diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp index 4e6c207da1..de0a589745 100644 --- a/3d-viewer/3d_canvas.cpp +++ b/3d-viewer/3d_canvas.cpp @@ -225,16 +225,34 @@ float spin_quat[4]; if ( event.m_wheelRotation ) { - if ( event.GetWheelRotation() > 0 ) - { - g_Parm_3D_Visu.m_Zoom /= 1.4; - if ( g_Parm_3D_Visu.m_Zoom <= 0.01) - g_Parm_3D_Visu.m_Zoom = 0.01; - } - - else g_Parm_3D_Visu.m_Zoom *= 1.4; - DisplayStatus(); - Refresh(FALSE); + if( event.ShiftDown() ) { + if ( event.GetWheelRotation() < 0 ) { + /* up */ + SetView3D(WXK_UP); + } else { + /* down */ + SetView3D(WXK_DOWN); + } + } else if( event.ControlDown() ) { + if ( event.GetWheelRotation() > 0 ) { + /* right */ + SetView3D(WXK_RIGHT); + } else { + /* left */ + SetView3D(WXK_LEFT); + } + } + else { + if ( event.GetWheelRotation() > 0 ) + { + g_Parm_3D_Visu.m_Zoom /= 1.4; + if ( g_Parm_3D_Visu.m_Zoom <= 0.01) + g_Parm_3D_Visu.m_Zoom = 0.01; + } + else g_Parm_3D_Visu.m_Zoom *= 1.4; + DisplayStatus(); + Refresh(FALSE); + } } if (event.Dragging()) @@ -582,6 +600,8 @@ bool fmt_is_jpeg = FALSE; ); if ( FullFileName.IsEmpty() ) return; } + + wxYield(); // Requested to allow tne window redraw after closing the dialog box wxSize image_size = GetClientSize(); wxClientDC dc(this); wxBitmap bitmap(image_size.x, image_size.y ); diff --git a/3d-viewer/3d_read_mesh.cpp b/3d-viewer/3d_read_mesh.cpp index 10b9c5fe73..a1792aef68 100644 --- a/3d-viewer/3d_read_mesh.cpp +++ b/3d-viewer/3d_read_mesh.cpp @@ -49,6 +49,8 @@ int LineNum = 0; return -1; } + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); while ( GetLine(file, line, &LineNum, 512) ) { text = strtok(line, " \t\n\r"); @@ -68,6 +70,7 @@ int LineNum = 0; } fclose (file); + setlocale(LC_NUMERIC, ""); // revert to the current locale return 0; } @@ -130,44 +133,44 @@ S3D_Material * material = NULL; if ( stricmp (text, "diffuseColor") == 0 ) { text = strtok(NULL," \t\n\r"); - material->m_DiffuseColor.x = atof(from_point(text)); + material->m_DiffuseColor.x = atof(text); text = strtok(NULL," \t\n\r"); - material->m_DiffuseColor.y = atof(from_point(text)); + material->m_DiffuseColor.y = atof(text); text = strtok(NULL," \t\n\r"); - material->m_DiffuseColor.z = atof(from_point(text)); + material->m_DiffuseColor.z = atof(text); } else if ( stricmp (text, "emissiveColor") == 0 ) { text = strtok(NULL," \t\n\r"); - material->m_EmissiveColor.x = atof(from_point(text)); + material->m_EmissiveColor.x = atof(text); text = strtok(NULL," \t\n\r"); - material->m_EmissiveColor.y = atof(from_point(text)); + material->m_EmissiveColor.y = atof(text); text = strtok(NULL," \t\n\r"); - material->m_EmissiveColor.z = atof(from_point(text)); + material->m_EmissiveColor.z = atof(text); } else if ( strnicmp (text, "specularColor", 13 ) == 0 ) { text = strtok(NULL," \t\n\r"); - material->m_SpecularColor.x = atof(from_point(text)); + material->m_SpecularColor.x = atof(text); text = strtok(NULL," \t\n\r"); - material->m_SpecularColor.y = atof(from_point(text)); + material->m_SpecularColor.y = atof(text); text = strtok(NULL," \t\n\r"); - material->m_SpecularColor.z = atof(from_point(text)); + material->m_SpecularColor.z = atof(text); } else if ( strnicmp (text, "ambientIntensity", 16 ) == 0 ) { text = strtok(NULL," \t\n\r"); - material->m_AmbientIntensity = atof(from_point(text)); + material->m_AmbientIntensity = atof(text); } else if ( strnicmp (text, "transparency", 12 ) == 0 ) { text = strtok(NULL," \t\n\r"); - material->m_Transparency = atof(from_point(text)); + material->m_Transparency = atof(text); } else if ( strnicmp (text, "shininess", 9 ) == 0 ) { text = strtok(NULL," \t\n\r"); - material->m_Shininess = atof(from_point(text)); + material->m_Shininess = atof(text); } } } @@ -323,7 +326,7 @@ char string_num[512]; case ',': jj = 0; if ( ! StartData || !HasData) break; - data_list[ii] = atof(from_point(string_num)); + data_list[ii] = atof(string_num); string_num[jj] = 0; ii++; if ( ii >= nn ) @@ -463,7 +466,7 @@ int * index = NULL; while ( text ) { if ( *text == ']') break; - jj = atoi(from_point(text)); + jj = atoi(text); if ( jj < 0 ) { S3D_Vertex * curr_coord = coords; diff --git a/3d-viewer/makefile.gtk b/3d-viewer/makefile.gtk index dd843890c1..d094d942d9 100644 --- a/3d-viewer/makefile.gtk +++ b/3d-viewer/makefile.gtk @@ -4,7 +4,7 @@ CC = gcc # Compiler flags. CPPFLAGS = -Wall -O2 -DPCBNEW -I../pcbnew -I ../include -I../common\ - `wx-config --cxxflags` + `wx-config --cxxflags` -fno-strict-aliasing include ../libs.linux @@ -23,6 +23,7 @@ $(TARGET).a: $(OBJECTS3D) makefile.gtk makefile.include ar -rv $@ $(OBJECTS3D) ranlib $@ +install:$(TARGET).a clean: rm -f *.o diff --git a/3d-viewer/makefile.include b/3d-viewer/makefile.include index 45644ea331..c205d71419 100644 --- a/3d-viewer/makefile.include +++ b/3d-viewer/makefile.include @@ -1,17 +1,11 @@ EXTRALIBS = EXTRACPPFLAGS= -I./ -I../include -I../common -I../pcbnew +CPPFLAGS += $(EXTRACPPFLAGS) + OBJECTS3D = 3d_frame.o 3d_read_mesh.o 3d_canvas.o trackball.o 3d_aux.o\ 3d_draw.o 3d_toolbar.o 3d_class.o - -OBJECTS= ../common/trigo.o - -AUXLIBS= -mthreads -o $(TARGET)$(DLLSUFF)\ - $(WXLIB_BASE) $(LIBS3D)\ - -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm\ - -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 - 3d_class.o: 3d_class.cpp 3d_struct.h 3d_viewer.h 3d_read_mesh.o: 3d_read_mesh.cpp 3d_struct.h 3d_viewer.h diff --git a/3d-viewer/makefile.macosx b/3d-viewer/makefile.macosx index 84f622cd50..37067475c7 100644 --- a/3d-viewer/makefile.macosx +++ b/3d-viewer/makefile.macosx @@ -5,6 +5,7 @@ CC = gcc CPPFLAGS = -Wall -O2 -DPCBNEW -I../pcbnew -I ../include -I../common\ `wx-config --cxxflags` +CPPFLAGS += -arch i386 -arch ppc include ../libs.macosx diff --git a/bitmaps/directory.xpm b/bitmaps/directory.xpm new file mode 100644 index 0000000000..465c5edd68 --- /dev/null +++ b/bitmaps/directory.xpm @@ -0,0 +1,160 @@ +/* XPM */ +#ifndef XPMMAIN +extern char * directory_xpm[]; + +#else +char * directory_xpm[] = { +"16 16 136 2", +" c None", +". c #469FFF", +"+ c #4193FF", +"@ c #4499FF", +"# c #2C63AC", +"$ c #4DA0FF", +"% c #B5D9FB", +"& c #AAD3FB", +"* c #ADD3FB", +"= c #89C4FF", +"- c #184888", +"; c #4495FF", +"> c #AED5FB", +", c #6DB3F9", +"' c #6FB2F9", +") c #6BAEF8", +"! c #67ABF6", +"~ c #549FF9", +"{ c #3E91FF", +"] c #ACD4FB", +"^ c #6BAEF9", +"/ c #6CAFF8", +"( c #66AAF7", +"_ c #5DA3F6", +": c #74AEF7", +"< c #9EC4F8", +"[ c #92BCF7", +"} c #8DB5F5", +"| c #88B1F3", +"1 c #83ABF2", +"2 c #80A8F0", +"3 c #87AEF5", +"4 c #0940B7", +"5 c #AAD2FB", +"6 c #67ACF8", +"7 c #68ABF8", +"8 c #61A4F7", +"9 c #5B9FF5", +"0 c #5399F3", +"a c #498FF1", +"b c #3F85EF", +"c c #367CEB", +"d c #2E73E8", +"e c #286BE6", +"f c #2164E2", +"g c #2163E5", +"h c #023AB6", +"i c #4394FF", +"j c #A7D0FA", +"k c #63A9F7", +"l c #61A7F7", +"m c #5BA0F6", +"n c #5499F4", +"o c #4B90F2", +"p c #4186EF", +"q c #377DEB", +"r c #2E73E7", +"s c #266AE5", +"t c #2062E2", +"u c #1C5DDF", +"v c #1A5CE2", +"w c #A4CEF9", +"x c #5DA5F7", +"y c #5DA1F6", +"z c #559AF4", +"A c #4C91F3", +"B c #4489F1", +"C c #3A7FED", +"D c #3075E9", +"E c #276BE5", +"F c #2062E1", +"G c #1B5CDE", +"H c #1758DB", +"I c #1857DE", +"J c #0239B6", +"K c #A1CBF9", +"L c #589FF6", +"M c #559BF5", +"N c #4F96F3", +"O c #478CF2", +"P c #3D84F0", +"Q c #3378EB", +"R c #2B6EE7", +"S c #2265E3", +"T c #1C5DDE", +"U c #1757DB", +"V c #1554DA", +"W c #1555DD", +"X c #0139B5", +"Y c #4696FF", +"Z c #FFFFFF", +"` c #FBFBFB", +" . c #F2F2F2", +".. c #E9E9E9", +"+. c #E0E0E0", +"@. c #D7D7D7", +"#. c #D4D4D4", +"$. c #A9A9A9", +"%. c #BABABA", +"&. c #9E9990", +"*. c #0A3DAF", +"=. c #FEFEFE", +"-. c #F8F8F8", +";. c #F1F1F1", +">. c #E8E8E8", +",. c #DCDCDC", +"'. c #D6D6D6", +"). c #D2D2D2", +"!. c #A7A7A7", +"~. c #B7B7B7", +"{. c #929292", +"]. c #BAB6AC", +"^. c #0E41B3", +"/. c #F0F0F0", +"(. c #E5E5E5", +"_. c #DDDDDD", +":. c #D3D3D3", +"<. c #D0D0D0", +"[. c #ABABAB", +"}. c #B5B5B5", +"|. c #939393", +"1. c #ADADAD", +"2. c #938E85", +"3. c #0A3DAE", +"4. c #FFFFFE", +"5. c #F4F4F4", +"6. c #EDEDED", +"7. c #DBDBDB", +"8. c #AEAEAE", +"9. c #969696", +"0. c #878787", +"a. c #AFABA1", +"b. c #0D40B2", +"c. c #0037B2", +"d. c #0034A8", +"e. c #0038B6", +" ", +" . + @ # ", +" $ % & * = - ", +"; > , ' ) ! ~ { + + + + + . ", +"; ] ^ / ( _ : < [ } | 1 2 3 4 ", +"; 5 6 7 8 9 0 a b c d e f g h ", +"i j k l m n o p q r s t u v h ", +"i w x y z A B C D E F G H I J ", +"i K L M N O P Q R S T U V W X ", +"Y Z Z Z Z ` ...+.@.#.$.%.&.*. ", +"Y Z Z =.-.;.>.,.'.).!.~.{.].^. ", +"Y Z =.-./.(._.:.<.[.}.|.1.2.3. ", +"Y 4.5.6.(.7.#.<.1.8.9.!.0.a.b. ", +" c.d.d.d.d.d.d.d.d.d.d.d.e. ", +" ", +" "}; +#endif diff --git a/bitmaps/icon_python.xpm b/bitmaps/icon_python.xpm new file mode 100644 index 0000000000..7a9901c64c --- /dev/null +++ b/bitmaps/icon_python.xpm @@ -0,0 +1,113 @@ +/* XPM */ +#ifndef XPMMAIN +extern char * icon_python_xpm[]; + +#else +char * icon_python_xpm[] = { +"32 32 72 1", +" c None", +". c #7EA5C6", +"+ c #6495BD", +"@ c #4383B6", +"# c #437FB2", +"$ c #6491B5", +"% c #7DA1BF", +"& c #3882BE", +"* c #387CB5", +"= c #3779AF", +"- c #3776AB", +"; c #4988BB", +"> c #CDDFEE", +", c #F7F7FF", +"' c #82ADD1", +") c #3773A5", +"! c #7096B5", +"~ c #4385BB", +"{ c #FFFFFF", +"] c #F6F5F5", +"^ c #3C729E", +"/ c #9BBDDA", +"( c #366D9C", +"_ c #387FBA", +": c #5A91BF", +"< c #376A94", +"[ c #FFED60", +"} c #FFE659", +"| c #F8E16E", +"1 c #FFEB5E", +"2 c #FFE354", +"3 c #4489C0", +"4 c #3885C3", +"5 c #FFDB4C", +"6 c #FBCE47", +"7 c #FFD544", +"8 c #72A0C5", +"9 c #507CA1", +"0 c #FFE052", +"a c #FFD040", +"b c #F5D98D", +"c c #7F9EB8", +"d c #F1ECDA", +"e c #FFCC3B", +"f c #FBC840", +"g c #FBD54F", +"h c #FCC539", +"i c #4379A7", +"j c #DCE1E7", +"k c #FAE262", +"l c #FFC532", +"m c #FBC037", +"n c #80A6C6", +"o c #FFBC29", +"p c #F7CD74", +"q c #427DAE", +"r c #FABE40", +"s c #FFB521", +"t c #497FAC", +"u c #FFCD57", +"v c #FFE097", +"w c #FFD67B", +"x c #FFD849", +"y c #FFFBF2", +"z c #F7DE92", +"A c #FFCF6A", +"B c #FFEDC8", +"C c #FFE4AC", +"D c #F7D284", +"E c #FFB531", +"F c #F7D47B", +"G c #FDBE2E", +" ", +" ", +" .+@###$% ", +" &&&**==--- ", +" ;&>,'*===))))! ", +" ~&{{]==--))))^ ", +" &&'/@===)))((( ", +" __**===)))(((( ", +" ((((( ", +" :&&&**====)))(((<<[[}}| ", +" &&&&&**===)))(((<<<11}22 ", +" 34&__***---))(((<<<<222556 ", +" 4&&&**====)))((<<<<<225557 ", +" 84&&***==--))(((<<<<900577ab ", +" ~&&&**===)))(((<<< c #3880BC", +", c #4A8AC0", +"' c #538DBD", +") c #3779AF", +"! c #3774A8", +"~ c #3772A3", +"{ c #366D9C", +"] c #366C9A", +"^ c #799785", +"/ c #FFEA5C", +"( c #FCE464", +"_ c #3883BF", +": c #387EB7", +"< c #387AB1", +"[ c #366E9E", +"} c #376A94", +"| c #9BA876", +"1 c #FFE658", +"2 c #FFDF50", +"3 c #4B8EC4", +"4 c #3882BE", +"5 c #387AB2", +"6 c #3778AE", +"7 c #3775A9", +"8 c #A1AA77", +"9 c #FFDE50", +"0 c #FFD848", +"a c #FCD55B", +"b c #3B81BB", +"c c #3880BB", +"d c #387BB4", +"e c #3776AA", +"f c #376B96", +"g c #7E9CB2", +"h c #FADE70", +"i c #FFD646", +"j c #FFCF3E", +"k c #FDC93C", +"l c #3B80B9", +"m c #387CB5", +"n c #6393BB", +"o c #F3E486", +"p c #FFED60", +"q c #FFE85B", +"r c #FFE253", +"s c #FFDA4A", +"t c #FFD545", +"u c #FFCD3C", +"v c #FFC734", +"w c #FEC433", +"x c #508ABB", +"y c #3776AB", +"z c #9AAD84", +"A c #FFE558", +"B c #FFE152", +"C c #FFD342", +"D c #FFCB3A", +"E c #FFC532", +"F c #FFC330", +"G c #FCC242", +"H c #9BB082", +"I c #FFEB5E", +"J c #FFE659", +"K c #FFE052", +"L c #FFD241", +"M c #FFC02E", +"N c #FFBA27", +"O c #4379A7", +"P c #C0C273", +"Q c #FFDE4F", +"R c #FFDB4C", +"S c #FFD040", +"T c #FFCC3B", +"U c #FFCE54", +"V c #FFC540", +"W c #FDBE30", +"X c #F9DA70", +"Y c #FFD645", +"Z c #FFC836", +"` c #FFEEC9", +" . c #FFD37B", +".. c #F9C95E", +"+. c #FCCC4D", +"@. c #FEC232", +"#. c #FFBC29", +"$. c #FCBD3D", +" ", +" . + @ # ", +" $ % & * = - - ; ", +" > , ' ) ! ~ { { ", +" { ] ^ / ( ", +" _ > : < = - [ ] } | 1 2 ", +" 3 4 : 5 6 7 ~ { } } 8 9 0 a ", +" b c d ) e - { f } g h i j k ", +" l m * n o p p q r s t u v w ", +" x * y z p p A B s C D E F G ", +" = ! H I J K 0 L D v M N ", +" O P 1 Q R ", +" r 9 s S T U V W ", +" X Y S Z E ` ... ", +" +.@.#.$. ", +" " +}; +#endif diff --git a/bitmaps/icon_txt.xpm b/bitmaps/icon_txt.xpm new file mode 100644 index 0000000000..3ee1803ebf --- /dev/null +++ b/bitmaps/icon_txt.xpm @@ -0,0 +1,125 @@ +/* XPM */ +#ifndef XPMMAIN +extern char * icon_txt_xpm[]; + +#else +char * icon_txt_xpm[] = { +"16 16 100 2", +" c None", +". c #AFAFAF", +"+ c #B8CEF8", +"@ c #B4CBF6", +"# c #9EBDF1", +"$ c #7CA5EA", +"% c #719EE6", +"& c #6697E2", +"* c #5B8FDE", +"= c #5088DA", +"- c #4581D6", +"; c #3A7AD2", +"> c #3072CE", +", c #256BCA", +"' c #F2F6FD", +") c #F1F5FD", +"! c #EFF4FC", +"~ c #EEF3FC", +"{ c #ECF1FA", +"] c #E9EFF8", +"^ c #E6ECF6", +"/ c #E3EAF5", +"( c #E0E8F2", +"_ c #DDE5F0", +": c #DBE3EF", +"< c #D8E1EC", +"[ c #FFFFFF", +"} c #FDFDFD", +"| c #FDE080", +"1 c #F2CC84", +"2 c #E0AB8A", +"3 c #F6F6F6", +"4 c #F5F5F5", +"5 c #F3F3F3", +"6 c #F0F0F0", +"7 c #FEFEFE", +"8 c #FCFBF8", +"9 c #FCE135", +"0 c #FFC729", +"a c #F6AB5E", +"b c #F2EBE8", +"c c #F4F4F4", +"d c #F2F2F2", +"e c #EDEDED", +"f c #FDE394", +"g c #FFDB35", +"h c #FFC340", +"i c #EAA871", +"j c #EAEAEA", +"k c #FCFCFC", +"l c #FDE24E", +"m c #FFCC36", +"n c #FCAC4C", +"o c #EEE1D8", +"p c #F1F1F1", +"q c #ECECEC", +"r c #FCE8B2", +"s c #FFE458", +"t c #FFCD55", +"u c #EDAA6D", +"v c #EEEEEE", +"w c #FEE473", +"x c #FFD861", +"y c #FDC16A", +"z c #EAD4C5", +"A c #F7E8C4", +"B c #FEEB80", +"C c #FFD871", +"D c #EFB579", +"E c #EEEEEF", +"F c #E3E3E6", +"G c #DDDDE1", +"H c #EDEDEE", +"I c #FCDF8D", +"J c #FFE389", +"K c #FED58A", +"L c #E7C8B2", +"M c #ECECED", +"N c #E1E1E4", +"O c #DBDBE0", +"P c #F7D090", +"Q c #FFEAB7", +"R c #ECB989", +"S c #E0E0E4", +"T c #DCDCE1", +"U c #E0B98F", +"V c #E2AD8A", +"W c #DBD1D1", +"X c #DDDDE2", +"Y c #DFDFE3", +"Z c #FBFBFB", +"` c #F9F9F9", +" . c #F8F8F8", +".. c #D3A78A", +"+. c #DFD9DA", +"@. c #E0E0E5", +"#. c #E4E4E8", +"$. c #EEEEF0", +"%. c #F7F7F7", +"&. c #E6E6E6", +" . . . . . . . . . . . . . . ", +" . + @ # $ % & * = - ; > , . ", +" . ' ) ! ~ { ] ^ / ( _ : < . ", +" . [ [ [ [ } | 1 2 3 4 5 6 . ", +" . [ [ [ 7 8 9 0 a b c d e . ", +" . [ [ 7 } f g h i c 5 6 j . ", +" . [ [ 7 k l m n o c p q q . ", +" . [ 7 } r s t u c d v v v . ", +" . } } k w x y z p 6 6 6 6 . ", +" . d 5 A B C D d d E F G H . ", +" . 5 5 I J K L M N O O O F . ", +" . 4 4 P Q R S T T . . . . . ", +" . 3 3 U V W X X Y . Z k ` . ", +" . . ...+.@.#.$.%.. d v . ", +" . ` ` ` ` ` ` ` ` . &.. ", +" . . . . . . . . . . . "}; + +#endif diff --git a/bitmaps/new_txt.xpm b/bitmaps/new_txt.xpm new file mode 100644 index 0000000000..609dc757d8 --- /dev/null +++ b/bitmaps/new_txt.xpm @@ -0,0 +1,102 @@ +/* XPM */ +#ifndef XPMMAIN +extern char * new_txt_xpm[]; + +#else +char * new_txt_xpm[] = { +"16 16 78 1", +" c None", +". c #000000", +"+ c #FEFEFE", +"@ c #090909", +"# c #EEEEEE", +"$ c #F1F1F1", +"% c #FBFBFB", +"& c #FBE291", +"* c #F2CC84", +"= c #E2B497", +"- c #F3F3F3", +"; c #767676", +"> c #F3F2F1", +", c #FCE135", +"' c #FFC729", +") c #F6AB5E", +"! c #F1EBE9", +"~ c #F0F0F0", +"{ c #161616", +"] c #FCE397", +"^ c #FFDB35", +"/ c #FFC340", +"( c #EAA871", +"_ c #EFEFEF", +": c #C4C4C4", +"< c #F6F6F6", +"[ c #FDE24E", +"} c #FFCC36", +"| c #FCAC4C", +"1 c #EEE2D9", +"2 c #ECECEC", +"3 c #FBE8B5", +"4 c #FFE458", +"5 c #FFCD55", +"6 c #EDAA6D", +"7 c #EBEBEB", +"8 c #FEE473", +"9 c #FFD861", +"0 c #FDC16A", +"a c #EADBD1", +"b c #EDEDED", +"c c #EAEAEA", +"d c #F4E9CE", +"e c #FEEB80", +"f c #FFD871", +"g c #EFB579", +"h c #E9E9E9", +"i c #E8E8E8", +"j c #E3E3E6", +"k c #DDDDE1", +"l c #FDFDFD", +"m c #FBDF8D", +"n c #FFE389", +"o c #FED58A", +"p c #E7C8B2", +"q c #E2E2E5", +"r c #DEDEE2", +"s c #DFDFE2", +"t c #E7E7E7", +"u c #FCFCFC", +"v c #F7D090", +"w c #FFEAB7", +"x c #ECB989", +"y c #E0E0E4", +"z c #DCDCE1", +"A c #E6E6E6", +"B c #E5E5E5", +"C c #E0B98F", +"D c #E2AD8A", +"E c #DBD1D1", +"F c #DDDDE2", +"G c #E0E0E3", +"H c #E4E4E4", +"I c #DBBDA9", +"J c #E0DBDC", +"K c #E1E1E6", +"L c #E5E5E8", +"M c #E3E3E3", +" ............ ", +".++++++++++@+. ", +".+###$$$$$$@%+. ", +".+###&*=-$$@;++.", +".+##>,')!$~@@@{.", +".+#~]^/(-___##:.", +".+#<[}|1_####2:.", +".+#3456~#####7:.", +".+-890a222bccc:.", +".+defghihjkhii:.", +".lmnop7qkrsttt:.", +".uvwxyzzAAAAAB:.", +".uCDEFFGAABBHH:.", +".lIJKL####HMMM:.", +".::::::::::::::.", +" .............. "}; +#endif diff --git a/common/base_screen.cpp b/common/base_screen.cpp index c5057ee5c9..d18432e0f2 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -64,7 +64,7 @@ void BASE_SCREEN::InitDatas(void) case CVPCB_DISPLAY_FRAME: case MODULE_EDITOR_FRAME: case PCB_FRAME: - m_CurrentSheet = &g_Sheet_A3; + m_CurrentSheet = &g_Sheet_A4; break; case GERBER_FRAME: @@ -98,7 +98,22 @@ void BASE_SCREEN::InitDatas(void) m_FlagSave = 1; // indique sauvegarde auto faite } - + +/******************************************************************/ +wxPoint BASE_SCREEN::CursorRealPosition(const wxPoint & ScreenPos) +/******************************************************************/ +{ +wxPoint curpos; + + curpos.x = ScreenPos.x * GetZoom(); + curpos.y = ScreenPos.y * GetZoom(); + + curpos.x += m_DrawOrg.x; + curpos.y += m_DrawOrg.y; + + return curpos; +} + /***************************************/ int BASE_SCREEN::GetInternalUnits(void) /***************************************/ diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 0bfae13348..c97fd316c3 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -12,8 +12,8 @@ #include "common.h" #include "wxstruct.h" #include "base_struct.h" -#include "grfonte.h" - +#include "grfonte.h" + #include "macros.h" @@ -65,7 +65,7 @@ wxT("lib cmp draw line"), wxT("lib cmp pin"), wxT("lib cmp field"), wxT("unknown"), -wxT("unknown") +wxT("unknown") }; @@ -84,32 +84,32 @@ EDA_BaseStruct::EDA_BaseStruct(EDA_BaseStruct * parent, int idType) m_StructType = idType; m_Parent = parent; /* Chainage hierarchique sur struct racine */ } - + /********************************************/ EDA_BaseStruct::EDA_BaseStruct(int idType) /********************************************/ -{ +{ InitVars(); m_StructType = idType; } - + /********************************************/ -void EDA_BaseStruct::InitVars(void) +void EDA_BaseStruct::InitVars(void) /********************************************/ -{ +{ m_StructType = TYPE_NOT_INIT; Pnext = NULL; /* Linked list: Link (next struct) */ Pback = NULL; /* Linked list: Link (previous struct) */ m_Parent = NULL; /* Linked list: Link (parent struct) */ - m_Son = NULL; /* Linked list: Link (son struct) */ + m_Son = NULL; /* Linked list: Link (son struct) */ m_Image = NULL; /* Link to an image copy for undelete or abort command */ m_Flags = 0; /* flags for editions and other */ m_TimeStamp = 0; // Time stamp used for logical links m_Status = 0; m_Selected = 0; /* Used by block commands, and selective editing */ -} - +} + /* Gestion de l'etat (status) de la structure (active, deleted..) */ int EDA_BaseStruct::GetState(int type) @@ -136,20 +136,20 @@ addition d'une nouvelle struct a la liste chain laststruct->Pnext = this; } - + /**************************************************************************************/ -void EDA_BaseStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, - int draw_mode, int Color) -/**************************************************************************************/ -/* Virtual +void EDA_BaseStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, + int draw_mode, int Color) +/**************************************************************************************/ +/* Virtual */ -{ - wxString msg, name; - msg.Printf( wxT("EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented ("), - m_StructType); - msg += ReturnClassName() + wxT(")\n"); - printf ( CONV_TO_UTF8(msg)); -} +{ + wxString msg, name; + msg.Printf( wxT("EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented ("), + m_StructType); + msg += ReturnClassName() + wxT(")\n"); + printf ( CONV_TO_UTF8(msg)); +} #if 0 /**************************************************************/ @@ -219,20 +219,20 @@ EDA_TextStruct::~EDA_TextStruct(void) } m_TextDrawingsSize = 0; /* nombre de sommets a dessiner */ } - -/********************************/ -int EDA_TextStruct::Len_Size(void) -/********************************/ -// Return the text lenght in internal units -{ -int nbchar = m_Text.Len(); -int len; - if ( nbchar == 0 ) return 0; - - len = ((10 * m_Size.x ) / 9) * nbchar; - return len; -} - + +/********************************/ +int EDA_TextStruct::Len_Size(void) +/********************************/ +// Return the text lenght in internal units +{ +int nbchar = m_Text.Len(); +int len; + if ( nbchar == 0 ) return 0; + + len = ((10 * m_Size.x ) / 9) * nbchar; + return len; +} + /*************************************************/ int EDA_TextStruct::Locate(const wxPoint & posref) @@ -302,7 +302,7 @@ int width; m_TextDrawings[2] + offset.y + m_Pos.y, m_TextDrawings[3] + offset.x + m_Pos.x, m_TextDrawings[4] + offset.y + m_Pos.y, - color); + width, color); } else @@ -317,9 +317,9 @@ int width; int cY = m_Pos.y - offset.y; /* trace ancre du texte */ GRLine(&panel->m_ClipBox, DC, cX - anchor_size, cY, - cX + anchor_size, cY, anchor_color); + cX + anchor_size, cY, 0, anchor_color); GRLine(&panel->m_ClipBox, DC, cX, cY - anchor_size , - cX, cY + anchor_size , anchor_color); + cX, cY + anchor_size , 0, anchor_color); } jj = 5; ii = jj+1; while (ii < m_TextDrawingsSize) @@ -352,7 +352,7 @@ int width; } } else - GRPoly(&panel->m_ClipBox, DC, nbpoints, coord, 0, color, color); + GRPoly(&panel->m_ClipBox, DC, nbpoints, coord, 0, 0, color, color); } } @@ -377,7 +377,7 @@ int ii, jj, kk,nbchar, nbpoints, AsciiCode, endcar; int k1 , k2 , x0 , y0 ; int size_h , size_v , espacement ; char f_cod , plume = 'U'; -const wxChar * ptr; +const wxChar * ptr; const SH_CODE * ptcar; int ux0, uy0, dx, dy; // Coord de trace des segments de texte & variables de calcul */ int cX, cY; // Centre du texte diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 7ec32250ac..0f98f65b3a 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -29,7 +29,7 @@ wxSize minsize; SetFont(*g_StdFont); m_MenuBar = NULL; // menu du haut d'ecran m_HToolBar = NULL; - m_FrameIsActive = FALSE; + m_FrameIsActive = TRUE; m_MsgFrameHeight = MSG_PANEL_DEFAULT_HEIGHT; minsize.x = 470; diff --git a/common/block_commande.cpp b/common/block_commande.cpp index 177470d862..695b9200df 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -112,10 +112,10 @@ void DrawBlockStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC) int h = GetHeight()/panel->GetZoom(); if ( w == 0 || h == 0 ) GRLine(&panel->m_ClipBox, DC, GetX(), GetY(), - GetRight(), GetBottom(), m_Color); + GetRight(), GetBottom(), 0, m_Color); else GRRect(&panel->m_ClipBox, DC, GetX(), GetY(), - GetRight(), GetBottom(), m_Color); + GetRight(), GetBottom(), 0, m_Color); } /*************************************************************************/ diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index ab3a3dc86e..a71f6c54f0 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -1,206 +1,207 @@ - /******************************************/ - /* Kicad: Common plot HPGL Routines */ - /******************************************/ - -#include "fctsys.h" -#include "gr_basic.h" -#include "trigo.h" -#include "wxstruct.h" -#include "base_struct.h" -#include "common.h" -#include "plot_common.h" -#include "macros.h" - -/* parametre HPGL pour trace de cercle: */ -#define CHORD_ANGLE 10 - -// Variables partagees avec Common plot Postscript Routines -extern wxPoint LastPenPosition; -extern wxPoint PlotOffset; -extern FILE * PlotOutputFile; -extern double XScale, YScale; -extern int PenWidth; -extern int PlotOrientOptions, etat_plume; - -//Variables locales -void Move_Plume_HPGL( wxPoint pos, int plume ); -void Plume_HPGL( int plume ); - - -/***********************************************************************************/ -void InitPlotParametresHPGL(wxPoint offset, double xscale, double yscale, int orient) -/***********************************************************************************/ -/* Set the plot offset for the current plotting - xscale,yscale = coordinate scale (scale coefficient for coordinates) - device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device) -*/ -{ - PlotOffset = offset; - XScale = xscale; - YScale = yscale; - PenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */ - PlotOrientOptions = orient; -} - - - -/*****************************************************************/ -bool PrintHeaderHPGL(FILE * plot_file, int pen_speed, int pen_num) -/*****************************************************************/ -{ -char Line[256]; - - PlotOutputFile = plot_file; - etat_plume = 'U'; - sprintf(Line,"IN;VS%d;PU;PA;SP%d;\n",pen_speed,pen_num); - fputs(Line,plot_file); - return TRUE; -} - -/**********************************/ -bool CloseFileHPGL(FILE * plot_file) -/**********************************/ -{ - fputs("PU;PA;SP0;\n",PlotOutputFile) ; fclose(PlotOutputFile) ; - fclose(plot_file); - return TRUE; -} - - -/************************************************************/ -void PlotCircle_HPGL(wxPoint centre, int diameter, int width) -/************************************************************/ -{ -int rayon; -char Line[256]; - - UserToDeviceCoordinate(centre); - rayon = (int)(diameter / 2 * XScale); - - if(rayon < 0 ) rayon = 0 ; - - Plume_HPGL('U'); - sprintf(Line,"PA %d,%d;CI %d,%d;\n", centre.x, centre.y, rayon , CHORD_ANGLE); - fputs(Line,PlotOutputFile) ; - - Plume_HPGL('U'); return ; -} - - -/********************************************************************/ -void PlotArcHPGL(wxPoint centre, int StAngle, int EndAngle, int rayon) -/********************************************************************/ -/* trace d'un arc de cercle: - centre = coord du centre - StAngle, EndAngle = angle de debut et fin - rayon = rayon de l'arc - commande - PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle, NbSegm; PU; - ou PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle; PU; -*/ -{ -char Line[256]; -wxPoint cmap; /* point de depart */ -wxPoint cpos; /* centre */ -float angle; /* angle de l'arc*/ - - if(rayon <= 0 ) return ; - - cpos = centre; UserToDeviceCoordinate(cpos); - - if( PlotOrientOptions == PLOT_MIROIR) - { - EndAngle = - EndAngle; - StAngle = - StAngle; - EXCHG (StAngle, EndAngle); - } - angle = (EndAngle - StAngle) /10.0; - /* Calcul des coord du point de depart : */ - cmap.x = (int)( centre.x + ( rayon * cos(StAngle * M_PI / 1800 ) ) ); - cmap.y = (int)(centre.y + ( rayon * sin(StAngle * M_PI / 1800 ) ) ); - UserToDeviceCoordinate(cmap); - - Plume_HPGL('U'); - sprintf(Line,"PU;PA %d,%d;PD;AA %d,%d, ", cmap.x, cmap.y, cpos.x, cpos.y); - fputs(Line,PlotOutputFile) ; - sprintf(Line,"%f", - angle); to_point(Line); // Transforme , et . du separateur - fputs(Line,PlotOutputFile) ; - sprintf(Line,", %d", CHORD_ANGLE); fputs(Line,PlotOutputFile) ; - sprintf(Line,";PU;\n"); fputs(Line,PlotOutputFile) ; - Plume_HPGL('U'); -} - - -/*****************************************************/ -void PlotPolyHPGL( int nb, int * coord, int fill) -/*****************************************************/ -/* Trace un polygone (ferme si rempli) en format HPGL - coord = tableau des coord des sommets - nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau ) - fill : si != 0 polygone rempli -*/ -{ -int ii; - if( nb <= 1 ) return; - - Move_Plume_HPGL( wxPoint(coord[0],coord[1]), 'U'); - for( ii = 1; ii < nb ; ii ++ ) - { - Move_Plume_HPGL( wxPoint(coord[ii * 2],coord[(ii*2) +1]), 'D'); - } - - /* Fermeture eventuelle du polygone */ - if ( fill ) - { - ii = (nb - 1) * 2; - if( (coord[ii] != coord[0] ) || (coord[ii+1] != coord[0]) ) - Move_Plume_HPGL( wxPoint(coord[0],coord[1]), 'D'); - } - Plume_HPGL('U'); -} - - -/**********************************************/ -void Move_Plume_HPGL( wxPoint pos, int plume ) -/**********************************************/ -/* - deplace la plume levee (plume = 'U') ou baissee (plume = 'D') - en position x,y - Unites en Unites DESSIN - Si plume = 'Z' lever de plume sans deplacement -*/ -{ -char Line[256]; - - if ( plume == 'Z') - { - Plume_HPGL('U'); - return; - } - Plume_HPGL(plume); - UserToDeviceCoordinate(pos); - - sprintf(Line,"PA %d,%d;\n",pos.x,pos.y) ; fputs(Line,PlotOutputFile) ; -} - - -/***************************/ -void Plume_HPGL( int plume ) -/***************************/ -/* leve (plume = 'U') ou baisse (plume = 'D') la plume -*/ -{ - if ( plume == 'U') - { - if(etat_plume != 'U' ) fputs("PU;",PlotOutputFile) ; - etat_plume = 'U'; - } - else - { - if(etat_plume != 'D' )fputs("PD;",PlotOutputFile) ; - etat_plume = 'D'; - } -} - - - + /******************************************/ + /* Kicad: Common plot HPGL Routines */ + /******************************************/ + +#include "fctsys.h" +#include "gr_basic.h" +#include "trigo.h" +#include "wxstruct.h" +#include "base_struct.h" +#include "common.h" +#include "plot_common.h" +#include "macros.h" + +/* parametre HPGL pour trace de cercle: */ +#define CHORD_ANGLE 10 + +// Variables partagees avec Common plot Postscript Routines +extern wxPoint LastPenPosition; +extern wxPoint PlotOffset; +extern FILE * PlotOutputFile; +extern double XScale, YScale; +extern int g_DefaultPenWidth, g_CurrentPenWidth; +extern int PlotOrientOptions, etat_plume; + +//Variables locales +void Move_Plume_HPGL( wxPoint pos, int plume ); +void Plume_HPGL( int plume ); + + +/***********************************************************************************/ +void InitPlotParametresHPGL(wxPoint offset, double xscale, double yscale, int orient) +/***********************************************************************************/ +/* Set the plot offset for the current plotting + xscale,yscale = coordinate scale (scale coefficient for coordinates) + device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device) +*/ +{ + PlotOffset = offset; + XScale = xscale; + YScale = yscale; + g_DefaultPenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */ + PlotOrientOptions = orient; + g_CurrentPenWidth = -1; +} + + + +/*****************************************************************/ +bool PrintHeaderHPGL(FILE * plot_file, int pen_speed, int pen_num) +/*****************************************************************/ +{ +char Line[256]; + + PlotOutputFile = plot_file; + etat_plume = 'U'; + sprintf(Line,"IN;VS%d;PU;PA;SP%d;\n",pen_speed,pen_num); + fputs(Line,plot_file); + return TRUE; +} + +/**********************************/ +bool CloseFileHPGL(FILE * plot_file) +/**********************************/ +{ + fputs("PU;PA;SP0;\n",plot_file); + fclose(plot_file); + return TRUE; +} + + +/************************************************************/ +void PlotCircle_HPGL(wxPoint centre, int diameter, int width) +/************************************************************/ +{ +int rayon; +char Line[256]; + + UserToDeviceCoordinate(centre); + rayon = (int)(diameter / 2 * XScale); + + if(rayon < 0 ) rayon = 0 ; + + Plume_HPGL('U'); + sprintf(Line,"PA %d,%d;CI %d,%d;\n", centre.x, centre.y, rayon , CHORD_ANGLE); + fputs(Line,PlotOutputFile) ; + + Plume_HPGL('U'); return ; +} + + +/********************************************************************/ +void PlotArcHPGL(wxPoint centre, int StAngle, int EndAngle, int rayon, int width) +/********************************************************************/ +/* trace d'un arc de cercle: + centre = coord du centre + StAngle, EndAngle = angle de debut et fin + rayon = rayon de l'arc + commande + PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle, NbSegm; PU; + ou PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle; PU; +*/ +{ +char Line[256]; +wxPoint cmap; /* point de depart */ +wxPoint cpos; /* centre */ +float angle; /* angle de l'arc*/ + + if(rayon <= 0 ) return ; + + cpos = centre; UserToDeviceCoordinate(cpos); + + if( PlotOrientOptions == PLOT_MIROIR) + { + EndAngle = - EndAngle; + StAngle = - StAngle; + EXCHG (StAngle, EndAngle); + } + angle = (EndAngle - StAngle) /10.0; + /* Calcul des coord du point de depart : */ + cmap.x = (int)( centre.x + ( rayon * cos(StAngle * M_PI / 1800 ) ) ); + cmap.y = (int)(centre.y + ( rayon * sin(StAngle * M_PI / 1800 ) ) ); + UserToDeviceCoordinate(cmap); + + Plume_HPGL('U'); + sprintf(Line,"PU;PA %d,%d;PD;AA %d,%d, ", cmap.x, cmap.y, cpos.x, cpos.y); + fputs(Line,PlotOutputFile) ; + sprintf(Line,"%f", - angle); to_point(Line); // Transforme , et . du separateur + fputs(Line,PlotOutputFile) ; + sprintf(Line,", %d", CHORD_ANGLE); fputs(Line,PlotOutputFile) ; + sprintf(Line,";PU;\n"); fputs(Line,PlotOutputFile) ; + Plume_HPGL('U'); +} + + +/*****************************************************/ +void PlotPolyHPGL( int nb, int * coord, int fill, int width) +/*****************************************************/ +/* Trace un polygone (ferme si rempli) en format HPGL + coord = tableau des coord des sommets + nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau ) + fill : si != 0 polygone rempli +*/ +{ +int ii; + if( nb <= 1 ) return; + + Move_Plume_HPGL( wxPoint(coord[0],coord[1]), 'U'); + for( ii = 1; ii < nb ; ii ++ ) + { + Move_Plume_HPGL( wxPoint(coord[ii * 2],coord[(ii*2) +1]), 'D'); + } + + /* Fermeture eventuelle du polygone */ + if ( fill ) + { + ii = (nb - 1) * 2; + if( (coord[ii] != coord[0] ) || (coord[ii+1] != coord[0]) ) + Move_Plume_HPGL( wxPoint(coord[0],coord[1]), 'D'); + } + Plume_HPGL('U'); +} + + +/**********************************************/ +void Move_Plume_HPGL( wxPoint pos, int plume ) +/**********************************************/ +/* + deplace la plume levee (plume = 'U') ou baissee (plume = 'D') + en position x,y + Unites en Unites DESSIN + Si plume = 'Z' lever de plume sans deplacement +*/ +{ +char Line[256]; + + if ( plume == 'Z') + { + Plume_HPGL('U'); + return; + } + Plume_HPGL(plume); + UserToDeviceCoordinate(pos); + + sprintf(Line,"PA %d,%d;\n",pos.x,pos.y) ; fputs(Line,PlotOutputFile) ; +} + + +/***************************/ +void Plume_HPGL( int plume ) +/***************************/ +/* leve (plume = 'U') ou baisse (plume = 'D') la plume +*/ +{ + if ( plume == 'U') + { + if(etat_plume != 'U' ) fputs("PU;",PlotOutputFile) ; + etat_plume = 'U'; + } + else + { + if(etat_plume != 'D' )fputs("PD;",PlotOutputFile) ; + etat_plume = 'D'; + } +} + + + diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp index 427c1f1193..a0547d7b83 100644 --- a/common/common_plotPS_functions.cpp +++ b/common/common_plotPS_functions.cpp @@ -16,7 +16,7 @@ extern wxPoint LastPenPosition; extern wxPoint PlotOffset; extern FILE * PlotOutputFile; extern double XScale, YScale; -extern int PenWidth; +extern int g_DefaultPenWidth, g_CurrentPenWidth; extern int PlotOrientOptions, etat_plume; // Locales @@ -36,6 +36,7 @@ void InitPlotParametresPS(wxPoint offset, Ki_PageDescr * sheet, SheetPS = sheet; XScale = xscale; YScale = yscale; + g_CurrentPenWidth = -1; } /*************************************************************************************/ @@ -44,7 +45,23 @@ void SetDefaultLineWidthPS( int width) /* Set the default line width (in 1/1000 inch) for the current plotting */ { - PenWidth = width; /* epaisseur du trait standard en 1/1000 pouce */ + g_DefaultPenWidth = width; /* epaisseur du trait standard en 1/1000 pouce */ + g_CurrentPenWidth = -1; +} + +/***************************************/ +void SetCurrentLineWidthPS( int width) +/***************************************/ +/* Set the Current line width (in 1/1000 inch) for the next plot +*/ +{ +int pen_width; + + if ( width > 0 ) pen_width = width; + else pen_width = g_DefaultPenWidth; + if ( pen_width != g_CurrentPenWidth ) + fprintf(PlotOutputFile,"%d setlinewidth\n", (int)(XScale * pen_width)); + g_CurrentPenWidth = pen_width; } /******************************/ @@ -77,7 +94,7 @@ void PlotFilledSegmentPS(wxPoint start , wxPoint end, int width) UserToDeviceCoordinate(start); UserToDeviceCoordinate(end); - fprintf(PlotOutputFile,"%d setlinewidth\n", (int)(XScale * width)); + SetCurrentLineWidthPS(width); fprintf(PlotOutputFile,"%d %d %d %d line\n", start.x, start.y, end.x, end.y); } @@ -94,21 +111,16 @@ char Line[256]; if(rayon < 0 ) rayon = 0 ; - if ( width > 0 ) - { - sprintf(Line,"%d setlinewidth\n", (int)( width * XScale) ) ; - fputs(Line,PlotOutputFile); - } - + SetCurrentLineWidthPS(width); sprintf(Line,"newpath %d %d %d 0 360 arc stroke\n", pos.x, pos.y, rayon); fputs(Line,PlotOutputFile) ; } -/********************************************************************/ -void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon) -/********************************************************************/ +/**************************************************************************************/ +void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon, int width) +/**************************************************************************************/ /* Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree */ @@ -117,6 +129,7 @@ char Line[256]; if(rayon <= 0 ) return ; + SetCurrentLineWidthPS(width); /* Calcul des coord du point de depart : */ UserToDeviceCoordinate(centre); @@ -132,29 +145,11 @@ char Line[256]; } -/*****************************************************************************/ -void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon, int width) -/*****************************************************************************/ -/* trace d'un arc de cercle: - x, y = coord du centre - StAngle, EndAngle = angle de debut et fin - rayon = rayon de l'arc - w = epaisseur de l'arc -*/ -{ -char Line[256]; - - if(rayon <= 0 ) return ; - - sprintf(Line,"%d setlinewidth\n", (int) (width * XScale) ); - fputs(Line, PlotOutputFile); - PlotArcPS( centre, StAngle, EndAngle, rayon); -} -/***************************************************/ -void PlotPolyPS( int nb_segm, int * coord, int fill) -/***************************************************/ +/****************************************************************/ +void PlotPolyPS( int nb_segm, int * coord, int fill, int width) +/*****************************************************************/ /* Trace un polygone ( ferme si rempli ) en format POSTSCRIPT coord = tableau des coord des sommets nb_segm = nombre de coord ( 1 coord = 2 elements: X et Y du tableau ) @@ -166,6 +161,8 @@ wxPoint pos; if( nb_segm <= 1 ) return; + SetCurrentLineWidthPS(width); + pos.x = coord[0]; pos.y = coord[1]; UserToDeviceCoordinate(pos); fprintf(PlotOutputFile, "newpath %d %d moveto\n", pos.x, pos.y); @@ -275,7 +272,7 @@ time_t time1970 = time(NULL); fputs(Line,PlotOutputFile); // Set default line width: - fprintf(PlotOutputFile,"%d setlinewidth\n", PenWidth ); //PenWidth in user units + fprintf(PlotOutputFile,"%d setlinewidth\n", g_DefaultPenWidth ); //g_DefaultPenWidth in user units } diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index e3c10776ee..9ac92aafc9 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -18,13 +18,24 @@ wxPoint LastPenPosition; wxPoint PlotOffset; FILE * PlotOutputFile; double XScale, YScale; -int PenWidth; +int g_DefaultPenWidth; +int g_CurrentPenWidth = -1; int PlotOrientOptions, etat_plume; // Locales static Ki_PageDescr * SheetPS; +/*************************/ +void ForcePenReinit(void) +/*************************/ +/* set the flag g_CurrentPenWidth to -1 in order to force a pen width redefinition + for the next draw command +*/ +{ + g_CurrentPenWidth = -1; +} + /**********************************************/ void SetPlotScale(double xscale, double yscale) /**********************************************/ @@ -56,7 +67,8 @@ void InitPlotParametresGERBER(wxPoint offset, double xscale, double yscale) SheetPS = NULL; XScale = xscale; YScale = yscale; - PenWidth = 120; /* epaisseur du trait standard en 1/1000 pouce */ + g_DefaultPenWidth = 120; /* epaisseur du trait standard en 1/1000 pouce */ + g_CurrentPenWidth = -1; } @@ -74,7 +86,8 @@ wxSize PageSize; wxPoint pos, ref; int color; Ki_WorkSheetData * WsItem; -int conv_unit = screen->GetInternalUnits()/1000; +int conv_unit = screen->GetInternalUnits()/1000; /* Scale to convert dimension in 1/1000 in into internal units + (1/1000 inc for EESchema, 1/10000 for pcbnew */ wxString msg; wxSize text_size; void (*FctPlume)(wxPoint pos, int state); @@ -124,10 +137,10 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; text_size.x = WSTEXTSIZE * conv_unit; text_size.y = WSTEXTSIZE * conv_unit; - ref.x = Sheet->m_LeftMargin * conv_unit; - ref.y = Sheet->m_TopMargin * conv_unit; /* Upper left corner */ - xg = (PageSize.x - Sheet->m_RightMargin) * conv_unit; - yg = (PageSize.y - Sheet->m_BottomMargin) * conv_unit; /* lower right corner */ + ref.x = Sheet->m_LeftMargin; + ref.y = Sheet->m_TopMargin; /* Upper left corner in 1/1000 inch */ + xg = (PageSize.x - Sheet->m_RightMargin); + yg = (PageSize.y - Sheet->m_BottomMargin); /* lower right corner in 1/1000 inch */ /* Trace des reperes selon l'axe X */ ipas = (xg - ref.x) / PAS_REF; diff --git a/common/dcsvg.cpp b/common/dcsvg.cpp index f1aca3218d..713d78bf0b 100644 --- a/common/dcsvg.cpp +++ b/common/dcsvg.cpp @@ -137,9 +137,6 @@ void wxSVGFileDC::Init (wxString f, int Width, int Height, float dpi) s.Printf ( wxT("Clear(); text = m_List->GetStringSelection(); m_MoveFct(text); m_WinMsg->WriteText(text.GetData()); - } + } } /*******************************************************/ @@ -259,3 +261,10 @@ const wxString ** BufList; } +/****************************************************/ +void WinEDAListBox::OnKeyEvent(wxKeyEvent& event) +/****************************************************/ +{ + event.Skip(); +} + diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 8283e2622c..eb7e759dc1 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -170,7 +170,7 @@ bool sketch_mode = FALSE; dx += cX; dy = cY; RotatePoint(&ux0, &uy0, cX, cY, orient); RotatePoint(&dx, &dy, cX, cY, orient); - GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, gcolor); + GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, width, gcolor); return; } @@ -210,7 +210,7 @@ return; if(ii && (plume == 'D' ) ) { if ( width <= 1 ) - GRPoly(&panel->m_ClipBox, DC, ii /2, coord, 0, + GRPoly(&panel->m_ClipBox, DC, ii /2, coord, 0, 0, gcolor, gcolor); else if ( sketch_mode ) { @@ -222,8 +222,8 @@ return; } else - GRPolyLines(&panel->m_ClipBox, DC, ii /2, coord, - gcolor, gcolor, width); + GRPoly(&panel->m_ClipBox, DC, ii /2, coord, 0, + width, gcolor, gcolor); } plume = f_cod; ii = 0; break; diff --git a/common/eda_dde.cpp b/common/eda_dde.cpp index f8ca2c51d9..41d22393d2 100644 --- a/common/eda_dde.cpp +++ b/common/eda_dde.cpp @@ -1,7 +1,7 @@ - ////////////////////// - // Name: eda_dde.cc // - ////////////////////// + /////////////////////// + // Name: eda_dde.cpp // + /////////////////////// // For compilers that support precompilation, includes "wx/wx.h". #include @@ -21,13 +21,16 @@ #include "id.h" #include "common.h" +#include "macros.h" #define ID_CONN "CAO_COM" wxString HOSTNAME(wxT("localhost")); /* variables locales */ -#define IPC_BUF_SIZE 4000 + +// buffers for read and write data in socket connections +#define IPC_BUF_SIZE 4096 char client_ipc_buffer[IPC_BUF_SIZE]; char server_ipc_buffer[IPC_BUF_SIZE]; @@ -77,22 +80,24 @@ size_t len; wxSocketBase *sock = evt.GetSocket(); switch (evt.GetSocketEvent()) - { + { case wxSOCKET_INPUT: - sock->Read(server_ipc_buffer,1); - len = sock->Read(server_ipc_buffer+1,IPC_BUF_SIZE-2).LastCount(); - server_ipc_buffer[len+1] = 0; - if(RemoteFct ) RemoteFct(server_ipc_buffer); - break; + sock->Read(server_ipc_buffer,1); + if( sock->LastCount() == 0 ) break; // No data: Occurs on open connection + sock->Read(server_ipc_buffer+1,IPC_BUF_SIZE-2); + len = 1 + sock->LastCount(); + server_ipc_buffer[len] = 0; + if(RemoteFct ) RemoteFct(server_ipc_buffer); + break; - case wxSOCKET_LOST: + case wxSOCKET_LOST: return; break; - default: + default: wxPrintf( wxT("WinEDA_DrawFrame::OnSockRequest() error: Invalid event !")); break; - } + } } /**************************************************************/ @@ -120,12 +125,12 @@ wxSocketServer *server = (wxSocketServer *) evt.GetSocket(); /********************************************/ bool SendCommand( int service, char * cmdline) /********************************************/ -/* Fonction utilisee par un client pour envoyer une information a un serveur. - - Etablit une connection Socket Client - - envoie le contenu du buffer cmdline - - ferme la connexion +/* Used by a client to sent (by a socket connection) a data to a server. + - Open a Socket Client connection + - Send the buffer cmdline + - Close the socket connection - service contient le numéro de service en ascii. + service is the service number for the TC/IP connection */ { wxSocketClient * sock_client; diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 4d4687e85c..a6871aa8a9 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -8,6 +8,10 @@ #define EDA_BASE #define COMMON_GLOBL +#ifdef KICAD_PYTHON +#include +#endif + #include "fctsys.h" #include #include "wx/html/htmlwin.h" @@ -95,8 +99,6 @@ WinEDA_App::~WinEDA_App(void) delete g_ItalicFont; delete g_FixedFont; delete g_MsgFont; - delete DrawPen; - delete DrawBrush; if ( m_Checker ) delete m_Checker; delete m_Locale; } @@ -130,10 +132,6 @@ wxString EnvLang; m_EDA_Config = new wxConfig(name); m_EDA_CommonConfig = new wxConfig(wxT("kicad_common")); - /* Creation des outils de trace */ - DrawPen = new wxPen( wxT("GREEN"), 1, wxSOLID); - DrawBrush = new wxBrush(wxT("BLACK"), wxTRANSPARENT); - /* Creation des fontes utiles */ g_StdFontPointSize = FONT_DEFAULT_SIZE; g_MsgFontPointSize = FONT_DEFAULT_SIZE; @@ -166,6 +164,9 @@ 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 } @@ -590,3 +591,12 @@ wxMenuItem * item; } +int WinEDA_App::OnRun(void) +/* Run init scripts */ +{ + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->RunScripts(); + #endif + return wxApp::OnRun(); +} + diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 484e1b3e6e..78bc4e99e9 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -5,6 +5,7 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#include "wx/mimetype.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -276,6 +277,8 @@ wxString defaultpath = Path; defaultpath.Replace(wxT("/"), STRING_DIR_SEP); if ( defaultpath.IsEmpty() ) defaultpath = wxGetCwd(); + wxSetWorkingDirectory( defaultpath ); + fullfilename = wxFileSelector( wxString(Title), defaultpath, defaultname, @@ -415,12 +418,24 @@ wxString FullFileName; /***********************************************************************************/ int ExecuteFile(wxWindow * frame, const wxString & ExecFile, const wxString & param) /***********************************************************************************/ -/* appelle le logiciel ExecFile, avec les parametres filename +/* Call the executable file "ExecFile", with params "param" */ { wxString FullFileName; + +#ifdef __WXMAC__ + // Mac part + wxGetEnv("HOME", &FullFileName); + FullFileName += wxString("/bin/") + newExecFile; + if (! wxFileExists(FullFileName) ) + { + FullFileName = FindKicadFile(ExecFile); + } + +#else FullFileName = FindKicadFile(ExecFile); +#endif if ( wxFileExists(FullFileName) ) { @@ -429,7 +444,6 @@ wxString FullFileName; return 0; } - wxString msg; msg.Printf( wxT("Command file <%s> not found"), FullFileName.GetData() ); DisplayError(frame, msg, 20); @@ -569,3 +583,71 @@ wxString GetEditorName(void) } return g_EditorName; } + +void OpenPDF( const wxString & file ) +{ + wxString command; + wxString filename = file; + wxString type; + + EDA_Appl->ReadPdfBrowserInfos(); + if ( !EDA_Appl->m_PdfBrowserIsDefault ) + { + AddDelimiterString(filename); + command = EDA_Appl->m_PdfBrowser + filename; + } + else + { + bool success = false; + wxFileType * filetype = NULL; + + wxFileType::MessageParameters params(filename, type); + filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(wxT(".pdf")); + if (filetype ) success = filetype->GetOpenCommand( &command, params); + delete filetype; + + if (!success) + { + AddDelimiterString(filename); + command.Empty(); + wxString tries[] = + { + wxT("/usr/bin/evince"), + wxT("/usr/bin/xpdf"), + wxT("/usr/bin/konqueror"), + wxT("/usr/bin/gpdf"), + wxT(""), + }; + for ( int i = 0;; i++ ) + { + if (tries[i].IsEmpty()) break; + if (wxFileExists(tries[i])) + { + command = tries[i] + wxT(" ") + filename; + } + } + } + } + + if (!command.IsEmpty()) wxExecute(command); +} + + +void OpenFile( const wxString & file ) +{ + wxString command; + wxString filename = file; + + wxFileName CurrentFileName(filename); + wxString ext, type; + ext = CurrentFileName.GetExt(); + wxFileType * filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(ext); + + bool success = false; + + wxFileType::MessageParameters params(filename, type); + if (filetype) success = filetype->GetOpenCommand( &command, params); + delete filetype; + + if (success && !command.IsEmpty()) wxExecute(command); +} diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 533629d7c5..505ea4b254 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -31,8 +31,8 @@ static int xcliplo = 0, ycliphi = 2000; /* coord de la surface de trace */ static int lastcolor = -1; static int lastwidth = -1; +static int s_Last_Pen_Style = -1; static wxDC * lastDC = NULL; - /* Macro de clipping du trace d'une ligne: la ligne (x1,y1 x2,y2) est clippee pour rester dans le cadre @@ -217,7 +217,7 @@ void SetPenMinWidth(int minwidth) /* Routine de changement de couleurs et epaisseur de la plume courante */ -void GRSetColorPen(wxDC * DC, int Color , int width) +void GRSetColorPen(wxDC * DC, int Color , int width, int style) { Color &= MASKCOLOR; // Pour 32 couleurs Max @@ -225,17 +225,21 @@ void GRSetColorPen(wxDC * DC, int Color , int width) if( ForceBlackPen && Color != WHITE ) Color = BLACK; - if( (lastcolor != Color) || (lastwidth != width) || (lastDC != DC ) ) + if( (lastcolor != Color) || (lastwidth != width) || (s_Last_Pen_Style != style) || (lastDC != DC ) ) { - DrawPen->SetColour( + wxPen DrawPen; + DrawPen.SetColour( ColorRefs[Color].m_Red, ColorRefs[Color].m_Green, ColorRefs[Color].m_Blue ); - DrawPen->SetWidth(width); - if ( &DC->GetPen() != DrawPen ) DC->SetPen(*DrawPen); + DrawPen.SetWidth(width); + DrawPen.SetStyle(style); +// if ( &DC->GetPen() != DrawPen ) + DC->SetPen(DrawPen); lastcolor = Color; lastwidth = width; lastDC = DC; + s_Last_Pen_Style = style; } } @@ -245,15 +249,16 @@ void GRSetBrush(wxDC * DC, int Color , int fill) { Color &= MASKCOLOR; // Pour 32 couleurs Max if( ForceBlackPen && Color != WHITE ) Color = BLACK; - DrawBrush->SetColour( + wxBrush DrawBrush; + DrawBrush.SetColour( ColorRefs[Color].m_Red, ColorRefs[Color].m_Green, ColorRefs[Color].m_Blue ); - if ( fill ) DrawBrush->SetStyle(wxSOLID); - else DrawBrush->SetStyle(wxTRANSPARENT); - if ( &DC->GetBrush() != DrawBrush ) DC->SetBrush(*DrawBrush); + if ( fill ) DrawBrush.SetStyle(wxSOLID); + else DrawBrush.SetStyle(wxTRANSPARENT); + DC->SetBrush(DrawBrush); } /*************************************/ @@ -340,68 +345,46 @@ int ii; /**************************************************************************** * Routine to draw a line, in Object spaces. * ****************************************************************************/ -void GRLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color) +void GRLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color) { - GRSLine(ClipBox, DC, GRMapX(x1), GRMapY(y1), GRMapX(x2), GRMapY(y2), Color); + GRSLine(ClipBox, DC, GRMapX(x1), GRMapY(y1), GRMapX(x2), GRMapY(y2), ZoomValue(width), Color); } /***************************************************/ /* Routine to draw a Dashed line, in Screen space. */ /***************************************************/ -void GRSDashedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color) +void GRSDashedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color) { GRLastMoveToX = x2; GRLastMoveToY = y2; lastcolor = -1; - DrawPen->SetStyle(wxSHORT_DASH); - GRSLine(ClipBox, DC, x1, y1, x2, y2, Color); + GRSetColorPen(DC, Color, width, wxSHORT_DASH); + GRSLine(ClipBox, DC, x1, y1, x2, y2, width, Color); lastcolor = -1; - DrawPen->SetStyle(wxSOLID); + GRSetColorPen(DC, Color, width); } -void GRSDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int Color) +void GRSDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int width, int Color) { lastcolor = -1; - DrawPen->SetStyle(wxSHORT_DASH); - GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x2, y2, Color); + GRSetColorPen(DC, Color, width, wxSHORT_DASH); + GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x2, y2, width, Color); lastcolor = -1; - DrawPen->SetStyle(wxSOLID); + GRSetColorPen(DC, Color, width); GRLastMoveToX = x2; GRLastMoveToY = y2; } /**************************************************************************** * Routine to draw a Dashed line, in Object spaces. * ****************************************************************************/ -void GRDashedLineTo(EDA_Rect * ClipBox,wxDC * DC,int x2, int y2, int Color) +void GRDashedLineTo(EDA_Rect * ClipBox,wxDC * DC,int x2, int y2, int width, int Color) { - GRSDashedLineTo(ClipBox, DC, GRMapX(x2), GRMapY(y2), Color); + GRSDashedLineTo(ClipBox, DC, GRMapX(x2), GRMapY(y2), ZoomValue(width), Color); } -void GRDashedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color) +void GRDashedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color) { - GRSDashedLine(ClipBox, DC, GRMapX(x1), GRMapY(y1), GRMapX(x2), GRMapY(y2), Color); -} - - -/*************************************************/ -/* Routine to draw a Bus line, in Object spaces. */ -/*************************************************/ - -void GRBusLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color) -{ - x1 = GRMapX(x1); x2 = GRMapX(x2); - y1 = GRMapY(y1); y2 = GRMapY(y2); - GRSBusLine(ClipBox, DC, x1, y1, x2, y2, Color); -} - -/**************************************************************** -* Routine to draw a Bus Line, in Screen (pixels) space. * -****************************************************************************/ -void GRSBusLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color) -{ - GRSFillCSegm(ClipBox, DC, x1, y1, x2, y2, 3*PenMinWidth, Color); - GRLastMoveToX = x2; - GRLastMoveToY = y2; + GRSDashedLine(ClipBox, DC, GRMapX(x1), GRMapY(y1), GRMapX(x2), GRMapY(y2), ZoomValue(width), Color); } @@ -417,46 +400,32 @@ void GRMoveTo(int x, int y) /*******************************************************/ /* Routine to draw to a new position, in Object space. */ /*******************************************************/ -void GRLineTo(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int Color) +void GRLineTo(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int width, int Color) { int GRLineToX, GRLineToY; GRLineToX = GRMapX(x); GRLineToY = GRMapY(y); - GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, Color); + GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, ZoomValue(width), Color); } /*************************************************/ /* Routine to draw a Mixed line, in Object space */ /*************************************************/ -void GRMixedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color) +void GRMixedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color) { - GRSMixedLine(ClipBox, DC, GRMapX(x1), GRMapY(y1), GRMapX(x2), GRMapY(y2), Color); + GRSMixedLine(ClipBox, DC, GRMapX(x1), GRMapY(y1), GRMapX(x2), GRMapY(y2), ZoomValue(width), Color); } /***********************************************************/ /* Routine to draw a Mixed line, in Screen (Pixels) space */ /***********************************************************/ -void GRSMixedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color) +void GRSMixedLine(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color) { - DrawPen->SetStyle(wxDOT_DASH); - GRSLine(ClipBox, DC, x1, y1, x2, y2, Color); - DrawPen->SetStyle(wxSOLID); + GRSetColorPen(DC, Color, width, wxDOT_DASH); + GRSLine(ClipBox, DC, x1, y1, x2, y2, width, Color); + GRSetColorPen(DC, Color, width); } -/*******************************************************************/ -/* Routine to draw a Bus line to a new position, in Object spaces. */ -/*******************************************************************/ -void GRBusLineTo(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int Color) -{ -int GRLineToX, GRLineToY; - - GRLineToX = GRMapX(x); GRLineToY = GRMapY(y); - - GRSBusLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, - Color); - GRLastMoveToX = GRLineToX; - GRLastMoveToY = GRLineToY; -} /**************************************************************************** * Routine to move to a new position, in Screen (pixels) space. * @@ -470,18 +439,18 @@ void GRSMoveTo(int x, int y) /**************************************************************************** * Routine to draw to a new position, in Screen (pixels) space. * ****************************************************************************/ -void GRSLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color) +void GRSLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color) { - GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x, y, Color); + GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x, y, width, Color); GRLastMoveToX = x; GRLastMoveToY = y; } /**************************************************************************** * Routine to draw to a new position, in Screen (pixels) space. * ****************************************************************************/ -void GRSLine(EDA_Rect * ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int Color) +void GRSLine(EDA_Rect * ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int Color) { - WinClipAndDrawLine(ClipBox, DC, x1, y1, x2, y2, Color); + WinClipAndDrawLine(ClipBox, DC, x1, y1, x2, y2, Color, width ); GRLastMoveToX = x2; GRLastMoveToY = y2; } @@ -499,7 +468,7 @@ void GRMoveRel(int x, int y) * Routine to line to a new position relative to current one, as in Object * * space. * ****************************************************************************/ -void GRLineRel(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int Color) +void GRLineRel(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int width, int Color) { int GRLineToX = GRLastMoveToX, GRLineToY = GRLastMoveToY; @@ -507,7 +476,7 @@ int GRLineToX = GRLastMoveToX, GRLineToX += ZoomValue(x); GRLineToY += ZoomValue(y); - GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, Color); + GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, ZoomValue(width), Color); } /**************************************************************************** @@ -524,12 +493,12 @@ void GRSMoveRel(int x, int y) * Routine to line to a new position relative to current one, as in Screen * * space (pixel coords.). * ****************************************************************************/ -void GRSLineRel(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int Color) +void GRSLineRel(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int width, int Color) { long GRLineToX = GRLastMoveToX + x, GRLineToY = GRLastMoveToY + y; - GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, Color); + GRSLine(ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, width, Color); GRLastMoveToX = GRLineToX; GRLastMoveToY = GRLineToY; } @@ -724,13 +693,13 @@ int Xmin, Xmax, Ymin, Ymax; /* Routine to draw a new polyline and fill it if Fill, in screen space. */ /************************************************************************/ void GRSPoly(EDA_Rect * ClipBox,wxDC * DC, int n, int *Points, int Fill, - int Color, int BgColor) + int width, int Color, int BgColor) { int startx, starty; if ( ! IsGRSPolyDrawable(ClipBox, n, Points) ) return; - GRSetColorPen(DC, Color ); + GRSetColorPen(DC, Color, width ); if( Fill && ( n > 2 ) ) { @@ -745,34 +714,24 @@ int startx, starty; } } -/************************************************************************/ -/* Routine to draw a new polyline (line width = Width), in screen space. */ -/************************************************************************/ -void GRSPolyLines(EDA_Rect * ClipBox,wxDC * DC, int n, int *Points, - int Color, int BgColor, int Width) -{ -int startx, starty; - - if ( ! IsGRSPolyDrawable(ClipBox, n, Points) ) return; - - GRSetColorPen(DC, Color, Width ); - - startx = Points[n * 2 - 2]; starty = Points[n * 2 - 1]; - GRSetBrush(DC, Color); - DC->DrawLines(n, (wxPoint*)Points); -} /******************************************************************************/ /* Routine to draw a new closed polyline and fill it if Fill, in screen space */ /******************************************************************************/ void GRSClosedPoly(EDA_Rect * ClipBox,wxDC * DC, int n, int *Points, int Fill, int Color, int BgColor) +{ + GRSClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor); +} + +void GRSClosedPoly(EDA_Rect * ClipBox,wxDC * DC, int n, int *Points, + int Fill, int width, int Color, int BgColor) { int startx, starty; if ( ! IsGRSPolyDrawable(ClipBox, n, Points) ) return; - GRSetColorPen(DC, Color ); + GRSetColorPen(DC, Color, width ); if( Fill && ( n > 2 ) ) { @@ -789,7 +748,7 @@ int startx, starty; /* Fermeture du polygone */ if( (startx != Points[0]) || (starty != Points[1]) ) { - GRSLine(ClipBox, DC, Points[0], Points[1], startx, starty, Color); + GRSLine(ClipBox, DC, Points[0], Points[1], startx, starty, width, Color); } } } @@ -799,27 +758,11 @@ int startx, starty; /* Routine to draw a new polyline and fill it if Fill, in drawing space. */ /************************************************************************/ void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, - int Fill, int Color, int BgColor) -{ -int ii, jj; - - for (ii = 0; ii < n; ii++) - { - jj = ii << 1; - Points[jj] = GRMapX(Points[jj]); - jj++; - Points[jj] = GRMapY(Points[jj]); - } - GRSPoly(ClipBox, DC, n, Points, Fill, Color, BgColor); -} - -void GRPolyLines(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, - int Color, int BgColor, int width) + int Fill, int width, int Color, int BgColor) { int ii, jj; width = ZoomValue(width); - for (ii = 0; ii < n; ii++) { jj = ii << 1; @@ -827,17 +770,24 @@ int ii, jj; jj++; Points[jj] = GRMapY(Points[jj]); } - if ( width <= 1 ) GRSPoly(ClipBox, DC, n, Points, 0, Color, BgColor); - else GRSPolyLines(ClipBox, DC, n, Points, Color, BgColor, width); + GRSPoly(ClipBox, DC, n, Points, Fill, width, Color, BgColor); } + /**************************************************************************/ /* Routine to draw a closed polyline and fill it if Fill, in object space */ /**************************************************************************/ void GRClosedPoly(EDA_Rect * ClipBox,wxDC * DC, int n, int *Points, int Fill, int Color, int BgColor) +{ + GRClosedPoly(ClipBox, DC, n, Points, Fill, 0, Color, BgColor); +} + +void GRClosedPoly(EDA_Rect * ClipBox,wxDC * DC, int n, int *Points, + int Fill, int width, int Color, int BgColor) { int ii, jj; + width = ZoomValue(width); for (ii = 0; ii < n; ii++) { jj = ii << 1; @@ -845,7 +795,7 @@ int ii, jj; jj++; Points[jj] = GRMapY(Points[jj]); } - GRSClosedPoly(ClipBox, DC, n, Points, Fill, Color, BgColor); + GRSClosedPoly(ClipBox, DC, n, Points, Fill, width, Color, BgColor); } /***********************************************/ @@ -857,21 +807,48 @@ int cx = GRMapX(x); int cy = GRMapY(y); int rayon = ZoomValue(r); - GRSCircle(ClipBox, DC, cx, cy, rayon, Color ); + GRSCircle(ClipBox, DC, cx, cy, rayon, 0, Color ); } /*****************************************************/ /* Routine to draw a Filled circle, in object space. */ /*****************************************************/ void GRFilledCircle(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int r, - int Color, int BgColor) + int width, int Color, int BgColor) { r = ZoomValue(r); - GRSFilledCircle(ClipBox, DC, GRMapX(x), GRMapY(y), r, Color, BgColor ); + width = ZoomValue(width); + GRSFilledCircle(ClipBox, DC, GRMapX(x), GRMapY(y), r, width, Color, BgColor ); } +/******************************************************/ +/* Routine to draw a FILLED circle, in drawing space. */ +/******************************************************/ +void GRSFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, + int width, int Color, int BgColor) +{ + /* suppression des cercles hors ecran */ + if ( ClipBox ) + { + int x0, y0, xm, ym; + x0 = ClipBox->GetX(); + y0 = ClipBox->GetY(); + xm = ClipBox->GetRight(); + ym = ClipBox->GetBottom(); + if ( x < (x0-r) ) return; + if ( y < (y0-r) ) return; + if ( x > (r+xm) ) return; + if ( y > (r+ym) ) return; + } + + GRSetColorPen(DC, Color, width ); + GRSetBrush(DC, BgColor, FILLED); + DC->DrawEllipse(x-r, y-r, r+r, r+r); +} + + /***********************************************************/ -/* Routine to draw un anneau, epaisseur w, in object space. */ +/* Routine to draw a circle, in object space. */ /***********************************************************/ void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color) { @@ -884,58 +861,6 @@ void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, in /***********************************************/ /* Routine to draw a circle, in drawing space. */ /***********************************************/ -void GRSCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color) -{ -int d = r + r; - - /* suppression des cercles hors ecran */ - if ( ClipBox ) - { - int x0, y0, xm, ym; - x0 = ClipBox->GetX(); - y0 = ClipBox->GetY(); - xm = ClipBox->GetRight(); - ym = ClipBox->GetBottom(); - if ( x < (x0-r) ) return; - if ( y < (y0-r) ) return; - if ( x > (r+xm) ) return; - if ( y > (r+ym) ) return; - } - - GRSetColorPen(DC, Color); - GRSetBrush(DC,Color,FALSE); - DC->DrawEllipse(x-r,y-r, d, d); -} - -/******************************************************/ -/* Routine to draw a FILLED circle, in drawing space. */ -/******************************************************/ -void GRSFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, - int Color, int BgColor) -{ - /* suppression des cercles hors ecran */ - if ( ClipBox ) - { - int x0, y0, xm, ym; - x0 = ClipBox->GetX(); - y0 = ClipBox->GetY(); - xm = ClipBox->GetRight(); - ym = ClipBox->GetBottom(); - if ( x < (x0-r) ) return; - if ( y < (y0-r) ) return; - if ( x > (r+xm) ) return; - if ( y > (r+ym) ) return; - } - - GRSetColorPen(DC, Color ); - GRSetBrush(DC, BgColor, FILLED); - DC->DrawEllipse(x-r, y-r, r+r, r+r); -} - - /***********************************************************************/ - /* Routine de trace d'un cercle epais ( Screen space = pixel coords.) */ - /***********************************************************************/ - void GRSCircle(EDA_Rect * ClipBox,wxDC * DC, int xc, int yc, int r, int width, int Color) { /* suppression des cercles hors ecran */ @@ -958,6 +883,7 @@ void GRSCircle(EDA_Rect * ClipBox,wxDC * DC, int xc, int yc, int r, int width, i } + /************************************************/ /* Routine to draw an arc, in USER space. */ /* Debut et fin de l'arc donnes par leur coord. */ @@ -967,7 +893,7 @@ void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, { GRSArc1(ClipBox, DC, GRMapX(x1), GRMapY(y1), GRMapX(x2), GRMapY(y2), - GRMapX(xc), GRMapY(yc), Color); + GRMapX(xc), GRMapY(yc), 0, Color); } /************************************************/ @@ -982,32 +908,6 @@ void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, GRMapX(xc), GRMapY(yc), ZoomValue(width), Color); } -/************************************************/ -/* Routine to draw an arc, in screen space. */ -/* Debut et fin de l'arc donnes par leur coord. */ -/************************************************/ -void GRSArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, - int xc, int yc, int Color) -{ - /* suppression des cercles hors ecran */ - if ( ClipBox ) - { - int x0, y0, xm, ym, r; - x0 = ClipBox->GetX(); - y0 = ClipBox->GetY(); - xm = ClipBox->GetRight(); - ym = ClipBox->GetBottom(); - r = (int)hypot(x1-xc, y1-yc); - if ( xc < (x0-r) ) return; - if ( yc < (y0-r) ) return; - if ( xc > (r+xm) ) return; - if ( yc > (r+ym) ) return; - } - - GRSetColorPen(DC, Color ); - GRSetBrush(DC,Color,FALSE); - DC->DrawArc(x1, y1, x2, y2, xc, yc); -} /************************************************/ /* Routine to draw an arc, width = width, in screen space. */ @@ -1040,40 +940,6 @@ void GRSArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, /* Routine to draw an arc, in screen space. */ /* As the Y axe is inverted the Angles should be inverted as well. */ /********************************************************************/ -void GRSArc(EDA_Rect * ClipBox,wxDC * DC, int xc, int yc, - int StAngle, int EndAngle, int r, int Color) -{ -int x1, y1, x2, y2; - - /* suppression des cercles hors ecran */ - if ( ClipBox ) - { - int x0, y0, xm, ym; - x0 = ClipBox->GetX(); - y0 = ClipBox->GetY(); - xm = ClipBox->GetRight(); - ym = ClipBox->GetBottom(); - if ( xc < (x0-r - 1) ) return; - if ( yc < (y0-r - 1) ) return; - if ( xc > (r+xm + 1) ) return; - if ( yc > (r+ym + 1) ) return; - } - - x1 = r; y1 = 0; - RotatePoint( &x1, & y1, EndAngle); - - x2 = r; y2 = 0; - RotatePoint( &x2, & y2, StAngle); - - GRSetColorPen(DC, Color); - GRSetBrush(DC,Color,FALSE); - DC->DrawArc(xc + x1, yc - y1, xc + x2, yc - y2, xc, yc); -} - -/********************************************************************/ -/* Routine to draw an arc, width = width, in screen space. */ -/* As the Y axe is inverted the Angles should be inverted as well. */ -/********************************************************************/ void GRSArc(EDA_Rect * ClipBox,wxDC * DC, int xc, int yc, int StAngle, int EndAngle, int r, int width, int Color) { @@ -1109,7 +975,7 @@ int x1, y1, x2, y2; /* As the Y axes is inverted the Angles should be inverted as well. */ /********************************************************************/ void GRSFilledArc(EDA_Rect * ClipBox,wxDC * DC, int xc, int yc, - int StAngle, int EndAngle, int r, int Color, int BgColor) + int StAngle, int EndAngle, int r, int width, int Color, int BgColor) { int x1, y1, x2, y2; @@ -1134,7 +1000,7 @@ int x1, y1, x2, y2; RotatePoint( &x2, & y2, StAngle); GRSetBrush(DC, BgColor, FILLED); - GRSetColorPen(DC, Color); + GRSetColorPen(DC, Color, width); DC->DrawArc(xc + x1, yc - y1, xc + x2, yc - y2, xc, yc); } @@ -1142,12 +1008,21 @@ int x1, y1, x2, y2; /* Routine to draw a Filled arc, in drawing space. */ /* As the Y axes is inverted the Angles should be inverted as well. */ /********************************************************************/ +void GRFilledArc(EDA_Rect * ClipBox,wxDC * DC, int x, int y, + int StAngle, int EndAngle, int r, int width, int Color, int BgColor) +{ + width = ZoomValue(width); + GRSFilledArc(ClipBox, DC, GRMapX(x), GRMapY(y), + StAngle, EndAngle, + ZoomValue(r), width, Color, BgColor); +} + void GRFilledArc(EDA_Rect * ClipBox,wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int Color, int BgColor) { GRSFilledArc(ClipBox, DC, GRMapX(x), GRMapY(y), StAngle, EndAngle, - ZoomValue(r), Color, BgColor); + ZoomValue(r), 0, Color, BgColor); } /********************************************************************/ @@ -1213,6 +1088,17 @@ void GRRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Co GRSRect(ClipBox, DC, x1, y1, x2, y2, Color ); } +/**************************************************/ +/* Routine to draw a Rectangle, in drawing space. */ +/**************************************************/ +void GRRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color) +{ + x1 = GRMapX(x1); y1 = GRMapY(y1); + x2 = GRMapX(x2); y2 = GRMapY(y2); + width = ZoomValue(width); + + GRSRect(ClipBox, DC, x1, y1, x2, y2, width, Color ); +} /************************************************************************************/ void GRFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color, int BgColor) @@ -1222,14 +1108,32 @@ void GRFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, x1 = GRMapX(x1); y1 = GRMapY(y1); x2 = GRMapX(x2); y2 = GRMapY(y2); - GRSFilledRect(ClipBox, DC, x1, y1, x2, y2, Color, BgColor ); + GRSFilledRect(ClipBox, DC, x1, y1, x2, y2, 0, Color, BgColor ); } +/************************************************************************************/ +void GRFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, + int width, int Color, int BgColor) +/************************************************************************************/ +/* Routine to draw a Rectangle (filled with AreaColor), in drawing space. */ +{ + x1 = GRMapX(x1); y1 = GRMapY(y1); + x2 = GRMapX(x2); y2 = GRMapY(y2); + width = ZoomValue(width); + + GRSFilledRect(ClipBox, DC, x1, y1, x2, y2, width, Color, BgColor ); +} /*************************************************/ /* Routine to draw a Rectangle, in screen space. */ /*************************************************/ void GRSRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color) +{ + GRSRect(ClipBox, DC, x1, y1, x2, y2, 0, Color); +} + +void GRSRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, + int width, int Color) { if(x1 > x2) EXCHG(x1,x2); if(y1 > y2) EXCHG(y1,y2); @@ -1248,7 +1152,7 @@ void GRSRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int C if ( y2 < ymin ) return; } - GRSetColorPen(DC, Color ); + GRSetColorPen(DC, Color, width ); if ( (x1 == x2) || (y1 == y2) ) DC->DrawLine(x1, y1, x2, y2); else { @@ -1258,11 +1162,18 @@ void GRSRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int C } +/* Routine to draw a Filled Rectangle, in screen space. */ /***************************************************************************************/ void GRSFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int Color, int BgColor) /***************************************************************************************/ -/* Routine to draw a Filled Rectangle, in screen space. */ +{ + GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, 0, Color, BgColor); +} +/***************************************************************************************/ +void GRSFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, + int width, int Color, int BgColor) +/***************************************************************************************/ { if(x1 > x2) EXCHG(x1,x2); if(y1 > y2) EXCHG(y1,y2); @@ -1278,14 +1189,14 @@ void GRSFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, if ( y1 > ymax ) return; if ( y2 < ymin ) return; - // Clipping des coordonnees + // Clipping coordinates if ( x1 < xmin )x1 = xmin -1; if ( y1 < ymin )y1 = ymin -1; if ( x2 > xmax ) x2 = xmax +1; if ( y2 > ymax ) y2 = ymax +1; } - GRSetColorPen(DC, Color ); + GRSetColorPen(DC, Color, width ); if ( (x1 == x2) || (y1 == y2) ) DC->DrawLine(x1, y1, x2, y2); else { @@ -1295,25 +1206,22 @@ void GRSFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, } - /****************************************/ - /* Routines relatives au trace de texte */ - /****************************************/ - - /*********************************************/ - /* Routine de selection de la fonte courante */ - /*********************************************/ + /*******************************/ + /* Routines used to draw texts */ + /*******************************/ +/*********************************************/ void GRSetFont(wxDC * DC, wxFont * Font) +/*********************************************/ +/* Routine to set the current font */ { DC->SetFont(*Font); } - /*********************************************************/ - /* void GRSetTextFgColor(wxFont * Font, int Color) */ - /*********************************************************/ - -/* Mise a la valeur Color des textes a afficher */ +/*********************************************************/ void GRSetTextFgColor(wxDC * DC, int Color) +/*********************************************************/ +/* Set the foreground color used to draw texts */ { DC->SetTextForeground(wxColour( ColorRefs[Color].m_Red, @@ -1322,7 +1230,6 @@ void GRSetTextFgColor(wxDC * DC, int Color) ); } -/* Mise a la valeur Color des textes a afficher */ void GRSetTextFgColor(wxDC * DC, wxFont *, int Color) { DC->SetTextForeground(wxColour( @@ -1336,7 +1243,7 @@ void GRSetTextFgColor(wxDC * DC, wxFont *, int Color) /*****************************************************************************/ void GRGetTextExtent(wxDC * DC, const wxChar * Text, long * width, long * height) /*****************************************************************************/ -/* donne la taille du rectangle d'encadrement du texte Text +/* Return the size of the text */ { long w = 0, h = 0; @@ -1349,25 +1256,21 @@ long w = 0, h = 0; if ( height ) * height = h; } - /********************************/ - /* void GRReseTextFgColor(void) */ - /********************************/ - -/* Mise a la couleur par defaut des textes a afficher */ +/********************************/ void GRResetTextFgColor(wxDC * DC) +/********************************/ +/* Set the foreground color used to draw texts to the default value */ { GRSetTextFgColor(DC, Text_Color); } - /*********************************************************/ - /* void GRSetTextBgColor(wxFont * Font, int Color) */ - /*********************************************************/ - -/* Mise a la valeur Color du fond pour les textes a afficher */ +/*********************************************************/ void GRSetTextBgColor(wxDC * DC, int Color) +/*********************************************************/ +/* Set the background color used to draw texts */ { - Color &= MASKCOLOR; // Pour 32 couleurs Max + Color &= MASKCOLOR; // keep only the bits used to select the color DC->SetTextBackground(wxColour( ColorRefs[Color].m_Red, ColorRefs[Color].m_Green, @@ -1377,7 +1280,7 @@ void GRSetTextBgColor(wxDC * DC, int Color) void GRSetTextBgColor(wxDC * DC, wxFont *, int Color) { - Color &= MASKCOLOR; // Pour 32 couleurs Max + Color &= MASKCOLOR; // keep only the bits used to select the color DC->SetTextBackground(wxColour( ColorRefs[Color].m_Red, ColorRefs[Color].m_Green, diff --git a/common/makefile.g95 b/common/makefile.g95 index aa2a7c8837..b96ffe785c 100644 --- a/common/makefile.g95 +++ b/common/makefile.g95 @@ -2,9 +2,10 @@ WXDIR = $(WXWIN) all: common.a -include makefile.include include ../libs.win +include makefile.include + common.a: $(OBJECTS) ../libs.win makefile.include ar ruv $@ $(OBJECTS) ranlib $@ diff --git a/common/makefile.gtk b/common/makefile.gtk index 378425af7e..08d7c4c565 100644 --- a/common/makefile.gtk +++ b/common/makefile.gtk @@ -8,9 +8,11 @@ EDACPPFLAGS = $(CPPFLAGS) all: common.a +include ../libs.linux + include makefile.include -CPPFLAGS += $(EXTRACPPFLAGS) +CPPFLAGS += $(EXTRACPPFLAGS) -fno-strict-aliasing EDACPPFLAGS = $(CPPFLAGS) @@ -19,6 +21,7 @@ common.a: $(OBJECTS) makefile.gtk makefile.include ar -rv $@ $(OBJECTS) ranlib $@ +install:common.a clean: rm -f *.o; rm -f *~; rm core; rm *.bak; rm *.obj diff --git a/common/makefile.include b/common/makefile.include index a28312b94a..caec07027e 100644 --- a/common/makefile.include +++ b/common/makefile.include @@ -1,4 +1,4 @@ -EXTRACPPFLAGS= -I$(SYSINCLUDE) -I./ -Ibitmaps -I../include +EXTRACPPFLAGS += -I$(SYSINCLUDE) -I./ -Ibitmaps -I../include COMMON = ../include/colors.h @@ -34,6 +34,11 @@ OBJECTS= \ base_screen.o\ dcsvg.o +ifdef KICAD_PYTHON +OBJECTS += pyhandler.o +pyhandler.o: pyhandler.cpp $(COMMON) ../include/pyhandler.h +endif + gr_basic.o: gr_basic.cpp ../include/gr_basic.h $(DEPEND) confirm.o: confirm.cpp $(COMMON) diff --git a/common/makefile.macosx b/common/makefile.macosx index 333439dabe..5b2eb7b400 100644 --- a/common/makefile.macosx +++ b/common/makefile.macosx @@ -2,7 +2,8 @@ CC = gcc # Compiler flags. -CPPFLAGS = -Wall -O2 -I./ -I../include `wx-config --cflags` +CPPFLAGS = -Wall -O2 -I./ -I../include `wx-config --cxxflags` +CPPFLAGS += -arch i386 -arch ppc EDACPPFLAGS = $(CPPFLAGS) diff --git a/common/pyhandler.cpp b/common/pyhandler.cpp new file mode 100644 index 0000000000..03cc855398 --- /dev/null +++ b/common/pyhandler.cpp @@ -0,0 +1,383 @@ +#include "wx/wxprec.h" +#include + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +// for all others, include the necessary headers (this file is usually all you +// need because it includes almost all "standard" wxWindows headers +#ifndef WX_PRECOMP +#include +#endif + +#include +#include + +#include +#include + +#include "fctsys.h" +#include "common.h" + +using namespace boost::python; + + +/*****************************************************************************/ +/* Common Python Binding */ +/*****************************************************************************/ + +static int GetLastID( void ) { return ID_END_LIST; } + +static object ChooseFile( str objTitle, str objMask, object objOpen ) +{ + wxString mask = PyHandler::MakeStr( objMask ); + int open = extract( objOpen ); + + wxString script = EDA_FileSelector( PyHandler::MakeStr( objTitle ), + wxEmptyString, /* Chemin par defaut */ + wxEmptyString, /* nom fichier par defaut */ + mask, /* extension par defaut */ + mask, /* Masque d'affichage */ + NULL, + open ? wxFD_OPEN : wxFD_SAVE, + TRUE + ); + + return PyHandler::Convert( script ); +} + +static void Print( str message ) { std::cout << extract(message) << std::endl; } +static void Clear() {} + +static void RegisterCb( str objKey, object callback ) +{ PyHandler::GetInstance()->RegisterCallback( PyHandler::MakeStr(objKey), callback ); } +static void UnRegisterCb( str objKey, object callback ) +{ PyHandler::GetInstance()->UnRegisterCallback( PyHandler::MakeStr(objKey), callback ); } + +static void init_base_utils(void) +{ + def ( "ChooseFile", &ChooseFile ); + def ( "RegisterCallback", &RegisterCb ); + def ( "UnRegisterCallback", &UnRegisterCb ); + def ( "GetLastID", &GetLastID ); + + def ( "Print", &Print ); + def ( "Clear", &Clear); +} + +static void InitPyModules() { PyHandler::GetInstance()->InitNextModule(); } // Dummy boost callback + +/*****************************************************************************/ +/* PyHandler */ +/*****************************************************************************/ + +// std::vector< T > -> python object implicit conversion +template struct std_vector_to_tuple +{ + static PyObject * makeItem( const wxString & str ) { return boost::python::incref( PyHandler::Convert( str ).ptr() ); } + static PyObject * makeItem( const std::string & str ) { return boost::python::incref( boost::python::str( str.c_str() ).ptr() ); } + static PyObject * makeItem( int item ) { return boost::python::incref( PyInt_FromLong( item ) ); } + + static PyObject * convert( const T& vect ) + { + PyObject * tuple = PyTuple_New( vect.size() ); + for ( unsigned int i = 0; i < vect.size() ; i++ ) + { + PyTuple_SET_ITEM( tuple, i, makeItem( vect[i] ) ); + } + return tuple; + } +}; + +PyHandler* PyHandler::m_instance = NULL; + +PyHandler * PyHandler::GetInstance() +/* Singleton implementation */ +{ + if ( !PyHandler::m_instance ) + { + PyHandler::m_instance = new PyHandler(); + } + return PyHandler::m_instance; +} + +PyHandler::PyHandler() +/* Init the Python env */ +{ + Py_Initialize(); + PyEval_InitThreads(); + m_ModulesLoaded = false; + m_current = 0; + if ( !wxPyCoreAPI_IMPORT() ) + { + std::cerr << "Can't get wx Python binding\n" ; + PyErr_Print(); + } +// m_mainTState = wxPyBeginAllowThreads(); // I can't figure out why this make py crash ... + m_mainTState = NULL; + + // Make the console appear in a window: + wxString initConsole; + initConsole += wxT( "import sys\n" ); + initConsole += wxT( "import wx\n" ); + initConsole += wxT( "output = wx.PyOnDemandOutputWindow()\n" ); + initConsole += wxT( "sys.stdout = sys.stderr = output\n" ); + RunSimpleString( initConsole ); + + AddToModule ( wxT( "common" ), &init_base_utils ); + + // Register converters + + to_python_converter < std::vector< std::string >, std_vector_to_tuple< const std::vector < std::string > > > (); + to_python_converter < std::vector< wxString >, std_vector_to_tuple< const std::vector < wxString > > > (); +} + +void PyHandler::DoInitModules() +{ + if ( m_ModulesLoaded ) return; + m_ModulesLoaded = true; + + for ( unsigned int i = 0; i < m_ModuleRegistry.size(); i ++ ) + { + detail::init_module( m_ModuleRegistry[i].name.fn_str(), &InitPyModules ); + } +} + +int PyHandler::GetModuleIndex( const wxString & name ) const +/* Returns the module index in the registry, -1 if not found*/ +{ + for ( unsigned int i = 0; i < m_ModuleRegistry.size(); i ++ ) + { + if ( m_ModuleRegistry[i].name == name ) return i; + } + return -1; +} + +void PyHandler::AddToModule( const wxString & name, PyHandler::initfunc_t initfunc ) +/* Adds an init function to a python module */ +{ + if (!initfunc) return; + int i = GetModuleIndex( name ); + + if ( -1 == i ) + { + m_ModuleRegistry.push_back( ModuleRecord( name ) ); + i = m_ModuleRegistry.size() - 1; + } + + m_ModuleRegistry[i].registry.push_back( initfunc ); +} + + +void PyHandler::InitNextModule() +/* Called to initialize a module on py 'import module' */ +{ + for ( unsigned int j = 0; j < m_ModuleRegistry[m_current].registry.size() ; j ++ ) + { + m_ModuleRegistry[m_current].registry[j](); + } + m_current++; +} + +PyHandler::~PyHandler() +/* Closes the Python env */ +{ + wxPyEndAllowThreads(m_mainTState); + Py_Finalize(); +} + +void PyHandler::RunBaseScripts( const wxString & base ) +/* Run scripts looking in 'base' directory */ +{ + const wxString sep = wxFileName().GetPathSeparator(); + + // check if we can have a kicad_startup.py around ? + wxString script = base + wxT( "scripts" ) + sep + wxT( "kicad_startup.py" ); + if ( wxFileExists( script ) ) RunScript( script ); + + // First find scripts/.py and run it if found : + + script = base + wxString::FromAscii( "scripts" ) + sep + m_appName + wxString::FromAscii(".py"); + if ( wxFileExists( script ) ) RunScript( script ); + + // Now lets see if we can find a suitable plugin directory (plugin/) somewhere + + wxString pluginDir = base + wxT( "plugins" ) + sep + m_appName; + if ( wxDirExists( pluginDir ) ) + { + // We do have a systemwide plugin dir, let's find files in it + wxArrayString pluginList; + wxDir::GetAllFiles( pluginDir, &pluginList, wxT("*.py") ); + + for ( unsigned int i = 0; i < pluginList.Count() ; i++ ) + { + RunScript( pluginList[i] ); + } + } +} + +void PyHandler::RunScripts() +/* Run application startup scripts */ +{ + // SYSTEMWIDE: + + const wxString sep = wxFileName().GetPathSeparator(); + + wxString dataPath = ReturnKicadDatasPath(); + if ( wxDirExists( dataPath ) ) RunBaseScripts( dataPath ); + + // USER Scripts: + wxString userDir = wxGetUserHome() + sep + wxString::FromAscii(".kicad.d") + sep; + if ( wxDirExists( userDir ) ) RunBaseScripts( userDir ); + userDir = wxGetUserHome() + sep + wxString::FromAscii("_kicad_d") + sep; + if ( wxDirExists( userDir ) ) RunBaseScripts( userDir ); + +} + +bool PyHandler::RunScript( const wxString & name ) +/* Run the script specified by 'name' */ +{ + DoInitModules(); + + object module( handle<>(borrowed(PyImport_AddModule("__main__")))); + object ns = module.attr( "__dict__" ); + bool ret = true; + + FILE * file = fopen( name.fn_str(), "r" ); + + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + + if ( !file ) + { + // do something + std::cout << "Unable to Load " << name.fn_str() << "\n"; + ret = false; + } + else + { + wxString currDir = wxGetCwd(); + + wxFileName fname( name ); + wxString pyDir = fname.GetPath(); + + wxSetWorkingDirectory( pyDir ); + try + { + ns["currentScript"] = Convert( name ); + handle<> ignored( PyRun_File( file, name.fn_str(), Py_file_input, ns.ptr(), ns.ptr() ) ); + } + catch ( error_already_set ) + { + PyErr_Print(); // should be printed into an error message ... + ret = false; + } + wxSetWorkingDirectory( currDir ); + } + + fclose( file ); + wxPyEndBlockThreads(blocked); + return ret; +} + +bool PyHandler::RunSimpleString( const wxString & code ) +/* Run the code in 'code' */ +{ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + try + { + PyRun_SimpleString( code.fn_str() ); + } + catch ( error_already_set ) + { + PyErr_Print(); // should be printed into an error message ... + wxPyEndBlockThreads(blocked); + return false; + } + + wxPyEndBlockThreads(blocked); + return true; +} + + +void PyHandler::SetAppName( const wxString & name ) +/* Set the application name in the python scope */ +{ + m_appName = name; + object module(( handle<>(borrowed(PyImport_AddModule("__main__"))))); + object ns = module.attr( "__dict__" ); + try { + ns["kicadApp"] = std::string( name.ToAscii() ); + } + catch (error_already_set) + { + PyErr_Print(); + } +} + +const char * PyHandler::GetVersion() { return Py_GetVersion(); } + +// Event handling : + +void PyHandler::DeclareEvent( const wxString & key ) { m_EventRegistry.push_back( Event( key ) ); } + +int PyHandler::GetEventIndex( const wxString & key ) +{ + for ( unsigned int i = 0; i < m_EventRegistry.size(); i ++ ) + { + if ( m_EventRegistry[i].key == key ) return i; + } + return -1; +} + +void PyHandler::TriggerEvent( const wxString & key ) { TriggerEvent( key, str( "" ) ); } +void PyHandler::TriggerEvent( const wxString & key, const object & param ) +{ + + int i = GetEventIndex( key ); + if ( -1 == i ) return; + + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + for ( unsigned int j = 0; j < m_EventRegistry[i].functors.size(); j++ ) + { + try + { + m_EventRegistry[i].functors[j]( param ); + } + catch (error_already_set) + { + std::cout << "Error in event " << key.fn_str() << " callback" << std::endl; + PyErr_Print(); + } + } + wxPyEndBlockThreads(blocked); +} + +void PyHandler::RegisterCallback( const wxString & key, const object & callback ) +{ + int i = GetEventIndex( key ); + if ( -1 == i ) return; + m_EventRegistry[i].functors.push_back( callback ); +} + +void PyHandler::UnRegisterCallback( const wxString & key, const object & callback ) +{ + int i = GetEventIndex( key ); + if ( -1 == i ) return; + for ( unsigned int j = 0; j < m_EventRegistry[i].functors.size() ; j++ ) + { + if ( callback == m_EventRegistry[i].functors[j] ) + { + m_EventRegistry[i].functors.erase( m_EventRegistry[i].functors.begin() + j ); + break; + } + } +} + +// Object conversion: + +wxString PyHandler::MakeStr( const object & objStr ) { return wxString( extract( objStr ), wxConvLocal ); } + +object PyHandler::Convert( const wxString & wxStr ) { return str( std::string( wxStr.fn_str() ).c_str() ); } + +// vim: set tabstop=4 : diff --git a/common/string.cpp b/common/string.cpp index 654533c8c1..7997d56c78 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -6,8 +6,8 @@ #include "fctsys.h" #include #include "common.h" - - + + /*********************************************************************/ int ReadDelimitedText(char * dest, char * source, int NbMaxChar ) /*********************************************************************/ @@ -302,22 +302,6 @@ char * line = Text; return line; } -/****************************/ -char * from_point(char * Text) -/****************************/ -/* convertit les . en , dans une chaine. utilisé pour compenser -l'internalisation imbecile de la fct scanf -qui lit les flottants avec une virgule au lieu du point -*/ -{ -char * line = Text; - if ( Text == NULL ) return NULL; - - for ( ; *Text != 0; Text++ ) - if (*Text == '.') *Text = g_FloatSeparator; - - return line; -} /********************************/ char * strupper(char * Text) diff --git a/common/worksheet.cpp b/common/worksheet.cpp index d4f9a5efd2..9c4f777160 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -13,9 +13,9 @@ /* Must be defined in main applications: */ extern wxString g_Main_Title; -/*********************************************************************/ -void WinEDA_DrawFrame::TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen) -/*********************************************************************/ +/*************************************************************************************/ +void WinEDA_DrawFrame::TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen, int line_width) +/*************************************************************************************/ /* Draw the sheet references */ { @@ -32,6 +32,7 @@ wxSize size(SIZETEXT*scale,SIZETEXT*scale); wxSize size_ref(SIZETEXT_REF*scale,SIZETEXT_REF*scale); wxString msg; int UpperLimit = VARIABLE_BLOCK_START_POSITION; +int width = line_width; Color = RED; if(Sheet == NULL) @@ -46,7 +47,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; { GRSetDrawMode(DC, GR_COPY); GRRect(&DrawPanel->m_ClipBox, DC, 0, 0, - Sheet->m_Size.x * scale, Sheet->m_Size.y * scale, + Sheet->m_Size.x * scale, Sheet->m_Size.y * scale, width, g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY ); } @@ -60,7 +61,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; for ( ii = 0; ii < 2 ; ii++ ) { GRRect(&DrawPanel->m_ClipBox, DC, refx * scale, refy * scale, - xg * scale, yg * scale, Color); + xg * scale, yg * scale, width, Color); refx += GRID_REF_W; refy += GRID_REF_W; xg -= GRID_REF_W; yg -= GRID_REF_W; @@ -80,23 +81,23 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; if( ii < xg - PAS_REF/2 ) { GRLine(&DrawPanel->m_ClipBox, DC, ii * scale, refy * scale, - ii * scale, (refy + GRID_REF_W) * scale, Color); + ii * scale, (refy + GRID_REF_W) * scale, width, Color); } DrawGraphicText(DrawPanel, DC, wxPoint( (ii - gxpas/2) * scale, (refy + GRID_REF_W/2) * scale), Color, Line, TEXT_ORIENT_HORIZ, size_ref, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width); if( ii < xg - PAS_REF/2 ) { GRLine(&DrawPanel->m_ClipBox, DC,ii * scale, yg * scale, - ii * scale, (yg - GRID_REF_W) * scale, Color); + ii * scale, (yg - GRID_REF_W) * scale, width, Color); } DrawGraphicText(DrawPanel, DC, wxPoint( (ii - gxpas/2) * scale, (yg - GRID_REF_W/2) * scale), Color, Line, TEXT_ORIENT_HORIZ, size_ref, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width); } /* Trace des reperes selon l'axe Y */ @@ -110,23 +111,23 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; if( ii < yg - PAS_REF/2 ) { GRLine(&DrawPanel->m_ClipBox, DC, refx * scale, ii * scale, - (refx + GRID_REF_W) * scale, ii * scale, Color); + (refx + GRID_REF_W) * scale, ii * scale, width, Color); } DrawGraphicText(DrawPanel, DC, wxPoint((refx + GRID_REF_W/2) * scale, (ii - gypas/2) * scale), Color, Line, TEXT_ORIENT_HORIZ, size_ref, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width); if( ii < yg - PAS_REF/2 ) { GRLine(&DrawPanel->m_ClipBox, DC, xg * scale, ii * scale, - (xg - GRID_REF_W) * scale, ii * scale, Color); + (xg - GRID_REF_W) * scale, ii * scale, width, Color); } DrawGraphicText(DrawPanel, DC, wxPoint((xg - GRID_REF_W/2) * scale, (ii - gxpas/2) * scale), Color, Line, TEXT_ORIENT_HORIZ, size_ref, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width); } @@ -147,7 +148,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; msg += screen->m_Date; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); break; case WS_REV: @@ -155,7 +156,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; msg += screen->m_Revision; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); break; case WS_LICENCE: @@ -164,7 +165,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; msg += wxT(" ") + GetBuildVersion(); DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); break; case WS_SIZESHEET: @@ -172,7 +173,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; msg += Sheet->m_Name; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); break; @@ -182,7 +183,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; screen->m_NumberOfSheet; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); break; case WS_COMPANY_NAME: @@ -192,7 +193,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; { DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); } break; @@ -202,7 +203,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; msg += screen->m_Title; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); break; case WS_COMMENT1: @@ -212,7 +213,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; { DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); } break; @@ -224,7 +225,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; { DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); } break; @@ -236,7 +237,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; { DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); } break; @@ -248,7 +249,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; { DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); } break; @@ -266,7 +267,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; yg = Sheet->m_Size.y - GRID_REF_W - Sheet->m_BottomMargin - WsItem->m_Endy; GRLine(&DrawPanel->m_ClipBox, DC, pos.x, pos.y, - xg * scale, yg * scale, Color); + xg * scale, yg * scale, width, Color); break; } diff --git a/cvpcb/loadcmp.cpp b/cvpcb/loadcmp.cpp index fc9d8f276c..1b5a784f3f 100644 --- a/cvpcb/loadcmp.cpp +++ b/cvpcb/loadcmp.cpp @@ -80,7 +80,10 @@ MODULE * Module = NULL; if( stricmp(Name,CONV_TO_UTF8(CmpName)) == 0 ) /* composant localise */ { Module = new MODULE(m_Pcb); + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); Module->ReadDescr(lib_module, &LineNum); + setlocale(LC_NUMERIC, ""); // revert to the current locale Module->SetPosition(wxPoint(0,0) ); fclose(lib_module); return(Module) ; diff --git a/cvpcb/makefile.gtk b/cvpcb/makefile.gtk index 46b231a72a..c1ffd38efa 100644 --- a/cvpcb/makefile.gtk +++ b/cvpcb/makefile.gtk @@ -31,7 +31,7 @@ $(TARGET): $(OBJECTS) makefile.gtk makefile.include $(EXTRALIBS) ../libs.linux $ $(LD) $(OBJECTS) $(LDFLAGS) $(LIBVIEWER3D) $(LIBS_WITH_GL) -o $(TARGET) -install: +install: $(TARGET) cp -f $(TARGET) $(KICAD_BIN) clean: diff --git a/cvpcb/makefile.include b/cvpcb/makefile.include index 2f851b5f78..865d031d62 100644 --- a/cvpcb/makefile.include +++ b/cvpcb/makefile.include @@ -1,141 +1,141 @@ -# makefile pour cvpcb (mingw) -OBJSUFF = o - -EXTRACPPFLAGS = -DCVPCB -I./ -I../cvpcb -I../include -Ibitmaps -I../pcbnew -I../3d-viewer -EXTRALIBS = ../common/common.a - -LIBVIEWER3D = ../3d-viewer/3d-viewer.a - -# DEPEND = cvpcb.h ../include/pcbstruct.h - -OBJECTS = $(TARGET).o \ - class_cvpcb.o\ - memoire.o \ - cvframe.o\ - listboxes.o\ - drawframe.o\ - class_pcb_text.o\ - class_cotation.o\ - class_mire.o\ - displayframe.o\ - drawpanel.o \ - init.o rdpcad.o \ - readschematicnetlist.o\ - viewlogi.o viewlnet.o \ - loadcmp.o savecmp.o \ - tool_cvpcb.o \ - writenetlistpcbnew.o\ - genequiv.o \ - ioascii.o \ - menucfg.o \ - cfg.o listlib.o \ - infospgm.o autosel.o \ - setvisu.o\ - dialog_display_options.o\ - zoom.o \ - visumod.o\ - tracemod.o \ - classpcb.o \ - class_board.o \ - class_module.o \ - class_pad.o \ - class_text_mod.o \ - class_edge_mod.o \ - class_equipot.o \ - class_track.o\ - basepcbframe.o - -cvpcb.o: cvpcb.cpp cvpcb.h $(DEPEND) - -displayframe.o: displayframe.cpp $(DEPEND) - -listboxes.o: listboxes.cpp $(DEPEND) - -drawpanel.o: ../share/drawpanel.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -drawframe.o: ../share/drawframe.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -init.o: init.cpp $(DEPEND) - -memoire.o: memoire.cpp $(DEPEND) - -rdpcad.o: rdpcad.cpp $(DEPEND) - -classpcb.o: ../pcbnew/classpcb.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_mire.o: ../pcbnew/class_mire.cpp ../pcbnew/class_mire.h $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_cotation.o: ../pcbnew/class_cotation.cpp ../pcbnew/class_cotation.h $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_pcb_text.o: ../pcbnew/class_pcb_text.cpp ../pcbnew/class_pcb_text.h $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_board.o: ../pcbnew/class_board.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_track.o: ../pcbnew/class_track.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_pad.o: ../pcbnew/class_pad.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_module.o: ../pcbnew/class_module.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_text_mod.o: ../pcbnew/class_text_mod.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_edge_mod.o: ../pcbnew/class_edge_mod.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_equipot.o: ../pcbnew/class_equipot.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -basepcbframe.o: ../pcbnew/basepcbframe.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -readschematicnetlist.o: readschematicnetlist.cpp $(DEPEND) - -viewlogi.o: viewlogi.cpp $(DEPEND) - -viewlnet.o: viewlnet.cpp $(DEPEND) - -loadcmp.o: loadcmp.cpp $(DEPEND) - -savecmp.o: savecmp.cpp $(DEPEND) - -writenetlistpcbnew.o: writenetlistpcbnew.cpp $(DEPEND) - -genequiv.o: genequiv.cpp $(DEPEND) - -ioascii.o: ../pcbnew/ioascii.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -listlib.o: listlib.cpp $(DEPEND) - -cfg.o: cfg.cpp cfg.h $(DEPEND) - -menucfg.o: menucfg.cpp dialog_cvpcb_config.cpp dialog_cvpcb_config.h $(DEPEND) - -infospgm.o: ../share/infospgm.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -autosel.o: autosel.cpp $(DEPEND) - -setvisu.o: setvisu.cpp $(DEPEND) - -zoom.o: ../share/zoom.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -visumod.o: visumod.cpp $(DEPEND) - -tracemod.o: ../pcbnew/tracemod.cpp ../include/gr_basic.h $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -dialog_display_options.o: dialog_display_options.cpp dialog_display_options.h $(DEPEND) - +# makefile pour cvpcb (mingw) +OBJSUFF = o + +EXTRACPPFLAGS += -DCVPCB -fno-strict-aliasing -I./ -I../cvpcb -I../include -Ibitmaps -I../pcbnew -I../3d-viewer +EXTRALIBS = ../common/common.a + +LIBVIEWER3D = ../3d-viewer/3d-viewer.a + +# DEPEND = cvpcb.h ../include/pcbstruct.h + +OBJECTS = $(TARGET).o \ + class_cvpcb.o\ + memoire.o \ + cvframe.o\ + listboxes.o\ + drawframe.o\ + class_pcb_text.o\ + class_cotation.o\ + class_mire.o\ + displayframe.o\ + drawpanel.o \ + init.o rdpcad.o \ + readschematicnetlist.o\ + viewlogi.o viewlnet.o \ + loadcmp.o savecmp.o \ + tool_cvpcb.o \ + writenetlistpcbnew.o\ + genequiv.o \ + ioascii.o \ + menucfg.o \ + cfg.o listlib.o \ + infospgm.o autosel.o \ + setvisu.o\ + dialog_display_options.o\ + zoom.o \ + visumod.o\ + tracemod.o \ + classpcb.o \ + class_board.o \ + class_module.o \ + class_pad.o \ + class_text_mod.o \ + class_edge_mod.o \ + class_equipot.o \ + class_track.o\ + basepcbframe.o + +cvpcb.o: cvpcb.cpp cvpcb.h $(DEPEND) + +displayframe.o: displayframe.cpp $(DEPEND) + +listboxes.o: listboxes.cpp $(DEPEND) + +drawpanel.o: ../share/drawpanel.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +drawframe.o: ../share/drawframe.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +init.o: init.cpp $(DEPEND) + +memoire.o: memoire.cpp $(DEPEND) + +rdpcad.o: rdpcad.cpp $(DEPEND) + +classpcb.o: ../pcbnew/classpcb.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_mire.o: ../pcbnew/class_mire.cpp ../pcbnew/class_mire.h $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_cotation.o: ../pcbnew/class_cotation.cpp ../pcbnew/class_cotation.h $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_pcb_text.o: ../pcbnew/class_pcb_text.cpp ../pcbnew/class_pcb_text.h $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_board.o: ../pcbnew/class_board.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_track.o: ../pcbnew/class_track.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_pad.o: ../pcbnew/class_pad.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_module.o: ../pcbnew/class_module.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_text_mod.o: ../pcbnew/class_text_mod.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_edge_mod.o: ../pcbnew/class_edge_mod.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_equipot.o: ../pcbnew/class_equipot.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +basepcbframe.o: ../pcbnew/basepcbframe.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +readschematicnetlist.o: readschematicnetlist.cpp $(DEPEND) + +viewlogi.o: viewlogi.cpp $(DEPEND) + +viewlnet.o: viewlnet.cpp $(DEPEND) + +loadcmp.o: loadcmp.cpp $(DEPEND) + +savecmp.o: savecmp.cpp $(DEPEND) + +writenetlistpcbnew.o: writenetlistpcbnew.cpp $(DEPEND) + +genequiv.o: genequiv.cpp $(DEPEND) + +ioascii.o: ../pcbnew/ioascii.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +listlib.o: listlib.cpp $(DEPEND) + +cfg.o: cfg.cpp cfg.h $(DEPEND) + +menucfg.o: menucfg.cpp dialog_cvpcb_config.cpp dialog_cvpcb_config.h $(DEPEND) + +infospgm.o: ../share/infospgm.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +autosel.o: autosel.cpp $(DEPEND) + +setvisu.o: setvisu.cpp $(DEPEND) + +zoom.o: ../share/zoom.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +visumod.o: visumod.cpp $(DEPEND) + +tracemod.o: ../pcbnew/tracemod.cpp ../include/gr_basic.h $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +dialog_display_options.o: dialog_display_options.cpp dialog_display_options.h $(DEPEND) + diff --git a/cvpcb/makefile.macosx b/cvpcb/makefile.macosx index a484d6b5fa..739d0e278a 100644 --- a/cvpcb/makefile.macosx +++ b/cvpcb/makefile.macosx @@ -19,11 +19,12 @@ include ../libs.macosx TARGET = cvpcb -all: $(TARGET) +all: $(TARGET) $(TARGET).app include makefile.include CPPFLAGS += $(EXTRACPPFLAGS) +CPPFLAGS += -arch i386 -arch ppc EDACPPFLAGS = $(CPPFLAGS) @@ -33,6 +34,22 @@ $(TARGET): $(OBJECTS) $(TARGET).r makefile.macosx makefile.include $(EXTRALIBS) $(SETFILE) -a C $(TARGET) +$(TARGET).app: $(OBJS) + rm -Rf $(TARGET).app + mkdir -p $(TARGET).app + mkdir -p $(TARGET).app/Contents + mkdir -p $(TARGET).app/Contents/MacOS + mkdir -p $(TARGET).app/Contents/Frameworks + mkdir -p $(TARGET).app/Contents/Resources + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/" \ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/wxmac.icns \ + >$(TARGET).app/Contents/Resources/wxmac.icns + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/"\ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/Info.plist.in \ + >$(TARGET).app/Contents/Info.plist + echo -n "APPL????" >$(TARGET).app/Contents/PkgInfo + ln -f $(TARGET) $(TARGET).app/Contents/MacOS/$(TARGET) + install: cp -f $(TARGET) $(KICAD_BIN) diff --git a/eeschema/affiche.cpp b/eeschema/affiche.cpp index 78f4eb1b84..f1a88df060 100644 --- a/eeschema/affiche.cpp +++ b/eeschema/affiche.cpp @@ -141,6 +141,10 @@ wxString msg; else if( m_Convert == 2 ) msg = _("yes"); else msg = wxT("?"); Affiche_1_Parametre(frame, 16, _("Convert"), msg, BROWN); + + if ( m_Width ) valeur_param(m_Width, msg); + else msg = _("default"); + Affiche_1_Parametre(frame, 24, _("Width"), msg, BLUE); } diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index f931076fc5..3e3ee74b28 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -88,13 +88,13 @@ bool ItemIsInOtherPart, ItemIsInOtherConvert; { case COMPONENT_ARC_DRAW_TYPE: { - pos = ((LibDrawArc*)item)->m_Start; pos.y = -pos.y; + pos = ((LibDrawArc*)item)->m_ArcStart; pos.y = -pos.y; if ( Rect.Inside(pos) ) { item->m_Selected = IS_SELECTED; ItemsCount++; } - pos = ((LibDrawArc*)item)->m_End; pos.y = -pos.y; + pos = ((LibDrawArc*)item)->m_ArcEnd; pos.y = -pos.y; if ( Rect.Inside(pos) ) { item->m_Selected = IS_SELECTED; @@ -113,7 +113,7 @@ bool ItemIsInOtherPart, ItemIsInOtherConvert; break; case COMPONENT_RECT_DRAW_TYPE: - pos = ((LibDrawSquare*)item)->m_Start; pos.y = -pos.y; + pos = ((LibDrawSquare*)item)->m_Pos; pos.y = -pos.y; if ( Rect.Inside(pos) ) { item->m_Selected = IS_SELECTED; @@ -529,10 +529,10 @@ LibEDA_BaseStruct * item; { ((LibDrawArc*)item)->m_Pos.x += offset.x; ((LibDrawArc*)item)->m_Pos.y += offset.y; - ((LibDrawArc*)item)->m_Start.x += offset.x; - ((LibDrawArc*)item)->m_Start.y += offset.y; - ((LibDrawArc*)item)->m_End.x += offset.x; - ((LibDrawArc*)item)->m_End.y += offset.y; + ((LibDrawArc*)item)->m_ArcStart.x += offset.x; + ((LibDrawArc*)item)->m_ArcStart.y += offset.y; + ((LibDrawArc*)item)->m_ArcEnd.x += offset.x; + ((LibDrawArc*)item)->m_ArcEnd.y += offset.y; break; } @@ -542,8 +542,8 @@ LibEDA_BaseStruct * item; break; case COMPONENT_RECT_DRAW_TYPE: - ((LibDrawSquare*)item)->m_Start.x += offset.x; - ((LibDrawSquare*)item)->m_Start.y += offset.y; + ((LibDrawSquare*)item)->m_Pos.x += offset.x; + ((LibDrawSquare*)item)->m_Pos.y += offset.y; ((LibDrawSquare*)item)->m_End.x += offset.x; ((LibDrawSquare*)item)->m_End.y += offset.y; break; @@ -632,9 +632,9 @@ LibEDA_BaseStruct * item; case COMPONENT_ARC_DRAW_TYPE: { SETMIRROR(((LibDrawArc*)item)->m_Pos.x); - SETMIRROR(((LibDrawArc*)item)->m_Start.x); - SETMIRROR(((LibDrawArc*)item)->m_End.x); - EXCHG(((LibDrawArc*)item)->m_Start,((LibDrawArc*)item)->m_End); + SETMIRROR(((LibDrawArc*)item)->m_ArcStart.x); + SETMIRROR(((LibDrawArc*)item)->m_ArcEnd.x); + EXCHG(((LibDrawArc*)item)->m_ArcStart,((LibDrawArc*)item)->m_ArcEnd); break; } @@ -643,7 +643,7 @@ LibEDA_BaseStruct * item; break; case COMPONENT_RECT_DRAW_TYPE: - SETMIRROR(((LibDrawSquare*)item)->m_Start.x); + SETMIRROR(((LibDrawSquare*)item)->m_Pos.x); SETMIRROR(((LibDrawSquare*)item)->m_End.x); break; diff --git a/eeschema/class_hierarchy_sheet.cpp b/eeschema/class_hierarchy_sheet.cpp index 9fef1815de..2079544b1e 100644 --- a/eeschema/class_hierarchy_sheet.cpp +++ b/eeschema/class_hierarchy_sheet.cpp @@ -28,6 +28,7 @@ #include "libcmp.h" #include "general.h" +#include "protos.h" /***********************************************************/ @@ -97,6 +98,7 @@ DrawSheetLabelStruct * Slabel = NULL, * label = m_Label; newitem->m_DrawOrg = m_DrawOrg; newitem->m_Curseur = m_Curseur; newitem->m_MousePosition = m_MousePosition; + newitem->m_MousePositionInPixels = m_MousePositionInPixels; newitem->m_O_Curseur = m_O_Curseur; newitem->m_ScrollbarPos = m_ScrollbarPos; newitem->m_ScrollbarNumber = m_ScrollbarNumber; @@ -140,7 +142,58 @@ void DrawSheetStruct::SwapData(DrawSheetStruct * copyitem) EXCHG(m_NbLabel, copyitem->m_NbLabel); } - /************************/ +/**************************************************************************************/ +void DrawSheetStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, + int DrawMode, int Color) +/**************************************************************************************/ +/* Draw the hierarchical sheet shape */ +{ +DrawSheetLabelStruct * SheetLabelStruct; +int txtcolor; +wxString Text; +int color; +wxPoint pos = m_Pos + offset; +int LineWidth = g_DrawMinimunLineWidth; + + if( Color >= 0 ) color = Color; + else color = ReturnLayerColor(m_Layer); + GRSetDrawMode(DC, DrawMode); + + GRRect(&panel->m_ClipBox, DC, pos.x, pos.y, + pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color); + + /* Trace des textes : SheetName */ + if( Color > 0 ) txtcolor = Color; + else txtcolor = ReturnLayerColor(LAYER_SHEETNAME); + + Text = wxT("Sheet: ") + m_SheetName; + DrawGraphicText(panel, DC, + wxPoint(pos.x, pos.y - 8), txtcolor, + Text, TEXT_ORIENT_HORIZ, wxSize(m_SheetNameSize,m_SheetNameSize), + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth); + + /* Trace des textes : FileName */ + if( Color >= 0 ) txtcolor = Color; + else txtcolor = ReturnLayerColor(LAYER_SHEETFILENAME); + Text = wxT("File: ") + m_FileName; + DrawGraphicText(panel, DC, + wxPoint(pos.x, pos.y + m_Size.y + 4), + txtcolor, + Text, TEXT_ORIENT_HORIZ, wxSize(m_FileNameSize,m_FileNameSize), + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth); + + + /* Trace des textes : SheetLabel */ + SheetLabelStruct = m_Label; + while( SheetLabelStruct != NULL ) + { + SheetLabelStruct->Draw(panel, DC, offset,DrawMode, Color); + SheetLabelStruct = (DrawSheetLabelStruct*)(SheetLabelStruct->Pnext); + } +} + + +/************************/ /* DrawSheetLabelStruct */ /************************/ @@ -170,4 +223,94 @@ DrawSheetLabelStruct * newitem = newitem->m_Shape = m_Shape; return newitem; -} +} + + + +/********************************************************************************************/ +void DrawSheetLabelStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, + int DrawMode, int Color) +/********************************************************************************************/ +/* Routine de dessin des Labels type hierarchie */ +{ +int side, txtcolor; +int posx , tposx, posy, size2; +wxSize size; +int NbSegm, coord[12]; +int LineWidth = g_DrawMinimunLineWidth; + + if( Color >= 0 ) txtcolor = Color; + else txtcolor = ReturnLayerColor(m_Layer); + GRSetDrawMode(DC, DrawMode); + + posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size; + if( !m_Text.IsEmpty() ) + { + if( m_Edge ) + { + tposx = posx - size.x; + side = GR_TEXT_HJUSTIFY_RIGHT; + } + else + { + tposx = posx + size.x + (size.x /8) ; + side = GR_TEXT_HJUSTIFY_LEFT; + } + DrawGraphicText(panel, DC, wxPoint(tposx, posy), txtcolor, + m_Text, TEXT_ORIENT_HORIZ,size , + side, GR_TEXT_VJUSTIFY_CENTER, LineWidth); + } + /* dessin du symbole de connexion */ + + if(m_Edge) + { + size.x = -size.x; + size.y = -size.y; + } + + coord[0] = posx; coord[1] = posy; size2 = size.x /2; + NbSegm = 0; + switch(m_Shape) + { + case 0: /* input |> */ + coord[2] = posx ; coord[3] = posy - size2; + coord[4] = posx + size2; coord[5] = posy - size2; + coord[6] = posx + size.x; coord[7] = posy; + coord[8] = posx + size2; coord[9] = posy + size2; + coord[10] = posx ; coord[11] = posy + size2; + coord[12] = coord[0] ; coord[13] = coord[1]; + NbSegm = 7; + break; + + case 1: /* output <| */ + coord[2] = posx + size2; coord[3] = posy - size2; + coord[4] = posx + size.x; coord[5] = posy - size2; + coord[6] = posx + size.x; coord[7] = posy + size2; + coord[8] = posx + size2; coord[9] = posy + size2; + coord[10] = coord[0] ; coord[11] = coord[1]; + NbSegm = 6; + break; + + case 2: /* bidi <> */ + case 3: /* TriSt <> */ + coord[2] = posx + size2; coord[3] = posy - size2; + coord[4] = posx + size.x; coord[5] = posy; + coord[6] = posx + size2; coord[7] = posy +size2; + coord[8] = coord[0]; coord[9] = coord[1]; + NbSegm = 5; + break; + + default: /* unsp []*/ + coord[2] = posx ; coord[3] = posy - size2; + coord[4] = posx + size.x; coord[5] = posy - size2; + coord[6] = posx + size.x; coord[7] = posy + size2; + coord[8] = posx ; coord[9] = posy + size2; + coord[10] = coord[0] ; coord[11] = coord[1]; + NbSegm = 6; + break; + } +int FillShape = FALSE; + GRPoly(&panel->m_ClipBox, DC, NbSegm, coord, FillShape, LineWidth, txtcolor, txtcolor); /* Poly Non rempli */ +} + + diff --git a/eeschema/class_text-label.cpp b/eeschema/class_text-label.cpp index c4c0e9da3b..778b8b9afe 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/class_text-label.cpp @@ -43,6 +43,7 @@ DrawTextStruct * newitem = new DrawTextStruct(m_Pos, m_Text); newitem->m_Shape = m_Shape; newitem->m_Orient = m_Orient; newitem->m_Size = m_Size; + newitem->m_Width = m_Width; newitem->m_HJustify = m_HJustify; newitem->m_VJustify = m_VJustify; newitem->m_IsDangling = m_IsDangling ; @@ -58,6 +59,7 @@ void DrawTextStruct::SwapData(DrawTextStruct * copyitem) EXCHG(m_Text, copyitem->m_Text); EXCHG(m_Pos, copyitem->m_Pos); EXCHG(m_Size, copyitem->m_Size); + EXCHG(m_Width, copyitem->m_Width); EXCHG(m_Shape, copyitem->m_Shape); EXCHG(m_Orient, copyitem->m_Orient); EXCHG(m_StructType, copyitem->m_StructType); @@ -134,16 +136,16 @@ void DrawTextStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & of } } -/***************************************************************/ +/*******************************************************************************************/ void DrawTextStruct::DrawAsText(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, int DrawMode, int Color) -/***************************************************************/ -/* Les textes type label ou notes peuvent avoir 4 directions, mais - sont tj cadres par rapport a la 1ere lettre du texte +/*******************************************************************************************/ +/* Texts type Label or Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter */ { int color; - +int width = MAX(m_Width, g_DrawMinimunLineWidth); + if( Color >= 0 ) color = Color; else color = ReturnLayerColor(m_Layer); GRSetDrawMode(DC, DrawMode); @@ -155,28 +157,28 @@ int color; wxPoint(m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y), color, m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, width); break; case 1: /* Orientation vert UP */ DrawGraphicText(panel, DC, wxPoint(m_Pos.x - TXTMARGE + offset.x, m_Pos.y + offset.y), color, m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM); + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, width); break; case 2: /* Orientation horiz inverse */ DrawGraphicText(panel, DC, wxPoint(m_Pos.x + offset.x, m_Pos.y + TXTMARGE + offset.y), color, m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP); + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP, width); break; case 3: /* Orientation vert BOTTOM */ DrawGraphicText(panel, DC, wxPoint(m_Pos.x + TXTMARGE + offset.y, m_Pos.y + offset.y), color, m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, width); break; } if ( m_IsDangling ) @@ -195,14 +197,14 @@ void DrawTextStruct::DrawAsLabel(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoi void DrawTextStruct::DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint& offset, int DrawMode, int Color) /*****************************************************************************/ -/* Les textes type Global label peuvent avoir 4 directions, mais - sont tj cadres par rapport au symbole graphique (icone) +/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon */ { int * Template; int Poly[12]; int ii, jj, imax, color, HalfSize; wxSize Size = m_Size; +int width = MAX(m_Width, g_DrawMinimunLineWidth); if( Color >= 0 ) color = Color; else color = ReturnLayerColor(m_Layer); @@ -217,28 +219,28 @@ wxSize Size = m_Size; DrawGraphicText(panel, DC, wxPoint(m_Pos.x - ii + offset.x, m_Pos.y + offset.y), color, m_Text, TEXT_ORIENT_HORIZ, Size, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width); break; case 1: /* Orientation vert UP */ DrawGraphicText(panel, DC, wxPoint(m_Pos.x + offset.x, m_Pos.y + ii + offset.y), color, m_Text, TEXT_ORIENT_VERT, Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width); break; case 2: /* Orientation horiz inverse */ DrawGraphicText(panel, DC, wxPoint(m_Pos.x + ii + offset.x, m_Pos.y + offset.y), color, m_Text, TEXT_ORIENT_HORIZ, Size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); break; case 3: /* Orientation vert BOTTOM */ DrawGraphicText(panel, DC, wxPoint(m_Pos.x + offset.x, m_Pos.y - ii + offset.y), color, m_Text, TEXT_ORIENT_VERT, Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width); break; } @@ -254,8 +256,8 @@ wxSize Size = m_Size; jj++; Template++; } -// GRPoly(&panel->m_ClipBox, DC, imax,Poly,1, color, color ); /* Polygne Rempli */ - GRPoly(&panel->m_ClipBox, DC, imax,Poly,0, color, color ); /* Polygne Non Rempli */ +// GRPoly(&panel->m_ClipBox, DC, imax,Poly,1, width, color, color ); /* Polygne Rempli */ + GRPoly(&panel->m_ClipBox, DC, imax,Poly,0, width, color, color ); /* Polygne Non Rempli */ if ( m_IsDangling ) DrawDanglingSymbol(panel, DC, m_Pos + offset, color); diff --git a/eeschema/component_class.h b/eeschema/component_class.h index eaa9c73326..e7d78081e3 100644 --- a/eeschema/component_class.h +++ b/eeschema/component_class.h @@ -81,7 +81,7 @@ public: int m_FlagControlMulti; int m_Convert; /* Gestion des mutiples representations (ex: conversion De Morgan) */ int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */ - bool * m_PinIsDangling; // liste des indicateurs de pin non connectee + bool * m_PinIsDangling; // liste des indicateurs de pin non connectee public: EDA_SchComponentStruct(const wxPoint & pos = wxPoint(0,0)); diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index bdf3182959..551f279bad 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -30,7 +30,7 @@ EDA_BaseStruct * WinEDA_SchematicFrame:: /**************************************************************/ /* Routine de localisation et d'affichage des caract (si utile ) - de l'element pointe par la souris + de l'element pointe par la souris ou par le curseur pcb - marqueur - noconnect - jonction @@ -44,100 +44,58 @@ EDA_BaseStruct * WinEDA_SchematicFrame:: */ { EDA_BaseStruct *DrawStruct; -LibDrawPin * Pin; -EDA_SchComponentStruct * LibItem; -wxString Text; -char Line[1024]; wxString msg; -int ii; +wxPoint mouse_position = GetScreen()->m_MousePosition; +LibDrawPin * Pin = NULL; +EDA_SchComponentStruct * LibItem = NULL; +char Line[1024]; - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, MARKERITEM); - if( DrawStruct ) - { - DrawMarkerStruct * Marker = (DrawMarkerStruct *) DrawStruct; - ii = Marker->m_Type; - Text = Marker->GetComment(); - if(Text.IsEmpty() ) Text = wxT("NoComment"); - msg = NameMarqueurType[ii]; msg << wxT(" << ") << Text; - Affiche_Message(msg); - return(DrawStruct); - } - - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, - NOCONNECTITEM); - if( DrawStruct ) - { - Affiche_Message(wxEmptyString); - return(DrawStruct); - } - - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, - JUNCTIONITEM); - if( DrawStruct ) - { - Affiche_Message(wxEmptyString); - return(DrawStruct); - } - - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, - WIREITEM|BUSITEM|RACCORDITEM); - if( DrawStruct ) // Recherche d'une pin eventelle + DrawStruct = SchematicGeneralLocateAndDisplay(mouse_position, IncludePin); + if(! DrawStruct && ( mouse_position != GetScreen()->m_Curseur) ) { - Pin = LocateAnyPin(m_CurrentScreen->EEDrawList,m_CurrentScreen->m_Curseur, &LibItem); - if( Pin ) - { - Pin->Display_Infos(this); - if ( LibItem ) - Affiche_1_Parametre( this, 1, - LibItem->m_Field[REFERENCE].m_Text, - LibItem->m_Field[VALUE].m_Text, - CYAN); - - /* envoi id pin a pcbnew */ - if(Pin->m_PinNum) - { - char pinnum[20]; - pinnum[0] = Pin->m_PinNum & 255; - pinnum[1] = (Pin->m_PinNum >> 8 ) & 255; - pinnum[2] = (Pin->m_PinNum >> 16 ) & 255; - pinnum[3] = (Pin->m_PinNum >> 24 ) & 255; - pinnum[4] = 0; - sprintf(Line,"$PIN: %s $PART: %s", pinnum, - CONV_TO_UTF8(LibItem->m_Field[REFERENCE].m_Text)); - SendCommand(MSG_TO_PCB, Line); - } - } - else Affiche_Message(wxEmptyString); - return(DrawStruct); + DrawStruct = SchematicGeneralLocateAndDisplay(GetScreen()->m_Curseur, IncludePin); } + if ( ! DrawStruct ) return NULL; - // Cross probing: Send a command to pcbnew via a socket link, service 4242 - // Cross probing:1- look for a component, and send a locate footprint command to pcbnew - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, - FIELDCMPITEM); - if( DrawStruct ) - { - PartTextStruct * Field = (PartTextStruct *) DrawStruct; - LibItem = (EDA_SchComponentStruct * )Field->m_Parent; - LibItem->Display_Infos(this); - - sprintf(Line,"$PART: %s", CONV_TO_UTF8(LibItem->m_Field[REFERENCE].m_Text) ); - SendCommand(MSG_TO_PCB, Line); - - return(DrawStruct); - } - - /* search for a pin */ - Pin = LocateAnyPin(m_CurrentScreen->EEDrawList,m_CurrentScreen->m_Curseur, &LibItem); - if( Pin ) + /* Cross probing to pcbnew if a pin or a component is found */ + switch (DrawStruct->m_StructType ) { + case COMPONENT_FIELD_DRAW_TYPE: + { + PartTextStruct * Field = (PartTextStruct *) DrawStruct; + LibItem = (EDA_SchComponentStruct * )Field->m_Parent; + sprintf(Line,"$PART: %s", CONV_TO_UTF8(LibItem->m_Field[REFERENCE].m_Text)); + SendCommand(MSG_TO_PCB, Line); + } + break; + + case DRAW_LIB_ITEM_STRUCT_TYPE: + Pin = LocateAnyPin(m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem); + if ( Pin ) break; // Priority is probing a pin first + LibItem = (EDA_SchComponentStruct *) DrawStruct; + sprintf(Line,"$PART: %s", CONV_TO_UTF8(LibItem->m_Field[REFERENCE].m_Text) ); + SendCommand(MSG_TO_PCB, Line); + break; + + default: + Pin = LocateAnyPin(m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem); + break; + + case COMPONENT_PIN_DRAW_TYPE: + Pin = (LibDrawPin*) DrawStruct; + break; + } + + if ( Pin ) + { + /* Force display pin infos (the previous display could be a component info) */ Pin->Display_Infos(this); if ( LibItem ) Affiche_1_Parametre( this, 1, LibItem->m_Field[REFERENCE].m_Text, LibItem->m_Field[VALUE].m_Text, CYAN); - + // Cross probing:2 - pin found, and send a locate pin command to pcbnew (hightlight net) if(Pin->m_PinNum) { @@ -147,26 +105,119 @@ int ii; CONV_TO_UTF8(LibItem->m_Field[REFERENCE].m_Text)); SendCommand(MSG_TO_PCB, Line); } + } + return DrawStruct; +} + +/************************************************************************************/ +EDA_BaseStruct * WinEDA_SchematicFrame:: + SchematicGeneralLocateAndDisplay(const wxPoint & refpoint, bool IncludePin) +/************************************************************************************/ + +/* Find the schematic item at position "refpoint" + the priority order is: + - marker + - noconnect + - junction + - wire/bus/entry + - label + - pin + - component + return: + an EDA_BaseStruct pointer on the item + a Null pointer if no item found + + For some items, caracteristics are displayed on the screen. +*/ +{ +EDA_BaseStruct *DrawStruct; +LibDrawPin * Pin; +EDA_SchComponentStruct * LibItem; +wxString Text; +wxString msg; +int ii; + + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, MARKERITEM); + if( DrawStruct ) + { + DrawMarkerStruct * Marker = (DrawMarkerStruct *) DrawStruct; + ii = Marker->m_Type; + Text = Marker->GetComment(); + if(Text.IsEmpty() ) Text = wxT("NoComment"); + msg = NameMarqueurType[ii]; msg << wxT(" << ") << Text; + Affiche_Message(msg); + return(DrawStruct); + } + + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, + NOCONNECTITEM); + if( DrawStruct ) + { + MsgPanel->EraseMsgBox(); + return(DrawStruct); + } + + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, + JUNCTIONITEM); + if( DrawStruct ) + { + MsgPanel->EraseMsgBox(); + return(DrawStruct); + } + + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, + WIREITEM|BUSITEM|RACCORDITEM); + if( DrawStruct ) // Search for a pin + { + Pin = LocateAnyPin(m_CurrentScreen->EEDrawList,refpoint, &LibItem); + if( Pin ) + { + Pin->Display_Infos(this); + if ( LibItem ) + Affiche_1_Parametre( this, 1, + LibItem->m_Field[REFERENCE].m_Text, + LibItem->m_Field[VALUE].m_Text, + CYAN); + + } + else MsgPanel->EraseMsgBox(); + return(DrawStruct); + } + + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, FIELDCMPITEM); + if( DrawStruct ) + { + PartTextStruct * Field = (PartTextStruct *) DrawStruct; + LibItem = (EDA_SchComponentStruct * )Field->m_Parent; + LibItem->Display_Infos(this); + + return(DrawStruct); + } + + /* search for a pin */ + Pin = LocateAnyPin(m_CurrentScreen->EEDrawList, refpoint, &LibItem); + if( Pin ) + { + Pin->Display_Infos(this); + if ( LibItem ) + Affiche_1_Parametre( this, 1, + LibItem->m_Field[REFERENCE].m_Text, + LibItem->m_Field[VALUE].m_Text, + CYAN); if ( IncludePin == TRUE ) return(LibItem); } - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, - LIBITEM); + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, LIBITEM); if( DrawStruct ) { DrawStruct = LocateSmallestComponent( GetScreen() ); LibItem = (EDA_SchComponentStruct *) DrawStruct; LibItem->Display_Infos(this); - - sprintf(Line,"$PART: %s", - CONV_TO_UTF8(LibItem->m_Field[REFERENCE].m_Text)); - SendCommand(MSG_TO_PCB, Line); - return(DrawStruct); } - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, SHEETITEM); if( DrawStruct ) { @@ -175,7 +226,7 @@ int ii; } // Recherche des autres elements - DrawStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList, + DrawStruct = PickStruct(refpoint, GetScreen()->EEDrawList, SEARCHALL); if( DrawStruct ) { @@ -188,9 +239,9 @@ int ii; -/**************************************************************/ -void WinEDA_DrawFrame::GeneralControle(wxDC *DC, wxPoint Mouse) -/**************************************************************/ +/***********************************************************************/ +void WinEDA_DrawFrame::GeneralControle(wxDC *DC, wxPoint MousePositionInPixels) +/***********************************************************************/ { wxSize delta; int zoom = m_CurrentScreen->GetZoom(); @@ -199,7 +250,7 @@ int hotkey = 0; ActiveScreen = (SCH_SCREEN *) m_CurrentScreen; - curpos = DrawPanel->CursorRealPosition(Mouse); + curpos = m_CurrentScreen->m_MousePosition; oldpos = m_CurrentScreen->m_Curseur; delta.x = m_CurrentScreen->GetGrid().x / zoom; @@ -252,26 +303,26 @@ int hotkey = 0; case WXK_NUMPAD8 : /* Deplacement curseur vers le haut */ case WXK_UP : - Mouse.y -= delta.y; - DrawPanel->MouseTo(Mouse); + MousePositionInPixels.y -= delta.y; + DrawPanel->MouseTo(MousePositionInPixels); break ; case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_DOWN: - Mouse.y += delta.y; - DrawPanel->MouseTo(Mouse); + MousePositionInPixels.y += delta.y; + DrawPanel->MouseTo(MousePositionInPixels); break ; case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_LEFT : - Mouse.x -= delta.x; - DrawPanel->MouseTo(Mouse); + MousePositionInPixels.x -= delta.x; + DrawPanel->MouseTo(MousePositionInPixels); break ; case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_RIGHT: - Mouse.x += delta.x; - DrawPanel->MouseTo(Mouse); + MousePositionInPixels.x += delta.x; + DrawPanel->MouseTo(MousePositionInPixels); break; case WXK_INSERT: diff --git a/eeschema/delete.cpp b/eeschema/delete.cpp index 08c1844643..79fc75c14d 100644 --- a/eeschema/delete.cpp +++ b/eeschema/delete.cpp @@ -254,11 +254,10 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; /*****************************************************************/ -void LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC) +bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC) /*****************************************************************/ - -/* Routine d'effacement d'un element de schema ( et placement en "undelete" ) - si plusieurs elements sont superposes: ordre de priorite: +/* Locate and delete the item found under the mouse cousor + If more than one item found: the priority order is: 1 : MARQUEUR 2 : JUNCTION 2 : NOCONNECT @@ -267,11 +266,13 @@ void LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC) 5 : TEXT 6 : COMPOSANT 7 : SHEET -*/ + return TRUE if an item was deleted +*/ { EDA_BaseStruct * DelStruct; SCH_SCREEN * screen = frame->GetScreen(); +bool item_deleted = FALSE; DelStruct = PickStruct(screen->m_Curseur, screen->EEDrawList, MARKERITEM); @@ -298,7 +299,10 @@ SCH_SCREEN * screen = frame->GetScreen(); DeleteStruct(frame->DrawPanel, DC, DelStruct); frame->TestDanglingEnds(frame->m_CurrentScreen->EEDrawList, DC); frame->GetScreen()->SetModify(); + item_deleted = TRUE; } + + return item_deleted; } diff --git a/eeschema/dialog_build_BOM.cpp b/eeschema/dialog_build_BOM.cpp index 12826a003f..d695fc75c2 100644 --- a/eeschema/dialog_build_BOM.cpp +++ b/eeschema/dialog_build_BOM.cpp @@ -74,6 +74,7 @@ static bool s_ListWithSubCmponents; static bool s_ListHierarchicalPinByName; static bool s_ListBySheet; static bool s_BrowsList; +static int s_OutputFormOpt; static bool s_Add_F1_state; static bool s_Add_F2_state; static bool s_Add_F3_state; @@ -142,6 +143,7 @@ bool WinEDA_Build_BOM_Frame::Create( wxWindow* parent, wxWindowID id, const wxSt m_ListCmpbyValItems = NULL; m_GenListLabelsbyVal = NULL; m_GenListLabelsbySheet = NULL; + m_OutputFormCtrl = NULL; m_FieldsToAppendListSizer = NULL; m_AddField1 = NULL; m_AddField2 = NULL; @@ -155,7 +157,7 @@ bool WinEDA_Build_BOM_Frame::Create( wxWindow* parent, wxWindowID id, const wxSt ////@end WinEDA_Build_BOM_Frame member initialisation ////@begin WinEDA_Build_BOM_Frame creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + SetExtraStyle(wxWS_EX_BLOCK_EVENTS); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); @@ -177,7 +179,7 @@ void WinEDA_Build_BOM_Frame::CreateControls() SetFont(*g_DialogFont); ////@begin WinEDA_Build_BOM_Frame content construction - // Generated by DialogBlocks, 07/08/2006 10:59:57 (unregistered) + // Generated by DialogBlocks, 09/05/2007 13:11:12 (unregistered) WinEDA_Build_BOM_Frame* itemDialog1 = this; @@ -187,32 +189,42 @@ void WinEDA_Build_BOM_Frame::CreateControls() wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("List items : ")); - wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); - itemBoxSizer3->Add(itemStaticBoxSizer4, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemDialog1, wxID_ANY, _("List items : ")); + wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL); + itemBoxSizer4->Add(itemStaticBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); m_ListCmpbyRefItems = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Components by Reference"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ListCmpbyRefItems->SetValue(true); - itemStaticBoxSizer4->Add(m_ListCmpbyRefItems, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer5->Add(m_ListCmpbyRefItems, 0, wxGROW|wxALL, 5); m_ListSubCmpItems = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Sub Components (i.e U2A, U2B..)"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ListSubCmpItems->SetValue(false); - itemStaticBoxSizer4->Add(m_ListSubCmpItems, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer5->Add(m_ListSubCmpItems, 0, wxGROW|wxALL, 5); m_ListCmpbyValItems = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Components by Value"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ListCmpbyValItems->SetValue(true); - itemStaticBoxSizer4->Add(m_ListCmpbyValItems, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer5->Add(m_ListCmpbyValItems, 0, wxGROW|wxALL, 5); m_GenListLabelsbyVal = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Hierachy Pins by name"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_GenListLabelsbyVal->SetValue(false); - itemStaticBoxSizer4->Add(m_GenListLabelsbyVal, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer5->Add(m_GenListLabelsbyVal, 0, wxGROW|wxALL, 5); m_GenListLabelsbySheet = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _("Hierachy Pins by Sheets"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_GenListLabelsbySheet->SetValue(false); - itemStaticBoxSizer4->Add(m_GenListLabelsbySheet, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer5->Add(m_GenListLabelsbySheet, 0, wxGROW|wxALL, 5); - wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Fields to Add")); - m_FieldsToAppendListSizer = new wxStaticBoxSizer(itemStaticBoxSizer10Static, wxVERTICAL); + wxArrayString m_OutputFormCtrlStrings; + m_OutputFormCtrlStrings.Add(_("Print as list")); + m_OutputFormCtrlStrings.Add(_("Print as text for spreadsheet import")); + m_OutputFormCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Ouput:"), wxDefaultPosition, wxDefaultSize, m_OutputFormCtrlStrings, 1, wxRA_SPECIFY_COLS ); + m_OutputFormCtrl->SetSelection(0); + itemBoxSizer4->Add(m_OutputFormCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Fields to Add")); + m_FieldsToAppendListSizer = new wxStaticBoxSizer(itemStaticBoxSizer12Static, wxVERTICAL); itemBoxSizer3->Add(m_FieldsToAppendListSizer, 0, wxGROW|wxALL, 5); m_AddField1 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD1, _("Add Field 1"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -247,25 +259,25 @@ void WinEDA_Build_BOM_Frame::CreateControls() m_AddField8->SetValue(false); m_FieldsToAppendListSizer->Add(m_AddField8, 0, wxGROW|wxALL, 5); - wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer3->Add(itemBoxSizer21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxButton* itemButton20 = new wxButton( itemDialog1, wxID_OK, _("&Create List"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton20->SetDefault(); - itemButton20->SetForegroundColour(wxColour(166, 0, 0)); - itemBoxSizer19->Add(itemButton20, 0, wxGROW|wxALL, 5); + wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _("&Create List"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton22->SetDefault(); + itemButton22->SetForegroundColour(wxColour(166, 0, 0)); + itemBoxSizer21->Add(itemButton22, 0, wxGROW|wxALL, 5); - wxButton* itemButton21 = new wxButton( itemDialog1, wxID_EXIT, _("&Quit"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton21->SetForegroundColour(wxColour(0, 0, 210)); - itemBoxSizer19->Add(itemButton21, 0, wxGROW|wxALL, 5); + wxButton* itemButton23 = new wxButton( itemDialog1, wxID_EXIT, _("&Quit"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton23->SetForegroundColour(wxColour(0, 0, 210)); + itemBoxSizer21->Add(itemButton23, 0, wxGROW|wxALL, 5); - wxStaticBox* itemStaticBoxSizer22Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options")); - wxStaticBoxSizer* itemStaticBoxSizer22 = new wxStaticBoxSizer(itemStaticBoxSizer22Static, wxHORIZONTAL); - itemBoxSizer2->Add(itemStaticBoxSizer22, 0, wxGROW|wxALL, 10); + wxStaticBox* itemStaticBoxSizer24Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options")); + wxStaticBoxSizer* itemStaticBoxSizer24 = new wxStaticBoxSizer(itemStaticBoxSizer24Static, wxHORIZONTAL); + itemBoxSizer2->Add(itemStaticBoxSizer24, 0, wxGROW|wxALL, 10); m_GetListBrowser = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _("Launch list browser"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_GetListBrowser->SetValue(false); - itemStaticBoxSizer22->Add(m_GetListBrowser, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemStaticBoxSizer24->Add(m_GetListBrowser, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); // Set validators m_ListCmpbyRefItems->SetValidator( wxGenericValidator(& s_ListByRef) ); @@ -273,6 +285,7 @@ void WinEDA_Build_BOM_Frame::CreateControls() m_ListCmpbyValItems->SetValidator( wxGenericValidator(& s_ListByValue) ); m_GenListLabelsbyVal->SetValidator( wxGenericValidator(& s_ListHierarchicalPinByName) ); m_GenListLabelsbySheet->SetValidator( wxGenericValidator(& s_ListBySheet) ); + m_OutputFormCtrl->SetValidator( wxGenericValidator(& s_OutputFormOpt) ); m_AddField1->SetValidator( wxGenericValidator(& s_Add_F1_state) ); m_AddField2->SetValidator( wxGenericValidator(& s_Add_F2_state) ); m_AddField3->SetValidator( wxGenericValidator(& s_Add_F3_state) ); @@ -326,10 +339,7 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name ) void WinEDA_Build_BOM_Frame::OnOkClick( wxCommandEvent& event ) { GenList(); -////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_Build_BOM_Frame. - // Before editing this code, remove the block markers. event.Skip(); -////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_Build_BOM_Frame. } @@ -347,6 +357,7 @@ void WinEDA_Build_BOM_Frame::OnExitClick( wxCommandEvent& event ) s_Add_F6_state = m_AddField6->GetValue(); s_Add_F7_state = m_AddField7->GetValue(); s_Add_F8_state = m_AddField8->GetValue(); + s_OutputFormOpt = m_OutputFormCtrl->GetSelection(); EndModal(0); } @@ -363,6 +374,7 @@ wxString mask, filename; s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue(); s_ListBySheet = m_GenListLabelsbySheet->GetValue(); s_BrowsList = m_GetListBrowser->GetValue(); + s_OutputFormOpt = m_OutputFormCtrl->GetSelection(); m_ListFileName = ScreenSch->m_FileName; ChangeFileNameExt(m_ListFileName, EXT_LIST); @@ -380,8 +392,10 @@ wxString mask, filename; if ( filename.IsEmpty() ) return; else m_ListFileName = filename; - /* Close dialog and show le list, if wanted */ - GenereListeOfItems(m_ListFileName); + /* Close dialog and show the list, if wanted */ + if ( s_OutputFormOpt == 0) GenereListeOfItems(m_ListFileName); + else CreateExportList(m_ListFileName); + Close(); if ( s_BrowsList ) @@ -392,6 +406,58 @@ wxString mask, filename; } } + +/****************************************************************************/ +void WinEDA_Build_BOM_Frame::CreateExportList(const wxString & FullFileName) +/****************************************************************************/ +/* + Print a list of components, in a form which can be imported by a spreadsheet + form is; + cmp name;cmp val; fields; +*/ +{ +FILE *f; +EDA_BaseStruct ** List; +int NbItems; +wxString msg; + + /* Creation de la liste des elements */ + if ((f = wxFopen(FullFileName, wxT("wt"))) == NULL) + { + msg = _("Failed to open file "); msg << FullFileName; + DisplayError(this, msg); + return; + } + + NbItems = GenListeCmp(NULL ); + if ( NbItems ) + { + List = (EDA_BaseStruct **) + MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) ); + if (List == NULL ) + { + fclose(f); return; + } + + GenListeCmp(List); + + /* sort component list */ + qsort( List, NbItems, sizeof( EDA_BaseStruct * ), + (int(*)(const void*, const void*))ListTriComposantByRef); + + if( ! s_ListWithSubCmponents ) DeleteSubCmp(List, NbItems); + + /* create the file */ + PrintListeCmpByRef(f, List, NbItems, TRUE); + + MyFree( List ); + } + + fclose(f); +} + + + /****************************************************************************/ void WinEDA_Build_BOM_Frame::GenereListeOfItems(const wxString & FullFileName) /****************************************************************************/ @@ -776,7 +842,8 @@ const wxString * OldName = NULL; /*******************************************************************************************/ -void WinEDA_Build_BOM_Frame::PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem) +void WinEDA_Build_BOM_Frame::PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, + bool CompactForm) /*******************************************************************************************/ { wxCheckBox * FieldListCtrl[FIELD8-FIELD1+1] = { @@ -787,22 +854,29 @@ wxCheckBox * FieldListCtrl[FIELD8-FIELD1+1] = { m_AddField5, m_AddField6, m_AddField7, - m_AddField8 -}; + m_AddField8 + }; int ii; wxCheckBox * FieldCtrl = FieldListCtrl[0]; + if ( CompactForm ) + { + fprintf(f, ";%s", CONV_TO_UTF8(DrawLibItem->m_Field[FOOTPRINT].m_Text)); + } + for ( ii = FIELD1; ii <= FIELD8; ii ++ ) { FieldCtrl = FieldListCtrl[ii-FIELD1]; if ( FieldCtrl == NULL ) continue; if ( ! FieldCtrl->IsChecked() ) continue; - fprintf(f, "; %-12s", CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); + if ( CompactForm ) fprintf(f, ";%s", CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); + else fprintf(f, "; %-12s", CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); } } /*********************************************************************************************/ -int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems ) +int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems, + bool CompactForm ) /*********************************************************************************************/ /* Print the B.O.M sorted by reference */ @@ -814,9 +888,35 @@ EDA_LibComponentStruct *Entry; char NameCmp[80]; wxString msg; - msg = _("\n#Cmp ( order = Reference )"); - if ( s_ListWithSubCmponents ) msg << _(" (with SubCmp)"); - fprintf( f, "%s\n", CONV_TO_UTF8(msg)); + if ( CompactForm ) + { + fprintf(f, "ref;value;sheet number;sheet name;footprint" ); + wxCheckBox * FieldListCtrl[FIELD8-FIELD1+1] = { + m_AddField1, + m_AddField2, + m_AddField3, + m_AddField4, + m_AddField5, + m_AddField6, + m_AddField7, + m_AddField8 + }; + for ( ii = FIELD1; ii <= FIELD8; ii ++ ) + { + wxCheckBox * FieldCtrl = FieldListCtrl[ii-FIELD1]; + if ( FieldCtrl == NULL ) continue; + if ( ! FieldCtrl->IsChecked() ) continue; + msg = _("Field"); + fprintf(f, ";%s%d", CONV_TO_UTF8(msg), ii - FIELD1 + 1); + } + fprintf( f, "\n"); + } + + else { + msg = _("\n#Cmp ( order = Reference )"); + if ( s_ListWithSubCmponents ) msg << _(" (with SubCmp)"); + fprintf( f, "%s\n", CONV_TO_UTF8(msg)); + } for ( ii = 0; ii < NbItems; ii++ ) { @@ -834,29 +934,37 @@ wxString msg; if( (Multi > 1 ) && s_ListWithSubCmponents ) Unit = DrawLibItem->m_Multi + 'A' - 1; - sprintf( NameCmp,"%s%c", CONV_TO_UTF8(DrawLibItem->m_Field[REFERENCE].m_Text), - Unit); - fprintf(f, "| %-10s %-12s", - NameCmp, + sprintf( NameCmp,"%s", CONV_TO_UTF8(DrawLibItem->m_Field[REFERENCE].m_Text) ); + if ( ! CompactForm || Unit != ' ' ) sprintf( NameCmp+strlen(NameCmp),"%c", Unit); + + if ( CompactForm ) fprintf(f, "%s;%s", NameCmp, + CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text)); + else fprintf(f, "| %-10s %-12s", NameCmp, CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text)); if ( s_ListWithSubCmponents ) { - BASE_SCREEN * screen = (BASE_SCREEN *)(DrawLibItem->m_Parent); + DrawSheetStruct * sheet = (DrawSheetStruct *)(DrawLibItem->m_Parent); wxString sheetname; - if( screen->m_Parent ) - sheetname = ((DrawSheetStruct*)screen->m_Parent)->m_SheetName.GetData(); + if( sheet && sheet->m_StructType == DRAW_SHEET_STRUCT_TYPE ) + sheetname = sheet->m_SheetName; else sheetname = _("Root"); - fprintf(f, " (Sheet %.2d: \"%s\")", DrawLibItem->m_FlagControlMulti, + if ( CompactForm ) + fprintf(f, ";%d;%s", DrawLibItem->m_FlagControlMulti, + CONV_TO_UTF8(sheetname)); + else fprintf(f, " (Sheet %.2d: \"%s\")", DrawLibItem->m_FlagControlMulti, CONV_TO_UTF8(sheetname)); } - PrintFieldData(f, DrawLibItem); + PrintFieldData(f, DrawLibItem, CompactForm); fprintf(f,"\n"); } - msg = _("#End Cmp\n"); - fprintf(f, CONV_TO_UTF8(msg)); + if ( ! CompactForm ) + { + msg = _("#End Cmp\n"); + fprintf(f, CONV_TO_UTF8(msg)); + } return(0); } diff --git a/eeschema/dialog_build_BOM.h b/eeschema/dialog_build_BOM.h index c465c9dfec..0dd9210bd1 100644 --- a/eeschema/dialog_build_BOM.h +++ b/eeschema/dialog_build_BOM.h @@ -39,16 +39,12 @@ ////@begin control identifiers #define ID_DIALOG 10000 -#define SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxSTAY_ON_TOP|wxCLOSE_BOX -#define SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE _("List of Material") -#define SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION wxDefaultPosition #define ID_CHECKBOX 10001 #define ID_CHECKBOX2 10004 #define ID_CHECKBOX1 10003 #define ID_CHECKBOX3 10005 #define ID_CHECKBOX4 10006 +#define ID_RADIOBOX1 10009 #define ID_CHECKBOX_FIELD1 10007 #define ID_CHECKBOX_FIELD2 10008 #define ID_CHECKBOX_FIELD4 10010 @@ -57,6 +53,11 @@ #define ID_CHECKBOX_FIELD7 10013 #define ID_CHECKBOX_FIELD8 10014 #define ID_CHECKBOX5 10002 +#define SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxSTAY_ON_TOP|wxCLOSE_BOX +#define SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE _("List of Material") +#define SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME ID_DIALOG +#define SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE wxSize(400, 300) +#define SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION wxDefaultPosition ////@end control identifiers /*! @@ -119,9 +120,10 @@ public: wxIcon GetIconResource( const wxString& name ); ////@end WinEDA_Build_BOM_Frame member function declarations void GenereListeOfItems(const wxString & FullFileName); - int PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems ); + void CreateExportList(const wxString & FullFileName); + int PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems, bool CompactForm = FALSE ); int PrintListeCmpByVal( FILE *f, EDA_BaseStruct **List, int NbItems); - void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem); + void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, bool CompactForm = FALSE); /// Should we show tooltips? @@ -133,6 +135,7 @@ public: wxCheckBox* m_ListCmpbyValItems; wxCheckBox* m_GenListLabelsbyVal; wxCheckBox* m_GenListLabelsbySheet; + wxRadioBox* m_OutputFormCtrl; wxStaticBoxSizer* m_FieldsToAppendListSizer; wxCheckBox* m_AddField1; wxCheckBox* m_AddField2; diff --git a/eeschema/dialog_build_BOM.pjd b/eeschema/dialog_build_BOM.pjd index f79bba5f74..e5c60017a8 100644 --- a/eeschema/dialog_build_BOM.pjd +++ b/eeschema/dialog_build_BOM.pjd @@ -1,4 +1,4 @@ - +
0 @@ -6,7 +6,6 @@ "" "" "" - 31 "" 0 0 @@ -18,6 +17,7 @@ "GNU license" "" 0 + 0 "<All platforms>" "<Any>" "///////////////////////////////////////////////////////////////////////////// @@ -43,11 +43,6 @@ // Licence: ///////////////////////////////////////////////////////////////////////////// -" - "/*! - * %BODY% - */ - " "///////////////////////////////////////////////////////////////////////////// // Name: %SYMBOLS-FILENAME% @@ -81,6 +76,14 @@ #include "wx/wx.h" #endif +" + " /// %BODY% +" + " +/*! + * %BODY% + */ + " "app_resources.h" "app_resources.cpp" @@ -92,17 +95,20 @@ "" "<None>" "<System>" + "utf-8" "<System>" "" 0 0 4 + " " "" 0 0 1 1 1 + 0 1
@@ -237,7 +243,7 @@ 1 1 0 - 0 + 1 "Windows" "html-document" @@ -261,6 +267,8 @@ 10000 0 "" + 0 + "" 0 "wxEVT_CLOSE_WINDOW|OnCloseWindow" "ID_DIALOG" @@ -315,6 +323,7 @@ -1 400 300 + 0 "" "wxBoxSizer V" @@ -359,7 +368,7 @@ 0 "<Any platform>" - "wxStaticBoxSizer V" + "wxBoxSizer V" "dialog-control-document" "" "sizer" @@ -367,16 +376,8 @@ 1 0 0 - "15/4/2006" - "wbStaticBoxSizerProxy" - "wxID_ANY" - -1 - "List items : " - "" - "" - "" - 0 - 1 + "9/5/2007" + "wbBoxSizerProxy" "Vertical" "" "Centre" @@ -392,46 +393,29 @@ 0 "<Any platform>" - "wxCheckBox: ID_CHECKBOX" + "wxStaticBoxSizer V" "dialog-control-document" "" - "checkbox" + "sizer" 0 1 0 0 - "15/4/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX" - 10001 - "wxCheckBox" - "m_ListCmpbyRefItems" - "Components by Reference" - 1 - "" - "" - "s_ListByRef" - "wxGenericValidator(& %VARIABLE%)" - "" + "9/5/2007" + "wbStaticBoxSizerProxy" + "wxID_ANY" + -1 + "List items : " + "" + "" "" "" 0 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" + "wxStaticBox" + "Vertical" + "Centre" + "Expand" 0 5 1 @@ -441,40 +425,334 @@ 0 0 0 - "" - "" + "<Any platform>" + + "wxCheckBox: ID_CHECKBOX" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "9/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX" + 10001 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_ListCmpbyRefItems" + "Components by Reference" + 1 + "" + "" + "s_ListByRef" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX2" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "9/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX2" + 10004 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_ListSubCmpItems" + "Sub Components (i.e U2A, U2B..)" + 0 + "" + "" + "s_ListWithSubCmponents" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX1" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "9/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX1" + 10003 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_ListCmpbyValItems" + "Components by Value" + 1 + "" + "" + "s_ListByValue" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX3" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "9/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX3" + 10005 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_GenListLabelsbyVal" + "Hierachy Pins by name" + 0 + "" + "" + "s_ListHierarchicalPinByName" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX4" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "9/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX4" + 10006 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_GenListLabelsbySheet" + "Hierachy Pins by Sheets" + 0 + "" + "" + "s_ListBySheet" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + - "wxCheckBox: ID_CHECKBOX2" + "wxRadioBox: ID_RADIOBOX1" "dialog-control-document" "" - "checkbox" + "radiobox" 0 1 0 0 - "7/8/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX2" - 10004 - "wxCheckBox" - "m_ListSubCmpItems" - "Sub Components (i.e U2A, U2B..)" - 0 + "9/5/2007" + "wbRadioBoxProxy" + "ID_RADIOBOX1" + 10009 + "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" + "m_OutputFormCtrl" + "Ouput:" + 1 + "Print as list|Print as text for spreadsheet import" + 0 "" "" - "s_ListWithSubCmponents" - "wxGenericValidator(& %VARIABLE%)" "" "" "" 0 1 "<Any platform>" - 0 - 1 - 0 - 0 + "s_OutputFormOpt" + "wxGenericValidator(& %VARIABLE%)" + 0 + 1 0 0 0 @@ -483,166 +761,7 @@ -1 -1 -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX1" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "15/4/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX1" - 10003 - "wxCheckBox" - "m_ListCmpbyValItems" - "Components by Value" - 1 - "" - "" - "s_ListByValue" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX3" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "15/4/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX3" - 10005 - "wxCheckBox" - "m_GenListLabelsbyVal" - "Hierachy Pins by name" - 0 - "" - "" - "s_ListHierarchicalPinByName" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX4" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "15/4/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX4" - 10006 - "wxCheckBox" - "m_GenListLabelsbySheet" - "Hierachy Pins by Sheets" - 0 - "" - "" - "s_ListBySheet" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" + "Centre" "Centre" 0 5 @@ -671,13 +790,14 @@ "wxID_ANY" "-1" "Fields to Add" + "" "m_FieldsToAppendListSizer" "" "" 0 1 + "wxStaticBox" "Vertical" - "" "Centre" "Expand" 0 @@ -704,6 +824,11 @@ "ID_CHECKBOX_FIELD1" 10007 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField1" "Add Field 1" 0 @@ -757,6 +882,11 @@ "ID_CHECKBOX_FIELD2" 10008 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField2" "Add Field 2" 0 @@ -810,6 +940,11 @@ "ID_CHECKBOX_FIELD1" 10007 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField3" "Add Field 3" 0 @@ -863,6 +998,11 @@ "ID_CHECKBOX_FIELD4" 10010 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField4" "Add Field 4" 0 @@ -916,6 +1056,11 @@ "ID_CHECKBOX_FIELD5" 10011 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField5" "Add Field 5" 0 @@ -969,6 +1114,11 @@ "ID_CHECKBOX_FIELD6" 10012 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField6" "Add Field 6" 0 @@ -1022,6 +1172,11 @@ "ID_CHECKBOX_FIELD7" 10013 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField7" "Add Field 7" 0 @@ -1075,6 +1230,11 @@ "ID_CHECKBOX_FIELD8" 10014 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_AddField8" "Add Field 8" 0 @@ -1155,6 +1315,11 @@ "wxID_OK" 5100 "wxButton" + "wxButton" + 1 + 0 + "" + "" "" "&Create List" 1 @@ -1209,6 +1374,11 @@ "wxID_EXIT" 5006 "wxButton" + "wxButton" + 1 + 0 + "" + "" "" "&Quit" 0 @@ -1264,13 +1434,14 @@ "wxID_ANY" "-1" "Options" + "" "" "" "" 0 1 + "wxStaticBox" "Horizontal" - "" "Expand" "Centre" 0 @@ -1297,6 +1468,11 @@ "ID_CHECKBOX5" 10002 "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_GetListBrowser" "Launch list browser" 0 diff --git a/eeschema/dialog_cmp_graphic_properties.cpp b/eeschema/dialog_cmp_graphic_properties.cpp index a17a5522e5..0fcd853a49 100644 --- a/eeschema/dialog_cmp_graphic_properties.cpp +++ b/eeschema/dialog_cmp_graphic_properties.cpp @@ -1,233 +1,249 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_cmp_graphic_properties.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 12/02/2006 11:38:02 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 12/02/2006 11:38:02 - - -////@begin includes -////@end includes - -#include "dialog_cmp_graphic_properties.h" - -////@begin XPM images -////@end XPM images - -/*! - * WinEDA_bodygraphics_PropertiesFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_bodygraphics_PropertiesFrame, wxDialog ) - -/*! - * WinEDA_bodygraphics_PropertiesFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_bodygraphics_PropertiesFrame, wxDialog ) - -////@begin WinEDA_bodygraphics_PropertiesFrame event table entries - EVT_BUTTON( wxID_OK, WinEDA_bodygraphics_PropertiesFrame::OnOkClick ) - - EVT_BUTTON( wxID_CANCEL, WinEDA_bodygraphics_PropertiesFrame::OnCancelClick ) - -////@end WinEDA_bodygraphics_PropertiesFrame event table entries - -END_EVENT_TABLE() - -/*! - * WinEDA_bodygraphics_PropertiesFrame constructors - */ - -WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( ) -{ -} - -WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -LibEDA_BaseStruct * CurrentItem = CurrentDrawItem; - - m_Parent = parent; - Create(parent, id, caption, pos, size, style); - - /* Set the dialog items: */ - if ( CurrentItem ) - { - if ( CurrentItem->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE); - } - else if ( ! g_FlDrawSpecificUnit ) m_CommonUnit->SetValue(TRUE); - if ( CurrentItem ) - { - if ( CurrentItem->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE); - } - else if ( !g_FlDrawSpecificConvert ) m_CommonConvert->SetValue(TRUE); - -bool show_fill_option = FALSE; -int fill_option = 0; - if( CurrentItem ) - switch(CurrentItem->m_StructType) - { - case COMPONENT_ARC_DRAW_TYPE: - show_fill_option = TRUE; - fill_option = ((LibDrawArc*)CurrentItem)->m_Fill; - break; - - case COMPONENT_CIRCLE_DRAW_TYPE: - show_fill_option = TRUE; - fill_option = ((LibDrawCircle*)CurrentItem)->m_Fill; - break; - - case COMPONENT_RECT_DRAW_TYPE: - show_fill_option = TRUE; - fill_option = ((LibDrawSquare *)CurrentItem)->m_Fill; - break; - - case COMPONENT_POLYLINE_DRAW_TYPE: - show_fill_option = TRUE; - fill_option = ((LibDrawPolyline*)CurrentItem)->m_Fill; - break; - - default: break; - } - - if ( show_fill_option ) m_Filled->SetSelection(fill_option); - else m_Filled->Enable(false); -} - -/*! - * WinEDA_bodygraphics_PropertiesFrame creator - */ - -bool WinEDA_bodygraphics_PropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin WinEDA_bodygraphics_PropertiesFrame member initialisation - m_CommonUnit = NULL; - m_CommonConvert = NULL; - m_Filled = NULL; -////@end WinEDA_bodygraphics_PropertiesFrame member initialisation - -////@begin WinEDA_bodygraphics_PropertiesFrame creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); - Centre(); -////@end WinEDA_bodygraphics_PropertiesFrame creation - return true; -} - -/*! - * Control creation for WinEDA_bodygraphics_PropertiesFrame - */ - -void WinEDA_bodygraphics_PropertiesFrame::CreateControls() -{ - SetFont(*g_DialogFont); - -////@begin WinEDA_bodygraphics_PropertiesFrame content construction - // Generated by DialogBlocks, 12/02/2006 11:50:42 (unregistered) - - WinEDA_bodygraphics_PropertiesFrame* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); - itemDialog1->SetSizer(itemBoxSizer2); - - wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options :")); - wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL); - itemBoxSizer2->Add(itemStaticBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - m_CommonUnit = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Common to Units"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_CommonUnit->SetValue(false); - itemStaticBoxSizer3->Add(m_CommonUnit, 0, wxALIGN_LEFT|wxALL, 5); - - m_CommonConvert = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Common to convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_CommonConvert->SetValue(false); - itemStaticBoxSizer3->Add(m_CommonConvert, 0, wxALIGN_LEFT|wxALL, 5); - - wxString m_FilledStrings[] = { - _("Void"), - _("Filled"), - _("BgFilled") - }; - m_Filled = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Fill:"), wxDefaultPosition, wxDefaultSize, 3, m_FilledStrings, 1, wxRA_SPECIFY_COLS ); - itemStaticBoxSizer3->Add(m_Filled, 0, wxALIGN_LEFT|wxALL, 5); - - wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxButton* itemButton8 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton8->SetForegroundColour(wxColour(206, 0, 0)); - itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxALL, 5); - - wxButton* itemButton9 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton9->SetForegroundColour(wxColour(0, 0, 255)); - itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxALL, 5); - -////@end WinEDA_bodygraphics_PropertiesFrame content construction -} - -/*! - * Should we show tooltips? - */ - -bool WinEDA_bodygraphics_PropertiesFrame::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_bodygraphics_PropertiesFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_bodygraphics_PropertiesFrame bitmap retrieval - wxUnusedVar(name); - return wxNullBitmap; -////@end WinEDA_bodygraphics_PropertiesFrame bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon WinEDA_bodygraphics_PropertiesFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_bodygraphics_PropertiesFrame icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end WinEDA_bodygraphics_PropertiesFrame icon retrieval -} -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - */ - -void WinEDA_bodygraphics_PropertiesFrame::OnOkClick( wxCommandEvent& event ) -{ - bodygraphics_PropertiesAccept(event); - Close(); -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - */ - -void WinEDA_bodygraphics_PropertiesFrame::OnCancelClick( wxCommandEvent& event ) -{ -////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame. - // Before editing this code, remove the block markers. - event.Skip(); -////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame. -} - - +///////////////////////////////////////////////////////////////////////////// +// Name: dialog_cmp_graphic_properties.cpp +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 12/02/2006 11:38:02 +// RCS-ID: +// Copyright: License GNU +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 12/02/2006 11:38:02 + + +////@begin includes +////@end includes + +#include "dialog_cmp_graphic_properties.h" + +////@begin XPM images +////@end XPM images + +/*! + * WinEDA_bodygraphics_PropertiesFrame type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( WinEDA_bodygraphics_PropertiesFrame, wxDialog ) + +/*! + * WinEDA_bodygraphics_PropertiesFrame event table definition + */ + +BEGIN_EVENT_TABLE( WinEDA_bodygraphics_PropertiesFrame, wxDialog ) + +////@begin WinEDA_bodygraphics_PropertiesFrame event table entries + EVT_BUTTON( wxID_OK, WinEDA_bodygraphics_PropertiesFrame::OnOkClick ) + + EVT_BUTTON( wxID_CANCEL, WinEDA_bodygraphics_PropertiesFrame::OnCancelClick ) + +////@end WinEDA_bodygraphics_PropertiesFrame event table entries + +END_EVENT_TABLE() + +/*! + * WinEDA_bodygraphics_PropertiesFrame constructors + */ + +WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( ) +{ +} + +WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +LibEDA_BaseStruct * CurrentItem = CurrentDrawItem; + + m_Parent = parent; + Create(parent, id, caption, pos, size, style); + + /* Set the dialog items: */ + if ( CurrentItem ) + { + if ( CurrentItem->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE); + } + else if ( ! g_FlDrawSpecificUnit ) m_CommonUnit->SetValue(TRUE); + if ( CurrentItem ) + { + if ( CurrentItem->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE); + } + else if ( !g_FlDrawSpecificConvert ) m_CommonConvert->SetValue(TRUE); + +bool show_fill_option = FALSE; +int fill_option = 0; + if( CurrentItem ) + switch(CurrentItem->m_StructType) + { + case COMPONENT_ARC_DRAW_TYPE: + show_fill_option = TRUE; + fill_option = ((LibDrawArc*)CurrentItem)->m_Fill; + m_GraphicShapeWidthCtrl->SetValue(((LibDrawArc*)CurrentItem)->m_Width); + + break; + + case COMPONENT_CIRCLE_DRAW_TYPE: + show_fill_option = TRUE; + fill_option = ((LibDrawCircle*)CurrentItem)->m_Fill; + m_GraphicShapeWidthCtrl->SetValue(((LibDrawCircle*)CurrentItem)->m_Width); + break; + + case COMPONENT_RECT_DRAW_TYPE: + show_fill_option = TRUE; + fill_option = ((LibDrawSquare *)CurrentItem)->m_Fill; + m_GraphicShapeWidthCtrl->SetValue(((LibDrawSquare*)CurrentItem)->m_Width); + break; + + case COMPONENT_POLYLINE_DRAW_TYPE: + show_fill_option = TRUE; + fill_option = ((LibDrawPolyline*)CurrentItem)->m_Fill; + m_GraphicShapeWidthCtrl->SetValue(((LibDrawPolyline*)CurrentItem)->m_Width); + break; + + default: break; + } + + if ( show_fill_option ) m_Filled->SetSelection(fill_option); + else m_Filled->Enable(false); +} + +/*! + * WinEDA_bodygraphics_PropertiesFrame creator + */ + +bool WinEDA_bodygraphics_PropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin WinEDA_bodygraphics_PropertiesFrame member initialisation + m_CommonUnit = NULL; + m_CommonConvert = NULL; + m_ShapeWidthBoxSizer = NULL; + m_Filled = NULL; +////@end WinEDA_bodygraphics_PropertiesFrame member initialisation + +////@begin WinEDA_bodygraphics_PropertiesFrame creation + SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); + + CreateControls(); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } + Centre(); +////@end WinEDA_bodygraphics_PropertiesFrame creation + return true; +} + +/*! + * Control creation for WinEDA_bodygraphics_PropertiesFrame + */ + +void WinEDA_bodygraphics_PropertiesFrame::CreateControls() +{ + SetFont(*g_DialogFont); + +////@begin WinEDA_bodygraphics_PropertiesFrame content construction + // Generated by DialogBlocks, 21/01/2007 16:28:34 (unregistered) + + WinEDA_bodygraphics_PropertiesFrame* itemDialog1 = this; + + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); + itemDialog1->SetSizer(itemBoxSizer2); + + wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options :")); + wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL); + itemBoxSizer2->Add(itemStaticBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_CommonUnit = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Common to Units"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_CommonUnit->SetValue(false); + itemStaticBoxSizer3->Add(m_CommonUnit, 0, wxALIGN_LEFT|wxALL, 5); + + m_CommonConvert = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Common to convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_CommonConvert->SetValue(false); + itemStaticBoxSizer3->Add(m_CommonConvert, 0, wxALIGN_LEFT|wxALL, 5); + + m_ShapeWidthBoxSizer = new wxBoxSizer(wxVERTICAL); + itemStaticBoxSizer3->Add(m_ShapeWidthBoxSizer, 0, wxGROW|wxTOP|wxBOTTOM, 5); + + wxString m_FilledStrings[] = { + _("Void"), + _("Filled"), + _("BgFilled") + }; + m_Filled = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Fill:"), wxDefaultPosition, wxDefaultSize, 3, m_FilledStrings, 1, wxRA_SPECIFY_COLS ); + m_Filled->SetSelection(0); + itemStaticBoxSizer3->Add(m_Filled, 0, wxALIGN_LEFT|wxALL, 5); + + wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxButton* itemButton9 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton9->SetForegroundColour(wxColour(206, 0, 0)); + itemBoxSizer8->Add(itemButton9, 0, wxGROW|wxALL, 5); + + wxButton* itemButton10 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton10->SetForegroundColour(wxColour(0, 0, 255)); + itemBoxSizer8->Add(itemButton10, 0, wxGROW|wxALL, 5); + +////@end WinEDA_bodygraphics_PropertiesFrame content construction + + m_GraphicShapeWidthCtrl = new WinEDA_ValueCtrl(this, _("Width"), 0, + g_UnitMetric,m_ShapeWidthBoxSizer, EESCHEMA_INTERNAL_UNIT); + +} + +/*! + * Should we show tooltips? + */ + +bool WinEDA_bodygraphics_PropertiesFrame::ShowToolTips() +{ + return true; +} + +/*! + * Get bitmap resources + */ + +wxBitmap WinEDA_bodygraphics_PropertiesFrame::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin WinEDA_bodygraphics_PropertiesFrame bitmap retrieval + wxUnusedVar(name); + return wxNullBitmap; +////@end WinEDA_bodygraphics_PropertiesFrame bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon WinEDA_bodygraphics_PropertiesFrame::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin WinEDA_bodygraphics_PropertiesFrame icon retrieval + wxUnusedVar(name); + return wxNullIcon; +////@end WinEDA_bodygraphics_PropertiesFrame icon retrieval +} +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK + */ + +void WinEDA_bodygraphics_PropertiesFrame::OnOkClick( wxCommandEvent& event ) +{ + bodygraphics_PropertiesAccept(event); + Close(); +} + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL + */ + +void WinEDA_bodygraphics_PropertiesFrame::OnCancelClick( wxCommandEvent& event ) +{ +////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame. + // Before editing this code, remove the block markers. + event.Skip(); +////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame. +} + + diff --git a/eeschema/dialog_cmp_graphic_properties.h b/eeschema/dialog_cmp_graphic_properties.h index ac1c6b86cb..c316aba08e 100644 --- a/eeschema/dialog_cmp_graphic_properties.h +++ b/eeschema/dialog_cmp_graphic_properties.h @@ -1,83 +1,84 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_cmp_graphic_properties.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 12/02/2006 11:38:02 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 12/02/2006 11:38:02 - -#ifndef _DIALOG_CMP_GRAPHIC_PROPERTIES_H_ -#define _DIALOG_CMP_GRAPHIC_PROPERTIES_H_ - - -/*! - * Includes - */ - -////@begin includes -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers +///////////////////////////////////////////////////////////////////////////// +// Name: dialog_cmp_graphic_properties.h +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 12/02/2006 11:38:02 +// RCS-ID: +// Copyright: License GNU +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 12/02/2006 11:38:02 + +#ifndef _DIALOG_CMP_GRAPHIC_PROPERTIES_H_ +#define _DIALOG_CMP_GRAPHIC_PROPERTIES_H_ + + +/*! + * Includes + */ + +////@begin includes +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxBoxSizer; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers #define ID_DIALOG 10000 +#define ID_CHECKBOX 10001 +#define ID_CHECKBOX1 10002 +#define ID_RADIOBOX 10003 #define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX #define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_TITLE _("Graphic shape properties") #define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_IDNAME ID_DIALOG #define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_SIZE wxSize(400, 300) #define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_POSITION wxDefaultPosition -#define ID_CHECKBOX 10001 -#define ID_CHECKBOX1 10002 -#define ID_RADIOBOX 10003 -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_bodygraphics_PropertiesFrame class declaration - */ - -class WinEDA_bodygraphics_PropertiesFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_bodygraphics_PropertiesFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_bodygraphics_PropertiesFrame( ); - WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE ); - - /// Creation +////@end control identifiers + +/*! + * Compatibility + */ + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif + +/*! + * WinEDA_bodygraphics_PropertiesFrame class declaration + */ + +class WinEDA_bodygraphics_PropertiesFrame: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( WinEDA_bodygraphics_PropertiesFrame ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + WinEDA_bodygraphics_PropertiesFrame( ); + WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE ); + + /// Creation bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_SIZE, - long style = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_bodygraphics_PropertiesFrame event handler declarations + long style = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin WinEDA_bodygraphics_PropertiesFrame event handler declarations /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK void OnOkClick( wxCommandEvent& event ); @@ -85,28 +86,30 @@ public: /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL void OnCancelClick( wxCommandEvent& event ); -////@end WinEDA_bodygraphics_PropertiesFrame event handler declarations - -////@begin WinEDA_bodygraphics_PropertiesFrame member function declarations +////@end WinEDA_bodygraphics_PropertiesFrame event handler declarations + +////@begin WinEDA_bodygraphics_PropertiesFrame member function declarations /// Retrieves bitmap resources wxBitmap GetBitmapResource( const wxString& name ); /// Retrieves icon resources wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_bodygraphics_PropertiesFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - void bodygraphics_PropertiesAccept(wxCommandEvent& event); - -////@begin WinEDA_bodygraphics_PropertiesFrame member variables +////@end WinEDA_bodygraphics_PropertiesFrame member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + void bodygraphics_PropertiesAccept(wxCommandEvent& event); + +////@begin WinEDA_bodygraphics_PropertiesFrame member variables wxCheckBox* m_CommonUnit; wxCheckBox* m_CommonConvert; + wxBoxSizer* m_ShapeWidthBoxSizer; wxRadioBox* m_Filled; -////@end WinEDA_bodygraphics_PropertiesFrame member variables +////@end WinEDA_bodygraphics_PropertiesFrame member variables WinEDA_LibeditFrame * m_Parent; -}; - -#endif - // _DIALOG_CMP_GRAPHIC_PROPERTIES_H_ + WinEDA_ValueCtrl * m_GraphicShapeWidthCtrl; +}; + +#endif + // _DIALOG_CMP_GRAPHIC_PROPERTIES_H_ diff --git a/eeschema/dialog_cmp_graphic_properties.pjd b/eeschema/dialog_cmp_graphic_properties.pjd index aa1aad1345..a18a3f3b6d 100644 --- a/eeschema/dialog_cmp_graphic_properties.pjd +++ b/eeschema/dialog_cmp_graphic_properties.pjd @@ -6,7 +6,7 @@ "" "" "" - 16 + 17 "" 0 0 @@ -18,6 +18,7 @@ "License GNU" "" 0 + 0 "<All platforms>" "<Any>" "///////////////////////////////////////////////////////////////////////////// @@ -95,9 +96,17 @@ "<System>" "<System>" "" + 0 + 0 + 4 + " " + "" 0 + 0 + 1 1 1 + 1 @@ -237,7 +246,9 @@ 0 0 0 - 0 + 0 + 0 + 0 0 0 1 @@ -331,6 +342,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -382,6 +395,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -401,6 +416,32 @@ "" "" + + "wxBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "21/1/2007" + "wbBoxSizerProxy" + "Vertical" + "m_ShapeWidthBoxSizer" + "Expand" + "Centre" + 0 + 5 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + "wxRadioBox: ID_RADIOBOX" "dialog-control-document" @@ -418,6 +459,8 @@ "m_Filled" "Fill:" 1 + "Void|Filled|BgFilled" + 0 "" "" "" @@ -430,8 +473,9 @@ "" 0 1 - "Void|Filled|BgFilled" 0 + 0 + 0 "" -1 -1 @@ -510,6 +554,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -562,6 +608,8 @@ 0 0 0 + 0 + 0 "" -1 -1 diff --git a/eeschema/dialog_eeschema_config.cpp b/eeschema/dialog_eeschema_config.cpp index 2d0dc5fb8d..974d3b8f7c 100644 --- a/eeschema/dialog_eeschema_config.cpp +++ b/eeschema/dialog_eeschema_config.cpp @@ -79,6 +79,8 @@ BEGIN_EVENT_TABLE( KiConfigEeschemaFrame, wxDialog ) EVT_BUTTON( INSERT_LIB, KiConfigEeschemaFrame::OnInsertLibClick ) + EVT_BUTTON( ID_LIB_PATH_SEL, KiConfigEeschemaFrame::OnLibPathSelClick ) + ////@end KiConfigEeschemaFrame event table entries END_EVENT_TABLE() @@ -125,8 +127,10 @@ bool KiConfigEeschemaFrame::Create( wxWindow* parent, wxWindowID id, const wxStr wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } Centre(); ////@end KiConfigEeschemaFrame creation return true; @@ -141,7 +145,7 @@ void KiConfigEeschemaFrame::CreateControls() SetFont(*g_DialogFont); ////@begin KiConfigEeschemaFrame content construction - // Generated by DialogBlocks, 18/02/2006 09:45:23 (unregistered) + // Generated by DialogBlocks, 28/02/2007 15:16:31 (unregistered) KiConfigEeschemaFrame* itemDialog1 = this; @@ -149,7 +153,7 @@ void KiConfigEeschemaFrame::CreateControls() itemDialog1->SetSizer(itemBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5); @@ -168,6 +172,7 @@ void KiConfigEeschemaFrame::CreateControls() _("Other") }; m_NetFormatBox = new wxRadioBox( itemDialog1, FORMAT_NETLIST, _("NetList Formats:"), wxDefaultPosition, wxDefaultSize, 5, m_NetFormatBoxStrings, 1, wxRA_SPECIFY_COLS ); + m_NetFormatBox->SetSelection(0); itemBoxSizer4->Add(m_NetFormatBox, 0, wxGROW|wxALL, 5); itemBoxSizer4->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); @@ -211,12 +216,16 @@ void KiConfigEeschemaFrame::CreateControls() m_ListLibr = new wxListBox( itemDialog1, ID_LIST_LIBS, wxDefaultPosition, wxSize(-1, 300), 0, m_ListLibrStrings, wxLB_SINGLE ); itemBoxSizer17->Add(m_ListLibr, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); - wxStaticText* itemStaticText20 = new wxStaticText( itemDialog1, wxID_STATIC, _("Library files path:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText20->SetForegroundColour(wxColour(204, 0, 0)); - itemBoxSizer2->Add(itemStaticText20, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); + wxStaticBox* itemStaticBoxSizer20Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Library files path:")); + wxStaticBoxSizer* itemStaticBoxSizer20 = new wxStaticBoxSizer(itemStaticBoxSizer20Static, wxHORIZONTAL); + itemStaticBoxSizer20Static->SetForegroundColour(wxColour(206, 0, 0)); + itemBoxSizer2->Add(itemStaticBoxSizer20, 0, wxGROW|wxALL, 5); - m_LibDirCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer2->Add(m_LibDirCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); + m_LibDirCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(350, -1), 0 ); + itemStaticBoxSizer20->Add(m_LibDirCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); + + wxButton* itemButton22 = new wxButton( itemDialog1, ID_LIB_PATH_SEL, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer20->Add(itemButton22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); ////@end KiConfigEeschemaFrame content construction @@ -453,3 +462,24 @@ void KiConfigEeschemaFrame::OnSaveCfgClick( wxCommandEvent& event ) } +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIB_PATH_SEL + */ + +void KiConfigEeschemaFrame::OnLibPathSelClick( wxCommandEvent& event ) +{ +wxString path = g_RealLibDirBuffer; + +bool select = EDA_DirectorySelector(_(" Default Path for libraries"), /* Titre de la fenetre */ + path, /* Chemin par defaut */ + wxDD_DEFAULT_STYLE, + this, /* parent frame */ + wxDefaultPosition); + + if ( !select ) return; + + m_LibDirCtrl->SetValue(path); + +} + + diff --git a/eeschema/dialog_eeschema_config.h b/eeschema/dialog_eeschema_config.h index fd97efe265..a7119272ef 100644 --- a/eeschema/dialog_eeschema_config.h +++ b/eeschema/dialog_eeschema_config.h @@ -38,11 +38,6 @@ ////@begin control identifiers #define ID_DIALOG 10000 -#define SYMBOL_KICONFIGEESCHEMAFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX -#define SYMBOL_KICONFIGEESCHEMAFRAME_TITLE _("Dialog") -#define SYMBOL_KICONFIGEESCHEMAFRAME_IDNAME ID_DIALOG -#define SYMBOL_KICONFIGEESCHEMAFRAME_SIZE wxSize(400, 300) -#define SYMBOL_KICONFIGEESCHEMAFRAME_POSITION wxDefaultPosition #define SAVE_CFG 10001 #define FORMAT_NETLIST 10006 #define DEL_LIB 10002 @@ -50,6 +45,12 @@ #define INSERT_LIB 10004 #define ID_LIST_LIBS 10005 #define ID_TEXTCTRL 10007 +#define ID_LIB_PATH_SEL 10008 +#define SYMBOL_KICONFIGEESCHEMAFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_KICONFIGEESCHEMAFRAME_TITLE _("Dialog") +#define SYMBOL_KICONFIGEESCHEMAFRAME_IDNAME ID_DIALOG +#define SYMBOL_KICONFIGEESCHEMAFRAME_SIZE wxSize(400, 300) +#define SYMBOL_KICONFIGEESCHEMAFRAME_POSITION wxDefaultPosition ////@end control identifiers /*! @@ -100,6 +101,9 @@ public: /// wxEVT_COMMAND_BUTTON_CLICKED event handler for INSERT_LIB void OnInsertLibClick( wxCommandEvent& event ); + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIB_PATH_SEL + void OnLibPathSelClick( wxCommandEvent& event ); + ////@end KiConfigEeschemaFrame event handler declarations ////@begin KiConfigEeschemaFrame member function declarations diff --git a/eeschema/dialog_eeschema_config.pjd b/eeschema/dialog_eeschema_config.pjd index 704adf8caf..4a36d41984 100644 --- a/eeschema/dialog_eeschema_config.pjd +++ b/eeschema/dialog_eeschema_config.pjd @@ -6,7 +6,7 @@ "" "" "" - 28 + 29 "" 0 0 @@ -18,6 +18,7 @@ "License GNU" "" 0 + 0 "<All platforms>" "<Any>" "///////////////////////////////////////////////////////////////////////////// @@ -95,9 +96,17 @@ "<System>" "<System>" "" + 0 + 0 + 4 + " " + "" 0 + 0 + 1 1 1 + 1 @@ -238,7 +247,9 @@ 0 0 0 - 0 + 0 + 0 + 0 0 0 1 @@ -281,7 +292,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -351,6 +362,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -414,6 +427,8 @@ "m_NetFormatBox" "NetList Formats:" 1 + "PcbNew|&OrcadPcb2|&CadStar|&Spice|Other" + 0 "" "" "" @@ -426,8 +441,9 @@ "" 0 1 - "PcbNew|&OrcadPcb2|&CadStar|&Spice|Other" 0 + 0 + 0 "" -1 -1 @@ -641,6 +657,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -693,6 +711,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -745,6 +765,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -806,6 +828,7 @@ "wxStaticText" "" "Libraries" + -1 "" "" "" @@ -827,6 +850,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -887,6 +912,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -912,128 +939,162 @@ - "wxStaticText: wxID_STATIC" + "wxStaticBoxSizer H" "dialog-control-document" "" - "statictext" + "sizer" 0 1 0 0 - "17/8/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "wxStaticText" - "" + "28/2/2007" + "wbStaticBoxSizerProxy" + "wxID_ANY" + "-1" "Library files path:" - "" - "" - "" - "CC0000" + "" + "CE0000" "" 0 1 - "<Any platform>" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Top" - 0 - 5 - 1 - 1 - 0 - 0 - 0 - 1 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "17/8/2006" - "wbTextCtrlProxy" - "ID_TEXTCTRL" - 10007 - "wxTextCtrl" - "m_LibDirCtrl" - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 + "Horizontal" + "" "Expand" "Centre" 0 5 1 1 - 0 + 1 1 0 0 0 - "" - "" + "<Any platform>" + + "wxTextCtrl: ID_TEXTCTRL" + "dialog-control-document" + "" + "textctrl" + 0 + 1 + 0 + 0 + "28/2/2007" + "wbTextCtrlProxy" + "ID_TEXTCTRL" + 10007 + "wxTextCtrl" + "m_LibDirCtrl" + "" + 0 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + 350 + -1 + "Expand" + "Expand" + 0 + 5 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + "" + "" + + + "wxButton: ID_LIB_PATH_SEL" + "dialog-control-document" + "" + "dialogcontrol" + 0 + 1 + 0 + 0 + "28/2/2007" + "wbButtonProxy" + "wxEVT_COMMAND_BUTTON_CLICKED|OnLibPathSelClick" + "ID_LIB_PATH_SEL" + 10008 + "wxButton" + "" + "Browse" + 0 + "" + "" + "" + "" + "" + 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 + "" + "" + diff --git a/eeschema/dialog_options.cpp b/eeschema/dialog_options.cpp index 6c5af3a8f0..435b2e9790 100644 --- a/eeschema/dialog_options.cpp +++ b/eeschema/dialog_options.cpp @@ -156,11 +156,13 @@ wxString title = _("Delta Step X") + ReturnUnitSymbol(g_UnitMetric); bool WinEDA_SetOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin WinEDA_SetOptionsFrame member initialisation + m_DrawOptionsSizer = NULL; m_ShowGridOpt = NULL; m_SelGridSize = NULL; m_SelShowPins = NULL; m_AutoPANOpt = NULL; m_Selunits = NULL; + m_LabelSizeCtrlSizer = NULL; m_SelDirWires = NULL; m_Show_Page_Limits = NULL; m_DeltaStepXTitle = NULL; @@ -193,7 +195,7 @@ void WinEDA_SetOptionsFrame::CreateControls() { SetFont(*g_DialogFont); ////@begin WinEDA_SetOptionsFrame content construction - // Generated by DialogBlocks, 26/08/2006 18:23:26 (unregistered) + // Generated by DialogBlocks, 23/02/2007 10:59:46 (unregistered) WinEDA_SetOptionsFrame* itemDialog1 = this; @@ -203,9 +205,13 @@ void WinEDA_SetOptionsFrame::CreateControls() wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Draw Options:")); + m_DrawOptionsSizer = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); + itemBoxSizer3->Add(m_DrawOptionsSizer, 0, wxGROW|wxALL, 5); + m_ShowGridOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Show grid"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowGridOpt->SetValue(false); - itemBoxSizer3->Add(m_ShowGridOpt, 0, wxALIGN_LEFT|wxALL, 5); + m_DrawOptionsSizer->Add(m_ShowGridOpt, 0, wxALIGN_LEFT|wxALL, 5); wxString m_SelGridSizeStrings[] = { _("Normal (50 mils)"), @@ -227,13 +233,13 @@ void WinEDA_SetOptionsFrame::CreateControls() m_SelShowPins->SetSelection(0); itemBoxSizer3->Add(m_SelShowPins, 0, wxGROW|wxALL, 5); - wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AutoPANOpt->SetValue(false); m_AutoPANOpt->SetForegroundColour(wxColour(0, 0, 255)); - itemBoxSizer7->Add(m_AutoPANOpt, 0, wxGROW|wxALL, 5); + itemBoxSizer8->Add(m_AutoPANOpt, 0, wxGROW|wxALL, 5); wxString m_SelunitsStrings[] = { _("millimeter"), @@ -241,7 +247,10 @@ void WinEDA_SetOptionsFrame::CreateControls() }; m_Selunits = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Units"), wxDefaultPosition, wxDefaultSize, 2, m_SelunitsStrings, 1, wxRA_SPECIFY_COLS ); m_Selunits->SetSelection(0); - itemBoxSizer7->Add(m_Selunits, 0, wxGROW|wxALL, 5); + itemBoxSizer8->Add(m_Selunits, 0, wxGROW|wxALL, 5); + + m_LabelSizeCtrlSizer = new wxBoxSizer(wxVERTICAL); + itemBoxSizer8->Add(m_LabelSizeCtrlSizer, 0, wxGROW|wxALL, 5); wxString m_SelDirWiresStrings[] = { _("Horiz/Vertical"), @@ -249,7 +258,7 @@ void WinEDA_SetOptionsFrame::CreateControls() }; m_SelDirWires = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _("Wires - Bus orient"), wxDefaultPosition, wxDefaultSize, 2, m_SelDirWiresStrings, 1, wxRA_SPECIFY_COLS ); m_SelDirWires->SetSelection(0); - itemBoxSizer7->Add(m_SelDirWires, 0, wxGROW|wxALL, 5); + itemBoxSizer8->Add(m_SelDirWires, 0, wxGROW|wxALL, 5); wxString m_Show_Page_LimitsStrings[] = { _("Yes"), @@ -257,42 +266,51 @@ void WinEDA_SetOptionsFrame::CreateControls() }; m_Show_Page_Limits = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 2, m_Show_Page_LimitsStrings, 1, wxRA_SPECIFY_COLS ); m_Show_Page_Limits->SetSelection(0); - itemBoxSizer7->Add(m_Show_Page_Limits, 0, wxGROW|wxALL, 5); + itemBoxSizer8->Add(m_Show_Page_Limits, 0, wxGROW|wxALL, 5); - wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxButton* itemButton13 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton13->SetForegroundColour(wxColour(202, 0, 0)); - itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton15->SetForegroundColour(wxColour(202, 0, 0)); + itemBoxSizer14->Add(itemButton15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxButton* itemButton14 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton14->SetForegroundColour(wxColour(0, 0, 255)); - itemBoxSizer12->Add(itemButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton16->SetForegroundColour(wxColour(0, 0, 255)); + itemBoxSizer14->Add(itemButton16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Auto increment params")); - wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer(itemStaticBoxSizer15Static, wxVERTICAL); - itemBoxSizer12->Add(itemStaticBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer14->Add(5, 5, 0, wxGROW|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Auto increment params")); + wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer(itemStaticBoxSizer18Static, wxVERTICAL); + itemBoxSizer14->Add(itemStaticBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); m_DeltaStepXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Step X"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer15->Add(m_DeltaStepXTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemStaticBoxSizer18->Add(m_DeltaStepXTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_DeltaStepCtrl_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer15->Add(m_DeltaStepCtrl_X, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer18->Add(m_DeltaStepCtrl_X, 0, wxGROW|wxALL, 5); m_DeltaStepYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Step Y"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer15->Add(m_DeltaStepYTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemStaticBoxSizer18->Add(m_DeltaStepYTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_DeltaStepCtrl_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer15->Add(m_DeltaStepCtrl_Y, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer18->Add(m_DeltaStepCtrl_Y, 0, wxGROW|wxALL, 5); m_DeltaIncTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Label:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer15->Add(m_DeltaIncTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemStaticBoxSizer18->Add(m_DeltaIncTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_DeltaLabelCtrl = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -16, 16, 0 ); - itemStaticBoxSizer15->Add(m_DeltaLabelCtrl, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer18->Add(m_DeltaLabelCtrl, 0, wxGROW|wxALL, 5); ////@end WinEDA_SetOptionsFrame content construction + + m_DefaultDrawLineWidthCtrl = new WinEDA_ValueCtrl(this, _("Default Line Width"),g_DrawMinimunLineWidth, + g_UnitMetric, m_DrawOptionsSizer, EESCHEMA_INTERNAL_UNIT); + + m_DefaultLabelSizeCtrl = new WinEDA_ValueCtrl(this, _("Default Label Size"),g_DefaultTextLabelSize, + g_UnitMetric, m_LabelSizeCtrlSizer, EESCHEMA_INTERNAL_UNIT); + } /*! @@ -364,6 +382,14 @@ wxSize grid; bool setgrid = TRUE; wxString msg; + g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue(); + if ( g_DrawMinimunLineWidth < 0 ) g_DrawMinimunLineWidth = 0; + if ( g_DrawMinimunLineWidth > 100 ) g_DrawMinimunLineWidth = 100; + + g_DefaultTextLabelSize = m_DefaultLabelSizeCtrl->GetValue(); + if ( g_DefaultTextLabelSize < 0 ) g_DefaultTextLabelSize = 0; + if ( g_DefaultTextLabelSize > 1000 ) g_DefaultTextLabelSize = 1000; + msg = m_DeltaStepCtrl_X->GetValue(); g_RepeatStep.x = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits); diff --git a/eeschema/dialog_options.h b/eeschema/dialog_options.h index c9cf47f7ca..411c18f705 100644 --- a/eeschema/dialog_options.h +++ b/eeschema/dialog_options.h @@ -31,6 +31,7 @@ */ ////@begin forward declarations +class wxBoxSizer; class wxSpinCtrl; ////@end forward declarations @@ -40,11 +41,6 @@ class wxSpinCtrl; ////@begin control identifiers #define ID_DIALOG 10000 -#define SYMBOL_WINEDA_SETOPTIONSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxSTAY_ON_TOP|wxCLOSE_BOX -#define SYMBOL_WINEDA_SETOPTIONSFRAME_TITLE _("General Options") -#define SYMBOL_WINEDA_SETOPTIONSFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_SETOPTIONSFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_SETOPTIONSFRAME_POSITION wxDefaultPosition #define ID_CHECKBOX1 10001 #define ID_RADIOBOX 10003 #define ID_RADIOBOX1 10004 @@ -55,6 +51,11 @@ class wxSpinCtrl; #define ID_TEXTCTRL 10008 #define ID_TEXTCTRL1 10009 #define ID_SPINCTRL 10010 +#define SYMBOL_WINEDA_SETOPTIONSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxSTAY_ON_TOP|wxCLOSE_BOX +#define SYMBOL_WINEDA_SETOPTIONSFRAME_TITLE _("General Options") +#define SYMBOL_WINEDA_SETOPTIONSFRAME_IDNAME ID_DIALOG +#define SYMBOL_WINEDA_SETOPTIONSFRAME_SIZE wxSize(400, 300) +#define SYMBOL_WINEDA_SETOPTIONSFRAME_POSITION wxDefaultPosition ////@end control identifiers /*! @@ -112,11 +113,13 @@ public: WinEDA_DrawFrame * m_Parent; ////@begin WinEDA_SetOptionsFrame member variables + wxStaticBoxSizer* m_DrawOptionsSizer; wxCheckBox* m_ShowGridOpt; wxRadioBox* m_SelGridSize; wxRadioBox* m_SelShowPins; wxCheckBox* m_AutoPANOpt; wxRadioBox* m_Selunits; + wxBoxSizer* m_LabelSizeCtrlSizer; wxRadioBox* m_SelDirWires; wxRadioBox* m_Show_Page_Limits; wxStaticText* m_DeltaStepXTitle; @@ -126,6 +129,9 @@ public: wxStaticText* m_DeltaIncTitle; wxSpinCtrl* m_DeltaLabelCtrl; ////@end WinEDA_SetOptionsFrame member variables + + WinEDA_ValueCtrl * m_DefaultDrawLineWidthCtrl; + WinEDA_ValueCtrl * m_DefaultLabelSizeCtrl; }; #endif diff --git a/eeschema/dialog_options.pjd b/eeschema/dialog_options.pjd index b3fc668d31..85fc9ebcc1 100644 --- a/eeschema/dialog_options.pjd +++ b/eeschema/dialog_options.pjd @@ -6,7 +6,7 @@ "" "" "" - 28 + 31 "" 0 0 @@ -18,6 +18,7 @@ "GNU License" "" 0 + 0 "<All platforms>" "<Any>" "///////////////////////////////////////////////////////////////////////////// @@ -98,6 +99,7 @@ 0 0 4 + " " "" 0 0 @@ -299,44 +301,27 @@ 0 "<Any platform>" - "wxCheckBox: ID_CHECKBOX1" + "wxStaticBoxSizer V" "dialog-control-document" "" - "checkbox" + "sizer" 0 1 0 0 - "wbCheckBoxProxy" - "ID_CHECKBOX1" - 10001 - "wxCheckBox" - "m_ShowGridOpt" - "Show grid" - 0 - "" - "" - "" - "" - "" + "22/1/2007" + "wbStaticBoxSizerProxy" + "wxID_ANY" + "-1" + "Draw Options:" + "m_DrawOptionsSizer" "" "" 0 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" + "Vertical" + "" + "Expand" "Centre" 0 5 @@ -347,8 +332,60 @@ 0 0 0 - "" - "" + "<Any platform>" + + "wxCheckBox: ID_CHECKBOX1" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "22/1/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX1" + 10001 + "wxCheckBox" + "m_ShowGridOpt" + "Show grid" + 0 + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + "wxRadioBox: ID_RADIOBOX" @@ -540,6 +577,7 @@ 1 0 0 + "23/2/2007" "wbRadioBoxProxy" "ID_RADIOBOX2" 10005 @@ -583,6 +621,32 @@ "" "" + + "wxBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "23/2/2007" + "wbBoxSizerProxy" + "Vertical" + "m_LabelSizeCtrlSizer" + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + "wxRadioBox: ID_RADIOBOX3" "dialog-control-document" @@ -818,6 +882,32 @@ "" "" + + "Spacer" + "dialog-control-document" + "" + "spacer" + 0 + 1 + 0 + 0 + "23/2/2007" + "wbSpacerProxy" + 5 + 5 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + "wxStaticBoxSizer V" "dialog-control-document" diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 11abb2df07..cae0c1034d 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -86,7 +86,7 @@ int ii; m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x; m_FieldFlags[ii] = (m_Cmp->m_Field[ii].m_Attributs & TEXT_NO_VISIBLE) ? 0 : 1; - m_FieldOrient[ii] = m_Cmp->m_Field[ii].m_Orient; + m_FieldOrient[ii] = m_Cmp->m_Field[ii].m_Orient == TEXT_ORIENT_VERT ? 1 : 0; if ( m_Cmp->m_Field[ii].m_Text.IsEmpty() ) continue; // These values have meaning only if this field is not void: @@ -372,7 +372,7 @@ wxString newname; m_Cmp->m_Field[ii].m_Attributs &= ~TEXT_NO_VISIBLE; else m_Cmp->m_Field[ii].m_Attributs |= TEXT_NO_VISIBLE; - m_Cmp->m_Field[ii].m_Orient = m_FieldOrient[ii] ? 1 : 0; + m_Cmp->m_Field[ii].m_Orient = m_FieldOrient[ii] ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_Cmp->m_Field[ii].m_Pos = m_FieldPosition[ii]; m_Cmp->m_Field[ii].m_Pos.x += cmp_pos.x; m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y; diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 795bb812e7..15824c74fc 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -21,8 +21,8 @@ static void ExitMoveTexte(WinEDA_DrawPanel * panel, wxDC *DC); static wxPoint ItemInitialPosition; static int OldOrient; static wxSize OldSize; -static int ShapeGLabel = (int) NET_INPUT; -static int TextLabelSize = DEFAULT_SIZE_TEXT; +static int s_DefaultShapeGLabel = (int) NET_INPUT; +static int s_DefaultOrientGLabel = 0; /************************************/ /* class WinEDA_LabelPropertiesFrame */ @@ -37,7 +37,7 @@ void WinEDA_LabelPropertiesFrame::TextPropertiesAccept(wxCommandEvent& event) { wxString text; int value; - + /* save old text in undo list if not already in edit */ if ( m_CurrentText->m_Flags == 0 ) m_Parent->SaveCopyInUndoList(m_CurrentText, IS_CHANGED); @@ -55,6 +55,10 @@ int value; m_Parent->GetScreen()->SetModify(); + /* Make the text size as new default size if it is a new text */ + if ( (m_CurrentText->m_Flags & IS_NEW) != 0 ) + g_DefaultTextLabelSize = m_CurrentText->m_Size.x; + Close(TRUE); } @@ -106,7 +110,8 @@ void WinEDA_SchematicFrame::StartMoveTexte(DrawTextStruct * TextStruct, wxDC *DC void WinEDA_SchematicFrame::EditSchematicText(DrawTextStruct * TextStruct, wxDC * DC) /*************************************************************************/ -/* Changement du texte (Label.. ) pointe par la souris +/* Edit the properties of the text (Label, Gloab label, graphic text).. ) + pointed by "TextStruct" */ { if(TextStruct == NULL) return; @@ -137,6 +142,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient(DrawTextStruct * TextStruct, wxDC * SaveCopyInUndoList(TextStruct, IS_CHANGED); /* Effacement du texte en cours */ + DrawPanel->CursorOff(DC); RedrawOneStruct(DrawPanel, DC, TextStruct, g_XorMode); /* Rotation du texte */ @@ -156,6 +162,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient(DrawTextStruct * TextStruct, wxDC * /* Reaffichage */ RedrawOneStruct(DrawPanel, DC, TextStruct, g_XorMode); + DrawPanel->CursorOn(DC); } /*************************************************************************/ @@ -172,20 +179,21 @@ DrawTextStruct * NewText = NULL; { case LAYER_NOTES: NewText = new DrawTextStruct(m_CurrentScreen->m_Curseur); - NewText->m_Size.x = NewText->m_Size.y = TextLabelSize; + NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; break; case LAYER_LOCLABEL: { NewText = new DrawLabelStruct(m_CurrentScreen->m_Curseur); - NewText->m_Size.x = NewText->m_Size.y = TextLabelSize; + NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; } break; case LAYER_GLOBLABEL: NewText = new DrawGlobalLabelStruct(m_CurrentScreen->m_Curseur); - NewText->m_Size.x = NewText->m_Size.y = TextLabelSize; - ((DrawGlobalLabelStruct*)NewText)->m_Shape = ShapeGLabel; + NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; + ((DrawGlobalLabelStruct*)NewText)->m_Shape = s_DefaultShapeGLabel; + ((DrawGlobalLabelStruct*)NewText)->m_Orient = s_DefaultOrientGLabel; break; default: @@ -195,6 +203,7 @@ DrawTextStruct * NewText = NULL; NewText->m_Flags = IS_NEW | IS_MOVED; + RedrawOneStruct(DrawPanel, DC, NewText, g_XorMode); EditSchematicText(NewText, DC); if ( NewText->m_Text.IsEmpty() ) @@ -203,6 +212,12 @@ DrawTextStruct * NewText = NULL; return NULL; } + if ( type == LAYER_GLOBLABEL ) + { + s_DefaultShapeGLabel = ((DrawGlobalLabelStruct*)NewText)->m_Shape; + s_DefaultOrientGLabel = ((DrawGlobalLabelStruct*)NewText)->m_Orient; + } + RedrawOneStruct(DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE); DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; diff --git a/eeschema/eeconfig.h b/eeschema/eeconfig.h index b8dc1d402e..93b9d96369 100644 --- a/eeschema/eeconfig.h +++ b/eeschema/eeconfig.h @@ -13,461 +13,462 @@ #include "netlist.h" /* Definitions generales liees au calcul de netliste */ /* variables importees */ -extern int PenMinWidth; +extern int g_PenMinWidth; + +/* saving parameters option : */ +#define INSETUP TRUE // used when the parameter is saved in general config + // if not used, the parameter is saved in the loca config (project config) /* Liste des parametres */ - -#define INSETUP TRUE - - static PARAM_CFG_WXSTRING UserLibDirBufCfg ( - wxT("LibDir"), /* identification */ - &g_UserLibDirBuffer /* Adresse du parametre */ + wxT("LibDir"), /* Ident String */ + &g_UserLibDirBuffer /* Parameter address */ ); static PARAM_CFG_LIBNAME_LIST LibNameBufCfg ( - wxT("LibName"), /* identification */ - &g_LibName_List, /* Adresse du parametre */ + wxT("LibName"), /* Ident String */ + &g_LibName_List, /* Parameter address */ GROUPLIB /* Groupe */ ); static PARAM_CFG_INT NetFormatCfg ( - wxT("NetFmt"), /* identification */ - &g_NetFormat, /* Adresse du parametre */ - NET_TYPE_PCBNEW, /* Valeur par defaut */ - NET_TYPE_NOT_INIT, NET_TYPE_MAX-1 /* Valeurs extremes */ + wxT("NetFmt"), /* Ident String */ + &g_NetFormat, /* Parameter address */ + NET_TYPE_PCBNEW, /* Default value */ + NET_TYPE_NOT_INIT, NET_TYPE_MAX-1 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT UnitCfg ( INSETUP, - wxT("Unite"), /* identification */ - &g_UnitMetric, /* Adresse du parametre */ - 0, /* Valeur par defaut */ - 0, 1 /* Valeurs extremes */ + wxT("Unite"), /* Ident String */ + &g_UnitMetric, /* Parameter address */ + 0, /* Default value */ + 0, 1 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT CursorShapeCfg ( INSETUP, - wxT("CuShape"), /* identification */ - &g_CursorShape, /* Adresse du parametre */ - 0, /* Valeur par defaut */ - 0, 1 /* Valeurs extremes */ + wxT("CuShape"), /* Ident String */ + &g_CursorShape, /* Parameter address */ + 0, /* Default value */ + 0, 1 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT ShowGridCfg ( INSETUP, - wxT("ShGrid"), /* identification */ - &g_ShowGrid, /* Adresse du parametre */ - 0, 1, /* Valeurs extremes */ - 1 /* Valeur par defaut */ + wxT("ShGrid"), /* Ident String */ + &g_ShowGrid, /* Parameter address */ + 0, 1, /* Min and Max values for the parameter */ + 1 /* Default value */ ); static PARAM_CFG_SETCOLOR DrawBgColorCfg ( INSETUP, - wxT("BgColor"), /* identification */ - &g_DrawBgColor, /* Adresse du parametre */ - WHITE /* Valeur par defaut */ + wxT("BgColor"), /* Ident String */ + &g_DrawBgColor, /* Parameter address */ + WHITE /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerWireCfg ( INSETUP, - wxT("ColWire"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_WIRE], /* Adresse du parametre */ - GREEN /* Valeur par defaut */ + wxT("ColWire"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_WIRE], /* Parameter address */ + GREEN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerBusCfg ( INSETUP, - wxT("ColorBus"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_BUS], /* Adresse du parametre */ - BLUE /* Valeur par defaut */ + wxT("ColorBus"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_BUS], /* Parameter address */ + BLUE /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerJunctionCfg ( INSETUP, - wxT("ColorConn"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_JUNCTION], /* Adresse du parametre */ - GREEN /* Valeur par defaut */ + wxT("ColorConn"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_JUNCTION], /* Parameter address */ + GREEN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerLLabelCfg ( INSETUP, - wxT("ColorLlab"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_LOCLABEL], /* Adresse du parametre */ - BLACK /* Valeur par defaut */ + wxT("ColorLlab"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_LOCLABEL], /* Parameter address */ + BLACK /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerGLabelCfg ( INSETUP, - wxT("ColorGlab"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_GLOBLABEL], /* Adresse du parametre */ - BROWN /* Valeur par defaut */ + wxT("ColorGlab"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_GLOBLABEL], /* Parameter address */ + BROWN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerPinFunCfg ( INSETUP, - wxT("ColorPinF"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_PINFUN], /* Adresse du parametre */ - MAGENTA /* Valeur par defaut */ + wxT("ColorPinF"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_PINFUN], /* Parameter address */ + MAGENTA /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerPinNumCfg ( INSETUP, - wxT("ColPinN"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_PINNUM], /* Adresse du parametre */ - RED /* Valeur par defaut */ + wxT("ColPinN"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_PINNUM], /* Parameter address */ + RED /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerPinNamCfg ( INSETUP, - wxT("ColorPNam"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_PINNAM], /* Adresse du parametre */ - CYAN /* Valeur par defaut */ + wxT("ColorPNam"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_PINNAM], /* Parameter address */ + CYAN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerFieldsCfg ( INSETUP, - wxT("ColorField"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_FIELDS], /* Adresse du parametre */ - MAGENTA /* Valeur par defaut */ + wxT("ColorField"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_FIELDS], /* Parameter address */ + MAGENTA /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerReferenceCfg ( INSETUP, - wxT("ColorRef"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_REFERENCEPART], /* Adresse du parametre */ - CYAN /* Valeur par defaut */ + wxT("ColorRef"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_REFERENCEPART], /* Parameter address */ + CYAN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerValueCfg ( INSETUP, - wxT("ColorValue"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_VALUEPART], /* Adresse du parametre */ - CYAN /* Valeur par defaut */ + wxT("ColorValue"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_VALUEPART], /* Parameter address */ + CYAN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerNotesCfg ( INSETUP, - wxT("ColorNote"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_NOTES], /* Adresse du parametre */ - LIGHTBLUE /* Valeur par defaut */ + wxT("ColorNote"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_NOTES], /* Parameter address */ + LIGHTBLUE /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerBodyCfg ( INSETUP, - wxT("ColorBody"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_DEVICE], /* Adresse du parametre */ - RED /* Valeur par defaut */ + wxT("ColorBody"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_DEVICE], /* Parameter address */ + RED /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerBodyBackgroundCfg ( INSETUP, - wxT("ColorBodyBg"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_DEVICE_BACKGROUND], /* Adresse du parametre */ - LIGHTYELLOW /* Valeur par defaut */ + wxT("ColorBodyBg"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_DEVICE_BACKGROUND], /* Parameter address */ + LIGHTYELLOW /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerNetNameCfg ( INSETUP, - wxT("ColorNetN"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_NETNAM], /* Adresse du parametre */ - DARKGRAY /* Valeur par defaut */ + wxT("ColorNetN"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_NETNAM], /* Parameter address */ + DARKGRAY /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerPinCfg ( INSETUP, - wxT("ColorPin"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_PIN], /* Adresse du parametre */ - RED /* Valeur par defaut */ + wxT("ColorPin"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_PIN], /* Parameter address */ + RED /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerSheetCfg ( INSETUP, - wxT("ColorSheet"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_SHEET], /* Adresse du parametre */ - MAGENTA /* Valeur par defaut */ + wxT("ColorSheet"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_SHEET], /* Parameter address */ + MAGENTA /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerSheetFileNameCfg ( INSETUP, - wxT("ColorSheetFileName"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_SHEETFILENAME], /* Adresse du parametre */ - BROWN /* Valeur par defaut */ + wxT("ColorSheetFileName"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_SHEETFILENAME], /* Parameter address */ + BROWN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerSheetNameCfg ( INSETUP, - wxT("ColorSheetName"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_SHEETNAME], /* Adresse du parametre */ - CYAN /* Valeur par defaut */ + wxT("ColorSheetName"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_SHEETNAME], /* Parameter address */ + CYAN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerSheetLabelCfg ( INSETUP, - wxT("ColorSheetLab"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_SHEETLABEL], /* Adresse du parametre */ - BROWN /* Valeur par defaut */ + wxT("ColorSheetLab"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_SHEETLABEL], /* Parameter address */ + BROWN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerNoConnectCfg ( INSETUP, - wxT("ColorNoCo"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_NOCONNECT], /* Adresse du parametre */ - BLUE /* Valeur par defaut */ + wxT("ColorNoCo"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_NOCONNECT], /* Parameter address */ + BLUE /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerErcWarnCfg ( INSETUP, - wxT("ColorErcW"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_ERC_WARN], /* Adresse du parametre */ - GREEN /* Valeur par defaut */ + wxT("ColorErcW"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_ERC_WARN], /* Parameter address */ + GREEN /* Default value */ ); static PARAM_CFG_SETCOLOR ColorLayerErcErrCfg ( INSETUP, - wxT("ColorErcE"), /* identification */ - &g_LayerDescr.LayerColor[LAYER_ERC_ERR], /* Adresse du parametre */ - RED /* Valeur par defaut */ + wxT("ColorErcE"), /* Ident String */ + &g_LayerDescr.LayerColor[LAYER_ERC_ERR], /* Parameter address */ + RED /* Default value */ ); static PARAM_CFG_INT PlotMarginCfg ( INSETUP, - wxT("Pltmarg"), /* identification */ - &g_PlotMargin, /* Adresse du parametre */ - 300, /* Valeur par defaut */ - 0,10000 /* Valeurs extremes */ + wxT("Pltmarg"), /* Ident String */ + &g_PlotMargin, /* Parameter address */ + 300, /* Default value */ + 0,10000 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT HPGLSpeed ( - wxT("HPGLSpd"), /* identification */ - &g_HPGL_Pen_Descr.m_Pen_Speed, /* Adresse du parametre */ - 20, /* Valeur par defaut */ - 2,45 /* Valeurs extremes */ + wxT("HPGLSpd"), /* Ident String */ + &g_HPGL_Pen_Descr.m_Pen_Speed, /* Parameter address */ + 20, /* Default value */ + 2,45 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT HPGLDiam ( - wxT("HPGLDm"), /* identification */ - &g_HPGL_Pen_Descr.m_Pen_Diam, /* Adresse du parametre */ - 15, /* Valeur par defaut */ - 1,150 /* Valeurs extremes */ + wxT("HPGLDm"), /* Ident String */ + &g_HPGL_Pen_Descr.m_Pen_Diam, /* Parameter address */ + 15, /* Default value */ + 1,150 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT HPGLPenNum ( - wxT("HPGLNum"), /* identification */ - &g_HPGL_Pen_Descr.m_Pen_Num, /* Adresse du parametre */ - 1, /* Valeur par defaut */ - 1,8 /* Valeurs extremes */ + wxT("HPGLNum"), /* Ident String */ + &g_HPGL_Pen_Descr.m_Pen_Num, /* Parameter address */ + 1, /* Default value */ + 1,8 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT PlotSheetOffsetX_A4 ( - wxT("offX_A4"), /* identification */ - &g_Sheet_A4.m_Offset.x /* Adresse du parametre */ + wxT("offX_A4"), /* Ident String */ + &g_Sheet_A4.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_A4 ( - wxT("offY_A4"), /* identification */ - &g_Sheet_A4.m_Offset.y /* Adresse du parametre */ + wxT("offY_A4"), /* Ident String */ + &g_Sheet_A4.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_A3 ( - wxT("offX_A3"), /* identification */ - &g_Sheet_A3.m_Offset.x /* Adresse du parametre */ + wxT("offX_A3"), /* Ident String */ + &g_Sheet_A3.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_A3 ( - wxT("offY_A3"), /* identification */ - &g_Sheet_A3.m_Offset.y /* Adresse du parametre */ + wxT("offY_A3"), /* Ident String */ + &g_Sheet_A3.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_A2 ( - wxT("offX_A2"), /* identification */ - &g_Sheet_A2.m_Offset.x /* Adresse du parametre */ + wxT("offX_A2"), /* Ident String */ + &g_Sheet_A2.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_A2 ( - wxT("offY_A2"), /* identification */ - &g_Sheet_A2.m_Offset.y /* Adresse du parametre */ + wxT("offY_A2"), /* Ident String */ + &g_Sheet_A2.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_A1 ( - wxT("offX_A1"), /* identification */ - &g_Sheet_A1.m_Offset.x /* Adresse du parametre */ + wxT("offX_A1"), /* Ident String */ + &g_Sheet_A1.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_A1 ( - wxT("offY_A1"), /* identification */ - &g_Sheet_A1.m_Offset.y /* Adresse du parametre */ + wxT("offY_A1"), /* Ident String */ + &g_Sheet_A1.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_A0 ( - wxT("offX_A0"), /* identification */ - &g_Sheet_A0.m_Offset.x /* Adresse du parametre */ + wxT("offX_A0"), /* Ident String */ + &g_Sheet_A0.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_A0 ( - wxT("offY_A0"), /* identification */ - &g_Sheet_A0.m_Offset.y /* Adresse du parametre */ + wxT("offY_A0"), /* Ident String */ + &g_Sheet_A0.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_A ( - wxT("offX_A"), /* identification */ - &g_Sheet_A.m_Offset.x /* Adresse du parametre */ + wxT("offX_A"), /* Ident String */ + &g_Sheet_A.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_A ( - wxT("offY_A"), /* identification */ - &g_Sheet_A.m_Offset.y /* Adresse du parametre */ + wxT("offY_A"), /* Ident String */ + &g_Sheet_A.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_B ( - wxT("offX_B"), /* identification */ - &g_Sheet_B.m_Offset.x /* Adresse du parametre */ + wxT("offX_B"), /* Ident String */ + &g_Sheet_B.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_B ( - wxT("offY_B"), /* identification */ - &g_Sheet_B.m_Offset.y /* Adresse du parametre */ + wxT("offY_B"), /* Ident String */ + &g_Sheet_B.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_C ( - wxT("offX_C"), /* identification */ - &g_Sheet_C.m_Offset.x /* Adresse du parametre */ + wxT("offX_C"), /* Ident String */ + &g_Sheet_C.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_C ( - wxT("offY_C"), /* identification */ - &g_Sheet_C.m_Offset.y /* Adresse du parametre */ + wxT("offY_C"), /* Ident String */ + &g_Sheet_C.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_D ( - wxT("offX_D"), /* identification */ - &g_Sheet_D.m_Offset.x /* Adresse du parametre */ + wxT("offX_D"), /* Ident String */ + &g_Sheet_D.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_D ( - wxT("offY_D"), /* identification */ - &g_Sheet_D.m_Offset.y /* Adresse du parametre */ + wxT("offY_D"), /* Ident String */ + &g_Sheet_D.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetX_E ( - wxT("offX_E"), /* identification */ - &g_Sheet_E.m_Offset.x /* Adresse du parametre */ + wxT("offX_E"), /* Ident String */ + &g_Sheet_E.m_Offset.x /* Parameter address */ ); static PARAM_CFG_INT PlotSheetOffsetY_E ( - wxT("offY_E"), /* identification */ - &g_Sheet_E.m_Offset.y /* Adresse du parametre */ + wxT("offY_E"), /* Ident String */ + &g_Sheet_E.m_Offset.y /* Parameter address */ ); static PARAM_CFG_INT CfgRepeatDeltaX ( - wxT("RptD_X"), /* identification */ - &g_RepeatStep.x, /* Adresse du parametre */ - 0, /* Valeur par defaut */ - -1000,+1000 /* Valeurs extremes */ + wxT("RptD_X"), /* Ident String */ + &g_RepeatStep.x, /* parameter address */ + 0, /* Default value */ + -1000,+1000 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT CfgRepeatDeltaY ( - wxT("RptD_Y"), /* identification */ - &g_RepeatStep.y, /* Adresse du parametre */ - 100, /* Valeur par defaut */ - -1000,+1000 /* Valeurs extremes */ + wxT("RptD_Y"), /* Ident String */ + &g_RepeatStep.y, /* Parameter address */ + 100, /* Default value */ + -1000,+1000 /* Min and Max values for the parameter */ ); static PARAM_CFG_INT CfgRepeatDeltaLabel ( - wxT("RptLab"), /* identification */ - &g_RepeatDeltaLabel, /* Adresse du parametre */ - 1, /* Valeur par defaut */ - -10,+10 /* Valeurs extremes */ -); - -static PARAM_CFG_INT CfgPenMinWidth -( - wxT("PenMin"), /* identification */ - &PenMinWidth, /* Adresse du parametre */ - 30, /* Valeur par defaut */ - 5, 100 /* Valeurs extremes */ + wxT("RptLab"), /* Ident String */ + &g_RepeatDeltaLabel, /* Parameter address */ + 1, /* Default value */ + -10,+10 /* Min and Max values for the parameter */ ); static PARAM_CFG_WXSTRING CfgSimulatorCommandLine ( - wxT("SimCmd"), /* identification */ - &g_SimulatorCommandLine /* Adresse du parametre */ + wxT("SimCmd"), /* Ident String */ + &g_SimulatorCommandLine /* Parameter address */ ); static PARAM_CFG_INT OptNetListUseNamesCfg ( - wxT("UseNetN"), /* identification */ - &g_OptNetListUseNames, /* Adresse du parametre */ - 0, /* Valeur par defaut */ - 0, 1 /* Valeurs extremes */ + wxT("UseNetN"), /* Ident String */ + &g_OptNetListUseNames, /* Parameter address */ + 0, /* Default value */ + 0, 1 /* Min and Max values for the parameter */ ); +static PARAM_CFG_INT OptDefaultLabelSizeCfg +( + wxT("LabSize"), /* Ident String */ + &g_DefaultTextLabelSize, /* Parameter address */ + DEFAULT_SIZE_TEXT, /* Default value */ + 0, 1000 /* Min and Max values for the parameter */ +); + + PARAM_CFG_BASE * ParamCfgList[] = { & UserLibDirBufCfg, @@ -530,8 +531,8 @@ PARAM_CFG_BASE * ParamCfgList[] = & CfgRepeatDeltaX, & CfgRepeatDeltaY, & CfgRepeatDeltaLabel, - & CfgPenMinWidth, & CfgSimulatorCommandLine, & OptNetListUseNamesCfg, + & OptDefaultLabelSizeCfg, NULL }; diff --git a/eeschema/eelibs_draw_components.cpp b/eeschema/eelibs_draw_components.cpp new file mode 100644 index 0000000000..8b1e209a2a --- /dev/null +++ b/eeschema/eelibs_draw_components.cpp @@ -0,0 +1,986 @@ + /****************************************/ + /* Modules to handle component 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 // Used to draw arcs + + +/* Fonctions locales */ + +/* Descr component used when a component is not found in library, + to draw a dummy shape*/ +/* +This component is a 400 mils square with the text ?? +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_Pos = 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; +int LineWidth = MAX(LibEntry->m_Prefix.m_Width, g_DrawMinimunLineWidth); + if ( (LibEntry->m_Prefix.m_Flags & IS_MOVED) == 0 ) + 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, LineWidth); + + 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; + LineWidth = MAX(LibEntry->m_Name.m_Width, g_DrawMinimunLineWidth); + if ( (LibEntry->m_Name.m_Flags & IS_MOVED) == 0 ) + 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, LineWidth); + + for( Field = LibEntry->Fields; Field != NULL; Field = (LibDrawField *)Field->Pnext ) + { + if( Field->m_Text.IsEmpty() ) return; + if ( (Field->m_Flags & IS_MOVED) != 0 ) continue; + 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; + LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); + 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, LineWidth); + } + + // Tracé de l'ancre + int len = 3 * panel->GetZoom(); + GRLine(&panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, 0, color); + GRLine(&panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, 0, 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; +int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); + + 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, LineWidth); + } + + 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, LineWidth); + } +} + + +/********************************************************************************/ +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; +int LineWidth; +//#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; + LineWidth = MAX(DEntry->m_Width, g_DrawMinimunLineWidth); + 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_ArcStart.x + + TransMat[0][1] * Arc->m_ArcStart.y;; + y2 = Pos.y + TransMat[1][0] * Arc->m_ArcStart.x + + TransMat[1][1] * Arc->m_ArcStart.y; + x1 = Pos.x + TransMat[0][0] * Arc->m_ArcEnd.x + + TransMat[0][1] * Arc->m_ArcEnd.y;; + y1 = Pos.y + TransMat[1][0] * Arc->m_ArcEnd.x + + TransMat[1][1] * Arc->m_ArcEnd.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, Arc->m_Width, 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, LineWidth, CharColor); +#else + else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, + xc, yc, LineWidth, CharColor); +#endif + } +#ifdef DRAW_ARC_WITH_ANGLE + else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, + Arc->m_Rayon, Circle->m_Width, CharColor); +#else + else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, + xc, yc, Arc->m_Width, 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, LineWidth, CharColor, + ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); + else if ( fill_option == FILLED_SHAPE) + GRFilledCircle(&panel->m_ClipBox, DC, x1, y1, + Circle->m_Rayon, 0, CharColor, CharColor); + else GRCircle(&panel->m_ClipBox, DC, x1, y1, + Circle->m_Rayon, LineWidth, CharColor); + } + else GRCircle(&panel->m_ClipBox, DC, x1, y1, + Circle->m_Rayon, LineWidth, 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; + DrawGraphicText(panel, DC, wxPoint(x1, y1), CharColor, Text->m_Text, + t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, + Text->m_Size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, LineWidth); + } + break; + + case COMPONENT_RECT_DRAW_TYPE: + { + LibDrawSquare * Square = (LibDrawSquare *) DEntry; + CharColor = GETCOLOR(LAYER_DEVICE); + + x1 = Pos.x + TransMat[0][0] * Square->m_Pos.x + + TransMat[0][1] * Square->m_Pos.y; + y1 = Pos.y + TransMat[1][0] * Square->m_Pos.x + + TransMat[1][1] * Square->m_Pos.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, LineWidth, + 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, + LineWidth, CharColor); + } + else GRRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, + LineWidth, 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); + Pin->DrawPinSymbol(panel, DC, wxPoint(x2, y2) , orient, 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, LineWidth, CharColor, + ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); + else if ( fill_option == FILLED_SHAPE ) + GRPoly(&panel->m_ClipBox, DC, polyline->n, + Buf_Poly_Drawings, 1, LineWidth, CharColor, CharColor); + else GRPoly(&panel->m_ClipBox, DC, polyline->n, + Buf_Poly_Drawings, 0, LineWidth, CharColor, CharColor); + } + else GRPoly(&panel->m_ClipBox, DC, polyline->n, + Buf_Poly_Drawings, 0, LineWidth, 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 LibDrawPin::DrawPinSymbol(WinEDA_DrawPanel * panel, wxDC * DC, + const wxPoint & pin_pos, int orient, int DrawMode, int Color) +/*******************************************************************************/ + +/* Draw the pin symbol (without texts) + if Color != 0 draw with Color, eles with the normal pin color +*/ +{ +int MapX1, MapY1, x1, y1; +int color; +int width = MAX(m_Width, g_DrawMinimunLineWidth); +int posX = pin_pos.x, posY = pin_pos.y, len = m_PinLen; + + + 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( m_PinShape & INVERT) + { + GRCircle(&panel->m_ClipBox, DC, MapX1 * INVERT_PIN_RADIUS + x1, + MapY1 * INVERT_PIN_RADIUS + y1, + INVERT_PIN_RADIUS, width, color); + + GRMoveTo(MapX1 * INVERT_PIN_RADIUS * 2 + x1, + MapY1 * INVERT_PIN_RADIUS * 2 + y1); + GRLineTo(&panel->m_ClipBox, DC, posX, posY, width, color); + } + + else + { + GRMoveTo(x1, y1); + GRLineTo(&panel->m_ClipBox, DC, posX, posY, width, color); + } + + if(m_PinShape & CLOCK) + { + if(MapY1 == 0 ) /* MapX1 = +- 1 */ + { + GRMoveTo(x1, y1 + CLOCK_PIN_DIM); + GRLineTo(&panel->m_ClipBox, DC, x1 - MapX1 * CLOCK_PIN_DIM, y1, width, color); + GRLineTo(&panel->m_ClipBox, DC, x1, y1 - CLOCK_PIN_DIM, width, color); + } + else /* MapX1 = 0 */ + { + GRMoveTo(x1 + CLOCK_PIN_DIM, y1 ); + GRLineTo(&panel->m_ClipBox, DC, x1, y1 - MapY1 * CLOCK_PIN_DIM, width, color); + GRLineTo(&panel->m_ClipBox, DC, x1 - CLOCK_PIN_DIM, y1, width, color); + } + } + + if(m_PinShape & 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, width, color); + GRLineTo(&panel->m_ClipBox, DC, x1, y1, width, 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, width, color); + GRLineTo(&panel->m_ClipBox, DC, x1 , y1, width, color); + } + } + + + if(m_PinShape & 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, width, color); + } + else /* MapX1 = 0 */ + { + GRMoveTo(x1 - IEEE_SYMBOL_PIN_DIM, y1); + GRLineTo(&panel->m_ClipBox, DC, x1 , y1 + MapY1 * IEEE_SYMBOL_PIN_DIM*2, width, color); + } + } + + /* Draw the pin end target (active end of the pin) */ + if ( ! g_IsPrinting ) // Draw but do not print the pin end target 1 pixel width */ + GRCircle(&panel->m_ClipBox, DC, posX,posY,TARGET_PIN_DIAM, 0, 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; + + int LineWidth = MAX(DrawItem->m_Width, g_DrawMinimunLineWidth); + + 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_ArcStart.x; + y2 = PartY - Arc->m_ArcStart.y; + x1 = PartX + Arc->m_ArcEnd.x; + y1 = PartY - Arc->m_ArcEnd.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, LineWidth, 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, LineWidth, 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, LineWidth, CharColor, + ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); + else if ( fill_option == FILLED_SHAPE) + GRFilledCircle(&panel->m_ClipBox, DC, x1, y1, + Circle->m_Rayon, 0, CharColor, CharColor); + else GRCircle(&panel->m_ClipBox, DC, x1, y1, + Circle->m_Rayon, LineWidth, CharColor); + } + break; + + case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: + { + LibDrawText * Text = (LibDrawText *) DrawItem; + x1 = PartX + Text->m_Pos.x; + y1 = PartY - Text->m_Pos.y; + DrawGraphicText(panel, DC, wxPoint(x1, y1), CharColor, Text->m_Text, + Text->m_Horiz, + Text->m_Size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, LineWidth); + } + break; + + case COMPONENT_RECT_DRAW_TYPE: + { + LibDrawSquare * Square = (LibDrawSquare *) DrawItem; + x1 = PartX + Square->m_Pos.x; + y1 = PartY - Square->m_Pos.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, LineWidth, + 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, LineWidth, + 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; + + Pin->DrawPinSymbol(panel, DC, wxPoint(x2, y2), orient, 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, LineWidth, CharColor, + ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); + else if ( fill_option == FILLED_SHAPE ) + GRPoly(&panel->m_ClipBox, DC, polyline->n, + Buf_Poly_Drawings, 1, LineWidth, CharColor, CharColor); + else GRPoly(&panel->m_ClipBox, DC, polyline->n, + Buf_Poly_Drawings, 0, LineWidth, CharColor, CharColor); + break; + } + } +} + diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp new file mode 100644 index 0000000000..25c840ec0d --- /dev/null +++ b/eeschema/eelibs_read_libraryfiles.cpp @@ -0,0 +1,1149 @@ +/***********************************************************/ +/* 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]; +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 %s %d %d %d %d", + &Arc->m_Pos.x, &Arc->m_Pos.y, &Arc->m_Rayon, + &Arc->t1, &Arc->t2, &Unit, &Convert, + &Arc->m_Width, chartmp, &startx, &starty, &endx, &endy); + if ( nbarg < 8 ) Error = TRUE; + Arc->m_Unit = Unit; Arc->m_Convert = Convert; + if ( chartmp[0] == 'F') Arc->m_Fill = FILLED_SHAPE; + if ( chartmp[0] == '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_ArcStart.x = startx; Arc->m_ArcStart.y = starty; + Arc->m_ArcEnd.x = endx; Arc->m_ArcEnd.y = endy; + } + else + { + Arc->m_ArcStart.x = Arc->m_Rayon; Arc->m_ArcStart.y = 0; + Arc->m_ArcEnd.x = Arc->m_Rayon; Arc->m_ArcEnd.y = 0; + RotatePoint( &Arc->m_ArcStart.x, &Arc->m_ArcStart.y, -Arc->t1); + Arc->m_ArcStart.x += Arc->m_Pos.x; Arc->m_ArcStart.y +=Arc->m_Pos.y; + RotatePoint( &Arc->m_ArcEnd.x, &Arc->m_ArcEnd.y, -Arc->t2); + Arc->m_ArcEnd.x += Arc->m_Pos.x; Arc->m_ArcEnd.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 %s", + &Circle->m_Pos.x, &Circle->m_Pos.y, &Circle->m_Rayon, + &Unit, &Convert,&Circle->m_Width, chartmp) < 6; + Circle->m_Unit = Unit; + Circle->m_Convert = Convert; + if ( chartmp[0] == 'F') Circle->m_Fill = FILLED_SHAPE; + if ( chartmp[0] == '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_Pos.x, &Square->m_Pos.y, + &Square->m_End.x, &Square->m_End.y, + &Unit, &Convert,&Square->m_Width, chartmp) < 7; + Square->m_Unit = Unit; Square->m_Convert = Convert; + if ( chartmp[0] == 'F') Square->m_Fill = FILLED_SHAPE; + if ( chartmp[0] == '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_PinNumSize = size1; /* Parametres type short */ + Pin->m_PinNameSize = 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/eeload.cpp b/eeschema/eeload.cpp index 9fa741153f..48c74a84ae 100644 --- a/eeschema/eeload.cpp +++ b/eeschema/eeload.cpp @@ -19,12 +19,13 @@ static void LoadSubHierarchy(WinEDA_SchematicFrame * frame, EDA_BaseStruct *Draw /* Variables locales */ + /************************************************************************************/ int WinEDA_SchematicFrame::LoadOneEEProject(const wxString & FileName, bool IsNew) /************************************************************************************/ /* - Routine de chargement d'un projet ( schema principal "Root" et ses - sous schemas ( hierarchie ) + Load an entire project ( shcematic root file and its subhierarchies, the configuration and the libs + which are not already loaded) */ { SCH_SCREEN *screen; diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 49393294b2..8664135cee 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -60,7 +60,7 @@ void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC, GRRect(&panel->m_ClipBox, DC, pos.x - DANGLING_SYMBOL_SIZE, pos.y - DANGLING_SYMBOL_SIZE, pos.x + DANGLING_SYMBOL_SIZE, pos.y + DANGLING_SYMBOL_SIZE, - Color); + 0, Color); } } @@ -101,7 +101,7 @@ wxString title; RedrawStructList(DrawPanel, DC, GetScreen()->EEDrawList, GR_DEFAULT_DRAWMODE); - TraceWorkSheet(DC, GetScreen()); + TraceWorkSheet(DC, GetScreen(), g_DrawMinimunLineWidth ); DrawPanel->CursorOn(DC); // reaffichage curseur if(DrawPanel->ManageCurseur) @@ -138,7 +138,7 @@ BASE_SCREEN * screen, * oldscreen = m_Parent->GetScreen(); RedrawStructList(this,DC, screen->EEDrawList, GR_COPY); if ( Print_Sheet_Ref ) - m_Parent->TraceWorkSheet(DC, screen); + m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth ); m_Parent->m_CurrentScreen = oldscreen; wxEndBusyCursor(); @@ -183,166 +183,33 @@ void RedrawOneStruct(WinEDA_DrawPanel * panel, wxDC * DC, Struct->Draw(panel, DC, wxPoint(0,0), DrawMode, Color); } -/********************************************************************************************/ -void DrawSheetLabelStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, - int DrawMode, int Color) -/********************************************************************************************/ -/* Routine de dessin des Labels type hierarchie */ -{ -int side, txtcolor; -int posx , tposx, posy, size2; -wxSize size; -int NbSegm, coord[12]; - - if( Color >= 0 ) txtcolor = Color; - else txtcolor = ReturnLayerColor(m_Layer); - GRSetDrawMode(DC, DrawMode); - - posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size; - if( !m_Text.IsEmpty() ) - { - if( m_Edge ) - { - tposx = posx - size.x; - side = GR_TEXT_HJUSTIFY_RIGHT; - } - else - { - tposx = posx + size.x + (size.x /8) ; - side = GR_TEXT_HJUSTIFY_LEFT; - } - DrawGraphicText(panel, DC, wxPoint(tposx, posy), txtcolor, - m_Text, TEXT_ORIENT_HORIZ,size , - side, GR_TEXT_VJUSTIFY_CENTER); - } - /* dessin du symbole de connexion */ - - if(m_Edge) - { - size.x = -size.x; - size.y = -size.y; - } - - coord[0] = posx; coord[1] = posy; size2 = size.x /2; - NbSegm = 0; - switch(m_Shape) - { - case 0: /* input |> */ - coord[2] = posx ; coord[3] = posy - size2; - coord[4] = posx + size2; coord[5] = posy - size2; - coord[6] = posx + size.x; coord[7] = posy; - coord[8] = posx + size2; coord[9] = posy + size2; - coord[10] = posx ; coord[11] = posy + size2; - coord[12] = coord[0] ; coord[13] = coord[1]; - NbSegm = 7; - break; - - case 1: /* output <| */ - coord[2] = posx + size2; coord[3] = posy - size2; - coord[4] = posx + size.x; coord[5] = posy - size2; - coord[6] = posx + size.x; coord[7] = posy + size2; - coord[8] = posx + size2; coord[9] = posy + size2; - coord[10] = coord[0] ; coord[11] = coord[1]; - NbSegm = 6; - break; - - case 2: /* bidi <> */ - case 3: /* TriSt <> */ - coord[2] = posx + size2; coord[3] = posy - size2; - coord[4] = posx + size.x; coord[5] = posy; - coord[6] = posx + size2; coord[7] = posy +size2; - coord[8] = coord[0]; coord[9] = coord[1]; - NbSegm = 5; - break; - - default: /* unsp []*/ - coord[2] = posx ; coord[3] = posy - size2; - coord[4] = posx + size.x; coord[5] = posy - size2; - coord[6] = posx + size.x; coord[7] = posy + size2; - coord[8] = posx ; coord[9] = posy + size2; - coord[10] = coord[0] ; coord[11] = coord[1]; - NbSegm = 6; - break; - } -// GRPoly(&panel->m_ClipBox, DC, NbSegm, coord, 1, txtcolor, txtcolor); /* Poly rempli */ - GRPoly(&panel->m_ClipBox, DC, NbSegm, coord, 0, txtcolor, txtcolor); /* Poly Non rempli */ -} -/**************************************************************************************/ -void DrawSheetStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, - int DrawMode, int Color) -/**************************************************************************************/ -/* Draw the hierarchical sheet shape */ -{ -DrawSheetLabelStruct * SheetLabelStruct; -int txtcolor; -wxString Text; -int color; -wxPoint pos = m_Pos + offset; - - if( Color >= 0 ) color = Color; - else color = ReturnLayerColor(m_Layer); - GRSetDrawMode(DC, DrawMode); - - GRRect(&panel->m_ClipBox, DC, pos.x, pos.y, - pos.x + m_Size.x, pos.y + m_Size.y, color); - - /* Trace des textes : SheetName */ - if( Color > 0 ) txtcolor = Color; - else txtcolor = ReturnLayerColor(LAYER_SHEETNAME); - - Text = wxT("Sheet: ") + m_SheetName; - DrawGraphicText(panel, DC, - wxPoint(pos.x, pos.y - 8), txtcolor, - Text, TEXT_ORIENT_HORIZ, wxSize(m_SheetNameSize,m_SheetNameSize), - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM); - - /* Trace des textes : FileName */ - if( Color >= 0 ) txtcolor = Color; - else txtcolor = ReturnLayerColor(LAYER_SHEETFILENAME); - Text = wxT("File: ") + m_FileName; - DrawGraphicText(panel, DC, - wxPoint(pos.x, pos.y + m_Size.y + 4), - txtcolor, - Text, TEXT_ORIENT_HORIZ, wxSize(m_FileNameSize,m_FileNameSize), - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP); - - - /* Trace des textes : SheetLabel */ - SheetLabelStruct = m_Label; - while( SheetLabelStruct != NULL ) - { - SheetLabelStruct->Draw(panel, DC, offset,DrawMode, Color); - SheetLabelStruct = (DrawSheetLabelStruct*)(SheetLabelStruct->Pnext); - } -} - - -/*********************************************************************/ +/*****************************************************************************************/ void EDA_DrawLineStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, int DrawMode, int Color) -/*********************************************************************/ -/* Routine de dessin des segments type wire, Bus .. */ +/*****************************************************************************************/ +/* Draw wires, Bus, and dashed liges.. */ { int color; int zoom = panel->GetZoom(); +int width = MAX(m_Width, g_DrawMinimunLineWidth); if( Color >= 0 ) color = Color; else color = ReturnLayerColor(m_Layer); GRSetDrawMode(DC, DrawMode); + if( (m_Layer == LAYER_BUS) && (zoom <= 16) ) + width *= 3; if( m_Layer == LAYER_NOTES) GRDashedLine(&panel->m_ClipBox, DC, m_Start.x + offset.x, m_Start.y + offset.y, - m_End.x + offset.x, m_End.y + offset.y, color); + m_End.x + offset.x, m_End.y + offset.y, width, color); - else if( (m_Layer == LAYER_BUS) && (zoom <= 16) ) - GRBusLine(&panel->m_ClipBox, DC, m_Start.x + offset.x, m_Start.y + offset.y, - m_End.x + offset.x, m_End.y + offset.y, color); else GRLine(&panel->m_ClipBox, DC, m_Start.x + offset.x, m_Start.y + offset.y, - m_End.x + offset.x, m_End.y + offset.y, color); + m_End.x + offset.x, m_End.y + offset.y, width, color); + if ( m_StartIsDangling ) DrawDanglingSymbol(panel, DC, m_Start + offset, color); @@ -351,11 +218,10 @@ int zoom = panel->GetZoom(); } -/*******************************************************************/ +/****************************************************************************************/ void DrawMarkerStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, int DrawMode, int Color) -/*******************************************************************/ -/* Routine de dessin des marqueurs .. */ +/****************************************************************************************/ { #define WAR 1 // utilisé aussi dans erc.cpp @@ -378,10 +244,11 @@ void DrawMarkerStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & void DrawNoConnectStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int DrawMode, int Color) /*************************************************************************/ -/* Routine de dessin des symboles de "No Connexion" .. */ +/* DRaw the "No Connect" symbol.. */ { #define DELTA (DRAWNOCONNECT_SIZE/2) int pX, pY, color; +int width = g_DrawMinimunLineWidth; pX = m_Pos.x + offset.x; pY = m_Pos.y + offset.y; @@ -389,8 +256,8 @@ int pX, pY, color; else color = ReturnLayerColor(LAYER_NOCONNECT); GRSetDrawMode(DC, DrawMode); - GRLine(&panel->m_ClipBox, DC, pX - DELTA, pY - DELTA, pX + DELTA, pY + DELTA, color); - GRLine(&panel->m_ClipBox, DC, pX + DELTA, pY - DELTA, pX - DELTA, pY + DELTA, color); + GRLine(&panel->m_ClipBox, DC, pX - DELTA, pY - DELTA, pX + DELTA, pY + DELTA, width, color); + GRLine(&panel->m_ClipBox, DC, pX + DELTA, pY - DELTA, pX - DELTA, pY + DELTA, width, color); } @@ -399,22 +266,22 @@ void DrawBusEntryStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint int DrawMode, int Color) /***************************************************************/ -/* Routine de dessin des Raccords a 45 degre type wire, Bus .. */ +/* Draw the bus entries .. */ { int color; int zoom = panel->GetZoom(); +int width = MAX(m_Width, g_DrawMinimunLineWidth); if( Color >= 0 ) color = Color; else color = ReturnLayerColor(m_Layer); GRSetDrawMode(DC, DrawMode); if( (m_Layer == LAYER_BUS) && (zoom <= 16) ) - GRBusLine(&panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y, - m_End().x + offset.x, m_End().y + offset.y, color); - else - GRLine(&panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y, - m_End().x + offset.x, m_End().y + offset.y, color); + width *= 3; + + GRLine(&panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y, + m_End().x + offset.x, m_End().y + offset.y, width, color); } @@ -426,28 +293,29 @@ void DrawPolylineStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint { int i, color ; int zoom = panel->GetZoom(); - +int width = MAX(m_Width, g_DrawMinimunLineWidth); + if( Color >= 0 ) color = Color; else color = ReturnLayerColor(m_Layer); GRSetDrawMode(DC, DrawMode); - GRMoveTo(m_Points[0], m_Points[1]); + if( (m_Layer == LAYER_BUS) && (zoom <= 16) ) + { + width *= 3; + } + + GRMoveTo(m_Points[0], m_Points[1]); if( m_Layer == LAYER_NOTES) { for (i = 1; i < m_NumOfPoints; i++) GRDashedLineTo(&panel->m_ClipBox, DC, m_Points[i * 2] + offset.x, - m_Points[i * 2 + 1] + offset.y, color); - } - else if( (m_Layer == LAYER_BUS) && (zoom <= 16) ) - { - for (i = 1; i < m_NumOfPoints; i++) - GRBusLineTo(&panel->m_ClipBox, DC, m_Points[i * 2] + offset.x, - m_Points[i * 2 + 1] + offset.y, color); + m_Points[i * 2 + 1] + offset.y, width, color); } else { for (i = 1; i < m_NumOfPoints; i++) - GRLineTo(&panel->m_ClipBox, DC, m_Points[i * 2] + offset.x, m_Points[i * 2 + 1] + offset.y, color); + GRLineTo(&panel->m_ClipBox, DC, m_Points[i * 2] + offset.x, m_Points[i * 2 + 1] + offset.y, + width, color); } } @@ -480,7 +348,9 @@ de structures. { int Width, ii; int DrawMode = g_XorMode; - +int width = g_DrawMinimunLineWidth; + + GRSetDrawMode(DC, DrawMode); switch (DrawStruct->m_StructType) @@ -492,7 +362,7 @@ int DrawMode = g_XorMode; GRMoveTo(Struct->m_Points[0] + dx, Struct->m_Points[1] + dy); for (ii = 1; ii < Struct->m_NumOfPoints; ii++) GRLineTo(&panel->m_ClipBox, DC, Struct->m_Points[ii * 2] + dx, - Struct->m_Points[ii * 2 + 1] +dy, g_GhostColor); + Struct->m_Points[ii * 2 + 1] +dy, width, g_GhostColor); break; } @@ -510,11 +380,11 @@ int DrawMode = g_XorMode; } if( (Struct->m_Flags & ENDPOINT) == 0 ) { - GRLineTo(&panel->m_ClipBox, DC, Struct->m_End.x + dx, Struct->m_End.y + dy, g_GhostColor); + GRLineTo(&panel->m_ClipBox, DC, Struct->m_End.x + dx, Struct->m_End.y + dy, width, g_GhostColor); } else { - GRLineTo(&panel->m_ClipBox, DC, Struct->m_End.x, Struct->m_End.y, g_GhostColor); + GRLineTo(&panel->m_ClipBox, DC, Struct->m_End.x, Struct->m_End.y, width, g_GhostColor); } break; } @@ -524,7 +394,7 @@ int DrawMode = g_XorMode; DrawBusEntryStruct * Struct = (DrawBusEntryStruct *) DrawStruct; int xx = Struct->m_Pos.x + dx, yy = Struct->m_Pos.y + dy; GRMoveTo(xx, yy); - GRLineTo(&panel->m_ClipBox, DC, Struct->m_Size.x + xx, Struct->m_Size.y + yy, g_GhostColor); + GRLineTo(&panel->m_ClipBox, DC, Struct->m_Size.x + xx, Struct->m_Size.y + yy, width, g_GhostColor); break; } @@ -598,7 +468,7 @@ int DrawMode = g_XorMode; DrawSheetStruct *Struct = (DrawSheetStruct * ) DrawStruct; GRRect(&panel->m_ClipBox, DC, Struct->m_Pos.x + dx, Struct->m_Pos.y + dy, Struct->m_Pos.x + Struct->m_Size.x + dx, - Struct->m_Pos.y + Struct->m_Size.y + dy, g_GhostColor); + Struct->m_Pos.y + Struct->m_Size.y + dy, width, g_GhostColor); break; } diff --git a/eeschema/eestring.cpp b/eeschema/eestring.cpp index ada7730a93..b55fa44521 100644 --- a/eeschema/eestring.cpp +++ b/eeschema/eestring.cpp @@ -16,22 +16,6 @@ extern void Move_Plume( wxPoint pos, int plume ); // see plot.cpp -/*****************************************************************************/ -void PutTextInfo(WinEDA_DrawPanel * panel, wxDC * DC, - int Orient, const wxPoint& Pos, const wxSize& Size, - const wxString & Str, int DrawMode, int color) -/*****************************************************************************/ -/* Put out a string, always centered to the given position, with given - orientation, taking into account current zoom factor. -*/ -{ - - GRSetDrawMode(DC, DrawMode); - DrawGraphicText(panel, DC, Pos, color, Str, Orient, Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); - -} - /***************************************************************************** Put out pin number and pin text info, given the pin line coordinates. The line must be vertical or horizontal. @@ -53,8 +37,9 @@ int PinTextBarPos[256]; int PinTextBarCount; int NameColor, NumColor; int PinTxtLen; -wxSize PinNameSize(m_SizeName,m_SizeName); -wxSize PinNumSize(m_SizeNum,m_SizeNum); +wxSize PinNameSize(m_PinNameSize,m_PinNameSize); +wxSize PinNumSize(m_PinNumSize,m_PinNumSize); +int LineWidth = g_DrawMinimunLineWidth; GRSetDrawMode(DC, DrawMode); @@ -112,7 +97,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x, y1), NameColor, PinText, TEXT_ORIENT_HORIZ, PinNameSize, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth); for ( ii = 0; ii < PinTextBarCount; ) { @@ -122,7 +107,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel(dx, 0); len = PinTextBarPos[ii++] - dx; // Get the line length - GRLineRel(&panel->m_ClipBox, DC, len, 0, NameColor); + GRLineRel(&panel->m_ClipBox, DC, len, 0, LineWidth, NameColor); } } else // Orient == PIN_LEFT @@ -131,7 +116,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x, y1) , NameColor, PinText, TEXT_ORIENT_HORIZ, PinNameSize, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth); for ( ii = 0; ii < PinTextBarCount; ) { @@ -141,7 +126,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel(dx - PinTxtLen, 0); len = PinTextBarPos[ii++] - dx; // Get the line length - GRLineRel(&panel->m_ClipBox, DC, len, 0, NameColor); + GRLineRel(&panel->m_ClipBox, DC, len, 0, LineWidth, NameColor); } } } @@ -151,7 +136,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint((x1 + pin_pos.x) / 2, y1 - TXTMARGE), NumColor, StringPinNum, TEXT_ORIENT_HORIZ, PinNumSize, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth); } } @@ -165,7 +150,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x1, y), NameColor, PinText, TEXT_ORIENT_VERT, PinNameSize, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth); for ( ii = 0; ii < PinTextBarCount; ) { @@ -175,7 +160,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel(0, PinTxtLen - dx); len = PinTextBarPos[ii++] - dx; // Get the line length - GRLineRel(&panel->m_ClipBox, DC, 0, -len, NameColor); + GRLineRel(&panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor); } } @@ -185,7 +170,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x1, y), NameColor, PinText, TEXT_ORIENT_VERT, PinNameSize, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth); for ( ii = 0; ii < PinTextBarCount; ) { @@ -195,7 +180,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel(0, - dx); len = PinTextBarPos[ii++] - dx; // Get the line length - GRLineRel(&panel->m_ClipBox, DC, 0, -len, NameColor); + GRLineRel(&panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor); } } } @@ -205,7 +190,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x1 - TXTMARGE, (y1 + pin_pos.y) / 2) , NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth); } } } @@ -221,7 +206,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x , y1 - TXTMARGE), NameColor, PinText, TEXT_ORIENT_HORIZ, PinNameSize, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth); for ( ii = 0; ii < PinTextBarCount; ) { @@ -230,7 +215,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel(dx, 0); len = PinTextBarPos[ii++] - dx; // Get the line length - GRLineRel(&panel->m_ClipBox, DC, len, 0, NameColor); + GRLineRel(&panel->m_ClipBox, DC, len, 0, LineWidth, NameColor); } } if(DrawPinNum) @@ -239,7 +224,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x, y1 + TXTMARGE), NumColor, StringPinNum, TEXT_ORIENT_HORIZ, PinNumSize, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth); } } else /* Its a vertical line. */ @@ -250,7 +235,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x1 - TXTMARGE , y ), NameColor, PinText, TEXT_ORIENT_VERT, PinNameSize, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth); for ( ii = 0; ii < PinTextBarCount; ) { @@ -259,7 +244,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel(0, PinTxtLen - dx); len = PinTextBarPos[ii++] - dx; // Get the line length - GRLineRel(&panel->m_ClipBox, DC, 0, - len, NameColor); + GRLineRel(&panel->m_ClipBox, DC, 0, - len, LineWidth, NameColor); } } @@ -268,7 +253,7 @@ wxSize PinNumSize(m_SizeNum,m_SizeNum); DrawGraphicText(panel, DC, wxPoint(x1 + TXTMARGE , (y1 + pin_pos.y) / 2), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth); } } } @@ -294,8 +279,8 @@ int PinTextBarPos[256]; int PinTextBarCount; int NameColor, NumColor; int PinTxtLen = 0; -wxSize PinNameSize = wxSize(m_SizeName,m_SizeName); -wxSize PinNumSize = wxSize(m_SizeNum,m_SizeNum); +wxSize PinNameSize = wxSize(m_PinNameSize,m_PinNameSize); +wxSize PinNumSize = wxSize(m_PinNumSize,m_PinNumSize); bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt; /* Get the num and name colors */ diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index c3032e23cc..ca20c76c7c 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -44,37 +44,40 @@ int id = event.GetId(); } -/**********************************************************************************/ -bool WinEDA_SchematicFrame::LoadOneSheet(SCH_SCREEN * screen, const wxString & FullFileName) -/**********************************************************************************/ +/******************************************************************************************/ +bool WinEDA_SchematicFrame::LoadOneSheet(SCH_SCREEN * screen, const wxString & filename) +/******************************************************************************************/ { +wxString FullFileName = filename; + if( screen->EEDrawList != NULL ) { if( !IsOK(this, _("Clear SubHierarchy ?") ) ) return FALSE; - ClearProjectDrawList(screen, TRUE); } - if( FullFileName.IsEmpty()) + if( FullFileName.IsEmpty() ) { - wxString filename, mask; + wxString mask; mask = wxT("*") + g_SchExtBuffer; - filename = EDA_FileSelector( _("Schematic files:"), - wxEmptyString, /* Chemin par defaut */ - screen->m_FileName, /* nom fichier par defaut */ + FullFileName = EDA_FileSelector( _("Schematic files:"), + wxEmptyString, /* default path */ + screen->m_FileName, /* default filename */ g_SchExtBuffer, /* extension par defaut */ mask, /* Masque d'affichage */ this, wxFD_OPEN, FALSE ); - if ( filename.IsEmpty() ) return FALSE; - else screen->m_FileName = filename; + if ( FullFileName.IsEmpty() ) return FALSE; } - else screen->m_FileName = FullFileName; + ClearProjectDrawList(screen, TRUE); - LoadOneEEFile(screen, screen->m_FileName); - screen->SetRefreshReq(); + screen->m_FileName = FullFileName; + LoadOneEEFile(screen, FullFileName); + screen->SetModify(); + + if ( GetScreen() == screen ) Refresh(TRUE); return TRUE; } diff --git a/eeschema/general.h b/eeschema/general.h index 0dd9bb2987..9347b8c702 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -172,13 +172,20 @@ eda_global struct EESchemaVariables g_EESchemaVar; eda_global int g_PrintFillMask; /* pour les options "FILL", l'option reelle est m_Fill & ~PrintFillMask */ -/* Variables eda_globales pour Libview */ +/* Variables globales pour Libview */ eda_global wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */ eda_global wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */ eda_global int g_ViewConvert; /* Vue normal / convert */ eda_global int g_ViewUnit; /* unité a afficher (A, B ..) */ + +/* Variables globales pour Schematic Edit */ +eda_global int g_DefaultTextLabelSize +#ifdef MAIN += DEFAULT_SIZE_TEXT +#endif +; -/* Variables eda_globales pour LibEdit */ +/* Variables globales pour LibEdit */ eda_global int g_LastTextSize #ifdef MAIN = DEFAULT_SIZE_TEXT @@ -263,4 +270,10 @@ eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin a #endif ; +eda_global int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units) used when creating a new graphic item in libedit : 0 = default */ +eda_global int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) width used to draw items on screen; 0 = single pixel line width */ +eda_global int g_PlotPSMinimunLineWidth; /* Minimum line (in EESCHEMA units) width used to Plot items , postscript format */ +/* Config keys */ +#define MINI_DRAW_LINE_WIDTH_KEY wxT("MinimunDrawLineWidth") +#define MINI_PLOTPS_LINE_WIDTH_KEY wxT("MinimunPlotPSLineWidth") diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index b5f5dd695c..26775ac90b 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -36,7 +36,8 @@ sous le courseur souris { bool PopupOn = m_CurrentScreen->m_CurrentItem && m_CurrentScreen->m_CurrentItem->m_Flags; - +bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified + if ( hotkey == 0 ) return; switch (hotkey) @@ -44,7 +45,7 @@ bool PopupOn = m_CurrentScreen->m_CurrentItem && case WXK_DELETE: case WXK_NUMPAD_DELETE: if ( PopupOn ) break; - LocateAndDeleteItem(this, DC); + RefreshToolBar = LocateAndDeleteItem(this, DC); m_CurrentScreen->SetModify(); m_CurrentScreen->m_CurrentItem = NULL; TestDanglingEnds(m_CurrentScreen->EEDrawList, DC); @@ -69,6 +70,12 @@ bool PopupOn = m_CurrentScreen->m_CurrentItem && switch (DrawStruct->m_StructType) { case DRAW_LIB_ITEM_STRUCT_TYPE: + if ( DrawStruct->m_Flags == 0 ) + { + SaveCopyInUndoList(DrawStruct, IS_CHANGED); + RefreshToolBar = TRUE; + } + CmpRotationMiroir( (EDA_SchComponentStruct *) DrawStruct, DC, CMP_ROTATE_COUNTERCLOCKWISE ); break; @@ -76,6 +83,11 @@ bool PopupOn = m_CurrentScreen->m_CurrentItem && case DRAW_TEXT_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: + if ( DrawStruct->m_Flags == 0 ) + { + SaveCopyInUndoList(DrawStruct, IS_CHANGED); + RefreshToolBar = TRUE; + } ChangeTextOrient( (DrawTextStruct*)DrawStruct, DC); break; } @@ -87,6 +99,11 @@ bool PopupOn = m_CurrentScreen->m_CurrentItem && DrawStruct = LocateSmallestComponent( GetScreen() ); if ( DrawStruct ) { + if ( DrawStruct->m_Flags == 0 ) + { + SaveCopyInUndoList(DrawStruct, IS_CHANGED); + RefreshToolBar = TRUE; + } CmpRotationMiroir( (EDA_SchComponentStruct *) DrawStruct, DC, CMP_MIROIR_Y ); } @@ -98,6 +115,11 @@ bool PopupOn = m_CurrentScreen->m_CurrentItem && DrawStruct = LocateSmallestComponent( GetScreen() ); if ( DrawStruct ) { + if ( DrawStruct->m_Flags == 0 ) + { + SaveCopyInUndoList(DrawStruct, IS_CHANGED); + RefreshToolBar = TRUE; + } CmpRotationMiroir( (EDA_SchComponentStruct *) DrawStruct, DC, CMP_MIROIR_X ); } @@ -109,6 +131,11 @@ bool PopupOn = m_CurrentScreen->m_CurrentItem && DrawStruct = LocateSmallestComponent( GetScreen() ); if ( DrawStruct ) { + if ( DrawStruct->m_Flags == 0 ) + { + SaveCopyInUndoList(DrawStruct, IS_CHANGED); + RefreshToolBar = TRUE; + } CmpRotationMiroir( (EDA_SchComponentStruct *) DrawStruct, DC, CMP_NORMAL ); TestDanglingEnds(m_CurrentScreen->EEDrawList, DC); @@ -127,4 +154,6 @@ bool PopupOn = m_CurrentScreen->m_CurrentItem && } break; } + + if ( RefreshToolBar ) SetToolbars(); } diff --git a/eeschema/libclass.cpp b/eeschema/libclass.cpp index 49eff9b6a5..0b4da30b94 100644 --- a/eeschema/libclass.cpp +++ b/eeschema/libclass.cpp @@ -98,7 +98,7 @@ char Line[1024], * text, * data; /* class LibCmpEntry */ /*********************/ /* Basic class for librarty oomponent description - Nor directly used + Not directly used Used to create the 2 derived classes : - EDA_LibCmpAliasStruct - EDA_LibComponentStruct @@ -125,10 +125,12 @@ LibCmpEntry::~LibCmpEntry(void) /* class EDA_LibCmpAliasStruct */ /*******************************/ -/* Decrit un alias d'un composant standard en librairie - Un alias est identique au composant standard - Dans un alias on ne redefinit que le nom et la documentation associée. - Le gain de place en memoire est important +/* Class to define an alias of a component + An alias uses the component defintion (graphic, pins...) + but has its own name and documentation. + Therefore, when the component is modified, alias of this component are modified. + This is a simple method to create components with differs very few + (like 74LS00, 74HC00 ... and many op amps ) */ EDA_LibCmpAliasStruct:: EDA_LibCmpAliasStruct( const wxChar * CmpName, @@ -230,14 +232,14 @@ EDA_Rect BoundaryBox; // Arc is reduced to a line from m_Start to m_End. // TO DO better. LibDrawArc * Arc = (LibDrawArc *) DrawEntry; - x1 = Arc->m_Start.x; - y1 = Arc->m_Start.y; + x1 = Arc->m_ArcStart.x; + y1 = Arc->m_ArcStart.y; xmin = MIN(xmin, x1); ymin = MIN(ymin, y1); xmax = MAX(xmax, x1); ymax = MAX(ymax, y1); - x1 = Arc->m_End.x; - y1 = Arc->m_End.y; + x1 = Arc->m_ArcEnd.x; + y1 = Arc->m_ArcEnd.y; xmin = MIN(xmin, x1); ymin = MIN(ymin, y1); xmax = MAX(xmax, x1); @@ -262,13 +264,13 @@ EDA_Rect BoundaryBox; case COMPONENT_RECT_DRAW_TYPE: { LibDrawSquare * Square = (LibDrawSquare *) DrawEntry; - xmin = MIN(xmin, Square->m_Start.x); + xmin = MIN(xmin, Square->m_Pos.x); xmin = MIN(xmin, Square->m_End.x); - xmax = MAX(xmax, Square->m_Start.x); + xmax = MAX(xmax, Square->m_Pos.x); xmax = MAX(xmax, Square->m_End.x); - ymin = MIN(ymin, Square->m_Start.y); + ymin = MIN(ymin, Square->m_Pos.y); ymin = MIN(ymin, Square->m_End.y); - ymax = MAX(ymax, Square->m_Start.y); + ymax = MAX(ymax, Square->m_Pos.y); ymax = MAX(ymax, Square->m_End.y); } break; @@ -351,12 +353,13 @@ LibDrawField::LibDrawField(int idfield) : LibEDA_BaseStruct(COMPONENT_FIELD_DRAW if ( m_FieldId >= NUMBER_OF_FIELDS ) m_FieldId = NUMBER_OF_FIELDS - 1; m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; m_Orient = 0; /* Orientation */ - m_Attributs = 0; /* Attributs = Non visible ... */ + m_Attributs = 0; /* Attributs = unvisible ... */ + m_Width = 0; m_HJustify = GR_TEXT_HJUSTIFY_CENTER; - m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */ + m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Horizontal and vertical text justification */ } -LibDrawField::~LibDrawField(void) // Destructor +LibDrawField::~LibDrawField(void) { } @@ -374,6 +377,7 @@ void LibDrawField::Copy(LibDrawField * Target) { Target->m_Pos = m_Pos; Target->m_Size = m_Size; + Target->m_Width = m_Width; Target->m_Orient = m_Orient; Target->m_Attributs = m_Attributs; Target->m_Text = m_Text; @@ -390,6 +394,7 @@ LibEDA_BaseStruct::LibEDA_BaseStruct(int struct_type): 0 if the item is common to all units */ m_Convert = 0; /* Shape identification (for parts which have a convert shape) 0 if the item is common to all shapes */ + m_Width = 0; /* Default value to draw lines or arc ... */ } /***************************************************************/ @@ -402,8 +407,10 @@ LibDrawPin::LibDrawPin(void) : LibEDA_BaseStruct(COMPONENT_PIN_DRAW_TYPE) m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */ m_Attributs = 0; /* bit 0 != 0: pin invisible */ m_PinNum = 0; /*pin number ( i.e. 4 codes Ascii ) */ - m_SizeNum = 50; - m_SizeName = 50; /* Default size for pin name and num */ + m_PinNumSize = 50; + m_PinNameSize = 50; /* Default size for pin name and num */ + m_Width = 0; +// m_PinNumWidth = m_PinNameWidth = 0; // Unused } @@ -509,11 +516,12 @@ LibDrawPin * newpin = new LibDrawPin(); newpin->m_PinType = m_PinType; newpin->m_Attributs = m_Attributs; newpin->m_PinNum = m_PinNum; - newpin->m_SizeNum = m_SizeNum; - newpin->m_SizeName = m_SizeName; + newpin->m_PinNumSize = m_PinNumSize; + newpin->m_PinNameSize = m_PinNameSize; newpin->m_Unit = m_Unit; newpin->m_Convert = m_Convert; newpin->m_Flags = m_Flags; + newpin->m_Width = m_Width; newpin->m_PinName = m_PinName; @@ -538,8 +546,8 @@ LibDrawArc * LibDrawArc::GenCopy(void) LibDrawArc * newitem = new LibDrawArc(); newitem->m_Pos = m_Pos; - newitem->m_Start = m_Start; - newitem->m_End = m_End; + newitem->m_ArcStart = m_ArcStart; + newitem->m_ArcEnd = m_ArcEnd; newitem->m_Rayon = m_Rayon; newitem->t1 = t1; newitem->t2 = t2; @@ -557,7 +565,6 @@ LibDrawCircle::LibDrawCircle(void) : LibEDA_BaseStruct(COMPONENT_CIRCLE_DRAW_TYP /**********************************************************************/ { m_Rayon = 0; - m_Width = 0; m_Fill = NO_FILL; } @@ -585,6 +592,7 @@ LibDrawText::LibDrawText(void) : LibEDA_BaseStruct(COMPONENT_GRAPHIC_TEXT_DRAW_T m_Horiz = TEXT_ORIENT_HORIZ; m_Size = wxSize(50,50); m_Type = 0; + m_Width = 0; } /***************************************/ @@ -601,6 +609,7 @@ LibDrawText * newitem = new LibDrawText(); newitem->m_Convert = m_Convert; newitem->m_Flags = m_Flags; newitem->m_Text = m_Text; + newitem->m_Width = m_Width; return newitem; } @@ -616,7 +625,7 @@ LibDrawSquare * LibDrawSquare::GenCopy(void) { LibDrawSquare * newitem = new LibDrawSquare(); - newitem->m_Start = m_Start; + newitem->m_Pos = m_Pos; newitem->m_End = m_End; newitem->m_Width = m_Width; newitem->m_Unit = m_Unit; @@ -635,7 +644,7 @@ LibDrawSegment * LibDrawSegment::GenCopy(void) { LibDrawSegment * newitem = new LibDrawSegment(); - newitem->m_Start = m_Start; + newitem->m_Pos = m_Pos; newitem->m_End = m_End; newitem->m_Width = m_Width; newitem->m_Unit = m_Unit; @@ -667,6 +676,7 @@ int size; newitem->PolyList = (int*)MyMalloc(size); memcpy(newitem->PolyList, PolyList, size); } + newitem->m_Pos = m_Pos; newitem->m_Width = m_Width; newitem->m_Unit = m_Unit; newitem->m_Convert = m_Convert; diff --git a/eeschema/libcmp.h b/eeschema/libcmp.h index fe04518ccd..0b57d58766 100644 --- a/eeschema/libcmp.h +++ b/eeschema/libcmp.h @@ -142,7 +142,7 @@ public: LibraryStruct * m_Pnext; /* Point on next lib in chain. */ int m_Modified; /* flag indicateur d'edition */ int m_Size; // Size in bytes (for statistics) - long m_TimeStamp; // Signature temporelle + unsigned long m_TimeStamp; // Signature temporelle int m_Flags; // variable used in some functions bool m_IsLibCache; // False for the "standard" libraries, // True for the library cache @@ -167,10 +167,12 @@ public: class LibEDA_BaseStruct : public EDA_BaseStruct { public: - int m_Unit; /* Unit identification (for multi part per parkage) + int m_Unit; /* Unit identification (for multi part per parkage) 0 if the item is common to all units */ - int m_Convert; /* Shape identification (for parts which have a convert shape) + int m_Convert; /* Shape identification (for parts which have a convert shape) 0 if the item is common to all shapes */ + wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */ + int m_Width; /* Width of draw lines */ public: LibEDA_BaseStruct * Next(void) {return (LibEDA_BaseStruct *) Pnext;} @@ -179,20 +181,20 @@ public: void Display_Infos_DrawEntry(WinEDA_DrawFrame * frame); }; + class LibDrawPin : public LibEDA_BaseStruct { public: - wxPoint m_Pos; /* Pin position */ - short m_PinLen; /* Pin lenght */ - short m_Orient; /* Pin orientation (Up, Down, Left, Right) */ - short m_PinShape; /* Bitwise ORed: Pin shape (see enum DrawPinShape) */ - char m_PinType; /* Electrical pin properties */ - char m_Attributs; /* bit 0 != 0: pin invisible */ - long m_PinNum; /* Pin number: 4 Ascii code like - "12" or "anod" or "G6" + int m_PinLen; /* Pin lenght */ + int m_Orient; /* Pin orientation (Up, Down, Left, Right) */ + int m_PinShape; /* Bitwise ORed: Pin shape (see enum DrawPinShape) */ + int m_PinType; /* Electrical pin properties */ + int m_Attributs; /* bit 0 != 0: pin invisible */ + long m_PinNum; /* Pin number: 4 Ascii code like "12" or "anod" or "G6" "12" is really "12\0\0"*/ wxString m_PinName; - short m_SizeNum, m_SizeName; /* Pin num and Pin name sizes */ + int m_PinNumSize, m_PinNameSize; /* Pin num and Pin name sizes */ +// short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */ public: LibDrawPin(void); @@ -204,6 +206,9 @@ public: int ReturnPinDrawOrient(int TransMat[2][2]); void ReturnPinStringNum(wxString & buffer); void SetPinNumFromString(wxString & buffer); + void DrawPinSymbol(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & pin_pos, int orient, + int DrawMode, int Color = -1); + void DrawPinTexts(WinEDA_DrawPanel * panel, wxDC * DC, wxPoint & pin_pos, int orient, int TextInside, bool DrawPinNum, bool DrawPinName, @@ -216,12 +221,10 @@ public: class LibDrawArc : public LibEDA_BaseStruct { public: - wxPoint m_Pos; /* Position du point de reference (Centre)*/ int m_Rayon; - int m_Width; int m_Fill; int t1, t2; /* position des 2 extremites de l'arc en 0,1 degres */ - wxPoint m_Start, m_End; /* position des 2 extremites de l'arc en coord reelles*/ + wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ public: LibDrawArc(void); @@ -233,9 +236,7 @@ public: class LibDrawCircle : public LibEDA_BaseStruct { public: - wxPoint m_Pos; /* Position du point de reference */ int m_Rayon; - int m_Width; int m_Fill; public: @@ -248,7 +249,6 @@ public: class LibDrawText : public LibEDA_BaseStruct { public: - wxPoint m_Pos; /* Position du point de reference */ int m_Horiz; wxSize m_Size; int m_Type; @@ -264,9 +264,7 @@ public: class LibDrawSquare : public LibEDA_BaseStruct { public: - wxPoint m_Start; wxPoint m_End; - int m_Width; int m_Fill; public: @@ -279,9 +277,7 @@ public: class LibDrawSegment : public LibEDA_BaseStruct { public: - wxPoint m_Start; wxPoint m_End; - int m_Width; public: LibDrawSegment(void); @@ -294,7 +290,6 @@ class LibDrawPolyline : public LibEDA_BaseStruct { public: int n, *PolyList; - int m_Width; int m_Fill; public: diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index da86523e07..ca02c1250b 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -50,14 +50,25 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; } else { - DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, + DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry, CurrentUnit, CurrentConvert); if (DrawEntry == NULL ) { - DrawEntry = LocateDrawItem(GetScreen(), CurrentLibEntry,CurrentUnit, + DrawEntry = LocateDrawItem(GetScreen(), GetScreen()->m_MousePosition, + CurrentLibEntry,CurrentUnit, CurrentConvert,LOCATE_ALL_DRAW_ITEM); } + if (DrawEntry == NULL ) + DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, + CurrentUnit, CurrentConvert); + if (DrawEntry == NULL ) + { + DrawEntry = LocateDrawItem(GetScreen(), GetScreen()->m_Curseur, + CurrentLibEntry,CurrentUnit, + CurrentConvert,LOCATE_ALL_DRAW_ITEM); + } + if ( DrawEntry ) DrawEntry->Display_Infos_DrawEntry(this); else @@ -110,14 +121,24 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; break; case ID_LIBEDIT_DELETE_ITEM_BUTT : - DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, + DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry, CurrentUnit, CurrentConvert); if (DrawEntry == NULL ) { - DrawEntry = LocateDrawItem(GetScreen(), CurrentLibEntry,CurrentUnit, + DrawEntry = LocateDrawItem(GetScreen(), m_CurrentScreen->m_MousePosition, + CurrentLibEntry,CurrentUnit, CurrentConvert,LOCATE_ALL_DRAW_ITEM); } + if (DrawEntry == NULL ) + DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, + CurrentUnit, CurrentConvert); + if (DrawEntry == NULL ) + { + DrawEntry = LocateDrawItem(GetScreen(), m_CurrentScreen->m_Curseur, + CurrentLibEntry,CurrentUnit, + CurrentConvert,LOCATE_ALL_DRAW_ITEM); + } if ( DrawEntry == NULL ) { AfficheDoc(this, CurrentLibEntry->m_Doc.GetData(), @@ -167,13 +188,23 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; if ( !m_ID_current_state || // Simple localisation des elements (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) { - DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, + DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry, CurrentUnit, CurrentConvert); - if ( DrawEntry == NULL ) - { - DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), CurrentLibEntry,CurrentUnit, - CurrentConvert,LOCATE_ALL_DRAW_ITEM); - } + if ( DrawEntry == NULL ) + DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, + CurrentUnit, CurrentConvert); + if ( DrawEntry == NULL ) + { + DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)m_CurrentScreen, + m_CurrentScreen->m_MousePosition,CurrentLibEntry,CurrentUnit, + CurrentConvert,LOCATE_ALL_DRAW_ITEM); + } + if ( DrawEntry == NULL ) + { + DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)m_CurrentScreen, + m_CurrentScreen->m_Curseur, CurrentLibEntry,CurrentUnit, + CurrentConvert,LOCATE_ALL_DRAW_ITEM); + } if ( DrawEntry == NULL ) { DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*) @@ -242,6 +273,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; case COMPONENT_FIELD_DRAW_TYPE: if( DrawEntry->m_Flags == 0 ) { + EditField(DC, (LibDrawField *)DrawEntry); } break; diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index 55d4197301..ed5ed6e09c 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -43,7 +43,13 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert); if ( DrawEntry == NULL ) { - DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), CurrentLibEntry,CurrentUnit, + DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), + GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit, + CurrentConvert,LOCATE_ALL_DRAW_ITEM); + } + if ( DrawEntry == NULL ) + { + DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit, CurrentConvert,LOCATE_ALL_DRAW_ITEM); } if ( DrawEntry == NULL ) diff --git a/eeschema/libfield.cpp b/eeschema/libfield.cpp index ae285a2439..5c137816f4 100644 --- a/eeschema/libfield.cpp +++ b/eeschema/libfield.cpp @@ -100,6 +100,7 @@ LibDrawField *Field = (LibDrawField *)CurrentDrawItem; break; } +int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; if( erase ) DrawGraphicText(panel, DC, @@ -107,7 +108,7 @@ LibDrawField *Field = (LibDrawField *)CurrentDrawItem; color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, - Field->m_HJustify, Field->m_VJustify); + Field->m_HJustify, Field->m_VJustify, LineWidth); LastTextPosition.x = panel->GetScreen()->m_Curseur.x; @@ -120,7 +121,7 @@ LibDrawField *Field = (LibDrawField *)CurrentDrawItem; color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, - Field->m_HJustify, Field->m_VJustify); + Field->m_HJustify, Field->m_VJustify, LineWidth); } /*******************************************************************/ @@ -131,10 +132,8 @@ int color; if(Field == NULL ) return; - GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE); - switch (Field->m_FieldId) - { + { case REFERENCE: color = ReturnLayerColor(LAYER_REFERENCEPART); break; @@ -146,18 +145,25 @@ int color; default: color = ReturnLayerColor(LAYER_FIELDS); break; - } + } - if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; + Field->m_Flags = 0; + + + if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY; Field->m_Pos.x = GetScreen()->m_Curseur.x; Field->m_Pos.y = - GetScreen()->m_Curseur.y; +int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); + DrawPanel->CursorOff(DC); + + GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE); DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, - Field->m_HJustify, Field->m_VJustify); + Field->m_HJustify, Field->m_VJustify, LineWidth); - Field->m_Flags = 0; + DrawPanel->CursorOn(DC); m_CurrentScreen->SetModify(); DrawPanel->ManageCurseur = NULL; @@ -200,11 +206,12 @@ wxString title = wxT("Text:"); Text.Replace( wxT(" ") , wxT("_") ); GRSetDrawMode(DC, g_XorMode); +int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, - Field->m_HJustify, Field->m_VJustify); + Field->m_HJustify, Field->m_VJustify, LineWidth); if( ! Text.IsEmpty() ) { @@ -219,7 +226,7 @@ wxString title = wxT("Text:"); color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, - Field->m_HJustify, Field->m_VJustify); + Field->m_HJustify, Field->m_VJustify, LineWidth); m_CurrentScreen->SetModify(); @@ -254,14 +261,17 @@ int color; break; } - if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; + if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY; + + DrawPanel->CursorOff(DC); GRSetDrawMode(DC, g_XorMode); +int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, - Field->m_HJustify, Field->m_VJustify); + Field->m_HJustify, Field->m_VJustify, LineWidth); if( Field->m_Orient) Field->m_Orient = 0; else Field->m_Orient = 1; @@ -272,7 +282,8 @@ int color; color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, - Field->m_HJustify, Field->m_VJustify); + Field->m_HJustify, Field->m_VJustify, LineWidth); + DrawPanel->CursorOn(DC); } diff --git a/eeschema/locate.cpp b/eeschema/locate.cpp index b5b23e7672..9da841233e 100644 --- a/eeschema/locate.cpp +++ b/eeschema/locate.cpp @@ -27,16 +27,15 @@ static bool IsPointInBox( int pX, int pY, static bool IsPointOnSegment( int pX, int pY, int SegmX1, int SegmY1, int SegmX2, int SegmY2, int seuil = 0); static bool SnapPoint2(const wxPoint & PosRef, int SearchMask, - EDA_BaseStruct *DrawList, DrawPickedStruct *DontSnapList); + EDA_BaseStruct *DrawList, DrawPickedStruct *DontSnapList, int zoom_value); /*********************************************************************/ EDA_SchComponentStruct * LocateSmallestComponent( SCH_SCREEN * Screen ) /*********************************************************************/ -/* Recherche du plus petit (en surface) composant pointe par la souris - Si 2 (ou plus) composants sont trouves, un pointeur sur le composant - le plus petit est retourne +/* Search the smaller (considering its area) component under the mouse cursor or the pcb cursor + If more than 1 component is found, a pointer to the smaller component is returned */ { EDA_SchComponentStruct * DrawLibItem = NULL, * LastDrawLibItem = NULL; @@ -48,8 +47,12 @@ float sizeref = 0, sizecurr; while ( DrawList ) { - if( ( SnapPoint2(Screen->m_Curseur, LIBITEM, - DrawList,NULL)) == FALSE ) break; + if( ( SnapPoint2(Screen->m_MousePosition, LIBITEM, + DrawList,NULL, Screen->GetZoom())) == FALSE ) + { + if( ( SnapPoint2(Screen->m_Curseur, LIBITEM, + DrawList,NULL, Screen->GetZoom())) == FALSE ) break; + } DrawLibItem = (EDA_SchComponentStruct *) LastSnappedStruct; DrawList = DrawLibItem->Pnext; if ( LastDrawLibItem == NULL ) // First time a component is located @@ -74,10 +77,7 @@ float sizeref = 0, sizecurr; } -/* 2 functions EDA_BaseStruct * PickStruct: - Search in block, or Search at location pos - - SearchMask = (bitwise OR): +/* SearchMask = (bitwise OR): LIBITEM WIREITEM BUSITEM @@ -100,7 +100,7 @@ float sizeref = 0, sizecurr; Return: - -Bloc searc: + -Bloc search: pointeur sur liste de pointeurs de structures si Plusieurs structures selectionnees. pointeur sur la structure si 1 seule @@ -118,11 +118,11 @@ EDA_BaseStruct * PickStruct(const wxPoint & refpos, */ { bool Snapped; - +int zoom = ActiveScreen->GetZoom(); if ( DrawList == NULL ) return NULL; if( (Snapped = SnapPoint2(refpos, SearchMask, - DrawList,NULL)) != FALSE) + DrawList,NULL, zoom)) != FALSE) { return( LastSnappedStruct); } @@ -186,7 +186,7 @@ EDA_BaseStruct *DrawStruct; * The routine returns TRUE if point was snapped. * *****************************************************************************/ bool SnapPoint2(const wxPoint & PosRef, int SearchMask, - EDA_BaseStruct *DrawList, DrawPickedStruct *DontSnapList) + EDA_BaseStruct *DrawList, DrawPickedStruct *DontSnapList, int zoom_value) { int i, *Points, x = PosRef.x, y = PosRef.y; int x1, y1, x2, y2, NumOfPoints2; @@ -272,10 +272,11 @@ int dx, dy; #undef STRUCT #define STRUCT ((DrawJunctionStruct *) DrawList) if( !(SearchMask & JUNCTIONITEM) )break; - x1 = STRUCT->m_Pos.x - (DRAWJUNCTION_SIZE / 2); - y1 = STRUCT->m_Pos.y - (DRAWJUNCTION_SIZE / 2); - x2 = STRUCT->m_Pos.x + (DRAWJUNCTION_SIZE / 2); - y2 = STRUCT->m_Pos.y + (DRAWJUNCTION_SIZE / 2); + dx = DRAWJUNCTION_SIZE / 2; + x1 = STRUCT->m_Pos.x - dx; + y1 = STRUCT->m_Pos.y - dx; + x2 = STRUCT->m_Pos.x + dx; + y2 = STRUCT->m_Pos.y + dx; if(IsPointInBox(x, y, x1,y1, x2,y2) ) { LastSnappedStruct = DrawList; @@ -288,10 +289,11 @@ int dx, dy; #undef STRUCT #define STRUCT ((DrawNoConnectStruct *) DrawList) if( !(SearchMask & NOCONNECTITEM) )break; - x1 = STRUCT->m_Pos.x - (DRAWNOCONNECT_SIZE / 2); - y1 = STRUCT->m_Pos.y - (DRAWNOCONNECT_SIZE / 2); - x2 = STRUCT->m_Pos.x + (DRAWNOCONNECT_SIZE / 2); - y2 = STRUCT->m_Pos.y + (DRAWNOCONNECT_SIZE / 2); + dx = (DRAWNOCONNECT_SIZE*zoom_value) / 2; + x1 = STRUCT->m_Pos.x - dx; + y1 = STRUCT->m_Pos.y - dx; + x2 = STRUCT->m_Pos.x + dx; + y2 = STRUCT->m_Pos.y + dx; if(IsPointInBox(x, y, x1,y1, x2,y2) ) { LastSnappedStruct = DrawList; @@ -303,10 +305,11 @@ int dx, dy; #undef STRUCT #define STRUCT ((DrawMarkerStruct *) DrawList) if( !(SearchMask & MARKERITEM) )break; - x1 = STRUCT->m_Pos.x - DRAWMARKER_SIZE / 4; - y1 = STRUCT->m_Pos.y - DRAWMARKER_SIZE / 4; - x2 = STRUCT->m_Pos.x + DRAWMARKER_SIZE / 4; - y2 = STRUCT->m_Pos.y + DRAWMARKER_SIZE / 4; + dx = (DRAWMARKER_SIZE*zoom_value) / 2; + x1 = STRUCT->m_Pos.x - dx; + y1 = STRUCT->m_Pos.y - dx; + x2 = STRUCT->m_Pos.x + dx; + y2 = STRUCT->m_Pos.y + dx; if(IsPointInBox(x, y, x1,y1, x2,y2) ) { LastSnappedStruct = DrawList; @@ -712,10 +715,10 @@ static bool IsPointOnSegment( int pX, int pY, else return(FALSE); } -/****************************************************************/ -LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, EDA_LibComponentStruct * LibEntry, - int Unit, int Convert, int masque) -/****************************************************************/ +/*********************************************************************************/ +LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, const wxPoint & refpoint, + EDA_LibComponentStruct * LibEntry, int Unit, int Convert, int masque) +/*********************************************************************************/ /* Routine de localisation d'un element de dessin de symbole( sauf pins ) Unit = Unite d'appartenance (si Unit = 0, recherche sur toutes unites) Convert = Conversion d'appartenance (si Convert = 0, recherche sur @@ -738,8 +741,8 @@ int seuil; DrawItem = LibEntry->m_Drawings; seuil = 3; /* Tolerance: 1/2 pas de petite grille */ - px = Screen->m_Curseur.x; - py = Screen->m_Curseur.y; + px = refpoint.x; + py = refpoint.y; for( ; DrawItem != NULL ; DrawItem = DrawItem->Next() ) { @@ -772,24 +775,24 @@ int seuil; break; case COMPONENT_RECT_DRAW_TYPE: - { + { // Locate a rect if the mouse cursor is on a segment LibDrawSquare * Square = (LibDrawSquare *) DrawItem; if( (masque & LOCATE_COMPONENT_RECT_DRAW_TYPE) == 0) break; - if(IsPointOnSegment(px,py, - Square->m_Start.x, - Square->m_Start.y, - Square->m_End.x, - Square->m_Start.y, seuil) ) + if(IsPointOnSegment(px,py, // locate lower segment + Square->m_Pos.x, - Square->m_Pos.y, + Square->m_End.x, - Square->m_Pos.y, seuil) ) return(DrawItem); - if(IsPointOnSegment(px, py, - Square->m_End.x, - Square->m_Start.y, + if(IsPointOnSegment(px, py, // locate right segment + Square->m_End.x, - Square->m_Pos.y, Square->m_End.x, - Square->m_End.y, seuil) ) return(DrawItem); - if(IsPointOnSegment(px, py, + if(IsPointOnSegment(px, py, // locate upper segment Square->m_End.x, - Square->m_End.y, - Square->m_Start.x, - Square->m_End.y, seuil) ) + Square->m_Pos.x, - Square->m_End.y, seuil) ) return(DrawItem); - if(IsPointOnSegment(px, py, - Square->m_Start.x, - Square->m_End.y, - Square->m_Start.x, - Square->m_Start.y, seuil) ) + if(IsPointOnSegment(px, py, // locate left segment + Square->m_Pos.x, - Square->m_End.y, + Square->m_Pos.x, - Square->m_Pos.y, seuil) ) return(DrawItem); } break; @@ -813,7 +816,7 @@ int seuil; LibDrawSegment * Segment = (LibDrawSegment *) DrawItem; if( (masque & LOCATE_COMPONENT_LINE_DRAW_TYPE) == 0) break; if(IsPointOnSegment(px, py, - Segment->m_Start.x, - Segment->m_Start.y, + Segment->m_Pos.x, - Segment->m_Pos.y, Segment->m_End.x, - Segment->m_End.y, seuil) ) return(DrawItem); } diff --git a/eeschema/makefile.g95 b/eeschema/makefile.g95 index b9e6516bb0..8ccbb693a3 100644 --- a/eeschema/makefile.g95 +++ b/eeschema/makefile.g95 @@ -16,7 +16,7 @@ $(TARGET).exe: $(OBJECTS) $(TARGET)_resources.o $(EDALIBS) $(CXX) $(ALL_LDFLAGS) -o $(TARGET).exe $(OBJECTS)\ $(TARGET)_resources.o $(EDALIBS) $(SYSWXLIB) -install: +install: $(TARGET).exe cp -v $(TARGET).exe $(KICAD_BIN) diff --git a/eeschema/makefile.gtk b/eeschema/makefile.gtk index 010bf78e50..690f0a5d38 100644 --- a/eeschema/makefile.gtk +++ b/eeschema/makefile.gtk @@ -27,10 +27,10 @@ $(TARGET): $(OBJECTS) makefile.gtk makefile.include $(EXTRALIBS) ../libs.linux $(LD) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $(TARGET) netlist_form_pads-pcb: plugins/netlist_form_pads-pcb.cpp makefile.gtk - gcc -D__UNIX__ -Wall plugins/netlist_form_pads-pcb.cpp $(LIBSTDC) -o netlist_form_pads-pcb + gcc $(CXXFLAGS) -D__UNIX__ -Wall plugins/netlist_form_pads-pcb.cpp $(LIBSTDC) -o netlist_form_pads-pcb -install: +install: $(TARGET) cp $(TARGET) $(KICAD_BIN) diff --git a/eeschema/makefile.include b/eeschema/makefile.include index 5fa6c7ea38..306713307c 100644 --- a/eeschema/makefile.include +++ b/eeschema/makefile.include @@ -1,187 +1,188 @@ -# File: makefile.include - -FINAL = 1 - -EESCHEMA_FLAGS= -DEESCHEMA -EXTRACPPFLAGS=$(KICAD_FLAGS) $(EESCHEMA_FLAGS) -I./ -Ibitmaps -I../include -I../eeschema -EXTRALIBS = ../common/common.a - -# DEPEND = program.h general.h - -OBJECTS = eeschema.o\ - schedit.o\ - load_one_schematic_file.o\ - libedit_undo_redo.o\ - schematic_undo_redo.o\ - dialog_create_component.o\ - libedit_onrightclick.o\ - libedit_onleftclick.o\ - dangling_ends.o\ - setpage.o\ - cmpclass.o\ - class_hierarchy_sheet.o\ - class_text-label.o\ - component_class.o\ - libclass.o\ - dialog_options.o\ - tool_lib.o\ - tool_sch.o\ - tool_viewlib.o\ - drawframe.o\ - schframe.o\ - viewlib_frame.o\ - drawpanel.o\ - wxprint.o\ - lib_export.o \ - busentry.o \ - bus-wire-junction.o \ - eelibs1.o eelibs2.o \ - eeload.o\ - block.o\ - block_libedit.o\ - eeredraw.o\ - dialog_eeschema_config.o\ - eestring.o eelayer.o \ - priorque.o eeconfig.o \ - affiche.o \ - zoom.o \ - getpart.o\ - netlist.o\ - netlist_control.o\ - edit_label.o\ - edit_component_in_schematic.o\ - locate.o \ - save_schemas.o sheet.o \ - viewlibs.o \ - libedit.o \ - libframe.o \ - symbedit.o \ - pinedit.o \ - libfield.o \ - edit_component_in_lib.o \ - menubar.o \ - savelib.o symbtext.o \ - symbdraw.o \ - hierarch.o files-io.o \ - annotate.o plothpgl.o \ - plot.o libalias.o \ - plotps.o netform.o \ - delsheet.o \ - infospgm.o \ - delete.o dialog_build_BOM.o \ - erc.o\ - dialog_erc.o\ - selpart.o \ - libarch.o \ - cleanup.o\ - sheetlab.o \ - class_screen.o \ - database.o\ - onrightclick.o \ - onleftclick.o \ - find.o \ - controle.o\ - hotkeys.o\ - svg_print.o - -eeschema.o: eeschema.cpp program.h general.h $(DEPEND) - -edit_component_in_lib.o: edit_component_in_lib.cpp\ - dialog_edit_component_in_lib.cpp dialog_edit_component_in_lib.h $(DEPEND) - -edit_component_in_schematic.o: edit_component_in_schematic.cpp\ - dialog_edit_component_in_schematic.cpp dialog_edit_component_in_schematic.h $(DEPEND) - -edit_label.o: edit_label.cpp dialog_edit_label.cpp dialog_edit_label.h $(DEPEND) - -dialog_create_component.o: dialog_create_component.cpp dialog_create_component.h $(DEPEND) - -busentry.o: busentry.cpp $(DEPEND) - -symbdraw.o: symbdraw.cpp dialog_cmp_graphic_properties.cpp\ - dialog_cmp_graphic_properties.h $(DEPEND) - -component_class.o: component_class.cpp component_class.h - -menubar.o: menubar.cpp $(DEPEND) - -find.o:find.cpp dialog_find.cpp dialog_find.h $(DEPEND) - -eeconfig.o: eeconfig.cpp eeconfig.h $(DEPEND) - -annotate.o: annotate.cpp annotate_dialog.cpp annotate_dialog.h $(DEPEND) netlist.h - -netlist.o: netlist.cpp $(DEPEND) netlist.h - -netlist_control.o: netlist_control.cpp $(DEPEND) netlist.h - -netform.o: netform.cpp $(DEPEND) netlist.h - -erc.o: erc.cpp dialog_erc.h $(DEPEND) netlist.h - -dialog_erc.o: dialog_erc.cpp dialog_erc.h $(DEPEND) - -setpage.o: ../share/setpage.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -svg_print.o: ../share/svg_print.cpp ../share/svg_print.h $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -zoom.o: ../share/zoom.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -treeprj.o: ../share/treeprj.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -drawpanel.o: ../share/drawpanel.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -mdiframe.o: ../share/mdiframe.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -buildmnu.o: ../share/buildmnu.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -pinedit.o: pinedit.cpp pinedit-dialog.cpp pinedit-dialog.h $(DEPEND) - -tool_lib.o: tool_lib.cpp $(DEPEND) - -controle.o: controle.cpp $(DEPEND) ../include/eda_dde.h - -wxprint.o: ../share/wxprint.cpp ../share/dialog_print.cpp ../share/dialog_print.h $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -bus-wire-junction.o: bus-wire-junction.cpp $(DEPEND) - -drawframe.o: ../share/drawframe.cpp - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -eelibs1.o: eelibs1.cpp $(DEPEND) - -eelibs2.o: eelibs2.cpp $(DEPEND) - -eeload.o: eeload.cpp $(DEPEND) - -block.o: block.cpp $(DEPEND) - -block_libedit.o: block_libedit.cpp $(DEPEND) - -onrightclick.o: onrightclick.cpp $(DEPEND) - -libedit_undo_redo.o: libedit_undo_redo.cpp $(DEPEND) - -libedit_onrightclick.o: libedit_onrightclick.cpp $(DEPEND) - -libedit_onleftclick.o: libedit_onleftclick.cpp $(DEPEND) - -onleftclick.o: onleftclick.cpp $(DEPEND) - -eeredraw.o: eeredraw.cpp $(DEPEND) - -dialog_eeschema_config.o: dialog_eeschema_config.cpp dialog_eeschema_config.h $(DEPEND) - -libedit.o: libedit.cpp $(DEPEND) - -infospgm.o: ../share/infospgm.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - +# File: makefile.include + +FINAL = 1 + +EESCHEMA_FLAGS= -DEESCHEMA +EXTRACPPFLAGS += $(KICAD_FLAGS) $(EESCHEMA_FLAGS) -fno-strict-aliasing -I./ -Ibitmaps -I../include -I../eeschema +EXTRALIBS = ../common/common.a + +# DEPEND = program.h general.h + +OBJECTS = eeschema.o\ + schedit.o\ + load_one_schematic_file.o\ + libedit_undo_redo.o\ + schematic_undo_redo.o\ + dialog_create_component.o\ + libedit_onrightclick.o\ + libedit_onleftclick.o\ + dangling_ends.o\ + setpage.o\ + cmpclass.o\ + class_hierarchy_sheet.o\ + class_text-label.o\ + component_class.o\ + libclass.o\ + dialog_options.o\ + tool_lib.o\ + tool_sch.o\ + tool_viewlib.o\ + drawframe.o\ + schframe.o\ + viewlib_frame.o\ + drawpanel.o\ + wxprint.o\ + lib_export.o \ + busentry.o \ + bus-wire-junction.o \ + eelibs_read_libraryfiles.o \ + eelibs_draw_components.o \ + eeload.o\ + block.o\ + block_libedit.o\ + eeredraw.o\ + dialog_eeschema_config.o\ + eestring.o eelayer.o \ + priorque.o eeconfig.o \ + affiche.o \ + zoom.o \ + getpart.o\ + netlist.o\ + netlist_control.o\ + edit_label.o\ + edit_component_in_schematic.o\ + locate.o \ + save_schemas.o sheet.o \ + viewlibs.o \ + libedit.o \ + libframe.o \ + symbedit.o \ + pinedit.o \ + libfield.o \ + edit_component_in_lib.o \ + menubar.o \ + savelib.o symbtext.o \ + symbdraw.o \ + hierarch.o files-io.o \ + annotate.o plothpgl.o \ + plot.o libalias.o \ + plotps.o netform.o \ + delsheet.o \ + infospgm.o \ + delete.o dialog_build_BOM.o \ + erc.o\ + dialog_erc.o\ + selpart.o \ + libarch.o \ + cleanup.o\ + sheetlab.o \ + class_screen.o \ + database.o\ + onrightclick.o \ + onleftclick.o \ + find.o \ + controle.o\ + hotkeys.o\ + svg_print.o + +eeschema.o: eeschema.cpp program.h general.h $(DEPEND) + +edit_component_in_lib.o: edit_component_in_lib.cpp\ + dialog_edit_component_in_lib.cpp dialog_edit_component_in_lib.h $(DEPEND) + +edit_component_in_schematic.o: edit_component_in_schematic.cpp\ + dialog_edit_component_in_schematic.cpp dialog_edit_component_in_schematic.h $(DEPEND) + +edit_label.o: edit_label.cpp dialog_edit_label.cpp dialog_edit_label.h $(DEPEND) + +dialog_create_component.o: dialog_create_component.cpp dialog_create_component.h $(DEPEND) + +busentry.o: busentry.cpp $(DEPEND) + +symbdraw.o: symbdraw.cpp dialog_cmp_graphic_properties.cpp\ + dialog_cmp_graphic_properties.h $(DEPEND) + +component_class.o: component_class.cpp component_class.h + +menubar.o: menubar.cpp $(DEPEND) + +find.o:find.cpp dialog_find.cpp dialog_find.h $(DEPEND) + +eeconfig.o: eeconfig.cpp eeconfig.h $(DEPEND) + +annotate.o: annotate.cpp annotate_dialog.cpp annotate_dialog.h $(DEPEND) netlist.h + +netlist.o: netlist.cpp $(DEPEND) netlist.h + +netlist_control.o: netlist_control.cpp $(DEPEND) netlist.h + +netform.o: netform.cpp $(DEPEND) netlist.h + +erc.o: erc.cpp dialog_erc.h $(DEPEND) netlist.h + +dialog_erc.o: dialog_erc.cpp dialog_erc.h $(DEPEND) + +setpage.o: ../share/setpage.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +svg_print.o: ../share/svg_print.cpp ../share/svg_print.h $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +zoom.o: ../share/zoom.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +treeprj.o: ../share/treeprj.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +drawpanel.o: ../share/drawpanel.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +mdiframe.o: ../share/mdiframe.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +buildmnu.o: ../share/buildmnu.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +pinedit.o: pinedit.cpp pinedit-dialog.cpp pinedit-dialog.h $(DEPEND) + +tool_lib.o: tool_lib.cpp $(DEPEND) + +controle.o: controle.cpp $(DEPEND) ../include/eda_dde.h + +wxprint.o: ../share/wxprint.cpp ../share/dialog_print.cpp ../share/dialog_print.h $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +bus-wire-junction.o: bus-wire-junction.cpp $(DEPEND) + +drawframe.o: ../share/drawframe.cpp + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +eelibs_read_libraryfiles.o: eelibs_read_libraryfiles.cpp $(DEPEND) + +eelibs_draw_components.o: eelibs_draw_components.cpp $(DEPEND) + +eeload.o: eeload.cpp $(DEPEND) + +block.o: block.cpp $(DEPEND) + +block_libedit.o: block_libedit.cpp $(DEPEND) + +onrightclick.o: onrightclick.cpp $(DEPEND) + +libedit_undo_redo.o: libedit_undo_redo.cpp $(DEPEND) + +libedit_onrightclick.o: libedit_onrightclick.cpp $(DEPEND) + +libedit_onleftclick.o: libedit_onleftclick.cpp $(DEPEND) + +onleftclick.o: onleftclick.cpp $(DEPEND) + +eeredraw.o: eeredraw.cpp $(DEPEND) + +dialog_eeschema_config.o: dialog_eeschema_config.cpp dialog_eeschema_config.h $(DEPEND) + +libedit.o: libedit.cpp $(DEPEND) + +infospgm.o: ../share/infospgm.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + diff --git a/eeschema/makefile.macosx b/eeschema/makefile.macosx index 5b4215838c..9d0e18e24b 100644 --- a/eeschema/makefile.macosx +++ b/eeschema/makefile.macosx @@ -15,11 +15,12 @@ TARGET = eeschema CPPFLAGS = -Wall -O2 `wx-config --cxxflags` -all: $(TARGET) netlist_form_pads-pcb +all: $(TARGET) $(TARGET).app netlist_form_pads-pcb include makefile.include CPPFLAGS += $(EXTRACPPFLAGS) +CPPFLAGS += -arch i386 -arch ppc EDACPPFLAGS = $(CPPFLAGS) $(TARGET): $(OBJECTS) $(TARGET).r makefile.macosx makefile.include $(EXTRALIBS) ../libs.macosx @@ -27,12 +28,28 @@ $(TARGET): $(OBJECTS) $(TARGET).r makefile.macosx makefile.include $(EXTRALIBS) $(RESCOMP) -o $(TARGET) Carbon.r $(TARGET).r $(SETFILE) -a C $(TARGET) + +$(TARGET).app: $(OBJS) + rm -Rf $(TARGET).app + mkdir -p $(TARGET).app + mkdir -p $(TARGET).app/Contents + mkdir -p $(TARGET).app/Contents/MacOS + mkdir -p $(TARGET).app/Contents/Frameworks + mkdir -p $(TARGET).app/Contents/Resources + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/" \ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/wxmac.icns \ + >$(TARGET).app/Contents/Resources/wxmac.icns + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/"\ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/Info.plist.in \ + >$(TARGET).app/Contents/Info.plist + echo -n "APPL????" >$(TARGET).app/Contents/PkgInfo + ln -f $(TARGET) $(TARGET).app/Contents/MacOS/$(TARGET) netlist_form_pads-pcb: plugins/netlist_form_pads-pcb.cpp - gcc -Wall plugins/netlist_form_pads-pcb.cpp -o netlist_form_pads-pcb + gcc $(CXXFLAGS) -Wall plugins/netlist_form_pads-pcb.cpp -o netlist_form_pads-pcb -install: +install: $(TARGET) cp $(TARGET) $(KICAD_BIN) cp netlist_form_pads-pcb $(KICAD_BIN) diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 5406a9be4c..91ea30850c 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -39,6 +39,12 @@ wxMenuBar * menuBar = GetMenuBar(); item->SetBitmap(open_xpm); m_FilesMenu->Append(item); + item = new wxMenuItem(m_FilesMenu, ID_LOAD_ONE_SHEET, + _("&Reload the current sheet"), + _("Load or reload a schematic file from file into the current sheet") ); + item->SetBitmap(import_xpm); + m_FilesMenu->Append(item); + m_FilesMenu->AppendSeparator(); item = new wxMenuItem(m_FilesMenu,ID_SAVE_PROJECT, _("&Save Schematic Project"), diff --git a/eeschema/netlist.h b/eeschema/netlist.h index 3cb9de946b..3f3d3580df 100644 --- a/eeschema/netlist.h +++ b/eeschema/netlist.h @@ -90,7 +90,7 @@ public: bool m_PartsLocked; // For multi part components: True if the part cannot be changed int m_Unit; /* Numero de part */ int m_Sheet; /* Numero de hierarchie */ - int m_TimeStamp; /* Signature temporelle */ + unsigned long m_TimeStamp; /* Signature temporelle */ int m_IsNew; /* != 0 pour composants non annotes */ char m_TextValue[32]; /* Valeur */ char m_TextRef[32]; /* Reference ( hors numero ) */ diff --git a/eeschema/pinedit-dialog.cpp b/eeschema/pinedit-dialog.cpp index 16f32b0be0..a6471fb793 100644 --- a/eeschema/pinedit-dialog.cpp +++ b/eeschema/pinedit-dialog.cpp @@ -65,10 +65,10 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PinPropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_PinPropertiesFrame, wxDialog ) ////@begin WinEDA_PinPropertiesFrame event table entries - EVT_BUTTON( wxID_OK, WinEDA_PinPropertiesFrame::OnOkClick ) - EVT_BUTTON( wxID_CANCEL, WinEDA_PinPropertiesFrame::OnCancelClick ) + EVT_BUTTON( wxID_OK, WinEDA_PinPropertiesFrame::OnOkClick ) + ////@end WinEDA_PinPropertiesFrame event table entries END_EVENT_TABLE() @@ -100,14 +100,14 @@ int tmp, ii; if ( CurrentPin ) msg = CurrentPin->m_PinName; else msg = wxEmptyString; m_PinNameCtrl->SetValue(msg); - tmp = CurrentPin ? CurrentPin->m_SizeName : LastPinNameSize; + tmp = CurrentPin ? CurrentPin->m_PinNameSize : LastPinNameSize; msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); m_PinNameSizeCtrl->SetValue(msg); msg = m_PinNameSizeText->GetLabel() + ReturnUnitSymbol(); m_PinNameSizeText->SetLabel(msg); /* Init dialog pin num and pin num size values */ m_PinNumCtrl->SetValue(StringPinNum); - tmp = CurrentPin ? CurrentPin->m_SizeNum : LastPinNumSize; + tmp = CurrentPin ? CurrentPin->m_PinNumSize : LastPinNumSize; msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); m_PinNumSizeCtrl->SetValue(msg); msg = m_PinNumSizeText->GetLabel() + ReturnUnitSymbol(); @@ -202,8 +202,10 @@ bool WinEDA_PinPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const w wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } Centre(); ////@end WinEDA_PinPropertiesFrame creation return true; @@ -218,7 +220,7 @@ void WinEDA_PinPropertiesFrame::CreateControls() SetFont(*g_DialogFont); ////@begin WinEDA_PinPropertiesFrame content construction - // Generated by DialogBlocks, 23/02/2006 09:33:11 (unregistered) + // Generated by DialogBlocks, 20/02/2007 08:45:04 (unregistered) WinEDA_PinPropertiesFrame* itemDialog1 = this; @@ -244,6 +246,7 @@ void WinEDA_PinPropertiesFrame::CreateControls() wxStaticBox* itemStaticBoxSizer9Static = new wxStaticBox(itemDialog1, wxID_ANY, _(" Pin Options :")); wxStaticBoxSizer* itemStaticBoxSizer9 = new wxStaticBoxSizer(itemStaticBoxSizer9Static, wxVERTICAL); + itemStaticBoxSizer9Static->SetForegroundColour(wxColour(64, 0, 128)); itemBoxSizer3->Add(itemStaticBoxSizer9, 0, wxGROW|wxALL, 5); wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin lenght :"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -288,6 +291,8 @@ void WinEDA_PinPropertiesFrame::CreateControls() _("Down") }; m_PinOrient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Pin Orient:"), wxDefaultPosition, wxDefaultSize, 4, m_PinOrientStrings, 1, wxRA_SPECIFY_COLS ); + m_PinOrient->SetSelection(0); + m_PinOrient->SetForegroundColour(wxColour(41, 84, 84)); itemBoxSizer15->Add(m_PinOrient, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL); @@ -296,11 +301,13 @@ void WinEDA_PinPropertiesFrame::CreateControls() wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer22->Add(itemBoxSizer23, 0, wxGROW|wxALL, 5); - wxButton* itemButton24 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton24->SetDefault(); + wxButton* itemButton24 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton24->SetForegroundColour(wxColour(0, 0, 160)); itemBoxSizer23->Add(itemButton24, 0, wxGROW|wxALL, 5); - wxButton* itemButton25 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton25 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton25->SetDefault(); + itemButton25->SetForegroundColour(wxColour(198, 0, 0)); itemBoxSizer23->Add(itemButton25, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxHORIZONTAL); @@ -316,6 +323,8 @@ void WinEDA_PinPropertiesFrame::CreateControls() _("low out") }; m_PinShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Pin Shape:"), wxDefaultPosition, wxDefaultSize, 7, m_PinShapeStrings, 1, wxRA_SPECIFY_COLS ); + m_PinShape->SetSelection(0); + m_PinShape->SetForegroundColour(wxColour(0, 64, 0)); itemBoxSizer26->Add(m_PinShape, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxString m_PinElectricalTypeStrings[] = { @@ -331,6 +340,8 @@ void WinEDA_PinPropertiesFrame::CreateControls() _("Open emit") }; m_PinElectricalType = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Electrical Type:"), wxDefaultPosition, wxDefaultSize, 10, m_PinElectricalTypeStrings, 1, wxRA_SPECIFY_COLS ); + m_PinElectricalType->SetSelection(0); + m_PinElectricalType->SetForegroundColour(wxColour(68, 68, 34)); itemBoxSizer26->Add(m_PinElectricalType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); ////@end WinEDA_PinPropertiesFrame content construction diff --git a/eeschema/pinedit-dialog.h b/eeschema/pinedit-dialog.h index ea85d758cd..bb506c6956 100644 --- a/eeschema/pinedit-dialog.h +++ b/eeschema/pinedit-dialog.h @@ -1,26 +1,26 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pinedit-dialog.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 11/02/2006 13:30:59 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 11/02/2006 13:30:59 - -#ifndef _PINEDIT_DIALOG_H_ -#define _PINEDIT_DIALOG_H_ - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "pinedit-dialog.h" -#endif - -/*! - * Includes - */ +///////////////////////////////////////////////////////////////////////////// +// Name: pinedit-dialog.h +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 11/02/2006 13:30:59 +// RCS-ID: +// Copyright: License GNU +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 11/02/2006 13:30:59 + +#ifndef _PINEDIT_DIALOG_H_ +#define _PINEDIT_DIALOG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "pinedit-dialog.h" +#endif + +/*! + * Includes + */ #include "fctsys.h" #include "gr_basic.h" @@ -31,30 +31,25 @@ #include "id.h" #include "protos.h" - -////@begin includes + +////@begin includes #include "wx/spinctrl.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations class wxSpinCtrl; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers #define ID_DIALOG 10000 -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE _("Pin properties") -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION wxDefaultPosition #define ID_TEXTCTRL 10001 #define ID_TEXTCTRL1 10002 #define ID_SPINCTRL 10003 @@ -66,58 +61,63 @@ class wxSpinCtrl; #define ID_RADIOBOX 10009 #define ID_RADIOBOX1 10012 #define ID_RADIOBOX2 10013 -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_PinPropertiesFrame class declaration - */ - -class WinEDA_PinPropertiesFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_PinPropertiesFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_PinPropertiesFrame( ); - WinEDA_PinPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id = SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_PinPropertiesFrame event handler declarations +#define SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE _("Pin properties") +#define SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME ID_DIALOG +#define SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE wxSize(400, 300) +#define SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION wxDefaultPosition +////@end control identifiers - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - void OnOkClick( wxCommandEvent& event ); +/*! + * Compatibility + */ + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif + +/*! + * WinEDA_PinPropertiesFrame class declaration + */ + +class WinEDA_PinPropertiesFrame: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( WinEDA_PinPropertiesFrame ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + WinEDA_PinPropertiesFrame( ); + WinEDA_PinPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id = SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin WinEDA_PinPropertiesFrame event handler declarations /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL void OnCancelClick( wxCommandEvent& event ); -////@end WinEDA_PinPropertiesFrame event handler declarations - -////@begin WinEDA_PinPropertiesFrame member function declarations + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK + void OnOkClick( wxCommandEvent& event ); + +////@end WinEDA_PinPropertiesFrame event handler declarations + +////@begin WinEDA_PinPropertiesFrame member function declarations /// Retrieves bitmap resources wxBitmap GetBitmapResource( const wxString& name ); /// Retrieves icon resources wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_PinPropertiesFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - +////@end WinEDA_PinPropertiesFrame member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + void PinPropertiesAccept(wxCommandEvent& event); void SetPinName(const wxString & newname, int newsize); void SetPinNum(const wxString & newnum, int newsize); @@ -127,7 +127,7 @@ public: void SetPinOrient(int neworient); void SetAttributsPin(bool draw, bool unit, bool convert); -////@begin WinEDA_PinPropertiesFrame member variables +////@begin WinEDA_PinPropertiesFrame member variables wxTextCtrl* m_PinNameCtrl; wxTextCtrl* m_PinNumCtrl; wxSpinCtrl* m_PinSize; @@ -141,10 +141,10 @@ public: wxRadioBox* m_PinOrient; wxRadioBox* m_PinShape; wxRadioBox* m_PinElectricalType; -////@end WinEDA_PinPropertiesFrame member variables +////@end WinEDA_PinPropertiesFrame member variables WinEDA_LibeditFrame * m_Parent; -}; - -#endif - // _PINEDIT_DIALOG_H_ +}; + +#endif + // _PINEDIT_DIALOG_H_ diff --git a/eeschema/pinedit-dialog.pjd b/eeschema/pinedit-dialog.pjd index 86f0c6eb72..6bacd16c17 100644 --- a/eeschema/pinedit-dialog.pjd +++ b/eeschema/pinedit-dialog.pjd @@ -18,6 +18,7 @@ "License GNU" "" 0 + 0 "<All platforms>" "<Any>" "///////////////////////////////////////////////////////////////////////////// @@ -95,9 +96,17 @@ "<System>" "<System>" "" + 0 + 0 + 4 + " " + "" 0 + 0 + 1 1 1 + 1 @@ -237,7 +246,9 @@ 0 0 0 - 0 + 0 + 0 + 0 0 0 1 @@ -307,6 +318,7 @@ "wxStaticText" "" "Pin Name :" + -1 "" "" "" @@ -328,6 +340,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -396,6 +410,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -431,6 +447,7 @@ "wxStaticText" "" "Pin Num :" + -1 "" "" "" @@ -452,6 +469,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -520,6 +539,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -580,7 +601,7 @@ "-1" " Pin Options :" "" - "" + "400080" "" 0 1 @@ -614,6 +635,7 @@ "wxStaticText" "" "Pin lenght :" + -1 "" "" "" @@ -635,6 +657,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -691,6 +715,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -742,6 +768,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -793,6 +821,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -844,6 +874,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -906,6 +938,7 @@ "wxStaticText" "m_PinNameSizeText" "Size" + -1 "" "" "" @@ -927,6 +960,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -995,6 +1030,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -1030,6 +1067,7 @@ "wxStaticText" "m_PinNumSizeText" "Size" + -1 "" "" "" @@ -1051,6 +1089,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -1119,6 +1159,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -1181,10 +1223,12 @@ "m_PinOrient" "Pin Orient:" 1 + "Right|Left|Up|Down" + 0 "" "" "" - "" + "295454" "" 0 1 @@ -1193,8 +1237,9 @@ "" 0 1 - "Right|Left|Up|Down" 0 + 0 + 0 "" -1 -1 @@ -1266,7 +1311,7 @@ 0 "<Any platform>" - "wxButton: wxID_OK" + "wxButton: wxID_CANCEL" "dialog-control-document" "" "dialogcontrol" @@ -1274,19 +1319,19 @@ 1 0 0 - "11/5/2006" + "20/2/2007" "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick" - "wxID_OK" - 5100 + "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick" + "wxID_CANCEL" + 5101 "wxButton" "" - "&OK" - 1 + "&Cancel" + 0 "" "" "" - "" + "0000A0" "" 0 1 @@ -1298,6 +1343,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -1318,7 +1365,7 @@ "" - "wxButton: wxID_CANCEL" + "wxButton: wxID_OK" "dialog-control-document" "" "dialogcontrol" @@ -1328,17 +1375,17 @@ 0 "11/5/2006" "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick" - "wxID_CANCEL" - 5101 + "wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick" + "wxID_OK" + 5100 "wxButton" "" - "&Cancel" - 0 + "&OK" + 1 "" "" "" - "" + "C60000" "" 0 1 @@ -1350,6 +1397,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -1412,10 +1461,12 @@ "m_PinShape" "Pin Shape:" 1 + "line|invert|clock|clock inv|low in|low clock|low out" + 0 "" "" "" - "" + "004000" "" 0 1 @@ -1424,8 +1475,9 @@ "" 0 1 - "line|invert|clock|clock inv|low in|low clock|low out" 0 + 0 + 0 "" -1 -1 @@ -1462,10 +1514,12 @@ "m_PinElectricalType" "Electrical Type:" 1 + "Input|Output|Bidi|3 States|Passive|Unspecified|Power In|Power Out|Open coll|Open emit" + 0 "" "" "" - "" + "444422" "" 0 1 @@ -1474,8 +1528,9 @@ "" 0 1 - "Input|Output|Bidi|3 States|Passive|Unspecified|Power In|Power Out|Open coll|Open emit" 0 + 0 + 0 "" -1 -1 diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 01a2a632a4..60b1da97a1 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -394,7 +394,7 @@ wxString buf; buf = newname; buf.Replace( wxT(" "), wxT("_")); - if ( newsize >= 0 ) CurrentPin->m_SizeName = newsize; + if ( newsize >= 0 ) CurrentPin->m_PinNameSize = newsize; CurrentPin->m_PinName = buf; @@ -406,7 +406,7 @@ wxString buf; { if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; - if (newsize >= 0 ) Pin->m_SizeName = newsize; + if (newsize >= 0 ) Pin->m_PinNameSize = newsize; Pin->m_PinName = buf; } } @@ -432,7 +432,7 @@ wxString buf; CurrentPin->m_PinNum = 0; - if ( newsize >= 0) CurrentPin->m_SizeNum = newsize; + if ( newsize >= 0) CurrentPin->m_PinNumSize = newsize; CurrentPin->SetPinNumFromString(buf); m_Parent->GetScreen()->SetModify(); @@ -442,7 +442,7 @@ wxString buf; if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; if( Pin->m_Unit != CurrentPin->m_Unit ) continue; - if ( newsize >= 0) Pin->m_SizeNum = newsize; + if ( newsize >= 0) Pin->m_PinNumSize = newsize; if ( newnum ) Pin->m_PinNum = CurrentPin->m_PinNum; } } @@ -520,8 +520,8 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; CurrentPin->m_Orient = LastPinOrient; CurrentPin->m_PinType = LastPinType; CurrentPin->m_PinShape = LastPinShape; - CurrentPin->m_SizeName = LastPinNameSize; - CurrentPin->m_SizeNum = LastPinNumSize; + CurrentPin->m_PinNameSize = LastPinNameSize; + CurrentPin->m_PinNumSize = LastPinNumSize; if ( LastPinCommonConvert ) CurrentPin->m_Convert = 0; else CurrentPin->m_Convert = CurrentConvert; if ( LastPinCommonUnit ) CurrentPin->m_Unit = 0; @@ -762,11 +762,11 @@ bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0; switch ( id ) { case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: - Pin->m_SizeNum = MasterPin->m_SizeNum; + Pin->m_PinNumSize = MasterPin->m_PinNumSize; break; case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: - Pin->m_SizeName = MasterPin->m_SizeName; + Pin->m_PinNameSize = MasterPin->m_PinNameSize; break; case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: diff --git a/eeschema/plot.cpp b/eeschema/plot.cpp index 26b7c888df..c688512a75 100644 --- a/eeschema/plot.cpp +++ b/eeschema/plot.cpp @@ -55,10 +55,24 @@ void Move_Plume( wxPoint pos, int plume ) } } +void SetCurrentLineWidth( int width) +{ + switch ( g_PlotFormat ) + { + case PLOT_FORMAT_HPGL: + break; -/***************************************************************/ -void PlotArc(wxPoint centre, int StAngle, int EndAngle, int rayon) -/***************************************************************/ + case PLOT_FORMAT_POST: + case PLOT_FORMAT_POST_A4: + SetCurrentLineWidthPS(width); + break; + } +} + + +/*******************************************************************************/ +void PlotArc(wxPoint centre, int StAngle, int EndAngle, int rayon, int width) +/*******************************************************************************/ /* trace d'un arc de cercle: x, y = coord du centre StAngle, EndAngle = angle de debut et fin @@ -68,33 +82,33 @@ void PlotArc(wxPoint centre, int StAngle, int EndAngle, int rayon) switch ( g_PlotFormat ) { case PLOT_FORMAT_HPGL: - PlotArcHPGL(centre, StAngle, EndAngle, rayon); + PlotArcHPGL(centre, StAngle, EndAngle, rayon, width); break; case PLOT_FORMAT_POST: - PlotArcPS(centre, StAngle, EndAngle, rayon); + PlotArcPS(centre, StAngle, EndAngle, rayon, width); break; } } -/**************************************************/ -void PlotCercle( wxPoint pos,int diametre ) -/**************************************************/ +/*******************************************************/ +void PlotCercle( wxPoint pos,int diametre, int width ) +/*******************************************************/ { switch ( g_PlotFormat ) - { + { case PLOT_FORMAT_HPGL: - PlotCircle_HPGL( pos, diametre); + PlotCircle_HPGL( pos, diametre, width); break; case PLOT_FORMAT_POST: - PlotCircle_PS(pos, diametre); + PlotCircle_PS(pos, diametre, width); break; - } + } } -/****************************************************/ -static void PlotPoly( int nb, int * coord, int fill) -/****************************************************/ +/******************************************************************/ +void PlotPoly( int nb, int * coord, int fill, int width) +/******************************************************************/ /* Trace un polygone ferme coord = tableau des coord des sommets nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau ) @@ -106,11 +120,11 @@ static void PlotPoly( int nb, int * coord, int fill) switch ( g_PlotFormat ) { case PLOT_FORMAT_HPGL: - PlotPolyHPGL( nb, coord, fill); + PlotPolyHPGL( nb, coord, fill, width); break; case PLOT_FORMAT_POST: - PlotPolyPS( nb, coord, fill); + PlotPolyPS( nb, coord, fill, width); break; } } @@ -128,6 +142,7 @@ int pX, pY; pX = Struct->m_Pos.x; pY = Struct->m_Pos.y; + SetCurrentLineWidth(-1); Move_Plume(wxPoint(pX - DELTA, pY - DELTA), 'U'); Move_Plume(wxPoint(pX + DELTA, pY + DELTA), 'D'); Move_Plume(wxPoint(pX + DELTA, pY - DELTA), 'U'); @@ -164,6 +179,7 @@ wxPoint pos; Plume('U'); if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) SetColorMapPS ( ReturnLayerColor(LAYER_DEVICE) ); + switch (DEntry->m_StructType) { case COMPONENT_ARC_DRAW_TYPE: @@ -175,7 +191,7 @@ wxPoint pos; pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x + TransMat[1][1] * Arc->m_Pos.y; MapAngles(&t1, &t2, TransMat); - PlotArc(pos, t1, t2, Arc->m_Rayon); + PlotArc(pos, t1, t2, Arc->m_Rayon, Arc->m_Width); } break; @@ -186,7 +202,7 @@ wxPoint pos; TransMat[0][1] * Circle->m_Pos.y; pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x + TransMat[1][1] * Circle->m_Pos.y; - PlotCercle(pos, Circle->m_Rayon * 2); + PlotCercle(pos, Circle->m_Rayon * 2, Circle->m_Width); } break; @@ -200,6 +216,7 @@ wxPoint pos; + TransMat[0][1] * Text->m_Pos.y; pos.y = PartY + TransMat[1][0] * Text->m_Pos.x + TransMat[1][1] * Text->m_Pos.y; + SetCurrentLineWidth(-1); PlotGraphicText(g_PlotFormat, pos , CharColor, Text->m_Text, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, @@ -211,15 +228,16 @@ wxPoint pos; case COMPONENT_RECT_DRAW_TYPE: { LibDrawSquare * Square = (LibDrawSquare *) DEntry; - x1 = PartX + TransMat[0][0] * Square->m_Start.x - + TransMat[0][1] * Square->m_Start.y; - y1 = PartY + TransMat[1][0] * Square->m_Start.x - + TransMat[1][1] * Square->m_Start.y; + x1 = PartX + TransMat[0][0] * Square->m_Pos.x + + TransMat[0][1] * Square->m_Pos.y; + y1 = PartY + TransMat[1][0] * Square->m_Pos.x + + TransMat[1][1] * Square->m_Pos.y; x2 = PartX + TransMat[0][0] * Square->m_End.x + TransMat[0][1] * Square->m_End.y; y2 = PartY + TransMat[1][0] * Square->m_End.x + TransMat[1][1] * Square->m_End.y; + SetCurrentLineWidth(Square->m_Width); Move_Plume(wxPoint(x1, y1), 'U'); Move_Plume(wxPoint(x1, y2), 'D'); Move_Plume(wxPoint(x2, y2), 'D'); @@ -246,6 +264,7 @@ wxPoint pos; + TransMat[1][1] * Pin->m_Pos.y; /* Dessin de la pin et du symbole special associe */ + SetCurrentLineWidth(-1); PlotPinSymbol(x2, y2, Pin->m_PinLen, orient, Pin->m_PinShape); wxPoint pinpos(x2, y2); Pin->PlotPinTexts(pinpos, orient, @@ -267,7 +286,7 @@ wxPoint pos; TransMat[1][0] * polyline->PolyList[ii * 2] + TransMat[1][1] * polyline->PolyList[ii * 2 + 1]; } - PlotPoly(ii, Poly, polyline->m_Fill); + PlotPoly(ii, Poly, polyline->m_Fill, polyline->m_Width); MyFree(Poly); } break; @@ -356,6 +375,8 @@ int orient, color = -1; vjustify = - vjustify; } + SetCurrentLineWidth(-1); + if( !IsMulti || (FieldNumber != REFERENCE) ) { PlotGraphicText( g_PlotFormat, wxPoint(px, py), color, Field->m_Text, @@ -390,6 +411,8 @@ int color; if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) SetColorMapPS ( color ); + SetCurrentLineWidth(-1); + MapX1 = MapY1 = 0; x1 = posX; y1 = posY; switch ( orient ) { @@ -411,7 +434,7 @@ int color; { PlotCercle( wxPoint(MapX1 * INVERT_PIN_RADIUS + x1, MapY1 * INVERT_PIN_RADIUS + y1), - INVERT_PIN_RADIUS * 2 ); + INVERT_PIN_RADIUS * 2); Move_Plume( wxPoint(MapX1 * INVERT_PIN_RADIUS * 2 + x1, MapY1 * INVERT_PIN_RADIUS * 2 + y1), 'U' ); @@ -514,6 +537,8 @@ int HalfSize; if(Size.x == 0 ) Size = wxSize(DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT); + SetCurrentLineWidth(-1); + switch(Orient) { case 0: /* Orientation horiz normale */ @@ -587,7 +612,7 @@ static void PlotSheetLabelStruct(DrawSheetLabelStruct *Struct) { int side, txtcolor = -1; int posx , tposx, posy, size, size2; -int coord[12]; +int coord[16]; if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) txtcolor = ReturnLayerColor(Struct->m_Layer); @@ -617,7 +642,8 @@ int coord[12]; coord[6] = posx + size; coord[7] = posy; coord[8] = posx + size2; coord[9] = posy + size2; coord[10] = posx ; coord[11] = posy + size2; - PlotPoly(6, coord, FILL); + coord[12] = posx; coord[13] = posy; + PlotPoly(7, coord, NOFILL); break; case 1: /* output <| */ @@ -625,7 +651,8 @@ int coord[12]; coord[4] = posx + size; coord[5] = posy - size2; coord[6] = posx + size; coord[7] = posy + size2; coord[8] = posx + size2; coord[9] = posy + size2; - PlotPoly(5, coord, FILL); + coord[10] = posx; coord[11] = posy; + PlotPoly(6, coord, NOFILL); break; case 2: /* bidi <> */ @@ -633,7 +660,8 @@ int coord[12]; coord[2] = posx + size2; coord[3] = posy - size2; coord[4] = posx + size; coord[5] = posy; coord[6] = posx + size2; coord[7] = posy +size2; - PlotPoly(4, coord, FILL); + coord[8] = posx; coord[9] = posy; + PlotPoly(5, coord, NOFILL); break; default: /* unsp []*/ @@ -641,7 +669,8 @@ int coord[12]; coord[4] = posx + size; coord[5] = posy - size2; coord[6] = posx + size; coord[7] = posy + size2; coord[8] = posx ; coord[9] = posy + size2; - PlotPoly(5, coord, NOFILL); + coord[10] = posx; coord[11] = posy; + PlotPoly(6, coord, NOFILL); break; } } @@ -659,6 +688,9 @@ wxPoint pos; if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) SetColorMapPS ( ReturnLayerColor(Struct->m_Layer) ); + + SetCurrentLineWidth(-1); + Move_Plume(Struct->m_Pos, 'U'); pos = Struct->m_Pos; pos.x += Struct->m_Size.x; Move_Plume(pos,'D'); diff --git a/eeschema/plothpgl.cpp b/eeschema/plothpgl.cpp index 07055398af..48958a0c67 100644 --- a/eeschema/plothpgl.cpp +++ b/eeschema/plothpgl.cpp @@ -498,13 +498,13 @@ int margin; g_PlotFormat = PLOT_FORMAT_HPGL; - screen = ActiveScreen; - if ( Select_PlotAll == TRUE ) - { - screen = ScreenSch; - } - while( screen ) - { + /* Build the screen list */ + EDA_ScreenList ScreenList(NULL); + + if ( Select_PlotAll == TRUE ) screen = screen = ScreenList.GetFirst(); + else screen = ActiveScreen; + for ( ; screen != NULL; screen = ScreenList.GetNext() ) + { ReturnSheetDims(screen, SheetSize, SheetOffset); /* Calcul des echelles de conversion */ g_PlotScaleX = Scale_X * SCALE_HPGL ; @@ -531,7 +531,7 @@ int margin; InitPlotParametresHPGL(PlotOffset, g_PlotScaleX, g_PlotScaleY); Plot_1_Page_HPGL(PlotFileName,screen); screen = (BASE_SCREEN*)screen->Pnext; - if ( Select_PlotAll == FALSE ) screen = NULL; + if ( Select_PlotAll == FALSE ) break; } m_MsgBox->AppendText(_("** Plot End **\n")); diff --git a/eeschema/plotps.cpp b/eeschema/plotps.cpp index 37f9db418d..0d33b0b071 100644 --- a/eeschema/plotps.cpp +++ b/eeschema/plotps.cpp @@ -1,158 +1,160 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: plotps.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 01/02/2006 08:37:24 -// RCS-ID: -// Copyright: GNU License -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24 - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "plotps.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 -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" -#include "worksheet.h" -#include "plot_common.h" -#include "protos.h" - - -/* coeff de conversion dim en 1 mil -> dim en unite PS: */ -#define SCALE_PS 0.001 - -extern void Move_Plume( wxPoint pos, int plume ); -extern void Plume( int plume ); - -enum PageFormatReq { - PAGE_SIZE_AUTO, - PAGE_SIZE_A4, - PAGE_SIZE_A -}; - - -/* Variables locales : */ -static int s_DefaultPenWidth = 6; /* default pen width for drawings in 1/1000 inch */ -static int PS_SizeSelect = PAGE_SIZE_AUTO; -extern FILE * PlotOutput; -static bool Plot_Sheet_Ref = TRUE; - - -////@begin includes -////@end includes - -#include "plotps.h" - -////@begin XPM images -////@end XPM images - - -/***********************************************************/ -void WinEDA_SchematicFrame::ToPlot_PS(wxCommandEvent& event) -/***********************************************************/ -/* fonction relai de creation de la frame de dialogue pour trace Postscript -*/ -{ -wxPoint pos; - - pos = GetPosition(); - pos.x += 10; pos.y += 20; - WinEDA_PlotPSFrame * Ps_frame = new WinEDA_PlotPSFrame(this); - Ps_frame->ShowModal(); Ps_frame->Destroy(); -} - - - -/*! - * WinEDA_PlotPSFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotPSFrame, wxDialog ) - -/*! - * WinEDA_PlotPSFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_PlotPSFrame, wxDialog ) - -////@begin WinEDA_PlotPSFrame event table entries +///////////////////////////////////////////////////////////////////////////// +// Name: plotps.cpp +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 01/02/2006 08:37:24 +// RCS-ID: +// Copyright: GNU License +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24 + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "plotps.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 +#include "fctsys.h" +#include "gr_basic.h" + +#include "common.h" +#include "program.h" +#include "libcmp.h" +#include "general.h" +#include "worksheet.h" +#include "plot_common.h" +#include "protos.h" + + +/* coeff de conversion dim en 1 mil -> dim en unite PS: */ +#define SCALE_PS 0.001 + +extern void Move_Plume( wxPoint pos, int plume ); +extern void Plume( int plume ); + +enum PageFormatReq { + PAGE_SIZE_AUTO, + PAGE_SIZE_A4, + PAGE_SIZE_A +}; + + +/* Variables locales : */ +static int PS_SizeSelect = PAGE_SIZE_AUTO; +extern FILE * PlotOutput; +static bool Plot_Sheet_Ref = TRUE; + + +////@begin includes +////@end includes + +#include "plotps.h" + +////@begin XPM images +////@end XPM images + + +/***********************************************************/ +void WinEDA_SchematicFrame::ToPlot_PS(wxCommandEvent& event) +/***********************************************************/ +/* fonction relai de creation de la frame de dialogue pour trace Postscript +*/ +{ +wxPoint pos; + + pos = GetPosition(); + pos.x += 10; pos.y += 20; + WinEDA_PlotPSFrame * Ps_frame = new WinEDA_PlotPSFrame(this); + Ps_frame->ShowModal(); Ps_frame->Destroy(); +} + + + +/*! + * WinEDA_PlotPSFrame type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotPSFrame, wxDialog ) + +/*! + * WinEDA_PlotPSFrame event table definition + */ + +BEGIN_EVENT_TABLE( WinEDA_PlotPSFrame, wxDialog ) + +////@begin WinEDA_PlotPSFrame event table entries EVT_BUTTON( ID_PLOT_PS_CURRENT_EXECUTE, WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick ) EVT_BUTTON( ID_PLOT_PS_ALL_EXECUTE, WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick ) EVT_BUTTON( wxID_CLOSE, WinEDA_PlotPSFrame::OnCloseClick ) -////@end WinEDA_PlotPSFrame event table entries - -END_EVENT_TABLE() - -/*! - * WinEDA_PlotPSFrame constructors - */ - -WinEDA_PlotPSFrame::WinEDA_PlotPSFrame( ) -{ -} - -WinEDA_PlotPSFrame::WinEDA_PlotPSFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - Create(parent, id, caption, pos, size, style); -} - -/*! - * WinEDA_PlotPSFrame creator - */ - -bool WinEDA_PlotPSFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin WinEDA_PlotPSFrame member initialisation +////@end WinEDA_PlotPSFrame event table entries + +END_EVENT_TABLE() + +/*! + * WinEDA_PlotPSFrame constructors + */ + +WinEDA_PlotPSFrame::WinEDA_PlotPSFrame( ) +{ +} + +WinEDA_PlotPSFrame::WinEDA_PlotPSFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ + Create(parent, id, caption, pos, size, style); +} + +/*! + * WinEDA_PlotPSFrame creator + */ + +bool WinEDA_PlotPSFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin WinEDA_PlotPSFrame member initialisation m_SizeOption = NULL; m_PlotPSColorOption = NULL; m_Plot_Sheet_Ref = NULL; + m_DefaultLineSizeCtrlSizer = NULL; m_MsgBox = NULL; -////@end WinEDA_PlotPSFrame member initialisation - -////@begin WinEDA_PlotPSFrame creation +////@end WinEDA_PlotPSFrame member initialisation + +////@begin WinEDA_PlotPSFrame creation SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } Centre(); -////@end WinEDA_PlotPSFrame creation - return true; -} - -/*! - * Control creation for WinEDA_PlotPSFrame - */ - -void WinEDA_PlotPSFrame::CreateControls() -{ - SetFont(*g_DialogFont); - -////@begin WinEDA_PlotPSFrame content construction - // Generated by DialogBlocks, 04/02/2006 17:30:50 (unregistered) +////@end WinEDA_PlotPSFrame creation + return true; +} + +/*! + * Control creation for WinEDA_PlotPSFrame + */ + +void WinEDA_PlotPSFrame::CreateControls() +{ + SetFont(*g_DialogFont); + +////@begin WinEDA_PlotPSFrame content construction + // Generated by DialogBlocks, 22/01/2007 11:32:43 (unregistered) WinEDA_PlotPSFrame* itemDialog1 = this; @@ -168,40 +170,49 @@ void WinEDA_PlotPSFrame::CreateControls() _("Page Size A") }; m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, 3, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); - itemBoxSizer3->Add(m_SizeOption, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_SizeOption->SetSelection(0); + itemBoxSizer3->Add(m_SizeOption, 0, wxGROW|wxALL, 5); itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticBox* itemStaticBoxSizer6Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Plot Options:")); + wxStaticBoxSizer* itemStaticBoxSizer6 = new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxVERTICAL); + itemBoxSizer3->Add(itemStaticBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxString m_PlotPSColorOptionStrings[] = { _("B/W"), _("Color") }; m_PlotPSColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot Color:"), wxDefaultPosition, wxDefaultSize, 2, m_PlotPSColorOptionStrings, 1, wxRA_SPECIFY_COLS ); - itemBoxSizer3->Add(m_PlotPSColorOption, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxButton* itemButton9 = new wxButton( itemDialog1, ID_PLOT_PS_CURRENT_EXECUTE, _("&Plot CURRENT"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton9->SetForegroundColour(wxColour(0, 128, 0)); - itemBoxSizer8->Add(itemButton9, 0, wxGROW|wxALL, 5); - - wxButton* itemButton10 = new wxButton( itemDialog1, ID_PLOT_PS_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton10->SetForegroundColour(wxColour(179, 0, 0)); - itemBoxSizer8->Add(itemButton10, 0, wxGROW|wxALL, 5); - - wxButton* itemButton11 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton11->SetForegroundColour(wxColour(0, 0, 255)); - itemBoxSizer8->Add(itemButton11, 0, wxGROW|wxALL, 5); + m_PlotPSColorOption->SetSelection(0); + itemStaticBoxSizer6->Add(m_PlotPSColorOption, 0, wxGROW|wxALL, 5); m_Plot_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Plot_Sheet_Ref->SetValue(false); - itemBoxSizer2->Add(m_Plot_Sheet_Ref, 0, wxALIGN_LEFT|wxALL, 5); + itemStaticBoxSizer6->Add(m_Plot_Sheet_Ref, 0, wxGROW|wxALL, 5); - wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer2->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxButton* itemButton11 = new wxButton( itemDialog1, ID_PLOT_PS_CURRENT_EXECUTE, _("&Plot CURRENT"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton11->SetForegroundColour(wxColour(0, 128, 0)); + itemBoxSizer10->Add(itemButton11, 0, wxGROW|wxALL, 5); + + wxButton* itemButton12 = new wxButton( itemDialog1, ID_PLOT_PS_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton12->SetForegroundColour(wxColour(179, 0, 0)); + itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5); + + wxButton* itemButton13 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton13->SetForegroundColour(wxColour(0, 0, 255)); + itemBoxSizer10->Add(itemButton13, 0, wxGROW|wxALL, 5); + + m_DefaultLineSizeCtrlSizer = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(m_DefaultLineSizeCtrlSizer, 0, wxGROW|wxALL, 5); + + wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE ); itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5); @@ -210,81 +221,85 @@ void WinEDA_PlotPSFrame::CreateControls() m_SizeOption->SetValidator( wxGenericValidator(& PS_SizeSelect) ); m_PlotPSColorOption->SetValidator( wxGenericValidator(& g_PlotPSColorOpt) ); m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) ); -////@end WinEDA_PlotPSFrame content construction -} - -/*! - * Should we show tooltips? - */ - -bool WinEDA_PlotPSFrame::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_PlotPSFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_PlotPSFrame bitmap retrieval +////@end WinEDA_PlotPSFrame content construction + + m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl(this, _("Default Line Width"), g_PlotPSMinimunLineWidth, + g_UnitMetric, m_DefaultLineSizeCtrlSizer, EESCHEMA_INTERNAL_UNIT ); + +} + +/*! + * Should we show tooltips? + */ + +bool WinEDA_PlotPSFrame::ShowToolTips() +{ + return true; +} + +/*! + * Get bitmap resources + */ + +wxBitmap WinEDA_PlotPSFrame::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin WinEDA_PlotPSFrame bitmap retrieval wxUnusedVar(name); return wxNullBitmap; -////@end WinEDA_PlotPSFrame bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon WinEDA_PlotPSFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_PlotPSFrame icon retrieval +////@end WinEDA_PlotPSFrame bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon WinEDA_PlotPSFrame::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin WinEDA_PlotPSFrame icon retrieval wxUnusedVar(name); return wxNullIcon; -////@end WinEDA_PlotPSFrame icon retrieval -} -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON - */ - -void WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick( wxCommandEvent& event ) -{ -int Select_PlotAll = FALSE; - - InitOptVars(); - CreatePSFile(Select_PlotAll, PS_SizeSelect); - m_MsgBox->AppendText( wxT("*****\n")); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 - */ - -void WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick( wxCommandEvent& event ) -{ -int Select_PlotAll = TRUE; - - InitOptVars(); - CreatePSFile(Select_PlotAll, PS_SizeSelect); - m_MsgBox->AppendText( wxT("*****\n")); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE - */ - -void WinEDA_PlotPSFrame::OnCloseClick( wxCommandEvent& event ) +////@end WinEDA_PlotPSFrame icon retrieval +} +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON + */ + +void WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick( wxCommandEvent& event ) { - InitOptVars(); - Close(TRUE); -} - +int Select_PlotAll = FALSE; + + InitOptVars(); + CreatePSFile(Select_PlotAll, PS_SizeSelect); + m_MsgBox->AppendText( wxT("*****\n")); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 + */ + +void WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick( wxCommandEvent& event ) +{ +int Select_PlotAll = TRUE; + + InitOptVars(); + CreatePSFile(Select_PlotAll, PS_SizeSelect); + m_MsgBox->AppendText( wxT("*****\n")); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE + */ + +void WinEDA_PlotPSFrame::OnCloseClick( wxCommandEvent& event ) +{ + InitOptVars(); + Close(TRUE); +} + /*****************************************/ void WinEDA_PlotPSFrame::InitOptVars(void) @@ -293,211 +308,207 @@ void WinEDA_PlotPSFrame::InitOptVars(void) Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue(); g_PlotPSColorOpt = m_PlotPSColorOption->GetSelection(); PS_SizeSelect = m_SizeOption->GetSelection(); -} - - -/*************************************************************/ -void WinEDA_PlotPSFrame::CreatePSFile(int AllPages, int pagesize) -/*************************************************************/ -{ -wxString PlotFileName, ShortFileName; -BASE_SCREEN *screen; -Ki_PageDescr * PlotSheet, * RealSheet; -int BBox[4]; -wxPoint plot_offset; - - g_PlotFormat = PLOT_FORMAT_POST; - - screen = ActiveScreen; - if ( AllPages == TRUE ) - { - screen = ScreenSch; - } - while( screen ) - { - PlotSheet = screen->m_CurrentSheet; - RealSheet = &g_Sheet_A4; - if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet; - else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A; - - /* Calcul des limites de trace en 1/1000 pouce */ - BBox[0] = BBox[1] = g_PlotMargin; // Plot margin in 1/1000 inch - BBox[2] = RealSheet->m_Size.x - g_PlotMargin; - BBox[3] = RealSheet->m_Size.y - g_PlotMargin; - - /* Calcul des echelles de conversion */ - g_PlotScaleX = SCALE_PS * - (float) (BBox[2] - BBox[0]) / - PlotSheet->m_Size.x; - g_PlotScaleY = SCALE_PS * - (float) (BBox[3] - BBox[1]) / - PlotSheet->m_Size.y; - - plot_offset.x = 0; - plot_offset.y = PlotSheet->m_Size.y; - - wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL, - &ShortFileName, (wxString*) NULL); - wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; - if( ! ShortFileName.IsEmpty() ) - PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".ps")); - else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".ps")); - - PlotOneSheetPS(PlotFileName,screen, RealSheet, BBox, plot_offset); - screen = (BASE_SCREEN*)screen->Pnext; - if (AllPages == FALSE ) screen = NULL; - } -} - - -/**********************************************************/ -void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName, - BASE_SCREEN * screen, Ki_PageDescr * sheet, int BBox[4], wxPoint plot_offset) -/**********************************************************/ -/* Trace en format PS. d'une feuille de dessin -*/ -{ -wxString Line; -EDA_BaseStruct *DrawList; -EDA_SchComponentStruct *DrawLibItem; -int x1=0, y1=0, x2=0, y2=0, layer; - - PlotOutput = wxFopen(FileName, wxT("wt")); - if (PlotOutput == NULL) - { - Line = wxT("\n** "); - Line += _("Unable to create ") + FileName + wxT(" **\n\n"); - m_MsgBox->AppendText(Line); - wxBell(); - return ; - } - - Line.Printf(_("Plot: %s\n"), FileName.GetData()) ; - m_MsgBox->AppendText(Line); - - InitPlotParametresPS(plot_offset, sheet, g_PlotScaleX, g_PlotScaleY); - SetDefaultLineWidthPS( s_DefaultPenWidth); - - /* Init : */ - PrintHeaderPS(PlotOutput, wxT("EESchema-PS"), FileName, BBox); - InitPlotParametresPS(plot_offset, sheet, 1.0, 1.0); - - if ( m_Plot_Sheet_Ref->GetValue() ) - { - if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) - SetColorMapPS ( BLACK ); - PlotWorkSheet(PLOT_FORMAT_POST, screen); - } - - DrawList = screen->EEDrawList; - while ( DrawList ) /* tracage */ - { - Plume('U'); - layer = LAYER_NOTES; - switch( DrawList->m_StructType ) - { - case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */ - #undef STRUCT - #define STRUCT ((DrawBusEntryStruct*)DrawList) - x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; - x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y; - layer = STRUCT->m_Layer; - case DRAW_SEGMENT_STRUCT_TYPE : - #undef STRUCT - #define STRUCT ((EDA_DrawLineStruct*)DrawList) - if ( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE) - { - x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; - x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; - layer = STRUCT->m_Layer; - } - if ( g_PlotPSColorOpt ) - SetColorMapPS ( ReturnLayerColor(layer) ); - switch (layer) - { - case LAYER_NOTES: /* Trace en pointilles */ - fprintf(PlotOutput,"[50 50] 0 setdash\n"); - Move_Plume( wxPoint(x1,y1), 'U'); - Move_Plume( wxPoint(x2,y2), 'D'); - fprintf(PlotOutput,"[] 0 setdash\n"); - break; - - case LAYER_BUS: /* Trait large */ - { - fprintf(PlotOutput,"%d setlinewidth\n", s_DefaultPenWidth * 3); - Move_Plume( wxPoint(x1,y1),'U'); - Move_Plume( wxPoint(x2,y2),'D'); - fprintf(PlotOutput,"%d setlinewidth\n", s_DefaultPenWidth); - } - break; - - default: - Move_Plume( wxPoint(x1,y1),'U'); - Move_Plume( wxPoint(x2,y2),'D'); - break; - } - break; - - case DRAW_JUNCTION_STRUCT_TYPE : - #undef STRUCT - #define STRUCT ((DrawJunctionStruct*)DrawList) - if ( g_PlotPSColorOpt ) - SetColorMapPS (ReturnLayerColor(STRUCT->m_Layer) ); - PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE); - break; - - case DRAW_TEXT_STRUCT_TYPE : - case DRAW_LABEL_STRUCT_TYPE : - case DRAW_GLOBAL_LABEL_STRUCT_TYPE : - PlotTextStruct(DrawList); - break; - - case DRAW_LIB_ITEM_STRUCT_TYPE : - DrawLibItem = (EDA_SchComponentStruct *) DrawList; - PlotLibPart( DrawLibItem ); - break; - - case DRAW_PICK_ITEM_STRUCT_TYPE : break; - case DRAW_POLYLINE_STRUCT_TYPE : break; - case DRAW_SHEETLABEL_STRUCT_TYPE: break; - case DRAW_MARKER_STRUCT_TYPE : break; - - case DRAW_SHEET_STRUCT_TYPE : - #undef STRUCT - #define STRUCT ((DrawSheetStruct*)DrawList) - PlotSheetStruct(STRUCT); - break; - - case DRAW_NOCONNECT_STRUCT_TYPE: - #undef STRUCT - #define STRUCT ((DrawNoConnectStruct*)DrawList) - if ( g_PlotPSColorOpt ) - SetColorMapPS (ReturnLayerColor(LAYER_NOCONNECT) ); - PlotNoConnectStruct(STRUCT); - break; - - default: - break; - } - - Plume('U'); - DrawList = DrawList->Pnext; - } - - /* fin */ - CloseFilePS(PlotOutput); - - m_MsgBox->AppendText( wxT("Ok\n")); -} - - - - - - - - - - + g_PlotPSMinimunLineWidth = m_DefaultLineSizeCtrl->GetValue(); + if ( g_PlotPSMinimunLineWidth < 1 ) g_PlotPSMinimunLineWidth = 1; + +} + + +/*************************************************************/ +void WinEDA_PlotPSFrame::CreatePSFile(int AllPages, int pagesize) +/*************************************************************/ +{ +wxString PlotFileName, ShortFileName; +BASE_SCREEN *screen; +Ki_PageDescr * PlotSheet, * RealSheet; +int BBox[4]; +wxPoint plot_offset; + + g_PlotFormat = PLOT_FORMAT_POST; + + /* Build the screen list */ + EDA_ScreenList ScreenList(NULL); + + if ( AllPages == TRUE ) screen = screen = ScreenList.GetFirst(); + else screen = ActiveScreen; + for ( ; screen != NULL; screen = ScreenList.GetNext() ) + { + PlotSheet = screen->m_CurrentSheet; + RealSheet = &g_Sheet_A4; + if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet; + else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A; + + /* Calcul des limites de trace en 1/1000 pouce */ + BBox[0] = BBox[1] = g_PlotMargin; // Plot margin in 1/1000 inch + BBox[2] = RealSheet->m_Size.x - g_PlotMargin; + BBox[3] = RealSheet->m_Size.y - g_PlotMargin; + + /* Calcul des echelles de conversion */ + g_PlotScaleX = SCALE_PS * + (float) (BBox[2] - BBox[0]) / + PlotSheet->m_Size.x; + g_PlotScaleY = SCALE_PS * + (float) (BBox[3] - BBox[1]) / + PlotSheet->m_Size.y; + + plot_offset.x = 0; + plot_offset.y = PlotSheet->m_Size.y; + + wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL, + &ShortFileName, (wxString*) NULL); + wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; + if( ! ShortFileName.IsEmpty() ) + PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".ps")); + else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".ps")); + + PlotOneSheetPS(PlotFileName,screen, RealSheet, BBox, plot_offset); + screen = (BASE_SCREEN*)screen->Pnext; + if (AllPages == FALSE ) break; + } +} + + +/*****************************************************************************************/ +void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName, + BASE_SCREEN * screen, Ki_PageDescr * sheet, int BBox[4], wxPoint plot_offset) +/*****************************************************************************************/ +/* Trace en format PS. d'une feuille de dessin +*/ +{ +wxString Line; +EDA_BaseStruct *DrawList; +EDA_SchComponentStruct *DrawLibItem; +int layer; +wxPoint StartPos, EndPos; + + PlotOutput = wxFopen(FileName, wxT("wt")); + if (PlotOutput == NULL) + { + Line = wxT("\n** "); + Line += _("Unable to create ") + FileName + wxT(" **\n\n"); + m_MsgBox->AppendText(Line); + wxBell(); + return ; + } + + Line.Printf(_("Plot: %s\n"), FileName.GetData()) ; + m_MsgBox->AppendText(Line); + + InitPlotParametresPS(plot_offset, sheet, g_PlotScaleX, g_PlotScaleY); + SetDefaultLineWidthPS( g_PlotPSMinimunLineWidth); + + /* Init : */ + PrintHeaderPS(PlotOutput, wxT("EESchema-PS"), FileName, BBox); + InitPlotParametresPS(plot_offset, sheet, 1.0, 1.0); + + if ( m_Plot_Sheet_Ref->GetValue() ) + { + if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) + SetColorMapPS ( BLACK ); + PlotWorkSheet(PLOT_FORMAT_POST, screen); + } + + DrawList = screen->EEDrawList; + while ( DrawList ) /* tracage */ + { + Plume('U'); + layer = LAYER_NOTES; + switch( DrawList->m_StructType ) + { + case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */ + #undef STRUCT + #define STRUCT ((DrawBusEntryStruct*)DrawList) + StartPos = STRUCT->m_Pos; + EndPos = STRUCT->m_End(); + layer = STRUCT->m_Layer; + case DRAW_SEGMENT_STRUCT_TYPE : + #undef STRUCT + #define STRUCT ((EDA_DrawLineStruct*)DrawList) + if ( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE) + { + StartPos = STRUCT->m_Start; + EndPos = STRUCT->m_End; + layer = STRUCT->m_Layer; + } + if ( g_PlotPSColorOpt ) + SetColorMapPS ( ReturnLayerColor(layer) ); + switch (layer) + { + case LAYER_NOTES: /* Trace en pointilles */ + SetCurrentLineWidth(-1); + fprintf(PlotOutput,"[50 50] 0 setdash\n"); + Move_Plume( StartPos, 'U'); + Move_Plume( EndPos, 'D'); + fprintf(PlotOutput,"[] 0 setdash\n"); + break; + + case LAYER_BUS: /* Trait large */ + { + fprintf(PlotOutput,"%d setlinewidth\n", g_PlotPSMinimunLineWidth * 3); + Move_Plume( StartPos,'U'); + Move_Plume( EndPos,'D'); + fprintf(PlotOutput,"%d setlinewidth\n", g_PlotPSMinimunLineWidth); + } + break; + + default: + SetCurrentLineWidth(-1); + Move_Plume( StartPos,'U'); + Move_Plume( EndPos,'D'); + break; + } + break; + + case DRAW_JUNCTION_STRUCT_TYPE : + #undef STRUCT + #define STRUCT ((DrawJunctionStruct*)DrawList) + if ( g_PlotPSColorOpt ) + SetColorMapPS (ReturnLayerColor(STRUCT->m_Layer) ); + PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE); + break; + + case DRAW_TEXT_STRUCT_TYPE : + case DRAW_LABEL_STRUCT_TYPE : + case DRAW_GLOBAL_LABEL_STRUCT_TYPE : + PlotTextStruct(DrawList); + break; + + case DRAW_LIB_ITEM_STRUCT_TYPE : + DrawLibItem = (EDA_SchComponentStruct *) DrawList; + PlotLibPart( DrawLibItem ); + break; + + case DRAW_PICK_ITEM_STRUCT_TYPE : break; + case DRAW_POLYLINE_STRUCT_TYPE : break; + case DRAW_SHEETLABEL_STRUCT_TYPE: break; + case DRAW_MARKER_STRUCT_TYPE : break; + + case DRAW_SHEET_STRUCT_TYPE : + #undef STRUCT + #define STRUCT ((DrawSheetStruct*)DrawList) + PlotSheetStruct(STRUCT); + break; + + case DRAW_NOCONNECT_STRUCT_TYPE: + #undef STRUCT + #define STRUCT ((DrawNoConnectStruct*)DrawList) + if ( g_PlotPSColorOpt ) + SetColorMapPS (ReturnLayerColor(LAYER_NOCONNECT) ); + PlotNoConnectStruct(STRUCT); + break; + + default: + break; + } + + Plume('U'); + DrawList = DrawList->Pnext; + } + + /* fin */ + CloseFilePS(PlotOutput); + + m_MsgBox->AppendText( wxT("Ok\n")); +} diff --git a/eeschema/plotps.h b/eeschema/plotps.h index 962cc46496..a427158088 100644 --- a/eeschema/plotps.h +++ b/eeschema/plotps.h @@ -1,86 +1,87 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: plotps.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 01/02/2006 08:37:24 -// RCS-ID: -// Copyright: GNU License -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24 - -#ifndef _PLOTPS_H_ -#define _PLOTPS_H_ - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "plotps.h" -#endif - -/*! - * Includes - */ - -////@begin includes +///////////////////////////////////////////////////////////////////////////// +// Name: plotps.h +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 01/02/2006 08:37:24 +// RCS-ID: +// Copyright: GNU License +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24 + +#ifndef _PLOTPS_H_ +#define _PLOTPS_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "plotps.h" +#endif + +/*! + * Includes + */ + +////@begin includes #include "wx/valgen.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxBoxSizer; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers #define ID_DIALOG 10000 +#define ID_RADIOBOX1 10002 +#define ID_RADIOBOX 10001 +#define ID_CHECKBOX 10005 +#define ID_PLOT_PS_CURRENT_EXECUTE 10003 +#define ID_PLOT_PS_ALL_EXECUTE 10004 +#define ID_TEXTCTRL 10006 #define SYMBOL_WINEDA_PLOTPSFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxSTAY_ON_TOP|wxCLOSE_BOX #define SYMBOL_WINEDA_PLOTPSFRAME_TITLE _("EESchema Plot PS") #define SYMBOL_WINEDA_PLOTPSFRAME_IDNAME ID_DIALOG #define SYMBOL_WINEDA_PLOTPSFRAME_SIZE wxSize(400, 300) #define SYMBOL_WINEDA_PLOTPSFRAME_POSITION wxDefaultPosition -#define ID_RADIOBOX1 10002 -#define ID_RADIOBOX 10001 -#define ID_PLOT_PS_CURRENT_EXECUTE 10003 -#define ID_PLOT_PS_ALL_EXECUTE 10004 -#define ID_CHECKBOX 10005 -#define ID_TEXTCTRL 10006 -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_PlotPSFrame class declaration - */ - -class WinEDA_PlotPSFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_PlotPSFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_PlotPSFrame( ); - WinEDA_PlotPSFrame( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PLOTPSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PLOTPSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PLOTPSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PLOTPSFRAME_SIZE, long style = SYMBOL_WINEDA_PLOTPSFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PLOTPSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PLOTPSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PLOTPSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PLOTPSFRAME_SIZE, long style = SYMBOL_WINEDA_PLOTPSFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_PlotPSFrame event handler declarations +////@end control identifiers + +/*! + * Compatibility + */ + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif + +/*! + * WinEDA_PlotPSFrame class declaration + */ + +class WinEDA_PlotPSFrame: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( WinEDA_PlotPSFrame ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + WinEDA_PlotPSFrame( ); + WinEDA_PlotPSFrame( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PLOTPSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PLOTPSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PLOTPSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PLOTPSFRAME_SIZE, long style = SYMBOL_WINEDA_PLOTPSFRAME_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PLOTPSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PLOTPSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PLOTPSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PLOTPSFRAME_SIZE, long style = SYMBOL_WINEDA_PLOTPSFRAME_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin WinEDA_PlotPSFrame event handler declarations /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_PS_CURRENT_EXECUTE void OnPlotPsCurrentExecuteClick( wxCommandEvent& event ); @@ -91,32 +92,34 @@ public: /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE void OnCloseClick( wxCommandEvent& event ); -////@end WinEDA_PlotPSFrame event handler declarations - -////@begin WinEDA_PlotPSFrame member function declarations +////@end WinEDA_PlotPSFrame event handler declarations + +////@begin WinEDA_PlotPSFrame member function declarations /// Retrieves bitmap resources wxBitmap GetBitmapResource( const wxString& name ); /// Retrieves icon resources wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_PlotPSFrame member function declarations +////@end WinEDA_PlotPSFrame member function declarations - void InitOptVars(void); - void CreatePSFile(int AllPages, int pagesize); - void PlotOneSheetPS(const wxString & FileName, - BASE_SCREEN * screen, Ki_PageDescr * sheet, int BBox[4], wxPoint plot_offset); - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin WinEDA_PlotPSFrame member variables + void InitOptVars(void); + void CreatePSFile(int AllPages, int pagesize); + void PlotOneSheetPS(const wxString & FileName, + BASE_SCREEN * screen, Ki_PageDescr * sheet, int BBox[4], wxPoint plot_offset); + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin WinEDA_PlotPSFrame member variables wxRadioBox* m_SizeOption; wxRadioBox* m_PlotPSColorOption; wxCheckBox* m_Plot_Sheet_Ref; + wxBoxSizer* m_DefaultLineSizeCtrlSizer; wxTextCtrl* m_MsgBox; -////@end WinEDA_PlotPSFrame member variables -}; - -#endif - // _PLOTPS_H_ +////@end WinEDA_PlotPSFrame member variables + WinEDA_ValueCtrl * m_DefaultLineSizeCtrl; +}; + +#endif + // _PLOTPS_H_ diff --git a/eeschema/plotps.pjd b/eeschema/plotps.pjd index 320108e3b9..586a481a62 100644 --- a/eeschema/plotps.pjd +++ b/eeschema/plotps.pjd @@ -6,7 +6,7 @@ "" "" "" - 21 + 23 "" 0 0 @@ -18,6 +18,7 @@ "GNU License" "" 0 + 0 "<All platforms>" "<Any>" "///////////////////////////////////////////////////////////////////////////// @@ -95,9 +96,17 @@ "<System>" "<System>" "" + 0 + 0 + 4 + " " + "" 0 + 0 + 1 1 1 + 1 @@ -237,7 +246,9 @@ 0 0 0 - 0 + 0 + 0 + 0 0 0 1 @@ -308,6 +319,8 @@ "m_SizeOption" "Plot page size:" 1 + "Auto|Page Size A4|Page Size A" + 0 "" "" "" @@ -320,15 +333,16 @@ "wxGenericValidator(& %VARIABLE%)" 0 1 - "Auto|Page Size A4|Page Size A" 0 + 0 + 0 "" -1 -1 -1 -1 "Centre" - "Centre" + "Expand" 0 5 1 @@ -368,41 +382,26 @@ "<Any platform>" - "wxRadioBox: ID_RADIOBOX" + "wxStaticBoxSizer V" "dialog-control-document" "" - "radiobox" + "sizer" 0 1 0 0 - "1/5/2006" - "wbRadioBoxProxy" - "ID_RADIOBOX" - 10001 - "wxRadioBox" - "m_PlotPSColorOption" - "Plot Color:" - 1 - "" - "" - "" + "22/1/2007" + "wbStaticBoxSizerProxy" + "wxID_ANY" + "-1" + "Plot Options:" + "" "" "" 0 1 - "<Any platform>" - "g_PlotPSColorOpt" - "wxGenericValidator(& %VARIABLE%)" - 0 - 1 - "B/W|Color" - 0 - "" - -1 - -1 - -1 - -1 + "Vertical" + "" "Centre" "Centre" 0 @@ -414,8 +413,113 @@ 0 0 0 - "" - "" + "<Any platform>" + + "wxRadioBox: ID_RADIOBOX" + "dialog-control-document" + "" + "radiobox" + 0 + 1 + 0 + 0 + "22/1/2007" + "wbRadioBoxProxy" + "ID_RADIOBOX" + 10001 + "wxRadioBox" + "m_PlotPSColorOption" + "Plot Color:" + 1 + "B/W|Color" + 0 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "g_PlotPSColorOpt" + "wxGenericValidator(& %VARIABLE%)" + 0 + 1 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "22/1/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX" + 10005 + "wxCheckBox" + "m_Plot_Sheet_Ref" + "Print Sheet Ref" + 0 + "" + "" + "Plot_Sheet_Ref" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + "Spacer" @@ -501,6 +605,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -553,6 +659,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -605,6 +713,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -627,43 +737,19 @@ - "wxCheckBox: ID_CHECKBOX" + "wxBoxSizer V" "dialog-control-document" "" - "checkbox" + "sizer" 0 1 0 0 - "1/5/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX" - 10005 - "wxCheckBox" - "m_Plot_Sheet_Ref" - "Print Sheet Ref" - 0 - "" - "" - "Plot_Sheet_Ref" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" + "22/1/2007" + "wbBoxSizerProxy" + "Vertical" + "m_DefaultLineSizeCtrlSizer" + "Expand" "Centre" 0 5 @@ -674,8 +760,7 @@ 0 0 0 - "" - "" + "<Any platform>" "wxStaticText: wxID_STATIC" @@ -693,6 +778,7 @@ "wxStaticText" "" "Messages :" + -1 "" "" "" @@ -714,6 +800,8 @@ 0 0 0 + 0 + 0 "" -1 -1 @@ -782,6 +870,8 @@ 0 0 0 + 0 + 0 "" -1 -1 diff --git a/eeschema/protos.h b/eeschema/protos.h index b0e1d5aa42..9eaea1b834 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -60,10 +60,6 @@ void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC, int Multi, int convert, int DrawMode, int Color = -1); -void DrawPinSymbol(WinEDA_DrawPanel * panel, wxDC * DC, - int posX, int posY, int len, int orient, int SymbolType, - int DrawMode, int Color = -1); - void DrawLibraryDrawStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_LibComponentStruct *LibEntry, int PartX, int PartY, LibEDA_BaseStruct *DrawItem, int Multi, @@ -167,8 +163,8 @@ EDA_BaseStruct * PickStruct(const wxPoint & refpos, -LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, - EDA_LibComponentStruct* LibEntry, int Unit, int Convert, int masque); +LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, const wxPoint & refpoint, + EDA_LibComponentStruct * LibEntry, int Unit, int Convert, int masque); DrawSheetLabelStruct * LocateSheetLabel(DrawSheetStruct *Sheet, const wxPoint & pos); LibDrawPin * LocateAnyPin(EDA_BaseStruct *DrawList, const wxPoint & RefPos, @@ -226,9 +222,6 @@ int CountCmpNumber(void); /* EESTRING.CPP */ /***************/ -void PutTextInfo(WinEDA_DrawPanel * panel, wxDC * DC, int Orient, const wxPoint & PosX, - const wxSize& size, - const wxString & Str, int DrawMode, int color); /***************/ /* EECONFIG.CPP */ @@ -315,8 +308,11 @@ int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly); /************/ /* PLOT.CPP */ /************/ -void PlotArc(wxPoint centre, int StAngle, int EndAngle, int rayon); -void PlotCercle(wxPoint centre, int diametre ); +void SetCurrentLineWidth( int width); + +void PlotArc(wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1); +void PlotCercle(wxPoint centre, int diametre, int width = -1); +void PlotPoly( int nb, int * coord, int fill, int width = -1); void PlotNoConnectStruct(DrawNoConnectStruct * Struct); void PlotLibPart( EDA_SchComponentStruct *DrawLibItem ); @@ -339,7 +335,7 @@ bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion); /* DELETE.CPP */ /*************/ -void LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC); +bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC); void EraseStruct(EDA_BaseStruct *DrawStruct, SCH_SCREEN * Window); void DeleteAllMarkers(int type); /* Effacement des marqueurs du type "type" */ diff --git a/eeschema/savelib.cpp b/eeschema/savelib.cpp index ab1622f1e6..86df46fcaa 100644 --- a/eeschema/savelib.cpp +++ b/eeschema/savelib.cpp @@ -41,7 +41,7 @@ int x2 = t2; if(x2 > 1800) x2 -= 3600; m_Rayon, x1, x2, m_Unit,m_Convert, m_Width, fill_tab[m_Fill], - m_Start.x, m_Start.y, m_End.x, m_End.y); + m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x, m_ArcEnd.y); return FALSE; } @@ -79,7 +79,7 @@ bool LibDrawSquare::WriteDescr( FILE * ExportFile ) /***************************************************/ { fprintf(ExportFile,"S %d %d %d %d %d %d %d %c\n", - m_Start.x, m_Start.y, m_End.x, m_End.y, + m_Pos.x, m_Pos.y, m_End.x, m_End.y, m_Unit,m_Convert, m_Width, fill_tab[m_Fill]); return FALSE; @@ -118,7 +118,7 @@ wxString StringPinNum; CONV_TO_UTF8(StringPinNum), m_Pos.x, m_Pos.y, (int)m_PinLen, (int)m_Orient, - m_SizeNum, m_SizeName, + m_PinNumSize, m_PinNameSize, m_Unit,m_Convert, Etype); if( (m_PinShape) || (m_Attributs & PINNOTDRAW) ) diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index b89cab7b7e..e9556f6c53 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -159,6 +159,10 @@ wxPoint defaultpos(-1,-1); LoadOneEEProject( wxEmptyString, FALSE); break; + case ID_LOAD_ONE_SHEET: + LoadOneSheet(GetScreen(), wxEmptyString); + break; + case ID_LOAD_FILE_1: case ID_LOAD_FILE_2: case ID_LOAD_FILE_3: @@ -519,7 +523,9 @@ wxPoint defaultpos(-1,-1); case ID_POPUP_SCH_ORIENT_NORMAL_CMP: option = CMP_NORMAL; break; } - DrawPanel->MouseToCursorSchema(); + DrawPanel->MouseToCursorSchema(); + if ( m_CurrentScreen->m_CurrentItem->m_Flags == 0 ) + SaveCopyInUndoList(m_CurrentScreen->m_CurrentItem, IS_CHANGED); CmpRotationMiroir( (EDA_SchComponentStruct *) m_CurrentScreen->m_CurrentItem, &dc, option ); diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index e44456786e..2a45a6658f 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -132,7 +132,12 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par m_CurrentScreen = ScreenSch; g_ItemToRepeat = NULL; + /* Get config */ GetSettings(); + g_DrawMinimunLineWidth = m_Parent->m_EDA_Config->Read(MINI_DRAW_LINE_WIDTH_KEY, (long)0); + g_PlotPSMinimunLineWidth = m_Parent->m_EDA_Config->Read(MINI_PLOTPS_LINE_WIDTH_KEY, (long) 4); + + /****/ SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y); if ( DrawPanel ) DrawPanel->m_Block_Enable = TRUE; ReCreateMenuBar(); @@ -210,6 +215,9 @@ SCH_SCREEN * screen; SaveSettings(); + m_Parent->m_EDA_Config->Write(MINI_DRAW_LINE_WIDTH_KEY, (long)g_DrawMinimunLineWidth); + m_Parent->m_EDA_Config->Write(MINI_PLOTPS_LINE_WIDTH_KEY, (long) g_PlotPSMinimunLineWidth); + Destroy(); } diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 5447a3f450..3e2d7b6b86 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -249,7 +249,20 @@ wxString FileName, msg; ChangeFileNameExt( FileName,g_SchExtBuffer ); - m_CurrentSheet->m_FileName = FileName; + if ( m_CurrentSheet->m_FileName != FileName ) + { + m_CurrentSheet->m_FileName = FileName; + + if ( wxFileExists(FileName) ) /* do we reload the data from the existing file */ + { + msg.Printf( _("A file named %s exists, load it ?"), FileName.GetData()); + if( IsOK (this,msg) ) + { + m_Parent->LoadOneSheet(m_CurrentSheet, FileName); + } + } + } + msg = m_FileNameSize->GetValue(); m_CurrentSheet->m_FileNameSize = ReturnValueFromString(g_UnitMetric, @@ -271,17 +284,14 @@ wxString FileName, msg; /*************************************************************************/ bool WinEDA_SchematicFrame::EditSheet(DrawSheetStruct * Sheet, wxDC * DC) /*************************************************************************/ -/* Routine de modification des textes (Name et FileName) de la Sheet */ +/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */ { -BASE_SCREEN * ScreenSheet = NULL; WinEDA_SheetPropertiesFrame * frame; bool edit = TRUE; if ( Sheet == NULL ) return FALSE; - ScreenSheet = Sheet; - - /* Demande du nouveau texte */ + /* Get the new texts */ RedrawOneStruct(DrawPanel, DC, Sheet, g_XorMode); DrawPanel->m_IgnoreMouseEvents = TRUE; @@ -290,16 +300,6 @@ bool edit = TRUE; DrawPanel->MouseToCursorSchema(); DrawPanel->m_IgnoreMouseEvents = FALSE; - if ( edit ) - { - /* Correction du nom fichier dans la structure SCREEN correspondante */ - if( ScreenSheet ) - { - ScreenSheet->m_FileName = Sheet->m_FileName; - } - GetScreen()->SetModify(); - } - RedrawOneStruct(DrawPanel, DC, Sheet, GR_DEFAULT_DRAWMODE); return edit; } diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 1b112bdbcf..13ca81515c 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -1,7 +1,8 @@ - /********************************************************************/ - /* EESchema - symbdraw.cpp */ - /* Menus et Routines de dessin des elements graphiques des symboles */ - /********************************************************************/ + /*********************************************************************/ + /* EESchema - symbdraw.cpp */ + /* Create, move .. graphic shapes used to build and draw a component */ + /* (lines, arcs .. */ + /*********************************************************************/ #include "fctsys.h" @@ -17,8 +18,6 @@ #include "id.h" -/* Routines importees */ - /* Routines locales */ static void SymbolDisplayDraw(WinEDA_DrawPanel * panel, wxDC * DC, bool erase); static void ComputeArc(LibDrawArc * DrawItem, wxPoint ArcCentre); @@ -28,7 +27,7 @@ static void MoveLibDrawItemAt(LibEDA_BaseStruct * DrawItem, wxPoint newpos); /* Variables locales */ static int StateDrawArc, ArcStartX, ArcStartY, ArcEndX, ArcEndY; static wxPoint InitPosition, StartCursor, ItemPreviousPos; -static int FlSymbol_Fill = NO_FILL; +static int FlSymbol_Fill = NO_FILL; /************************************/ @@ -48,6 +47,7 @@ void WinEDA_bodygraphics_PropertiesFrame:: g_FlDrawSpecificUnit = m_CommonUnit->GetValue() ? FALSE : TRUE; if ( m_Filled ) FlSymbol_Fill = m_Filled->GetSelection(); + g_LibSymbolDefaultLineWidth = m_GraphicShapeWidthCtrl->GetValue(); if ( CurrentDrawItem ) { @@ -69,18 +69,22 @@ void WinEDA_bodygraphics_PropertiesFrame:: { case COMPONENT_ARC_DRAW_TYPE: ((LibDrawArc*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; + ((LibDrawArc*)CurrentDrawItem)->m_Width = m_GraphicShapeWidthCtrl->GetValue(); break; case COMPONENT_CIRCLE_DRAW_TYPE: ((LibDrawCircle*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; + ((LibDrawCircle*)CurrentDrawItem)->m_Width = m_GraphicShapeWidthCtrl->GetValue(); break; case COMPONENT_RECT_DRAW_TYPE: ((LibDrawSquare*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; + ((LibDrawSquare*)CurrentDrawItem)->m_Width = m_GraphicShapeWidthCtrl->GetValue(); break; case COMPONENT_POLYLINE_DRAW_TYPE: ((LibDrawPolyline*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; + ((LibDrawPolyline*)CurrentDrawItem)->m_Width = m_GraphicShapeWidthCtrl->GetValue(); break; default: break; @@ -211,7 +215,8 @@ int * ptpoly; ArcStartX = ArcEndX = m_CurrentScreen->m_Curseur.x; ArcStartY = ArcEndY = - m_CurrentScreen->m_Curseur.y; StateDrawArc = 1; - Arc->m_Fill = FlSymbol_Fill; + Arc->m_Fill = FlSymbol_Fill; + Arc->m_Width = g_LibSymbolDefaultLineWidth; } break; @@ -222,6 +227,7 @@ int * ptpoly; Circle->m_Pos.x = m_CurrentScreen->m_Curseur.x; Circle->m_Pos.y = - m_CurrentScreen->m_Curseur.y; Circle->m_Fill = FlSymbol_Fill; + Circle->m_Width = g_LibSymbolDefaultLineWidth; } break; @@ -229,10 +235,11 @@ int * ptpoly; { LibDrawSquare * Square = new LibDrawSquare(); CurrentDrawItem = Square; - Square->m_Start.x = m_CurrentScreen->m_Curseur.x; - Square->m_Start.y = - m_CurrentScreen->m_Curseur.y; - Square->m_End = Square->m_Start; + Square->m_Pos.x = m_CurrentScreen->m_Curseur.x; + Square->m_Pos.y = - m_CurrentScreen->m_Curseur.y; + Square->m_End = Square->m_Pos; Square->m_Fill = FlSymbol_Fill; + Square->m_Width = g_LibSymbolDefaultLineWidth; } break; @@ -246,6 +253,7 @@ int * ptpoly; ptpoly[0] = ptpoly[2] = m_CurrentScreen->m_Curseur.x; ptpoly[1] = ptpoly[3] = - m_CurrentScreen->m_Curseur.y; polyline->m_Fill = FlSymbol_Fill; + polyline->m_Width = g_LibSymbolDefaultLineWidth; } break; @@ -253,9 +261,10 @@ int * ptpoly; { LibDrawSegment* Segment = new LibDrawSegment(); CurrentDrawItem = Segment; - Segment->m_Start.x = m_CurrentScreen->m_Curseur.x; - Segment->m_Start.y = -m_CurrentScreen->m_Curseur.y; - Segment->m_End = Segment->m_Start; + Segment->m_Pos.x = m_CurrentScreen->m_Curseur.x; + Segment->m_Pos.y = -m_CurrentScreen->m_Curseur.y; + Segment->m_End = Segment->m_Pos; + Segment->m_Width = g_LibSymbolDefaultLineWidth; } break; @@ -346,13 +355,13 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw(wxDC * DC) /**************************************************************************/ static void RedrawWhileMovingCursor(WinEDA_DrawPanel * panel, wxDC * DC, bool erase) /**************************************************************************/ -/* Redessine le "Draw Symbol" en cours de deplacement +/* Redraw the graphoc shape while moving */ { BASE_SCREEN * Screen = panel->m_Parent->m_CurrentScreen; int mx, my; - /* Effacement ancien dessin */ + /* Erase shape in the old positon*/ if( erase ) { mx = ItemPreviousPos.x - StartCursor.x , @@ -362,7 +371,7 @@ int mx, my; CurrentDrawItem, CurrentUnit, g_XorMode); } - /* Redraw moved item */ + /* Redraw moved shape */ mx = Screen->m_Curseur.x - StartCursor.x , my = Screen->m_Curseur.y - StartCursor.y ; DrawLibraryDrawStruct(panel, DC, CurrentLibEntry, mx , my, @@ -387,10 +396,10 @@ wxSize size; int dy = - my - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y; ((LibDrawArc*)CurrentDrawItem)->m_Pos.x = mx; ((LibDrawArc*)CurrentDrawItem)->m_Pos.y = - my; - ((LibDrawArc*)CurrentDrawItem)->m_Start.x += dx; - ((LibDrawArc*)CurrentDrawItem)->m_Start.y += dy; - ((LibDrawArc*)CurrentDrawItem)->m_End.x += dx; - ((LibDrawArc*)CurrentDrawItem)->m_End.y += dy; + ((LibDrawArc*)CurrentDrawItem)->m_ArcStart.x += dx; + ((LibDrawArc*)CurrentDrawItem)->m_ArcStart.y += dy; + ((LibDrawArc*)CurrentDrawItem)->m_ArcEnd.x += dx; + ((LibDrawArc*)CurrentDrawItem)->m_ArcEnd.y += dy; break; } @@ -401,11 +410,11 @@ wxSize size; case COMPONENT_RECT_DRAW_TYPE: size.x = ((LibDrawSquare*)CurrentDrawItem)->m_End.x - - ((LibDrawSquare*)CurrentDrawItem)->m_Start.x; + ((LibDrawSquare*)CurrentDrawItem)->m_Pos.x; size.y = ((LibDrawSquare*)CurrentDrawItem)->m_End.y - - ((LibDrawSquare*)CurrentDrawItem)->m_Start.y; - ((LibDrawSquare*)CurrentDrawItem)->m_Start.x = mx; - ((LibDrawSquare*)CurrentDrawItem)->m_Start.y = - my; + ((LibDrawSquare*)CurrentDrawItem)->m_Pos.y; + ((LibDrawSquare*)CurrentDrawItem)->m_Pos.x = mx; + ((LibDrawSquare*)CurrentDrawItem)->m_Pos.y = - my; ((LibDrawSquare*)CurrentDrawItem)->m_End.x = mx + size.x; ((LibDrawSquare*)CurrentDrawItem)->m_End.y = - my + size.y; break; @@ -456,7 +465,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol(wxDC * DC) break; case COMPONENT_RECT_DRAW_TYPE: - InitPosition = ((LibDrawSquare*)CurrentDrawItem)->m_Start; + InitPosition = ((LibDrawSquare*)CurrentDrawItem)->m_Pos; break; case COMPONENT_POLYLINE_DRAW_TYPE: @@ -500,7 +509,7 @@ int mx = Screen->m_Curseur.x, if( StateDrawArc == 1 ) { int Color = ReturnLayerColor(LAYER_DEVICE); - GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color); + GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, 0, Color); } else { @@ -512,11 +521,11 @@ int mx = Screen->m_Curseur.x, GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, - Color); + 0, Color); GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, - Color); + 0, Color); } } } @@ -569,7 +578,7 @@ int mx = Screen->m_Curseur.x, if( StateDrawArc == 1 ) { int Color = ReturnLayerColor(LAYER_DEVICE); - GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color); + GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, 0, Color); } else { @@ -581,11 +590,11 @@ int mx = Screen->m_Curseur.x, GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, - Color); + 0, Color); GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, - Color); + 0, Color); } } } @@ -719,10 +728,10 @@ int angle; DrawItem->t2 = (int)(atan2(dy, dx) *1800 /M_PI); - DrawItem->m_Start.x = ArcStartX; - DrawItem->m_Start.y = ArcStartY; - DrawItem->m_End.x = ArcEndX; - DrawItem->m_End.y = ArcEndY; + DrawItem->m_ArcStart.x = ArcStartX; + DrawItem->m_ArcStart.y = ArcStartY; + DrawItem->m_ArcEnd.x = ArcEndX; + DrawItem->m_ArcEnd.y = ArcEndY; NORMALIZE_ANGLE(DrawItem->t1); NORMALIZE_ANGLE(DrawItem->t2); // angles = 0 .. 3600 diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index dc01affd39..4b99cd76da 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -1,5 +1,8 @@ /*************************************************/ - /* Routines d'edition de symboles de composants */ + /* Functions to Load from file and save to file */ + /* the graphic shapes used to draw a component */ + /* When using the import/export symbol options */ + /* files are the *.sym files */ /*************************************************/ /* fichier symbedit.cpp */ @@ -27,10 +30,8 @@ static bool CompareSymbols(LibEDA_BaseStruct *DEntryRef, /***************************************************/ void WinEDA_LibeditFrame::LoadOneSymbol(wxDC * DC) /***************************************************/ -/* Cette routine lit un fichier type librairie symbole et -ajoute au symbole courant les elements de trace du nouveau symbole graphique - Si il n'y a pas de symbole courant, le nouveau symbole devient le - symbole courant +/* Read a component shape file and add data (graphic items) to the current + component. */ { int NumOfParts; @@ -64,7 +65,7 @@ wxString msg; if ( FullFileName.IsEmpty() ) return; - /* Chargement de 1 symbole */ + /* Load data */ ImportFile = wxFopen(FullFileName, wxT("rt")); if (ImportFile == NULL) { @@ -87,7 +88,7 @@ wxString msg; if(LibEntry == NULL ) DisplayError(this, _("Symbol File is void"), 20); - else /* Ajout des elements graphiques */ + else /* add data to the current symbol */ { DrawEntry = LibEntry->m_Drawings; while(DrawEntry) @@ -121,10 +122,9 @@ wxString msg; /********************************************/ void WinEDA_LibeditFrame::SaveOneSymbol(void) /********************************************/ -/* Routine de sauvegarde du symbole courant edite - Le format est identique aux librairies standards - Les pins invisibles et les elements - non relativ a la forme courante ne sont pas sauves +/* Save in file the current symbol + file format is like the standard libraries, but there is only one symbol + Invisible pins are not saved */ { EDA_LibComponentStruct *LibEntry = CurrentLibEntry; @@ -254,9 +254,9 @@ FILE * ExportFile; /*****************************************************************/ void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry) /*****************************************************************/ -/* Routine de suppression des elements de trace dupliques, situation -frequente lorsque l'on charge des symboles predessines plusieurs fois -pour definir un composant +/* Delete redundant graphic items. + Useful after loading asymbole from a file symbol, because some graphic items + can be duplicated. */ { LibEDA_BaseStruct *DEntryRef, *DEntryCompare; @@ -291,9 +291,9 @@ wxDC * DC = NULL; static bool CompareSymbols(LibEDA_BaseStruct *DEntryRef, LibEDA_BaseStruct *DEntryCompare) /********************************************************************/ -/* Routine de comparaison de 2 DrawEntryStruct. - retourne FALSE si differentes - TRUE si egales +/* Compare 2 graphic items (arc, lines ...). + return FALSE si different + TRUE si they are identical, and therefore redundant */ { int ii; @@ -332,8 +332,7 @@ int * ptref, *ptcomp; #undef CMPSTRUCT #define REFSTRUCT ((LibDrawText *) DEntryRef) #define CMPSTRUCT ((LibDrawText *) DEntryCompare) - if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x) return(FALSE); - if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y) return(FALSE); + if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos) return(FALSE); if( REFSTRUCT->m_Size != CMPSTRUCT->m_Size) return(FALSE); if( REFSTRUCT->m_Text != CMPSTRUCT->m_Text ) return(FALSE); @@ -344,10 +343,8 @@ int * ptref, *ptcomp; #undef CMPSTRUCT #define REFSTRUCT ((LibDrawSquare *) DEntryRef) #define CMPSTRUCT ((LibDrawSquare *) DEntryCompare) - if( REFSTRUCT->m_Start.x != CMPSTRUCT->m_Start.x) return(FALSE); - if( REFSTRUCT->m_Start.y != CMPSTRUCT->m_Start.y) return(FALSE); - if( REFSTRUCT->m_End.x != CMPSTRUCT->m_End.x) return(FALSE); - if( REFSTRUCT->m_End.y != CMPSTRUCT->m_End.y) return(FALSE); + if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos) return(FALSE); + if( REFSTRUCT->m_End != CMPSTRUCT->m_End) return(FALSE); break; case COMPONENT_PIN_DRAW_TYPE: @@ -355,8 +352,7 @@ int * ptref, *ptcomp; #undef CMPSTRUCT #define REFSTRUCT ((LibDrawPin *) DEntryRef) #define CMPSTRUCT ((LibDrawPin *) DEntryCompare) - if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x) return(FALSE); - if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y) return(FALSE); + if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos) return(FALSE); break; case COMPONENT_POLYLINE_DRAW_TYPE: @@ -415,10 +411,10 @@ LibEDA_BaseStruct * DrawEntry; #define STRUCT ((LibDrawArc *) DrawEntry) STRUCT->m_Pos.x += dx; STRUCT->m_Pos.y += dy; - STRUCT->m_Start.x += dx; - STRUCT->m_Start.y += dy; - STRUCT->m_End.x += dx; - STRUCT->m_End.y += dy; + STRUCT->m_ArcStart.x += dx; + STRUCT->m_ArcStart.y += dy; + STRUCT->m_ArcEnd.x += dx; + STRUCT->m_ArcEnd.y += dy; break; case COMPONENT_CIRCLE_DRAW_TYPE: @@ -438,8 +434,8 @@ LibEDA_BaseStruct * DrawEntry; case COMPONENT_RECT_DRAW_TYPE: #undef STRUCT #define STRUCT ((LibDrawSquare *) DrawEntry) - STRUCT->m_Start.x += dx; - STRUCT->m_Start.y += dy; + STRUCT->m_Pos.x += dx; + STRUCT->m_Pos.y += dy; STRUCT->m_End.x += dx; STRUCT->m_End.y += dy; break; @@ -464,7 +460,7 @@ LibEDA_BaseStruct * DrawEntry; } DrawEntry = DrawEntry->Next(); } - /* Reaffichage du symbole */ + /* Redraw the symbol */ m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0; Recadre_Trace(TRUE); m_CurrentScreen->SetRefreshReq(); diff --git a/gerbview/deltrack.cpp b/gerbview/deltrack.cpp index e553b15621..dff4375f97 100644 --- a/gerbview/deltrack.cpp +++ b/gerbview/deltrack.cpp @@ -15,7 +15,27 @@ /* Routines Locales */ /* Variables locales */ - + + +/****************************************************************************************/ +void WinEDA_GerberFrame::Delete_DCode_Items(wxDC * DC, int dcode_value, int layer_number) +/****************************************************************************************/ +{ + if ( dcode_value < FIRST_DCODE ) // No tool selected + return; +BOARD * Pcb = m_Pcb; +TRACK * track = Pcb->m_Track, * next_track; + for ( ; track != NULL ; track = next_track ) + { + next_track = track->Next(); + if ( dcode_value != track->m_NetCode ) continue; + if ( layer_number >= 0 && layer_number != track->m_Layer ) continue; + Delete_Segment(DC, track); + } + GetScreen()->m_CurrentItem = NULL; + +} + /*****************************************************************/ TRACK * WinEDA_GerberFrame::Delete_Segment(wxDC * DC, TRACK *Track) diff --git a/gerbview/edit.cpp b/gerbview/edit.cpp index 5dde9cc0f5..691dff57cb 100644 --- a/gerbview/edit.cpp +++ b/gerbview/edit.cpp @@ -273,6 +273,11 @@ wxClientDC dc(DrawPanel); HandleBlockEnd(&dc); break; + case ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS: + if ( gerber_layer ) + Delete_DCode_Items(&dc, gerber_layer->m_Selected_Tool, GetScreen()->m_Active_Layer); + break; + default: wxMessageBox( wxT("WinEDA_GerberFrame::Process_Special_Functions error")); break; diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp new file mode 100644 index 0000000000..3ee97801cb --- /dev/null +++ b/gerbview/export_to_pcbnew.cpp @@ -0,0 +1,235 @@ +/* export_to_pcbnew.cpp */ +/* +Export des couches vers pcbnew +*/ + +#include "fctsys.h" + +#include "common.h" +#include "gerbview.h" + +#include "protos.h" + +/* Routines Locales : */ +static int SavePcbFormatAscii(WinEDA_GerberFrame * frame, + FILE * File, int * LayerLookUpTable); + +/* Variables Locales */ + + +/************************************************************************/ +void WinEDA_GerberFrame::ExportDataInPcbnewFormat(wxCommandEvent& event) +/************************************************************************/ +/* Export data in pcbnew format +*/ +{ +wxString FullFileName, msg; +wxString PcbExt(wxT(".brd")); +FILE * dest; + + msg = wxT("*") + PcbExt; + FullFileName = EDA_FileSelector(_("Board file name:"), + wxEmptyString, /* Chemin par defaut */ + wxEmptyString, /* nom fichier par defaut */ + PcbExt, /* extension par defaut */ + msg, /* Masque d'affichage */ + this, + wxFD_SAVE, + FALSE + ); + if ( FullFileName == wxEmptyString ) return; + + int * LayerLookUpTable; + if ( ( LayerLookUpTable = InstallDialogLayerPairChoice(this) ) != NULL ) + { + if ( wxFileExists(FullFileName) ) + { + if ( ! IsOK(this, _("Ok to change the existing file ?")) ) + return; + } + dest = wxFopen(FullFileName, wxT("wt")); + if (dest == 0) + { + msg = _("Unable to create ") + FullFileName; + DisplayError(this, msg) ; + return; + } + GetScreen()->m_FileName = FullFileName; + SavePcbFormatAscii(this, dest, LayerLookUpTable); + fclose(dest) ; + } +} + + +/***************************************************************/ +static int WriteSetup(FILE * File, BOARD * Pcb) +/***************************************************************/ +{ +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; + fprintf(File, "Layers %d\n", g_DesignSettings.m_CopperLayerCount); + + fprintf(File,"$EndSETUP\n\n"); + return(1); +} + +/******************************************************/ +static bool WriteGeneralDescrPcb(BOARD * Pcb, FILE * File) +/******************************************************/ +{ +int NbLayers; + + /* generation du masque des couches autorisees */ + NbLayers = Pcb->m_BoardSettings->m_CopperLayerCount; + fprintf(File,"$GENERAL\n"); + fprintf(File,"LayerCount %d\n",NbLayers); + + /* Generation des coord du rectangle d'encadrement */ + Pcb->ComputeBoundaryBox(); + fprintf(File,"Di %d %d %d %d\n", + Pcb->m_BoundaryBox.GetX(), Pcb->m_BoundaryBox.GetY(), + Pcb->m_BoundaryBox.GetRight(), + Pcb->m_BoundaryBox.GetBottom()); + + fprintf(File,"$EndGENERAL\n\n"); + return TRUE; +} + + +/*******************************************************************/ +static int SavePcbFormatAscii(WinEDA_GerberFrame * frame,FILE * File, + int * LayerLookUpTable) +/*******************************************************************/ +/* Routine de sauvegarde du PCB courant sous format ASCII + retourne + 1 si OK + 0 si sauvegarde non faite +*/ +{ +char Line[256]; +TRACK * track, *next_track; +EDA_BaseStruct * PtStruct, *NextStruct; +BOARD * GerberPcb = frame->m_Pcb; +BOARD * Pcb; + + wxBeginBusyCursor(); + + /* Create an image of gerber data */ + Pcb = new BOARD(NULL, frame); + for(track = GerberPcb->m_Track; track != NULL; track = (TRACK*) track->Pnext) + { + int layer = track->m_Layer; + int pcb_layer_number = LayerLookUpTable[layer]; + if ( pcb_layer_number < 0 ) continue; + if ( pcb_layer_number > CMP_N ) + { + DRAWSEGMENT * drawitem = new DRAWSEGMENT(NULL, TYPEDRAWSEGMENT); + drawitem->m_Layer = pcb_layer_number; + drawitem->m_Start = track->m_Start; + drawitem->m_End = track->m_End; + drawitem->m_Width = track->m_Width; + drawitem->Pnext = Pcb->m_Drawings; + Pcb->m_Drawings = drawitem; + } + else + { + TRACK * newtrack = new TRACK(*track); + newtrack->m_Layer = pcb_layer_number; + newtrack->Insert(Pcb, NULL); + } + } + + /* replace spots by vias when possible */ + for(track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext) + { + if( (track->m_Shape != S_SPOT_CIRCLE) && (track->m_Shape != S_SPOT_RECT) && (track->m_Shape != S_SPOT_OVALE) ) + continue; + /* A spot is found, and can be a via: change it for via, and delete others + spots at same location */ + track->m_Shape = VIA_NORMALE; + track->m_StructType = TYPEVIA; + track->m_Layer = 0x0F; // Layers are 0 to 15 (Cu/Cmp) + track->m_Drill = -1; + /* Compute the via position from track position ( Via position is the position of the middle of the track segment */ + track->m_Start.x = (track->m_Start.x +track->m_End.x)/2; + track->m_Start.y = (track->m_Start.y +track->m_End.y)/2; + track->m_End = track->m_Start; + } + /* delete redundant vias */ + for(track = Pcb->m_Track; track != NULL; track = track->Next()) + { + if( track->m_Shape != VIA_NORMALE ) continue; + /* Search and delete others vias*/ + TRACK * alt_track = track->Next(); + for( ; alt_track != NULL; alt_track = next_track) + { + next_track = (TRACK*) alt_track->Pnext; + if( alt_track->m_Shape != VIA_NORMALE ) continue; + if ( alt_track->m_Start != track->m_Start ) continue; + /* delete track */ + alt_track->UnLink(); + delete alt_track; + } + } + + + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); + /* Ecriture de l'entete PCB : */ + fprintf(File,"PCBNEW-BOARD Version %d date %s\n\n",g_CurrentVersionPCB, + DateAndTime(Line) ); + WriteGeneralDescrPcb(Pcb, File); + WriteSetup(File, Pcb); + + /* Ecriture des donnes utiles du pcb */ + PtStruct = Pcb->m_Drawings; + for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) + { + switch ( PtStruct->m_StructType ) + { + case TYPETEXTE: + ((TEXTE_PCB*)PtStruct)->WriteTextePcbDescr(File) ; + break; + + case TYPEDRAWSEGMENT: + ((DRAWSEGMENT *)PtStruct)->WriteDrawSegmentDescr(File); + break; + + default: + break; + } + } + + fprintf(File,"$TRACK\n"); + for(track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext) + { + track->WriteTrackDescr(File); + } + + fprintf(File,"$EndTRACK\n"); + + fprintf(File,"$EndBOARD\n"); + + /* Delete the copy */ + for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = NextStruct ) + { + NextStruct = PtStruct->Pnext; + delete PtStruct; + } + for(track = Pcb->m_Track; track != NULL; track = next_track) + { + next_track = (TRACK*) track->Pnext; + delete track; + } + delete Pcb; + + setlocale(LC_NUMERIC, ""); // revert to the current locale + wxEndBusyCursor(); + return 1; +} diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 399422e721..070f4c085c 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -122,8 +122,9 @@ wxString path = wxPathOnly(FullFileName); ActiveScreen = GetScreen(); if( filename == wxEmptyString) - { - wxString mask = wxT("*") + g_PhotoFilenameExt; + { + wxString mask = wxT("*") + g_PhotoFilenameExt; + mask += wxT(";*.gbr;*.lgr;*.ger"); filename = EDA_FileSelector(_("GERBER PLOT files:"), path, /* Chemin par defaut */ wxEmptyString, /* nom fichier par defaut */ @@ -134,7 +135,7 @@ wxString path = wxPathOnly(FullFileName); FALSE ); if ( filename == wxEmptyString ) return FALSE; - } + } GetScreen()->m_FileName = filename; wxSetWorkingDirectory(path); diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index bb49ed2fd1..722ef7f2fb 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -49,6 +49,7 @@ BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame) EVT_MENU(ID_MENU_SAVE_BOARD, WinEDA_GerberFrame::Files_io) EVT_MENU(ID_MENU_SAVE_BOARD_AS, WinEDA_GerberFrame::Files_io) EVT_MENU(ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter) + EVT_MENU(ID_GERBVIEW_EXPORT_TO_PCBNEW, WinEDA_GerberFrame::ExportDataInPcbnewFormat) EVT_MENU_RANGE(ID_LOAD_FILE_1,ID_LOAD_FILE_10, WinEDA_GerberFrame::Files_io) @@ -66,12 +67,13 @@ BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame) // menu Postprocess EVT_MENU(ID_GERBVIEW_SHOW_LIST_DCODES, WinEDA_GerberFrame::Process_Special_Functions) - - // menu Miscellaneous - EVT_MENU(ID_PCB_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions) + EVT_MENU(ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions) EVT_MENU(ID_GERBVIEW_SHOW_SOURCE, WinEDA_GerberFrame::Process_Special_Functions ) + + // menu Miscellaneous + EVT_MENU(ID_PCB_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions) // Menu Help EVT_MENU(ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp) EVT_MENU(ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout) @@ -101,6 +103,10 @@ BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame) EVT_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, WinEDA_PcbFrame::Process_Special_Functions ) + // Pop up menu + EVT_MENU(ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, + WinEDA_GerberFrame::Process_Special_Functions ) + // Option toolbar EVT_TOOL_RANGE(ID_TB_OPTIONS_START,ID_TB_OPTIONS_END, WinEDA_GerberFrame::OnSelectOptionToolbar) @@ -187,150 +193,6 @@ PCB_SCREEN * screen; Destroy(); } - -/***********************************************/ -void WinEDA_GerberFrame::ReCreateMenuBar(void) -/***********************************************/ -/* Cree ou reinitialise le menu du haut d'ecran -*/ -{ -int ii; -wxMenuBar * menuBar = GetMenuBar(); - - if( menuBar == NULL ) - { - menuBar = new wxMenuBar(); - - m_FilesMenu = new wxMenu; - m_FilesMenu->Append(ID_MENU_LOAD_FILE, - _("Clear and Load gerber file"), - _("Clear all layers and Load new gerber file"), - FALSE); - - m_FilesMenu->Append(ID_MENU_APPEND_FILE, - _("Load gerber file"), - _("Load new gerber file on currrent layer"), - FALSE); - - m_FilesMenu->Append(ID_MENU_INC_LAYER_AND_APPEND_FILE, - _("Inc Layer and load gerber file"), - _("Increment layer number, and Load gerber file"), - FALSE); - - m_FilesMenu->Append(ID_GERBVIEW_LOAD_DCODE_FILE, - _("Load DCodes"), - _("Load D-Codes File"), - FALSE); - - m_FilesMenu->Append(ID_GERBVIEW_LOAD_DRILL_FILE, - _("Load Drill"), - _("Load Drill File (EXCELLON Format)"), - FALSE); - - m_FilesMenu->Append(ID_MENU_NEW_BOARD, - _("&New"), - _("Clear all layers"), - FALSE); - - m_FilesMenu->AppendSeparator(); - m_FilesMenu->Append(ID_MENU_SAVE_BOARD, - _("&Save layers"), - _("Save current layers (GERBER format)"), - FALSE); - - m_FilesMenu->Append(ID_MENU_SAVE_BOARD_AS, - _("Save layers as.."), - _("Save current layers as.."), - FALSE); - - m_FilesMenu->AppendSeparator(); - - m_FilesMenu->Append(ID_GEN_PRINT, _("P&rint"), _("Print on current printer")); - m_FilesMenu->Append(ID_GEN_PLOT, - _("Plot"), _("Plotting in various formats") ); - - m_FilesMenu->AppendSeparator(); - m_FilesMenu->Append(ID_EXIT,_("E&xit"), _("Quit Gerbview") ); - - // Creation des selections des anciens fichiers - m_FilesMenu->AppendSeparator(); - for ( int ii = 0; ii < 10; ii++ ) - { - if ( GetLastProject(ii).IsEmpty() ) break; - m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); - } - - // Configuration: - wxMenu * configmenu = new wxMenu; - configmenu->Append(ID_CONFIG_REQ, _("&Files and Dir"), - _("Setting Files extension, Directories and others...")); - configmenu->Append(ID_COLORS_SETUP, _("&Colors"), - _("Select Colors and Display for layers")); - configmenu->Append(ID_OPTIONS_SETUP, _("&Options"), - _(" Select general options")); - - configmenu->Append(ID_PCB_LOOK_SETUP, _("Display"), - _(" Select how items are displayed")); - - // Font selection and setup - AddFontSelectionMenu(configmenu); - - m_Parent->SetLanguageList(configmenu); - - configmenu->AppendSeparator(); - configmenu->Append(ID_CONFIG_SAVE, _("&Save Gerbview Setup"), - _("Save options in current directory")); - - // Menu drill ( generation fichiers percage) -/* wxMenu *drill_menu = new wxMenu; - postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file", - "Gen Drill (EXCELLON] file and/or Drill sheet"); -*/ - // Menu d'outils divers - wxMenu *miscellaneous_menu = new wxMenu; - miscellaneous_menu->Append(ID_GERBVIEW_SHOW_LIST_DCODES, _("&List DCodes"), - _("List and Edit DCodes") ); - miscellaneous_menu->Append(ID_GERBVIEW_SHOW_SOURCE,_("&Show source"), - _("Show source file for the current layer") ); - miscellaneous_menu->AppendSeparator(); - miscellaneous_menu->Append(ID_PCB_GLOBAL_DELETE, _("&Delete Layer"), - _("Delete current layer") ); - - // Menu Help: - wxMenu *helpMenu = new wxMenu; - helpMenu->Append(ID_GENERAL_HELP, _("&Help"), _("On line doc") ); - helpMenu->Append(ID_KICAD_ABOUT, _("&About"), _("Gerbview Infos") ); - - menuBar->Append(m_FilesMenu, _("&Files")); - menuBar->Append(configmenu, _("&Preferences")); - menuBar->Append(miscellaneous_menu, _("&Miscellaneous")); -// menuBar->Append(drill_menu, _("&Drill")); - menuBar->Append(helpMenu, _("&Help")); - - // Associate the menu bar with the frame - SetMenuBar(menuBar); - } - - else // simple mise a jour de la liste des fichiers anciens - { - wxMenuItem * item; - int max_file = m_Parent->m_LastProjectMaxCount; - for ( ii = max_file-1; ii >=0 ; ii-- ) - { - if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) - { - item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); - if ( item ) delete item; - } - } - for ( ii = 0; ii < max_file; ii++ ) - { - if ( GetLastProject(ii).IsEmpty() ) break; - m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); - } - } -} - /*******************************************/ void WinEDA_GerberFrame::SetToolbars(void) /*******************************************/ diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index 3c4a288825..0f0ed95009 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -20,8 +20,7 @@ typedef enum { FORMAT_GERBER, FORMAT_POST } PlotFormat; - - + //eda_global wxString g_Plot_FileName; eda_global wxString g_PhotoFilenameExt; eda_global wxString g_DrillFilenameExt; @@ -124,6 +123,7 @@ public: int m_Iterpolation; // Linear, 90 arc, Circ. bool m_ImageNegative; // TRUE = Negative image int m_Current_Tool; // Current Tool (Dcode) number selected + int m_Last_Pen_Command; // Current or last pen state (0..9, set by Dn option with n <10 int m_CommandState; // donne l'etat de l'analyse des commandes gerber wxPoint m_CurrentPos; // current specified coord for plot wxPoint m_PreviousPos; // old current specified coord for plot diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index 7fa1649a42..79734ff8d8 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -26,11 +26,10 @@ static int distance(int seuil); /* Macro de calcul de la coord de pointage selon le curseur (ON/OFF grille) choisi -A REVOIR */ #define SET_REF_POS(ref) if(typeloc == CURSEUR_ON_GRILLE) \ { ref = ActiveScreen->m_Curseur;} \ - else { ref = ActiveScreen->m_Curseur; } + else { ref = ActiveScreen->m_MousePosition; } @@ -50,7 +49,7 @@ int layer; /* Localistion des pistes et vias, avec priorite aux vias */ layer = GetScreen()->m_Active_Layer; - Track = Locate_Pistes( m_Pcb->m_Track, NO_TST_LAYER,typeloc ); + Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc ); if ( Track != NULL ) { TrackLocate = Track ; /* Reperage d'une piste ou via */ diff --git a/gerbview/makefile.g95 b/gerbview/makefile.g95 index c83dbca06d..d8cb643eea 100644 --- a/gerbview/makefile.g95 +++ b/gerbview/makefile.g95 @@ -13,7 +13,7 @@ $(TARGET).exe: $(OBJECTS) $(TARGET)_resources.o $(EDALIB) $(CXX) $(ALL_LDFLAGS) -o $(TARGET).exe $(OBJECTS)\ $(TARGET)_resources.o $(EDALIBS) $(SYSWXLIB) -install: +install: $(TARGET).exe cp $(TARGET).exe $(KICAD_BIN) diff --git a/gerbview/makefile.gtk b/gerbview/makefile.gtk index 42d5f0cf94..325d96a6da 100644 --- a/gerbview/makefile.gtk +++ b/gerbview/makefile.gtk @@ -23,7 +23,7 @@ EDACPPFLAGS = $(CPPFLAGS) $(TARGET): $(OBJECTS) makefile.gtk makefile.include $(EXTRALIBS) ../libs.linux $(LD) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET) -install: +install: $(TARGET) cp $(TARGET) $(KICAD_BIN) diff --git a/gerbview/makefile.include b/gerbview/makefile.include index 5c42ca83b1..6c6857965c 100644 --- a/gerbview/makefile.include +++ b/gerbview/makefile.include @@ -1,169 +1,175 @@ -EXTRALIBS = ../common/common.a -EXTRACPPFLAGS= -DGERBVIEW -DPCBNEW -I./ -I../gerbview -I../include\ - -I../share -I../pcbnew -I../3d-viewer - -#COMMON = pcbnew.h struct.h - -OBJECTS= \ - $(TARGET).o\ +EXTRALIBS = ../common/common.a +EXTRACPPFLAGS= -DGERBVIEW -DPCBNEW -fno-strict-aliasing -I./ -I../gerbview -I../include\ + -I../share -I../pcbnew -I../3d-viewer + +#COMMON = pcbnew.h struct.h + +OBJECTS= \ + $(TARGET).o\ classpcb.o\ - lay2plot.o\ - wxprint.o \ - edit.o \ - setpage.o \ - tool_gerber.o \ - gerberframe.o\ - onrightclick.o\ - class_board.o\ - class_track.o \ - drawframe.o\ - drawpanel.o\ - set_color.o \ - cfg.o \ - cursors.o \ - affiche.o \ - tracepcb.o \ - class_pcb_text.o\ - trpiste.o \ - zoom.o\ - reglage.o \ - options.o \ - initpcb.o\ - locate.o\ - deltrack.o\ - pcbplot.o\ - readgerb.o\ - rs274d.o\ - rs274x.o\ - dcode.o\ - undelete.o\ - infospgm.o \ - struct.o \ - files.o\ - block.o\ - controle.o\ - basepcbframe.o + select_layers_to_pcb.o\ + sel_layer.o\ + lay2plot.o\ + wxprint.o \ + edit.o \ + setpage.o \ + tool_gerber.o \ + gerberframe.o\ + onrightclick.o\ + class_board.o\ + class_track.o \ + drawframe.o\ + drawpanel.o\ + set_color.o \ + cfg.o \ + cursors.o \ + affiche.o \ + tracepcb.o \ + class_pcb_text.o\ + trpiste.o \ + zoom.o\ + reglage.o \ + options.o \ + initpcb.o\ + locate.o\ + deltrack.o\ + pcbplot.o\ + readgerb.o\ + rs274d.o\ + rs274x.o\ + dcode.o\ + undelete.o\ + infospgm.o \ + struct.o \ + files.o\ + block.o\ + controle.o\ + basepcbframe.o\ + export_to_pcbnew.o + +setpage.o: ../share/setpage.cpp + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +drawpanel.o: ../share/drawpanel.cpp + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +drawframe.o: ../share/drawframe.cpp + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +controle.o: controle.cpp $(COMMON) + +set_color.o: set_color.cpp set_color.h $(COMMON) + +files.o: files.cpp $(COMMON) + +cursors.o: ../pcbnew/cursors.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp -setpage.o: ../share/setpage.cpp - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -drawpanel.o: ../share/drawpanel.cpp - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -drawframe.o: ../share/drawframe.cpp - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -controle.o: controle.cpp $(COMMON) - -set_color.o: set_color.cpp set_color.h $(COMMON) - -files.o: files.cpp $(COMMON) - -cursors.o: ../pcbnew/cursors.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -wxprint.o: ../share/wxprint.cpp ../share/dialog_print.cpp ../share/dialog_print.h $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -lay2plot.o: lay2plot.cpp $(COMMON) - -classpcb.o: ../pcbnew/classpcb.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_pcb_text.o: ../pcbnew/class_pcb_text.cpp ../pcbnew/class_pcb_text.h $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_board.o: ../pcbnew/class_board.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -basepcbframe.o: ../pcbnew/basepcbframe.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -class_track.o: ../pcbnew/class_track.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp - -$(TARGET).o: $(TARGET).cpp $(COMMON) - -cfg.o: cfg.cpp cfg.h $(COMMON) - -tracepcb.o: tracepcb.cpp $(COMMON) - -block.o: block.cpp $(COMMON) - -trpiste.o: trpiste.cpp $(COMMON) - -surbrill.o: surbrill.cpp $(COMMON) - -pcbtexte.o: pcbtexte.cpp $(COMMON) - -zoom.o: ../share/zoom.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -infospgm.o: ../share/infospgm.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -affiche.o: affiche.cpp $(COMMON) - -reglage.o: reglage.cpp $(COMMON) - -editrack.o: editrack.cpp $(COMMON) - -deltrack.o: deltrack.cpp $(COMMON) - -track.o: track.cpp $(COMMON) - -editrout.o: editrout.cpp autorout.h $(COMMON) - -editmod.o: editmod.cpp autorout.h $(COMMON) - -editpads.o: editpads.cpp $(COMMON) - -editedge.o: editedge.cpp $(COMMON) - -cotation.o: cotation.cpp $(COMMON) - -editexte.o: editexte.cpp $(COMMON) - -clean.o: clean.cpp autorout.h $(COMMON) - -pcbplot.o: pcbplot.cpp $(COMMON) - -plothpgl.o: plothpgl.cpp $(COMMON) - -plotgerb.o: plotgerb.cpp pcbplot.h $(COMMON) - -printps.o: printps.cpp pcbplot.h $(COMMON) - -readgerb.o: readgerb.cpp pcbplot.h $(COMMON) - -plot_rtn.o: plot_rtn.cpp pcbplot.h $(COMMON) - -gendrill.o: gendrill.cpp pcbplot.h $(COMMON) - -librairi.o: librairi.cpp autorout.h librairi.h $(COMMON) - -docedit.o: docedit.cpp $(COMMON) - -edgemod.o: edgemod.cpp $(COMMON) - -autorout.o: autorout.cpp cell.h autorout.fct autorout.h $(COMMON) - -setlayer.o: setlayer.cpp $(COMMON) - -dist.o: dist.cpp cell.h autorout.fct $(COMMON) - -zones.o: zones.cpp cell.h autorout.fct $(COMMON) - -undelete.o: undelete.cpp $(COMMON) - -ioascii.o: ioascii.cpp $(COMMON) - -chrono.o: chrono.cpp pcbnew.h - -struct.o: struct.cpp $(COMMON) - -coordbox.o: coordbox.cpp $(COMMON) - -mirepcb.o: mirepcb.cpp $(COMMON) - -dragsegm.o: dragsegm.cpp drag.h $(COMMON) +sel_layer.o: ../pcbnew/sel_layer.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +wxprint.o: ../share/wxprint.cpp ../share/dialog_print.cpp ../share/dialog_print.h $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +lay2plot.o: lay2plot.cpp $(COMMON) + +classpcb.o: ../pcbnew/classpcb.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_pcb_text.o: ../pcbnew/class_pcb_text.cpp ../pcbnew/class_pcb_text.h $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_board.o: ../pcbnew/class_board.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +basepcbframe.o: ../pcbnew/basepcbframe.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +class_track.o: ../pcbnew/class_track.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp + +$(TARGET).o: $(TARGET).cpp $(COMMON) + +cfg.o: cfg.cpp cfg.h $(COMMON) + +tracepcb.o: tracepcb.cpp $(COMMON) + +block.o: block.cpp $(COMMON) + +trpiste.o: trpiste.cpp $(COMMON) + +surbrill.o: surbrill.cpp $(COMMON) + +pcbtexte.o: pcbtexte.cpp $(COMMON) + +zoom.o: ../share/zoom.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +infospgm.o: ../share/infospgm.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +affiche.o: affiche.cpp $(COMMON) + +reglage.o: reglage.cpp $(COMMON) + +editrack.o: editrack.cpp $(COMMON) + +deltrack.o: deltrack.cpp $(COMMON) + +track.o: track.cpp $(COMMON) + +editrout.o: editrout.cpp autorout.h $(COMMON) + +editmod.o: editmod.cpp autorout.h $(COMMON) + +editpads.o: editpads.cpp $(COMMON) + +editedge.o: editedge.cpp $(COMMON) + +cotation.o: cotation.cpp $(COMMON) + +editexte.o: editexte.cpp $(COMMON) + +clean.o: clean.cpp autorout.h $(COMMON) + +pcbplot.o: pcbplot.cpp $(COMMON) + +plothpgl.o: plothpgl.cpp $(COMMON) + +plotgerb.o: plotgerb.cpp pcbplot.h $(COMMON) + +printps.o: printps.cpp pcbplot.h $(COMMON) + +readgerb.o: readgerb.cpp pcbplot.h $(COMMON) + +plot_rtn.o: plot_rtn.cpp pcbplot.h $(COMMON) + +gendrill.o: gendrill.cpp pcbplot.h $(COMMON) + +librairi.o: librairi.cpp autorout.h librairi.h $(COMMON) + +docedit.o: docedit.cpp $(COMMON) + +edgemod.o: edgemod.cpp $(COMMON) + +autorout.o: autorout.cpp cell.h autorout.fct autorout.h $(COMMON) + +setlayer.o: setlayer.cpp $(COMMON) + +dist.o: dist.cpp cell.h autorout.fct $(COMMON) + +zones.o: zones.cpp cell.h autorout.fct $(COMMON) + +undelete.o: undelete.cpp $(COMMON) + +ioascii.o: ioascii.cpp $(COMMON) + +chrono.o: chrono.cpp pcbnew.h + +struct.o: struct.cpp $(COMMON) + +coordbox.o: coordbox.cpp $(COMMON) + +mirepcb.o: mirepcb.cpp $(COMMON) + +dragsegm.o: dragsegm.cpp drag.h $(COMMON) diff --git a/gerbview/makefile.macosx b/gerbview/makefile.macosx index fb91ed839e..256b3aeb9d 100644 --- a/gerbview/makefile.macosx +++ b/gerbview/makefile.macosx @@ -13,11 +13,12 @@ include ../libs.macosx TARGET = gerbview -all: $(TARGET) +all: $(TARGET) $(TARGET).app include makefile.include CPPFLAGS += $(EXTRACPPFLAGS) +CPPFLAGS += -arch i386 -arch ppc EDACPPFLAGS = $(CPPFLAGS) @@ -25,6 +26,22 @@ $(TARGET): $(OBJECTS) $(TARGET).r makefile.macosx makefile.include $(EXTRALIBS) $(LD) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET) $(RESCOMP) -o $(TARGET) Carbon.r $(TARGET).r $(SETFILE) -a C $(TARGET) + +$(TARGET).app: $(OBJS) + rm -Rf $(TARGET).app + mkdir -p $(TARGET).app + mkdir -p $(TARGET).app/Contents + mkdir -p $(TARGET).app/Contents/MacOS + mkdir -p $(TARGET).app/Contents/Frameworks + mkdir -p $(TARGET).app/Contents/Resources + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/" \ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/wxmac.icns \ + >$(TARGET).app/Contents/Resources/wxmac.icns + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/"\ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/Info.plist.in \ + >$(TARGET).app/Contents/Info.plist + echo -n "APPL????" >$(TARGET).app/Contents/PkgInfo + ln -f $(TARGET) $(TARGET).app/Contents/MacOS/$(TARGET) install: diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index 3254eebb4b..303f040571 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -60,15 +60,18 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); } if ( BlockActive ) return; + + PopMenu->Append(ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, _("Delete Dcode items")); if ( DrawStruct == NULL ) return; GetScreen()->m_CurrentItem = DrawStruct; switch ( DrawStruct->m_StructType ) - { + { case TYPETRACK: +// PopMenu->AppendSeparator(); // PopMenu->Append(ID_POPUP_PCB_EDIT_TRACK, _("Edit")); // PopMenu->Append(ID_POPUP_PCB_DELETE_TRACKSEG, _("Delete")); break; @@ -76,11 +79,11 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); default: msg.Printf( - wxT("WinEDA_GerberFrame::OnRightClick Error: iilegal or unknown DrawType %d"), + wxT("WinEDA_GerberFrame::OnRightClick Error: illegal or unknown DrawType %d"), DrawStruct->m_StructType); DisplayError(this, msg ); break; - } + } PopMenu->AppendSeparator(); } diff --git a/gerbview/protos.h b/gerbview/protos.h index 63f9497c7b..5e9d9da432 100644 --- a/gerbview/protos.h +++ b/gerbview/protos.h @@ -1,5 +1,10 @@ /* declarations prototype */ +/***************************/ +/* select_layers_to_pcb.cpp*/ +/***************************/ +int * InstallDialogLayerPairChoice(WinEDA_GerberFrame * parent); + /****************/ /* undelete.cpp */ /****************/ diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 0af784f871..dba59fe96b 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -166,6 +166,7 @@ wxBusyCursor show_wait; { switch( *text ) { + case ' ': case '\r': case '\n': text ++; @@ -186,7 +187,7 @@ wxBusyCursor show_wait; gerber_layer->Execute_G_Command(text, G_commande); break ; - case 'D': /* Ligne type Dxx : Selection d'un outil */ + case 'D': /* Ligne type Dxx : Selection d'un outil ou commande si xx = 0..9*/ D_commande = gerber_layer->ReturnDCodeNumber(text); gerber_layer->Execute_DCODE_Command(this, DC, text, D_commande); @@ -195,6 +196,11 @@ wxBusyCursor show_wait; case 'X': case 'Y': /* Commande de deplacement ou de Trace */ pos = gerber_layer->ReadXYCoord(text); + if ( *text == '*' ) // command like X12550Y19250* + { + gerber_layer->Execute_DCODE_Command(this, DC, text, + gerber_layer->m_Last_Pen_Command); + } break; case 'I': diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index a2a1c44b1d..109954b45b 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -616,7 +616,7 @@ int shape = 1, dcode = 0; D_CODE * pt_Tool = NULL; wxString msg; - if(D_commande >= FIRST_DCODE ) + if(D_commande >= FIRST_DCODE ) // This is a "Set tool" command { if (D_commande > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1; m_Current_Tool = D_commande; @@ -625,7 +625,12 @@ wxString msg; return TRUE; } - if ( m_PolygonFillMode ) // Enter a plygon description: + else // D_commande = 0..9: this is a pen command (usualy D1, D2 or D3) + { + m_Last_Pen_Command = D_commande; + } + + if ( m_PolygonFillMode ) // Enter a polygon description: { switch ( D_commande ) { diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index bd53a02893..44888a7b6a 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -13,7 +13,8 @@ #define IsNumber(x) ( ( ((x) >= '0') && ((x) <='9') ) ||\ ((x) == '-') || ((x) == '+') || ((x) == '.') || ((x) == ',')) -#define CODE(x,y) ((x<<8) + (y)) +#define CODE(x,y) ((x<<8) + (y)) + enum rs274x_parameters { FORMAT_STATEMENT_COMMAND = CODE('F','S'), @@ -74,15 +75,18 @@ static int ReadInt(char * &text) /********************************/ { int nb = 0; + + while ( text && *text == ' ' ) text++; // Skip blanks before number + while ( text && *text) - { + { if ( (*text >= '0') && (*text <='9') ) - { + { nb *= 10; nb += *text & 0x0F; text++; - } - else break; } + else break; + } return nb; } @@ -95,6 +99,7 @@ double nb = 0.0; char buf[256], * ptchar; ptchar = buf; + while ( text && *text == ' ' ) text++; // Skip blanks before number while ( text && *text) { if ( IsNumber(*text) ) @@ -188,6 +193,9 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; { switch ( *text ) { + case ' ': + text++; + break; case'L': // No Leading 0 m_NoTrailingZeros = FALSE; text ++; @@ -279,7 +287,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case ROTATE: msg.Printf(_("Command <%c%c> ignored by Gerbview"), (command>>8) & 0xFF, command & 0xFF); - wxMessageBox(msg); + if ( g_DebugLevel > 0 )wxMessageBox(msg); break; case IMAGE_NAME: @@ -347,6 +355,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; { case 'C': // Circle dcode->m_Shape = GERB_CIRCLE; + while ( * text == ' ' ) text++; if ( * text == 'X' ) { text++; @@ -354,6 +363,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; (int) round(ReadDouble(text) * conv_scale); dcode->m_DrillShape = 1; } + while ( * text == ' ' ) text++; if ( * text == 'X' ) { text++; @@ -367,12 +377,14 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case 'O': // ovale case 'R': // rect dcode->m_Shape = (ctmp == 'O') ? GERB_OVALE : GERB_RECT; + while ( * text == ' ' ) text++; if ( * text == 'X' ) { text++; dcode->m_Size.y = (int) round(ReadDouble(text) * conv_scale); } + while ( * text == ' ' ) text++; if ( * text == 'X' ) { text++; @@ -380,6 +392,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; (int) round(ReadDouble(text) * conv_scale); dcode->m_DrillShape = 1; } + while ( * text == ' ' ) text++; if ( * text == 'Y' ) { text++; @@ -444,7 +457,7 @@ int macro_type = 0; text ++; } -wxMessageBox(macro_name, wxT("macro name")); + if ( g_DebugLevel > 0 ) wxMessageBox(macro_name, wxT("macro name")); text = buff; fgets(buff,255,gerber_file); diff --git a/gerbview/select_layers_to_pcb.cpp b/gerbview/select_layers_to_pcb.cpp new file mode 100644 index 0000000000..7c7e344d6f --- /dev/null +++ b/gerbview/select_layers_to_pcb.cpp @@ -0,0 +1,233 @@ + /*******************************************************/ + /* Dialog frame to choose gerber layers and pcb layers */ + /*******************************************************/ + + /* select_layers_to_pcb.cpp*/ + +#include "fctsys.h" +#include "common.h" +#include "gerbview.h" + +#include "protos.h" + + +/* Variables locales */ +static int LayerLookUpTable[32]; + +enum swap_layer_id { + ID_SWAP_LAYER_EXECUTE = 1800, + ID_SWAP_LAYER_CANCEL, + ID_SWAP_LAYER_BUTTON_SELECT, + ID_SWAP_LAYER_DESELECT, + ID_SWAP_LAYER_SELECT +}; + + +/***********************************************/ +/* classe pour la frame de selection de layers */ +/***********************************************/ + +class WinEDA_SwapLayerFrame: public wxDialog +{ +private: + WinEDA_GerberFrame *m_Parent; + wxRadioBox * m_LayerList; + +public: + + // Constructor and destructor + WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent); + ~WinEDA_SwapLayerFrame(void) {}; + +private: + void Sel_Layer(wxCommandEvent& event); + void Cancel(wxCommandEvent& event); + void Execute(wxCommandEvent& event); + DECLARE_EVENT_TABLE() + +}; +/* Table des evenements pour WinEDA_SwapLayerFrame */ +BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog) + EVT_BUTTON(ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute) + EVT_BUTTON(ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel) + EVT_BUTTON(ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer) + EVT_BUTTON(ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) + EVT_RADIOBOX(ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) +END_EVENT_TABLE() + + +/*************************************************************/ +int * InstallDialogLayerPairChoice(WinEDA_GerberFrame * parent) +/*************************************************************/ +/* Install a dialog frame to choose the equivalence + between gerber layers and pcbnew layers + return the "lookup table" if ok, or NULL +*/ +{ + WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(parent); + int ii = frame->ShowModal(); frame->Destroy(); + if ( ii >= 0 ) return LayerLookUpTable; + else return NULL; +} + +/*************************************************************************/ +WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent): + wxDialog(parent, -1, _("Layer selection:"),wxPoint(-1,-1), + wxDefaultSize, DIALOG_STYLE ) +/*************************************************************************/ +{ +wxButton * Button; +int ii, nb_items; +wxString g_Layer_Name_Pair[32]; + + m_Parent = parent; + SetFont(*g_DialogFont); + + /* Compute a resonnable number of copper layers */ + g_DesignSettings.m_CopperLayerCount = 0; + for ( ii = 0; ii < NB_LAYERS; ii++ ) + { + if ( g_GERBER_Descr_List[ii] != NULL) + g_DesignSettings.m_CopperLayerCount++; + } + + int pcb_layer_number = 0; + for ( nb_items = 0, ii = 0; ii < NB_LAYERS; ii++ ) + { + if ( g_GERBER_Descr_List[ii] == NULL ) + { + LayerLookUpTable[ii] = -1; + continue; + } + if ( (pcb_layer_number == g_DesignSettings.m_CopperLayerCount-1) + && (g_DesignSettings.m_CopperLayerCount > 1) ) + pcb_layer_number = CMP_N; + LayerLookUpTable[ii] = pcb_layer_number; + g_Layer_Name_Pair[ii] = _("Gerber layer "); + g_Layer_Name_Pair[ii] << ii+1 + << wxT(" -> ") << ReturnPcbLayerName(pcb_layer_number); + nb_items++; + pcb_layer_number++; + } + + wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxHORIZONTAL); + SetSizer(FrameBoxSizer); + wxBoxSizer* LeftBoxSizer = new wxBoxSizer(wxVERTICAL); + FrameBoxSizer->Add(LeftBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxBoxSizer* RightBoxSizer = new wxBoxSizer(wxVERTICAL); + FrameBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_LayerList = new wxRadioBox(this, ID_SWAP_LAYER_SELECT, _("Layers"), + wxDefaultPosition, wxDefaultSize, + nb_items, g_Layer_Name_Pair, + nb_items < 16 ? nb_items :16, + wxRA_SPECIFY_ROWS); + LeftBoxSizer->Add(m_LayerList, 0, wxGROW|wxALL, 5); + + Button = new wxButton(this,ID_SWAP_LAYER_CANCEL, _("Cancel")); + Button->SetForegroundColour(*wxRED); + RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); + + Button = new wxButton(this,ID_SWAP_LAYER_EXECUTE, _("OK")); + Button->SetForegroundColour(*wxBLUE); + RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); + + Button = new wxButton(this,ID_SWAP_LAYER_DESELECT, _("Deselect")); + Button->SetForegroundColour(wxColour(0,100,0)); + RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); + + Button = new wxButton(this,ID_SWAP_LAYER_BUTTON_SELECT, _("Select")); + Button->SetForegroundColour(wxColour(0,100,100)); + RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); + + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } +} + + +/***************************************************************/ +void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event) +/***************************************************************/ +{ +int ii, jj; +int gerber_layer_number; +wxString msg; + + ii = m_LayerList->GetSelection(); + if ( ii < 0 ) return; + /* Search the gerber layer number correspondint to the selection */ + for ( jj = 0, gerber_layer_number = 0; gerber_layer_number < 32; gerber_layer_number++ ) + { + if ( g_GERBER_Descr_List[gerber_layer_number] == NULL) continue; + if (jj == ii ) break; + jj++; + } + + + switch ( event.GetId()) + { + case ID_SWAP_LAYER_DESELECT: + if ( LayerLookUpTable[gerber_layer_number] != -1 ) + { + LayerLookUpTable[gerber_layer_number] = -1; + msg = _("Gerber layer "); + msg << gerber_layer_number+1 << wxT(" -> ") << _("Do not export"); + m_LayerList->SetString(ii, msg ); + } + break; + + case ID_SWAP_LAYER_BUTTON_SELECT: + case ID_SWAP_LAYER_SELECT: + jj = m_Parent->SelectLayer(ii, -1, -1); + if ( (jj < 0) || (jj >= 29) ) return; + + if ( ii != jj ) + { + LayerLookUpTable[gerber_layer_number] = jj; + msg = _("Gerber layer "); + msg << gerber_layer_number+1 << wxT(" -> ") << ReturnPcbLayerName(jj); + m_LayerList->SetString(ii, msg ); + } + break; + } +} + +/*********************************************************/ +void WinEDA_SwapLayerFrame::Cancel(wxCommandEvent& event) +/*********************************************************/ +{ + EndModal(-1); +} + +/*********************************************************/ +void WinEDA_SwapLayerFrame::Execute(wxCommandEvent& event) +/*********************************************************/ +{ +int ii; +bool AsCmpLayer = false; + + /* Compute the number of copper layers + this is the max layer number + 1 (if some internal layers exists) + */ + g_DesignSettings.m_CopperLayerCount = 1; + for ( ii = 0; ii < 32; ii++ ) + { + if ( LayerLookUpTable[ii] == CMP_N ) AsCmpLayer = true; + else + { + if ( LayerLookUpTable[ii] >= CMP_N ) continue; // not a copper layer + if ( LayerLookUpTable[ii] >= g_DesignSettings.m_CopperLayerCount ) + g_DesignSettings.m_CopperLayerCount++; + } + } + + if ( AsCmpLayer ) g_DesignSettings.m_CopperLayerCount++; + if ( g_DesignSettings.m_CopperLayerCount > CMP_N+1 ) // should not occur. + g_DesignSettings.m_CopperLayerCount = CMP_N+1; + + EndModal(1); +} + + diff --git a/gerbview/set_color.cpp b/gerbview/set_color.cpp index a98035860d..9ea9e6358a 100644 --- a/gerbview/set_color.cpp +++ b/gerbview/set_color.cpp @@ -292,6 +292,7 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y; iconDC.SetBrush(Brush); iconDC.DrawRectangle(0,0, w, h); + Button->SetBitmapLabel(ButtBitmap); SetDisplayOnOff(event); m_Parent->GetScreen()->SetRefreshReq(); } diff --git a/gerbview/tool_gerber.cpp b/gerbview/tool_gerber.cpp index 94b3cf1f60..11def72324 100644 --- a/gerbview/tool_gerber.cpp +++ b/gerbview/tool_gerber.cpp @@ -1,6 +1,6 @@ - /***********************************************/ - /* buildmnu.h: construction du menu principal */ - /***********************************************/ + /***************************************************/ + /* tool_gerber.cpp: Build tool bars and main menu */ + /***************************************************/ #include "fctsys.h" @@ -17,6 +17,159 @@ #include "id.h" +/***********************************************/ +void WinEDA_GerberFrame::ReCreateMenuBar(void) +/***********************************************/ +/* Cree ou reinitialise le menu du haut d'ecran +*/ +{ +int ii; +wxMenuBar * menuBar = GetMenuBar(); + + if( menuBar == NULL ) + { + menuBar = new wxMenuBar(); + + m_FilesMenu = new wxMenu; + m_FilesMenu->Append(ID_MENU_LOAD_FILE, + _("Clear and Load gerber file"), + _("Clear all layers and Load new gerber file"), + FALSE); + + m_FilesMenu->Append(ID_MENU_APPEND_FILE, + _("Load gerber file"), + _("Load new gerber file on currrent layer"), + FALSE); + + m_FilesMenu->Append(ID_MENU_INC_LAYER_AND_APPEND_FILE, + _("Inc Layer and load gerber file"), + _("Increment layer number, and Load gerber file"), + FALSE); + + m_FilesMenu->Append(ID_GERBVIEW_LOAD_DCODE_FILE, + _("Load DCodes"), + _("Load D-Codes File"), + FALSE); +#if 0 + m_FilesMenu->Append(ID_GERBVIEW_LOAD_DRILL_FILE, + _("Load Drill"), + _("Load Drill File (EXCELLON Format)"), + FALSE); +#endif + + m_FilesMenu->Append(ID_MENU_NEW_BOARD, + _("&New"), + _("Clear all layers"), + FALSE); + + m_FilesMenu->AppendSeparator(); + m_FilesMenu->Append(ID_GERBVIEW_EXPORT_TO_PCBNEW, + _("&Export to Pcbnew"), + _("Export data in pcbnew format"), + FALSE); + +#if 0 + m_FilesMenu->AppendSeparator(); + m_FilesMenu->Append(ID_MENU_SAVE_BOARD, + _("&Save layers"), + _("Save current layers (GERBER format)"), + FALSE); + + m_FilesMenu->Append(ID_MENU_SAVE_BOARD_AS, + _("Save layers as.."), + _("Save current layers as.."), + FALSE); +#endif + + m_FilesMenu->AppendSeparator(); + + m_FilesMenu->Append(ID_GEN_PRINT, _("P&rint"), _("Print on current printer")); + m_FilesMenu->Append(ID_GEN_PLOT, + _("Plot"), _("Plotting in various formats") ); + + m_FilesMenu->AppendSeparator(); + m_FilesMenu->Append(ID_EXIT,_("E&xit"), _("Quit Gerbview") ); + + // Creation des selections des anciens fichiers + m_FilesMenu->AppendSeparator(); + for ( int ii = 0; ii < 10; ii++ ) + { + if ( GetLastProject(ii).IsEmpty() ) break; + m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); + } + + // Configuration: + wxMenu * configmenu = new wxMenu; + configmenu->Append(ID_CONFIG_REQ, _("&Files and Dir"), + _("Setting Files extension, Directories and others...")); + configmenu->Append(ID_COLORS_SETUP, _("&Colors"), + _("Select Colors and Display for layers")); + configmenu->Append(ID_OPTIONS_SETUP, _("&Options"), + _(" Select general options")); + + configmenu->Append(ID_PCB_LOOK_SETUP, _("Display"), + _(" Select how items are displayed")); + + // Font selection and setup + AddFontSelectionMenu(configmenu); + + m_Parent->SetLanguageList(configmenu); + + configmenu->AppendSeparator(); + configmenu->Append(ID_CONFIG_SAVE, _("&Save Gerbview Setup"), + _("Save options in current directory")); + + // Menu drill ( generation fichiers percage) +/* wxMenu *drill_menu = new wxMenu; + postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file", + "Gen Drill (EXCELLON] file and/or Drill sheet"); +*/ + // Menu d'outils divers + wxMenu *miscellaneous_menu = new wxMenu; + miscellaneous_menu->Append(ID_GERBVIEW_SHOW_LIST_DCODES, _("&List DCodes"), + _("List and Edit DCodes") ); + miscellaneous_menu->Append(ID_GERBVIEW_SHOW_SOURCE,_("&Show source"), + _("Show source file for the current layer") ); + miscellaneous_menu->AppendSeparator(); + miscellaneous_menu->Append(ID_PCB_GLOBAL_DELETE, _("&Delete Layer"), + _("Delete current layer") ); + + // Menu Help: + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(ID_GENERAL_HELP, _("&Help"), _("On line doc") ); + helpMenu->Append(ID_KICAD_ABOUT, _("&About"), _("Gerbview Infos") ); + + menuBar->Append(m_FilesMenu, _("&Files")); + menuBar->Append(configmenu, _("&Preferences")); + menuBar->Append(miscellaneous_menu, _("&Miscellaneous")); +// menuBar->Append(drill_menu, _("&Drill")); + menuBar->Append(helpMenu, _("&Help")); + + // Associate the menu bar with the frame + SetMenuBar(menuBar); + } + + else // simple mise a jour de la liste des fichiers anciens + { + wxMenuItem * item; + int max_file = m_Parent->m_LastProjectMaxCount; + for ( ii = max_file-1; ii >=0 ; ii-- ) + { + if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) + { + item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); + if ( item ) delete item; + } + } + for ( ii = 0; ii < max_file; ii++ ) + { + if ( GetLastProject(ii).IsEmpty() ) break; + m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); + } + } +} + + /***********************************************/ void WinEDA_GerberFrame::ReCreateHToolbar(void) /***********************************************/ diff --git a/gerbview/tracepcb.cpp b/gerbview/tracepcb.cpp index d24cd24e0e..087f7f2e23 100644 --- a/gerbview/tracepcb.cpp +++ b/gerbview/tracepcb.cpp @@ -44,7 +44,7 @@ DISPLAY_OPTIONS save_opt; ((WinEDA_GerberFrame*)m_Parent)->Trace_Gerber(DC, GR_COPY); if ( Print_Sheet_Ref ) - m_Parent->TraceWorkSheet(DC, GetScreen()); + m_Parent->TraceWorkSheet(DC, GetScreen(), 0); DisplayOpt = save_opt; } @@ -66,7 +66,7 @@ PCB_SCREEN * screen = GetScreen(); DrawPanel->DrawBackGround(DC); Trace_Gerber(DC, GR_OR); - TraceWorkSheet(DC, screen); + TraceWorkSheet(DC, screen, 0); Affiche_Status_Box(); if( DrawPanel->ManageCurseur ) diff --git a/gerbview/trpiste.cpp b/gerbview/trpiste.cpp index 940856979e..8fab8743c1 100644 --- a/gerbview/trpiste.cpp +++ b/gerbview/trpiste.cpp @@ -82,15 +82,15 @@ static bool show_err; if ( (l_piste/zoom) < L_MIN_DESSIN) { GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - rayon , color) ; + rayon , 0, color) ; } if( fillopt == SKETCH) { GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - rayon-l_piste, color); + rayon-l_piste, 0, color); GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - rayon+l_piste, color); + rayon+l_piste, 0, color); } else { @@ -105,7 +105,7 @@ static bool show_err; { GRArc1(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, track->m_End.x, track->m_End.y, - track->m_Param, track->m_Sous_Netcode, color); + track->m_Param, track->m_Sous_Netcode, 0, color); } else { @@ -122,18 +122,18 @@ static bool show_err; if ( (rayon/zoom) < L_MIN_DESSIN) { GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - rayon , color) ; + rayon , 0, color) ; } else if( fillopt == SKETCH ) { GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - rayon, color); + rayon, 0, color); } else { GRFilledCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - rayon, color, color); + rayon, 0, color, color); } break; @@ -143,7 +143,7 @@ static bool show_err; if ( (l_piste/zoom) < L_MIN_DESSIN) { GRLine(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, color); + track->m_End.x, track->m_End.y, 0, color); } else if( fillopt == SKETCH ) { @@ -152,7 +152,7 @@ static bool show_err; track->m_Start.y - l_piste, track->m_End.x + l_piste, track->m_End.y + l_piste, - color) ; + 0, color) ; } else { @@ -161,7 +161,7 @@ static bool show_err; track->m_Start.y - l_piste, track->m_End.x + l_piste, track->m_End.y + l_piste, - color, color) ; + 0, color, color) ; } break; @@ -171,7 +171,7 @@ static bool show_err; if ( (l_piste/zoom) < L_MIN_DESSIN) { GRLine(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, - track->m_End.x, track->m_End.y, color); + track->m_End.x, track->m_End.y, 0, color); break; } @@ -242,12 +242,12 @@ int rayon; rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) ); if ( mode == FILAIRE) { - GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, color) ; + GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, 0, color) ; } else if( mode == SKETCH) { - GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon-l_piste, color); - GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon+l_piste, color); + GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon-l_piste, 0, color); + GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon+l_piste, 0, color); } else { @@ -262,12 +262,12 @@ int rayon; StAngle = (int) ArcTangente(dy-uy0, dx-ux0); EndAngle = StAngle + PtDrawSegment->m_Angle; if ( mode == FILAIRE) - GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color); + GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, 0, color); else if( mode == SKETCH) { - GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc(&panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle, rayon - l_piste, color); - GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc(&panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle, rayon + l_piste, color); } else @@ -281,7 +281,7 @@ int rayon; default: if( mode == FILAIRE) - GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, color) ; + GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color) ; else if( mode == SKETCH) { GRCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, diff --git a/include/appl_wxstruct.h b/include/appl_wxstruct.h index 996af6389d..2a8921a8c9 100644 --- a/include/appl_wxstruct.h +++ b/include/appl_wxstruct.h @@ -63,6 +63,7 @@ public: WinEDA_App(void); ~WinEDA_App(void); bool OnInit(void); + int OnRun(void); bool SetBinDir(void); void InitEDA_Appl(const wxString & name); diff --git a/include/base_struct.h b/include/base_struct.h index 84f19d4854..fe66046670 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -74,7 +74,7 @@ public: EDA_BaseStruct *m_Son; /* Linked list: Link (son struct) */ EDA_BaseStruct *m_Image; /* Link to an image copy for undelete or abort command */ int m_Flags; // flags for editions and other - long m_TimeStamp; // Time stamp used for logical links + unsigned long m_TimeStamp; // Time stamp used for logical links int m_Selected; /* Used by block commands, and selective editing */ private: diff --git a/include/bitmaps.h b/include/bitmaps.h index 44a01bfab1..8921861746 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -5,6 +5,11 @@ #include "../bitmaps/Cancel.xpm" #include "../bitmaps/cancel_tool.xpm" #include "../bitmaps/Apply.xpm" + + #include "../bitmaps/icon_txt.xpm" + #include "../bitmaps/new_txt.xpm" + #include "../bitmaps/directory.xpm" + #include "../bitmaps/icon_python_small.xpm" #include "../bitmaps/Fonts.xpm" @@ -144,6 +149,7 @@ #include "../bitmaps/icon_pcbnew.xpm" #include "../bitmaps/icon_modedit.xpm" #include "../bitmaps/Info.xpm" + #include "../bitmaps/icon_python.xpm" #include "../bitmaps/mirepcb.xpm" #include "../bitmaps/icon_3d.xpm" #include "../bitmaps/drc_off.xpm" diff --git a/include/build_version.h b/include/build_version.h index d18745186b..e4b2481d61 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-01-15)")) + (wxT("(2007-05-25)")) #endif ; diff --git a/include/colors.h b/include/colors.h index 2c716c69b2..23af5f0e57 100644 --- a/include/colors.h +++ b/include/colors.h @@ -87,7 +87,4 @@ StructColors ColorRefs[NBCOLOR] = #endif /* ifdef MAIN */ -COMMON_GLOBL wxPen * DrawPen; -COMMON_GLOBL wxBrush * DrawBrush; - #endif /* ifndef _COLORS_H */ diff --git a/include/common.h b/include/common.h index 90512dc783..a34e837d3b 100644 --- a/include/common.h +++ b/include/common.h @@ -48,11 +48,19 @@ enum pseudokeys { #define GERBVIEW_EXE wxT("gerbview.exe") #else +#ifndef __WXMAC__ #define CVPCB_EXE wxT("cvpcb") #define PCBNEW_EXE wxT("pcbnew") #define EESCHEMA_EXE wxT("eeschema") #define GERBVIEW_EXE wxT("gerbview") #endif +#ifdef __WXMAC__ +#define CVPCB_EXE wxT("cvpcb.app") +#define PCBNEW_EXE wxT("pcbnew.app") +#define EESCHEMA_EXE wxT("eeschema.app") +#define GERBVIEW_EXE wxT("gerbview.app") +#endif +#endif @@ -203,7 +211,7 @@ private: /* Gestion des feuilles de tracé: */ class Ki_PageDescr -{ +{ // All sizes are in 1/1000 inch public: wxSize m_Size ; /* page size in 1/1000 inch */ @@ -264,8 +272,8 @@ COMMON_GLOBL wxString g_UserLibDirBuffer; // Chemin des librairies de module don // le file de config /* variables globales generales */ - -COMMON_GLOBL int g_FloatSeparator; // = '.' ou = ',' selon locale pour l'ecriture des nombres flotttant + +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; @@ -284,7 +292,7 @@ COMMON_GLOBL int g_MsgFontPointSize; /* taille de la fonte */ COMMON_GLOBL int g_FontMinPointSize; /* taille minimum des fontes */ COMMON_GLOBL bool g_IsPrinting; // TRUE si impression au lieu de trace a l'ecran -COMMON_GLOBL bool g_ShowPageLimits // TRUE to display the page limits +COMMON_GLOBL bool g_ShowPageLimits // TRUE to display the page limits #ifdef EDA_BASE = TRUE #endif @@ -312,9 +320,9 @@ int g_UserGrid_Unit = INCHES; extern wxRealPoint g_UserGrid; extern int g_UserGrid_Unit; #endif - -COMMON_GLOBL int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2 - + +COMMON_GLOBL int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2 + // shape selector for cursor screen COMMON_GLOBL int g_CursorShape; @@ -389,6 +397,8 @@ int Get_Message(const wxString & titre, wxString & buffer, wxWindow * frame) ; /************************/ wxString GetEditorName(void); // Return the prefered editor name +void OpenPDF( const wxString & file ); +void OpenFile( const wxString & file ); bool EDA_DirectorySelector(const wxString & Title, /* Titre de la fenetre */ @@ -516,13 +526,8 @@ bool WildCompareString(const wxString & pattern, const wxString & string_to_tst, retourne TRUE si match FALSE si differences */ char * to_point(char * Text); - /* convertit les , en . dans une chaine. utilisé pour compenser un defaut de la fct printf sous linux-mandrake - qui genere les flottants avec une virgule au lieu du point */ - -char * from_point(char * Text); - /* convertit les . en , dans une chaine. utilisé pour compenser - la francisation imbecile de la fct scanf sous linux-mandrake ou mingw - qui lit les flottants avec une virgule au lieu du point */ + /* convertit les , en . dans une chaine. utilisé pour compenser la fct printf + qui genere les flottants avec une virgule au lieu du point en mode international */ /****************/ /* infospgm.cpp */ @@ -531,8 +536,8 @@ void Print_Kicad_Infos(wxWindow * frame); /**************/ /* common.cpp */ -/**************/ -wxString GetBuildVersion(void); /* Return the build date */ +/**************/ +wxString GetBuildVersion(void); /* Return the build date */ void Affiche_1_Parametre(WinEDA_DrawFrame * frame , int pos_X,const wxString& texte_H,const wxString& texte_L,int color); @@ -563,21 +568,21 @@ void valeur_param(int valeur,wxString & buf_texte); entree : valeur en mils , buffer de texte retourne en buffer : texte : valeur exprimee en pouces ou millimetres suivie de " ou mm -*/ - -wxString ReturnUnitSymbol(int Units = g_UnitMetric); -int ReturnValueFromString(int Units, const wxString & TextValue, int Internal_Unit); -wxString ReturnStringFromValue(int Units, int Value, int Internal_Unit); -void AddUnitSymbol(wxStaticText & Stext, int Units = g_UnitMetric); - /* Add string " (mm):" or " ("):" to the static text Stext. - Used in dialog boxes for entering values depending on selected units */ -void PutValueInLocalUnits(wxTextCtrl & TextCtr, int Value, int Internal_Unit); - /* Convert the number Value in a string according to the internal units - and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl */ -int ReturnValueFromTextCtrl(const wxTextCtrl & TextCtr, int Internal_Unit); - /* Convert the Value in the wxTextCtrl TextCtrl in an integer, - according to the internal units and the selected unit (g_UnitMetric) */ - +*/ + +wxString ReturnUnitSymbol(int Units = g_UnitMetric); +int ReturnValueFromString(int Units, const wxString & TextValue, int Internal_Unit); +wxString ReturnStringFromValue(int Units, int Value, int Internal_Unit); +void AddUnitSymbol(wxStaticText & Stext, int Units = g_UnitMetric); + /* Add string " (mm):" or " ("):" to the static text Stext. + Used in dialog boxes for entering values depending on selected units */ +void PutValueInLocalUnits(wxTextCtrl & TextCtr, int Value, int Internal_Unit); + /* Convert the number Value in a string according to the internal units + and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl */ +int ReturnValueFromTextCtrl(const wxTextCtrl & TextCtr, int Internal_Unit); + /* Convert the Value in the wxTextCtrl TextCtrl in an integer, + according to the internal units and the selected unit (g_UnitMetric) */ + double To_User_Unit(bool is_metric, int val,int internal_unit_value); int From_User_Unit(bool is_metric, double val,int internal_unit_value); wxString GenDate(void); diff --git a/include/dcsvg.h b/include/dcsvg.h index 23530f9e14..8a3b3a3d4c 100644 --- a/include/dcsvg.h +++ b/include/dcsvg.h @@ -3,21 +3,13 @@ #include "wx/wfstream.h" #include "wx/string.h" -#ifdef WXMAKINGDLL_SVG - #define WXDLLIMPEXP_SVG WXEXPORT -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_SVG WXIMPORT -#else // not making nor using DLL - #define WXDLLIMPEXP_SVG -#endif - #define wxSVGVersion wxT("v0101") #ifdef __BORLANDC__ #pragma warn -rch #pragma warn -ccc #endif -class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC +class wxSVGFileDC : public wxDC { private: diff --git a/include/drawpanel_wxstruct.h b/include/drawpanel_wxstruct.h index 0b9a719ee0..845eadd511 100644 --- a/include/drawpanel_wxstruct.h +++ b/include/drawpanel_wxstruct.h @@ -168,6 +168,7 @@ public: wxPoint m_DrawOrg; /* offsets pour tracer le circuit sur l'ecran */ wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */ wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */ + wxPoint m_MousePositionInPixels; /* Mouse cursor coordinate (off grid) in pixels. */ wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid) in user units. (coordinates from last reset position)*/ wxPoint m_ScrollbarPos; // Position effective des Curseurs de scroll @@ -229,6 +230,8 @@ public: wxSize ReturnPageSize(void); int GetInternalUnits(void); + wxPoint CursorRealPosition(const wxPoint & ScreenPos); + /* general Undo/Redo command control */ virtual void ClearUndoRedoList(void); virtual void AddItemToUndoList(EDA_BaseStruct * item); diff --git a/include/gr_basic.h b/include/gr_basic.h index aa7b718fd3..006c5f56b4 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -65,66 +65,59 @@ void GRMouseWarp(WinEDA_DrawPanel * panel, const wxPoint& pos); /* positionne la void GRSetDrawMode(wxDC * DC, int mode); int GRGetDrawMode(wxDC * DC); void GRResetPenAndBrush(wxDC * DC); -void GRSetColorPen(wxDC * DC, int Color , int width = 1); +void GRSetColorPen(wxDC * DC, int Color , int width = 1, int stype = wxSOLID); void GRSetBrush(wxDC * DC, int Color , int fill = 0); void GRForceBlackPen(bool flagforce ); void SetPenMinWidth(int minwidth); /* ajustage de la largeur mini de plume */ -void GRLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); -void GRMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); -void GRSMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); -void GRDashedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); -void GRSDashedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); -void GRDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int Color); -void GRSDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int Color); -void GRBusLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); -void GRSBusLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); -void GRSLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); +void GRLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); +void GRMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); +void GRSMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); +void GRDashedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); +void GRSDashedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); +void GRDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int width, int Color); +void GRSDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int width, int Color); +void GRSLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); void GRMoveTo(int x, int y); void GRSMoveTo(int x, int y); -void GRLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color); -void GRBusLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color); -void GRSLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color); +void GRLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color); +void GRSLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color); void GRMoveRel(int x, int y); void GRSMoveRel(int x, int y); -void GRLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color); -void GRSLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color); +void GRLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color); +void GRSLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color); void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, - int Fill, int Color, int BgColor); -void GRPolyLines(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, - int Color, int BgColor, int width); + int Fill, int width, int Color, int BgColor); void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, int Fill, int Color, int BgColor); +void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, + int Fill, int width, int Color, int BgColor); void GRSPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, - int Fill, int Color, int BgColor); -void GRSPolyLines(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, - int Color, int BgColor, int width); + int Fill, int width, int Color, int BgColor); void GRSClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, - int Fill, int Color, int BgColor); + int Fill, int width, int Color, int BgColor); void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color); void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color); void GRFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, - int Color, int BgColor); -void GRSCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color); + int width, int Color, int BgColor); void GRSCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color); void GRSFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, - int Color, int BgColor); + int width, int Color, int BgColor); void GRArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int Color); void GRArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int width, int Color); void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int xc, int yc, int Color); void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int xc, int yc, int width, int Color); -void GRSArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, - int xc, int yc, int Color); void GRSArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, int xc, int yc, int width, int Color); -void GRSArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int Color); void GRSArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int width, int Color); void GRFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int Color, int BgColor); +void GRFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, + int StAngle, int EndAngle, int r, int width, int Color, int BgColor); void GRSFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, - int StAngle, int EndAngle, int r, int Color, int BgColor); + int StAngle, int EndAngle, int r, int width, int Color, int BgColor); void GRCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); void GRFillCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); void GRSCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); @@ -139,14 +132,20 @@ void GRSPutPixel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int color); int GRGetPixel(wxDC * DC, int x, int y); void GRFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color, int BgColor); +void GRFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, + int x2, int y2, int width, int Color, int BgColor); void GRSFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color, int BgColor); -void GRSFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2, - int Color, int BgColor); +void GRSFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, + int x2, int y2, int width, int Color, int BgColor); void GRRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); +void GRRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, + int x2, int y2, int width, int Color); void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color); +void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, + int x2, int y2, int width, int Color); /* Routines relatives a l'affichage des textes */ void GRSetFont(wxDC * DC, wxFont * Font); diff --git a/include/id.h b/include/id.h index 93b88b60e2..b3a78d65eb 100644 --- a/include/id.h +++ b/include/id.h @@ -8,12 +8,29 @@ enum main_id { ID_BOTTOM_FRAME, ID_MAIN_DIALOG, ID_PROJECT_TREE, + ID_PROJECT_TXTEDIT, + ID_PROJECT_TREE_REFRESH, + ID_PROJECT_RUNPY, + ID_PROJECT_NEWFILE, + ID_PROJECT_NEWSCH, + ID_PROJECT_NEWBRD, + ID_PROJECT_NEWPY, + ID_PROJECT_NEWGERBER, + ID_PROJECT_NEWTXT, + ID_PROJECT_NEWNET, + ID_PROJECT_NEWDIR, + ID_PROJECT_DELETE, + ID_PROJECT_RENAME, + ID_PROJECT_UNUSED0, + ID_PROJECT_UNUSED1, + ID_MAIN_COMMAND, ID_TO_EDITOR, ID_TO_EESCHEMA, ID_TO_GERBVIEW, ID_TO_PCB, ID_TO_CVPCB, + ID_RUN_PYTHON, ID_MAIN_MENUBAR, ID_ON_ZOOM_SELECT, ID_ON_GRID_SELECT, @@ -124,11 +141,11 @@ enum main_id { ID_LANGUAGE_CHOICE_END, - // ID du Main Toolbar de Schematique + // ID du Main Toolbar de Schematique ID_SCHEMATIC_MAIN_TOOLBAR_START, ID_SCHEMATIC_UNDO, - ID_SCHEMATIC_REDO, + ID_SCHEMATIC_REDO, ID_SCHEMATIC_MAIN_TOOLBAR_END, // ID du Vertical Toolbar de Schematique @@ -448,7 +465,7 @@ enum main_id { ID_CVPCB_CREATE_STUFF_FILE, ID_CVPCB_SHOW3D_FRAME, ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, - ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, + ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, ID_CVPCB_UNUSED0, ID_CVPCB_UNUSED1, ID_CVPCB_UNUSED2, @@ -601,10 +618,10 @@ enum main_id { ID_POPUP_PCB_VIA_HOLE_EXPORT, ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT, ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS, - ID_POPUP_PCB_UNUSED1, - ID_POPUP_PCB_UNUSED2, - ID_POPUP_PCB_UNUSED3, - ID_POPUP_PCB_UNUSED4, + ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE, + ID_POPUP_PCB_DRAG_TRACK_SEGMENT, + ID_POPUP_PCB_MOVE_TRACK_SEGMENT, + ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, ID_POPUP_PCB_UNUSED5, ID_POPUP_PCB_UNUSED6, ID_POPUP_PCB_UNUSED7, @@ -743,8 +760,8 @@ enum main_id { ID_MENU_INC_LAYER_AND_APPEND_FILE, ID_INC_LAYER_AND_APPEND_FILE, ID_GERBVIEW_SHOW_SOURCE, - ID_GERBVIEW_UNUSED0, - ID_GERBVIEW_UNUSED1, + ID_GERBVIEW_EXPORT_TO_PCBNEW, + ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, ID_GERBVIEW_UNUSED2, ID_GERBVIEW_UNUSED3, ID_GERBVIEW_UNUSED4, diff --git a/include/pcbstruct.h b/include/pcbstruct.h index 7c587c8a0f..339a7e5599 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -1,357 +1,357 @@ - /**************************************************************/ - /* pcbstruct.h : definition des structures de donnees type PCB */ - /**************************************************************/ - -#ifndef PCBSTRUCT_H -#define PCBSTRUCT_H - -#include "base_struct.h" - -// Definitions relatives aux libariries -#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1" -#define ENTETE_LIBDOC "PCBNEW-LibDoc----V1" -#define L_ENTETE_LIB 18 -#define EXT_CMP wxT(".emp") -#define EXT_CMP_MASK wxT("*.emp") -#define EXT_DOC wxT(".mdc") - - -/* Bits indicateurs du membre .Status, pour pistes, modules... */ -#define FLAG1 0x2000 /* flag libre pour calculs locaux */ -#define FLAG0 0x1000 /* flag libre pour calculs locaux */ -#define BEGIN_ONPAD 0x800 /* flag indiquant un debut de segment sur pad */ -#define END_ONPAD 0x400 /* flag indiquant une fin de segment sur pad */ -#define BUSY 0x0200 /* flag indiquant que la structure a deja - ete examinee, dans certaines routines */ -#define DELETED 0x0100 /* Bit flag de Status pour structures effacee - et mises en chaine "DELETED" */ -#define NO_TRACE 0x80 /* l'element ne doit pas etre affiche */ -#define SURBRILL 0x20 /* element en surbrillance */ -#define DRAG 0x10 /* segment en mode drag */ -#define EDIT 0x8 /* element en cours d'edition */ -#define SEGM_FIXE 0x04 /* segment FIXE ( pas d'effacement global ) */ -#define SEGM_AR 0x02 /* segment Auto_Route */ -#define CHAIN 0x01 /* segment marque */ - - - /*************************************/ - /* constantes de gestion des couches */ - /*************************************/ -#define CUIVRE_LAYER 0x00000001 /* Bit layer cuivre */ -#define LAYER_2 0x00000002 /* Bit layer 2 */ -#define LAYER_3 0x00000004 /* Bit layer 3 */ -#define LAYER_4 0x00000008 /* Bit layer 4 */ -#define LAYER_5 0x00000010 /* Bit layer 5 */ -#define LAYER_6 0x00000020 /* Bit layer 6 */ -#define LAYER_7 0x00000040 /* Bit layer 7 */ -#define LAYER_8 0x00000080 /* Bit layer 8 */ -#define LAYER_9 0x00000100 /* Bit layer 9 */ -#define LAYER_10 0x00000200 /* Bit layer 10 */ -#define LAYER_11 0x00000400 /* Bit layer 11 */ -#define LAYER_12 0x00000800 /* Bit layer 12 */ -#define LAYER_13 0x00001000 /* Bit layer 13 */ -#define LAYER_14 0x00002000 /* Bit layer 14 */ -#define LAYER_15 0x00004000 /* Bit layer 15 */ -#define CMP_LAYER 0x00008000 /* Bit layer cmp */ -#define ADHESIVE_LAYER_CU 0x00010000 -#define ADHESIVE_LAYER_CMP 0x00020000 -#define SOLDERPASTE_LAYER_CU 0x00040000 -#define SOLDERPASTE_LAYER_CMP 0x00080000 -#define SILKSCREEN_LAYER_CU 0x00100000 -#define SILKSCREEN_LAYER_CMP 0x00200000 -#define SOLDERMASK_LAYER_CU 0x00400000 -#define SOLDERMASK_LAYER_CMP 0x00800000 -#define DRAW_LAYER 0x01000000 -#define COMMENT_LAYER 0x02000000 -#define ECO1_LAYER 0x04000000 -#define ECO2_LAYER 0x08000000 -#define EDGE_LAYER 0x10000000 -#define intS_LAYER 0xE0000000 /* 4 bits MSB = autres flags */ -/* masques generaux : */ -#define ALL_LAYERS 0x1FFFFFFF -#define ALL_NO_CU_LAYERS 0x1FFF0000 -#define ALL_CU_LAYERS 0x0000FFFF -#define INTERNAL_LAYERS 0x00007FFE /* Bits layers internes */ -#define EXTERNAL_LAYERS 0x00008001 -/* Flags pour les couches cuivres */ -#define LAYER_is_PLAN 0x80000000 - -/* numero des couches particulieres */ -#define LAYER_CUIVRE_N 0 -#define CUIVRE_N 0 -#define LAYER_N_2 1 /* Numero layer 2 */ -#define LAYER_N_3 2 /* Numero layer 3 */ -#define LAYER_N_4 3 /* Numero layer 4 */ -#define LAYER_N_5 4 /* Numero layer 5 */ -#define LAYER_N_6 5 /* Numero layer 6 */ -#define LAYER_N_7 6 /* Numero layer 7 */ -#define LAYER_N_8 7 /* Numero layer 8 */ -#define LAYER_N_9 8 /* Numero layer 9 */ -#define LAYER_N_10 9 /* Numero layer 10 */ -#define LAYER_N_11 10 /* Numero layer 11 */ -#define LAYER_N_12 11 /* Numero layer 12 */ -#define LAYER_N_13 12 /* Numero layer 13 */ -#define LAYER_N_14 13 /* Numero layer 14 */ -#define LAYER_N_15 14 /* Numero layer 15 */ -#define LAYER_CMP_N 15 -#define CMP_N 15 -#define NB_COPPER_LAYERS (CMP_N+1) -#define FIRST_NO_COPPER_LAYER 16 -#define ADHESIVE_N_CU 16 -#define ADHESIVE_N_CMP 17 -#define SOLDERPASTE_N_CU 18 -#define SOLDERPASTE_N_CMP 19 -#define SILKSCREEN_N_CU 20 -#define SILKSCREEN_N_CMP 21 -#define SOLDERMASK_N_CU 22 -#define SOLDERMASK_N_CMP 23 -#define DRAW_N 24 -#define COMMENT_N 25 -#define ECO1_N 26 -#define ECO2_N 27 -#define EDGE_N 28 -#define LAST_NO_COPPER_LAYER 28 -#define NB_LAYERS (EDGE_N+1) -#define LAYER_COUNT 32 - -/* Forme des segments (pistes, contours ..) ( parametre .shape ) */ -enum Track_Shapes { - S_SEGMENT = 0, /* segment rectiligne */ - S_RECT, /* segment forme rect (i.e. bouts non arrondis) */ - S_ARC, /* segment en arc de cercle (bouts arrondis)*/ - S_CIRCLE, /* segment en cercle (anneau)*/ - S_ARC_RECT, /* segment en arc de cercle (bouts droits) (GERBER)*/ - S_SPOT_OVALE, /* spot ovale (for GERBER)*/ - S_SPOT_CIRCLE, /* spot rond (for GERBER)*/ - S_SPOT_RECT, /* spot rect (for GERBER)*/ - S_POLYGON /* polygon shape */ -}; - - -/* Forward declaration */ -class MODULE; -class EQUIPOT; -class MARQUEUR; -class TRACK; -class D_PAD; -struct CHEVELU; -class Ki_PageDescr; -class DrawBlockStruct; - -// Class for handle current printed board design settings -#define HIST0RY_NUMBER 8 -class EDA_BoardDesignSettings -{ -public: - int m_CopperLayerCount; // Number of copper layers for this design - int m_ViaDrill; // via drill (for the entire board) - int m_CurrentViaSize; // Current via size - int m_ViaSizeHistory[HIST0RY_NUMBER]; // Last HIST0RY_NUMBER used via sizes - int m_CurrentViaType; /* via type (BLIND, TROUGHT ...), bits 1 and 2 (not 0 and 1)*/ - int m_CurrentTrackWidth; // current track width - int m_TrackWidhtHistory[HIST0RY_NUMBER]; // Last HIST0RY_NUMBER used track widths - int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) - int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) - int m_PcbTextWidth; // current Pcb (not module) Text width - wxSize m_PcbTextSize; // current Pcb (not module) Text size - int m_TrackClearence; // track to track and track to pads clearance - int m_ZoneClearence; // zone to track and zone to pads clearance - int m_MaskMargin; // Solder mask margin - /* Color options for screen display of the Printed Board: */ - int m_PcbGridColor; // Grid color - int m_LayerColor[32] ; // Layer colors (tracks and graphic items) - int m_ViaColor[4]; // Via color (depending on is type) - int m_ModuleTextCMPColor; // Text module color for modules on the COMPONENT layer - int m_ModuleTextCUColor; // Text module color for modules on the COPPER layer - int m_ModuleTextNOVColor; // Text module color for "invisible" texts (must be BLACK if really not displayed) - int m_AnchorColor; // Anchor color for modules and texts - int m_PadCUColor; // Pad color for the COMPONENT side of the pad - int m_PadCMPColor; // Pad color for the COPPER side of the pad - // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors) - int m_RatsnestColor; // Ratsnest color - -public: - EDA_BoardDesignSettings(void); -}; - -// Values for m_DisplayViaMode member: -enum DisplayViaMode { - VIA_HOLE_NOT_SHOW = 0, - VIA_SPECIAL_HOLE_SHOW, - ALL_VIA_HOLE_SHOW, - OPT_VIA_HOLE_END -}; - -class BOARD: public EDA_BaseStruct -{ - public: - WinEDA_BasePcbFrame * m_PcbFrame; // Window de visualisation - EDA_Rect m_BoundaryBox; // Limites d'encadrement du PCB - int m_Unused; // - int m_Status_Pcb; // Mot d'etat: Bit 1 = Chevelu calcule - EDA_BoardDesignSettings * m_BoardSettings; // Link to current design settings - int m_NbNets; // Nombre de nets (equipotentielles) - int m_NbNodes; // nombre de pads connectes - int m_NbLinks; // nombre de chevelus - int m_NbLoclinks; // nombre de chevelus dans Local ratsnest - // minimal de pistes a tracer - int m_NbNoconnect; // nombre de chevelus actifs - int m_NbSegmTrack; // nombre d'elements de type segments de piste - int m_NbSegmZone; // nombre d'elements de type segments de zone - - EDA_BaseStruct * m_Drawings; // pointeur sur liste drawings - MODULE * m_Modules; // pointeur sur liste zone modules - EQUIPOT * m_Equipots; // pointeur liste zone equipot - TRACK * m_Track; // pointeur relatif zone piste - TRACK * m_Zone; // pointeur tableau zone zones de cuivre - D_PAD ** m_Pads; // pointeur liste d'acces aux pads - int m_NbPads; // nombre total de pads - CHEVELU * m_Ratsnest; // pointeur liste des chevelus - CHEVELU * m_LocalRatsnest; // pointeur liste des chevelus d'un module - - EDGE_ZONE * m_CurrentLimitZone; /* pointeur sur la liste des segments - de delimitation de la zone en cours de trace */ - - BOARD(EDA_BaseStruct * StructFather, WinEDA_BasePcbFrame * frame); - ~BOARD(void); - - /* supprime du chainage la structure Struct */ - void UnLink( void ); - - /* Routines de calcul des nombres de segments pistes et zones */ - int GetNumSegmTrack(void); - int GetNumSegmZone(void); - int GetNumNoconnect(void); // retourne le nombre de connexions manquantes - int GetNumRatsnests(void); // retourne le nombre de chevelus - int GetNumNodes(void); // retourne le nombre de pads a netcode > 0 - - // Calcul du rectangle d'encadrement: - bool ComputeBoundaryBox(void); -}; - - -/* Description d'un ecran */ -class PCB_SCREEN : public BASE_SCREEN -{ -public: - int m_Active_Layer; /* ref couche active */ - int m_Route_Layer_TOP; /* ref couches actives */ - int m_Route_Layer_BOTTOM; /* pour placement vias et routage 2 couches */ - -public: - PCB_SCREEN(int idscreen); - ~PCB_SCREEN(void); - PCB_SCREEN * Next(void) { return (PCB_SCREEN *) Pnext;} - void Init(void); - void SetNextZoom(void); - void SetPreviousZoom(void); - void SetLastZoom(void); -}; - - /***************************/ - /* Description des Modules */ - /***************************/ - -#include "class_pad.h" /* Description des Pastilles :*/ -#include "class_edge_mod.h" -#include "class_text_mod.h" -#include "class_module.h" -#include "class_equipot.h" - - - /***********************************/ - /* Description des elements du PCB */ - /***********************************/ - -class DRAWSEGMENT: public EDA_BaseLineStruct -{ -public: - int m_Shape; // forme: Segment , Cercle.. - int m_Type; // numero de sous type ( cotation.. ) - int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg - -public: - DRAWSEGMENT(EDA_BaseStruct * StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT); - ~DRAWSEGMENT(void); - - // Read/write data - bool WriteDrawSegmentDescr(FILE * File); - bool ReadDrawSegmentDescr(FILE * File, int * LineNum); - - /* supprime du chainage la structure Struct */ - void UnLink( void ); - - void Copy(DRAWSEGMENT * source); -}; - - -#include "class_pcb_text.h" -#include "class_cotation.h" -#include "class_mire.h" -#include "class_track.h" - - /*******************/ - /* class EDGE_ZONE */ - /*******************/ - -class EDGE_ZONE: public DRAWSEGMENT -{ -public: - EDGE_ZONE(EDA_BaseStruct * StructFather); - EDGE_ZONE(const EDGE_ZONE & edgezone); - ~EDGE_ZONE(void); -}; - - - /************************************/ - /* Gestion des marqueurs sur le PCB */ - /************************************/ - -class MARQUEUR: public EDA_BaseStruct -{ /* Description d'un marqueur */ -public: - wxPoint m_Pos; - char * m_Bitmap; /* Shape (bitmap) */ - int m_Type; - int m_Color; /* couleur */ - wxString m_Diag; /* Associated text (comment) */ - -public: - MARQUEUR(EDA_BaseStruct * StructFather); - ~MARQUEUR(void); - void UnLink( void ); - void Draw( WinEDA_DrawPanel * panel, wxDC * DC, int DrawMode); -}; - - -class DISPLAY_OPTIONS -{ -public: - bool DisplayPadFill; - bool DisplayPadNum; - bool DisplayPadNoConn; - bool DisplayPadIsol; - - int DisplayModEdge; - int DisplayModText; - bool DisplayPcbTrackFill; /* FALSE = sketch , TRUE = filled */ - bool DisplayTrackIsol; - int m_DisplayViaMode; /* 0 do not show via hole, - 1 show via hole for non default value - 2 show all via hole */ - - bool DisplayPolarCood; - bool DisplayZones; - bool Show_Modules_Cmp; - bool Show_Modules_Cu; - - int DisplayDrawItems; - bool ContrastModeDisplay; - -public: - DISPLAY_OPTIONS(void); -}; - - - -#endif /* PCBSTRUCT_H */ + /**************************************************************/ + /* pcbstruct.h : definition des structures de donnees type PCB */ + /**************************************************************/ + +#ifndef PCBSTRUCT_H +#define PCBSTRUCT_H + +#include "base_struct.h" + +// Definitions relatives aux libariries +#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1" +#define ENTETE_LIBDOC "PCBNEW-LibDoc----V1" +#define L_ENTETE_LIB 18 +#define EXT_CMP wxT(".emp") +#define EXT_CMP_MASK wxT("*.emp") +#define EXT_DOC wxT(".mdc") + + +/* Bits indicateurs du membre .Status, pour pistes, modules... */ +#define FLAG1 0x2000 /* flag libre pour calculs locaux */ +#define FLAG0 0x1000 /* flag libre pour calculs locaux */ +#define BEGIN_ONPAD 0x800 /* flag indiquant un debut de segment sur pad */ +#define END_ONPAD 0x400 /* flag indiquant une fin de segment sur pad */ +#define BUSY 0x0200 /* flag indiquant que la structure a deja + ete examinee, dans certaines routines */ +#define DELETED 0x0100 /* Bit flag de Status pour structures effacee + et mises en chaine "DELETED" */ +#define NO_TRACE 0x80 /* l'element ne doit pas etre affiche */ +#define SURBRILL 0x20 /* element en surbrillance */ +#define DRAG 0x10 /* segment en mode drag */ +#define EDIT 0x8 /* element en cours d'edition */ +#define SEGM_FIXE 0x04 /* segment FIXE ( pas d'effacement global ) */ +#define SEGM_AR 0x02 /* segment Auto_Route */ +#define CHAIN 0x01 /* segment marque */ + + + /*************************************/ + /* constantes de gestion des couches */ + /*************************************/ +#define CUIVRE_LAYER 0x00000001 /* Bit layer cuivre */ +#define LAYER_2 0x00000002 /* Bit layer 2 */ +#define LAYER_3 0x00000004 /* Bit layer 3 */ +#define LAYER_4 0x00000008 /* Bit layer 4 */ +#define LAYER_5 0x00000010 /* Bit layer 5 */ +#define LAYER_6 0x00000020 /* Bit layer 6 */ +#define LAYER_7 0x00000040 /* Bit layer 7 */ +#define LAYER_8 0x00000080 /* Bit layer 8 */ +#define LAYER_9 0x00000100 /* Bit layer 9 */ +#define LAYER_10 0x00000200 /* Bit layer 10 */ +#define LAYER_11 0x00000400 /* Bit layer 11 */ +#define LAYER_12 0x00000800 /* Bit layer 12 */ +#define LAYER_13 0x00001000 /* Bit layer 13 */ +#define LAYER_14 0x00002000 /* Bit layer 14 */ +#define LAYER_15 0x00004000 /* Bit layer 15 */ +#define CMP_LAYER 0x00008000 /* Bit layer cmp */ +#define ADHESIVE_LAYER_CU 0x00010000 +#define ADHESIVE_LAYER_CMP 0x00020000 +#define SOLDERPASTE_LAYER_CU 0x00040000 +#define SOLDERPASTE_LAYER_CMP 0x00080000 +#define SILKSCREEN_LAYER_CU 0x00100000 +#define SILKSCREEN_LAYER_CMP 0x00200000 +#define SOLDERMASK_LAYER_CU 0x00400000 +#define SOLDERMASK_LAYER_CMP 0x00800000 +#define DRAW_LAYER 0x01000000 +#define COMMENT_LAYER 0x02000000 +#define ECO1_LAYER 0x04000000 +#define ECO2_LAYER 0x08000000 +#define EDGE_LAYER 0x10000000 +#define intS_LAYER 0xE0000000 /* 4 bits MSB = autres flags */ +/* masques generaux : */ +#define ALL_LAYERS 0x1FFFFFFF +#define ALL_NO_CU_LAYERS 0x1FFF0000 +#define ALL_CU_LAYERS 0x0000FFFF +#define INTERNAL_LAYERS 0x00007FFE /* Bits layers internes */ +#define EXTERNAL_LAYERS 0x00008001 +/* Flags pour les couches cuivres */ +#define LAYER_is_PLAN 0x80000000 + +/* numero des couches particulieres */ +#define LAYER_CUIVRE_N 0 +#define CUIVRE_N 0 +#define LAYER_N_2 1 /* Numero layer 2 */ +#define LAYER_N_3 2 /* Numero layer 3 */ +#define LAYER_N_4 3 /* Numero layer 4 */ +#define LAYER_N_5 4 /* Numero layer 5 */ +#define LAYER_N_6 5 /* Numero layer 6 */ +#define LAYER_N_7 6 /* Numero layer 7 */ +#define LAYER_N_8 7 /* Numero layer 8 */ +#define LAYER_N_9 8 /* Numero layer 9 */ +#define LAYER_N_10 9 /* Numero layer 10 */ +#define LAYER_N_11 10 /* Numero layer 11 */ +#define LAYER_N_12 11 /* Numero layer 12 */ +#define LAYER_N_13 12 /* Numero layer 13 */ +#define LAYER_N_14 13 /* Numero layer 14 */ +#define LAYER_N_15 14 /* Numero layer 15 */ +#define LAYER_CMP_N 15 +#define CMP_N 15 +#define NB_COPPER_LAYERS (CMP_N+1) +#define FIRST_NO_COPPER_LAYER 16 +#define ADHESIVE_N_CU 16 +#define ADHESIVE_N_CMP 17 +#define SOLDERPASTE_N_CU 18 +#define SOLDERPASTE_N_CMP 19 +#define SILKSCREEN_N_CU 20 +#define SILKSCREEN_N_CMP 21 +#define SOLDERMASK_N_CU 22 +#define SOLDERMASK_N_CMP 23 +#define DRAW_N 24 +#define COMMENT_N 25 +#define ECO1_N 26 +#define ECO2_N 27 +#define EDGE_N 28 +#define LAST_NO_COPPER_LAYER 28 +#define NB_LAYERS (EDGE_N+1) +#define LAYER_COUNT 32 + +/* Forme des segments (pistes, contours ..) ( parametre .shape ) */ +enum Track_Shapes { + S_SEGMENT = 0, /* segment rectiligne */ + S_RECT, /* segment forme rect (i.e. bouts non arrondis) */ + S_ARC, /* segment en arc de cercle (bouts arrondis)*/ + S_CIRCLE, /* segment en cercle (anneau)*/ + S_ARC_RECT, /* segment en arc de cercle (bouts droits) (GERBER)*/ + S_SPOT_OVALE, /* spot ovale (for GERBER)*/ + S_SPOT_CIRCLE, /* spot rond (for GERBER)*/ + S_SPOT_RECT, /* spot rect (for GERBER)*/ + S_POLYGON /* polygon shape */ +}; + + +/* Forward declaration */ +class MODULE; +class EQUIPOT; +class MARQUEUR; +class TRACK; +class D_PAD; +struct CHEVELU; +class Ki_PageDescr; +class DrawBlockStruct; + +// Class for handle current printed board design settings +#define HIST0RY_NUMBER 8 +class EDA_BoardDesignSettings +{ +public: + int m_CopperLayerCount; // Number of copper layers for this design + int m_ViaDrill; // via drill (for the entire board) + int m_CurrentViaSize; // Current via size + int m_ViaSizeHistory[HIST0RY_NUMBER]; // Last HIST0RY_NUMBER used via sizes + int m_CurrentViaType; /* via type (BLIND, TROUGHT ...), bits 1 and 2 (not 0 and 1)*/ + int m_CurrentTrackWidth; // current track width + int m_TrackWidhtHistory[HIST0RY_NUMBER]; // Last HIST0RY_NUMBER used track widths + int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) + int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) + int m_PcbTextWidth; // current Pcb (not module) Text width + wxSize m_PcbTextSize; // current Pcb (not module) Text size + int m_TrackClearence; // track to track and track to pads clearance + int m_ZoneClearence; // zone to track and zone to pads clearance + int m_MaskMargin; // Solder mask margin + /* Color options for screen display of the Printed Board: */ + int m_PcbGridColor; // Grid color + int m_LayerColor[32] ; // Layer colors (tracks and graphic items) + int m_ViaColor[4]; // Via color (depending on is type) + int m_ModuleTextCMPColor; // Text module color for modules on the COMPONENT layer + int m_ModuleTextCUColor; // Text module color for modules on the COPPER layer + int m_ModuleTextNOVColor; // Text module color for "invisible" texts (must be BLACK if really not displayed) + int m_AnchorColor; // Anchor color for modules and texts + int m_PadCUColor; // Pad color for the COMPONENT side of the pad + int m_PadCMPColor; // Pad color for the COPPER side of the pad + // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors) + int m_RatsnestColor; // Ratsnest color + +public: + EDA_BoardDesignSettings(void); +}; + +// Values for m_DisplayViaMode member: +enum DisplayViaMode { + VIA_HOLE_NOT_SHOW = 0, + VIA_SPECIAL_HOLE_SHOW, + ALL_VIA_HOLE_SHOW, + OPT_VIA_HOLE_END +}; + +class BOARD: public EDA_BaseStruct +{ + public: + WinEDA_BasePcbFrame * m_PcbFrame; // Window de visualisation + EDA_Rect m_BoundaryBox; // Limites d'encadrement du PCB + int m_Unused; // + int m_Status_Pcb; // Mot d'etat: Bit 1 = Chevelu calcule + EDA_BoardDesignSettings * m_BoardSettings; // Link to current design settings + int m_NbNets; // Nombre de nets (equipotentielles) + int m_NbNodes; // nombre de pads connectes + int m_NbLinks; // nombre de chevelus + int m_NbLoclinks; // nombre de chevelus dans Local ratsnest + // minimal de pistes a tracer + int m_NbNoconnect; // nombre de chevelus actifs + int m_NbSegmTrack; // nombre d'elements de type segments de piste + int m_NbSegmZone; // nombre d'elements de type segments de zone + + EDA_BaseStruct * m_Drawings; // pointeur sur liste drawings + MODULE * m_Modules; // pointeur sur liste zone modules + EQUIPOT * m_Equipots; // pointeur liste zone equipot + TRACK * m_Track; // pointeur relatif zone piste + TRACK * m_Zone; // pointeur tableau zone zones de cuivre + D_PAD ** m_Pads; // pointeur liste d'acces aux pads + int m_NbPads; // nombre total de pads + CHEVELU * m_Ratsnest; // pointeur liste des chevelus + CHEVELU * m_LocalRatsnest; // pointeur liste des chevelus d'un module + + EDGE_ZONE * m_CurrentLimitZone; /* pointeur sur la liste des segments + de delimitation de la zone en cours de trace */ + + BOARD(EDA_BaseStruct * StructFather, WinEDA_BasePcbFrame * frame); + ~BOARD(void); + + /* supprime du chainage la structure Struct */ + void UnLink( void ); + + /* Routines de calcul des nombres de segments pistes et zones */ + int GetNumSegmTrack(void); + int GetNumSegmZone(void); + int GetNumNoconnect(void); // retourne le nombre de connexions manquantes + int GetNumRatsnests(void); // retourne le nombre de chevelus + int GetNumNodes(void); // retourne le nombre de pads a netcode > 0 + + // Calcul du rectangle d'encadrement: + bool ComputeBoundaryBox(void); +}; + + +/* Description d'un ecran */ +class PCB_SCREEN : public BASE_SCREEN +{ +public: + int m_Active_Layer; /* ref couche active */ + int m_Route_Layer_TOP; /* ref couches actives */ + int m_Route_Layer_BOTTOM; /* pour placement vias et routage 2 couches */ + +public: + PCB_SCREEN(int idscreen); + ~PCB_SCREEN(void); + PCB_SCREEN * Next(void) { return (PCB_SCREEN *) Pnext;} + void Init(void); + void SetNextZoom(void); + void SetPreviousZoom(void); + void SetLastZoom(void); +}; + + /***************************/ + /* Description des Modules */ + /***************************/ + +#include "class_pad.h" /* Description des Pastilles :*/ +#include "class_edge_mod.h" +#include "class_text_mod.h" +#include "class_module.h" +#include "class_equipot.h" + + + /***********************************/ + /* Description des elements du PCB */ + /***********************************/ + +class DRAWSEGMENT: public EDA_BaseLineStruct +{ +public: + int m_Shape; // forme: Segment , Cercle.. + int m_Type; // numero de sous type ( cotation.. ) + int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg + +public: + DRAWSEGMENT(EDA_BaseStruct * StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT); + ~DRAWSEGMENT(void); + + // Read/write data + bool WriteDrawSegmentDescr(FILE * File); + bool ReadDrawSegmentDescr(FILE * File, int * LineNum); + + /* supprime du chainage la structure Struct */ + void UnLink( void ); + + void Copy(DRAWSEGMENT * source); +}; + + +#include "class_pcb_text.h" +#include "class_cotation.h" +#include "class_mire.h" +#include "class_track.h" + + /*******************/ + /* class EDGE_ZONE */ + /*******************/ + +class EDGE_ZONE: public DRAWSEGMENT +{ +public: + EDGE_ZONE(EDA_BaseStruct * StructFather); + EDGE_ZONE(const EDGE_ZONE & edgezone); + ~EDGE_ZONE(void); +}; + + + /************************************/ + /* Gestion des marqueurs sur le PCB */ + /************************************/ + +class MARQUEUR: public EDA_BaseStruct +{ /* Description d'un marqueur */ +public: + wxPoint m_Pos; + char * m_Bitmap; /* Shape (bitmap) */ + int m_Type; + int m_Color; /* couleur */ + wxString m_Diag; /* Associated text (comment) */ + +public: + MARQUEUR(EDA_BaseStruct * StructFather); + ~MARQUEUR(void); + void UnLink( void ); + void Draw( WinEDA_DrawPanel * panel, wxDC * DC, int DrawMode); +}; + + +class DISPLAY_OPTIONS +{ +public: + bool DisplayPadFill; + bool DisplayPadNum; + bool DisplayPadNoConn; + bool DisplayPadIsol; + + int DisplayModEdge; + int DisplayModText; + bool DisplayPcbTrackFill; /* FALSE = sketch , TRUE = filled */ + bool DisplayTrackIsol; + int m_DisplayViaMode; /* 0 do not show via hole, + 1 show via hole for non default value + 2 show all via hole */ + + bool DisplayPolarCood; + bool DisplayZones; + bool Show_Modules_Cmp; + bool Show_Modules_Cu; + + int DisplayDrawItems; + bool ContrastModeDisplay; + +public: + DISPLAY_OPTIONS(void); +}; + + + +#endif /* PCBSTRUCT_H */ diff --git a/include/plot_common.h b/include/plot_common.h index d5cb992281..cba7cee854 100644 --- a/include/plot_common.h +++ b/include/plot_common.h @@ -1,70 +1,73 @@ - /********************/ - /* plot_common.h */ - /********************/ - -#ifndef PLOT_COMMON_H -#define PLOT_COMMON_H - -#ifndef EDA_BASE -#define COMMON_GLOBL extern -#else -#define COMMON_GLOBL -#endif - - -typedef enum { - PLOT_FORMAT_HPGL, - PLOT_FORMAT_POST, - PLOT_FORMAT_GERBER, - PLOT_FORMAT_POST_A4 - } PlotFormat; - -#define PLOT_MIROIR 1 - - -/*******************************/ -/* common_plot_functions.cpp */ -/*******************************/ -void SetPlotScale(double xscale, double yscale); /* Set the plot scale for the current plotting) */ -void SetPlotOffset(wxPoint offset); /* Set the plot offset for the current plotting) */ -void InitPlotParametresGERBER(wxPoint offset, double xscale, double yscale); -void PlotWorkSheet(int format_plot, BASE_SCREEN * screen); -void UserToDeviceCoordinate(wxPoint & pos ); - /* modifie les coord pos.x et pos.y pour le trace selon l'orientation, l'echelle, les offsets de trace */ -void UserToDeviceSize(wxSize & size ); - /* modifie les dimension size.x et size.y pour le trace selon l'echelle */ - - -/*******************************/ -/* common_plotPS_functions.cpp */ -/*******************************/ -void InitPlotParametresPS( wxPoint offset, Ki_PageDescr * sheet, double xscale, double yscale, int orient = 0); -void SetDefaultLineWidthPS( int width); -void PlotCircle_PS(wxPoint pos, int diametre, int width = -1); -void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon); -void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon, int width); - /* Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree */ -void PlotPolyPS( int nb_segm, int * coord, int fill); -void PlotFilledSegmentPS(wxPoint start , wxPoint end, int width); -void LineTo_PS(wxPoint pos, int plume); -void PrintHeaderPS(FILE * file, const wxString & Creator, const wxString & FileName, int BBox[4]); -bool CloseFilePS(FILE * plot_file); -void SetColorMapPS(int color); - - - -/*********************************/ -/* common_plotHPGL_functions.cpp */ -/*********************************/ -void InitPlotParametresHPGL(wxPoint offset, double xscale, double yscale, int orient = 0); -bool PrintHeaderHPGL(FILE * plot_file, int pen_speed, int pen_num); -bool CloseFileHPGL(FILE * plot_file); -void PlotCircle_HPGL(wxPoint centre, int diameter, int width = -1); -void PlotArcHPGL(wxPoint centre, int StAngle, int EndAngle, int rayon); -void PlotPolyHPGL( int nb, int * coord, int fill); -void Move_Plume_HPGL( wxPoint pos, int plume ); -void Plume_HPGL( int plume ); - -#endif // PLOT_COMMON_H - - + /********************/ + /* plot_common.h */ + /********************/ + +#ifndef PLOT_COMMON_H +#define PLOT_COMMON_H + +#ifndef EDA_BASE +#define COMMON_GLOBL extern +#else +#define COMMON_GLOBL +#endif + + +typedef enum { + PLOT_FORMAT_HPGL, + PLOT_FORMAT_POST, + PLOT_FORMAT_GERBER, + PLOT_FORMAT_POST_A4 + } PlotFormat; + +#define PLOT_MIROIR 1 + + +/*******************************/ +/* common_plot_functions.cpp */ +/*******************************/ +void SetPlotScale(double xscale, double yscale); /* Set the plot scale for the current plotting) */ +void SetPlotOffset(wxPoint offset); /* Set the plot offset for the current plotting) */ +void InitPlotParametresGERBER(wxPoint offset, double xscale, double yscale); +void PlotWorkSheet(int format_plot, BASE_SCREEN * screen); +void UserToDeviceCoordinate(wxPoint & pos ); + /* modifie les coord pos.x et pos.y pour le trace selon l'orientation, l'echelle, les offsets de trace */ +void UserToDeviceSize(wxSize & size ); + /* modifie les dimension size.x et size.y pour le trace selon l'echelle */ +void ForcePenReinit(void); + /* set the flag g_CurrentPenWidth to -1 in order to force a pen width redefinition + for the next draw command */ + + +/*******************************/ +/* common_plotPS_functions.cpp */ +/*******************************/ +void SetCurrentLineWidthPS( int width); +void InitPlotParametresPS( wxPoint offset, Ki_PageDescr * sheet, double xscale, double yscale, int orient = 0); +void SetDefaultLineWidthPS( int width); +void PlotCircle_PS(wxPoint pos, int diametre, int width = -1); +void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1); + /* Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree */ +void PlotPolyPS( int nb_segm, int * coord, int fill, int width = -1); +void PlotFilledSegmentPS(wxPoint start , wxPoint end, int width); +void LineTo_PS(wxPoint pos, int plume); +void PrintHeaderPS(FILE * file, const wxString & Creator, const wxString & FileName, int BBox[4]); +bool CloseFilePS(FILE * plot_file); +void SetColorMapPS(int color); + + + +/*********************************/ +/* common_plotHPGL_functions.cpp */ +/*********************************/ +void InitPlotParametresHPGL(wxPoint offset, double xscale, double yscale, int orient = 0); +bool PrintHeaderHPGL(FILE * plot_file, int pen_speed, int pen_num); +bool CloseFileHPGL(FILE * plot_file); +void PlotCircle_HPGL(wxPoint centre, int diameter, int width = -1); +void PlotArcHPGL(wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1); +void PlotPolyHPGL( int nb, int * coord, int fill, int width = -1); +void Move_Plume_HPGL( wxPoint pos, int plume ); +void Plume_HPGL( int plume ); + +#endif // PLOT_COMMON_H + + diff --git a/include/pyhandler.h b/include/pyhandler.h new file mode 100644 index 0000000000..b00a4a4f53 --- /dev/null +++ b/include/pyhandler.h @@ -0,0 +1,103 @@ + /****************************/ + /* pyhandler.h */ + /****************************/ + +#ifndef PYHANDLER_H +#define PYHANDLER_H + +#include +#include +#include + +/* Use the boost library : */ +#include + +#include + + +class PyHandler +{ + + typedef void (*initfunc_t )(); + + private: + static PyHandler * m_instance; + bool m_ModulesLoaded; + int m_current; + PyThreadState* m_mainTState; + + protected: + PyHandler(); + + wxString m_appName; + void RunBaseScripts( const wxString & base ); + + // Modules + struct ModuleRecord + { + wxString name; + std::vector< initfunc_t > registry; + + ModuleRecord( const wxString & modName ) : name(modName) {} + }; + std::vector< ModuleRecord > m_ModuleRegistry; + void DoInitModules(); + + // Events + struct Event + { + wxString key; + std::vector< boost::python::object > functors; + + Event( const wxString & strKey ) : key( strKey ) {} + }; + std::vector< Event > m_EventRegistry; + + public: + // Singletton handling: + static PyHandler * GetInstance(); + + ~PyHandler(); + + // Scope params/handling: + void SetAppName( const wxString & name ); + + void AddToModule( const wxString & name, initfunc_t initfunc ); + int GetModuleIndex( const wxString & name ) const; + + // Script and direct call + void RunScripts(); + bool RunScript( const wxString & name ); + bool RunSimpleString( const wxString & code ); + + // Common Informations + const char * GetVersion(); + + void InitNextModule(); + + // Event triggering + + // - C++ interface + void DeclareEvent( const wxString & key ); + void TriggerEvent( const wxString & key ); + void TriggerEvent( const wxString & key, const boost::python::object & param ); + int GetEventIndex( const wxString & key ); + + // - Py Interface + void RegisterCallback ( const wxString & key, const boost::python::object & obj ); + void UnRegisterCallback( const wxString & key, const boost::python::object & obj ); + + // Object conversions + + // - Py -> C++ + static wxString MakeStr( const boost::python::object & objStr ); + + // - C++ -> Py + static boost::python::object Convert( const wxString & wxStr ); +}; + + +#define KICAD_PY_BIND_MODULE( mod ) PyHandler::GetInstance()->AddModule( init#mod ) + +#endif //PYHANDLER_H + diff --git a/include/worksheet.h b/include/worksheet.h index f7fab0e29b..cbcdd88883 100644 --- a/include/worksheet.h +++ b/include/worksheet.h @@ -5,6 +5,9 @@ /****************************/ /* Description du cartouche */ /****************************/ + +/* Values are in 1/1000 inch */ + #define GRID_REF_W 70 /* hauteur de la bande de reference grille */ #define SIZETEXT 60 /* Dimension des textes du cartouche */ #define SIZETEXT_REF 50 /* Dimension des lettres du marquage des reperes */ diff --git a/include/wxstruct.h b/include/wxstruct.h index 088d4c9ede..bd053ce527 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -162,6 +162,10 @@ public: WinEDA_BasicFrame( wxWindow * father, int idtype, WinEDA_App *parent, const wxString & title, const wxPoint& pos, const wxSize& size); +#ifdef KICAD_PYTHON + WinEDA_BasicFrame( const WinEDA_BasicFrame & ) {} // Should throw!! + WinEDA_BasicFrame() {} // Should throw!! +#endif ~WinEDA_BasicFrame(void); void GetKicadHelp(wxCommandEvent& event); @@ -271,7 +275,7 @@ public: void OnActivate(wxActivateEvent& event); void ReDrawPanel(void); - void TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen); + void TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen, int line_width); void DisplayToolMsg(const wxString msg); void Process_Zoom(wxCommandEvent& event); void Process_Grid(wxCommandEvent& event); @@ -369,7 +373,7 @@ public: // Gestion du PCB bool Clear_Pcb(wxDC * DC, bool query); EDA_BaseStruct * PcbGeneralLocateAndDisplay(void); - EDA_BaseStruct * Locate(int typeloc ); + EDA_BaseStruct * Locate(int typeloc, int LayerSearch ); // Gestion du curseur void place_marqueur( wxDC * DC, const wxPoint & pos, char* pt_bitmap, @@ -386,6 +390,7 @@ public: bool Overwrite, bool DisplayDialog); void Archive_Modules(const wxString & LibName, bool NewModulesOnly); MODULE * Select_1_Module_From_BOARD(BOARD * Pcb); + MODULE * GetModuleByName(void); // Modules MODULE * Create_1_Module(wxDC * DC, const wxString & module_name); @@ -422,7 +427,7 @@ public: MODULE * Get_Librairie_Module(wxWindow * winaff, const wxString & library, const wxString & ModuleName, bool show_msg_err); wxString Select_1_Module_From_List( - wxWindow * active_window, const wxString & Library, + WinEDA_DrawFrame * active_window, const wxString & Library, const wxString & Mask, const wxString & KeyWord); MODULE * Load_Module_From_Library(const wxString & library, wxDC * DC); @@ -598,7 +603,7 @@ public: void Hight_Light(wxDC * DC); void DrawHightLight(wxDC * DC, int NetCode); - // Edition des pistes: + // Track and via edition: void DisplayTrackSettings(void); void Other_Layer_Route(TRACK * track, wxDC * DC); void Affiche_PadsNoConnect(wxDC * DC); @@ -619,8 +624,9 @@ public: void Attribut_Segment(TRACK * track, wxDC * DC, bool Flag_On); void Attribut_Track(TRACK * track, wxDC * DC, bool Flag_On); void Attribut_net(wxDC * DC, int net_code, bool Flag_On); - void Start_MoveOneTrackSegment(TRACK * track, wxDC * DC, bool Drag); + void Start_MoveOneNodeOrSegment(TRACK * track, wxDC * DC, int command); bool PlaceDraggedTrackSegment(TRACK * Track, wxDC * DC); + void Start_DragTrackSegmentAndKeepSlope(TRACK * track, wxDC * DC); // Edition des zones EDGE_ZONE * Del_SegmEdgeZone(wxDC * DC, EDGE_ZONE * edge_zone); @@ -783,11 +789,16 @@ public: void Erase_Pistes(wxDC * DC, int masque_type, bool query); void Erase_Textes_Pcb(wxDC * DC, bool query); void UnDeleteItem(wxDC * DC); + void Delete_DCode_Items(wxDC * DC, int dcode_value, int layer_number); TRACK * Begin_Route(TRACK * track, wxDC * DC); void End_Route(TRACK * track, wxDC * DC); TRACK * Delete_Segment(wxDC * DC, TRACK *Track); int Edit_TrackSegm_Width(wxDC * DC, TRACK * segm); + + // Conversion function + void ExportDataInPcbnewFormat(wxCommandEvent& event); + DECLARE_EVENT_TABLE() }; @@ -928,6 +939,7 @@ public: int BestZoom(void); // Retourne le meilleur zoom EDA_BaseStruct * SchematicGeneralLocateAndDisplay(bool IncludePin = TRUE); + EDA_BaseStruct * SchematicGeneralLocateAndDisplay(const wxPoint & refpoint, bool IncludePin); /* netlist generation */ void * BuildNetListBase(void); @@ -1436,7 +1448,7 @@ public: class WinEDAListBox : public wxDialog { public: - wxWindow * m_Parent; + WinEDA_DrawFrame * m_Parent; wxListBox * m_List; wxTextCtrl * m_WinMsg; const wxChar ** m_ItemList; @@ -1445,7 +1457,7 @@ private: void(* m_MoveFct)(wxString & Text); public: - WinEDAListBox( wxWindow * parent, const wxString & title, + WinEDAListBox( WinEDA_DrawFrame * parent, const wxString & title, const wxChar ** ItemList, const wxString & RefText, void(* movefct)(wxString & Text) = NULL, @@ -1465,6 +1477,7 @@ private: void Ok(wxCommandEvent& event); void ClickOnList(wxCommandEvent& event); void D_ClickOnList(wxCommandEvent& event); + void OnKeyEvent(wxKeyEvent& event); DECLARE_EVENT_TABLE() }; diff --git a/kicad/bitmaps/icon_cvpcb_small.xpm b/kicad/bitmaps/icon_cvpcb_small.xpm new file mode 100644 index 0000000000..c6fc029d13 --- /dev/null +++ b/kicad/bitmaps/icon_cvpcb_small.xpm @@ -0,0 +1,151 @@ +/* XPM */ +static char * icon_cvpcb_small_xpm[] = { +"16 16 132 2", +" c None", +". c #FF7800", +"+ c #AF5200", +"@ c #A64E00", +"# c #6A3200", +"$ c #6B3200", +"% c #984700", +"& c #8D4200", +"* c #000000", +"= c #929191", +"- c #A49C96", +"; c #FBFAFA", +"> c #FFFEFE", +", c #FFFCFA", +"' c #FFEEDF", +") c #FFDEC2", +"! c #FFCFA4", +"~ c #FFBF87", +"{ c #FFB069", +"] c #FFA04C", +"^ c #FF902F", +"/ c #FF8111", +"( c #803C00", +"_ c #807F7F", +": c #EA7610", +"< c #A88363", +"[ c #D5D4D3", +"} c #FFEEE0", +"| c #FFDFC2", +"1 c #FFCFA5", +"2 c #FFC088", +"3 c #FFB06A", +"4 c #FFA04D", +"5 c #FF9130", +"6 c #FF8112", +"7 c #232323", +"8 c #FF8010", +"9 c #FFA352", +"0 c #E4B58C", +"a c #D2CAC2", +"b c #F6E6D8", +"c c #FFDFC3", +"d c #FECFA5", +"e c #FEBF88", +"f c #FEB06B", +"g c #FFA14E", +"h c #FF9230", +"i c #FF8213", +"j c #7D7D7D", +"k c #FE8010", +"l c #D48845", +"m c #A98C73", +"n c #817C78", +"o c #767676", +"p c #585451", +"q c #987B62", +"r c #46403C", +"s c #847364", +"t c #C08959", +"u c #EC8C39", +"v c #783E0B", +"w c #100800", +"x c #F67D12", +"y c #D4945C", +"z c #AE947D", +"A c #332E2C", +"B c #2F2E2E", +"C c #919090", +"D c #686767", +"E c #ABA9A8", +"F c #6F5E4E", +"G c #9A6231", +"H c #C3722C", +"I c #F57B0E", +"J c #B87941", +"K c #957D69", +"L c #666260", +"M c #575656", +"N c #666666", +"O c #282524", +"P c #585656", +"Q c #766454", +"R c #AD784A", +"S c #C2742F", +"T c #FC7E0F", +"U c #DA8A44", +"V c #9E7A5A", +"W c #746960", +"X c #5F5E5E", +"Y c #7B6F66", +"Z c #B6967C", +"` c #775A41", +" . c #92663E", +".. c #C98040", +"+. c #EC8830", +"@. c #783F0C", +"#. c #FCA150", +"$. c #F9C190", +"%. c #DCCBBC", +"&. c #DED3CA", +"*. c #F7DAC2", +"=. c #F7CBA5", +"-. c #F4BA87", +";. c #F9AE6D", +">. c #FDA252", +",. c #FE9435", +"'. c #FF8418", +"). c #803C01", +"!. c #E4944E", +"~. c #B8A595", +"{. c #E8E7E6", +"]. c #FFF2E6", +"^. c #FFE2C9", +"/. c #FFD3AC", +"(. c #FFC38E", +"_. c #FFB471", +":. c #FFA454", +"<. c #FF9436", +"[. c #FF8519", +"}. c #803C02", +"|. c #965A25", +"1. c #BBB8B6", +"2. c #FEFDFD", +"3. c #FFF2E8", +"4. c #FFE3CA", +"5. c #FFD3AD", +"6. c #FFC490", +"7. c #FFB472", +"8. c #FFA555", +"9. c #FF9537", +"0. c #FF861A", +"a. c #803D02", +" . . . . . . ", +" . . . . . ", +" + @ # $ % & * ", +" = - ; > , ' ) ! ~ { ] ^ / ( ", +" _ : < [ , } | 1 2 3 4 5 6 ( ", +"* * 7 8 9 0 a b c d e f g h i ( ", +" j k l m n o p q r s t u v w ", +" _ x y z A B C D E F G H * ", +" _ I J K L M N O P Q R S * ", +" _ T U V W X Y Z ` ...+.@.w ", +" _ 8 #.$.%.&.*.=.-.;.>.,.'.).", +"* * 7 8 !.~.{.].^./.(._.:.<.[.}.", +" j |.1.2.> 3.4.5.6.7.8.9.0.a.", +" + @ # $ % & * ", +" . . . . . ", +" . . . . . . "}; diff --git a/kicad/bitmaps/icon_gerbview_small.xpm b/kicad/bitmaps/icon_gerbview_small.xpm new file mode 100644 index 0000000000..92f4b186d6 --- /dev/null +++ b/kicad/bitmaps/icon_gerbview_small.xpm @@ -0,0 +1,185 @@ +/* XPM */ +static char * icon_gerbview_small_xpm[] = { +"16 16 166 2", +" c None", +". c #424040", +"+ c #818080", +"@ c #7E7D7D", +"# c #4E4C4C", +"$ c #1B1A19", +"% c #FDFCFE", +"& c #D5BDAB", +"* c #616162", +"= c #909090", +"- c #BCBCBC", +"; c #6A5C52", +"> c #C3C3D6", +", c #E7E7FF", +"' c #E4E4FF", +") c #E2E2FF", +"! c #DFDFFF", +"~ c #44444E", +"{ c #E2C5AE", +"] c #625951", +"^ c #CECECE", +"/ c #D1D1D1", +"( c #E8A467", +"_ c #FD7A05", +": c #7A4E28", +"< c #CC9E84", +"[ c #F0B087", +"} c #EEAF87", +"| c #E5C5C3", +"1 c #44434E", +"2 c #8D7059", +"3 c #FF7800", +"4 c #FE7801", +"5 c #FE7902", +"6 c #FE7903", +"7 c #FE7A04", +"8 c #FF7801", +"9 c #EF9646", +"0 c #D2BEAC", +"a c #6A411F", +"b c #ECA87C", +"c c #EEAA80", +"d c #E3C2BF", +"e c #43424E", +"f c #7A7A79", +"g c #815F40", +"h c #E8A468", +"i c #F9831B", +"j c #FA8217", +"k c #8B480E", +"l c #BF9D92", +"m c #E5BEB4", +"n c #D8D7FE", +"o c #42424E", +"p c #515050", +"q c #8F8F8F", +"r c #DABFA7", +"s c #F68825", +"t c #FC7D0C", +"u c #AE733F", +"v c #A05C28", +"w c #F8892E", +"x c #E2BAB4", +"y c #42404E", +"z c #676666", +"A c #7C7C7C", +"B c #D4CAC1", +"C c #F1913C", +"D c #FC7C0A", +"E c #A45E26", +"F c #E0B8B4", +"G c #41404E", +"H c #636365", +"I c #EA9E5A", +"J c #FE7A05", +"K c #EC9B53", +"L c #F28F37", +"M c #E7A66C", +"N c #E7A66B", +"O c #E8A569", +"P c #6D5744", +"Q c #6A4C38", +"R c #D7AFAA", +"S c #D1D0FE", +"T c #403F4E", +"U c #968682", +"V c #C67226", +"W c #F9821A", +"X c #D6C8BC", +"Y c #FA8013", +"Z c #DA6C0A", +"` c #706C70", +" . c #E1E1E4", +".. c #6E6E74", +"+. c #938FAC", +"@. c #403E4E", +"#. c #F0C8B4", +"$. c #764010", +"%. c #BA661C", +"&. c #FE7A06", +"*. c #DDB999", +"=. c #2F2C2D", +"-. c #8F8FB9", +";. c #D8D8FF", +">. c #F2F2FF", +",. c #B5B5B6", +"'. c #2D2D2F", +"). c #E7E6FE", +"!. c #EBC4B4", +"~. c #928181", +"{. c #5F534F", +"]. c #705B4A", +"^. c #606062", +"/. c #4E4E55", +"(. c #5E5E71", +"_. c #ACACD1", +":. c #8584A1", +"<. c #656079", +"[. c #BEBEF0", +"}. c #EFEFF6", +"|. c #EBCCC3", +"1. c #EFAF87", +"2. c #E5A67E", +"3. c #D29269", +"4. c #C4845A", +"5. c #D09069", +"6. c #E0A17E", +"7. c #E7A787", +"8. c #EA9E6F", +"9. c #E37E2E", +"0. c #6D5045", +"a. c #8080A7", +"b. c #D0D0FF", +"c. c #ECECFF", +"d. c #E9C8BF", +"e. c #EFAC80", +"f. c #EDA980", +"g. c #EBA880", +"h. c #EAA780", +"i. c #E9A580", +"j. c #E8A480", +"k. c #E6A380", +"l. c #E99B6A", +"m. c #F5862E", +"n. c #A58280", +"o. c #46465C", +"p. c #A8A8DA", +"q. c #E0E0FF", +"r. c #DDDDFF", +"s. c #DBDBFF", +"t. c #D6D6FF", +"u. c #D3D3FF", +"v. c #D1D1FF", +"w. c #CECEFF", +"x. c #CCCCFF", +"y. c #CAC9FE", +"z. c #D7B0B4", +"A. c #D6AEB4", +"B. c #C2C2FE", +"C. c #3C3B4E", +"D. c #0E0E10", +"E. c #42414E", +"F. c #3F3E4E", +"G. c #3E3D4E", +"H. c #3D3C4E", +"I. c #1F1E27", +". + + @ # $ $ # @ + + + + + . ", +"+ % & * = - - = ; > , ' ) ! ~ ", +"+ { ] ^ / / / ( _ : < [ } | 1 ", +"+ 2 3 4 5 6 7 8 9 0 a b c d e ", +"f g h h h h h i j 9 k l m n o ", +"p q / / / / / r s t u v w x y ", +"z A B C D C B / / / A E w F G ", +"+ H I J K 7 L M N O P Q R S T ", +"+ U V W X Y 3 3 3 Z ` ...+.@. ", +"+ #.$.%.6 &.*./ q =.-.;.>.,.'. ", +"+ ).!.~.{.].^./.(._.:.<.[.) }.A ", +"+ |.[ 1.2.3.4.5.6.7.8.9.0.a.b.c.", +"+ d.e.c f.g.h.i.j.k.l.m.m.n.o.p.", +"+ q.r.s.;.t.u.v.w.x.y.z.A.B.C.D.", +". ~ 1 e o E.G T @.F.G.H.C.C.I. ", +" "}; diff --git a/kicad/bitmaps/new_cvpcb.xpm b/kicad/bitmaps/new_cvpcb.xpm new file mode 100644 index 0000000000..0fc44270c2 --- /dev/null +++ b/kicad/bitmaps/new_cvpcb.xpm @@ -0,0 +1,106 @@ +/* XPM */ +static char * new_cvpcb_xpm[] = { +"16 16 87 1", +" c None", +". c #000000", +"+ c #FEFEFE", +"@ c #090909", +"# c #EEEEEE", +"$ c #F1F1F1", +"% c #FBFBFB", +"& c #FF7800", +"* c #767676", +"= c #161616", +"- c #EFEFEF", +"; c #AF5200", +"> c #6A3200", +", c #6B3200", +"' c #984700", +") c #C4C4C4", +"! c #807F7F", +"~ c #A88363", +"{ c #D5D4D3", +"] c #FFFCFA", +"^ c #FFDFC2", +"/ c #FFCFA5", +"( c #FFB06A", +"_ c #FFA04D", +": c #FF9130", +"< c #803C00", +"[ c #ECECEC", +"} c #232323", +"| c #FFA352", +"1 c #E4B58C", +"2 c #D2CAC2", +"3 c #FFDFC3", +"4 c #FECFA5", +"5 c #FEB06B", +"6 c #FFA14E", +"7 c #FF9230", +"8 c #EBEBEB", +"9 c #7D7D7D", +"0 c #D48845", +"a c #A98C73", +"b c #817C78", +"c c #585451", +"d c #987B62", +"e c #847364", +"f c #C08959", +"g c #EC8C39", +"h c #100800", +"i c #EAEAEA", +"j c #B87941", +"k c #957D69", +"l c #666260", +"m c #666666", +"n c #282524", +"o c #766454", +"p c #AD784A", +"q c #C2742F", +"r c #E8E8E8", +"s c #DA8A44", +"t c #9E7A5A", +"u c #746960", +"v c #7B6F66", +"w c #B6967C", +"x c #92663E", +"y c #C98040", +"z c #EC8830", +"A c #E7E7E7", +"B c #E4944E", +"C c #B8A595", +"D c #E8E7E6", +"E c #FFE2C9", +"F c #FFD3AC", +"G c #FFB471", +"H c #FFA454", +"I c #FF9436", +"J c #803C02", +"K c #E5E5E5", +"L c #BBB8B6", +"M c #FEFDFD", +"N c #FFFEFE", +"O c #FFE3CA", +"P c #FFD3AD", +"Q c #FFB472", +"R c #FFA555", +"S c #FF9537", +"T c #803D02", +"U c #E4E4E4", +"V c #E3E3E3", +" ............ ", +".++++++++++@+. ", +".+###$$$$$$@%+. ", +".+###$$$&&&&*++.", +".+###$$$&&&&@@=.", +".+###$--;>,'.#).", +".+#!~{]^/(_:<[).", +"...}|1234567<8).", +".+#90abcdefghi).", +".+#!jklmnopqrr).", +".+#!stuvwxyzhA).", +"...}BCDEFGHIJK).", +".+#9LMNOPQRSTU).", +".+######;>,'.V).", +".)))))))&&&&))).", +" .............. "}; diff --git a/kicad/bitmaps/new_gerb.xpm b/kicad/bitmaps/new_gerb.xpm new file mode 100644 index 0000000000..43621aefeb --- /dev/null +++ b/kicad/bitmaps/new_gerb.xpm @@ -0,0 +1,97 @@ +/* XPM */ +static char * new_gerb_xpm[] = { +"16 16 78 1", +" c None", +". c #000000", +"+ c #FEFEFE", +"@ c #090909", +"# c #EEEEEE", +"$ c #F1F1F1", +"% c #FBFBFB", +"& c #767676", +"* c #424040", +"= c #807F7F", +"- c #454343", +"; c #272625", +"> c #7E7D7D", +", c #818080", +"' c #212020", +") c #161616", +"! c #A4A3A3", +"~ c #C4C4C4", +"{ c #766453", +"] c #D4C9C0", +"^ c #D9BFA8", +"/ c #D37017", +"( c #D5A07F", +"_ c #E9B9A3", +": c #A4A3A8", +"< c #ECECEC", +"[ c #737372", +"} c #E4AB79", +"| c #E8A367", +"1 c #F68724", +"2 c #A16A41", +"3 c #E1C3C7", +"4 c #A3A3A8", +"5 c #EBEBEB", +"6 c #6D6C6C", +"7 c #DBBB9E", +"8 c #F7841E", +"9 c #DABEA5", +"0 c #D6C6B7", +"a c #846852", +"b c #E6A787", +"c c #A0A0A6", +"d c #EAEAEA", +"e c #B0631E", +"f c #E6A66D", +"g c #F28F36", +"h c #C87226", +"i c #A2A1B0", +"j c #9B9AA8", +"k c #9C9CA0", +"l c #E8E8E8", +"m c #E8B89F", +"n c #957460", +"o c #876D5E", +"p c #A2898A", +"q c #A58078", +"r c #ABA5C2", +"s c #C2C2D0", +"t c #E7E7E7", +"u c #E6C3BD", +"v c #E2BFBD", +"w c #DEBBBD", +"x c #DAB8BD", +"y c #DEA897", +"z c #CD9D95", +"A c #505068", +"B c #E6E6E6", +"C c #E5E5E5", +"D c #A3A2A2", +"E c #A09FA5", +"F c #9F9FA5", +"G c #9E9DA4", +"H c #9D9DA4", +"I c #9D9CA4", +"J c #9C9BA3", +"K c #C0C0C1", +"L c #E4E4E4", +"M c #E3E3E3", +" ............ ", +".++++++++++@+. ", +".+###$$$$$$@%+. ", +".+###$$$$$$@&++.", +".+#**=-;>,,'@@).", +".+#**=-;>,,!##~.", +".+#,,{]^/(_:#<~.", +".+#[[}}|1234#5~.", +".+#667890abcdd~.", +".+#,,efghijkll~.", +".+#,,mnopqrstt~.", +".+#,,uvwxyzABC~.", +".+#DDEFGHIJKLL~.", +".+########LMMM~.", +".~~~~~~~~~~~~~~.", +" .............. "}; diff --git a/kicad/bitmaps/new_pcb.xpm b/kicad/bitmaps/new_pcb.xpm new file mode 100644 index 0000000000..389641e1ee --- /dev/null +++ b/kicad/bitmaps/new_pcb.xpm @@ -0,0 +1,54 @@ +/* XPM */ +static char * new_pcb_xpm[] = { +"16 16 35 1", +" c None", +". c #000000", +"+ c #FEFEFE", +"@ c #090909", +"# c #EEEEEE", +"$ c #F1F1F1", +"% c #FBFBFB", +"& c #FEFEFF", +"* c #F9AB7F", +"= c #9B9B9B", +"- c #161616", +"; c #F55A00", +"> c #C4C4C4", +", c #F4A67F", +"' c #FFFFFF", +") c #FAFAFF", +"! c #F6F6FF", +"~ c #F2F2FF", +"{ c #EBEBFF", +"] c #E7E7FF", +"^ c #F9F9FF", +"/ c #F1F1FF", +"( c #EEEEFF", +"_ c #EAEAFF", +": c #E3E3FF", +"< c #DFDFFF", +"[ c #FBFBFF", +"} c #F7F7FF", +"| c #F0F0FF", +"1 c #ECECFF", +"2 c #E5E5FF", +"3 c #E1E1FF", +"4 c #DDDDFF", +"5 c #E3957F", +"6 c #4D4D4D", +" ............ ", +".++++++++++@+. ", +".+###$$$$$$@%+. ", +".+...........++.", +".+.&**&&&&&&.=-.", +".+.&;;;;;;;;.=>.", +".+.&&&&&&&;,.=>.", +".+.&;;;;;;';.=>.", +".+.&**&)!~{].=>.", +".+.&;;;;;;;;.=>.", +".+.&**^/(_:<.=>.", +".+.&;;;;;;';.=>.", +".+.[}|1234;5.=>.", +".+..........6=>.", +".>>===========>.", +" .............. "}; diff --git a/kicad/bitmaps/new_python.xpm b/kicad/bitmaps/new_python.xpm new file mode 100644 index 0000000000..870dcefc39 --- /dev/null +++ b/kicad/bitmaps/new_python.xpm @@ -0,0 +1,131 @@ +/* XPM */ +static char * new_python_xpm[] = { +"16 16 112 2", +" c None", +". c #000000", +"+ c #FEFEFE", +"@ c #090909", +"# c #EEEEEE", +"$ c #F1F1F1", +"% c #FBFBFB", +"& c #DAE2E8", +"* c #CDDBE7", +"= c #528DBD", +"- c #3C7BB0", +"; c #5689B2", +"> c #DAE1E7", +", c #E9EBED", +"' c #767676", +") c #5590C1", +"! c #79A9D1", +"~ c #709FC6", +"{ c #3777AC", +"] c #3672A4", +"^ c #3C73A2", +"/ c #B2C4D4", +"( c #161616", +"_ c #C1D2E1", +": c #C2D3E2", +"< c #BFD0DE", +"[ c #BBCCDB", +"} c #366E9D", +"| c #467695", +"1 c #C4C787", +"2 c #F8E78A", +"3 c #C4C4C4", +"4 c #B7CDDF", +"5 c #3881BD", +"6 c #387EB7", +"7 c #3779B0", +"8 c #3775A9", +"9 c #366F9F", +"0 c #366B99", +"a c #597F89", +"b c #DACF62", +"c c #FFDF50", +"d c #EEEDEC", +"e c #ECECEC", +"f c #4287C0", +"g c #387EB8", +"h c #377AB1", +"i c #3776AB", +"j c #366D9B", +"k c #386A94", +"l c #728F8F", +"m c #E6CF5B", +"n c #FFD545", +"o c #F8D774", +"p c #EBEBEB", +"q c #3A7FB9", +"r c #377BB4", +"s c #4E86B5", +"t c #A8B890", +"u c #AEBA7A", +"v c #AEB674", +"w c #AFB26D", +"x c #DCC969", +"y c #FED348", +"z c #FFCA38", +"A c #F8CE5E", +"B c #EAEAEA", +"C c #4784B7", +"D c #3778AD", +"E c #88A38E", +"F c #FDEC63", +"G c #FFE95C", +"H c #FFE254", +"I c #FFDA4A", +"J c #FFD140", +"K c #FFC836", +"L c #FFC330", +"M c #F7CA65", +"N c #E8E8E8", +"O c #C1D1DE", +"P c #457EAE", +"Q c #95AB84", +"R c #FFE95B", +"S c #FBDB5F", +"T c #FBD55E", +"U c #FACE56", +"V c #FAC851", +"W c #FAC249", +"X c #E7E7E7", +"Y c #B9C9D7", +"Z c #D4CD6F", +"` c #FFE152", +" . c #FFD949", +".. c #F4D881", +"+. c #F1DA9F", +"@. c #F1D494", +"#. c #E9DFC6", +"$. c #E6E6E6", +"%. c #E5E5E5", +"&. c #F8DD79", +"*. c #FFD646", +"=. c #FFCE3D", +"-. c #FFC735", +";. c #FFE5AA", +">. c #FDCC64", +",. c #ECD9AF", +"'. c #E4E4E4", +"). c #F0E8D3", +"!. c #FBC94A", +"~. c #FDBF36", +"{. c #F9C150", +"]. c #E3E3E3", +" . . . . . . . . . . . . ", +". + + + + + + + + + + @ + . ", +". + # # # $ $ $ $ $ $ @ % + . ", +". + # # & * = - ; > , @ ' + + . ", +". + # # ) ! ~ { ] ^ / @ @ @ ( . ", +". + # # _ : < [ } | 1 2 # # 3 . ", +". + 4 5 6 7 8 9 0 a b c d e 3 . ", +". + f g h i ] j k l m n o p 3 . ", +". + q r s t u v w x y z A B 3 . ", +". + C D E F G H I J K L M N 3 . ", +". + O P Q R H S T U V W X X 3 . ", +". + # Y Z ` ...+.@.#.$.$.%.3 . ", +". + # # &.*.=.-.;.>.,.%.'.'.3 . ", +". + # # # ).!.~.{.# '.].].].3 . ", +". 3 3 3 3 3 3 3 3 3 3 3 3 3 3 . ", +" . . . . . . . . . . . . . . "}; diff --git a/kicad/bitmaps/new_sch.xpm b/kicad/bitmaps/new_sch.xpm new file mode 100644 index 0000000000..0ee2b9d2c1 --- /dev/null +++ b/kicad/bitmaps/new_sch.xpm @@ -0,0 +1,85 @@ +/* XPM */ +static char * new_sch_xpm[] = { +"16 16 66 1", +" c None", +". c #000000", +"+ c #FEFEFE", +"@ c #090909", +"# c #EEEEEE", +"$ c #F1F1F1", +"% c #FBFBFB", +"& c #FDFDFD", +"* c #FCFCFC", +"= c #DEDEDE", +"- c #BFBFBF", +"; c #767676", +"> c #F0F0F0", +", c #C1C1C1", +"' c #F9F9F9", +") c #161616", +"! c #E2E2E2", +"~ c #8F8F8F", +"{ c #B1B1B1", +"] c #6F3400", +"^ c #FF7800", +"/ c #848383", +"( c #151515", +"_ c #C4C4C4", +": c #823D00", +"< c #040404", +"[ c #BDBDBD", +"} c #ECECEC", +"| c #E0E0E0", +"1 c #8E8E8E", +"2 c #AFAFAF", +"3 c #753700", +"4 c #F67400", +"5 c #BCBCBC", +"6 c #EBEBEB", +"7 c #E5E5E5", +"8 c #1A1A1A", +"9 c #AEAEAE", +"0 c #EAEAEA", +"a c #ACACAC", +"b c #BD5900", +"c c #231000", +"d c #636363", +"e c #E7E7E7", +"f c #D9D9D9", +"g c #B9B9B9", +"h c #E8E8E8", +"i c #F4F4F4", +"j c #AAAAAA", +"k c #8A8A8A", +"l c #BEBEBE", +"m c #F37200", +"n c #A8A8A8", +"o c #888888", +"p c #D6D6D6", +"q c #E6E6E6", +"r c #060606", +"s c #B05300", +"t c #1C0D00", +"u c #626262", +"v c #E3E3E3", +"w c #BABABA", +"x c #E4E4E4", +"y c #8B8B8B", +"z c #BBBBBB", +"A c #9F9F9F", +" ............ ", +".++++++++++@+. ", +".+#.......$@%+. ", +".+.&&&&*=-.@;++.", +".+.&>>>>,'..@@).", +".+.&!~{]^/(.##_.", +".+...:<^^^[.#}_.", +".+.&|1234^5.#6_.", +".+.78960a89.00_.", +".+.(bcdeefg.hh_.", +".+.i^43jkfl.ee_.", +".+.i^m]nop5.q7_.", +".+.rstuv!!w.xx_.", +".+.w(yzwwwA.vv_.", +".______________.", +" .............. "}; diff --git a/kicad/bitmaps/reload.xpm b/kicad/bitmaps/reload.xpm new file mode 100644 index 0000000000..3dc28c25eb --- /dev/null +++ b/kicad/bitmaps/reload.xpm @@ -0,0 +1,171 @@ +/* XPM */ +static char * reload_xpm[] = { +"16 16 152 2", +" c None", +". c #3ACF73", +"+ c #35C96E", +"@ c #64D790", +"# c #3DC973", +"$ c #51CE81", +"% c #56CE84", +"& c #55CE84", +"* c #54CE83", +"= c #53CE82", +"- c #52CE82", +"; c #4FCF80", +"> c #4CD07F", +", c #97F1B8", +"' c #29A759", +") c #70D697", +"! c #F0FEF5", +"~ c #D3F8E1", +"{ c #CEF8DF", +"] c #C3F7D8", +"^ c #B4F5CD", +"/ c #A7F2C2", +"( c #9CEDBA", +"_ c #8DE7AF", +": c #84E4A7", +"< c #6FDA97", +"[ c #32B966", +"} c #23A254", +"| c #76D79B", +"1 c #CCFADD", +"2 c #80EFAA", +"3 c #7BF0A8", +"4 c #69ED9C", +"5 c #56EB8F", +"6 c #47E382", +"7 c #3FD778", +"8 c #39CB6F", +"9 c #32BF67", +"0 c #2BB25F", +"a c #2EAF5F", +"b c #2CAD5D", +"c c #107D3C", +"d c #73D699", +"e c #C5F9D9", +"f c #75ECA2", +"g c #6AE898", +"h c #5EE992", +"i c #50E487", +"j c #47D67C", +"k c #40CC74", +"l c #37BE6A", +"m c #30B160", +"n c #2DAD5D", +"o c #2BA85A", +"p c #158643", +"q c #01421D", +"r c #77DF9E", +"s c #B8F8D1", +"t c #5FE994", +"u c #34C169", +"v c #1E974D", +"w c #1A8B46", +"x c #168643", +"y c #12803E", +"z c #0F7639", +"A c #107639", +"B c #26A155", +"C c #158442", +"D c #003717", +"E c #95F1B8", +"F c #A8F7C6", +"G c #3ED878", +"H c #60C687", +"I c #388558", +"J c #000700", +"K c #001D0A", +"L c #0A6E34", +"M c #12793C", +"N c #076328", +"O c #1F7A3C", +"P c #267544", +"Q c #EEFFF3", +"R c #85E4A9", +"S c #51C07B", +"T c #8BEDB0", +"U c #13813F", +"V c #001C09", +"W c #00260F", +"X c #015C28", +"Y c #076026", +"Z c #1A853C", +"` c #178042", +" . c #186D2F", +".. c #C1EED2", +"+. c #73C592", +"@. c #80E1A4", +"#. c #3DD275", +"$. c #51B979", +"%. c #65D28F", +"&. c #56D486", +"*. c #47CE7B", +"=. c #36BD6A", +"-. c #2A9D57", +";. c #2EA556", +">. c #1C8E49", +",. c #126C38", +"'. c #084E20", +"). c #54B77B", +"!. c #7FE1A3", +"~. c #3ECF74", +"{. c #38C66D", +"]. c #4ED17E", +"^. c #52CC7F", +"/. c #45C273", +"(. c #3BBA6B", +"_. c #31B261", +":. c #2EAC5E", +"<. c #259E55", +"[. c #188944", +"}. c #106835", +"|. c #00421D", +"1. c #01471E", +"2. c #27A658", +"3. c #3BC971", +"4. c #36BB68", +"5. c #26A555", +"6. c #229E52", +"7. c #1E954C", +"8. c #1C8C48", +"9. c #198443", +"0. c #167C3E", +"a. c #13733B", +"b. c #14723A", +"c. c #0F5F32", +"d. c #01451F", +"e. c #02441E", +"f. c #209B51", +"g. c #198745", +"h. c #055F2A", +"i. c #05612C", +"j. c #035F2B", +"k. c #035D2A", +"l. c #045A29", +"m. c #045828", +"n. c #045628", +"o. c #045428", +"p. c #05592A", +"q. c #004820", +"r. c #087435", +"s. c #00210D", +"t. c #00461E", +"u. c #00230F", +" . ", +" + @ ", +"# $ % & & * = - ; > , ' ", +") ! ~ { ] ^ / ( _ : < [ } ", +"| 1 2 3 4 5 6 7 8 9 0 a b c ", +"d e f g h i j k l m n o p q ", +"r s t u v w x y z A B C D ", +"E F G H I J K L M N O P ", +"Q R S T U V W X Y Z ` . ", +"..+.@.#.$.%.&.*.=.-.;.>.,.'. ", +").!.~.{.].^./.(._.:.<.[.}.|. ", +"1.2.3.4.5.6.7.8.9.0.a.b.c.d. ", +" e.f.g.h.i.j.k.l.m.n.o.p.q. ", +" e.r.s. ", +" t.u. ", +" "}; diff --git a/kicad/bitmaps/unknown.xpm b/kicad/bitmaps/unknown.xpm new file mode 100644 index 0000000000..f8368f9863 --- /dev/null +++ b/kicad/bitmaps/unknown.xpm @@ -0,0 +1,68 @@ +/* XPM */ +static char * unknown_xpm[] = { +"16 16 49 1", +" c None", +". c #C6C6D5", +"+ c #9494AD", +"@ c #FBFBFC", +"# c #F8F8FA", +"$ c #F4F4F7", +"% c #EEEEF2", +"& c #EAEAF0", +"* c #DEDEE7", +"= c #E0E0E9", +"- c #F5F5F8", +"; c #F0F0F4", +"> c #EDEDF2", +", c #E1E1E9", +"' c #C9C9D7", +") c #E4E4EB", +"! c #F7F7F9", +"~ c #F1F1F5", +"{ c #E6E6ED", +"] c #DBDBE5", +"^ c #CDCDDA", +"/ c #BFBFD0", +"( c #F2F2F6", +"_ c #E7E7EE", +": c #E3E3EA", +"< c #D0D0DC", +"[ c #C4C4D3", +"} c #C2C2D1", +"| c #FAFAFB", +"1 c #F3F3F6", +"2 c #E8E8EE", +"3 c #CBCBD9", +"4 c #C8C8D6", +"5 c #F9F9FA", +"6 c #DCDCE5", +"7 c #D6D6E1", +"8 c #D2D2DE", +"9 c #D1D1DD", +"0 c #CECEDB", +"a c #EBEBF1", +"b c #DADAE4", +"c c #D4D4E0", +"d c #E5E5EC", +"e c #DFDFE8", +"f c #DDDDE6", +"g c #D7D7E2", +"h c #E9E9EF", +"i c #D9D9E3", +"j c #EFEFF3", +" ........+ ", +" .@#$%&*=.+ ", +" .@#-;>,=.'+ ", +" .@#-;%)=++++ ", +" .@!-~%{=]^/+ ", +" .@!-(;_:<[}+ ", +" .|!-1;2=34.+ ", +" .5$(%&67890+ ", +" .-(~a:]b7c8+ ", +" .-$%d:efbg7+ ", +" .!~h{)=e]i7+ ", +" .!j2{)=e6bg+ ", +" .$&2{d:e6bg+ ", +" .12_d),e]bg+ ", +" .;22{)=e6bg+ ", +" ++++++++++++ "}; diff --git a/kicad/buildmnu.cpp b/kicad/buildmnu.cpp index 546718a1a4..ae2870910d 100644 --- a/kicad/buildmnu.cpp +++ b/kicad/buildmnu.cpp @@ -1,309 +1,323 @@ - /***********************************************/ - /* buildmnu.h: construction du menu principal */ - /***********************************************/ - -#include "fctsys.h" -#include "gr_basic.h" -#include "common.h" - -#include "wx/spinctrl.h" - -#include "kicad.h" -#include "macros.h" - -#define BITMAP wxBitmap - -// ---------------------------------------------------------------------------- -// resources -// ---------------------------------------------------------------------------- - -// USE_XPM_BITMAPS -#include "bitmaps.h" // Common bitmaps - -#include "zip.xpm" -#include "unzip.xpm" -#include "Browse_Files.xpm" -#include "Editor.xpm" -#include "New_Project.xpm" -#include "Open_Project.xpm" - -#include "id.h" - -/* Fonctions locales */ - -/* Variables locales */ - - -BEGIN_EVENT_TABLE(WinEDA_MainFrame, WinEDA_BasicFrame) - EVT_SIZE(WinEDA_MainFrame::OnSize) - EVT_CLOSE(WinEDA_MainFrame::OnCloseWindow) - EVT_SASH_DRAGGED(ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag) - EVT_SASH_DRAGGED(ID_BOTTOM_FRAME, WinEDA_MainFrame::OnSashDrag) - EVT_SASH_DRAGGED(ID_MAIN_COMMAND, WinEDA_MainFrame::OnSashDrag) - - EVT_MENU_RANGE(ID_LOAD_PROJECT,ID_LOAD_FILE_10, - WinEDA_MainFrame::Process_Files) - EVT_MENU(ID_SAVE_PROJECT, WinEDA_MainFrame::Process_Files) - - EVT_TOOL(ID_NEW_PROJECT, WinEDA_MainFrame::Process_Files) - EVT_TOOL(ID_LOAD_PROJECT, WinEDA_MainFrame::Process_Files) - EVT_TOOL(ID_SAVE_PROJECT, WinEDA_MainFrame::Process_Files) - EVT_TOOL(ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::Process_Files) - - EVT_MENU(ID_EXIT, WinEDA_MainFrame::Process_Special_Functions) - - EVT_MENU(ID_TO_EDITOR, WinEDA_MainFrame::Process_Fct) - EVT_MENU(ID_BROWSE_AN_SELECT_FILE, WinEDA_MainFrame::Process_Fct) - EVT_MENU(ID_SELECT_PREFERED_EDITOR, WinEDA_MainFrame::Process_Preferences) - EVT_MENU(ID_SELECT_DEFAULT_PDF_BROWSER, WinEDA_MainFrame::Process_Preferences) - EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER, WinEDA_MainFrame::Process_Preferences) - EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME, WinEDA_MainFrame::Process_Preferences) - EVT_MENU(ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::Process_Files) - EVT_MENU(ID_READ_ZIP_ARCHIVE, WinEDA_MainFrame::Process_Files) - - EVT_MENU(ID_PREFERENCES_FONT_INFOSCREEN, WinEDA_MainFrame::Process_Preferences) - - EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, - WinEDA_MainFrame::SetLanguage) - - - EVT_MENU(ID_GENERAL_HELP, WinEDA_MainFrame::GetKicadHelp) - EVT_MENU(ID_KICAD_ABOUT, WinEDA_MainFrame::GetKicadAbout) - - EVT_BUTTON(ID_TO_PCB, WinEDA_MainFrame::Process_Fct) - EVT_BUTTON(ID_TO_CVPCB, WinEDA_MainFrame::Process_Fct) - EVT_BUTTON(ID_TO_EESCHEMA, WinEDA_MainFrame::Process_Fct) - EVT_BUTTON(ID_TO_GERBVIEW, WinEDA_MainFrame::Process_Fct) - -END_EVENT_TABLE() - - -/*******************************************/ -void WinEDA_MainFrame::ReCreateMenuBar(void) -/*******************************************/ -{ -int ii, jj; -wxMenuBar * menuBar = GetMenuBar() ; - - if( menuBar == NULL ) - { - m_MenuBar = menuBar = new wxMenuBar(); - - m_FilesMenu = new wxMenu; - wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT, - _("&Open Project Descr"), - _("Select an existing project descriptor") ); - item->SetBitmap(open_project_xpm); - m_FilesMenu->Append(item); - - item = new wxMenuItem(m_FilesMenu, ID_NEW_PROJECT, - _("&New Project Descr"), - _("Create new project descriptor") ); - item->SetBitmap(new_project_xpm); - m_FilesMenu->Append(item); - - item = new wxMenuItem(m_FilesMenu, ID_SAVE_PROJECT, - _("&Save Project Descr"), - _("Save current project descriptor") ); - item->SetBitmap(save_project_xpm); - m_FilesMenu->Append(item); - - m_FilesMenu->AppendSeparator(); - item = new wxMenuItem(m_FilesMenu, ID_SAVE_AND_ZIP_FILES, - _("Save &Project Files"), - _("Save and Zip all project files") ); - item->SetBitmap(zip_xpm); - m_FilesMenu->Append(item); - item = new wxMenuItem(m_FilesMenu, ID_READ_ZIP_ARCHIVE, - _("&Unzip Archive"), - _("UnZip archive file") ); - item->SetBitmap(unzip_xpm); - m_FilesMenu->Append(item); - - m_FilesMenu->AppendSeparator(); - item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit Kicad") ); - item->SetBitmap(exit_xpm); - m_FilesMenu->Append(item); - - // Creation des selections des anciens fichiers - m_FilesMenu->AppendSeparator(); - for ( ii = 0; ii < 10; ii++ ) - { - if ( GetLastProject(ii).IsEmpty() ) break; - m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); - } - - // Menu Browse - wxMenu *browseMenu = new wxMenu(); - item = new wxMenuItem(browseMenu, ID_TO_EDITOR, - _("&Editor"), _("Text editor") ); - item->SetBitmap(editor_xpm); - browseMenu->Append(item); - item = new wxMenuItem(browseMenu, ID_BROWSE_AN_SELECT_FILE, - _("&Browse Files"), _("Read or edit files") ); - item->SetBitmap(browse_files_xpm); - browseMenu->Append(item); - browseMenu->AppendSeparator(); - item = new wxMenuItem(browseMenu, ID_SELECT_PREFERED_EDITOR, - _("&Select Editor"), _("Select your prefered editor for file browsing") ); - item->SetBitmap(editor_xpm); - browseMenu->Append(item); - - // Preferences menu: - wxMenu *PreferencesMenu = new wxMenu; - item = new wxMenuItem(PreferencesMenu , ID_PREFERENCES_FONT_INFOSCREEN, - _("Select Fonts"), _("Select Fonts and Font sizes")); - item->SetBitmap(fonts_xpm); - PreferencesMenu->Append(item); - - // Submenu Pdf Browser selection: system browser or user selected browser (and its name) - wxMenu *SubMenuPdfBrowserChoice = new wxMenu; - item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_DEFAULT_PDF_BROWSER, - _("Default Pdf Viewer"), _("Use the default (system) PDF viewer used to browse datasheets"), - wxITEM_CHECK); - SETBITMAPS(datasheet_xpm); - SubMenuPdfBrowserChoice->Append(item); - SubMenuPdfBrowserChoice->Check(ID_SELECT_DEFAULT_PDF_BROWSER, - EDA_Appl->m_PdfBrowserIsDefault); - item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER, - _("Favourite Pdf Viewer"), _("Use your favourite PDF viewer used to browse datasheets"), - wxITEM_CHECK); - SETBITMAPS(preference_xpm); - SubMenuPdfBrowserChoice->Append(item); - SubMenuPdfBrowserChoice->AppendSeparator(); - SubMenuPdfBrowserChoice->Check(ID_SELECT_PREFERED_PDF_BROWSER, - !EDA_Appl->m_PdfBrowserIsDefault); - item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER_NAME, - _("Select Pdf Viewer"), _("Select your favourite PDF viewer used to browse datasheets")); - item->SetBitmap(datasheet_xpm); - SubMenuPdfBrowserChoice->Append(item); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU(PreferencesMenu, SubMenuPdfBrowserChoice, - -1, _("Pdf Browser"), - wxT("Pdf Browser choice: default or user selection"), - datasheet_xpm); - - PreferencesMenu->AppendSeparator(); - m_Parent->SetLanguageList(PreferencesMenu); - - - // Menu Help: - wxMenu *helpMenu = new wxMenu; - item = new wxMenuItem(helpMenu , ID_GENERAL_HELP, - _("Kicad &Help"), _("On line doc")); - item->SetBitmap(help_xpm); - helpMenu->Append(item); - - item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT, - _("Kicad &About"), _("Kicad Infos")); - item->SetBitmap(info_xpm); - helpMenu->Append(item); - - - menuBar->Append(m_FilesMenu, _("&Projects")); - menuBar->Append(browseMenu, _("&Browse")); - menuBar->Append(PreferencesMenu, _("&Preferences")); - menuBar->Append(helpMenu, _("&Help")); - - // Associate the menu bar with the frame - SetMenuBar(menuBar); - } - else // simple mise a jour de la liste des fichiers anciens - { - wxMenuItem * item; - int max_file = m_Parent->m_LastProjectMaxCount; - for ( ii = max_file-1; ii >=0 ; ii-- ) - { - if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) - { - item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); - if ( item ) delete item; - } - } - for ( jj = 0, ii = 0; ii < max_file; ii++ ) - { - if (GetLastProject(ii).IsEmpty() ) break; - m_FilesMenu->Append(ID_LOAD_FILE_1 + jj, GetLastProject(ii) ); - jj++; - } - } -} - - -/***************************************************/ -void WinEDA_MainFrame::RecreateBaseHToolbar(void) -/***************************************************/ -{ - if ( m_HToolBar != NULL ) return; - - m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE); - SetToolBar(m_HToolBar); - - // Set up toolbar - m_HToolBar->AddTool(ID_NEW_PROJECT, BITMAP(new_project_xpm), - wxNullBitmap, FALSE, - -1, -1, (wxObject *) NULL, - _("Create new project descriptor")); - - m_HToolBar->AddTool(ID_LOAD_PROJECT, BITMAP(open_project_xpm), - wxNullBitmap, FALSE, - -1, -1, (wxObject *) NULL, - _("Select an existing project descriptor")); - - m_HToolBar->AddTool(ID_SAVE_PROJECT, BITMAP(save_project_xpm), - wxNullBitmap, FALSE, - -1, -1, (wxObject *) NULL, - _("Save current project descriptor")); - - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool(ID_SAVE_AND_ZIP_FILES, BITMAP(zip_xpm), - wxNullBitmap, FALSE, - -1, -1, (wxObject *) NULL, - _("Archive all project files")); - - - // after adding the buttons to the toolbar, must call Realize() to reflect - // the changes - m_HToolBar->Realize(); -} - -/*************************************************/ -void WinEDA_MainFrame::CreateCommandToolbar(void) -/*************************************************/ -{ -#define SEPAR 20 -int sizex, sizey,width; -wxBitmapButton * Butt; -wxPoint pos; - - // delete and recreate the toolbar - if( m_VToolBar ) return; - - m_CommandWin->GetClientSize(&sizex, &sizey); - width = 300; - - // Set up toolbar - width = 32; - pos.x = 20; pos.y = 20; - - Butt = new wxBitmapButton(m_CommandWin, ID_TO_EESCHEMA, - BITMAP(icon_eeschema_xpm), pos ); - Butt->SetToolTip(_("EeSchema (Schematic editor)")); - - pos.x += width + SEPAR; - Butt = new wxBitmapButton(m_CommandWin,ID_TO_CVPCB, - BITMAP(icon_cvpcb_xpm), pos ); - Butt->SetToolTip(_("Cvpcb (Componants to modules)")); - - pos.x += width + SEPAR; - Butt = new wxBitmapButton(m_CommandWin, ID_TO_PCB, - BITMAP(a_icon_pcbnew_xpm), pos ); - Butt->SetToolTip(_("Pcbnew ( board editor )")); - - pos.x += width + SEPAR; - Butt = new wxBitmapButton(m_CommandWin, ID_TO_GERBVIEW, - BITMAP(icon_gerbview_xpm), pos ); - Butt->SetToolTip(_("GerbView ( Gerber viewer )")); - -} - - + /***********************************************/ + /* buildmnu.h: construction du menu principal */ + /***********************************************/ + +#include "fctsys.h" +#include "gr_basic.h" +#include "common.h" + +#include "wx/spinctrl.h" + +#include "kicad.h" +#include "macros.h" + +#define BITMAP wxBitmap + +// ---------------------------------------------------------------------------- +// resources +// ---------------------------------------------------------------------------- + +// USE_XPM_BITMAPS +#include "bitmaps.h" // Common bitmaps + +#include "zip.xpm" +#include "unzip.xpm" +#include "Browse_Files.xpm" +#include "Editor.xpm" +#include "New_Project.xpm" +#include "Open_Project.xpm" +#include "../bitmaps/icon_python.xpm" +#include "../bitmaps/reload.xpm" + +#include "id.h" + +/* Fonctions locales */ + +/* Variables locales */ + + +BEGIN_EVENT_TABLE(WinEDA_MainFrame, WinEDA_BasicFrame) + EVT_SIZE(WinEDA_MainFrame::OnSize) + EVT_CLOSE(WinEDA_MainFrame::OnCloseWindow) + EVT_SASH_DRAGGED(ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag) + EVT_SASH_DRAGGED(ID_BOTTOM_FRAME, WinEDA_MainFrame::OnSashDrag) + EVT_SASH_DRAGGED(ID_MAIN_COMMAND, WinEDA_MainFrame::OnSashDrag) + + EVT_MENU_RANGE(ID_LOAD_PROJECT,ID_LOAD_FILE_10, + WinEDA_MainFrame::Process_Files) + EVT_MENU(ID_SAVE_PROJECT, WinEDA_MainFrame::Process_Files) + + EVT_TOOL(ID_NEW_PROJECT, WinEDA_MainFrame::Process_Files) + EVT_TOOL(ID_LOAD_PROJECT, WinEDA_MainFrame::Process_Files) + EVT_TOOL(ID_SAVE_PROJECT, WinEDA_MainFrame::Process_Files) + EVT_TOOL(ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::Process_Files) + + EVT_MENU(ID_EXIT, WinEDA_MainFrame::Process_Special_Functions) + + EVT_MENU(ID_TO_EDITOR, WinEDA_MainFrame::Process_Fct) + EVT_MENU(ID_BROWSE_AN_SELECT_FILE, WinEDA_MainFrame::Process_Fct) + EVT_MENU(ID_SELECT_PREFERED_EDITOR, WinEDA_MainFrame::Process_Preferences) + EVT_MENU(ID_SELECT_DEFAULT_PDF_BROWSER, WinEDA_MainFrame::Process_Preferences) + EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER, WinEDA_MainFrame::Process_Preferences) + EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME, WinEDA_MainFrame::Process_Preferences) + EVT_MENU(ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::Process_Files) + EVT_MENU(ID_READ_ZIP_ARCHIVE, WinEDA_MainFrame::Process_Files) + EVT_MENU(ID_PROJECT_TREE_REFRESH, WinEDA_MainFrame::OnRefresh) + + EVT_MENU(ID_PREFERENCES_FONT_INFOSCREEN, WinEDA_MainFrame::Process_Preferences) + + EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, + WinEDA_MainFrame::SetLanguage) + + + EVT_MENU(ID_GENERAL_HELP, WinEDA_MainFrame::GetKicadHelp) + EVT_MENU(ID_KICAD_ABOUT, WinEDA_MainFrame::GetKicadAbout) + + EVT_BUTTON(ID_TO_PCB, WinEDA_MainFrame::Process_Fct) + EVT_BUTTON(ID_TO_CVPCB, WinEDA_MainFrame::Process_Fct) + EVT_BUTTON(ID_TO_EESCHEMA, WinEDA_MainFrame::Process_Fct) + EVT_BUTTON(ID_TO_GERBVIEW, WinEDA_MainFrame::Process_Fct) + +#ifdef KICAD_PYTHON + EVT_BUTTON(ID_RUN_PYTHON, WinEDA_MainFrame::Process_Fct) +#endif + +END_EVENT_TABLE() + + +/*******************************************/ +void WinEDA_MainFrame::ReCreateMenuBar(void) +/*******************************************/ +{ +int ii, jj; +wxMenuBar * menuBar = GetMenuBar() ; + + if( menuBar == NULL ) + { + m_MenuBar = menuBar = new wxMenuBar(); + + m_FilesMenu = new wxMenu; + wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT, + _("&Open Project Descr"), + _("Select an existing project descriptor") ); + item->SetBitmap(open_project_xpm); + m_FilesMenu->Append(item); + + item = new wxMenuItem(m_FilesMenu, ID_NEW_PROJECT, + _("&New Project Descr"), + _("Create new project descriptor") ); + item->SetBitmap(new_project_xpm); + m_FilesMenu->Append(item); + + item = new wxMenuItem(m_FilesMenu, ID_SAVE_PROJECT, + _("&Save Project Descr"), + _("Save current project descriptor") ); + item->SetBitmap(save_project_xpm); + m_FilesMenu->Append(item); + + m_FilesMenu->AppendSeparator(); + item = new wxMenuItem(m_FilesMenu, ID_SAVE_AND_ZIP_FILES, + _("Save &Project Files"), + _("Save and Zip all project files") ); + item->SetBitmap(zip_xpm); + m_FilesMenu->Append(item); + item = new wxMenuItem(m_FilesMenu, ID_READ_ZIP_ARCHIVE, + _("&Unzip Archive"), + _("UnZip archive file") ); + item->SetBitmap(unzip_xpm); + m_FilesMenu->Append(item); + + m_FilesMenu->AppendSeparator(); + item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit Kicad") ); + item->SetBitmap(exit_xpm); + m_FilesMenu->Append(item); + + // Creation des selections des anciens fichiers + m_FilesMenu->AppendSeparator(); + for ( ii = 0; ii < 10; ii++ ) + { + if ( GetLastProject(ii).IsEmpty() ) break; + m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); + } + + // Menu Browse + wxMenu *browseMenu = new wxMenu(); + item = new wxMenuItem(browseMenu, ID_TO_EDITOR, + _("&Editor"), _("Text editor") ); + item->SetBitmap(editor_xpm); + browseMenu->Append(item); + item = new wxMenuItem(browseMenu, ID_BROWSE_AN_SELECT_FILE, + _("&Browse Files"), _("Read or edit files") ); + item->SetBitmap(browse_files_xpm); + browseMenu->Append(item); + browseMenu->AppendSeparator(); + item = new wxMenuItem(browseMenu, ID_SELECT_PREFERED_EDITOR, + _("&Select Editor"), _("Select your prefered editor for file browsing") ); + item->SetBitmap(editor_xpm); + browseMenu->Append(item); + + // Preferences menu: + wxMenu *PreferencesMenu = new wxMenu; + item = new wxMenuItem(PreferencesMenu , ID_PREFERENCES_FONT_INFOSCREEN, + _("Select Fonts"), _("Select Fonts and Font sizes")); + item->SetBitmap(fonts_xpm); + PreferencesMenu->Append(item); + + // Submenu Pdf Browser selection: system browser or user selected browser (and its name) + wxMenu *SubMenuPdfBrowserChoice = new wxMenu; + item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_DEFAULT_PDF_BROWSER, + _("Default Pdf Viewer"), _("Use the default (system) PDF viewer used to browse datasheets"), + wxITEM_CHECK); + SETBITMAPS(datasheet_xpm); + SubMenuPdfBrowserChoice->Append(item); + SubMenuPdfBrowserChoice->Check(ID_SELECT_DEFAULT_PDF_BROWSER, + EDA_Appl->m_PdfBrowserIsDefault); + item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER, + _("Favourite Pdf Viewer"), _("Use your favourite PDF viewer used to browse datasheets"), + wxITEM_CHECK); + SETBITMAPS(preference_xpm); + SubMenuPdfBrowserChoice->Append(item); + SubMenuPdfBrowserChoice->AppendSeparator(); + SubMenuPdfBrowserChoice->Check(ID_SELECT_PREFERED_PDF_BROWSER, + !EDA_Appl->m_PdfBrowserIsDefault); + item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER_NAME, + _("Select Pdf Viewer"), _("Select your favourite PDF viewer used to browse datasheets")); + item->SetBitmap(datasheet_xpm); + SubMenuPdfBrowserChoice->Append(item); + ADD_MENUITEM_WITH_HELP_AND_SUBMENU(PreferencesMenu, SubMenuPdfBrowserChoice, + -1, _("Pdf Browser"), + wxT("Pdf Browser choice: default or user selection"), + datasheet_xpm); + + PreferencesMenu->AppendSeparator(); + m_Parent->SetLanguageList(PreferencesMenu); + + + // Menu Help: + wxMenu *helpMenu = new wxMenu; + item = new wxMenuItem(helpMenu , ID_GENERAL_HELP, + _("Kicad &Help"), _("On line doc")); + item->SetBitmap(help_xpm); + helpMenu->Append(item); + + item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT, + _("Kicad &About"), _("Kicad Infos")); + item->SetBitmap(info_xpm); + helpMenu->Append(item); + + + menuBar->Append(m_FilesMenu, _("&Projects")); + menuBar->Append(browseMenu, _("&Browse")); + menuBar->Append(PreferencesMenu, _("&Preferences")); + menuBar->Append(helpMenu, _("&Help")); + + // Associate the menu bar with the frame + SetMenuBar(menuBar); + } + else // simple mise a jour de la liste des fichiers anciens + { + wxMenuItem * item; + int max_file = m_Parent->m_LastProjectMaxCount; + for ( ii = max_file-1; ii >=0 ; ii-- ) + { + if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) + { + item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); + if ( item ) delete item; + } + } + for ( jj = 0, ii = 0; ii < max_file; ii++ ) + { + if (GetLastProject(ii).IsEmpty() ) break; + m_FilesMenu->Append(ID_LOAD_FILE_1 + jj, GetLastProject(ii) ); + jj++; + } + } +} + + +/***************************************************/ +void WinEDA_MainFrame::RecreateBaseHToolbar(void) +/***************************************************/ +{ + if ( m_HToolBar != NULL ) return; + + m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE); + SetToolBar(m_HToolBar); + + // Set up toolbar + m_HToolBar->AddTool(ID_NEW_PROJECT, BITMAP(new_project_xpm), + wxNullBitmap, FALSE, + -1, -1, (wxObject *) NULL, + _("Create new project descriptor")); + + m_HToolBar->AddTool(ID_LOAD_PROJECT, BITMAP(open_project_xpm), + wxNullBitmap, FALSE, + -1, -1, (wxObject *) NULL, + _("Select an existing project descriptor")); + + m_HToolBar->AddTool(ID_SAVE_PROJECT, BITMAP(save_project_xpm), + wxNullBitmap, FALSE, + -1, -1, (wxObject *) NULL, + _("Save current project descriptor")); + + m_HToolBar->AddSeparator(); + m_HToolBar->AddTool(ID_SAVE_AND_ZIP_FILES, BITMAP(zip_xpm), + wxNullBitmap, FALSE, + -1, -1, (wxObject *) NULL, + _("Archive all project files")); + + m_HToolBar->AddSeparator(); + m_HToolBar->AddTool(ID_PROJECT_TREE_REFRESH, BITMAP(reload_xpm), + wxNullBitmap, FALSE, + -1, -1, (wxObject *) NULL, + _("Refresh project tree")); + + + // after adding the buttons to the toolbar, must call Realize() to reflect + // the changes + m_HToolBar->Realize(); +} + +/*************************************************/ +void WinEDA_MainFrame::CreateCommandToolbar(void) +/*************************************************/ +{ +wxBitmapButton * btn; + + // delete and recreate the toolbar + if( m_VToolBar ) return; + btn = new wxBitmapButton( this, ID_TO_EESCHEMA, BITMAP(icon_eeschema_xpm) ); + btn->SetToolTip(_("EeSchema (Schematic editor)")); + AddFastLaunch( btn ); + + btn = new wxBitmapButton( this,ID_TO_CVPCB, BITMAP(icon_cvpcb_xpm) ); + btn->SetToolTip(_("Cvpcb (Componants to modules)")); + AddFastLaunch( btn ); + + btn = new wxBitmapButton( this, ID_TO_PCB, BITMAP(a_icon_pcbnew_xpm) ); + btn->SetToolTip(_("Pcbnew ( board editor )")); + AddFastLaunch( btn ); + + btn = new wxBitmapButton( this, ID_TO_GERBVIEW, BITMAP(icon_gerbview_xpm) ); + btn->SetToolTip(_("GerbView ( Gerber viewer )")); + AddFastLaunch( btn ); + + + // Set up toolbar + + #ifdef KICAD_PYTHON + btn = new wxBitmapButton( this, ID_RUN_PYTHON, BITMAP(icon_python_xpm) ); + btn->SetToolTip(_("Run Python Script")); + AddFastLaunch( btn ); + #endif +} + +void WinEDA_MainFrame::AddFastLaunch( wxButton * button, int sep ) +{ + static wxPoint pos (20, 20); + button->Reparent( m_CommandWin ); + button->Move( pos ); + pos.x += button->GetSize().GetWidth() + sep; +} + diff --git a/kicad/files-io.cpp b/kicad/files-io.cpp index 40d363bc55..ad0628db82 100644 --- a/kicad/files-io.cpp +++ b/kicad/files-io.cpp @@ -242,7 +242,8 @@ wxFileName zip_name(filename); wxChar * Ext_to_arch[] = { /* Liste des extensions des fichiers à sauver */ wxT("*.sch"), wxT("*.lib"), wxT("*.cmp"), wxT("*.brd"), - wxT("*.net"), wxT("*.pro"), wxT("*.pho"), + wxT("*.net"), wxT("*.pro"), wxT("*.pho"), wxT("*.py"), + wxT("*.pdf"), wxT("*.txt"), NULL}; int ii = 0; wxString zip_cmd = wxT("-O ") + zip_file_fullname; diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index f9d21667e9..cd4db79653 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -1,92 +1,252 @@ - /********************************/ - /* kicad.cpp - module principal */ - /********************************/ - -#ifdef __GNUG__ -#pragma implementation -#endif - -#define MAIN -#define eda_global - -#include "fctsys.h" - -#include - -//#define SPLASH_OK - -#ifdef SPLASH_OK -#include -#endif - -#include "wxstruct.h" -#include "common.h" -#include "bitmaps.h" -#include "kicad.h" -#include "macros.h" - -/* Routines exportees */ - -/* fonctions importees */ -char *GetFileName(char *FullPathName); -void ShowLogo(char * FonteFileName); - -/* Routines locales */ - - /************************************/ - /* Called to initialize the program */ - /************************************/ - -// Create a new application object -IMPLEMENT_APP(WinEDA_App) - -bool WinEDA_App::OnInit(void) -{ - EDA_Appl = this; - InitEDA_Appl( wxT("kicad")); - - /* init kicad */ - GetSettings(); // read current setup - - m_MainFrame = new WinEDA_MainFrame(this, NULL, wxT("KiCad"), - wxPoint(0,0), wxSize(600,400) ); - if(argc > 1 ) m_MainFrame->m_PrjFileName = argv[1]; - else if ( m_EDA_Config ) - { - m_MainFrame->m_PrjFileName = m_EDA_Config->Read(wxT("LastProject"), - wxT("noname.pro") ); - } - else m_MainFrame->m_PrjFileName = wxT("noname.pro"); - - wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); - Title += wxT(" ") + m_MainFrame->m_PrjFileName; - m_MainFrame->SetTitle(Title); - m_MainFrame->ReCreateMenuBar(); - m_MainFrame->RecreateBaseHToolbar(); - - m_MainFrame->m_LeftWin->ReCreateTreePrj(); - SetTopWindow(m_MainFrame); - m_MainFrame->Show(TRUE); - - /* Preparation Affichage du logo */ -#ifdef SPLASH_OK -wxString logoname( wxString(m_BinDir) + wxT("logokicad.png") ); -wxBitmap image; - if ( image.LoadFile( logoname, wxBITMAP_TYPE_PNG ) ) - { - wxSplashScreen * logoscreen = new wxSplashScreen( image, - wxSPLASH_CENTRE_ON_PARENT | wxSPLASH_TIMEOUT, - 500, m_MainFrame, -1, - wxDefaultPosition, wxDefaultSize, - wxSIMPLE_BORDER | wxSTAY_ON_TOP); - } -#endif - - if ( wxFileExists(m_MainFrame->m_PrjFileName) ) - { - m_MainFrame->Load_Prj_Config(); - } - - return TRUE; -} - + /********************************/ + /* kicad.cpp - module principal */ + /********************************/ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#define MAIN +#define eda_global + +#include "fctsys.h" + +#include + +//#define SPLASH_OK + +#ifdef SPLASH_OK +#include +#endif +#include + +#include "wxstruct.h" +#include "common.h" +#include "bitmaps.h" +#include "kicad.h" +#include "macros.h" + +#ifdef KICAD_PYTHON +#include +#endif + +/* Routines exportees */ + +/* fonctions importees */ +char *GetFileName(char *FullPathName); +void ShowLogo(char * FonteFileName); + +/* Routines locales */ + + /************************************/ + /* Called to initialize the program */ + /************************************/ + +// Create a new application object +IMPLEMENT_APP(WinEDA_App) + +#ifdef KICAD_PYTHON +using namespace boost::python; + +// Global functions: +static WinEDA_MainFrame& GetMainFrame(void) { return *( wxGetApp().m_MainFrame ); } +static void WinEDAPrint( str msg ) { GetMainFrame().PrintMsg( PyHandler::MakeStr( msg ) + wxT("\n") ); } +static void WinEDAClear() { GetMainFrame().ClearMsg(); } +static object GetTypeExt( enum TreeFileType type ) { return PyHandler::Convert( WinEDA_PrjFrame::GetFileExt( type ) ); } + +// WinEDA_MainFrame Special binding functions: +// (one line functions are simple wrappers) + +object WinEDA_MainFrame::GetPrjName() const { return PyHandler::Convert( m_PrjFileName ); } +object WinEDA_MainFrame::ToWx() { return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); } +WinEDA_PrjFrame* WinEDA_MainFrame::GetTree() const { return m_LeftWin; } + +void WinEDA_MainFrame::AddFastLaunchPy( object & button ) +{ + wxButton * btn; + bool success = wxPyConvertSwigPtr( button.ptr(), (void**)&btn, _T("wxButton")); + if ( !success ) return; + + Py_INCREF( button.ptr() ); + AddFastLaunch( btn ); +} + +// WinEDA_PrjFrame Special binding functions: +// (one line functions are simple wrappers) + +object WinEDA_PrjFrame::ToWx() { return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); } +object WinEDA_PrjFrame::GetFtExPy( enum TreeFileType type ) const { return PyHandler::Convert( GetFileExt( type ) ); } +object WinEDA_PrjFrame::GetMenuPy( enum TreeFileType type ) { return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) ); } +object WinEDA_PrjFrame::GetTreeCtrl() { return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) ); } +object WinEDA_PrjFrame::GetCurrentMenu() { return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) ); } + +void WinEDA_PrjFrame::NewFilePy( const str & name, enum TreeFileType type, object & id ) +{ + wxTreeItemId root; + if (! wxPyConvertSwigPtr( id.ptr(), (void**)&root, _T("wxTreeItemId") ) ) return; + NewFile( PyHandler::MakeStr( name ), type, root ); +} + +void WinEDA_PrjFrame::AddFilePy( const str & file, object & root ) +/* Add a file to the tree under root, or m_root if conversion is wrong */ +{ + wxTreeItemId * theroot = &m_root; + if ( !wxPyConvertSwigPtr( root.ptr(), (void**)&root, _T("wxTreeItemId") ) ) + { + theroot = &m_root; + } + AddFile( PyHandler::MakeStr( file ), *theroot ); +} + +TreePrjItemData * WinEDA_PrjFrame::GetItemData( const object & item ) +/* convert wxTreeItem into TreePrjItemData */ +{ + wxTreeItemId *id = NULL; + if ( !wxPyConvertSwigPtr( item.ptr(), (void**)&id, _T("wxTreeItemId") ) ) return NULL; + return dynamic_cast( m_TreeProject->GetItemData( *id ) ); +} + +// TreePrjItemData Special binding functions +// (one line functions are simple wrappers) + +bool TreePrjItemData::RenamePy( const str & newname, bool check ) { return Rename( PyHandler::MakeStr(newname), check ); } +object TreePrjItemData::GetDirPy() const { return PyHandler::Convert( GetDir() ); } +object TreePrjItemData::GetFileNamePy() const { return PyHandler::Convert( GetFileName() ); } +object TreePrjItemData::GetMenuPy() { return object( handle<>( borrowed( wxPyMake_wxObject( &m_fileMenu, false ) ) ) ); } + +// kicad module init function +// ( this function is called from PyHandler to init the kicad module ) + +static void py_kicad_init(void) +{ + def( "GetMainFrame", &GetMainFrame, return_value_policy< reference_existing_object >() ); + def( "GetTypeExtension", &GetTypeExt ); + + class_( "PrjItem" ) + // Internal data: + .def( "GetFileName", &TreePrjItemData::GetFileNamePy ) + .def( "GetDir", &TreePrjItemData::GetDirPy ) + .def( "GetType", &TreePrjItemData::GetType ) + .def( "GetId", &TreePrjItemData::GetIdPy ) + .def( "GetMenu", &TreePrjItemData::GetMenuPy ) + // Item control + .def( "SetState", &TreePrjItemData::SetState ) + .def( "Rename", &TreePrjItemData::RenamePy ) + .def( "Move", &TreePrjItemData::Move ) + .def( "Delete", &TreePrjItemData::Delete ) + .def( "Activate", &TreePrjItemData::Activate ) + ; + + enum_( "FileType" ) + .value( "PROJECT", TREE_PROJECT ) + .value( "SCHEMA", TREE_SCHEMA ) + .value( "BOARD", TREE_PCB ) + .value( "PYSCRIPT", TREE_PY ) + .value( "GERBER", TREE_GERBER ) + .value( "PDF", TREE_PDF ) + .value( "TXT", TREE_TXT ) + .value( "NETLIST", TREE_NET ) + .value( "UNKNOWN", TREE_UNKNOWN ) + .value( "DIRECTORY", TREE_DIRECTORY ) + .value( "MAX", TREE_MAX ); + + class_( "TreeWindow" ) + // wx Interface + .def( "ToWx", &WinEDA_PrjFrame::ToWx ) + // common features + .def( "GetContextMenu", &WinEDA_PrjFrame::GetMenuPy ) + .def( "GetFileExtension", &WinEDA_PrjFrame::GetFtExPy ) + // file filters control + .def( "AddFilter", &WinEDA_PrjFrame::AddFilter ) + .def( "ClearFilters", &WinEDA_PrjFrame::ClearFilters ) + .def( "RemoveFilter", &WinEDA_PrjFrame::RemoveFilterPy ) + .def( "GetFilters", &WinEDA_PrjFrame::GetFilters, return_value_policy < copy_const_reference >() ) + .def( "GetCurrentMenu", &WinEDA_PrjFrame::GetCurrentMenu ) + // Project tree control + .def( "AddState", &WinEDA_PrjFrame::AddStatePy ) + .def( "GetTreeCtrl", &WinEDA_PrjFrame::GetTreeCtrl ) + .def( "GetItemData", &WinEDA_PrjFrame::GetItemData, return_value_policy < reference_existing_object >() ) + .def( "FindItemData", &WinEDA_PrjFrame::FindItemData, return_value_policy < reference_existing_object >() ) + .def( "NewFile", &WinEDA_PrjFrame::NewFilePy ) + .def( "AddFile", &WinEDA_PrjFrame::AddFilePy ) + ; + + class_( "MainFrame" ) + // Wx interface + .def( "ToWx", &WinEDA_MainFrame::ToWx ) + // Common controls + .def( "AddFastLaunch", &WinEDA_MainFrame::AddFastLaunchPy ) + .def( "Refresh", &WinEDA_MainFrame::OnRefreshPy ) + .def( "GetProjectName", &WinEDA_MainFrame::GetPrjName ) + .def( "GetProjectWindow", &WinEDA_MainFrame::GetTree, return_value_policy< reference_existing_object >() ); + +} + +// common module init function + +static void py_common_init(void) +{ + def( "Print", &WinEDAPrint ); + def( "Clear", &WinEDAClear ); +} + +#endif + + +bool WinEDA_App::OnInit(void) +{ + EDA_Appl = this; + InitEDA_Appl( wxT("kicad")); + + /* init kicad */ + GetSettings(); // read current setup + + m_MainFrame = new WinEDA_MainFrame(this, NULL, wxT("KiCad"), + wxPoint(0,0), wxSize(600,400) ); + if(argc > 1 ) m_MainFrame->m_PrjFileName = argv[1]; + else if ( m_EDA_Config ) + { + m_MainFrame->m_PrjFileName = m_EDA_Config->Read(wxT("LastProject"), + wxT("noname.pro") ); + } + else m_MainFrame->m_PrjFileName = wxT("noname.pro"); + + wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); + Title += wxT(" ") + m_MainFrame->m_PrjFileName; + m_MainFrame->SetTitle(Title); + m_MainFrame->ReCreateMenuBar(); + m_MainFrame->RecreateBaseHToolbar(); + + m_MainFrame->m_LeftWin->ReCreateTreePrj(); + SetTopWindow(m_MainFrame); + m_MainFrame->Show(TRUE); + + /* Preparation Affichage du logo */ +#ifdef SPLASH_OK +wxString logoname( wxString(m_BinDir) + wxT("logokicad.png") ); +wxBitmap image; + if ( image.LoadFile( logoname, wxBITMAP_TYPE_PNG ) ) + { + wxSplashScreen * logoscreen = new wxSplashScreen( image, + wxSPLASH_CENTRE_ON_PARENT | wxSPLASH_TIMEOUT, + 500, m_MainFrame, -1, + wxDefaultPosition, wxDefaultSize, + wxSIMPLE_BORDER | wxSTAY_ON_TOP); + } +#endif + + if ( wxFileExists(m_MainFrame->m_PrjFileName) ) + { + m_MainFrame->Load_Prj_Config(); + } + + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->AddToModule( wxT("kicad"), &py_kicad_init ); + PyHandler::GetInstance()->AddToModule( wxT("common"), &py_common_init ); + #endif + + + return TRUE; +} + +// vim: tabstop=4 : noexpandtab : diff --git a/kicad/kicad.h b/kicad/kicad.h index 01078eed73..4677bbccb2 100644 --- a/kicad/kicad.h +++ b/kicad/kicad.h @@ -5,7 +5,13 @@ #ifndef KICAD_H #define KICAD_H +#ifdef KICAD_PYTHON +#include +#endif + #include +#include +#include /* Message de presentation */ eda_global wxString g_Main_Title @@ -25,6 +31,7 @@ class WinEDA_PrjFrame; class WinEDA_MainFrame: public WinEDA_BasicFrame { + /* This class is the main entry point of the py API */ public: WinEDA_CommandFrame * m_CommandWin; @@ -62,27 +69,176 @@ public: void RecreateBaseHToolbar(void); void CreateCommandToolbar(void); void PrintMsg(const wxString & text); + void ClearMsg(); void SetLanguage(wxCommandEvent& event); + void OnRefresh(wxCommandEvent& event); void CreateZipArchive(const wxString FullFileName); void UnZipArchive(const wxString FullFileName); + #ifdef KICAD_PYTHON + void OnRefreshPy(); + boost::python::object GetPrjName() const; + WinEDA_MainFrame( const WinEDA_MainFrame& ) {} + WinEDA_MainFrame() {} + boost::python::object ToWx(); + void AddFastLaunchPy( boost::python::object & button ); + WinEDA_PrjFrame* GetTree() const; + #endif + + void AddFastLaunch( wxButton * button, int sep = 20 ); + DECLARE_EVENT_TABLE() }; +// Order of this enum changes AddFile() internal working +// please update both +enum TreeFileType { + TREE_PROJECT = 1, + TREE_SCHEMA, + TREE_PCB, + TREE_PY, + TREE_GERBER, + TREE_PDF, + TREE_TXT, + TREE_NET, + TREE_UNKNOWN, + TREE_DIRECTORY, + TREE_MAX, +}; + +/***********************************************************/ +/* Classes pour l'arbre de hierarchie de gestion du projet */ +/***********************************************************/ +class TreePrjItemData: public wxTreeItemData +{ +public: + enum TreeFileType m_Type; + bool m_IsRootFile; // True if m_Filename is a root schematic (same name as project) + wxString m_FileName; + +private: + wxTreeCtrl * m_Parent; + wxMenu m_fileMenu; + int m_State; + +public: + + TreePrjItemData(enum TreeFileType type, const wxString & data, wxTreeCtrl * parent); + TreePrjItemData() : m_Parent(NULL) {} + TreePrjItemData( const TreePrjItemData & src ) + : m_Type( src.m_Type ) + , m_FileName( src.m_FileName ) + , m_Parent( src.m_Parent ) + { + SetState( src.m_State ); + } + + enum TreeFileType GetType() const { return m_Type; } + wxString GetFileName() const { return m_FileName; } + void SetFileName( const wxString & name ) { m_FileName = name; } + + wxString GetDir() const; + + void OnRename( wxTreeEvent & event, bool check = true ); + bool Rename( const wxString & name, bool check = true ); + bool Delete( bool check = true ); + void Move( TreePrjItemData * dest ); + void Activate(); + + const wxMenu * GetMenu() { return &m_fileMenu; } + void SetState( int state ); + + #ifdef KICAD_PYTHON + boost::python::object GetFileNamePy() const; + bool RenamePy( const boost::python::str & newname, bool check = true ); + boost::python::object GetDirPy() const; + boost::python::object GetIdPy() const; + boost::python::object GetMenuPy(); + #endif +}; + /* Fenetre d'affichage des fichiers du projet */ class WinEDA_PrjFrame : public wxSashLayoutWindow { +private: + + std::vector< wxMenu* > m_ContextMenus; + wxMenu * m_PopupMenu; + std::vector< wxString > m_Filters; + + wxCursor m_DragCursor; + wxCursor m_Default; + +protected: + wxMenu * GetContextMenu( int type ); + void NewFile( enum TreeFileType type ); + void NewFile( const wxString & name, enum TreeFileType type, wxTreeItemId & root ); + TreePrjItemData * GetSelectedData(); + public: WinEDA_MainFrame * m_Parent; WinEDA_TreePrj * m_TreeProject; + wxTreeItemId m_root; + public: + static wxString GetFileExt( enum TreeFileType type ); + WinEDA_PrjFrame(WinEDA_MainFrame * parent, - const wxPoint & pos, const wxSize & size ); + const wxPoint & pos, const wxSize & size ); ~WinEDA_PrjFrame(void) {} void OnSelect(wxTreeEvent & Event); + void OnRenameAsk(wxTreeEvent & Event); + void OnRename(wxTreeEvent & Event); + void OnDragStart( wxTreeEvent & event ); + void OnDragEnd( wxTreeEvent & event ); + void OnRight(wxTreeEvent & Event); void ReCreateTreePrj(void); + + void OnTxtEdit(wxCommandEvent & event); + + void OnDeleteFile(wxCommandEvent &event ); + void OnRenameFile(wxCommandEvent &event ); + + void OnNewFile(wxCommandEvent & event); + void OnNewDirectory(wxCommandEvent & event); + void OnNewSchFile(wxCommandEvent & event); + void OnNewBrdFile(wxCommandEvent & event); + void OnNewPyFile(wxCommandEvent & event); + void OnNewGerberFile(wxCommandEvent & event); + void OnNewTxtFile(wxCommandEvent & event); + void OnNewNetFile(wxCommandEvent & event); + + void ClearFilters(); + const std::vector & GetFilters(); + void RemoveFilter( const wxString & filter ); + +#ifdef KICAD_PYTHON + boost::python::object ToWx(); + + WinEDA_PrjFrame() {} + WinEDA_PrjFrame( const WinEDA_PrjFrame & ) {} + + void OnRunPy(wxCommandEvent & event); + boost::python::object GetMenuPy( enum TreeFileType ); + boost::python::object GetFtExPy ( enum TreeFileType ) const; + + void RemoveFilterPy( const boost::python::str & filter ); + void AddFilter( const boost::python::str & filter ); + + boost::python::object GetTreeCtrl(); + TreePrjItemData * GetItemData( const boost::python::object & item ); + void AddFilePy( const boost::python::str & name, boost::python::object & root ); + void NewFilePy( const boost::python::str & name, enum TreeFileType type, boost::python::object & root ); + + TreePrjItemData * FindItemData( const boost::python::str & name ); + boost::python::object GetCurrentMenu(); + int AddStatePy( boost::python::object & bitmap ); + +#endif + + void AddFile( const wxString & name, wxTreeItemId & root ); DECLARE_EVENT_TABLE() }; @@ -90,13 +246,19 @@ public: /** Classe TreeCtrl des fichiers projets **/ class WinEDA_TreePrj : public wxTreeCtrl { + DECLARE_DYNAMIC_CLASS(WinEDA_TreePrj) private: WinEDA_PrjFrame * m_Parent; wxImageList * m_ImageList; public: + + WinEDA_PrjFrame * GetParent() { return m_Parent; } WinEDA_TreePrj(WinEDA_PrjFrame *parent); ~WinEDA_TreePrj(); +private: + /* overlayed sort function */ + int OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2); }; eda_global wxString g_SchematicRootFileName; @@ -111,7 +273,8 @@ wxString g_GerberExtBuffer(wxT(".pho")); eda_global wxString g_SchExtBuffer; eda_global wxString g_BoardExtBuffer; eda_global wxString g_NetlistExtBuffer; -eda_global wxString g_GerberExtBuffer; +eda_global wxString g_GerberExtBuffer; #endif #endif +// vim: tabstop=4 : noexpandtab : diff --git a/kicad/makefile.g95 b/kicad/makefile.g95 index 670c440468..5f8de67b57 100644 --- a/kicad/makefile.g95 +++ b/kicad/makefile.g95 @@ -11,11 +11,10 @@ include makefile.include $(TARGET).exe: $(OBJECTS) $(TARGET)_resources.o $(EDALIBS) - $(CXX) $(ALL_LDFLAGS)\ - -o $(TARGET).exe $(OBJECTS)\ + $(CXX) $(ALL_LDFLAGS) -o $(TARGET).exe $(OBJECTS)\ $(TARGET)_resources.o $(EDALIBS) $(SYSWXLIB) -install: +install:$(TARGET).exe cp -f $(TARGET).exe $(KICAD_BIN) diff --git a/kicad/makefile.gtk b/kicad/makefile.gtk index 436a1632bc..571c523b25 100644 --- a/kicad/makefile.gtk +++ b/kicad/makefile.gtk @@ -25,7 +25,7 @@ EDACPPFLAGS = $(CPPFLAGS) $(TARGET): $(OBJECTS) makefile.gtk $(EXTRALIBS) ../libs.linux $(LD) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $(TARGET) -install: +install:$(TARGET) cp -f $(TARGET) $(KICAD_BIN) clean: diff --git a/kicad/makefile.include b/kicad/makefile.include index 1d0f9eefd4..41358f8193 100644 --- a/kicad/makefile.include +++ b/kicad/makefile.include @@ -1,29 +1,32 @@ -EXTRALIBS = ../common/common.a -EXTRACPPFLAGS= -DKICAD -I./ -Ibitmaps -I../include -I../kicad -I../share - -DEPEND = - -OBJECTS = kicad.o\ - treeprj.o\ - buildmnu.o\ - infospgm.o\ - mdiframe.o\ - prjconfig.o\ - preferences.o\ - files-io.o - - -$(TARGET).o: $(TARGET).cpp $(DEPEND) $(TARGET).h - -treeprj.o: treeprj.cpp $(DEPEND) kicad.h - -prjconfig.o: prjconfig.cpp $(DEPEND) prjconfig.h - -files-io.o: files-io.cpp $(DEPEND) kicad.h - -mdiframe.o: mdiframe.cpp $(DEPEND) kicad.h - -buildmnu.o: buildmnu.cpp $(DEPEND) kicad.h - -infospgm.o: ../share/infospgm.cpp $(DEPEND) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp +EXTRALIBS = ../common/common.a +EXTRACPPFLAGS += -DKICAD -fno-strict-aliasing -I./ -Ibitmaps -I../include -I../kicad -I../share + +DEPEND = + +OBJECTS = kicad.o\ + treeprj_frame.o\ + treeprj_datas.o\ + buildmnu.o\ + infospgm.o\ + mdiframe.o\ + prjconfig.o\ + preferences.o\ + files-io.o + + +$(TARGET).o: $(TARGET).cpp $(DEPEND) $(TARGET).h + +treeprj_frame.o: treeprj_frame.cpp $(DEPEND) kicad.h + +treeprj_datas.o: treeprj_datas.cpp $(DEPEND) kicad.h + +prjconfig.o: prjconfig.cpp $(DEPEND) prjconfig.h + +files-io.o: files-io.cpp $(DEPEND) kicad.h + +mdiframe.o: mdiframe.cpp $(DEPEND) kicad.h + +buildmnu.o: buildmnu.cpp $(DEPEND) kicad.h + +infospgm.o: ../share/infospgm.cpp $(DEPEND) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp diff --git a/kicad/makefile.macosx b/kicad/makefile.macosx index 7a6b33b2c8..da3f0037e7 100644 --- a/kicad/makefile.macosx +++ b/kicad/makefile.macosx @@ -8,13 +8,15 @@ FINAL = 1 # Compiler flags. CPPFLAGS = -Wall -O2 `wx-config --cxxflags` +CPPFLAGS += -arch i386 -arch ppc + LDFLAGS = include ../libs.macosx TARGET = kicad -all: $(TARGET) +all: $(TARGET) $(TARGET).app include makefile.include @@ -26,8 +28,25 @@ $(TARGET): $(OBJECTS) $(TARGET).r makefile.macosx $(EXTRALIBS) ../libs.macosx $(LD) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $(TARGET) $(RESCOMP) -o $(TARGET) Carbon.r $(TARGET).r $(SETFILE) -a C $(TARGET) + + +$(TARGET).app: $(OBJS) + rm -Rf $(TARGET).app + mkdir -p $(TARGET).app + mkdir -p $(TARGET).app/Contents + mkdir -p $(TARGET).app/Contents/MacOS + mkdir -p $(TARGET).app/Contents/Frameworks + mkdir -p $(TARGET).app/Contents/Resources + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/" \ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/wxmac.icns \ + >$(TARGET).app/Contents/Resources/wxmac.icns + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/"\ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/Info.plist.in \ + >$(TARGET).app/Contents/Info.plist + echo -n "APPL????" >$(TARGET).app/Contents/PkgInfo + ln -f $(TARGET) $(TARGET).app/Contents/MacOS/$(TARGET) -install: +install:$(TARGET) cp -f $(TARGET) $(KICAD_BIN) clean: diff --git a/kicad/mdiframe.cpp b/kicad/mdiframe.cpp index fe5789ef04..b35e365df6 100644 --- a/kicad/mdiframe.cpp +++ b/kicad/mdiframe.cpp @@ -6,6 +6,10 @@ #pragma implementation #endif +#ifdef KICAD_PYTHON +#include +#endif + #include "fctsys.h" #include "common.h" @@ -17,7 +21,6 @@ #include "kicad.h" - /****************/ /* Constructeur */ /****************/ @@ -105,6 +108,10 @@ wxString line; msg = wxGetCwd(); line.Printf( _("Ready\nWorking dir: %s\n"), msg.GetData()); PrintMsg(line); + + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->DeclareEvent(wxT("kicad::LoadProject")); + #endif } /***************/ @@ -318,6 +325,23 @@ wxString FullFileName = m_PrjFileName; } break; +#ifdef KICAD_PYTHON + case ID_RUN_PYTHON: + { + wxString script = EDA_FileSelector( _("Execute Python Script:"), + wxEmptyString, /* Chemin par defaut */ + wxEmptyString, /* nom fichier par defaut */ + wxT( ".py" ), /* extension par defaut */ + wxT("*.py"), /* Masque d'affichage */ + this, + wxFD_OPEN, + FALSE + ); + if ( script.IsEmpty() ) break; + PyHandler::GetInstance()->RunScript( script ); + } + break; +#endif case ID_BROWSE_AN_SELECT_FILE: { wxString mask(wxT("*")), extension; @@ -350,3 +374,22 @@ wxString FullFileName = m_PrjFileName; } } + +/********************************************************/ +void WinEDA_MainFrame::OnRefresh(wxCommandEvent & event ) +/********************************************************/ +{ + m_LeftWin->ReCreateTreePrj(); +} + +/*********************************/ +void WinEDA_MainFrame::ClearMsg() +/*********************************/ +{ + m_DialogWin->Clear(); +} + +#ifdef KICAD_PYTHON +void WinEDA_MainFrame::OnRefreshPy() { m_LeftWin->ReCreateTreePrj(); } +#endif + diff --git a/kicad/preferences.cpp b/kicad/preferences.cpp index 3415e2d6a4..fea7363fa6 100644 --- a/kicad/preferences.cpp +++ b/kicad/preferences.cpp @@ -19,6 +19,35 @@ #include +static bool ChoosePdfBrowser(WinEDA_MainFrame * parent_frame) +/* routine to choose the prefered Pdf browser +*/ +{ +wxString mask(wxT("*")); +#ifdef __WINDOWS__ +mask += wxT(".exe"); +#endif + + EDA_Appl->ReadPdfBrowserInfos(); + wxString FullFileName = EDA_Appl->m_PdfBrowser; + FullFileName = EDA_FileSelector( _("Prefered Pdf Browser:"), + wxPathOnly(FullFileName), /* Default path */ + FullFileName, /* default filename */ + wxEmptyString, /* default filename extension */ + mask, /* filter for filename list */ + parent_frame, /* parent frame */ + wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/ + TRUE /* true = keep the current path */ + ); + if ( ! FullFileName.IsEmpty() && (EDA_Appl->m_PdfBrowser != FullFileName) ) + { + EDA_Appl->m_PdfBrowser = FullFileName; + EDA_Appl->WritePdfBrowserInfos(); + return TRUE; + } + return FALSE; +} + /****************************************************************/ void WinEDA_MainFrame::Process_Preferences(wxCommandEvent& event) /*****************************************************************/ @@ -42,32 +71,26 @@ mask += wxT(".exe"); case ID_SELECT_PREFERED_PDF_BROWSER: if ( EDA_Appl->m_PdfBrowser.IsEmpty() ) { - DisplayError(this, _("You must choose a PDF wiever before use this option")); - break; + DisplayError(this, _("You must choose a PDF viewer before use this option")); + ChoosePdfBrowser(this); + } + if ( EDA_Appl->m_PdfBrowser.IsEmpty() ) + { + EDA_Appl->m_PdfBrowserIsDefault = TRUE; + GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, TRUE); + GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, FALSE); + } + else + { + EDA_Appl->m_PdfBrowserIsDefault = FALSE; + GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, FALSE); + GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, TRUE); } - EDA_Appl->m_PdfBrowserIsDefault = FALSE; - GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, EDA_Appl->m_PdfBrowserIsDefault); - GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, !EDA_Appl->m_PdfBrowserIsDefault); EDA_Appl->WritePdfBrowserInfos(); break; case ID_SELECT_PREFERED_PDF_BROWSER_NAME: - EDA_Appl->ReadPdfBrowserInfos(); - FullFileName = EDA_Appl->m_PdfBrowser; - FullFileName = EDA_FileSelector( _("Prefered Pdf Browser:"), - wxPathOnly(FullFileName), /* Default path */ - FullFileName, /* default filename */ - wxEmptyString, /* default filename extension */ - mask, /* filter for filename list */ - this, /* parent frame */ - wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/ - TRUE /* true = keep the current path */ - ); - if ( ! FullFileName.IsEmpty() && (EDA_Appl->m_PdfBrowser != FullFileName) ) - { - EDA_Appl->m_PdfBrowser = FullFileName; - EDA_Appl->WritePdfBrowserInfos(); - } + ChoosePdfBrowser(this); break; case ID_SELECT_PREFERED_EDITOR: diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index d3c95bd419..676c01d879 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -3,12 +3,16 @@ /*************************************************************/ +#ifdef KICAD_PYTHON +#include +#endif #include "fctsys.h" #include "common.h" #include "kicad.h" #include "protos.h" #include "prjconfig.h" + /* Variables locales */ @@ -32,6 +36,9 @@ void WinEDA_MainFrame::Load_Prj_Config(void) wxString msg = _("\nWorking dir: ") + wxGetCwd(); msg << _("\nProject: ") << m_PrjFileName << wxT("\n"); PrintMsg(msg); + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::LoadProject"), PyHandler::Convert(m_PrjFileName) ); + #endif } @@ -62,3 +69,4 @@ wxString mask( wxT("*")); EDA_Appl->WriteProjectConfig(FullFileName, wxT("/general"), CfgParamList); } +// vim: set tabstop=4 : noexpandtab : diff --git a/kicad/treeprj.cpp b/kicad/treeprj.cpp deleted file mode 100644 index 6a1cb39677..0000000000 --- a/kicad/treeprj.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/***************/ -/* treeprj.cpp */ -/***************/ - -#include "fctsys.h" -#include "gr_basic.h" -#include "common.h" - -#include "kicad.h" -#include "protos.h" - -#include "wx/image.h" -#include "wx/imaglist.h" -#include "wx/treectrl.h" - -#include "bitmaps.h" - -#include "id.h" - -enum { - TREE_PROJECT = 1, - TREE_SCHEMA, - TREE_PCB -}; - -/***********************************************************/ -/* Classes pour l'arbre de hierarchie de gestion du projet */ -/***********************************************************/ -class TreePrjItemData: public wxTreeItemData -{ -public: - int m_Id; - wxString m_FileName; - -public: - TreePrjItemData(int tree_id, const wxString & data) :wxTreeItemData() - { - m_Id = tree_id; - if ( data ) m_FileName = data; - } -}; - - - -/**********************************************************************/ -/* Methodes de la Frame de l'arbre de hierarchie de gestion du projet */ -/**********************************************************************/ - -WinEDA_PrjFrame::WinEDA_PrjFrame(WinEDA_MainFrame * parent, - const wxPoint & pos, - const wxSize & size ) : - wxSashLayoutWindow(parent, ID_LEFT_FRAME, pos, size, - wxNO_BORDER|wxSW_3D) -{ - m_Parent = parent; - m_TreeProject = NULL; - ReCreateTreePrj(); -} - -BEGIN_EVENT_TABLE(WinEDA_PrjFrame, wxSashLayoutWindow) - EVT_TREE_ITEM_ACTIVATED(ID_PROJECT_TREE, WinEDA_PrjFrame::OnSelect) -END_EVENT_TABLE() - - -/******************************************/ -void WinEDA_PrjFrame::ReCreateTreePrj(void) -/******************************************/ -/* Create or modify the tree showing root schematic and pcb file names -*/ -{ -wxTreeItemId rootcellule; -wxTreeItemId cellule; -wxString Text; -int id; - - if ( ! m_TreeProject ) m_TreeProject = new WinEDA_TreePrj(this); - else m_TreeProject->DeleteAllItems(); - - m_TreeProject->SetFont(* g_StdFont); - if (m_Parent->m_PrjFileName.IsEmpty() ) Text = wxT("noname"); - else Text = wxFileNameFromPath(m_Parent->m_PrjFileName); - - id = 0; - rootcellule = m_TreeProject->AddRoot(Text, id, id); - m_TreeProject->SetItemBold(rootcellule, TRUE); - m_TreeProject->SetItemData( rootcellule, new TreePrjItemData(TREE_PROJECT, wxEmptyString) ); - m_TreeProject->SetItemFont(rootcellule, *g_StdFont); - - ChangeFileNameExt(Text, wxEmptyString); - - id++; - cellule = m_TreeProject->AppendItem(rootcellule,Text + g_SchExtBuffer, id, id); - m_TreeProject->SetItemData( cellule, new TreePrjItemData(TREE_SCHEMA, wxEmptyString) ); - m_TreeProject->SetItemFont(cellule, *g_StdFont); - g_SchematicRootFileName = m_TreeProject->GetItemText(cellule); - - id++; - cellule = m_TreeProject->AppendItem(rootcellule,Text + g_BoardExtBuffer, id, id); - m_TreeProject->SetItemData( cellule, new TreePrjItemData(TREE_PCB, wxEmptyString) ); - m_TreeProject->SetItemFont(cellule, *g_StdFont); - g_BoardFileName = m_TreeProject->GetItemText(cellule); - - m_TreeProject->Expand(rootcellule); -} - -/**************************************************/ -void WinEDA_PrjFrame::OnSelect(wxTreeEvent & Event) -/**************************************************/ -{ -int tree_id; -TreePrjItemData * tree_data; -wxString FullFileName; - - tree_data = (TreePrjItemData*) - m_TreeProject->GetItemData(m_TreeProject->GetSelection()); - - tree_id = tree_data->m_Id; - FullFileName = m_Parent->m_PrjFileName; - - switch ( tree_id ) - { - case TREE_PROJECT: - break; - - case TREE_SCHEMA: - { - ChangeFileNameExt(FullFileName, g_SchExtBuffer); - AddDelimiterString( FullFileName ); - ExecuteFile(this, EESCHEMA_EXE, FullFileName); - break; - } - - case TREE_PCB: - ChangeFileNameExt(FullFileName, g_BoardExtBuffer); - AddDelimiterString( FullFileName ); - ExecuteFile(this, PCBNEW_EXE, FullFileName); - break; - } -} - - -/********************************************/ -/* Methodes pour l'arbre gestion du projet */ -/********************************************/ - -WinEDA_TreePrj::WinEDA_TreePrj(WinEDA_PrjFrame * parent) : - wxTreeCtrl(parent, ID_PROJECT_TREE, - wxDefaultPosition, wxDefaultSize, - wxTR_HAS_BUTTONS, wxDefaultValidator, wxT("EDATreeCtrl")) -{ - m_Parent = parent; - // Make an image list containing small icons - m_ImageList = new wxImageList(16, 16, TRUE, 2); - - m_ImageList->Add(wxBitmap(kicad_icon_small_xpm)); - m_ImageList->Add(wxBitmap(eeschema_xpm)); - m_ImageList->Add(wxBitmap(pcbnew_xpm)); - - SetImageList(m_ImageList); - -} - -/********************************/ -WinEDA_TreePrj::~WinEDA_TreePrj() -/********************************/ -{ -} - - diff --git a/kicad/treeprj_datas.cpp b/kicad/treeprj_datas.cpp new file mode 100644 index 0000000000..127963db7c --- /dev/null +++ b/kicad/treeprj_datas.cpp @@ -0,0 +1,360 @@ +/***************/ +/* treeprj.cpp */ +/***************/ + +#ifdef KICAD_PYTHON +#include +#endif + +#include "fctsys.h" +#include "gr_basic.h" +#include "common.h" + +#include "kicad.h" +#include "protos.h" + +#include "wx/image.h" +#include "wx/imaglist.h" +#include "wx/treectrl.h" +#include "wx/regex.h" +#include "wx/dir.h" + +#include "bitmaps.h" +#include "bitmaps/icon_gerbview_small.xpm" +#include "bitmaps/icon_cvpcb_small.xpm" +#include "bitmaps/unknown.xpm" +//#include "bitmaps/new_gerb.xpm" +//#include "bitmaps/new_pcb.xpm" +//#include "bitmaps/new_sch.xpm" +//#include "bitmaps/new_cvpcb.xpm" + +#include "id.h" + + +/********************************************/ +/* Methodes pour l'arbre gestion du projet */ +/********************************************/ + +IMPLEMENT_ABSTRACT_CLASS(WinEDA_TreePrj, wxTreeCtrl) +WinEDA_TreePrj::WinEDA_TreePrj(WinEDA_PrjFrame * parent) : + wxTreeCtrl(parent, ID_PROJECT_TREE, + wxDefaultPosition, wxDefaultSize, + wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS, wxDefaultValidator, wxT("EDATreeCtrl")) +{ + m_Parent = parent; + // Make an image list containing small icons + m_ImageList = new wxImageList(16, 16, TRUE, TREE_MAX); + + m_ImageList->Add(wxBitmap(kicad_icon_small_xpm)); // TREE_PROJECT + m_ImageList->Add(wxBitmap(eeschema_xpm)); // TREE_SCHEMA + m_ImageList->Add(wxBitmap(pcbnew_xpm)); // TREE_PCB + m_ImageList->Add(wxBitmap(icon_python_small_xpm)); // TREE_PY + m_ImageList->Add(wxBitmap(icon_gerbview_small_xpm)); // TREE_GERBER + m_ImageList->Add(wxBitmap(datasheet_xpm)); // TREE_PDF + m_ImageList->Add(wxBitmap(icon_txt_xpm)); // TREE_TXT + m_ImageList->Add(wxBitmap(icon_cvpcb_small_xpm)); // TREE_NET + m_ImageList->Add(wxBitmap(unknown_xpm)); // TREE_UNKNOWN + m_ImageList->Add(wxBitmap(directory_xpm)); // TREE_DIRECTORY + + SetImageList(m_ImageList); +} + + +/***************************************************************************************/ +int WinEDA_TreePrj::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2) +/***************************************************************************************/ +/* sort function for tree items. +items are sorted : + directory names first by alphabetic order + root file names after + file names last by alphabetic order +*/ +{ +TreePrjItemData* myitem1 = (TreePrjItemData*)GetItemData(item1); +TreePrjItemData* myitem2 = (TreePrjItemData*)GetItemData(item2); + + if ( (myitem1->m_Type == TREE_DIRECTORY) && ( myitem2->m_Type != TREE_DIRECTORY ) ) + return -1; + if ( (myitem2->m_Type == TREE_DIRECTORY) && ( myitem1->m_Type != TREE_DIRECTORY ) ) + return 1; + + if ( myitem1->m_IsRootFile && ! myitem2->m_IsRootFile ) + return -1; + if ( myitem2->m_IsRootFile && ! myitem1->m_IsRootFile ) + return 1; + + return myitem1->m_FileName.CmpNoCase(myitem2->m_FileName) ; +} + + +/****************************************************************************************************/ +TreePrjItemData::TreePrjItemData(enum TreeFileType type, const wxString & data, wxTreeCtrl * parent) + : wxTreeItemData() +/****************************************************************************************************/ +{ + m_Type = type; + m_Parent = parent; + m_FileName = data; + m_IsRootFile = false; +} + +#ifdef KICAD_PYTHON +using namespace boost::python; + +/**************************************/ +object TreePrjItemData::GetIdPy() const +/**************************************/ +// Convert the data to an id +{ + wxTreeItemId * id = new wxTreeItemId(); + *id = GetId(); + return object( handle<>( borrowed( wxPyConstructObject( id, wxT("wxTreeItemId"), true ) ) ) ); +} +#endif + +/*******************************************/ +void TreePrjItemData::SetState( int state ) +/*******************************************/ +// Set the state used in the icon list +{ + wxImageList* imglist = m_Parent->GetImageList(); + if ( !imglist || state < 0 || state >= imglist->GetImageCount() / ( TREE_MAX - 2 ) ) return; + m_State = state; + int imgid = m_Type - 1 + state * ( TREE_MAX - 1 ); + m_Parent->SetItemImage( GetId(), imgid ); + m_Parent->SetItemImage( GetId(), imgid, wxTreeItemIcon_Selected ); +} + +/*******************************************/ +wxString TreePrjItemData::GetDir() const +/*******************************************/ +/* Get the directory containing the file */ +{ + if (TREE_DIRECTORY == m_Type ) return m_FileName; + + wxFileName filename = wxFileName( m_FileName ); + filename.MakeRelativeTo( wxGetCwd() ); + wxArrayString dirs = filename.GetDirs(); + + wxString dir; + for ( unsigned int i = 0; i < dirs.Count(); i ++ ) + { + dir += dirs[i] + filename.GetPathSeparator(); + } + return dir; +} + +/****************************************************************/ +void TreePrjItemData::OnRename( wxTreeEvent & event, bool check ) +/****************************************************************/ +/* Called upon tree item rename */ +{ + if ( !Rename( event.GetLabel(), check ) ) event.Veto(); +} + +/****************************************************/ +void TreePrjItemData::Move( TreePrjItemData * dest ) +/****************************************************/ +// Move the object to dest +{ + const wxString sep = wxFileName().GetPathSeparator(); + if (!dest) return; + if ( m_Parent != dest->m_Parent ) return;// Can not cross move! + if ( dest == this ) return; // Can not move to ourself... + + wxTreeItemId parent = m_Parent->GetItemParent( GetId() ); + if ( dest == dynamic_cast( m_Parent->GetItemData( parent ) ) ) return; // same parent ? + + // We need to create a new item from us, and move + // data to there ... + + // First move file on the disk + wxFileName fname( m_FileName ); + wxString destName; + if ( !dest->GetDir().IsEmpty() ) destName = dest->GetDir() + sep; + destName += fname.GetFullName(); + + if ( destName == GetFileName() ) return; // Same place ?? + + // Move the file on the disk: + if ( !wxRenameFile( GetFileName(), destName, false ) ) + { + wxMessageDialog( m_Parent, _( "Unable to move file ... "), _( "Permission error ?" ), wxICON_ERROR | wxOK ); + return; + } + + #ifdef KICAD_PYTHON + object param = make_tuple( PyHandler::Convert( m_FileName ) + , PyHandler::Convert( destName ) ); + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::MoveFile"), param ); + #endif + + SetFileName( destName ); + + if ( TREE_DIRECTORY != GetType() ) + { + // Move the tree item itself now: + wxTreeItemId oldId = GetId(); + int i = m_Parent->GetItemImage( oldId ); + wxString text = m_Parent->GetItemText( oldId ); + + // Bye bye old Id :'( + wxTreeItemId newId = m_Parent->AppendItem( dest->GetId(), text, i ); + m_Parent->SetItemData( newId, this ); + m_Parent->SetItemData( oldId, NULL ); + m_Parent->Delete( oldId ); + } + else + { + // We should move recursively all files, but that's quite boring + // let's just refresh that's all ... TODO (change this to a better code ...) + wxCommandEvent dummy; + dynamic_cast(m_Parent)->GetParent()->m_Parent->OnRefresh(dummy); + } + + +} + +/****************************************************************/ +bool TreePrjItemData::Rename( const wxString & name, bool check ) +/****************************************************************/ +/* rename the file checking if extension change occurs */ +{ + if ( name.IsEmpty() ) return false; + + const wxString sep = wxFileName().GetPathSeparator(); + wxString newFile; + wxString dirs = GetDir(); + + if ( !dirs.IsEmpty() && GetType() != TREE_DIRECTORY ) newFile = dirs + sep + name; + else newFile = name; + + if ( newFile == m_FileName ) return false; + + wxString ext = WinEDA_PrjFrame::GetFileExt( GetType() ); + + wxRegEx reg( wxT( "^.*\\" ) + ext + wxT( "$" ), wxRE_ICASE ); + if ( check && !ext.IsEmpty() && !reg.Matches( newFile ) ) + { + wxMessageDialog dialog( m_Parent + , _("Changing file extension will change file type.\n Do you want to continue ?") + , _("Rename File") + , wxYES_NO | wxICON_QUESTION ); + + if ( wxID_YES != dialog.ShowModal() ) return false; + } + + if (! wxRenameFile( m_FileName, newFile, false ) ) + { + wxMessageDialog( m_Parent, _( "Unable to rename file ... "), _( "Permission error ?" ), wxICON_ERROR | wxOK ); + return false; + } + SetFileName( newFile ); + + #ifdef KICAD_PYTHON + object param = make_tuple( PyHandler::Convert( m_FileName ) + , PyHandler::Convert( newFile ) ); + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::RenameFile"), param ); + #endif + return true; +} + +/*******************************************/ +bool TreePrjItemData::Delete( bool check ) +/*******************************************/ +/* delete a file */ +{ + wxMessageDialog dialog( m_Parent, _("Do you really want to delete ") + GetFileName(), _("Delete File") + , wxYES_NO | wxICON_QUESTION ); + + if ( !check || wxID_YES == dialog.ShowModal() ) + { + if ( !wxDirExists( m_FileName ) ) + { + wxRemoveFile( m_FileName ); + } + else + { + wxArrayString filelist; + wxDir::GetAllFiles( m_FileName, &filelist ); + for ( unsigned int i = 0; i < filelist.Count(); i++ ) wxRemoveFile( filelist[i] ); + wxRmdir( m_FileName ); + } + m_Parent->Delete( GetId() ); + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::DeleteFile"), PyHandler::Convert( m_FileName ) ); + #endif + return true; + } + return false; +} + +/**********************************/ +void TreePrjItemData::Activate() +/**********************************/ +/* Called under item activation */ +{ + wxString FullFileName = wxGetCwd() + wxFileName().GetPathSeparator() + GetFileName(); + + switch ( GetType() ) + { + case TREE_PROJECT: + break; + + case TREE_DIRECTORY: + m_Parent->Toggle( GetId() ); + break; + + case TREE_SCHEMA: + { + AddDelimiterString( FullFileName ); + ExecuteFile(m_Parent, EESCHEMA_EXE, FullFileName); + break; + } + + case TREE_PCB: + AddDelimiterString( FullFileName ); + ExecuteFile(m_Parent, PCBNEW_EXE, FullFileName); + break; + + #ifdef KICAD_PYTHON + case TREE_PY: + PyHandler::GetInstance()->RunScript( FullFileName ); + break; + #endif + + case TREE_GERBER: + AddDelimiterString(FullFileName); + ExecuteFile(m_Parent, GERBVIEW_EXE, FullFileName); + break; + + case TREE_PDF: + OpenPDF( FullFileName ); + break; + + case TREE_NET: + AddDelimiterString(FullFileName); + ExecuteFile(m_Parent, CVPCB_EXE, FullFileName); + break; + + case TREE_TXT: + { + wxString editorname = GetEditorName(); + if ( !editorname.IsEmpty() ) ExecuteFile(m_Parent, editorname, FullFileName); + break; + } + + default: + OpenFile( FullFileName ); + break; + + } +} + +/***************************************************/ +TreePrjItemData * WinEDA_PrjFrame::GetSelectedData() +/***************************************************/ +{ + return dynamic_cast( m_TreeProject->GetItemData(m_TreeProject->GetSelection()) ); +} + diff --git a/kicad/treeprj_frame.cpp b/kicad/treeprj_frame.cpp new file mode 100644 index 0000000000..6948c58f11 --- /dev/null +++ b/kicad/treeprj_frame.cpp @@ -0,0 +1,743 @@ +/*********************/ +/* treeprj_frame.cpp */ +/*********************/ + +#ifdef KICAD_PYTHON +#include +#endif + +#include "fctsys.h" +#include "gr_basic.h" +#include "common.h" + +#include "kicad.h" +#include "protos.h" + +#include "wx/image.h" +#include "wx/imaglist.h" +#include "wx/treectrl.h" +#include "wx/regex.h" +#include "wx/dir.h" + +#include "bitmaps.h" +#include "bitmaps/new_python.xpm" + +#include "id.h" + +/******************************************************************/ +WinEDA_PrjFrame::WinEDA_PrjFrame(WinEDA_MainFrame * parent, + const wxPoint & pos, + const wxSize & size ) : + wxSashLayoutWindow(parent, ID_LEFT_FRAME, pos, size, + wxNO_BORDER|wxSW_3D) +/******************************************************************/ +{ + m_Parent = parent; + m_TreeProject = NULL; + wxMenuItem *item; + m_PopupMenu = NULL; + /* Filtering some file extensions (.bak, .bck, .000) (backup files)*/ + m_Filters.push_back(wxT("^.*\\.(bak|bck|000)$") ); + + +#ifdef KICAD_PYTHON + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::RunScript" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::EditScript" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::TreeContextMenu" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::TreeAddFile" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::NewFile" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::NewDirectory" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::DeleteFile" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::RenameFile" ) ); + PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::MoveFile" ) ); +#endif + + for ( int i = 0; i < TREE_MAX; i++ ) m_ContextMenus.push_back( new wxMenu() ); + + // Python script context menu: + + wxMenu * menu = m_ContextMenus[TREE_PY]; + +#ifdef KICAD_PYTHON + item = new wxMenuItem(menu, ID_PROJECT_RUNPY, + _("&Run"), + _("Run the Python Script") ); + item->SetBitmap( icon_python_small_xpm ); + menu->Append( item ); +#endif + + item = new wxMenuItem(menu, ID_PROJECT_TXTEDIT, + _("&Edit in a text editor"), + _("Edit the Python Script in a Text Editor") ); + item->SetBitmap( icon_txt_xpm ); + menu->Append( item ); + + // New files context menu: + wxMenu * menus[2]; + menus[0] = m_ContextMenus[TREE_DIRECTORY]; + menus[1] = m_ContextMenus[TREE_PROJECT]; + + for ( int i = 0; i < 2; i ++ ) + { + menu = menus[i]; + + item = new wxMenuItem(menu, ID_PROJECT_NEWDIR, _("New D&irectory"), _("Create a New Directory") ); + item->SetBitmap( directory_xpm ); + menu->Append( item ); + +#if 0 + item = new wxMenuItem(menu, ID_PROJECT_NEWSCH, _("New &Schematic"), _("Create a New Schematic File") ); + item->SetBitmap( new_sch_xpm ); + menu->Append( item ); + + item = new wxMenuItem(menu, ID_PROJECT_NEWBRD, _("New &PCB"), _("Create a New PCB File") ); + item->SetBitmap( new_pcb_xpm ); + menu->Append( item ); + + item = new wxMenuItem(menu, ID_PROJECT_NEWGERBER, _("New &Gerber File"), _("Create a New Gerber File") ); + item->SetBitmap( new_gerb_xpm ); + menu->Append( item ); + + item = new wxMenuItem(menu, ID_PROJECT_NEWNET, _("New &Netlist"), _("Create a New Netlist") ); + item->SetBitmap( new_cvpcb_xpm ); + menu->Append( item ); +#endif + +#ifdef KICAD_PYTHON + item = new wxMenuItem(menu, ID_PROJECT_NEWPY, _("New P&ython Script"), _("Create a New Python Script") ); + item->SetBitmap( new_python_xpm ); + menu->Append( item ); +#endif + + item = new wxMenuItem(menu, ID_PROJECT_NEWTXT, _("New &Text File"), _("Create a New Txt File") ); + item->SetBitmap( new_txt_xpm ); + menu->Append( item ); + + item = new wxMenuItem(menu, ID_PROJECT_NEWFILE, _("New &File"), _("Create a New File") ); + item->SetBitmap( new_xpm ); + menu->Append( item ); + } + + + // Put the Rename and Delete file menu commands: + for ( int i = TREE_PROJECT + 1; i < TREE_MAX ; i++ ) + { + menu = m_ContextMenus[i]; + item = new wxMenuItem(menu, ID_PROJECT_RENAME + , TREE_DIRECTORY != i ? _("&Rename File") : _("&Rename Directory") + , TREE_DIRECTORY != i ? _("Rename the File") : _("&Rename the Directory") ); + item->SetBitmap( right_xpm ); + menu->Append( item ); + item = new wxMenuItem(menu, ID_PROJECT_DELETE + , TREE_DIRECTORY != i ? _("&Delete File") : _("&Delete Directory") + , TREE_DIRECTORY != i ? _("Delete the File") : _("&Delete the Directory and its content") ); + item->SetBitmap( delete_xpm ); + menu->Append( item ); + } + + ReCreateTreePrj(); +} + + +BEGIN_EVENT_TABLE(WinEDA_PrjFrame, wxSashLayoutWindow) + + EVT_TREE_BEGIN_LABEL_EDIT(ID_PROJECT_TREE, WinEDA_PrjFrame::OnRenameAsk ) + EVT_TREE_END_LABEL_EDIT(ID_PROJECT_TREE, WinEDA_PrjFrame::OnRename ) + EVT_TREE_ITEM_ACTIVATED(ID_PROJECT_TREE, WinEDA_PrjFrame::OnSelect) + EVT_TREE_ITEM_RIGHT_CLICK(ID_PROJECT_TREE, WinEDA_PrjFrame::OnRight) + EVT_TREE_BEGIN_DRAG( ID_PROJECT_TREE, WinEDA_PrjFrame::OnDragStart) + EVT_TREE_END_DRAG( ID_PROJECT_TREE, WinEDA_PrjFrame::OnDragEnd) + EVT_MENU(ID_PROJECT_TXTEDIT, WinEDA_PrjFrame::OnTxtEdit) + EVT_MENU(ID_PROJECT_NEWFILE, WinEDA_PrjFrame::OnNewFile) + EVT_MENU(ID_PROJECT_NEWDIR, WinEDA_PrjFrame::OnNewDirectory) + EVT_MENU(ID_PROJECT_NEWSCH, WinEDA_PrjFrame::OnNewSchFile) + EVT_MENU(ID_PROJECT_NEWBRD, WinEDA_PrjFrame::OnNewBrdFile) + EVT_MENU(ID_PROJECT_NEWPY, WinEDA_PrjFrame::OnNewPyFile) + EVT_MENU(ID_PROJECT_NEWGERBER, WinEDA_PrjFrame::OnNewGerberFile) + EVT_MENU(ID_PROJECT_NEWTXT, WinEDA_PrjFrame::OnNewTxtFile) + EVT_MENU(ID_PROJECT_NEWNET, WinEDA_PrjFrame::OnNewNetFile) + EVT_MENU(ID_PROJECT_DELETE, WinEDA_PrjFrame::OnDeleteFile) + EVT_MENU(ID_PROJECT_RENAME, WinEDA_PrjFrame::OnRenameFile) + +#ifdef KICAD_PYTHON + EVT_MENU(ID_PROJECT_RUNPY, WinEDA_PrjFrame::OnRunPy) +#endif +END_EVENT_TABLE() + +/********************************/ +WinEDA_TreePrj::~WinEDA_TreePrj() +/********************************/ +{ +} + +/*******************************************************/ +void WinEDA_PrjFrame::OnDragStart( wxTreeEvent & event ) +/*******************************************************/ +// Allowing drag&drop of file other than the currently opened project +{ + /* Ensure item is selected (Under Windows start drag does not activate the item) */ +wxTreeItemId curr_item = event.GetItem(); + m_TreeProject->SelectItem(curr_item); + TreePrjItemData * data = GetSelectedData(); + if ( data->GetFileName() == m_Parent->m_PrjFileName ) return; + + wxTreeItemId id = m_TreeProject->GetSelection(); + + wxImage img = m_TreeProject->GetImageList()->GetBitmap( data->GetType() - 1 ).ConvertToImage(); + m_DragCursor = wxCursor(img ); + m_Parent->wxWindow::SetCursor( (wxCursor &) m_DragCursor ); + event.Allow(); +} + +/*******************************************************/ +void WinEDA_PrjFrame::OnDragEnd( wxTreeEvent & event ) +/*******************************************************/ +{ + m_Parent->SetCursor( wxNullCursor ); + + wxTreeItemId moved = m_TreeProject->GetSelection(); + TreePrjItemData * source_data = GetSelectedData(); + wxTreeItemId dest = event.GetItem(); + if (!dest.IsOk() ) return; // Cancelled ... + TreePrjItemData * destData = dynamic_cast(m_TreeProject->GetItemData( dest ) ); + if (!destData ) return; + + // the item can be a member of the selected directory; get the directory itself + if ( TREE_DIRECTORY != destData->GetType() && !m_TreeProject->ItemHasChildren( dest ) ) + { // the item is a member of the selected directory; get the directory itself + dest = m_TreeProject->GetItemParent( dest ); + if (!dest.IsOk() ) return; // no parent ? + + // Select the right destData: + destData = dynamic_cast(m_TreeProject->GetItemData( dest ) ); + if (!destData ) return; + } + + source_data->Move( destData ); + +#if 0 + /* Sort filenames by alphabetic order */ + m_TreeProject->SortChildren(dest); +#endif +} + +/************************************/ +void WinEDA_PrjFrame::ClearFilters() +/************************************/ +{ + m_Filters.clear(); +} + +/*************************************************************/ +void WinEDA_PrjFrame::RemoveFilter( const wxString & filter ) +/*************************************************************/ +{ + for ( unsigned int i = 0; i < m_Filters.size(); i++ ) + { + if ( filter == m_Filters[i] ) + { + m_Filters.erase( m_Filters.begin() + i ); + return; + } + } +} + +#ifdef KICAD_PYTHON + +/********************************************************************************/ +TreePrjItemData * WinEDA_PrjFrame::FindItemData( const boost::python::str & name ) +/********************************************************************************/ +// Return the data corresponding to the file, or NULL +{ + // (Interative tree parsing) + std::vector< wxTreeItemId > roots1, roots2; + std::vector< wxTreeItemId > *root, *reserve; + wxString filename = PyHandler::MakeStr( name ); + + root = &roots1; + reserve = &roots2; + root->push_back( m_TreeProject->GetRootItem() ); + + + // if we look for the root, return it ... + TreePrjItemData * data = dynamic_cast< TreePrjItemData *>( m_TreeProject->GetItemData( root->at(0) ) ); + if ( data->GetFileName() == filename ) return data; + + // Then find in its child + while ( root->size() ) + { + // look in all roots + for ( unsigned int i = 0; i < root->size() ; i++ ) + { + wxTreeItemId id = root->at( i ); + + // for each root check any child: + void * cookie = NULL; + wxTreeItemId child = m_TreeProject->GetFirstChild( id, cookie ); + while ( child.IsOk() ) + { + TreePrjItemData * data = dynamic_cast< TreePrjItemData *>( m_TreeProject->GetItemData( child ) ); + if ( data ) + { + if ( data->GetFileName() == filename ) return data; + if ( m_TreeProject->ItemHasChildren( child ) ) reserve->push_back( child ); + } + child = m_TreeProject->GetNextSibling( child ); + } + + } + // Swap the roots + root->clear(); + std::vector< wxTreeItemId > *tmp; + tmp = root; + root = reserve; + reserve = tmp; + } + return NULL; +} + +/******************************************************************/ +void WinEDA_PrjFrame::RemoveFilterPy( const boost::python::str & filter ) +/******************************************************************/ +{ + RemoveFilter( PyHandler::MakeStr( filter ) ); +} + +/******************************************************************/ +void WinEDA_PrjFrame::AddFilter( const boost::python::str & filter ) +/******************************************************************/ +{ + wxRegEx reg; + wxString text = PyHandler::MakeStr( filter ); + if ( !reg.Compile( text ) ) return; + m_Filters.push_back( text ); +} +#endif + +/******************************************************************/ +const std::vector< wxString > & WinEDA_PrjFrame::GetFilters() +/******************************************************************/ +{ + return m_Filters; +} + +/******************************************************************/ +wxMenu * WinEDA_PrjFrame::GetContextMenu( int type ) +/******************************************************************/ +{ + return m_ContextMenus[type]; +} + +void WinEDA_PrjFrame::OnNewDirectory(wxCommandEvent & event) { NewFile( TREE_DIRECTORY ); } +void WinEDA_PrjFrame::OnNewFile(wxCommandEvent & event) { NewFile( TREE_UNKNOWN ); } +void WinEDA_PrjFrame::OnNewSchFile(wxCommandEvent & event) { NewFile( TREE_SCHEMA ); } +void WinEDA_PrjFrame::OnNewBrdFile(wxCommandEvent & event) { NewFile( TREE_PCB ); } +void WinEDA_PrjFrame::OnNewPyFile(wxCommandEvent & event) { NewFile( TREE_PY ); } +void WinEDA_PrjFrame::OnNewGerberFile(wxCommandEvent & event) { NewFile( TREE_GERBER ); } +void WinEDA_PrjFrame::OnNewTxtFile(wxCommandEvent & event) { NewFile( TREE_TXT ); } +void WinEDA_PrjFrame::OnNewNetFile(wxCommandEvent & event) { NewFile( TREE_NET ); } + +/******************************************************************/ +void WinEDA_PrjFrame::NewFile( enum TreeFileType type ) +/******************************************************************/ +{ + wxString filename; + wxString mask = GetFileExt( type ); + const wxString sep = wxFileName().GetPathSeparator(); + + // Get the directory: + wxString dir; + + TreePrjItemData * treeData; + wxString FullFileName; + treeData = GetSelectedData(); + if (!treeData) return; + + dir = treeData->GetDir(); + + // Ask for the new file name + + filename = EDA_FileSelector( TREE_DIRECTORY != type ? _("Create New File:") : _("Create New Directory"), + wxGetCwd() + sep + dir, /* Chemin par defaut */ + _("noname") + mask, /* nom fichier par defaut */ + mask, /* extension par defaut */ + mask, /* Masque d'affichage */ + this, + wxFD_SAVE | wxFD_OVERWRITE_PROMPT, + TRUE + ); + if ( filename.IsEmpty() ) return; + + enum TreeFileType rootType = treeData->GetType(); + wxTreeItemId root; + + if ( TREE_DIRECTORY == rootType ) + { + root = m_TreeProject->GetSelection(); + } + else + { + root = m_TreeProject->GetItemParent( m_TreeProject->GetSelection() ); + if ( !root.IsOk() ) root = m_TreeProject->GetSelection(); + } + + NewFile( filename, type, root ); +} + +/******************************************************************/ +void WinEDA_PrjFrame::NewFile( const wxString & name, + enum TreeFileType type, wxTreeItemId & root ) +/******************************************************************/ +{ + if ( TREE_DIRECTORY != type ) + { + wxFile( name, wxFile::write ); + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::NewFile"), PyHandler::Convert(name) ); + #endif + } + else + { + wxMkdir( name ); + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::NewDirectory"), PyHandler::Convert(name) ); + #endif + } + + AddFile( name, root ); +} + +/******************************************************************/ +wxString WinEDA_PrjFrame::GetFileExt( enum TreeFileType type ) +/******************************************************************/ +{ +wxString extensions[] = +{ + wxT( "" ), // 0 is not used + wxT( ".pro" ), // TREE_PROJECT + g_SchExtBuffer, // TREE_SCHEMA + g_BoardExtBuffer, // TREE_PCB + wxT( ".py" ), // TREE_PY + g_GerberExtBuffer, // TREE_GERBER + wxT( ".pdf" ), // TREE_PDF + wxT( ".txt" ), // TREE_TXT + wxT( ".net" ), // TREE_NET + wxT( "" ), // TREE_UNKNOWN + wxT( "" ), // TREE_DIRECTORY + }; + + if ( type < TREE_MAX ) return extensions[type]; + return wxEmptyString; +} + +/**************************************************************************/ +void WinEDA_PrjFrame::AddFile( const wxString & name, wxTreeItemId & root ) +/**************************************************************************/ +/* add filename "name" to the tree + if name is adirectory, add the sub directory file names +*/ +{ +wxTreeItemId cellule; +// Filter +wxRegEx reg; + + for ( unsigned int i = 0; i < m_Filters.size(); i++ ) + { + reg.Compile( m_Filters[i], wxRE_ICASE ); + if ( reg.Matches( name ) ) return; + } + + // Check the file type + int type = TREE_UNKNOWN; + + if ( wxDirExists( name ) ) + { + type = TREE_DIRECTORY; + } + else + { + for ( int i = TREE_PROJECT; i < TREE_MAX; i++ ) + { + wxString ext = GetFileExt( (enum TreeFileType) i ); + + if ( ext == wxT( "" ) ) continue; + + reg.Compile( wxString::FromAscii( "^.*\\" ) + ext + wxString::FromAscii( "$" ), wxRE_ICASE ); + if ( reg.Matches( name ) ) + { + type = i; + break; + } + } + } + + // Append the item (only appending the filename not the full path): + + wxString file = wxFileNameFromPath( name ); + cellule = m_TreeProject->AppendItem( root, file ); + TreePrjItemData * data = new TreePrjItemData( (enum TreeFileType) type, name, m_TreeProject ); + m_TreeProject->SetItemFont( cellule, *g_StdFont ); + m_TreeProject->SetItemData( cellule, data ); + data->SetState(0); + + /* Mark root files (files which have the same name as the project) */ + wxFileName project (m_Parent->m_PrjFileName); + wxFileName currfile (file); + if ( currfile.GetName().CmpNoCase(project.GetName()) == 0 ) data->m_IsRootFile = true; + else data->m_IsRootFile = false; + + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::TreeAddFile"), PyHandler::Convert( name ) ); + #endif + + if ( TREE_DIRECTORY == type ) + { + const wxString sep = wxFileName().GetPathSeparator(); + wxDir dir( name ); + wxString dir_filename; + if ( dir.GetFirst( &dir_filename ) ) + { + do + { + AddFile( name + sep + dir_filename, cellule ); + } while ( dir.GetNext( &dir_filename ) ); + } + /* Sort filenames by alphabetic order */ + m_TreeProject->SortChildren(cellule); + } +} + +/******************************************/ +void WinEDA_PrjFrame::ReCreateTreePrj(void) +/******************************************/ +/* Create or modify the tree showing project file names +*/ +{ +wxTreeItemId rootcellule; +wxString Text; +bool prjOpened = false; + + if ( ! m_TreeProject ) m_TreeProject = new WinEDA_TreePrj(this); + else m_TreeProject->DeleteAllItems(); + + m_TreeProject->SetFont(* g_StdFont); + if (m_Parent->m_PrjFileName.IsEmpty() ) Text = wxT("noname"); + else Text = wxFileNameFromPath(m_Parent->m_PrjFileName); + + prjOpened = wxFileExists( Text ); + + // root tree: + m_root = rootcellule = m_TreeProject->AddRoot(Text, TREE_PROJECT - 1, TREE_PROJECT - 1); + m_TreeProject->SetItemBold(rootcellule, TRUE); + m_TreeProject->SetItemData( rootcellule, new TreePrjItemData(TREE_PROJECT, wxEmptyString, m_TreeProject) ); + m_TreeProject->SetItemFont(rootcellule, *g_StdFont); + + ChangeFileNameExt(Text, wxEmptyString); + + // Add at least a .scn / .brd if not existing: + if ( !wxFileExists(Text+g_SchExtBuffer) ) AddFile( Text + g_SchExtBuffer, m_root ); + if ( !wxFileExists(Text+g_BoardExtBuffer) ) AddFile( Text + g_BoardExtBuffer, m_root ); + + // Now adding all current files if available + if ( prjOpened ) + { + wxDir dir( wxGetCwd() ); + wxString filename; + if ( dir.GetFirst( &filename ) ) + { + do + { + if ( filename == Text + wxT( ".pro" ) ) continue; + AddFile( filename, m_root ); + } while ( dir.GetNext( &filename ) ); + } + } + + m_TreeProject->Expand(rootcellule); + + /* Sort filenames by alphabetic order */ + m_TreeProject->SortChildren(m_root); +} + +/**************************************************/ +void WinEDA_PrjFrame::OnRight(wxTreeEvent & Event) +/**************************************************/ +// Opens (popup) the context menu +{ +int tree_id; +TreePrjItemData * tree_data; +wxString FullFileName; +wxTreeItemId curr_item = Event.GetItem(); + + /* Ensure item is selected (Under Windows right click does not select the item) */ + m_TreeProject->SelectItem(curr_item); + + // Delete and recreate the context menu + delete( m_PopupMenu ); + m_PopupMenu = new wxMenu(); + + // Get the current filename: + tree_data = GetSelectedData(); + if (!tree_data) return; + + tree_id = tree_data->GetType(); + FullFileName = tree_data->GetFileName(); + + // copy menu contents in order of the next array: + wxMenu * menus[] = + { + GetContextMenu( tree_id ) + , const_cast( tree_data->GetMenu() ) + }; + + for ( unsigned int j = 0; j < sizeof(menus)/sizeof(wxMenu*); j++ ) + { + wxMenu * menu = menus[j]; + if ( ! menu ) continue; + wxMenuItemList list = menu->GetMenuItems(); + + for ( unsigned int i = 0; i < list.GetCount() ; i ++ ) + { + // Grrrr! wxMenu does not have any copy constructor !! (do it by hand) + wxMenuItem * src = list[i]; + wxString label = src->GetText(); + // for obscure reasons, the & is translated into _ ... so replace it + label.Replace( wxT("_"), wxT("&"), true ); + wxMenuItem * item = new wxMenuItem( m_PopupMenu, src->GetId() + , label, src->GetHelp() + , src->GetKind() ); + item->SetBitmap( src->GetBitmap() ); + m_PopupMenu->Append( item ); + } + } + + // At last, call python to let python add menu items "on the fly" + + #ifdef KICAD_PYTHON + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::TreeContextMenu"), PyHandler::Convert( FullFileName ) ); + #endif + + if ( m_PopupMenu ) PopupMenu( m_PopupMenu ); +} + + +/*******************************************************/ +void WinEDA_PrjFrame::OnTxtEdit(wxCommandEvent & event ) +/*******************************************************/ +{ + TreePrjItemData * tree_data = GetSelectedData(); + if (!tree_data) return; + + wxString FullFileName = tree_data->GetFileName(); + AddDelimiterString( FullFileName ); + wxString editorname = GetEditorName(); + if ( !editorname.IsEmpty() ) + { +#ifdef KICAD_PYTHON + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::EditScript"), PyHandler::Convert( FullFileName ) ); +#endif + ExecuteFile(this, editorname, FullFileName); + } +} + +/***************************************************/ +void WinEDA_PrjFrame::OnDeleteFile(wxCommandEvent &) +/***************************************************/ +{ + TreePrjItemData * tree_data = GetSelectedData(); + if (!tree_data) return; + tree_data->Delete(); +} + +/***************************************************/ +void WinEDA_PrjFrame::OnRenameFile(wxCommandEvent &) +/***************************************************/ +{ +wxTreeItemId curr_item = m_TreeProject->GetSelection(); +TreePrjItemData * tree_data = GetSelectedData(); + if (!tree_data) return; + +wxString buffer = m_TreeProject->GetItemText(curr_item); +wxString msg = _("Change File Name: ") + tree_data->m_FileName; + if ( Get_Message(msg, buffer, this) != 0 ) + return; //Abort command + + if ( tree_data->Rename( buffer, true ) ) + { + m_TreeProject->SetItemText(curr_item, buffer); + } + +} + + +#ifdef KICAD_PYTHON +/***************************************************/ +void WinEDA_PrjFrame::OnRunPy(wxCommandEvent & event ) +/***************************************************/ +{ + TreePrjItemData * tree_data = GetSelectedData(); + if (!tree_data) return; + + wxString FullFileName = tree_data->GetFileName(); + PyHandler::GetInstance()->TriggerEvent( wxT("kicad::RunScript"), PyHandler::Convert( FullFileName ) ); + PyHandler::GetInstance()->RunScript( FullFileName ); +} + +/****************************************************************/ +int WinEDA_PrjFrame::AddStatePy( boost::python::object & bitmap ) +/****************************************************************/ +// Add a state to the image list ... +{ + wxBitmap * image; + bool success = wxPyConvertSwigPtr( bitmap.ptr(), (void**)&image, _T("wxBitmap")); + if ( !success ) return -1; + + wxImageList * list = m_TreeProject->GetImageList(); + int ret = list->GetImageCount() / ( TREE_MAX - 2 ); + + for ( int i = 0; i < TREE_MAX - 1; i ++ ) + { + wxBitmap composed ( list->GetBitmap( i ) ); + wxMemoryDC dc; + dc.SelectObject( composed ); + dc.DrawBitmap( *image, 0, 0, true ); + list->Add( composed ); + } + return ret; +} + +#endif + +/***************************************************/ +void WinEDA_PrjFrame::OnRenameAsk(wxTreeEvent & event) +/***************************************************/ +/* Prevent the main project to be renamed */ +{ + TreePrjItemData * tree_data = GetSelectedData(); + if (!tree_data) return; + if ( m_Parent->m_PrjFileName == tree_data->GetFileName() ) event.Veto(); +} + +/***************************************************/ +void WinEDA_PrjFrame::OnRename(wxTreeEvent & event) +/***************************************************/ +/* rename a tree item on demand of the context menu */ +{ + TreePrjItemData * tree_data = GetSelectedData(); + if (!tree_data) return; + + tree_data->OnRename( event ); +} + + +/**************************************************/ +void WinEDA_PrjFrame::OnSelect(wxTreeEvent & Event) +/**************************************************/ +{ +wxString FullFileName; + + TreePrjItemData * tree_data = GetSelectedData(); + if (!tree_data) return; + tree_data->Activate(); +} + diff --git a/libs.linux b/libs.linux index 201c0702d8..d04aad7e61 100644 --- a/libs.linux +++ b/libs.linux @@ -7,11 +7,25 @@ SRCSUFF = .cpp OBJSUFF = .o FINAL = 1 +# You must comment or uncomment this line to disable/enable python support +#KICAD_PYTHON = 1 + # You must comment or uncomment this line for dynamic or static link # dynamic link is less difficult than static link # choose it if you have problems (libs not found, or unresolved references) ), or if kicad is running only on YOUR system. +ifndef KICAD_PYTHON KICAD_STATIC_LINK = 1 +endif + +ifdef KICAD_PYTHON +PYTHON_VERSION=2.3 +PYLIBS= -L/usr/lib +PYLIBS+= -L /usr/include/python +PYLIBS+= -lpython$(PYTHON_VERSION) +PYLIBS+= -lboost_python +EXTRACPPFLAGS+=-I /usr/include/python$(PYTHON_VERSION) -DKICAD_PYTHON -fno-strict-aliasing +endif # path and version definition for wxWidgets and mesa libs MESALIBSPATH = /usr/local/lib @@ -30,7 +44,9 @@ else LIBSTDC = -lstdc++ endif + LIBVERSION=`wx-config --release` +LIBREGEX=$(WXPATH)/libwxregexu-$(LIBVERSION).a # use link static for wxWidgets ifdef KICAD_STATIC_LINK @@ -41,13 +57,13 @@ WXSYSLIB= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \ $(WXPATH)/libwxpng-$(LIBVERSION).a\ $(WXPATH)/libwxjpeg-$(LIBVERSION).a\ $(WXPATH)/libwxzlib-$(LIBVERSION).a\ + $(LIBREGEX)\ /usr/X11R6/lib/libXinerama.a \ - /usr/X11R6/lib/libXxf86vm.a \ -lgtk-x11-2.0 -lgdk-x11-2.0 \ -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lgthread-2.0\ -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl\ -lglib-2.0 -lpangoft2-1.0 -lSM\ - -L/usr/lib + -L/usr/lib $(PYLIBS) WXSYSLIB_WITH_GL= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \ @@ -61,7 +77,7 @@ WXSYSLIB_WITH_GL= $(WXPATH)/$(PREFIX_WX_LIBS)-$(LIBVERSION).a \ -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lgthread-2.0\ -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl\ -lglib-2.0 -lpangoft2-1.0 -lSM\ - -L/usr/lib + -L/usr/lib $(PYLIBS) else #or use "standard command" for wxWidgets WXSYSLIB= `wx-config --libs std` @@ -72,8 +88,8 @@ endif # attention à l'ordre des libairies LIBS = -L/usr/local/lib -L/usr/X11R6/lib\ $(EXTRALIBS) $(WXSYSLIB)\ - $(LIBSTDC) + $(LIBSTDC) $(PYLIBS) LIBS_WITH_GL = -L/usr/local/lib -L/usr/X11R6/lib\ $(EXTRALIBS) $(WXSYSLIB_WITH_GL)\ - $(LIBSTDC) + $(LIBSTDC) $(PYLIBS) diff --git a/libs.macosx b/libs.macosx index e41bb39198..8a8e186dac 100644 --- a/libs.macosx +++ b/libs.macosx @@ -4,10 +4,25 @@ KICAD_BIN = /usr/local/kicad/macosx RESCOMP = /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ -i . SETFILE = /Developer/Tools/SetFile +MKMK_WX_VERSION=`wx-config --version` + SRCSUFF = .cpp OBJSUFF = .o FINAL = 1 -LIBS = ../common/common.a `wx-config --libs` -LIBS3D = ../common/common.a `wx-config --libs std,gl` +# You must comment or uncomment this line to disable/enable python support +#KICAD_PYTHON = 1 + + + +ifdef KICAD_PYTHON +PYLIBS= -L/usr/lib +PYLIBS+= -L /usr/include/python +PYLIBS+= -lpython2.4 +PYLIBS+= -lboost_python +EXTRACPPFLAGS+=-I /usr/include/python2.4 -DKICAD_PYTHON -fno-strict-aliasing -ggdb +endif + +LIBS = ../common/common.a `wx-config --libs` $(PYLIBS) +LIBS3D = ../common/common.a `wx-config --libs std,gl` $(PYLIBS) diff --git a/libs.win b/libs.win index 0141975258..767110ae46 100644 --- a/libs.win +++ b/libs.win @@ -1,58 +1,70 @@ -# File: winmake.env -#binaries path: -KICAD_BIN = /f/kicad/winexe - - - -# Target WXMAKINGDLL WXUSINGDLL WXBUILDDLL -# wxWin DLL 1 0 1 -# wxWin STATIC 0 0 0 -# App use wxWin DLL 0 1 0 -# DLL use wxWin DLL 0 1 1 -# DLL use wxWin STATIC 0 0 1 -# - -#Define the wxWidget path (if not found in environment variables): -ifndef WXWIN -WXWIN=/f/wxMSW-2.8.1 -endif -LIBVERSION = 2.8 - - -#comment this for static wxWidgets link -#WXUSINGDLL = 1 - -FINAL = 1 - -ALL_CPPFLAGS = `$(WXWIN)/wx-config --cppflags` - -EDACPPFLAGS = $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) - -EDALIBS = $(EXTRALIBS) - -SYSWXLIB = `$(WXWIN)/wx-config --libs gl`\ - -lwxpng-$(LIBVERSION) -lwxjpeg-$(LIBVERSION) -lwxzlib-$(LIBVERSION) - -.cpp.o: - gcc -c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp - - -# Settings for Cyginw/Mingw32 -# Some versions of windres cannot cope with the --preprocessor -# option. Uncomment the RCPREPROCESSOR line below if yours can. -ifndef WINE -RESCOMP=$(CROSS)windres $(_USE_TEMP_FILE_IF_SUPPORTED) -else -RESCOMP=wrc -endif -RCINPUTSWITCH=-i -RCOUTPUTSWITCH=-o -RCINCSWITCH=--include-dir -RCDEFSWITCH=--define -# Note that this can cause windres to fail (Win95/98 problem?) -# but commenting out RCPREPROCESSOR then does the trick. -#RCPREPROCESSOR=--preprocessor "$(CXX) -c -E -xc-header -DRC_INVOKED" - -# Don't make this too long (e.g. by adding contrib/include/wx) because it will -# truncate the command line -RESFLAGS=$(RCPREPROCESSOR) $(RCINCSWITCH) $(WXDIR)/include $(RCEXTRAINC) $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__ +# File: winmake.env +#binaries path: +KICAD_BIN = /f/kicad/winexe + + + +# Target WXMAKINGDLL WXUSINGDLL WXBUILDDLL +# wxWin DLL 1 0 1 +# wxWin STATIC 0 0 0 +# App use wxWin DLL 0 1 0 +# DLL use wxWin DLL 0 1 1 +# DLL use wxWin STATIC 0 0 1 +# + +#WXUSINGDLL = 1 + +#Define the wxWidget path (if not found in environment variables): +ifndef WXWIN +WXWIN=/f/wxMSW-2.8.4 +endif +LIBVERSION = 2.8 + + +#comment this for static wxWidgets link +#WXUSINGDLL = 1 + +# You must comment or uncomment this line to disable/enable python support +#KICAD_PYTHON = 1 + +FINAL = 1 + +ALL_CPPFLAGS = `$(WXWIN)/wx-config --cppflags` +EDACPPFLAGS = $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) +EDALIBS = $(EXTRALIBS) + +ifdef KICAD_PYTHON +BOOST_PATH=/d/boost +PYTHON_PATH=/c/Python25 +PYLIBS= -L$(PYTHON_PATH)/libs +PYLIBS+= -L $(PYTHON_PATH)/Lib +PYLIBS+= -lpython2.5 +EXTRACPPFLAGS+=-I $(PYTHON_PATH)/include -DKICAD_PYTHON -I $(BOOST_PATH) -fno-strict-aliasing -ggdb +endif + +SYSWXLIB = `$(WXWIN)/wx-config --libs gl`\ + -lwxpng-$(LIBVERSION) -lwxjpeg-$(LIBVERSION) -lwxzlib-$(LIBVERSION) $(PYLIBS) + +.cpp.o: + gcc -c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp + + +# Settings for Cyginw/Mingw32 +# Some versions of windres cannot cope with the --preprocessor +# option. Uncomment the RCPREPROCESSOR line below if yours can. +ifndef WINE +RESCOMP=$(CROSS)windres $(_USE_TEMP_FILE_IF_SUPPORTED) +else +RESCOMP=wrc +endif +RCINPUTSWITCH=-i +RCOUTPUTSWITCH=-o +RCINCSWITCH=--include-dir +RCDEFSWITCH=--define +# Note that this can cause windres to fail (Win95/98 problem?) +# but commenting out RCPREPROCESSOR then does the trick. +#RCPREPROCESSOR=--preprocessor "$(CXX) -c -E -xc-header -DRC_INVOKED" + +# Don't make this too long (e.g. by adding contrib/include/wx) because it will +# truncate the command line +RESFLAGS=$(RCPREPROCESSOR) $(RCINCSWITCH) $(WXDIR)/include $(RCEXTRAINC) $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__ diff --git a/mybuild_wxWidgets_linux.txt b/mybuild_wxWidgets_linux.txt index 6fdf415ca2..0d31766e46 100644 --- a/mybuild_wxWidgets_linux.txt +++ b/mybuild_wxWidgets_linux.txt @@ -1,2 +1,2 @@ rm *.cache -./configure --enable-monolithic --enable-unicode=no --enable-shared=no --with-opengl --disable-compat24 --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-zlib=builtin --with-regex=builtin +./configure --enable-monolithic --enable-unicode=no --enable-shared=no --with-opengl --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-zlib=builtin --with-regex=builtin diff --git a/mybuild_wxWidgets_linux_unicode.txt b/mybuild_wxWidgets_linux_unicode.txt index 8804540664..199e89d153 100644 --- a/mybuild_wxWidgets_linux_unicode.txt +++ b/mybuild_wxWidgets_linux_unicode.txt @@ -1,2 +1,2 @@ rm *.cache -./configure --enable-monolithic --enable-unicode=yes --enable-shared=no --with-opengl --disable-compat24 --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-zlib=builtin --with-regex=builtin +./configure --enable-monolithic --enable-unicode=yes --enable-shared=no --with-opengl --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-zlib=builtin --with-regex=builtin diff --git a/mybuild_wxWidgets_macosX_unicode.txt b/mybuild_wxWidgets_macosX_unicode.txt index a23fb25b14..9bfadf79c4 100644 --- a/mybuild_wxWidgets_macosX_unicode.txt +++ b/mybuild_wxWidgets_macosX_unicode.txt @@ -1,2 +1,2 @@ rm *.cache -./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --disable-universal --disable-compat24 +./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --enable-universal_binary diff --git a/mybuild_wxWidgets_windows.txt b/mybuild_wxWidgets_windows.txt index 45e208a2fb..72f3776cd8 100644 --- a/mybuild_wxWidgets_windows.txt +++ b/mybuild_wxWidgets_windows.txt @@ -1,2 +1,2 @@ rm *.cache -./configure --enable-unicode=no --enable-shared=no --enable-monolithic --with-msw --disable-compat24 --with-opengl --with-odbc +./configure --enable-unicode=no --enable-shared=no --enable-monolithic --with-msw --with-opengl --with-odbc diff --git a/mybuild_wxWidgets_windows_unicode.txt b/mybuild_wxWidgets_windows_unicode.txt index 604ca16290..dbd5861417 100644 --- a/mybuild_wxWidgets_windows_unicode.txt +++ b/mybuild_wxWidgets_windows_unicode.txt @@ -1,2 +1,2 @@ rm *.cache -./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-msw --disable-compat24 --with-opengl --with-odbc +./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-msw --with-opengl diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index aa93c66003..dae8f16bbb 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -832,7 +832,8 @@ int ox, oy, fx, fy, dx , dy; if ( AutoPlaceShowAll ) { - GRLine(&DrawPanel->m_ClipBox, DC, ox, oy, fx, fy, g_DesignSettings.m_RatsnestColor|GR_XOR) ; + GRLine(&DrawPanel->m_ClipBox, DC, ox, oy, fx, fy, + 0, g_DesignSettings.m_RatsnestColor|GR_XOR) ; } /* Evaluation du cout du chevelu: */ diff --git a/pcbnew/bitmaps/Drag_Segment_WithSlope.xpm b/pcbnew/bitmaps/Drag_Segment_WithSlope.xpm new file mode 100644 index 0000000000..f9435f77a3 --- /dev/null +++ b/pcbnew/bitmaps/Drag_Segment_WithSlope.xpm @@ -0,0 +1,59 @@ +/* XPM */ +static const char * drag_segment_withslope_xpm[] = { +"16 16 40 1", +" c None", +"! c black", +"# c #009B00", +"$ c #3CBA00", +"% c #007C28", +"& c #0D0D1E", +"' c #9B9B9B", +"( c #565656", +") c #32323E", +"* c #DCDCEF", +"+ c #4A4A4A", +", c #D2D2D2", +"- c #84849B", +". c white", +"0 c #F1F1FF", +"1 c #31313D", +"2 c #E7E5FF", +"3 c #646489", +"4 c #232332", +"5 c #FBFBFF", +"6 c #EAEAFF", +"7 c #E2E1FF", +"8 c #DBDBFF", +"9 c #D5D3FF", +": c #CDCDFF", +"; c #C8C6FF", +"< c #C1C1FF", +"= c #9F9DDB", +"> c #30303B", +"? c #7A7A96", +"@ c #D2D0FF", +"A c #5A5981", +"B c #20202F", +"C c #C8C8FF", +"D c #C0BFFF", +"E c #5C5C82", +"F c #B8B8FF", +"G c #56557D", +"H c #9493D6", +"I c #1D1D2C", +" ##", +" ##$", +" #%%#########$ ", +" %%#####&####$ ", +" '%#$''()*)+ ,,,", +" %#$ !-.-!! ", +"%#$ !.! ", +"#$ ! !0! ! ", +"$ 1-!!!2!!!34 ", +" !*506789:;<=!", +" >?!!!@!!!AB ", +" ! !C! !! ", +" ! !D! ! ", +" !EFG!! ", +" BHI! ", +" ! "}; diff --git a/pcbnew/bitmaps/Drag_Track_Segment.xpm b/pcbnew/bitmaps/Drag_Track_Segment.xpm new file mode 100644 index 0000000000..6d61af10b8 --- /dev/null +++ b/pcbnew/bitmaps/Drag_Track_Segment.xpm @@ -0,0 +1,60 @@ +/* XPM */ +static const char * drag_track_segment_xpm[] = { +"16 16 41 1", +" c None", +"! c #D90000", +"# c black", +"$ c #009B00", +"% c #3CBA00", +"& c #007C28", +"' c #0D0D1E", +"( c #9B9B9B", +") c #565656", +"* c #32323E", +"+ c #DCDCEF", +", c #4A4A4A", +"- c #D2D2D2", +". c #84849B", +"0 c white", +"1 c #F1F1FF", +"2 c #31313D", +"3 c #E7E5FF", +"4 c #646489", +"5 c #232332", +"6 c #FBFBFF", +"7 c #EAEAFF", +"8 c #E2E1FF", +"9 c #DBDBFF", +": c #D5D3FF", +"; c #CDCDFF", +"< c #C8C6FF", +"= c #C1C1FF", +"> c #9F9DDB", +"? c #30303B", +"@ c #7A7A96", +"A c #D2D0FF", +"B c #5A5981", +"C c #20202F", +"D c #C8C8FF", +"E c #C0BFFF", +"F c #5C5C82", +"G c #B8B8FF", +"H c #56557D", +"I c #9493D6", +"J c #1D1D2C", +"!! $$", +" !! $$%", +" &&$$$$$$$$$% ", +" &&$$$$$'$$$% ", +" &$((!()*+*, ---", +" &$ !!#.0.## ", +"&$ !!#0# ", +"$ # !#1# # ", +"$ 2.###3###45 ", +" #+61789:;<=>#", +" ?@###A###BC ", +" # #D# ## ", +" # #E# # ", +" #FGH## ", +" CIJ# ", +" # "}; diff --git a/pcbnew/bitmaps/Footprint_Text.xpm b/pcbnew/bitmaps/Footprint_Text.xpm new file mode 100644 index 0000000000..8250c9e74a --- /dev/null +++ b/pcbnew/bitmaps/Footprint_Text.xpm @@ -0,0 +1,24 @@ +/* XPM */ +char * footprint_text_xpm[] = { +"16 16 4 1", +" c None", +". c #009B9B", +"+ c #007070", +"@ c #005050", +" .............. ", +" .............. ", +" .+ .... +. ", +" .@ .... . ", +" .... ", +" .... ", +" .... ", +" .... ", +" .... ", +" .... ", +" .... ", +" .... ", +" .... ", +" .....+ ", +" ........ ", +" "}; + diff --git a/pcbnew/bitmaps/Move_Track.xpm b/pcbnew/bitmaps/Move_Track.xpm new file mode 100644 index 0000000000..39edb487cb --- /dev/null +++ b/pcbnew/bitmaps/Move_Track.xpm @@ -0,0 +1,60 @@ +/* XPM */ +static const char * move_track_xpm[] = { +"16 16 41 1", +" c None", +"! c black", +"# c #007C28", +"$ c #009B00", +"% c #3CBA00", +"& c #287C00", +"' c #0D0D1E", +"( c #9B9B9B", +") c #565656", +"* c #32323E", +"+ c #DCDCEF", +", c #4A4A4A", +"- c #D2D2D2", +". c #84849B", +"0 c white", +"1 c #F1F1FF", +"2 c #31313D", +"3 c #E7E5FF", +"4 c #646489", +"5 c #232332", +"6 c #FBFBFF", +"7 c #EAEAFF", +"8 c #E2E1FF", +"9 c #DBDBFF", +": c #D5D3FF", +"; c #CDCDFF", +"< c #C8C6FF", +"= c #C1C1FF", +"> c #9F9DDB", +"? c #30303B", +"@ c #7A7A96", +"A c #D2D0FF", +"B c #5A5981", +"C c #20202F", +"D c #C8C8FF", +"E c #C0BFFF", +"F c #5C5C82", +"G c #B8B8FF", +"H c #56557D", +"I c #9493D6", +"J c #1D1D2C", +" ", +"##$$$$$$$$$$$$%%", +"&##$$$$$$'$$$$%%", +" (((((()*+*, ---", +" !.0.!! ", +" !0! ", +" ! !1! ! ", +" 2.!!!3!!!45 ", +" !+61789:;<=>!", +" ?@!!!A!!!BC ", +" ! !D! !! ", +" ! !E! ! ", +" !FGH!! ", +" CIJ! ", +" ! ", +" "}; \ No newline at end of file diff --git a/pcbnew/bitmaps/Move_Track_Segment.xpm b/pcbnew/bitmaps/Move_Track_Segment.xpm new file mode 100644 index 0000000000..a71f948822 --- /dev/null +++ b/pcbnew/bitmaps/Move_Track_Segment.xpm @@ -0,0 +1,60 @@ +/* XPM */ +static const char * move_track_segment_xpm[] = { +"16 16 41 1", +" c None", +"! c black", +"# c #007C28", +"$ c #009B00", +"% c #3CBA00", +"& c #287C00", +"' c #0D0D1E", +"( c #9B9B9B", +") c #565656", +"* c #32323E", +"+ c #DCDCEF", +", c #4A4A4A", +"- c #D2D2D2", +". c #84849B", +"0 c white", +"1 c #F1F1FF", +"2 c #31313D", +"3 c #E7E5FF", +"4 c #646489", +"5 c #232332", +"6 c #FBFBFF", +"7 c #EAEAFF", +"8 c #E2E1FF", +"9 c #DBDBFF", +": c #D5D3FF", +"; c #CDCDFF", +"< c #C8C6FF", +"= c #C1C1FF", +"> c #9F9DDB", +"? c #30303B", +"@ c #7A7A96", +"A c #D2D0FF", +"B c #5A5981", +"C c #20202F", +"D c #C8C8FF", +"E c #C0BFFF", +"F c #5C5C82", +"G c #B8B8FF", +"H c #56557D", +"I c #9493D6", +"J c #1D1D2C", +" ", +"##$$$$$$$$$$$$%%", +"&##$$$$$$'$$$$%%", +" (((((()*+*, ---", +" !.0.!! ", +" !0! ", +" ! !1! ! ", +" 2.!!!3!!!45 ", +" !+61789:;<=>!", +" ?@!!!A!!!BC ", +" ! !D! !! ", +" ! !E! ! ", +" !FGH!! ", +" CIJ! ", +" ! ", +" "}; diff --git a/pcbnew/class_cotation.cpp b/pcbnew/class_cotation.cpp index c782c8c091..1cfd0ac5a0 100644 --- a/pcbnew/class_cotation.cpp +++ b/pcbnew/class_cotation.cpp @@ -293,58 +293,29 @@ int zoom = panel->GetScreen()->GetZoom(); switch( typeaff ) { case FILAIRE: - GRLine(&panel->m_ClipBox, DC, - Barre_ox - ox, Barre_oy - oy, - Barre_fx - ox, Barre_fy- oy, gcolor); - GRLine(&panel->m_ClipBox, DC, - TraitG_ox - ox, TraitG_oy - oy, - TraitG_fx - ox, TraitG_fy- oy, gcolor); - GRLine(&panel->m_ClipBox, DC, - TraitD_ox - ox, TraitD_oy - oy, - TraitD_fx - ox, TraitD_fy- oy, gcolor); - GRLine(&panel->m_ClipBox, DC, - FlecheD1_ox - ox, FlecheD1_oy - oy, - FlecheD1_fx - ox, FlecheD1_fy- oy, gcolor); - GRLine(&panel->m_ClipBox, DC, - FlecheD2_ox - ox, FlecheD2_oy - oy, - FlecheD2_fx - ox, FlecheD2_fy- oy, gcolor); - GRLine(&panel->m_ClipBox, DC, - FlecheG1_ox - ox, FlecheG1_oy - oy, - FlecheG1_fx - ox, FlecheG1_fy- oy, gcolor); - GRLine(&panel->m_ClipBox, DC, - FlecheG2_ox - ox, FlecheG2_oy - oy, - FlecheG2_fx - ox, FlecheG2_fy- oy, gcolor); - break; - + width = 0; case FILLED: - GRFillCSegm(&panel->m_ClipBox, DC, + GRLine(&panel->m_ClipBox, DC, Barre_ox - ox, Barre_oy - oy, - Barre_fx - ox, Barre_fy- oy, - width, gcolor); - GRFillCSegm(&panel->m_ClipBox, DC, + Barre_fx - ox, Barre_fy- oy, width, gcolor); + GRLine(&panel->m_ClipBox, DC, TraitG_ox - ox, TraitG_oy - oy, - TraitG_fx - ox, TraitG_fy- oy, - width, gcolor); - GRFillCSegm(&panel->m_ClipBox, DC, + TraitG_fx - ox, TraitG_fy- oy, width, gcolor); + GRLine(&panel->m_ClipBox, DC, TraitD_ox - ox, TraitD_oy - oy, - TraitD_fx - ox, TraitD_fy- oy, - width, gcolor); - GRFillCSegm(&panel->m_ClipBox, DC, + TraitD_fx - ox, TraitD_fy- oy, width, gcolor); + GRLine(&panel->m_ClipBox, DC, FlecheD1_ox - ox, FlecheD1_oy - oy, - FlecheD1_fx - ox, FlecheD1_fy- oy, - width, gcolor); - GRFillCSegm(&panel->m_ClipBox, DC, + FlecheD1_fx - ox, FlecheD1_fy- oy, width, gcolor); + GRLine(&panel->m_ClipBox, DC, FlecheD2_ox - ox, FlecheD2_oy - oy, - FlecheD2_fx - ox, FlecheD2_fy- oy, - width, gcolor); - GRFillCSegm(&panel->m_ClipBox, DC, + FlecheD2_fx - ox, FlecheD2_fy- oy, width, gcolor); + GRLine(&panel->m_ClipBox, DC, FlecheG1_ox - ox, FlecheG1_oy - oy, - FlecheG1_fx - ox, FlecheG1_fy- oy, - width, gcolor); - GRFillCSegm(&panel->m_ClipBox, DC, + FlecheG1_fx - ox, FlecheG1_fy- oy, width, gcolor); + GRLine(&panel->m_ClipBox, DC, FlecheG2_ox - ox, FlecheG2_oy - oy, - FlecheG2_fx - ox, FlecheG2_fy- oy, - width, gcolor); + FlecheG2_fx - ox, FlecheG2_fy- oy, width, gcolor); break; case SKETCH: diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 35d4e6f16e..a46c49f9a0 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -73,21 +73,23 @@ void EDGE_MODULE:: Copy(EDGE_MODULE * source) // copy structure } +/********************************/ void EDGE_MODULE::UnLink( void ) +/********************************/ { /* Modification du chainage arriere */ if( Pback ) - { + { if( Pback->m_StructType != TYPEMODULE) - { + { Pback->Pnext = Pnext; - } + } else /* Le chainage arriere pointe sur la structure "Pere" */ - { + { ((MODULE*) Pback)->m_Drawings = Pnext; - } } + } /* Modification du chainage avant */ if( Pnext) Pnext->Pback = Pback; @@ -105,14 +107,14 @@ MODULE * Module = (MODULE*) m_Parent; m_End = m_End0; if ( Module ) - { + { RotatePoint( &m_Start.x, &m_Start.y, Module->m_Orient); RotatePoint( &m_End.x, &m_End.y, Module->m_Orient); m_Start.x += Module->m_Pos.x; m_Start.y += Module->m_Pos.y; m_End.x += Module->m_Pos.x; m_End.y += Module->m_Pos.y; - } + } } @@ -159,17 +161,22 @@ MODULE * Module = NULL; GRSetDrawMode(DC, draw_mode); typeaff = frame->m_DisplayModEdge; if( m_Layer <= CMP_N ) + { typeaff = frame->m_DisplayPcbTrackFill; + if ( ! typeaff ) typeaff = SKETCH; + } if( (m_Width /zoom) < L_MIN_DESSIN ) typeaff = FILAIRE; switch (type_trace ) { case S_SEGMENT: if( typeaff == FILAIRE) - GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, color); - else Affiche_1_Segment(panel, DC, ux0,uy0,dx,dy,m_Width, - typeaff,color); - break ; + GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color); + else if( typeaff == FILLED) + GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color) ; + else // SKETCH Mode + GRCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color) ; + break ; case S_CIRCLE: rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) ); @@ -183,7 +190,7 @@ MODULE * Module = NULL; { GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, m_Width, color); } - else + else // SKETCH Mode { GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon + (m_Width/2), color) ; GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon - (m_Width/2), color) ; @@ -205,7 +212,7 @@ MODULE * Module = NULL; GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, m_Width, color); } - else + else // SKETCH Mode { GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon + (m_Width/2), color) ; @@ -236,7 +243,7 @@ MODULE * Module = NULL; *ptr = x; ptr++; *ptr = y; ptr++; } GRPoly(&panel->m_ClipBox, DC, m_PolyCount, ptr_base, - TRUE, color, color); + TRUE, m_Width, color, color); free ( ptr_base); break; } diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index e45d414ca9..cb2ba3bd7e 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -139,10 +139,7 @@ int zoom; switch( typeaff ) { case FILAIRE: - GRCircle(&panel->m_ClipBox, DC, ox, oy, rayon, gcolor) ; - break; - - default: + width = 0; case FILLED: GRCircle(&panel->m_ClipBox, DC, ox, oy, rayon, width, gcolor); break; @@ -168,19 +165,11 @@ int zoom; switch( typeaff ) { case FILAIRE: - GRLine(&panel->m_ClipBox, DC, ox - dx1, oy - dy1, - ox + dx1, oy + dy1, gcolor); - GRLine(&panel->m_ClipBox, DC, ox - dx2, oy - dy2, - ox + dx2, oy + dy2, gcolor); - break; - case FILLED: - GRFillCSegm(&panel->m_ClipBox, DC, ox - dx1, oy - dy1, - ox + dx1, oy + dy1, - width, gcolor); - GRFillCSegm(&panel->m_ClipBox, DC, ox - dx2, oy - dy2, - ox + dx2, oy + dy2, - width, gcolor); + GRLine(&panel->m_ClipBox, DC, ox - dx1, oy - dy1, + ox + dx1, oy + dy1, width, gcolor); + GRLine(&panel->m_ClipBox, DC, ox - dx2, oy - dy2, + ox + dx2, oy + dy2, width, gcolor); break; case SKETCH: diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 40cf7a874f..c3a24f338b 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -43,11 +43,11 @@ int anchor_size = dim_ancre * zoom; GRLine(&panel->m_ClipBox, DC, m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y, m_Pos.x -offset.x + anchor_size,m_Pos.y - offset.y, - g_AnchorColor); + 0, g_AnchorColor); GRLine(&panel->m_ClipBox, DC, m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size , m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size , - g_AnchorColor); + 0, g_AnchorColor); } } @@ -544,21 +544,21 @@ Struct3D_Master * Struct3D = m_3D_Drawings; } case 'S': // Scale - sscanf( from_point(text),"%lf %lf %lf\n", + sscanf( text,"%lf %lf %lf\n", &Struct3D->m_MatScale.x, &Struct3D->m_MatScale.y, &Struct3D->m_MatScale.z); break; case 'O': // Offset - sscanf( from_point(text),"%lf %lf %lf\n", + sscanf( text,"%lf %lf %lf\n", &Struct3D->m_MatPosition.x, &Struct3D->m_MatPosition.y, &Struct3D->m_MatPosition.z); break; case 'R': // Rotation - sscanf( from_point(text),"%lf %lf %lf\n", + sscanf( text,"%lf %lf %lf\n", &Struct3D->m_MatRotation.x, &Struct3D->m_MatRotation.y, &Struct3D->m_MatRotation.z); diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 1f704222e7..0eec689a10 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -311,12 +311,12 @@ wxPoint shape_pos; { case CIRCLE : if ( fillpad) - GRFilledCircle(&panel->m_ClipBox, DC, xc, yc, dx, color, color); - else GRCircle(&panel->m_ClipBox, DC, xc, yc, dx, color); + GRFilledCircle(&panel->m_ClipBox, DC, xc, yc, dx, 0, color, color); + else GRCircle(&panel->m_ClipBox, DC, xc, yc, dx, 0, color); if(DisplayIsol) { - GRCircle(&panel->m_ClipBox, DC, xc, yc, dx + g_DesignSettings.m_TrackClearence, color ); + GRCircle(&panel->m_ClipBox, DC, xc, yc, dx + g_DesignSettings.m_TrackClearence, 0, color ); } break; @@ -431,8 +431,8 @@ wxPoint shape_pos; switch ( m_DrillShape ) { case CIRCLE: - if( (hole/zoom) > 1 ) /* C.a.d si le diametre est suffisant */ - GRFilledCircle(&panel->m_ClipBox, DC, cx0, cy0, hole, color, color); + if( (hole/zoom) > 1 ) /* draw hole if its size is enought */ + GRFilledCircle(&panel->m_ClipBox, DC, cx0, cy0, hole, 0, color, color); break; case OVALE: @@ -469,11 +469,11 @@ wxPoint shape_pos; int nc_color = BLUE; if(m_Masque_Layer & CMP_LAYER) /* Trace forme \ */ GRLine(&panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0, - cx0 + dx0, cy0 + dx0, nc_color ); + cx0 + dx0, cy0 + dx0, 0, nc_color ); if(m_Masque_Layer & CUIVRE_LAYER) /* Trace forme / */ GRLine(&panel->m_ClipBox, DC, cx0 + dx0, cy0 - dx0, - cx0 - dx0, cy0 + dx0, nc_color ); + cx0 - dx0, cy0 + dx0, 0, nc_color ); } /* Trace de la reference */ if( ! frame->m_DisplayPadNum) return; @@ -509,7 +509,7 @@ $EndPAD { char Line[1024], BufLine[1024], BufCar[256]; char * PtLine; -int nn, ll, dx, dy, drill_shape; +int nn, ll, dx, dy; while( GetLine(File, Line, LineNum ) != NULL ) { @@ -558,14 +558,14 @@ int nn, ll, dx, dy, drill_shape; break; case 'D': - drill_shape = 0; - nn = sscanf(PtLine,"%d %d %d %c %d %d", &m_Drill.x, - &m_Offset.x, &m_Offset.y, &drill_shape, &dx, &dy ); + BufCar[0] = 0; + nn = sscanf(PtLine,"%d %d %d %s %d %d", &m_Drill.x, + &m_Offset.x, &m_Offset.y, BufCar, &dx, &dy ); m_Drill.y = m_Drill.x; m_DrillShape = CIRCLE; if (nn >= 6 ) // Drill shape = OVAL ? { - if (drill_shape == 'O' ) + if (BufCar[0] == 'O' ) { m_Drill.x = dx; m_Drill.y = dy; m_DrillShape = OVALE; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index cdb5e1d41f..1cc692504f 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -221,10 +221,10 @@ MODULE * Module = (MODULE *) m_Parent; int anchor_size = 2*zoom; GRLine(&panel->m_ClipBox, DC, pos.x - anchor_size, pos.y, - pos.x + anchor_size, pos.y, g_AnchorColor); + pos.x + anchor_size, pos.y, 0, g_AnchorColor); GRLine(&panel->m_ClipBox, DC, pos.x, pos.y - anchor_size, - pos.x, pos.y + anchor_size, g_AnchorColor); + pos.x, pos.y + anchor_size, 0, g_AnchorColor); } color = g_DesignSettings.m_LayerColor[Module->m_Layer]; diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 1e3d7eaf86..eaa0f4e8dd 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -534,7 +534,7 @@ int curr_layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer; if ( (l_piste/zoom) < L_MIN_DESSIN) { GRLine(&panel->m_ClipBox, DC, m_Start.x, m_Start.y, - m_End.x, m_End.y, color); + m_End.x, m_End.y, 0, color); return; } diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index cc52ab5a9d..d0edb526c3 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -33,7 +33,7 @@ char *idcmd, * text; WinEDA_PcbFrame * frame = EDA_Appl->m_PcbFrame; strncpy(Line, cmdline, sizeof(Line) -1 ); - frame->Affiche_Message( CONV_FROM_UTF8(Line)); + msg = CONV_FROM_UTF8(Line); idcmd = strtok(Line," \n\r"); text = strtok(NULL," \n\r"); @@ -45,7 +45,7 @@ WinEDA_PcbFrame * frame = EDA_Appl->m_PcbFrame; msg = CONV_FROM_UTF8(text); Module = ReturnModule(frame->m_Pcb, msg); msg.Printf(_("Locate module %s %s"),msg.GetData(), Module ? wxT("Ok") : wxT("not found")); - frame->SetStatusText(msg); + frame->Affiche_Message(msg); if ( Module ) { wxClientDC dc(frame->DrawPanel); @@ -97,9 +97,17 @@ wxClientDC dc(frame->DrawPanel); /***********************************************************************/ EDA_BaseStruct * WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay(void) -/***********************************************************************/ -{ - return Locate(CURSEUR_OFF_GRILLE); +/***********************************************************************/ +/* Search an item under the mouse cursor. + items are searched first on the current working layer. + if nothing found, an item will be searched without layer restriction +*/ +{ +EDA_BaseStruct * item; + item = Locate(CURSEUR_OFF_GRILLE, GetScreen()->m_Active_Layer); + if ( item == NULL ) + item = Locate(CURSEUR_OFF_GRILLE, -1); + return item; } diff --git a/pcbnew/copy_track.cpp b/pcbnew/copy_track.cpp new file mode 100644 index 0000000000..db75dda500 --- /dev/null +++ b/pcbnew/copy_track.cpp @@ -0,0 +1,287 @@ + /*******************************************/ + /* Track editing: routines to copy tracks */ + /*******************************************/ + +#include "fctsys.h" +#include "gr_basic.h" + +#include "common.h" +#include "pcbnew.h" +#include "autorout.h" + +#include "drag.h" + +#include "protos.h" + + +/* local functions */ + + +/* variables locales */ + + +#if 0 + +/***************************************************************/ +void WinEDA_PcbFrame::Place_Dupl_Track(Track * Track, wxDC * DC) +/***************************************************************/ +/* + Routine de placement d'une piste (succession de segments) +*/ +{ +D_PAD * pt_pad; +TRACK * pt_track, *Track, * pt_classe, *NextS; +int masquelayer; +EDA_BaseStruct * LockPoint; +int ii, old_net_code, new_net_code, DRC_error = 0; +wxDC * DC = Cmd->DC; + + ActiveDrawPanel->ManageCurseur = NULL; + + if( NewTrack == NULL ) return ; + + old_net_code = NewTrack->net_code; + + /* Placement du flag BUSY de la piste originelle, qui ne doit + pas etre vue dans les recherches de raccordement suivantes */ + ii = NbPtNewTrack; pt_track = NewTrack; + for ( ; ii > 0; ii --, pt_track = (TRACK*) pt_track->Pnext) + { + pt_track->SetState(BUSY, ON); + } + + /* Detection du nouveau net_code */ + ii = NbPtNewTrack; pt_track = NewTrack; + for ( ; ii > 0; ii --, pt_track = (TRACK*) pt_track->Pnext) + { + pt_track->net_code = 0; + } + + new_net_code = 0; + ii = 0; pt_track = NewTrack; + for( ; ii < NbPtNewTrack ; ii++, pt_track = (TRACK*)pt_track->Pnext) + { + /* Localisation de la pastille ou segment en debut de segment: */ + masquelayer = tab_layer[pt_track->Layer]; + LockPoint = LocateLockPoint(pt_track->m_Start.x,pt_track->m_Start.y,masquelayer); + if( LockPoint ) + { + if ( LockPoint->m_StructType == TYPEPAD ) + { + pt_pad = (D_PAD*) LockPoint; + new_net_code = pt_pad->net_code; + if ( new_net_code > 0 ) break; + } + else /* debut de piste sur un segment de piste */ + { + Track = (TRACK *) LockPoint; + new_net_code = Track->net_code; + if ( new_net_code > 0 ) break; + } + } + LockPoint = LocateLockPoint(pt_track->m_End.x,pt_track->m_End.y,masquelayer); + if( LockPoint ) + { + if ( LockPoint->m_StructType == TYPEPAD ) + { + pt_pad = (D_PAD*) LockPoint; + new_net_code = pt_pad->net_code; + if ( new_net_code > 0 ) break; + } + else /* debut de piste sur un segment de piste */ + { + Track = (TRACK *) LockPoint; + new_net_code = Track->net_code; + if ( new_net_code > 0 ) break; + } + } + } + + /* Mise a jour du nouveau net code de la piste */ + ii = 0; pt_track = NewTrack; + for( ; ii < NbPtNewTrack; ii++, pt_track = (TRACK*)pt_track->Pnext) + { + pt_track->net_code = new_net_code; + } + + /* Controle DRC de la nouvelle piste */ + ii = 0; pt_track = NewTrack; + for( ; ii < NbPtNewTrack; ii++, pt_track = pt_track->Next() ) + { + if( Drc_On == RUN ) + if( drc(DC, pt_track, pt_pcb->Track, 1) == BAD_DRC ) + { + if( confirmation(" Erreur DRC, Place piste:") == YES ) continue; + else { DRC_error = 1; break; } + } + } + + if( DRC_error == 0) + { + if(FlagState == MOVE_ROUTE) + { + /* copie nouvelle piste */ + pt_track = NewTrack; + NewTrack = pt_track->Copy(NbPtNewTrack); + /* effacement ancienne ( chainage et liens mauvais */ + ii = NbPtNewTrack; + for ( ; ii > 0; ii --, pt_track = NextS) + { + NextS = (TRACK*) pt_track->Pnext; + DeleteStructure(pt_track); + } + test_1_net_connexion(DC, old_net_code ); + } + + pt_classe = NewTrack->GetBestInsertPoint(); + NewTrack->Insert(pt_classe); + + Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_OR) ; + + /* Mise a jour des connexions sur pads et sur pistes */ + ii = 0; pt_track = NewTrack; + for( ; ii < NbPtNewTrack; ii++, pt_track = NextS) + { + NextS = (TRACK*)pt_track->Pnext; + pt_track->SetState(BEGIN_ONPAD|END_ONPAD, OFF); + masquelayer = tab_layer[pt_track->Layer]; + + /* Localisation de la pastille ou segment sur debut segment: */ + LockPoint = LocateLockPoint(pt_track->m_Start.x,pt_track->m_Start.y,masquelayer); + if( LockPoint ) + { + pt_track->start = LockPoint; + if ( LockPoint->m_StructType == TYPEPAD ) + { /* fin de piste sur un pad */ + pt_pad = (D_PAD*) LockPoint; + pt_track->SetState(BEGIN_ONPAD, ON); + } + else /* debut de piste sur un segment de piste */ + { + Track = (TRACK *) LockPoint; + CreateLockPoint(&pt_track->m_Start.x,&pt_track->m_Start.y,Track,pt_track); + } + } + + /* Localisation de la pastille ou segment sur fin de segment: */ + LockPoint = LocateLockPoint(pt_track->m_End.x,pt_track->m_End.y,masquelayer); + if( LockPoint ) + { + pt_track->end = LockPoint; + if ( LockPoint->m_StructType == TYPEPAD ) + { /* fin de piste sur un pad */ + pt_pad = (D_PAD*) LockPoint; + pt_track->SetState(END_ONPAD, ON); + } + else /* debut de piste sur un segment de piste */ + { + Track = (TRACK *) LockPoint; + CreateLockPoint(&pt_track->m_Start.x,&pt_track->m_Start.y,Track,pt_track); + } + } + } + + /* Clear the BUSY flag */ + ii = NbPtNewTrack; pt_track = NewTrack; + for ( ; ii > 0; ii --, pt_track = (TRACK*) pt_track->Pnext) + { + pt_track->SetState(BUSY, OFF); + } + + test_1_net_connexion(DC, new_net_code ); + ActiveScreen->SetModify(); + } + + else /* DRC error: Annulation commande */ + { + DisplayOpt.DisplayPcbTrackFill = FALSE ; + Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR); + DisplayOpt.DisplayPcbTrackFill = Track_fill_copy ; + + if(FlagState == MOVE_ROUTE) + { /* Remise en position de la piste deplacee */ + Track = NewTrack; + PosInitX -= Track->m_Start.x; PosInitY -= Track->m_Start.y; + for( ii = 0; ii < NbPtNewTrack; ii++, Track = (TRACK*) Track->Pnext) + { + if( Track == NULL ) break; + Track->m_Start.x += PosInitX; Track->m_Start.y += PosInitY; + Track->m_End.x += PosInitX; Track->m_End.y += PosInitY; + Track->SetState(BUSY,OFF); + } + Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_OR); + } + + if (FlagState == COPY_ROUTE ) + { /* Suppression copie */ + for( ii = 0; ii < NbPtNewTrack; NewTrack = NextS) + { + if(NewTrack == NULL) break; + NextS = (TRACK*) NewTrack->Pnext; + delete NewTrack; + } + } + } + NewTrack = NULL; + Affiche_Infos_Status_Pcb(Cmd); + if(Etat_Surbrillance) Hight_Light(DC); +} + +/*******************************************************************************/ +void WinEDA_PcbFrame::Start_CopyOrMove_Route(TRACK * track, wxDC * DC, bool Drag) +/*******************************************************************************/ +/* Routine permettant la recopie d'une piste (suite de segments) deja tracee +*/ +{ +int ii; +TRACK *pt_segm, *pt_track; +int masquelayer = tab_layer[ActiveScreen->Active_Layer]; + + if( NewTrack ) return; + + FlagState = (int)Cmd->Menu->param_inf; + + /* Recherche de la piste sur la couche active (non zone) */ + for(pt_segm = pt_pcb->Track; pt_segm != NULL; pt_segm = (TRACK*)pt_segm->Pnext) + { + pt_segm = Locate_Pistes(pt_segm,masquelayer, CURSEUR_OFF_GRILLE); + if( pt_segm == NULL ) break ; + break ; + } + + if( pt_segm != NULL ) + { + if (FlagState == COPY_ROUTE ) + pt_track = Marque_Une_Piste(DC, pt_segm, &NbPtNewTrack, 0); + else pt_track = Marque_Une_Piste(DC, pt_segm, &NbPtNewTrack, GR_XOR); + + if(NbPtNewTrack) /* Il y a NbPtNewTrack segments de piste a traiter */ + { + /* effacement du flag BUSY de la piste originelle */ + ii = NbPtNewTrack; pt_segm = pt_track; + for ( ; ii > 0; ii --, pt_segm = (TRACK*) pt_segm->Pnext) + { + pt_segm->SetState(BUSY, OFF); + } + + if (FlagState == COPY_ROUTE ) + NewTrack = pt_track->Copy(NbPtNewTrack); + else NewTrack = pt_track; + + Affiche_Infos_Piste(Cmd, pt_track) ; + + startX = ActiveScreen->Curseur_X; + startY = ActiveScreen->Curseur_Y; + Place_Dupl_Route_Item.State = WAIT; + ActiveDrawPanel->ManageCurseur = Show_Move_Piste; + DisplayOpt.DisplayPcbTrackFill = FALSE ; + Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR) ; + DisplayOpt.DisplayPcbTrackFill = Track_fill_copy ; + PosInitX = NewTrack->m_Start.x; PosInitY = NewTrack->m_Start.y; + } + } +} + + +#endif + diff --git a/pcbnew/drag.h b/pcbnew/drag.h index a38182194a..efc246ec35 100644 --- a/pcbnew/drag.h +++ b/pcbnew/drag.h @@ -3,6 +3,7 @@ /* fonctions de "DRAG" des segments de piste */ /***************************************************************/ +/*** Class to handle a list of track segments to drag ***/ class DRAG_SEGM { public: @@ -39,3 +40,6 @@ void Build_1_Pad_SegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, D_PAD * PtP void Collect_TrackSegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, wxPoint & point, int MasqueLayer, int net_code); void EraseDragListe(void); +void AddSegmentToDragList(WinEDA_DrawPanel * panel, wxDC * DC, + int flag, TRACK * Track); /* Add the segment"Track" to the drag list, and erase it from screen + flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT */ diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 813da6c6f0..897c3a6e9e 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -43,7 +43,7 @@ void DRAG_SEGM::SetInitialValues(void) /*******************************************************************/ void Dessine_Segments_Dragges(WinEDA_DrawPanel * panel, wxDC * DC) /*******************************************************************/ -/* trace les segments dragges en mode EDIT */ +/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */ { D_PAD* pt_pad; TRACK * Track; @@ -53,7 +53,7 @@ DRAG_SEGM * pt_drag; pt_drag = g_DragSegmentList; for( ; pt_drag; pt_drag = pt_drag->Pnext) - { + { int px, py; Track = pt_drag->m_Segm; @@ -62,20 +62,20 @@ DRAG_SEGM * pt_drag; pt_pad = pt_drag->m_Pad_Start; if( pt_pad) - { + { px = pt_pad->m_Pos.x - g_Offset_Module.x; py = pt_pad->m_Pos.y - g_Offset_Module.y; Track->m_Start.x = px; Track->m_Start.y = py; - } + } pt_pad = pt_drag->m_Pad_End; if( pt_pad) - { + { px = pt_pad->m_Pos.x - g_Offset_Module.x; py = pt_pad->m_Pos.y - g_Offset_Module.y; Track->m_End.x = px; Track->m_End.y = py; - } - Track->Draw(panel, DC, GR_XOR); } + Track->Draw(panel, DC, GR_XOR); + } } @@ -111,40 +111,52 @@ void Build_1_Pad_SegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, D_PAD * PtP TRACK * Track; DRAG_SEGM * pt_drag; int net_code = PtPad->m_NetCode; -int pX, pY, MasqueLayer; +int MasqueLayer; +wxPoint pos; BOARD * pcb = ((WinEDA_BasePcbFrame*)(panel->m_Parent))->m_Pcb; Track = pcb->m_Track->GetStartNetCode(net_code); - pX = PtPad->m_Pos.x; pY = PtPad->m_Pos.y; + pos = PtPad->m_Pos; MasqueLayer = PtPad->m_Masque_Layer; for( ; Track != NULL; Track = (TRACK*)Track->Pnext ) { if( Track->m_NetCode != net_code ) break; /* hors zone */ if( (MasqueLayer & Track->ReturnMaskLayer()) == 0 ) continue; /* couches differentes */ - if( (pX == Track->m_Start.x) && (pY == Track->m_Start.y) ) + if( pos == Track->m_Start ) { - pt_drag = new DRAG_SEGM(Track); - pt_drag->Pnext = g_DragSegmentList; - g_DragSegmentList = pt_drag; - pt_drag->m_Pad_Start = PtPad; - Track->Draw(panel, DC, GR_XOR); - Track->SetState(EDIT,ON); - Track->Draw(panel, DC, GR_XOR); + AddSegmentToDragList(panel, DC, STARTPOINT, Track); + g_DragSegmentList->m_Pad_Start = PtPad; } - if( (pX == Track->m_End.x) && (pY == Track->m_End.y) ) + if( pos == Track->m_End ) { - pt_drag = new DRAG_SEGM(Track); - pt_drag->Pnext = g_DragSegmentList; - g_DragSegmentList = pt_drag; - pt_drag->m_Pad_End = PtPad; - Track->Draw(panel, DC, GR_XOR); - Track->SetState(EDIT,ON); - Track->Draw(panel, DC, GR_XOR); + AddSegmentToDragList(panel, DC, ENDPOINT, Track); + g_DragSegmentList->m_Pad_End = PtPad; } } } +/******************************************************************/ +void AddSegmentToDragList(WinEDA_DrawPanel * panel, wxDC * DC, + int flag, TRACK * Track) +/******************************************************************/ +/* Add the segment"Track" to the drag list, and erase it from screen + flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT +*/ +{ +DRAG_SEGM * pt_drag; + + pt_drag = new DRAG_SEGM(Track); + pt_drag->Pnext = g_DragSegmentList; + g_DragSegmentList = pt_drag; + if ( (flag & STARTPOINT) ) pt_drag->m_Flag |= 1; + if ( (flag & ENDPOINT) ) pt_drag->m_Flag |= 2; + Track->Draw(panel, DC, GR_XOR); + Track->SetState(EDIT,ON); + if ( (flag & STARTPOINT) ) Track->m_Flags |= STARTPOINT; + if ( (flag & ENDPOINT) ) Track->m_Flags |= ENDPOINT; + Track->Draw(panel, DC, GR_XOR); +} /**********************************************************************************/ void Collect_TrackSegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, @@ -155,39 +167,22 @@ void Collect_TrackSegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, */ { TRACK * Track; -DRAG_SEGM * pt_drag; -int pX, pY; BOARD * pcb = ((WinEDA_BasePcbFrame*)(panel->m_Parent))->m_Pcb; Track = pcb->m_Track->GetStartNetCode(net_code); - pX = point.x; pY = point.y; for( ; Track != NULL; Track = (TRACK*)Track->Pnext ) { if( Track->m_NetCode != net_code ) break; /* hors zone */ if( (MasqueLayer & Track->ReturnMaskLayer()) == 0 ) continue; /* couches differentes */ if ( Track->m_Flags & IS_DRAGGED) continue; // already in list - if( (pX == Track->m_Start.x) && (pY == Track->m_Start.y) ) + if( Track->m_Start == point ) { - pt_drag = new DRAG_SEGM(Track); - pt_drag->Pnext = g_DragSegmentList; - g_DragSegmentList = pt_drag; - pt_drag->m_Flag |= 1; - Track->Draw(panel, DC, GR_XOR); - Track->SetState(EDIT,ON); - Track->m_Flags |= STARTPOINT; - Track->Draw(panel, DC, GR_XOR); + AddSegmentToDragList(panel, DC, STARTPOINT, Track); } - if( (pX == Track->m_End.x) && (pY == Track->m_End.y) ) + if( Track->m_End == point ) { - pt_drag = new DRAG_SEGM(Track); - pt_drag->Pnext = g_DragSegmentList; - g_DragSegmentList = pt_drag; - pt_drag->m_Flag |= 2; - Track->m_Flags |= ENDPOINT; - Track->Draw(panel, DC, GR_XOR); - Track->SetState(EDIT,ON); - Track->Draw(panel, DC, GR_XOR); + AddSegmentToDragList(panel, DC, ENDPOINT, Track); } } } diff --git a/pcbnew/dupltrac.cpp b/pcbnew/dupltrac.cpp index 0168e139b0..71a26c0afb 100644 --- a/pcbnew/dupltrac.cpp +++ b/pcbnew/dupltrac.cpp @@ -54,7 +54,7 @@ wxDC * DC = Cmd->DC; if( NewTrack ) { /* Effacement du trace en cours */ - DisplayOpt.DisplayPcbTrackFill = SKETCH ; + DisplayOpt.DisplayPcbTrackFill = FALSE ; Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR); DisplayOpt.DisplayPcbTrackFill = Track_fill_copy ; @@ -266,7 +266,7 @@ wxDC * DC = Cmd->DC; else /* Erreur DRC: Annulation commande */ { - DisplayOpt.DisplayPcbTrackFill = SKETCH ; + DisplayOpt.DisplayPcbTrackFill = FALSE ; Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR); DisplayOpt.DisplayPcbTrackFill = Track_fill_copy ; @@ -313,13 +313,13 @@ TRACK * ptsegm; /* efface ancienne position si elle a ete deja dessinee */ if( (flag == CURSEUR_MOVED ) && (FlagState == COPY_ROUTE ) ) { - DisplayOpt.DisplayPcbTrackFill = SKETCH ; + DisplayOpt.DisplayPcbTrackFill = FALSE ; Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR) ; } if( FlagState == MOVE_ROUTE ) { - if( flag == CURSEUR_MOVED) DisplayOpt.DisplayPcbTrackFill = SKETCH ; + if( flag == CURSEUR_MOVED) DisplayOpt.DisplayPcbTrackFill = FALSE ; Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR) ; } @@ -336,7 +336,7 @@ TRACK * ptsegm; } /* dessin de la nouvelle piste */ - DisplayOpt.DisplayPcbTrackFill = SKETCH ; + DisplayOpt.DisplayPcbTrackFill = FALSE ; Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR) ; DisplayOpt.DisplayPcbTrackFill = Track_fill_copy ; } @@ -392,7 +392,7 @@ wxDC * DC = Cmd->DC; startY = ActiveScreen->Curseur_Y; Place_Dupl_Route_Item.State = WAIT; ActiveDrawPanel->ManageCurseur = Show_Move_Piste; - DisplayOpt.DisplayPcbTrackFill = SKETCH ; + DisplayOpt.DisplayPcbTrackFill = FALSE ; Trace_Une_Piste(DC, NewTrack,NbPtNewTrack,GR_XOR) ; DisplayOpt.DisplayPcbTrackFill = Track_fill_copy ; PosInitX = NewTrack->m_Start.x; PosInitY = NewTrack->m_Start.y; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index f25bca1e8f..1b932d7730 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -374,6 +374,9 @@ int itmp; case ID_POPUP_PCB_SELECT_VIASIZE7: case ID_POPUP_PCB_SELECT_VIASIZE8: case ID_POPUP_PCB_MOVE_TRACK_NODE: + case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: + case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: + case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE: case ID_POPUP_PCB_BREAK_TRACK: case ID_POPUP_PCB_EDIT_NET: @@ -735,6 +738,15 @@ int itmp; StartMove_Module( (MODULE*)CURRENT_ITEM, &dc); break; + case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */ + CURRENT_ITEM = GetModuleByName(); + if ( CURRENT_ITEM ) + { + DrawPanel->MouseToCursorSchema(); + StartMove_Module( (MODULE*)CURRENT_ITEM, &dc); + } + break; + case ID_POPUP_PCB_DELETE_MODULE: DrawPanel->MouseToCursorSchema(); // If the current Item is a pad, text module ...: Get the parent @@ -1037,12 +1049,25 @@ int itmp; Via_Edit_Control(&dc, id, (SEGVIA *) GetScreen()->m_CurrentItem); break; + case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: + DrawPanel->MouseToCursorSchema(); + Start_MoveOneNodeOrSegment((TRACK *) GetScreen()->m_CurrentItem, + &dc, id); + break; + + case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_MOVE_TRACK_NODE: DrawPanel->MouseToCursorSchema(); - Start_MoveOneTrackSegment((TRACK *) GetScreen()->m_CurrentItem, - &dc, TRUE); + Start_MoveOneNodeOrSegment((TRACK *) GetScreen()->m_CurrentItem, + &dc, id); break; + case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: + DrawPanel->MouseToCursorSchema(); + Start_DragTrackSegmentAndKeepSlope((TRACK *) GetScreen()->m_CurrentItem, + &dc); + break; + case ID_POPUP_PCB_BREAK_TRACK: DrawPanel->MouseToCursorSchema(); { diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 33038bd616..8e33ad1165 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -303,7 +303,8 @@ MODULE * Module = NULL; GRLine( &DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x, pt_chevelu->pad_start->m_Pos.y, pt_chevelu->pad_end->m_Pos.x, - pt_chevelu->pad_end->m_Pos.y, + pt_chevelu->pad_end->m_Pos.y, + 0, g_DesignSettings.m_RatsnestColor); } } @@ -335,7 +336,8 @@ MODULE * Module = NULL; GRLine(&DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x, pt_chevelu->pad_start->m_Pos.y, pt_chevelu->pad_end->m_Pos.x, - pt_chevelu->pad_end->m_Pos.y, + pt_chevelu->pad_end->m_Pos.y, + 0, g_DesignSettings.m_RatsnestColor); } } diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index 04549bf3cf..27fe407a8c 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -97,6 +97,9 @@ FILE * LayerCu = NULL, *LayerCmp = NULL; } } + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); + /* Affichage du bilan : */ MsgPanel->EraseMsgBox(); Affiche_1_Parametre(this,0,_("Component side place file:"),NameLayerCmp,BLUE); @@ -173,8 +176,6 @@ FILE * LayerCu = NULL, *LayerCmp = NULL; (float) module_pos.x * conv_unit, (float) module_pos.y * conv_unit, (float) Liste[ii].m_Module->m_Orient / 10); - // compensation bug francisation printf (float x.y généré x,y) - to_point(text); if (Liste[ii].m_Module->m_Layer == CMP_N) { @@ -198,6 +199,7 @@ FILE * LayerCu = NULL, *LayerCmp = NULL; fclose(LayerCu); } MyFree(Liste); + setlocale(LC_NUMERIC, ""); // revert to the current locale msg = wxT("Cmp File: ") + NameLayerCmp; if( GenCu ) msg += wxT("\nCu File: ") + NameLayerCu; @@ -238,6 +240,9 @@ wxPoint module_pos; DisplayError(this, msg); return ; } + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); + /* Generation entete du fichier 'commentaires) */ sprintf(Line,"## Module report - date %s\n", DateAndTime(Buff) ); fputs(Line,rptfile); @@ -257,13 +262,11 @@ wxPoint module_pos; sprintf(Line,"upper_left_corner %9.6f %9.6f\n", (float) m_Pcb->m_BoundaryBox.GetX() * conv_unit, (float) m_Pcb->m_BoundaryBox.GetY() * conv_unit); - to_point(Line); fputs(Line, rptfile); sprintf(Line,"lower_right_corner %9.6f %9.6f\n", (float) (m_Pcb->m_BoundaryBox.GetRight() ) * conv_unit, (float) (m_Pcb->m_BoundaryBox.GetBottom() ) * conv_unit); - to_point(Line); fputs(Line, rptfile); fputs("$EndBOARD\n\n", rptfile); @@ -295,11 +298,9 @@ wxPoint module_pos; sprintf( Line, "position %9.6f %9.6f\n", (float) module_pos.x * conv_unit, (float) module_pos.y * conv_unit); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "orientation %.2f\n", (float) Module->m_Orient / 10); - to_point(Line); if (Module->m_Layer == CMP_N) strcat(Line,"layer component\n"); else if (Module->m_Layer == CUIVRE_N) strcat(Line,"layer copper\n"); else strcat(Line,"layer other\n"); @@ -313,27 +314,25 @@ wxPoint module_pos; sprintf( Line, "position %9.6f %9.6f\n", (float) pad->m_Pos0.x * conv_unit, (float) pad->m_Pos0.y * conv_unit); - to_point(Line); fputs(Line, rptfile); + sprintf( Line, "size %9.6f %9.6f\n", (float) pad->m_Size.x * conv_unit, (float) pad->m_Size.y * conv_unit); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "drill %9.6f\n", (float) pad->m_Drill.x * conv_unit); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "shape_offset %9.6f %9.6f\n", (float) pad->m_Offset.x * conv_unit, (float) pad->m_Offset.y * conv_unit); - to_point(Line); fputs(Line, rptfile); + sprintf( Line, "orientation %.2f\n", (float) (pad->m_Orient - Module->m_Orient) / 10); - to_point(Line); fputs(Line, rptfile); char *shape_name[6] = {"??? ","Circ","Rect","Oval","trap","spec"} ; sprintf( Line, "Shape %s\n", shape_name[pad->m_PadShape]); fputs(Line, rptfile); + int layer = 0; if(pad->m_Masque_Layer & CUIVRE_LAYER) layer = 1; if(pad->m_Masque_Layer & CMP_LAYER) layer |= 2; @@ -349,15 +348,16 @@ char *layer_name[4] = {"??? ","copper","component","all"} ; /* Write board Edges */ EDA_BaseStruct * PtStruct; for ( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext) - { + { if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) continue; if( ((DRAWSEGMENT *) PtStruct)->m_Layer != EDGE_N ) continue; WriteDrawSegmentPcb( (DRAWSEGMENT *) PtStruct, rptfile); - } + } /* Generation fin du fichier */ fputs("$EndDESCRIPTION\n", rptfile); fclose(rptfile); + setlocale(LC_NUMERIC, ""); // revert to the current locale } @@ -392,11 +392,8 @@ char Line[1024]; rayon = hypot(dx-ux0,dy-uy0); sprintf(Line,"$CIRCLE \n"); fputs(Line, rptfile); sprintf( Line, "centre %.6lf %.6lf\n", ux0, uy0); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "radius %.6lf\n", rayon); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "width %.6lf\n", width); - to_point(Line); fputs(Line, rptfile); sprintf(Line,"$EndCIRCLE \n"); fputs(Line, rptfile); break; @@ -408,13 +405,9 @@ char Line[1024]; RotatePoint(&endx, &endy, PtDrawSegment->m_Start.x, PtDrawSegment->m_Start.y,PtDrawSegment->m_Angle); sprintf(Line,"$ARC \n"); fputs(Line, rptfile); sprintf( Line, "centre %.6lf %.6lf\n", ux0, uy0); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "start %.6lf %.6lf\n", endx * conv_unit, endy * conv_unit); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "end %.6lf %.6lf\n", dx, dy); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "width %.6lf\n", width); - to_point(Line); fputs(Line, rptfile); sprintf(Line,"$EndARC \n"); fputs(Line, rptfile); } @@ -424,11 +417,8 @@ char Line[1024]; sprintf(Line,"$LINE \n"); fputs(Line, rptfile); sprintf( Line, "start %.6lf %.6lf\n", ux0, uy0); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "end %.6lf %.6lf\n", dx, dy); - to_point(Line); fputs(Line, rptfile); sprintf( Line, "width %.6lf\n", width); - to_point(Line); fputs(Line, rptfile); sprintf(Line,"$EndLINE \n"); fputs(Line, rptfile); break; diff --git a/pcbnew/gendrill.cpp b/pcbnew/gendrill.cpp index ee3a796ab7..06ca0a2f4c 100644 --- a/pcbnew/gendrill.cpp +++ b/pcbnew/gendrill.cpp @@ -88,6 +88,7 @@ enum id_drill { ID_CLOSE_DRILL, ID_SEL_DRILL_UNITS, ID_SEL_DRILL_SHEET, + ID_SEL_DRILL_REPORT, ID_SEL_ZEROS_FMT, ID_SEL_PRECISION }; @@ -96,7 +97,8 @@ class WinEDA_DrillFrame: public wxDialog { WinEDA_PcbFrame * m_Parent; - wxRadioBox * m_Choice_Drill_Plan; + wxRadioBox * m_Choice_Drill_Map; + wxRadioBox * m_Choice_Drill_Report; wxRadioBox * m_Choice_Unit; wxRadioBox * m_Choice_Drill_Offset; WinEDA_EnterText * m_EnterFileNameDrill; @@ -121,6 +123,7 @@ private: void UpdatePrecisionOptions(wxCommandEvent& event); void UpdateConfig(void); int Plot_Drill_PcbMap( FORET * buffer, int format); + void GenDrillReport(const wxString & FullFileName); int Gen_Liste_Forets( FORET * buffer,bool print_header); int Gen_Drill_File_EXCELLON( FORET * buffer); void Gen_Line_EXCELLON(char *line, float x, float y); @@ -208,13 +211,21 @@ wxString choice_drill_offset_msg[] = LeftBoxSizer->Add(m_Choice_Drill_Offset, 0, wxGROW|wxALL, 5); /* second column */ -wxString choice_drill_plan_msg[] = - {_("none"), _("drill sheet (HPGL)"), _("drill sheet (Postscript)")}; - m_Choice_Drill_Plan = new wxRadioBox(this, ID_SEL_DRILL_SHEET, +wxString choice_drill_map_msg[] = + {_("None"), _("drill sheet (HPGL)"), _("drill sheet (Postscript)")}; + m_Choice_Drill_Map = new wxRadioBox(this, ID_SEL_DRILL_SHEET, _("Drill Sheet:"), wxDefaultPosition,wxSize(-1,-1), - 3,choice_drill_plan_msg,1,wxRA_SPECIFY_COLS); - MiddleBoxSizer->Add(m_Choice_Drill_Plan, 0, wxGROW|wxALL, 5); + 3,choice_drill_map_msg,1,wxRA_SPECIFY_COLS); + MiddleBoxSizer->Add(m_Choice_Drill_Map, 0, wxGROW|wxALL, 5); + +wxString choice_drill_report_msg[] = + {_("None"), _("Drill report") }; + m_Choice_Drill_Report = new wxRadioBox(this, ID_SEL_DRILL_REPORT, + _("Drill Report:"), + wxDefaultPosition,wxSize(-1,-1), + 2,choice_drill_report_msg,1,wxRA_SPECIFY_COLS); + MiddleBoxSizer->Add(m_Choice_Drill_Report, 0, wxGROW|wxALL, 5); m_ViaDrillCtrl = new WinEDA_ValueCtrl(this, _("Via Drill"), g_DesignSettings.m_ViaDrill, g_UnitMetric, MiddleBoxSizer, @@ -244,10 +255,10 @@ wxString choice_drill_plan_msg[] = Button->SetForegroundColour(*wxBLUE); RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); - Centre(); - GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); + + Centre(); } @@ -389,7 +400,7 @@ wxString msg; Fin_Drill(); } - switch ( m_Choice_Drill_Plan->GetSelection() ) + switch ( m_Choice_Drill_Map->GetSelection() ) { case 0: break; case 1: @@ -400,6 +411,12 @@ wxString msg; break; } + if ( m_Choice_Drill_Report->GetSelection() > 0 ) + { + FullFileName << wxT(".rpt"); + GenDrillReport(FullFileName); + } + EndModal(0); } @@ -1371,3 +1388,60 @@ void PlotOvalDrillSymbol(const wxPoint & position,const wxSize & size,int orient break; } } + +/********************************************************************/ +void WinEDA_DrillFrame::GenDrillReport(const wxString & FullFileName) +/********************************************************************/ +/* +Create a list od drill values and drill count +*/ +{ +wxString FileName, Mask(wxT("*")), Ext(wxT(".*")); +int ii; +char line[1024]; +FORET * foret; + + FileName = FullFileName; + FileName = EDA_FileSelector(_("Drill Map file"), + wxEmptyString, /* Chemin par defaut */ + FullFileName, /* nom fichier par defaut */ + Ext, /* extension par defaut */ + Mask, /* Masque d'affichage */ + this, + wxFD_SAVE, + TRUE + ); + if ( FileName.IsEmpty()) return; + + dest = wxFopen(FileName, wxT("w") ); + if (dest == 0) + { + wxString msg = _("Unable to create file ") + FileName; + DisplayError(this, msg); + return ; + } + + sprintf(line,"Drill report\n\n" ); + fputs(line, dest); + + for(ii = 0, foret = (FORET*)adr_lowmem ; ii < DrillToolsCount; ii++, foret++) + { + int ncount; + ncount = foret->m_TotalCount - foret->m_OvalCount; + if ( ncount ) + sprintf(line,"%2.2fmm %2.3f\" (%d holes)\n", + float(foret->m_Diameter) * 0.00254, + float(foret->m_Diameter) * 0.0001, + ncount ); + if ( foret->m_OvalCount ) + { + sprintf(line,"%2.2fmm %2.3f\" (%d oblongs)\n", + float(foret->m_Diameter) * 0.00254, + float(foret->m_Diameter) * 0.0001, + foret->m_OvalCount ); + } + + fputs(line, dest); + } + +} diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index acd540df88..66514f84f4 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -112,7 +112,7 @@ wxClientDC dc(m_Parent->DrawPanel); bool WinEDA_BasePcbFrame::Clear_Pcb(wxDC * DC, bool query) /*********************************************************/ /* Realise les init des pointeurs et variables - Si Item == NULL, il n'y aura pas de confirmation + Si query == FALSE, il n'y aura pas de confirmation */ { diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 81b73cbce9..5ff5a58762 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -372,7 +372,6 @@ char Line[1024], *data; wxString msg; if ( data ) { - from_point(data); msg = CONV_FROM_UTF8(data); msg.ToDouble(&g_UserGrid.x); } @@ -380,7 +379,6 @@ char Line[1024], *data; data = strtok(NULL," =\n\r"); if ( data ) { - from_point(data); msg = CONV_FROM_UTF8(data); msg.ToDouble(&g_UserGrid.y); } @@ -508,7 +506,6 @@ int ii, jj; fprintf(File,"$SETUP\n"); sprintf(text, "InternalUnit %f INCH\n", 1.0/PCB_INTERNAL_UNIT); - to_point(text); fprintf(File, text); if ( frame->GetScreen()->m_UserGridIsON ) ii = jj = -1; @@ -523,7 +520,6 @@ int ii, jj; sprintf(text, "UserGridSize %lf %lf %s\n", frame->GetScreen()->m_UserGrid.x, frame->GetScreen()->m_UserGrid.y, ( g_UserGrid_Unit == 0 )? "INCH" : "mm"); - to_point(text); fprintf(File, text); fprintf(File, "ZoneGridSize %d\n", g_GridRoutingSize); @@ -743,6 +739,9 @@ EQUIPOT * LastEquipot = NULL, * Equipot; wxBusyCursor dummy; + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); + NbDraw = NbTrack = NbZone = NbMod = NbNets = -1; m_Pcb->m_NbNets = 0; m_Pcb->m_Status_Pcb = 0; @@ -973,12 +972,13 @@ EQUIPOT * LastEquipot = NULL, * Equipot; } } + setlocale(LC_NUMERIC, ""); // revert to the current locale + Affiche_Message(wxEmptyString); #ifdef PCBNEW Compile_Ratsnest(DC, TRUE); #endif - // Size est donnee en 1/1000 " return(1); } @@ -1009,7 +1009,8 @@ MODULE * Module; PtStruct = (EDA_BaseStruct *) m_Pcb->m_Modules; NbModules = 0; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext) NbModules++; - + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); /* Ecriture de l'entete PCB : */ fprintf(File,"PCBNEW-BOARD Version %d date %s\n\n",g_CurrentVersionPCB, DateAndTime(Line) ); @@ -1106,6 +1107,7 @@ MODULE * Module; fprintf(File,"$EndZONE\n"); fprintf(File,"$EndBOARD\n"); + setlocale(LC_NUMERIC, ""); // revert to the current locale wxEndBusyCursor(); Affiche_Message(wxEmptyString); diff --git a/pcbnew/lay2plot.cpp b/pcbnew/lay2plot.cpp index 5cdbfe3b69..191d10cd84 100644 --- a/pcbnew/lay2plot.cpp +++ b/pcbnew/lay2plot.cpp @@ -22,7 +22,7 @@ static void Plot_Module(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module, /****************************/ int GetLayerNumber(void) /****************************/ -/* retourne le nombre de couches a tracer +/* Return the number of layers which can be printed */ { int ii = 29; @@ -34,7 +34,10 @@ return ii; /**********************************************************************************/ void WinEDA_DrawPanel::PrintPage(wxDC *DC, bool Print_Sheet_Ref, int printmasklayer) /**********************************************************************************/ -/* routine de trace du pcb, avec selection des couches */ +/* Used to print the board. + Draw the board, but only layers allowed by printmasklayer + ( printmasklayer is a 32 bits mask: bit n = 1 -> layer n is printed) +*/ { MODULE * Module; EDA_BaseStruct * PtStruct; @@ -60,7 +63,7 @@ BOARD * Pcb = frame->m_Pcb; printmasklayer |= EDGE_LAYER; - /* Trace des elements particuliers de Drawings Pcb */ + /* Draw the pcb graphic items (texts, ...) */ PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { @@ -98,7 +101,7 @@ BOARD * Pcb = frame->m_Pcb; } } - /* trace des pistes */ + /* Draw the tracks */ pt_piste = Pcb->m_Track; for ( ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) { @@ -109,42 +112,43 @@ BOARD * Pcb = frame->m_Pcb; int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape]; GRSetDrawMode(DC, drawmode); GRFilledCircle(&m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y, - rayon, color, color) ; + rayon, 0, color, color) ; } else pt_piste->Draw(this, DC, drawmode); } pt_piste = Pcb->m_Zone; for ( ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) - { + { if( (printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 ) continue ; pt_piste->Draw(this, DC, drawmode); - } + } - // Trace des modules en dernier, pour imprimer en blanc le trou des pastilles + // Draw footprints, this is done at last in order to print the pad holes in while + // after the tracks Module = (MODULE*) Pcb->m_Modules; for ( ; Module != NULL; Module = (MODULE *) Module->Pnext ) - { + { Plot_Module(this, DC, Module, drawmode, printmasklayer); - } + } - /* trace des trous des vias*/ + /* draw the via holes */ pt_piste = Pcb->m_Track; int rayon = g_DesignSettings.m_ViaDrill / 2; int color = WHITE; for ( ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) - { + { if( (printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 ) continue; if ( pt_piste->m_StructType == TYPEVIA ) /* VIA rencontree */ - { + { GRSetDrawMode(DC, drawmode); GRFilledCircle(&m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y, - rayon, color, color) ; - } + rayon, 0, color, color) ; } + } if ( Print_Sheet_Ref ) - m_Parent->TraceWorkSheet( DC, ActiveScreen); + m_Parent->TraceWorkSheet( DC, ActiveScreen, 0); DisplayOpt = save_opt; frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; @@ -163,7 +167,7 @@ EDA_BaseStruct * PtStruct; TEXTE_MODULE * TextMod; int mlayer; - /* trace des pastilles */ + /* Draw pads */ pt_pad = Module->m_Pads; for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext ) { @@ -171,7 +175,7 @@ int mlayer; pt_pad->Draw(panel, DC, wxPoint(0,0), draw_mode); } - /* impression des graphismes */ + /* draw footprint graphic shapes */ PtStruct = Module->m_Drawings; mlayer = g_TabOneLayerMask[Module->m_Layer]; if( Module->m_Layer == CUIVRE_N) mlayer = SILKSCREEN_LAYER_CU; diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 420996882b..426ed4b63d 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -247,7 +247,10 @@ unsigned ii; if( Name.CmpNoCase(ComponentName) == 0 ) /* composant localise */ { NewModule = new MODULE(m_Pcb); + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + setlocale(LC_NUMERIC, "C"); NewModule->ReadDescr(lib_module, &LineNum); + setlocale(LC_NUMERIC, ""); // revert to the current locale if( Module == NULL ) /* 1er Module */ { m_Pcb->m_Modules = NewModule; @@ -279,7 +282,7 @@ unsigned ii; /***************************************************************/ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( - wxWindow * active_window, + WinEDA_DrawFrame * active_window, const wxString & Library, const wxString & Mask, const wxString & KeyWord) /***************************************************************/ diff --git a/pcbnew/locate.cpp b/pcbnew/locate.cpp index 1b31c8c8ff..11d984f069 100644 --- a/pcbnew/locate.cpp +++ b/pcbnew/locate.cpp @@ -17,16 +17,15 @@ int ux0 , uy0 ,dx, dy, spot_cX, spot_cY; /* Variables utilisees pour la localisation des segments */ /* fonctions locales */ -EDA_BaseStruct * Locate_MirePcb( EDA_BaseStruct * PtStruct, int typeloc); +EDA_BaseStruct * Locate_MirePcb( EDA_BaseStruct * PtStruct, int LayerSearch, int typeloc); /**/ /* Macro de calcul de la coord de pointage selon le curseur (ON/OFF grille) choisi -A REVOIR */ #define SET_REF_POS(ref_pos) if(typeloc == CURSEUR_ON_GRILLE) \ { ref_pos = ActiveScreen->m_Curseur;} \ - else { ref_pos = ActiveScreen->m_Curseur; } + else { ref_pos = ActiveScreen->m_MousePosition; } @@ -76,12 +75,12 @@ wxString buf; -/*********************************************************/ -EDA_BaseStruct * WinEDA_BasePcbFrame::Locate( int typeloc ) -/*********************************************************/ -/* Fonction de localisation generale - Affiche les caract de la stucture localisée et retourne un pointeur - sur celle-ci +/*******************************************************************************/ +EDA_BaseStruct * WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) +/*******************************************************************************/ +/* General locate function + Display infos relatives to the item found + return a pointer to this item ( or NULL ) */ { TEXTE_PCB * pt_texte_pcb; @@ -92,72 +91,90 @@ D_PAD* pt_pad; int masque_layer; EDA_BaseStruct * item; - pt_texte_pcb = Locate_Texte_Pcb(m_Pcb->m_Drawings, typeloc); - if(pt_texte_pcb ) // texte type PCB localise - { + pt_texte_pcb = Locate_Texte_Pcb(m_Pcb->m_Drawings, LayerSearch, typeloc); + if(pt_texte_pcb ) // a PCB text is found + { Affiche_Infos_PCB_Texte(this, pt_texte_pcb); return pt_texte_pcb; - } + } - if ( (DrawSegm = Locate_Segment_Pcb(m_Pcb, typeloc)) != NULL) - { + if ( (DrawSegm = Locate_Segment_Pcb(m_Pcb, LayerSearch, typeloc)) != NULL) + { Affiche_Infos_DrawSegment(this, DrawSegm); return DrawSegm; - } + } - if ( (item = Locate_Cotation(m_Pcb, typeloc)) != NULL) return item; + if ( (item = Locate_Cotation(m_Pcb, LayerSearch, typeloc)) != NULL) return item; - if ( (item = Locate_MirePcb(m_Pcb->m_Drawings, typeloc)) != NULL) return item; + if ( (item = Locate_MirePcb(m_Pcb->m_Drawings, LayerSearch, typeloc)) != NULL) return item; - /* Localistion des pistes et vias, avec priorite aux vias */ - masque_layer = g_TabOneLayerMask[GetScreen()->m_Active_Layer]; - Track = Locate_Pistes( m_Pcb->m_Track, NO_TST_LAYER,typeloc ); + /* Search for tracks and vias, with via priority */ + if ( LayerSearch == -1 ) masque_layer = ALL_LAYERS; + else masque_layer = g_TabOneLayerMask[LayerSearch]; + Track = Locate_Pistes( m_Pcb->m_Track, masque_layer,typeloc ); if ( Track != NULL ) - { - TrackLocate = Track ; /* Reperage d'une piste ou via */ - /* recherche de 1 via eventuelle */ + { + TrackLocate = Track ; /* a track or a via is found*/ + /* Search for a via */ while((TrackLocate = Locate_Pistes(TrackLocate, masque_layer,typeloc)) != NULL ) - { + { Track = TrackLocate; if(TrackLocate->m_StructType == TYPEVIA) break ; TrackLocate = (TRACK*) TrackLocate->Pnext; - } + } Affiche_Infos_Piste(this, Track) ; return Track; - } + } - /* Localisation des Pads */ + /* Search for Pads */ if( (pt_pad = Locate_Any_Pad(m_Pcb, typeloc)) != NULL ) - { - pt_pad->Display_Infos(this); return pt_pad; - } - - /* Localisation d'un texte sur modules */ - module = NULL; { - TEXTE_MODULE * pt_texte; - pt_texte = LocateTexteModule(m_Pcb, &module, typeloc); - if( pt_texte != NULL ) + pt_pad->Display_Infos(this); return pt_pad; + } + + /* Search for a footprint text */ + 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) { - Affiche_Infos_E_Texte(this, module, pt_texte); - return pt_texte; + TEXTE_MODULE * pt_texte; + if ( module->m_Layer != LayerSearch) continue; + pt_texte = LocateTexteModule(m_Pcb, &module, typeloc); + if( pt_texte != NULL ) + { + Affiche_Infos_E_Texte(this, module, pt_texte); + return pt_texte; + } + } + } + else // Search footprint texts on all layers + { + module = 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; + } } } - /* Recherche d'un module */ + /* Search for a footprint */ if ( (module = Locate_Prefered_Module(m_Pcb, typeloc)) != NULL) - { + { module->Display_Infos(this); return module; - } + } if( (TrackLocate = Locate_Zone((TRACK*)m_Pcb->m_Zone, GetScreen()->m_Active_Layer,typeloc)) != NULL ) - { + { Affiche_Infos_Piste(this, TrackLocate) ; return TrackLocate; - } + } MsgPanel->EraseMsgBox(); return NULL; @@ -165,7 +182,7 @@ EDA_BaseStruct * item; /*******************************************************************/ -TRACK * Locate_Via(BOARD * Pcb, const wxPoint & pos, int layer = -1) +TRACK * Locate_Via(BOARD * Pcb, const wxPoint & pos, int layer) /*******************************************************************/ /* Localise une via au point pX,pY @@ -310,13 +327,12 @@ int StAngle, EndAngle, MouseAngle; /* pour localisation d'arcs, } -/*********************************************************/ -EDA_BaseStruct * Locate_Cotation(BOARD * Pcb, int typeloc) -/*********************************************************/ -/* Localise un element de cotation, en priorite sur la couche active, - et a defaut sur les autres couches - retourne un pointeur sur l'element localise - sinon returne NULL +/*************************************************************************/ +EDA_BaseStruct * Locate_Cotation(BOARD * Pcb, int LayerSearch, int typeloc) +/*************************************************************************/ +/* Serach for a cotation item , on LayerSearch, + (if LayerSearch == -1 , no yaere restriction ) + return a pointer to the located item, or NULL */ { EDA_BaseStruct * PtStruct; @@ -329,17 +345,18 @@ int ux0, uy0; PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) - { + { if( PtStruct->m_StructType != TYPECOTATION ) continue; Cotation = (COTATION*) PtStruct; - if( Cotation->m_Layer != ((PCB_SCREEN *)ActiveScreen)->m_Active_Layer ){}; + if( (Cotation->m_Layer != LayerSearch) && (LayerSearch != -1) ) + continue; /* Localisation du texte ? */ pt_txt = Cotation->m_Text; if( pt_txt ) - { - if( pt_txt->Locate(wxPoint(spot_cX, spot_cY)) ) return(PtStruct); - } + { + if( pt_txt->Locate(ref_pos) ) return(PtStruct); + } /* Localisation des SEGMENTS ?) */ ux0 = Cotation->Barre_ox ; uy0 = Cotation->Barre_oy; @@ -397,14 +414,14 @@ int ux0, uy0; /* detection : */ if( distance( Cotation->m_Width/2 )) return( PtStruct ); - } + } return(NULL); } -/*********************************************************/ -DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int typeloc) -/*********************************************************/ +/*************************************************************************/ +DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int LayerSearch, int typeloc) +/*************************************************************************/ /* Localisation de segments de contour du type drawing Retourne: Pointeur sur DEBUT du segment localise @@ -421,9 +438,11 @@ PCB_SCREEN *screen = (PCB_SCREEN *)ActiveScreen; PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) - { + { if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) continue; pts = ( DRAWSEGMENT * ) PtStruct; + if ( (pts->m_Layer != LayerSearch) && (LayerSearch != -1) ) + continue; ux0 = pts->m_Start.x ; uy0 = pts->m_Start.y; /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ dx = pts->m_End.x - ux0 ; dy = pts->m_End.y - uy0 ; @@ -431,46 +450,46 @@ PCB_SCREEN *screen = (PCB_SCREEN *)ActiveScreen; /* detection : */ if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) ) - { + { int rayon, dist, StAngle, EndAngle, MouseAngle; rayon = (int) hypot((double)(dx),(double)(dy) ); dist = (int) hypot((double)(spot_cX),(double)(spot_cY) ); if( abs(rayon-dist) <= (pts->m_Width/2) ) - { + { if(pts->m_Shape == S_CIRCLE) - { + { if(pts->m_Layer == screen->m_Active_Layer) return( pts ) ; else if ( ! locate_segm ) locate_segm = pts; - } + } /* pour un arc, controle complementaire */ MouseAngle = (int) ArcTangente(spot_cY, spot_cX); StAngle = (int) ArcTangente(dy, dx); EndAngle = StAngle + pts->m_Angle; if( EndAngle > 3600 ) - { + { StAngle -= 3600; EndAngle -= 3600; - } + } if( (MouseAngle >= StAngle) && (MouseAngle <= EndAngle) ) - { + { if(pts->m_Layer == screen->m_Active_Layer) return( pts ) ; else if ( ! locate_segm ) locate_segm = pts; - } - } - } - - else - { - if( distance( pts->m_Width /2 ) ) - { - if(pts->m_Layer == screen->m_Active_Layer) - return( pts ) ; - else if ( ! locate_segm ) locate_segm = pts; } } } + + else + { + if( distance( pts->m_Width /2 ) ) + { + if(pts->m_Layer == screen->m_Active_Layer) + return( pts ) ; + else if ( ! locate_segm ) locate_segm = pts; + } + } + } return(locate_segm) ; } @@ -695,41 +714,41 @@ wxPoint ref_pos; module = * PtModule; if( module == NULL ) - { + { module = Pcb->m_Modules; - } + } for( ; module != NULL; module = (MODULE*)module->Pnext ) - { + { pt_txt_mod = module->m_Reference; /* la souris est-elle dans le rectangle autour du texte*/ if( pt_txt_mod->Locate(ref_pos) ) - { + { if( PtModule) *PtModule = module; return(pt_txt_mod); - } + } pt_txt_mod = module->m_Value; /* la souris est-elle dans le rectangle autour du texte*/ if( pt_txt_mod->Locate(ref_pos) ) - { + { if( PtModule) *PtModule = module; return(pt_txt_mod); - } + } PtStruct = module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) - { + { if( PtStruct->m_StructType != TYPETEXTEMODULE ) continue; pt_txt_mod = (TEXTE_MODULE*) PtStruct; /* la souris est-elle dans le rectangle autour du texte*/ if( pt_txt_mod->Locate(ref_pos) ) - { + { if( PtModule) *PtModule = module; return(pt_txt_mod); - } } - if( *PtModule != NULL ) break; /* Recherche limitee a 1 seul module */ } + if( *PtModule != NULL ) break; /* Recherche limitee a 1 seul module */ + } return(NULL) ; } @@ -740,8 +759,8 @@ TRACK * Locate_Piste_Connectee( TRACK * PtRefSegm, TRACK * pt_base, /**************************************************************/ /* recherche le segment connecte au segment pointe par PtRefSegm: - si int = START, le point de debut du segment est utilise - si int = END, le point de fin du segment est utilise + si int extr = START, le point de debut du segment est utilise + si int extr = END, le point de fin du segment est utilise La recherche ne se fait que sur les EXTREMITES des segments La recherche se fait de l'adresse : @@ -753,17 +772,12 @@ TRACK * Locate_Piste_Connectee( TRACK * PtRefSegm, TRACK * pt_base, */ { TRACK * PtSegmB, * PtSegmN; -int x, y , Reflayer; +int Reflayer; +wxPoint pos_ref; int ii; - if ( extr == START) - { - x = PtRefSegm->m_Start.x; y = PtRefSegm->m_Start.y; - } - else - { - x = PtRefSegm->m_End.x; y = PtRefSegm->m_End.y; - } + if ( extr == START) pos_ref = PtRefSegm->m_Start; + else pos_ref = PtRefSegm->m_End; Reflayer = PtRefSegm->ReturnMaskLayer(); @@ -777,12 +791,12 @@ int ii; { if( PtSegmN->GetState(BUSY|DELETED) ) goto suite; if (PtSegmN == PtRefSegm) goto suite; - if( (x == PtSegmN->m_Start.x ) && (y == PtSegmN->m_Start.y) ) + if( pos_ref == PtSegmN->m_Start ) { /* Test des couches */ if(Reflayer & PtSegmN->ReturnMaskLayer() )return(PtSegmN); } - if( (x == PtSegmN->m_End.x ) && (y == PtSegmN->m_End.y) ) + if( pos_ref == PtSegmN->m_End ) { /* Test des couches */ if(Reflayer & PtSegmN->ReturnMaskLayer() )return(PtSegmN); } @@ -795,12 +809,12 @@ int ii; { if(PtSegmB->GetState(BUSY|DELETED) ) goto suite1; if (PtSegmB == PtRefSegm) goto suite1; - if( (x == PtSegmB->m_Start.x ) && (y == PtSegmB->m_Start.y) ) + if( pos_ref == PtSegmB->m_Start ) { /* Test des couches */ if(Reflayer & PtSegmB->ReturnMaskLayer() )return(PtSegmB); } - if( (x == PtSegmB->m_End.x ) && (y == PtSegmB->m_End.y) ) + if( pos_ref == PtSegmB->m_End ) { /* Test des couches */ if(Reflayer & PtSegmB->ReturnMaskLayer() )return(PtSegmB); } @@ -825,12 +839,12 @@ int ii; continue; } - if( (x == PtSegmN->m_Start.x ) && (y == PtSegmN->m_Start.y) ) + if( pos_ref == PtSegmN->m_Start ) { /* Test des couches */ if(Reflayer & PtSegmN->ReturnMaskLayer() )return(PtSegmN); } - if( (x == PtSegmN->m_End.x ) && (y == PtSegmN->m_End.y) ) + if( pos_ref == PtSegmN->m_End ) { /* Test des couches */ if(Reflayer & PtSegmN->ReturnMaskLayer() )return(PtSegmN); } @@ -951,9 +965,9 @@ int l_segm ; /* demi-largeur de la piste */ -/*******************************************************************/ -TEXTE_PCB * Locate_Texte_Pcb(EDA_BaseStruct * PtStruct, int typeloc) -/*******************************************************************/ +/************************************************************************************/ +TEXTE_PCB * Locate_Texte_Pcb(EDA_BaseStruct * PtStruct, int LayerSearch, int typeloc) +/************************************************************************************/ /* localisation des inscriptions sur le Pcb: entree : EDA_BaseStruct pointeur sur le debut de la zone de recherche retour : pointeur sur la description du texte localise @@ -963,19 +977,23 @@ wxPoint ref; SET_REF_POS(ref); for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) - { + { if( PtStruct->m_StructType != TYPETEXTE ) continue; TEXTE_PCB * pt_txt_pcb = (TEXTE_PCB *) PtStruct; - if( pt_txt_pcb->Locate(ref) ) return pt_txt_pcb; + if( pt_txt_pcb->Locate(ref) ) + { + if ( pt_txt_pcb->m_Layer == LayerSearch ) + return pt_txt_pcb; } + } return(NULL) ; } - /*****************************/ - /* int distance(int seuil) */ - /*****************************/ +/*****************************/ +int distance(int seuil) +/*****************************/ /* Calcul de la distance du curseur souris a un segment de droite : @@ -993,8 +1011,6 @@ wxPoint ref; segment 45 segment quelconque */ - -int distance(int seuil) { int cXrot, cYrot , /* coord du point (souris) dans le repere tourne */ segX, segY; /* coord extremite segment tj >= 0 */ @@ -1220,9 +1236,10 @@ TRACK * PtSegm; /***********************************************************************/ -EDA_BaseStruct * Locate_MirePcb( EDA_BaseStruct * PtStruct, int typeloc) +EDA_BaseStruct * Locate_MirePcb( EDA_BaseStruct * PtStruct, int LayerSearch, + int typeloc) /***********************************************************************/ -/* Routine d'initialisation du deplacement d'une mire +/* Serach for a photo target */ { wxPoint ref_pos; /* coord du point de localisation */ @@ -1234,10 +1251,14 @@ int dX, dY, rayon; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext) { + MIREPCB* item; if( PtStruct->m_StructType != TYPEMIRE ) continue; - dX = ref_pos.x - ((MIREPCB*) PtStruct)->m_Pos.x; - dY = ref_pos.y - ((MIREPCB*) PtStruct)->m_Pos.y; - rayon = ((MIREPCB*) PtStruct)->m_Size / 2; + item = (MIREPCB*) PtStruct; + if( LayerSearch != -1 && item->m_Layer != LayerSearch ) continue; + + dX = ref_pos.x - item->m_Pos.x; + dY = ref_pos.y - item->m_Pos.y; + rayon = item->m_Size / 2; if( (abs(dX) <= rayon ) && ( abs(dY) <= rayon ) ) break; /* Mire Localisee */ } diff --git a/pcbnew/makefile.g95 b/pcbnew/makefile.g95 index 7df527ab30..0fd34c55aa 100644 --- a/pcbnew/makefile.g95 +++ b/pcbnew/makefile.g95 @@ -15,7 +15,7 @@ $(TARGET).exe: $(OBJECTS) $(TARGET)_resources.o\ $(CXX) $(ALL_LDFLAGS) -o $(TARGET).exe\ $(OBJECTS) $(LIBVIEWER3D) $(TARGET)_resources.o $(EDALIBS) $(SYSWXLIB) -install: +install: $(TARGET).exe cp $(TARGET).exe $(KICAD_BIN) diff --git a/pcbnew/makefile.gtk b/pcbnew/makefile.gtk index 2fa460d172..c884298bfb 100644 --- a/pcbnew/makefile.gtk +++ b/pcbnew/makefile.gtk @@ -26,7 +26,7 @@ $(TARGET): $(OBJECTS) makefile.gtk makefile.include $(LIBVIEWER3D) $(EXTRALIBS) -o $(TARGET) -install: +install: $(TARGET) cp $(TARGET) $(KICAD_BIN) diff --git a/pcbnew/makefile.include b/pcbnew/makefile.include index 4796323d89..c844e200da 100644 --- a/pcbnew/makefile.include +++ b/pcbnew/makefile.include @@ -1,287 +1,291 @@ -EXTRALIBS = ../common/common.a -EXTRACPPFLAGS= -DPCBNEW -I./ -Ibitmaps -I../include -I../share -I../pcbnew -I../3d-viewer - -#COMMON = pcbnew.h struct.h class_pad.h class_module.h class_text_mod.h \ -# class_edge_mod.h class_equipot.h - -LIBVIEWER3D = ../3d-viewer/3d-viewer.a - -OBJECTS= $(TARGET).o classpcb.o\ - lay2plot.o\ - modedit_undo_redo.o\ - block_module_editor.o\ - onrightclick.o\ - modedit_onclick.o\ - via_edit.o\ - wxprint.o \ - cursors.o\ - menubarpcb.o \ - menubarmodedit.o \ - tool_onrightclick.o\ - edit.o \ - setpage.o \ - tool_pcb.o \ - pcbframe.o \ - class_track.o \ - class_mire.o\ - class_cotation.o\ - class_pad.o \ - class_equipot.o \ - class_module.o \ - class_edge_mod.o \ - class_text_mod.o\ - class_pcb_text.o\ - class_board.o\ - drawframe.o\ - drawpanel.o\ - track.o \ - set_color.o \ - set_grid.o \ - pcbcfg.o \ - netlist.o \ - affiche.o \ - pcbpiste.o \ - tracepcb.o \ - tracemod.o \ - trpiste.o \ - surbrill.o \ - pcbtexte.o \ - locate.o \ - modules.o \ - loadcmp.o \ - zoom.o\ - dialog_setup_libs.o \ - dialog_general_options.o \ - muwave_command.o \ - initpcb.o\ - editrack.o \ - editrack-part2.o \ - deltrack.o edit_track_width.o \ - editmod.o\ - editpads.o \ - move-drag_pads.o\ - globaleditpad.o \ - editedge.o\ - edtxtmod.o \ - dialog_edit_mod_text.o\ - ratsnest.o drc.o \ - block.o\ - clean.o \ - pcbplot.o\ - plothpgl.o\ - plot_rtn.o\ - plotgerb.o\ - librairi.o edgemod.o\ - connect.o muonde.o attribut.o\ - gendrill.o\ - sel_layer.o \ - cotation.o\ - automove.o\ - tr_modif.o \ - autorout.o solve.o\ - work.o queue.o \ - board.o dist.o graphpcb.o \ - zones.o undelete.o \ - move_copy_track.o ioascii.o struct.o \ - mirepcb.o xchgmod.o\ - plotps.o\ - dragsegm.o\ - autoplac.o\ - files.o\ - infospgm.o\ - router.o\ - controle.o\ - tool_modedit.o\ - moduleframe.o\ - find.o\ - basepcbframe.o\ - modeditoptions.o\ - gen_modules_placefile.o\ - modedit.o\ - export_gencad.o\ - hotkeys.o - -setpage.o: ../share/setpage.cpp - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -drawpanel.o: ../share/drawpanel.cpp - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -drawframe.o: ../share/drawframe.cpp - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -menubarpcb.o: menubarpcb.cpp $(COMMON) - -dialog_general_options.o: dialog_general_options.cpp dialog_track_options.cpp dialog_display_options.cpp\ - dialog_graphic_items_options.cpp $(COMMON) - -menubarmodedit.o: menubarmodedit.cpp $(COMMON) - -controle.o: controle.cpp $(COMMON) - -cursors.o: cursors.cpp $(COMMON) - -tool_onrightclick.o: tool_onrightclick.cpp $(COMMON) - -files.o: files.cpp $(COMMON) - -export_gencad.o: export_gencad.cpp $(COMMON) - -wxprint.o: ../share/wxprint.cpp ../share/dialog_print.cpp ../share/dialog_print.h $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -lay2plot.o: lay2plot.cpp $(COMMON) - -classpcb.o: classpcb.cpp $(COMMON) - -class_track.o: class_track.cpp class_track.h $(COMMON) - -class_mire.o: class_mire.cpp class_mire.h $(COMMON) - -class_cotation.o: class_cotation.cpp class_cotation.h $(COMMON) - -class_pad.o: class_pad.cpp $(COMMON) - -class_equipot.o: class_equipot.cpp $(COMMON) - -class_module.o: class_module.cpp $(COMMON) - -class_edge_mod.o: class_edge_mod.cpp $(COMMON) - -class_text_mod.o: class_text_mod.cpp $(COMMON) - -class_pcb_text.o: class_pcb_text.cpp class_pcb_text.h $(COMMON) - -pcbnew.o: pcbnew.cpp pcbnew.h pcbplot.h drag.h $(COMMON) \ - autorout.h ../include/eda_dde.h - -pcbcfg.o: pcbcfg.cpp $(COMMON) pcbcfg.h pcbplot.h - -netlist.o: netlist.cpp dialog_netlist.cpp dialog_netlist.h $(COMMON) - -gen_modules_placefile.o: gen_modules_placefile.cpp $(COMMON) - -xchgmod.o: xchgmod.cpp $(COMMON) - -pcbpiste.o: pcbpiste.cpp $(COMMON) - -tracepcb.o: tracepcb.cpp $(COMMON) - -tracemod.o: tracemod.cpp ../include/grfonte.h $(COMMON) - -trpiste.o: trpiste.cpp $(COMMON) - -surbrill.o: surbrill.cpp $(COMMON) - -pcbtexte.o: pcbtexte.cpp $(COMMON) - -locate.o: locate.cpp $(COMMON) - -modules.o: modules.cpp drag.h $(COMMON) - -autoplac.o: autoplac.cpp autorout.h $(COMMON) - -automove.o: automove.cpp autorout.h $(COMMON) - -loadcmp.o: loadcmp.cpp $(COMMON) - -zoom.o: ../share/zoom.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -infospgm.o: ../share/infospgm.cpp $(COMMON) - $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp - -affiche.o: affiche.cpp $(COMMON) - -tr_modif.o: tr_modif.cpp $(COMMON) - -dialog_setup_libs.o: dialog_setup_libs.cpp $(COMMON) - -initpcb.o: initpcb.cpp dialog_initpcb.cpp dialog_initpcb.h $(COMMON) - -editrack.o: editrack.cpp $(COMMON) - -attribut.o: attribut.cpp $(COMMON) - -deltrack.o: deltrack.cpp $(COMMON) - -track.o: track.cpp $(COMMON) - -edit_track_width.o: edit_track_width.cpp $(COMMON) - -editmod.o: editmod.cpp dialog_edit_module.cpp dialog_edit_module.h $(COMMON) - -editpads.o: editpads.cpp dialog_pad_edit.cpp dialog_pad_edit.h $(COMMON) - -move-drag_pads.o: move-drag_pads.cpp drag.h $(COMMON) - -editedge.o: editedge.cpp $(COMMON) - -cotation.o: cotation.cpp $(COMMON) - -edtxtmod.o: edtxtmod.cpp $(COMMON) - -dialog_edit_mod_text.o: dialog_edit_mod_text.cpp dialog_edit_mod_text.h $(COMMON) - -ratsnest.o: ratsnest.cpp $(COMMON) - -connect.o: connect.cpp $(COMMON) - -drc.o: drc.cpp dialog_drc.cpp dialog_drc.h autorout.h $(COMMON) - -block.o: block.cpp $(COMMON) - -clean.o: clean.cpp $(COMMON) - -pcbplot.o: pcbplot.cpp pcbplot.h $(COMMON) - -plothpgl.o: plothpgl.cpp $(COMMON) - -plotgerb.o: plotgerb.cpp pcbplot.h plotgerb.h $(COMMON) - -plotps.o: plotps.cpp pcbplot.h $(COMMON) - -readgerb.o: readgerb.cpp pcbplot.h $(COMMON) - -plot_rtn.o: plot_rtn.cpp pcbplot.h $(COMMON) - -gendrill.o: gendrill.cpp pcbplot.h $(COMMON) - -librairi.o: librairi.cpp $(COMMON) - -edgemod.o: edgemod.cpp $(COMMON) - -muonde.o: muonde.cpp drag.h gen_self.h $(COMMON) - -autorout.o: autorout.cpp cell.h autorout.h $(COMMON) - -solve.o: solve.cpp cell.h autorout.h $(COMMON) - -work.o: work.cpp cell.h autorout.h $(COMMON) - -queue.o: queue.cpp cell.h autorout.h $(COMMON) - -board.o: board.cpp cell.h autorout.h $(COMMON) - -dist.o: dist.cpp cell.h autorout.h $(COMMON) - -graphpcb.o: graphpcb.cpp cell.h autorout.h $(COMMON) - -zones.o: zones.cpp cell.h $(COMMON) - -undelete.o: undelete.cpp $(COMMON) - -move_copy_track.o: move_copy_track.cpp $(COMMON) - -ioascii.o: ioascii.cpp $(COMMON) - -struct.o: struct.cpp $(COMMON) - -coordbox.o: coordbox.cpp $(COMMON) - -mirepcb.o: mirepcb.cpp $(COMMON) - -dragsegm.o: dragsegm.cpp drag.h $(COMMON) - -router.o: router.cpp $(COMMON) - +EXTRALIBS = ../common/common.a +EXTRACPPFLAGS += -DPCBNEW -fno-strict-aliasing -I./ -Ibitmaps -I../include -I../share -I../pcbnew -I../3d-viewer + +#COMMON = pcbnew.h struct.h class_pad.h class_module.h class_text_mod.h \ +# class_edge_mod.h class_equipot.h + +LIBVIEWER3D = ../3d-viewer/3d-viewer.a + +OBJECTS= $(TARGET).o classpcb.o\ + lay2plot.o\ + modedit_undo_redo.o\ + block_module_editor.o\ + onrightclick.o\ + modedit_onclick.o\ + via_edit.o\ + wxprint.o \ + cursors.o\ + menubarpcb.o \ + menubarmodedit.o \ + tool_onrightclick.o\ + edit.o \ + setpage.o \ + tool_pcb.o \ + pcbframe.o \ + class_track.o \ + class_mire.o\ + class_cotation.o\ + class_pad.o \ + class_equipot.o \ + class_module.o \ + class_edge_mod.o \ + class_text_mod.o\ + class_pcb_text.o\ + class_board.o\ + drawframe.o\ + drawpanel.o\ + track.o \ + set_color.o \ + set_grid.o \ + pcbcfg.o \ + netlist.o \ + affiche.o \ + swap_layers.o \ + tracepcb.o \ + tracemod.o \ + trpiste.o \ + surbrill.o \ + pcbtexte.o \ + locate.o \ + modules.o \ + loadcmp.o \ + zoom.o\ + dialog_setup_libs.o \ + dialog_general_options.o \ + muwave_command.o \ + initpcb.o\ + editrack.o \ + editrack-part2.o \ + deltrack.o edit_track_width.o \ + editmod.o\ + editpads.o \ + move-drag_pads.o\ + globaleditpad.o \ + editedge.o\ + edtxtmod.o \ + dialog_edit_mod_text.o\ + ratsnest.o drc.o \ + block.o\ + clean.o \ + pcbplot.o\ + plothpgl.o\ + plot_rtn.o\ + plotgerb.o\ + librairi.o edgemod.o\ + connect.o muonde.o attribut.o\ + gendrill.o\ + sel_layer.o \ + cotation.o\ + automove.o\ + tr_modif.o \ + autorout.o solve.o\ + work.o queue.o \ + board.o dist.o graphpcb.o \ + zones.o undelete.o \ + copy_track.o\ + move_or_drag_track.o\ + ioascii.o struct.o \ + mirepcb.o xchgmod.o\ + plotps.o\ + dragsegm.o\ + autoplac.o\ + files.o\ + infospgm.o\ + router.o\ + controle.o\ + tool_modedit.o\ + moduleframe.o\ + find.o\ + basepcbframe.o\ + modeditoptions.o\ + gen_modules_placefile.o\ + modedit.o\ + export_gencad.o\ + hotkeys.o + +setpage.o: ../share/setpage.cpp + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +drawpanel.o: ../share/drawpanel.cpp + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +drawframe.o: ../share/drawframe.cpp + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +menubarpcb.o: menubarpcb.cpp $(COMMON) + +dialog_general_options.o: dialog_general_options.cpp dialog_track_options.cpp dialog_display_options.cpp\ + dialog_graphic_items_options.cpp $(COMMON) + +menubarmodedit.o: menubarmodedit.cpp $(COMMON) + +controle.o: controle.cpp $(COMMON) + +cursors.o: cursors.cpp $(COMMON) + +tool_onrightclick.o: tool_onrightclick.cpp $(COMMON) + +files.o: files.cpp $(COMMON) + +export_gencad.o: export_gencad.cpp $(COMMON) + +wxprint.o: ../share/wxprint.cpp ../share/dialog_print.cpp ../share/dialog_print.h $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +lay2plot.o: lay2plot.cpp $(COMMON) + +classpcb.o: classpcb.cpp $(COMMON) + +class_track.o: class_track.cpp class_track.h $(COMMON) + +class_mire.o: class_mire.cpp class_mire.h $(COMMON) + +class_cotation.o: class_cotation.cpp class_cotation.h $(COMMON) + +class_pad.o: class_pad.cpp $(COMMON) + +class_equipot.o: class_equipot.cpp $(COMMON) + +class_module.o: class_module.cpp $(COMMON) + +class_edge_mod.o: class_edge_mod.cpp $(COMMON) + +class_text_mod.o: class_text_mod.cpp $(COMMON) + +class_pcb_text.o: class_pcb_text.cpp class_pcb_text.h $(COMMON) + +pcbnew.o: pcbnew.cpp pcbnew.h pcbplot.h drag.h $(COMMON) \ + autorout.h ../include/eda_dde.h + +pcbcfg.o: pcbcfg.cpp $(COMMON) pcbcfg.h pcbplot.h + +netlist.o: netlist.cpp dialog_netlist.cpp dialog_netlist.h $(COMMON) + +gen_modules_placefile.o: gen_modules_placefile.cpp $(COMMON) + +xchgmod.o: xchgmod.cpp $(COMMON) + +swap_layers.o: swap_layers.cpp $(COMMON) + +tracepcb.o: tracepcb.cpp $(COMMON) + +tracemod.o: tracemod.cpp ../include/grfonte.h $(COMMON) + +trpiste.o: trpiste.cpp $(COMMON) + +surbrill.o: surbrill.cpp $(COMMON) + +pcbtexte.o: pcbtexte.cpp $(COMMON) + +locate.o: locate.cpp $(COMMON) + +modules.o: modules.cpp drag.h $(COMMON) + +autoplac.o: autoplac.cpp autorout.h $(COMMON) + +automove.o: automove.cpp autorout.h $(COMMON) + +loadcmp.o: loadcmp.cpp $(COMMON) + +zoom.o: ../share/zoom.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +infospgm.o: ../share/infospgm.cpp $(COMMON) + $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp + +affiche.o: affiche.cpp $(COMMON) + +tr_modif.o: tr_modif.cpp $(COMMON) + +dialog_setup_libs.o: dialog_setup_libs.cpp $(COMMON) + +initpcb.o: initpcb.cpp dialog_initpcb.cpp dialog_initpcb.h $(COMMON) + +editrack.o: editrack.cpp $(COMMON) + +attribut.o: attribut.cpp $(COMMON) + +deltrack.o: deltrack.cpp $(COMMON) + +track.o: track.cpp $(COMMON) + +edit_track_width.o: edit_track_width.cpp $(COMMON) + +editmod.o: editmod.cpp dialog_edit_module.cpp dialog_edit_module.h $(COMMON) + +editpads.o: editpads.cpp dialog_pad_edit.cpp dialog_pad_edit.h $(COMMON) + +move-drag_pads.o: move-drag_pads.cpp drag.h $(COMMON) + +editedge.o: editedge.cpp $(COMMON) + +cotation.o: cotation.cpp $(COMMON) + +edtxtmod.o: edtxtmod.cpp $(COMMON) + +dialog_edit_mod_text.o: dialog_edit_mod_text.cpp dialog_edit_mod_text.h $(COMMON) + +ratsnest.o: ratsnest.cpp $(COMMON) + +connect.o: connect.cpp $(COMMON) + +drc.o: drc.cpp dialog_drc.cpp dialog_drc.h autorout.h $(COMMON) + +block.o: block.cpp $(COMMON) + +clean.o: clean.cpp $(COMMON) + +pcbplot.o: pcbplot.cpp pcbplot.h $(COMMON) + +plothpgl.o: plothpgl.cpp $(COMMON) + +plotgerb.o: plotgerb.cpp pcbplot.h plotgerb.h $(COMMON) + +plotps.o: plotps.cpp pcbplot.h $(COMMON) + +readgerb.o: readgerb.cpp pcbplot.h $(COMMON) + +plot_rtn.o: plot_rtn.cpp pcbplot.h $(COMMON) + +gendrill.o: gendrill.cpp pcbplot.h $(COMMON) + +librairi.o: librairi.cpp $(COMMON) + +edgemod.o: edgemod.cpp $(COMMON) + +muonde.o: muonde.cpp drag.h gen_self.h $(COMMON) + +autorout.o: autorout.cpp cell.h autorout.h $(COMMON) + +solve.o: solve.cpp cell.h autorout.h $(COMMON) + +work.o: work.cpp cell.h autorout.h $(COMMON) + +queue.o: queue.cpp cell.h autorout.h $(COMMON) + +board.o: board.cpp cell.h autorout.h $(COMMON) + +dist.o: dist.cpp cell.h autorout.h $(COMMON) + +graphpcb.o: graphpcb.cpp cell.h autorout.h $(COMMON) + +zones.o: zones.cpp cell.h $(COMMON) + +undelete.o: undelete.cpp $(COMMON) + +move_or_drag_track.o: move_or_drag_track.cpp $(COMMON) + +copy_track.o: copy_track.cpp $(COMMON) + +ioascii.o: ioascii.cpp $(COMMON) + +struct.o: struct.cpp $(COMMON) + +coordbox.o: coordbox.cpp $(COMMON) + +mirepcb.o: mirepcb.cpp $(COMMON) + +dragsegm.o: dragsegm.cpp drag.h $(COMMON) + +router.o: router.cpp $(COMMON) + diff --git a/pcbnew/makefile.macosx b/pcbnew/makefile.macosx index ed0849e26a..d9bed3f20e 100644 --- a/pcbnew/makefile.macosx +++ b/pcbnew/makefile.macosx @@ -12,11 +12,12 @@ include ../libs.macosx TARGET = pcbnew -all: $(TARGET) +all: $(TARGET) $(TARGET).app include makefile.include CPPFLAGS += $(EXTRACPPFLAGS) +CPPFLAGS += -arch i386 -arch ppc EDACPPFLAGS = $(CPPFLAGS) @@ -26,9 +27,24 @@ $(TARGET): $(OBJECTS) $(TARGET).r makefile.macosx makefile.include $(LIBVIEWER3 $(RESCOMP) -o $(TARGET) Carbon.r $(TARGET).r $(SETFILE) -a C $(TARGET) -install: +install: $(TARGET) cp $(TARGET) $(KICAD_BIN) +$(TARGET).app: $(OBJS) + rm -Rf $(TARGET).app + mkdir -p $(TARGET).app + mkdir -p $(TARGET).app/Contents + mkdir -p $(TARGET).app/Contents/MacOS + mkdir -p $(TARGET).app/Contents/Frameworks + mkdir -p $(TARGET).app/Contents/Resources + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/" \ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/wxmac.icns \ + >$(TARGET).app/Contents/Resources/wxmac.icns + sed -e "s/IDENTIFIER/`echo . | sed -e ’s,\.\./,,g’ | sed -e ’s,/,.,g’`/" -e "s/EXECUTABLE/$(TARGET)/"\ + -e "s/VERSION/$(MKMK_WX_VERSION)/" $(HOME)/wxMac-$(MKMK_WX_VERSION)/src/mac/carbon/Info.plist.in \ + >$(TARGET).app/Contents/Info.plist + echo -n "APPL????" >$(TARGET).app/Contents/PkgInfo + ln -f $(TARGET) $(TARGET).app/Contents/MacOS/$(TARGET) clean: rm -f *.o diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index fb00a9dae1..fcf49ed462 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -29,10 +29,10 @@ MODULE * Module = m_Pcb->m_Modules; DrawStruct = Locate_Edge_Module(Module, CURSEUR_OFF_GRILLE); if ( DrawStruct ) - { + { Affiche_Infos_Segment_Module(this, Module,(EDGE_MODULE*) DrawStruct); - } - else DrawStruct = Locate( CURSEUR_OFF_GRILLE ); + } + else DrawStruct = Locate( CURSEUR_OFF_GRILLE, -1); return DrawStruct; } diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 81da55316d..2bc2dbef3e 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -26,6 +26,7 @@ static void Exit_Module(WinEDA_DrawPanel * Panel, wxDC *DC) ; static int ModuleInitOrient; // Lors des moves, val init de l'orient (pour annulation) static int ModuleInitLayer; // Lors des moves, val init de la couche (pour annulation) + /*************************************************************************/ void Show_Pads_On_Off(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * module) /**************************************************************************/ @@ -61,6 +62,28 @@ WinEDA_BasePcbFrame * frame = (WinEDA_BasePcbFrame *)panel->m_Parent; frame->trace_ratsnest_module(DC); } +/***************************************************/ +MODULE * WinEDA_BasePcbFrame::GetModuleByName(void) +/***************************************************/ +/* Get a module name from user and return a pointer to the corresponding module +*/ +{ +wxString modulename; +MODULE * module = NULL; + + Get_Message(_("Footprint name:"), modulename, this); + if ( ! modulename.IsEmpty() ) + { + module = m_Pcb->m_Modules; + while (module ) + { + if ( module->m_Reference->m_Text.CmpNoCase(modulename) == 0 ) break; + module = module->Next(); + } + } + return module; + +} /**********************************************************************/ void WinEDA_PcbFrame::StartMove_Module(MODULE * module, wxDC * DC) diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp new file mode 100644 index 0000000000..c119e6a32a --- /dev/null +++ b/pcbnew/move_or_drag_track.cpp @@ -0,0 +1,870 @@ + /****************************************************/ + /* Track editing */ + /* routines to move and drag track segments or node */ + /****************************************************/ + +#include "fctsys.h" +#include "gr_basic.h" + +#include "common.h" +#include "pcbnew.h" +#include "autorout.h" +#include "trigo.h" + +#include "drag.h" +#include "id.h" + +#include "protos.h" + + +/* local functions */ +static void Show_MoveNode(WinEDA_DrawPanel * panel, wxDC * DC, bool erase); +static void Show_Drag_Track_Segment_With_Cte_Slope(WinEDA_DrawPanel * panel, wxDC * DC, bool erase); +static void Abort_MoveTrack(WinEDA_DrawPanel * Panel, wxDC *DC); +static bool InitialiseDragParameters(void); + +/* variables locales */ +static wxPoint PosInit, s_LastPos; +static TRACK * NewTrack; /* Nouvelle piste creee ou piste deplacee */ +static int NbPtNewTrack; +static int Old_HightLigth_NetCode; +static bool Old_HightLigt_Status; +static double s_StartSegmentSlope, s_EndSegmentSlope, s_MovingSegmentSlope, + s_StartSegment_Yorg, s_EndSegment_Yorg, + s_MovingSegment_Yorg; //slope and intercept parameters of lines +bool s_StartPointVertical,s_EndPointVertical, + s_MovingSegmentVertical,s_MovingSegmentHorizontal, + s_StartPointHorizontal,s_EndPointHorizontal; // vertical or horizontal line indicators +bool s_StartSegmentPresent, s_EndSegmentPresent; + +/**************************************************************/ +static void Abort_MoveTrack(WinEDA_DrawPanel * Panel, wxDC *DC) +/***************************************************************/ +/* routine d'annulation de la commande drag, copy ou move track si une piste est en cours + de tracage, ou de sortie de l'application EDITRACK. +*/ +{ +TRACK * NextS; +int ii; + + + /* Erase the current drawings */ + wxPoint oldpos = Panel->GetScreen()->m_Curseur; + Panel->GetScreen()->m_Curseur = PosInit; + if ( Panel->ManageCurseur ) Panel->ManageCurseur(Panel, DC, TRUE); + Panel->GetScreen()->m_Curseur = oldpos; + g_HightLigt_Status = FALSE; + ( (WinEDA_PcbFrame *)Panel->m_Parent)->DrawHightLight( DC, g_HightLigth_NetCode) ; + + if( NewTrack ) + { + if (NewTrack->m_Flags & IS_NEW ) + { + for( ii = 0; ii < NbPtNewTrack; ii++, NewTrack = NextS) + { + if(NewTrack == NULL) break; + NextS = (TRACK*) NewTrack->Pnext; + delete NewTrack; + } + } + else /* Move : remise en ancienne position */ + { + TRACK * Track = NewTrack; + int dx = s_LastPos.x - PosInit.x; + int dy = s_LastPos.y - PosInit.y; + for( ii = 0; ii < NbPtNewTrack; ii++, Track = (TRACK*) Track->Pnext) + { + if( Track == NULL ) break; + Track->m_Start.x -= dx; + Track->m_Start.y -= dy; + Track->m_End.x -= dx; + Track->m_End.y -= dy; + Track->m_Flags = 0; + + } + Trace_Une_Piste(Panel, DC, NewTrack,NbPtNewTrack,GR_OR); + } + + NewTrack = NULL; + } + + Panel->ManageCurseur = NULL; + Panel->ForceCloseManageCurseur = NULL; + Panel->GetScreen()->m_CurrentItem = NULL; + Panel->m_Parent->EraseMsgBox(); + + /* Annulation deplacement et Redessin des segments dragges */ + DRAG_SEGM * pt_drag = g_DragSegmentList; + for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext) + { + TRACK * Track = pt_drag->m_Segm; + pt_drag->SetInitialValues(); + Track->SetState(EDIT,OFF); + Track->m_Flags = 0; + Track->Draw(Panel, DC, GR_OR); + } + + g_HightLigth_NetCode = Old_HightLigth_NetCode; + g_HightLigt_Status = Old_HightLigt_Status; + if(g_HightLigt_Status) + ( (WinEDA_PcbFrame *)Panel->m_Parent)->DrawHightLight( DC, g_HightLigth_NetCode) ; + + EraseDragListe(); +} + +/*************************************************************************/ +static void Show_MoveNode(WinEDA_DrawPanel * panel, wxDC * DC, bool erase) +/*************************************************************************/ +/* Redraw the moved node according to the mouse cursor position */ +{ +int ii, dx, dy; +TRACK * Track; +BASE_SCREEN * screen = panel->GetScreen(); +int track_fill_copy = DisplayOpt.DisplayPcbTrackFill; +int draw_mode = GR_XOR | GR_SURBRILL; + + DisplayOpt.DisplayPcbTrackFill = FALSE ; + +erase = TRUE; + + /* erase the current moved track segments from screen */ + if( erase ) + { + if ( NewTrack ) Trace_Une_Piste(panel, DC, NewTrack,NbPtNewTrack,draw_mode) ; + } + + /* set the new track coordinates */ + wxPoint Pos = screen->m_Curseur; + dx = Pos.x - s_LastPos.x; + dy = Pos.y - s_LastPos.y; + s_LastPos = Pos; + ii = NbPtNewTrack, Track = NewTrack; + for( ; (ii > 0) && (Track != NULL); ii--, Track = Track->Next() ) + { + if( Track->m_Flags & STARTPOINT) + { + Track->m_Start.x += dx; Track->m_Start.y += dy; + } + if( Track->m_Flags & ENDPOINT) + { + Track->m_End.x += dx; Track->m_End.y += dy; + } + } + + /* Redraw the current moved track segments */ + Trace_Une_Piste(panel, DC, NewTrack,NbPtNewTrack,GR_XOR) ; + + DRAG_SEGM * pt_drag = g_DragSegmentList; + for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext) + { + Track = pt_drag->m_Segm; + if ( erase ) Track->Draw(panel, DC, draw_mode); + if( Track->m_Flags & STARTPOINT) + { + Track->m_Start.x += dx; Track->m_Start.y += dy; + } + if( Track->m_Flags & ENDPOINT) + { + Track->m_End.x += dx; Track->m_End.y += dy; + } + Track->Draw(panel, DC, draw_mode); + } + DisplayOpt.DisplayPcbTrackFill = track_fill_copy ; +} + + + +/*************************************************************************/ +static void Show_Drag_Track_Segment_With_Cte_Slope(WinEDA_DrawPanel * panel, + wxDC * DC, bool erase) +/*************************************************************************/ +/* drawing the track segment movement + > s_MovingSegmentSlope slope = moving track segment slope + > s_StartSegmentSlope slope = slope of the segment connected to the start point of the moving segment + > s_EndSegmentSlope slope = slope of the segment connected to the end point of the moving segment + + moved segment function : + yt=s_MovingSegmentSlope * x + s_MovingSegment_Yorg + + segment connected to moved segment's start: + y1 = s_StartSegmentSlope * x + s_StartSegment_Yorg + + segment connected to moved segment's end: + y2=s_EndSegmentSlope * x + s_EndSegment_Yorg + + first intersection point will be located at + y1=yt -> + xi1=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_StartSegmentSlope-s_MovingSegmentSlope) + yi1=s_MovingSegmentSlope*xi1+s_MovingSegment_Yorg + or yi1=s_StartSegmentSlope*xi1+s_MovingSegment_Yorg + + second intersection point + y2=yt -> + xi2=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_MovingSegmentSlope-s_MovingSegmentSlope) + yi2=s_MovingSegmentSlope*xi2+s_MovingSegment_Yorg + or yi1=s_EndSegmentSlope*xi2+s_MovingSegment_Yorg + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !!!!! special attention to vertical segments because + !!!!! their slope=infinite + !!!!! intersection point will be calculated using the + !!!!! segment intersecting it + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + Slope parametres are computed once, because they can become undetermined when moving segments + (i.e. when a segment lenght is 0) and we want keep them constant +*/ + +{ +double xi1=0,yi1=0,xi2=0,yi2=0; // calculated intersection points +double tx1,tx2,ty1,ty2; // temporary storage of points +int dx, dy; +BASE_SCREEN * screen = panel->GetScreen(); +bool update=true; +TRACK * Track; +DRAG_SEGM * TrackSegWrapper = g_DragSegmentList; +TRACK * tSegmentToStart = NULL, * tSegmentToEnd = NULL; + + if ( TrackSegWrapper == NULL ) return; + Track = TrackSegWrapper->m_Segm; if (Track == NULL ) return; + + TrackSegWrapper = TrackSegWrapper->Pnext; + if ( TrackSegWrapper ) + { + if ( s_EndSegmentPresent ) + { + tSegmentToEnd = TrackSegWrapper->m_Segm; // Get the segment connected to the end point + TrackSegWrapper = TrackSegWrapper->Pnext; + } + if ( s_StartSegmentPresent ) + { + if ( TrackSegWrapper ) + tSegmentToStart = TrackSegWrapper->m_Segm; // Get the segment connected to the start point + } + } + + int draw_mode = GR_XOR | GR_SURBRILL; + /* Undraw the current moved track segments before modification*/ +// if( erase ) + { + Track->Draw(panel, DC, draw_mode); + if ( tSegmentToStart ) tSegmentToStart->Draw(panel, DC, draw_mode); + if ( tSegmentToEnd ) tSegmentToEnd->Draw(panel, DC, draw_mode); + } + + /* Compute the new track segment position */ + wxPoint Pos = screen->m_Curseur; + + dx = Pos.x - s_LastPos.x; + dy = Pos.y - s_LastPos.y; + //move the line by dx and dy + tx1 = (double)(Track->m_Start.x + dx); + ty1 = (double)(Track->m_Start.y + dy); + tx2 = (double)(Track->m_End.x + dx); + ty2 = (double)(Track->m_End.y + dy); + + // recalculate the segments new parameters and intersection points + // only the intercept will change, segment slopes does not change + // because we are moving parallel with is initial state + if (!s_MovingSegmentVertical) { + s_MovingSegment_Yorg = ty1 - (s_MovingSegmentSlope * tx1); + } + + if ((!s_EndPointVertical) && (!s_MovingSegmentVertical)) { + xi2 = (s_MovingSegment_Yorg - s_EndSegment_Yorg) / (s_EndSegmentSlope - s_MovingSegmentSlope); + } else { + if (!s_EndPointVertical) { + xi2 = tx2; + } else { + //P1=P2 + if (!s_EndPointHorizontal) { + xi2 = tx2-dx; + } else { + update=false; + } + } + } + + if (!s_MovingSegmentVertical) + { + yi2 = s_MovingSegmentSlope * (xi2) + s_MovingSegment_Yorg; + } + else + { + if (!s_EndPointVertical) { + yi2 = s_EndSegmentSlope * (xi2) + s_EndSegment_Yorg; + } + else + { + if (!s_EndPointHorizontal) { + update=false; + } + else { + yi2 = s_MovingSegmentSlope * (xi2) + s_MovingSegment_Yorg; + } + } + } + + if ((!s_StartPointVertical) && (!s_MovingSegmentVertical)) + { + xi1 = (s_MovingSegment_Yorg - s_StartSegment_Yorg) / (s_StartSegmentSlope - s_MovingSegmentSlope); + } + else + { + if (!s_StartPointVertical) { + xi1 = tx1; + } + else + { + //P1=P2 + if (!s_StartPointHorizontal) { + xi1 = tx1-dx; + } + else + { + if (!s_StartPointHorizontal) { + update=false; + } + } + } + } + + if (!s_MovingSegmentVertical) { + yi1 = s_MovingSegmentSlope * (xi1) + s_MovingSegment_Yorg; + } + else { + if (!s_StartPointVertical) { + yi1 = s_StartSegmentSlope * (xi1) + s_StartSegment_Yorg; + } else { + if (!s_StartPointHorizontal) { + update=false; + } else { + yi2 = s_MovingSegmentSlope * (xi1) + s_MovingSegment_Yorg; + } + } + } + + // update the segment coordinates (if possible) + if ( tSegmentToStart == NULL ) + { + xi1 = tx1; yi1 = ty1; + } + if ( tSegmentToEnd == NULL ) + { + xi2 = tx2; yi2 = ty2; + } + + + if (update) + { + s_LastPos=Pos; + Track->m_Start.x = (int) round(xi1); + Track->m_Start.y = (int) round(yi1); + Track->m_End.x = (int) round(xi2); + Track->m_End.y = (int) round(yi2); + if ( tSegmentToEnd ) + { + if ( tSegmentToEnd->m_Flags & STARTPOINT ) + tSegmentToEnd->m_Start = Track->m_End; + else tSegmentToEnd->m_End = Track->m_End; + } + if ( tSegmentToStart ) + { + if ( tSegmentToStart->m_Flags & STARTPOINT ) + tSegmentToStart->m_Start = Track->m_Start; + else tSegmentToStart->m_End = Track->m_Start; + } + } + + Track->Draw(panel, DC, draw_mode); + if ( tSegmentToStart ) tSegmentToStart->Draw(panel, DC, draw_mode); + if ( tSegmentToEnd ) tSegmentToEnd->Draw(panel, DC, draw_mode); +} + + +/**********************************/ +bool InitialiseDragParameters(void) +/**********************************/ +/* Init variables (slope, Y intersect point, flags) for Show_Drag_Track_Segment_With_Cte_Slope() + return TRUE if Ok, FALSE if dragging is not possible + (2 colinear segments) +*/ +{ +double tx1,tx2,ty1,ty2; // temporary storage of points +TRACK * Track; +DRAG_SEGM * TrackSegWrapper = g_DragSegmentList; +TRACK * tSegmentToStart = NULL, * tSegmentToEnd = NULL; + + if ( TrackSegWrapper == NULL ) return FALSE; + Track = TrackSegWrapper->m_Segm; + if (Track == NULL ) return FALSE; + + TrackSegWrapper = TrackSegWrapper->Pnext; + if ( TrackSegWrapper ) + { + if ( s_EndSegmentPresent ) + { + tSegmentToEnd = TrackSegWrapper->m_Segm; // Get the segment connected to the end point + TrackSegWrapper = TrackSegWrapper->Pnext; + } + if ( s_StartSegmentPresent ) + { + if ( TrackSegWrapper ) + tSegmentToStart = TrackSegWrapper->m_Segm; // Get the segment connected to the start point + } + } + + s_StartPointVertical=false; + s_EndPointVertical=false; + s_MovingSegmentVertical=false; + s_StartPointHorizontal=false; + s_EndPointHorizontal=false; + s_MovingSegmentHorizontal=false; + + + // Init parameters for the starting point of the moved segment + if ( tSegmentToStart ) + { + if ( tSegmentToStart->m_Flags & ENDPOINT ) + { + tx1=(double)tSegmentToStart->m_Start.x; + ty1=(double)tSegmentToStart->m_Start.y; + tx2=(double)tSegmentToStart->m_End.x; + ty2=(double)tSegmentToStart->m_End.y; + } + else + { + tx1=(double)tSegmentToStart->m_End.x; + ty1=(double)tSegmentToStart->m_End.y; + tx2=(double)tSegmentToStart->m_Start.x; + ty2=(double)tSegmentToStart->m_Start.y; + } + } + else // move the start point on a line starting at Track->m_Start, and perpendicular to Track + { + tx1 = (double)Track->m_Start.x; + ty1 = (double)Track->m_Start.y; + tx2 = (double)Track->m_End.x; + ty2 = (double)Track->m_End.y; + RotatePoint(&tx2, &ty2, tx1, ty1, 900); + } + if (tx1!=tx2) { + s_StartSegmentSlope = (ty2 - ty1) / (tx2 - tx1); + s_StartSegment_Yorg = ty1 - (ty2 - ty1) * tx1 / (tx2 - tx1); + } else { + s_StartPointVertical=true; //signal first segment vertical + } + if (ty1==ty2) { + s_StartPointHorizontal=true; + } + + + // Init parameters for the ending point of the moved segment + if ( tSegmentToEnd ) + { + //check if second line is vertical + if ( tSegmentToEnd->m_Flags & STARTPOINT ) + { + tx1=(double)tSegmentToEnd->m_Start.x; + ty1=(double)tSegmentToEnd->m_Start.y; + tx2=(double)tSegmentToEnd->m_End.x; + ty2=(double)tSegmentToEnd->m_End.y; + } + else + { + tx1=(double)tSegmentToEnd->m_End.x; + ty1=(double)tSegmentToEnd->m_End.y; + tx2=(double)tSegmentToEnd->m_Start.x; + ty2=(double)tSegmentToEnd->m_Start.y; + } + } + else // move the start point on a line starting at Track->m_End, and perpendicular to Track + { + tx1 = (double)Track->m_End.x; + ty1 = (double)Track->m_End.y; + tx2 = (double)Track->m_Start.x; + ty2 = (double)Track->m_Start.y; + RotatePoint(&tx2, &ty2, tx1, ty1, -900); + } + + if (tx2!=tx1) { + s_EndSegmentSlope = (ty2 - ty1) / (tx2 - tx1); + s_EndSegment_Yorg = ty1 - (ty2 - ty1) * tx1 / (tx2 - tx1); + } else { + s_EndPointVertical = true; //signal second segment vertical + } + if (ty1==ty2) { + s_EndPointHorizontal = true; + } + + + + // Init parameters for the moved segment + + tx1 = (double)Track->m_Start.x; + ty1 = (double)Track->m_Start.y; + tx2 = (double)Track->m_End.x; + ty2 = (double)Track->m_End.y; + if (tx2 != tx1) { + s_MovingSegmentSlope = (ty2 - ty1) / (tx2 - tx1); + } else { + s_MovingSegmentVertical = true; //signal vertical line + } + if (ty1==ty2) { + s_MovingSegmentHorizontal=true; + } + + // Test if drag is possible: + if( s_MovingSegmentVertical ) + { + if ( s_EndPointVertical || s_StartPointVertical ) return false; + } + else + { if ( ! s_EndPointVertical && (s_MovingSegmentSlope == s_EndSegmentSlope) ) return false; + if ( ! s_StartPointVertical && (s_MovingSegmentSlope == s_StartSegmentSlope) ) return false; + } + + return TRUE; +} + +/*************************************************************************************/ +void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment(TRACK * track, wxDC * DC, int command) +/*************************************************************************************/ +/* Init parametres to move one node: + a via or/and a terminal point of a track segment + The terminal point of other connected segments (if any) are moved too. +*/ +{ + if ( ! track ) return; + + NewTrack = NULL; + NbPtNewTrack = 0; + EraseDragListe(); + + /* Change hight light net: the new one will be hightlighted */ + Old_HightLigt_Status = g_HightLigt_Status; + Old_HightLigth_NetCode = g_HightLigth_NetCode; + if(g_HightLigt_Status) Hight_Light(DC); + PosInit = GetScreen()->m_Curseur; + + if ( track->m_StructType == TYPEVIA) + { + track->m_Flags = IS_DRAGGED|STARTPOINT|ENDPOINT; + if ( command != ID_POPUP_PCB_MOVE_TRACK_SEGMENT ) + { + Collect_TrackSegmentsToDrag(DrawPanel, DC, track->m_Start, + track->ReturnMaskLayer(), track->m_NetCode); + } + NewTrack = track; + NbPtNewTrack = 1; + PosInit = track->m_Start; + } + + else + { + int diag = track->IsPointOnEnds(GetScreen()->m_Curseur, -1); + wxPoint pos; + switch ( command ) + { + case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: + track->m_Flags |= IS_DRAGGED|ENDPOINT|STARTPOINT; + AddSegmentToDragList(DrawPanel, DC, track->m_Flags, track); + break; + + case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: + pos = track->m_Start; + Collect_TrackSegmentsToDrag(DrawPanel, DC, pos, + track->ReturnMaskLayer(), track->m_NetCode); + pos = track->m_End; + track->m_Flags |= IS_DRAGGED|ENDPOINT|STARTPOINT; + Collect_TrackSegmentsToDrag(DrawPanel, DC, pos, + track->ReturnMaskLayer(), track->m_NetCode); + break; + + case ID_POPUP_PCB_MOVE_TRACK_NODE: + pos = (diag & STARTPOINT) ? track->m_Start : track->m_End; + Collect_TrackSegmentsToDrag(DrawPanel, DC, pos, + track->ReturnMaskLayer(), track->m_NetCode); + PosInit = pos; + break; + + } + track->m_Flags |= IS_DRAGGED; + } + s_LastPos = PosInit; + DrawPanel->ManageCurseur = Show_MoveNode; + DrawPanel->ForceCloseManageCurseur = Abort_MoveTrack; + + g_HightLigth_NetCode = track->m_NetCode; + g_HightLigt_Status = TRUE; + DrawHightLight( DC, g_HightLigth_NetCode) ; + DrawPanel->ManageCurseur(DrawPanel, DC, TRUE); +} + + + + +/***********************************************************************************/ +void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope(TRACK * track, wxDC * DC) +/***********************************************************************************/ +{ +TRACK * TrackToStartPoint = NULL; +TRACK * TrackToEndPoint = NULL; +bool error = FALSE; + + if ( ! track ) return; + + s_StartSegmentPresent = s_EndSegmentPresent = TRUE; + + if ( (track->start == NULL) || (track->start->m_StructType == TYPETRACK) ) + TrackToStartPoint = (TRACK*) Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, START); + // Test if more than one segment is connected to this point + if ( TrackToStartPoint ) + { + TrackToStartPoint->SetState(BUSY,ON); + if ( Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, START) ) error = TRUE; + TrackToStartPoint->SetState(BUSY,OFF); + } + + if ( (track->end == NULL) || (track->end->m_StructType == TYPETRACK) ) + TrackToEndPoint = (TRACK*) Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, END); + // Test if more than one segment is connected to this point + if ( TrackToEndPoint ) + { + TrackToEndPoint->SetState(BUSY,ON); + if ( Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, END) ) error = TRUE; + TrackToEndPoint->SetState(BUSY,OFF); + } + + if ( error ) + { + DisplayError( this, _("Unable to drag this segment: too many segments connected") ); + return; + } + + if ( !TrackToStartPoint || (TrackToStartPoint->m_StructType != TYPETRACK) ) + s_StartSegmentPresent = FALSE; + + if ( !TrackToEndPoint || (TrackToEndPoint->m_StructType != TYPETRACK) ) + s_EndSegmentPresent = FALSE; + + /* Change hight light net: the new one will be hightlighted */ + Old_HightLigt_Status = g_HightLigt_Status; + Old_HightLigth_NetCode = g_HightLigth_NetCode; + if(g_HightLigt_Status) Hight_Light(DC); + + EraseDragListe(); + + NewTrack = NULL; + NbPtNewTrack = 0; + track->m_Flags = IS_DRAGGED; + + if( TrackToStartPoint ) + { + int flag = STARTPOINT; + if ( track->m_Start != TrackToStartPoint->m_Start ) flag = ENDPOINT; + AddSegmentToDragList(DrawPanel, DC, flag, TrackToStartPoint); + track->m_Flags |= STARTPOINT; + } + if( TrackToEndPoint ) + { + int flag = STARTPOINT; + if ( track->m_End != TrackToEndPoint->m_Start ) flag = ENDPOINT; + AddSegmentToDragList(DrawPanel, DC, flag, TrackToEndPoint); + track->m_Flags |= ENDPOINT; + } + + AddSegmentToDragList(DrawPanel, DC, track->m_Flags, track); + + + PosInit=GetScreen()->m_Curseur; + s_LastPos = GetScreen()->m_Curseur; + DrawPanel->ManageCurseur = Show_Drag_Track_Segment_With_Cte_Slope; + DrawPanel->ForceCloseManageCurseur = Abort_MoveTrack; + + g_HightLigth_NetCode = track->m_NetCode; + g_HightLigt_Status = TRUE; + DrawHightLight( DC, g_HightLigth_NetCode) ; + + if ( ! InitialiseDragParameters() ) + { + DisplayError( this, _("Unable to drag this segment: two colinear segments") ); + DrawPanel->ManageCurseur = NULL; + Abort_MoveTrack(DrawPanel, DC); + return; + } +} + + +/**********************************************************************/ +bool WinEDA_PcbFrame::PlaceDraggedTrackSegment(TRACK * Track, wxDC * DC) +/**********************************************************************/ +/* Place a dragged (or moved) track segment or via */ +{ +int errdrc; +DRAG_SEGM * pt_drag; + if(Track == NULL ) return FALSE; + +int current_net_code = Track->m_NetCode; + + // DRC control: + if(Drc_On) + { + errdrc = Drc(this, DC, Track, m_Pcb->m_Track,1); + if(errdrc == BAD_DRC) return FALSE; + /* Redraw the dragged segments */ + pt_drag = g_DragSegmentList; + for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext) + { + errdrc = Drc(this, DC, pt_drag->m_Segm, m_Pcb->m_Track,1); + if(errdrc == BAD_DRC) return FALSE; + } + } + + int draw_mode = GR_OR | GR_SURBRILL; + + // DRC Ok: place track segments + Track->m_Flags = 0; + Track->SetState(EDIT,OFF); + Track->Draw(DrawPanel, DC, draw_mode); + + /* Tracage des segments dragges */ + pt_drag = g_DragSegmentList; + for( ; pt_drag; pt_drag = pt_drag->Pnext) + { + Track = pt_drag->m_Segm; + Track->SetState(EDIT,OFF); + Track->m_Flags = 0; + Track->Draw(DrawPanel, DC, draw_mode); + /* Test the connections modified by the move + (only pad connection must be tested, track connection will be tested by test_1_net_connexion() ) */ + int masque_layer = g_TabOneLayerMask[Track->m_Layer]; + Track->start = Fast_Locate_Pad_Connecte(m_Pcb, Track->m_Start, masque_layer); + Track->end = Fast_Locate_Pad_Connecte(m_Pcb, Track->m_End, masque_layer); + } + + EraseDragListe(); + + GetScreen()->SetModify(); + DrawPanel->ManageCurseur = NULL; + DrawPanel->ForceCloseManageCurseur = NULL; + + if ( current_net_code > 0 ) test_1_net_connexion(DC, current_net_code); + + return TRUE; +} + + +/************************************************************************/ +EDA_BaseStruct * LocateLockPoint(BOARD * Pcb, wxPoint pos, int LayerMask) +/************************************************************************/ +/* Routine trouvant le point " d'accrochage " d'une extremite de piste. + Ce point peut etre un PAD ou un autre segment de piste + Retourne: + - pointeur sur ce PAD ou: + - pointeur sur le segment ou: + - NULL + Parametres d'appel: + coord pX, pY du point tst + masque des couches a tester +*/ +{ +D_PAD * pt_pad; +TRACK * ptsegm; +MODULE * Module; + + /* detection du point type PAD */ + pt_pad = NULL; + Module = Pcb->m_Modules; + for( ; Module != NULL; Module = (MODULE*)Module->Pnext ) + { + pt_pad = Locate_Pads(Module, pos, LayerMask); + if (pt_pad) return(pt_pad); + } + + /* ici aucun pad n'a ete localise: detection d'un segment de piste */ + + ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask); + if( ptsegm == NULL ) + ptsegm = Locate_Pistes( Pcb->m_Track, pos, LayerMask); + return(ptsegm); +} + + +/******************************************************************************/ +TRACK * CreateLockPoint(int *pX, int *pY, TRACK * ptsegm, TRACK * refsegm) +/******************************************************************************/ +/* Routine de creation d'un point intermediaire sur un segment + le segment ptsegm est casse en 2 segments se raccordant au point pX, pY + retourne: + NULL si pas de nouveau point ( c.a.d si pX, pY correspondait deja + a une extremite ou: + pointeur sur le segment cree + si refsegm != NULL refsegm est pointeur sur le segment incident, + et le point cree est l'intersection des 2 axes des segments ptsegm et + refsegm + retourne la valeur exacte de pX et pY + Si ptsegm pointe sur une via: + retourne la valeur exacte de pX et pY et ptsegm, + mais ne cree pas de point supplementaire + +*/ +{ +int cX, cY; +int dx, dy; /* Coord de l'extremite du segm ptsegm / origine */ +int ox, oy, fx , fy; /* coord de refsegm / origine de prsegm */ +TRACK * NewTrack; + + if( (ptsegm->m_Start.x == *pX) && (ptsegm->m_Start.y == *pY) ) return(NULL); + if( (ptsegm->m_End.x == *pX) && (ptsegm->m_End.y == *pY) ) return(NULL); + + /* le point n'est pas sur une extremite de piste */ + if(ptsegm->m_StructType == TYPEVIA ) + { + *pX = ptsegm->m_Start.x; *pY = ptsegm->m_Start.y; + return(ptsegm); + } + /* calcul des coord vraies du point intermediaire dans le repere d'origine + = origine de ptsegm */ + cX = *pX - ptsegm->m_Start.x; + cY = *pY - ptsegm->m_Start.y; + dx = ptsegm->m_End.x - ptsegm->m_Start.x; + dy = ptsegm->m_End.y - ptsegm->m_Start.y; + +// ***** A COMPLETER : non utilise + if ( refsegm ) + { + ox = refsegm->m_Start.x - ptsegm->m_Start.x; + oy = refsegm->m_Start.y - ptsegm->m_Start.y; + fx = refsegm->m_End.x - ptsegm->m_Start.x; + fy = refsegm->m_End.y - ptsegm->m_Start.y; + } + + /* pour que le point soit sur le segment ptsegm: cY/cX = dy/dx */ + if ( dx == 0 ) cX = 0; /* segm horizontal */ + else cY = (cX * dy) / dx; + + /* creation du point intermediaire ( c'est a dire creation d'un nouveau + segment, debutant au point intermediaire */ + + cX += ptsegm->m_Start.x; cY += ptsegm->m_Start.y; + NewTrack = ptsegm->Copy(); + + NewTrack->Insert(NULL, ptsegm); + /* correction du pointeur de fin du nouveau segment */ + NewTrack->end = ptsegm->end; + + /* le segment primitif finit au nouveau point : */ + ptsegm->m_End.x = cX; ptsegm->m_End.y = cY; + ptsegm->SetState(END_ONPAD, OFF); + + /* le nouveau segment debute au nouveau point : */ + ptsegm = NewTrack;; + ptsegm->m_Start.x = cX; ptsegm->m_Start.y = cY; + ptsegm->SetState(BEGIN_ONPAD, OFF); + *pX = cX; *pY = cY; + + return(ptsegm); + +} + + diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 4a37d03776..d46aa53cf0 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -436,11 +436,10 @@ double * ptbuf; bufsize = 100; ptbuf = PolyEdges = (double*) MyZMalloc( bufsize * 2 * sizeof(double)); + setlocale(LC_NUMERIC, "C"); int LineNum = 0; while( GetLine(File, Line, &LineNum , sizeof(Line) -1) != NULL ) { - from_point(Line); - param1 = strtok(Line," =\n\r"); param2 = strtok(NULL," \t\n\r"); @@ -454,7 +453,6 @@ double * ptbuf; { while( GetLine(File, Line, &LineNum , sizeof(Line) -1) != NULL ) { - from_point(Line); param1 = strtok(Line," \t\n\r"); param2 = strtok(NULL," \t\n\r"); if ( strnicmp(param1, "$ENDCOORD", 8) == 0) break; @@ -488,6 +486,7 @@ double * ptbuf; PolyEdges = NULL; } fclose( File); + setlocale(LC_NUMERIC, ""); // revert to the current locale ShapeScaleX *= unitconv; ShapeScaleY *= unitconv; diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index f2016b1bb1..260eb5d0b9 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -289,7 +289,7 @@ wxString TextNameLibMod; wxString TextValeur; wxString TextCmpName; wxString NameLibCmp; -long TimeStamp = -1; +unsigned long TimeStamp = 0; int Error = 0; char Line[1024]; bool Found; @@ -307,8 +307,8 @@ bool Found; else TextValeur = CONV_FROM_UTF8(text); if( Error > 0 ) return( NULL ); - - TextTimeStamp.ToLong( &TimeStamp, 16); + + TextTimeStamp.ToULong( &TimeStamp, 16); /* Tst si composant deja charge */ Module = (MODULE*) m_Parent->m_Pcb->m_Modules; diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 13d90a914b..8cd5e1c687 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -25,6 +25,9 @@ #include "Delete_Line.xpm" #include "Delete_Track.xpm" #include "Move_Module.xpm" +#include "Move_Track_Segment.xpm" +#include "Drag_Track_Segment.xpm" +#include "Drag_Segment_WithSlope.xpm" #include "Drag_Module.xpm" #include "Edit_Module.xpm" #include "Rotate_Module+.xpm" @@ -47,6 +50,7 @@ #include "Width_Net.xpm" #include "Width_Track_Via.xpm" #include "Select_Layer_Pair.xpm" +#include "Footprint_Text.xpm" #include "Flag.xpm" @@ -55,32 +59,16 @@ /* local functions */ static void CreatePopupMenuForTracks(TRACK * Track, wxPoint CursorPosition, wxMenu * PopMenu); +static void CreatePopUpMenuForFootprints(MODULE * Footprint, wxMenu * menu, bool full_menu); +static void CreatePopUpMenuForFpTexts(TEXTE_MODULE * FpText, wxMenu * menu); +static void CreatePopUpMenuForPads(D_PAD * Pad, wxMenu * menu); +static void CreatePopUpMenuForTexts(TEXTE_PCB * Text, wxMenu * menu); +static void CreatePopUpBlockMenu(wxMenu * menu); + /*****/ -/*********************************************************************/ -static void AppendModuleOnRightClickMenu(wxMenu * menu, bool full_menu) -/*********************************************************************/ -/* Create the wxMenuitem list for module editing -*/ -{ - if ( full_menu ) - { - ADD_MENUITEM(menu, ID_POPUP_PCB_MOVE_MODULE_REQUEST, - _("Move Module (M)"), Move_Module_xpm) - ADD_MENUITEM(menu, ID_POPUP_PCB_DRAG_MODULE_REQUEST, - _("Drag Module (G)"), Drag_Module_xpm); - } - ADD_MENUITEM(menu, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, - _("Rotate Module + (R)"), rotate_module_pos_xpm); - ADD_MENUITEM(menu, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE, - _("Rotate Module -"), rotate_module_neg_xpm); - ADD_MENUITEM(menu, ID_POPUP_PCB_CHANGE_SIDE_MODULE, - _("Invert Module (S)"), invert_module_xpm); - ADD_MENUITEM(menu, ID_POPUP_PCB_EDIT_MODULE, - _("Edit Module"), Edit_Module_xpm); -} /********************************************/ static wxMenu * Append_Track_Width_List(void) @@ -129,7 +117,7 @@ double value; /****************************************************************************/ void WinEDA_PcbFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu) /****************************************************************************/ -/* Prepare le menu PullUp affiché par un click sur le bouton droit +/* Prepare le menu PopUp affiché par un click sur le bouton droit de la souris. Ce menu est ensuite complété par la liste des commandes de ZOOM */ @@ -177,23 +165,7 @@ wxClientDC dc(DrawPanel); if ( (DrawStruct && DrawStruct->m_Flags) || BlockActive ) { if ( BlockActive ) - { - ADD_MENUITEM(PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, - _("Cancel Block"), cancel_xpm ); - ADD_MENUITEM(PopMenu, ID_POPUP_ZOOM_BLOCK, - _("Zoom Block (Midd butt drag)"), zoom_selected_xpm ); - PopMenu->AppendSeparator(); - ADD_MENUITEM(PopMenu, ID_POPUP_PLACE_BLOCK, - _("Place Block"), apply_xpm ); - ADD_MENUITEM(PopMenu, ID_POPUP_COPY_BLOCK, - _("Copy Block (shift + drag mouse)"), copyblock_xpm ); - ADD_MENUITEM(PopMenu, ID_POPUP_INVERT_BLOCK, - _("Flip Block (alt + drag mouse)"), invert_module_xpm ); - ADD_MENUITEM(PopMenu, ID_POPUP_ROTATE_BLOCK, - _("Rotate Block (ctrl + drag mouse)"), rotate_pos_xpm ); - ADD_MENUITEM(PopMenu, ID_POPUP_DELETE_BLOCK, - _("Delete Block (shift+ctrl + drag mouse)"), delete_xpm ); - } + CreatePopUpBlockMenu(PopMenu); else { ADD_MENUITEM(PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, @@ -203,18 +175,27 @@ wxClientDC dc(DrawPanel); } } - if ( BlockActive ) goto out; + if ( BlockActive ) + { + DrawPanel->CursorOn(&dc); return; + } m_CurrentScreen->m_CurrentItem = DrawStruct; - + + if ( DrawStruct ) flags = DrawStruct->m_Flags; + else flags = 0; + if( !flags ) + { + ADD_MENUITEM(PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, + _("Footprint Get and Move (F)"), Move_Module_xpm); + } if ( DrawStruct ) { - flags = DrawStruct->m_Flags; switch ( DrawStruct->m_StructType ) { case TYPEMODULE: - if( !flags ) AppendModuleOnRightClickMenu(PopMenu, TRUE); - else AppendModuleOnRightClickMenu(PopMenu, FALSE); + if( !flags ) CreatePopUpMenuForFootprints((MODULE *) DrawStruct, PopMenu, TRUE); + else CreatePopUpMenuForFootprints((MODULE *) DrawStruct, PopMenu, FALSE); if (m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE) { @@ -233,13 +214,6 @@ wxClientDC dc(DrawPanel); if( !flags ) PopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _("Autoroute")); } - - if( !flags ) - { - PopMenu->AppendSeparator(); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_DELETE_MODULE, - _("Delete Module"), Delete_Module_xpm); - } break; case TYPEPAD: @@ -248,19 +222,11 @@ wxClientDC dc(DrawPanel); MODULE * Module = (MODULE *) DrawStruct->m_Parent; if (Module) { - AppendModuleOnRightClickMenu(PopMenu, TRUE); + CreatePopUpMenuForFootprints(Module, PopMenu, TRUE); PopMenu->AppendSeparator(); } - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, - _("Move Pad"), move_pad_xpm); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_DRAG_PAD_REQUEST, - _("Drag Pad"), drag_pad_xpm); } - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_EDIT_PAD, _("Edit Pad"), options_pad_xpm); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, - _("New Pad Settings"), options_new_pad_xpm); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, - _("Export Pad Settings"), Export_Options_Pad_xpm); + CreatePopUpMenuForPads( (D_PAD *)DrawStruct, PopMenu); if (m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE) { if( !flags ) @@ -269,15 +235,6 @@ wxClientDC dc(DrawPanel); PopMenu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _("Autoroute Net")); } } - - if( !flags ) - { - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_DELETE_PAD, - _("delete Pad"), Delete_Pad_xpm); - PopMenu->AppendSeparator(); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, - _("Global Pad Settings"), global_options_pad_xpm); - } break; case TYPETEXTEMODULE: @@ -286,19 +243,11 @@ wxClientDC dc(DrawPanel); MODULE * Module = (MODULE *) DrawStruct->m_Parent; if (Module) { - AppendModuleOnRightClickMenu(PopMenu, TRUE); + CreatePopUpMenuForFootprints(Module, PopMenu, TRUE); PopMenu->AppendSeparator(); } - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, - _("Move Text Mod."), Move_Field_xpm); - } - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, - _("Rotate Text Mod."), Rotate_Field_xpm); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, - _("Edit Text Mod."), edit_text_xpm); - if ( ((TEXTE_MODULE*)DrawStruct)->m_Type == TEXT_is_DIVERS) - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, - _("Delete Text Mod."), delete_xpm); + } + CreatePopUpMenuForFpTexts( (TEXTE_MODULE *) DrawStruct, PopMenu); break; case TYPEDRAWSEGMENT: @@ -327,17 +276,7 @@ wxClientDC dc(DrawPanel); break; case TYPETEXTE: - if( !flags ) - { - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, - _("Move Text"), move_text_xpm); - } - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_ROTATE_TEXTEPCB, - _("Rotate Text"), rotate_pos_xpm); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_EDIT_TEXTEPCB, - _("Edit Text"), edit_text_xpm); - ADD_MENUITEM(PopMenu, ID_POPUP_PCB_DELETE_TEXTEPCB, - _("Delete Text"), delete_text_xpm); + CreatePopUpMenuForTexts( (TEXTE_PCB *) DrawStruct, PopMenu); break; case TYPETRACK: @@ -387,14 +326,14 @@ wxClientDC dc(DrawPanel); case TYPEPCB: case PCB_EQUIPOT_STRUCT_TYPE: msg.Printf( - wxT("WinEDA_PcbFrame::OnRightClick Error: illegal DrawType %d"), + wxT("WinEDA_PcbFrame::OnRightClick() Error: illegal DrawType %d"), DrawStruct->m_StructType); DisplayError(this, msg ); break; default: msg.Printf( - wxT("WinEDA_PcbFrame::OnRightClick Error: unknown DrawType %d"), + wxT("WinEDA_PcbFrame::OnRightClick() Error: unknown DrawType %d"), DrawStruct->m_StructType); DisplayError(this, msg ); break; @@ -513,9 +452,33 @@ wxClientDC dc(DrawPanel); break; } - out: + DrawPanel->CursorOn(&dc); } + + +/****************************************/ +void CreatePopUpBlockMenu(wxMenu * menu) +/****************************************/ +/* Create Pop sub menu for block commands +*/ +{ + ADD_MENUITEM(menu, ID_POPUP_CANCEL_CURRENT_COMMAND, + _("Cancel Block"), cancel_xpm ); + ADD_MENUITEM(menu, ID_POPUP_ZOOM_BLOCK, + _("Zoom Block (Midd butt drag)"), zoom_selected_xpm ); + menu->AppendSeparator(); + ADD_MENUITEM(menu, ID_POPUP_PLACE_BLOCK, + _("Place Block"), apply_xpm ); + ADD_MENUITEM(menu, ID_POPUP_COPY_BLOCK, + _("Copy Block (shift + drag mouse)"), copyblock_xpm ); + ADD_MENUITEM(menu, ID_POPUP_INVERT_BLOCK, + _("Flip Block (alt + drag mouse)"), invert_module_xpm ); + ADD_MENUITEM(menu, ID_POPUP_ROTATE_BLOCK, + _("Rotate Block (ctrl + drag mouse)"), rotate_pos_xpm ); + ADD_MENUITEM(menu, ID_POPUP_DELETE_BLOCK, + _("Delete Block (shift+ctrl + drag mouse)"), delete_xpm ); +} /********************************************************************/ @@ -558,6 +521,14 @@ int flags = Track->m_Flags; } else { + ADD_MENUITEM(PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE, + _("Drag Segments, keep slope"), drag_segment_withslope_xpm); + ADD_MENUITEM(PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT, + _("Drag Segment"), drag_track_segment_xpm); +#if 0 + ADD_MENUITEM(PopMenu, ID_POPUP_PCB_MOVE_TRACK_SEGMENT, + _("Move Segment"), move_track_segment_xpm); +#endif ADD_MENUITEM(PopMenu, ID_POPUP_PCB_BREAK_TRACK, _("Break Track"), Break_Line_xpm); } @@ -630,3 +601,159 @@ int flags = Track->m_Flags; track_mnu->Append(ID_POPUP_PCB_LOCK_OFF_NET, _("Net Locked: No")); } } + +/*********************************************************************************/ +void CreatePopUpMenuForFootprints(MODULE * Module, wxMenu * menu, bool full_menu) +/*********************************************************************************/ +/* Create the wxMenuitem list for footprint editing +*/ +{ +wxMenu * sub_menu_footprint; +wxString msg; +int flags = Module->m_Flags; + + msg = _("Footprint"); + msg << wxT(" ") << Module->m_Reference->m_Text; + + sub_menu_footprint = new wxMenu; + ADD_MENUITEM_WITH_SUBMENU(menu, sub_menu_footprint, -1, msg, module_xpm) + if ( full_menu ) + { + ADD_MENUITEM(sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST, + _("Move (M)"), Move_Module_xpm) + ADD_MENUITEM(sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST, + _("Drag (G)"), Drag_Module_xpm); + } + ADD_MENUITEM(sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, + _("Rotate + (R)"), rotate_module_pos_xpm); + ADD_MENUITEM(sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE, + _("Rotate -"), rotate_module_neg_xpm); + ADD_MENUITEM(sub_menu_footprint, ID_POPUP_PCB_CHANGE_SIDE_MODULE, + _("Flip (S)"), invert_module_xpm); + ADD_MENUITEM(sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, + _("Edit"), Edit_Module_xpm); + + if( !flags ) + { + sub_menu_footprint->AppendSeparator(); + ADD_MENUITEM(sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, + _("Delete Module"), Delete_Module_xpm); + } +} + + +/********************************************************************/ +void CreatePopUpMenuForFpTexts(TEXTE_MODULE * FpText, wxMenu * menu) +/********************************************************************/ +/* Create the wxMenuitem list for editing texts on footprints +*/ +{ +wxMenu * sub_menu_Fp_text; +wxString msg; +int flags = FpText->m_Flags; + + switch ( FpText->m_Type ) + { + case TEXT_is_REFERENCE: + msg = _("Footprint ref"); + break; + + case TEXT_is_VALUE: + msg = _("Footprint value"); + break; + + default: + msg = _("Footprint text"); + break; + } + msg << wxT(" ") << FpText->m_Text; + + sub_menu_Fp_text = new wxMenu; + ADD_MENUITEM_WITH_SUBMENU(menu, sub_menu_Fp_text, -1, msg, footprint_text_xpm) + + if( !flags ) + ADD_MENUITEM(sub_menu_Fp_text, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, + _("Move"), Move_Field_xpm); + + ADD_MENUITEM(sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE, + _("Rotate"), Rotate_Field_xpm); + ADD_MENUITEM(sub_menu_Fp_text, ID_POPUP_PCB_EDIT_TEXTMODULE, + _("Edit"), edit_text_xpm); + if ( FpText->m_Type == TEXT_is_DIVERS) + ADD_MENUITEM(sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE, + _("Delete"), delete_xpm); +} + + +/***************************************************************/ +void CreatePopUpMenuForPads( D_PAD * Pad, wxMenu * menu) +/***************************************************************/ +/* Create pop menu for pads */ +{ +wxMenu * sub_menu_Pad; +wxString msg; +int flags = Pad->m_Flags; + + msg = _("Pad"); + msg << wxT(" ") << Pad->ReturnStringPadName(); + + sub_menu_Pad = new wxMenu; + ADD_MENUITEM_WITH_SUBMENU(menu, sub_menu_Pad, -1, msg, pad_xpm) + if( !flags ) + { + ADD_MENUITEM(sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST, + _("Move"), move_pad_xpm); + ADD_MENUITEM(sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, + _("Drag"), drag_pad_xpm); + } + ADD_MENUITEM(sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _("Edit Pad"), options_pad_xpm); + sub_menu_Pad->AppendSeparator(); + ADD_MENUITEM(sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, + _("New Pad Settings"), options_new_pad_xpm); + ADD_MENUITEM(sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, + _("Export Pad Settings"), Export_Options_Pad_xpm); + + if( !flags ) + { + ADD_MENUITEM(sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, + _("Global Pad Settings"), global_options_pad_xpm); + sub_menu_Pad->AppendSeparator(); + ADD_MENUITEM(sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD, + _("delete"), Delete_Pad_xpm); + } +} + + +/*************************************************************/ +void CreatePopUpMenuForTexts(TEXTE_PCB * Text, wxMenu * menu) +/*************************************************************/ +/* Create pop menu for pcb texts */ +{ +wxMenu * sub_menu_Text; +wxString msg; +int flags = Text->m_Flags; + + msg = _("Pcb Text");msg << wxT(" "); + if ( Text->m_Text.Len() < 8 ) + msg << Text->m_Text; + else + msg += Text->m_Text.Left(5) + wxT(".."); + + sub_menu_Text = new wxMenu; + ADD_MENUITEM_WITH_SUBMENU(menu, sub_menu_Text, -1, msg, add_text_xpm) + + if( !flags ) + { + ADD_MENUITEM(sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, + _("Move"), move_text_xpm); + } + ADD_MENUITEM(sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, + _("Rotate"), rotate_pos_xpm); + ADD_MENUITEM(sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, + _("Edit"), edit_text_xpm); + + sub_menu_Text->AppendSeparator(); + ADD_MENUITEM(sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB, + _("Delete"), delete_text_xpm); +} + diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index b652a6d3f8..d04676dc25 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -210,7 +210,6 @@ eda_global int Texte_Module_Type; /* pistes , vias , pads*/ /***********************/ -#define NO_TST_LAYER -1 /* parametre de Locate_Pistes(): suppression tst layer */ #define L_MIN_DESSIN 1 /* seuil de largeur des pistes pour trace autre que filaire */ // Current designe settings: diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 297acf6c1b..7970853f8c 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -566,7 +566,7 @@ wxString ext; } } - Close(true); +// Close(true); } diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp index 76e9000435..c9899f4ed4 100644 --- a/pcbnew/plotps.cpp +++ b/pcbnew/plotps.cpp @@ -556,8 +556,11 @@ int x0, y0, x1, y1, w; RotatePoint(&x1,&y1, centre.x, centre.y, orient); fprintf(dest,"0 setlinewidth 0 setlinecap 0 setlinejoin\n"); + ForcePenReinit(); // Force init line width for PlotFilledSegmentPS PlotFilledSegmentPS(wxPoint(x0, y0), wxPoint(x1, y1), w); - fprintf(dest,"%d setlinewidth 1 setlinecap 1 setlinejoin\n", g_PlotLine_Width); + ForcePenReinit(); + SetCurrentLineWidthPS(0); // Force init line width to default + fprintf(dest,"1 setlinecap 1 setlinejoin\n"); } else { @@ -691,7 +694,7 @@ int l_pen; /* diam spot (plume) */ polygone[ii].x += centre.x; polygone[ii].y += centre.y; } - fprintf(dest,"%d setlinewidth\n", l_pen) ; + SetCurrentLineWidthPS( l_pen); UserToDeviceCoordinate(polygone[0]); fprintf(dest,"newpath %d %d moveto\n", polygone[0].x, polygone[0].y); diff --git a/pcbnew/protos.h b/pcbnew/protos.h index 4361029654..3d2c6ea11a 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -63,9 +63,6 @@ void Trace_Pads_Only(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module, int o Les pads affiches doivent apparaitre sur les couches donnees par MasqueLayer */ -void Affiche_1_Segment(WinEDA_DrawPanel * panel, wxDC * DC, int ux0, int uy0, int dx, int dy, - int width, int mode, int color); - /****************/ /* LOCATE.CPP : */ /****************/ @@ -76,7 +73,7 @@ MODULE * ReturnModule(BOARD * Pcb, const wxString & name); D_PAD * ReturnPad(MODULE * Module, const wxString & name); /* Recherche d'un pad par son nom, pour le module Module */ -TRACK * Locate_Via(BOARD * Pcb, const wxPoint & pos, int layer); +TRACK * Locate_Via(BOARD * Pcb, const wxPoint & pos, int layer = -1); TRACK * Fast_Locate_Via(TRACK *start_adr, TRACK* end_adr, const wxPoint & pos, int masquelayer); @@ -183,9 +180,9 @@ TRACK * Locate_Pistes(TRACK * start_adresse, int typeloc); /* routine de localisation du segment de piste pointe par la souris La recherche commence a l'adresse start_adresse */ -DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int typeloc) ; +DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int LayerSearch , int typeloc) ; -TEXTE_PCB * Locate_Texte_Pcb(EDA_BaseStruct * PtStruct, int typeloc); +TEXTE_PCB * Locate_Texte_Pcb(EDA_BaseStruct * PtStruct, int LayerSearch , int typeloc); /* localisation des inscriptions sur le Pcb: la recherche se fait a partir de l'adresse pr_texte */ @@ -231,7 +228,7 @@ TRACK * Locate_Zone(TRACK * start_adresse, const wxPoint & ref_pos,int layer); La recherche commence a l'adresse start_adresse */ -EDA_BaseStruct * Locate_Cotation(BOARD * Pcb, int typeloc); +EDA_BaseStruct * Locate_Cotation(BOARD * Pcb, int LayerSearch, int typeloc); /* Localise un element de cotation, en priorite sur la couche active, et a defaut sur les autres couches retourne un pointeur sur l'element (TRACK ou TEXTE_PCB) localise diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 7915c57fd3..f4bd840a46 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -164,7 +164,7 @@ LISTE_PAD * pt_liste_pad_tmp, g_pt_chevelu->pad_start->m_Pos.y, g_pt_chevelu->pad_end->m_Pos.x, g_pt_chevelu->pad_end->m_Pos.y, - g_DesignSettings.m_RatsnestColor) ; + 0, g_DesignSettings.m_RatsnestColor) ; g_pt_chevelu++ ; } @@ -262,7 +262,7 @@ D_PAD * ref_pad, * pad; g_pt_chevelu->pad_start->m_Pos.y, g_pt_chevelu->pad_end->m_Pos.x, g_pt_chevelu->pad_end->m_Pos.y, - g_DesignSettings.m_RatsnestColor); + 0, g_DesignSettings.m_RatsnestColor); } g_pt_chevelu++ ; } @@ -428,7 +428,7 @@ EQUIPOT * equipot; if ( DC ) GRLine(&DrawPanel->m_ClipBox, DC, Chevelu->pad_start->m_Pos.x, Chevelu->pad_start->m_Pos.y, Chevelu->pad_end->m_Pos.x, Chevelu->pad_end->m_Pos.y, - g_DesignSettings.m_RatsnestColor); + 0, g_DesignSettings.m_RatsnestColor); } } @@ -473,7 +473,7 @@ CHEVELU * Chevelu; GRLine(&DrawPanel->m_ClipBox, DC, Chevelu->pad_start->m_Pos.x, Chevelu->pad_start->m_Pos.y, Chevelu->pad_end->m_Pos.x, Chevelu->pad_end->m_Pos.y, - g_DesignSettings.m_RatsnestColor); + 0, g_DesignSettings.m_RatsnestColor); } } } @@ -1094,7 +1094,7 @@ int ii; local_chevelu->pad_start->m_Pos.y - g_Offset_Module.y, local_chevelu->pad_end->m_Pos.x - g_Offset_Module.x, local_chevelu->pad_end->m_Pos.y - g_Offset_Module.y, - YELLOW); + 0, YELLOW); } else { @@ -1103,7 +1103,7 @@ int ii; local_chevelu->pad_start->m_Pos.y - g_Offset_Module.y, local_chevelu->pad_end->m_Pos.x, local_chevelu->pad_end->m_Pos.y, - g_DesignSettings.m_RatsnestColor); + 0, g_DesignSettings.m_RatsnestColor); } local_chevelu++; } @@ -1246,7 +1246,8 @@ int refX, refY; for( ii = 0; ii < nb_local_chevelu; ii++) { if ( ii >= g_MaxLinksShowed ) break; - GRLine(&DrawPanel->m_ClipBox, DC, refX, refY, *pt_coord, *(pt_coord+1), YELLOW); + GRLine(&DrawPanel->m_ClipBox, DC, refX, refY, *pt_coord, *(pt_coord+1), + 0, YELLOW); pt_coord += 2; } } diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 7be0ac3e20..26ed71c07f 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -65,7 +65,6 @@ int layer; WinEDA_SelLayerFrame * frame = new WinEDA_SelLayerFrame(this, default_layer,min_layer, max_layer); layer = frame->ShowModal(); frame->Destroy(); - DrawPanel->MouseToCursorSchema(); return layer; } diff --git a/pcbnew/set_color.cpp b/pcbnew/set_color.cpp index 8e44319c58..06d3559835 100644 --- a/pcbnew/set_color.cpp +++ b/pcbnew/set_color.cpp @@ -714,7 +714,7 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y; if ( color < 0) return; for ( ii = 0; laytool_list[ii] != NULL; ii++ ) - { + { if( laytool_list[ii]->m_Id != id) continue; if( laytool_list[ii]->m_Color == NULL) continue; @@ -740,10 +740,11 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y; iconDC.SetBrush(Brush); iconDC.DrawRectangle(0,0, w, h); + Button->SetBitmapLabel(ButtBitmap); Button->Refresh(); SetDisplayOnOff(event); m_Parent->m_CurrentScreen->SetRefreshReq(); - } + } Refresh(FALSE); } diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp index 3ab7174a42..201e3151a7 100644 --- a/pcbnew/solve.cpp +++ b/pcbnew/solve.cpp @@ -233,7 +233,7 @@ wxString msg; segm_fY = m_Pcb->m_BoundaryBox.m_Pos.y + (g_GridRoutingSize * row_target); /* Affiche Liaison */ - GRLine(&DrawPanel->m_ClipBox, DC, segm_oX, segm_oY, segm_fX, segm_fY, WHITE | GR_XOR); + GRLine(&DrawPanel->m_ClipBox, DC, segm_oX, segm_oY, segm_fX, segm_fY, 0, WHITE | GR_XOR); pt_cur_ch->pad_start->Draw(DrawPanel, DC, wxPoint(0,0), GR_OR | GR_SURBRILL); pt_cur_ch->pad_end->Draw(DrawPanel, DC, wxPoint(0,0), GR_OR|GR_SURBRILL); @@ -474,7 +474,7 @@ wxString msg; { /* Efface Liaison */ GRSetDrawMode(DC, GR_XOR); - GRLine(&pcbframe->DrawPanel->m_ClipBox, DC, segm_oX, segm_oY, segm_fX, segm_fY, WHITE); + GRLine(&pcbframe->DrawPanel->m_ClipBox, DC, segm_oX, segm_oY, segm_fX, segm_fY, 0, WHITE); /* Generation de la trace */ if( Retrace(pcbframe, DC, row_source, col_source, diff --git a/pcbnew/surbrill.cpp b/pcbnew/surbrill.cpp index 74f080644d..1e675b2b26 100644 --- a/pcbnew/surbrill.cpp +++ b/pcbnew/surbrill.cpp @@ -17,6 +17,63 @@ static void Pad_Surbrillance(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Modul /* variables locales : */ static int draw_mode ; + +/*********************************************************/ +void WinEDA_PcbFrame::Liste_Equipot(wxCommandEvent & event) +/*********************************************************/ +/* Display a filtered list of equipot names + if an equipot is selected the corresponding tracks and pads are highlighted +*/ +{ +EQUIPOT * Equipot ; +wxString msg; +WinEDA_TextFrame * List; +int ii, jj; + + msg = wxT("*"); + Get_Message(_("Filter for net names:"),msg, this); + if ( msg.IsEmpty() ) return; + + List = new WinEDA_TextFrame(this, _("List Nets") ); + + Equipot = (EQUIPOT*) m_Pcb->m_Equipots; + for ( ; Equipot != NULL; Equipot = (EQUIPOT*)Equipot->Pnext ) + { + wxString Line; + /* calcul adr relative du nom de la pastille reference de la piste */ + if( ! WildCompareString(msg, Equipot->m_Netname, FALSE ) ) continue ; + + Line.Printf( wxT("net_code = %3.3d [%.16s] "),Equipot->m_NetCode, + Equipot->m_Netname.GetData()); + List->Append(Line); + } + ii = List->ShowModal(); List->Destroy(); + if (ii < 0) return; + + /* Recherche du numero de net rellement selectionné */ + Equipot = (EQUIPOT*) m_Pcb->m_Equipots; + for ( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*)Equipot->Pnext ) + { + /* calcul adr relative du nom de la pastille reference de la piste */ + if( ! WildCompareString(msg, Equipot->m_Netname, FALSE) ) continue ; + if ( ii == jj ) + { + ii = Equipot->m_NetCode; + break; + } + jj++; + } + + +wxClientDC dc(DrawPanel); + DrawPanel->PrepareGraphicContext(&dc); + + if(g_HightLigt_Status) Hight_Light(&dc); + g_HightLigth_NetCode = ii; + Hight_Light(&dc); +} + + /**************************************************/ int WinEDA_PcbFrame::Select_High_Light(wxDC * DC) /**************************************************/ @@ -66,29 +123,26 @@ void WinEDA_PcbFrame::Hight_Light(wxDC * DC) /****************************************************************/ void WinEDA_PcbFrame::DrawHightLight(wxDC * DC, int NetCode) /****************************************************************/ -/* Met ou supprime la surbrillance d'un net de nom NetName +/* Turn On or OFF the HightLight for trcak and pads with the netcode "NetCode' */ { TRACK * pts ; MODULE * Module; -PCB_SCREEN * OldScreen = (PCB_SCREEN *) ActiveScreen; if(g_HightLigt_Status ) draw_mode = GR_SURBRILL | GR_OR; else draw_mode = GR_AND | GR_SURBRILL; Module = m_Pcb->m_Modules; - /* Surbrillance des Pastilles : */ - + /* Redraw pads */ for( ; Module != NULL; Module = (MODULE*) Module->Pnext ) { Pad_Surbrillance(DrawPanel, DC, Module, NetCode) ; } - /* Surbrillance des pistes : */ + /* Redraw track and vias: */ for ( pts = m_Pcb->m_Track; pts != NULL; pts = (TRACK*) pts->Pnext) { - /* est ce que la piste fait partie du net ? : */ if( pts->m_NetCode == NetCode ) { pts->Draw(DrawPanel, DC, draw_mode); diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp new file mode 100644 index 0000000000..094db8a301 --- /dev/null +++ b/pcbnew/swap_layers.cpp @@ -0,0 +1,230 @@ + /*******************************/ + /* Dialog frame to swap layers */ + /*******************************/ + + /* Fichier swap_layers */ + +#include "fctsys.h" +#include "common.h" +#include "pcbnew.h" + +#include "protos.h" + +/* Variables locales */ +static int New_Layer[32]; + +enum swap_layer_id { + ID_SWAP_LAYER_EXECUTE = 1800, + ID_SWAP_LAYER_CANCEL, + ID_SWAP_LAYER_BUTTON_SELECT, + ID_SWAP_LAYER_DESELECT, + ID_SWAP_LAYER_SELECT +}; + + +/***********************************************/ +/* classe pour la frame de selection de layers */ +/***********************************************/ + +class WinEDA_SwapLayerFrame: public wxDialog +{ +private: + WinEDA_BasePcbFrame *m_Parent; + wxRadioBox * m_LayerList; + +public: + + // Constructor and destructor + WinEDA_SwapLayerFrame(WinEDA_BasePcbFrame *parent); + ~WinEDA_SwapLayerFrame(void) {}; + +private: + void Sel_Layer(wxCommandEvent& event); + void Cancel(wxCommandEvent& event); + void Execute(wxCommandEvent& event); + DECLARE_EVENT_TABLE() + +}; +/* Table des evenements pour WinEDA_SwapLayerFrame */ +BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog) + EVT_BUTTON(ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute) + EVT_BUTTON(ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel) + EVT_BUTTON(ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer) + EVT_BUTTON(ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) + EVT_RADIOBOX(ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) +END_EVENT_TABLE() + + +/*************************************************************************/ +WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_BasePcbFrame *parent): + wxDialog(parent, -1, _("Swap Layers:"),wxPoint(-1,-1), + wxSize(470, 450), DIALOG_STYLE ) +/*************************************************************************/ +{ +#define START_Y 15 +wxButton * Button; +int ii; +wxPoint pos; +wxString g_Layer_Name_Pair[32]; +wxSize winsize; + + m_Parent = parent; + SetFont(*g_DialogFont); + + for ( ii = 0; ii < NB_LAYERS; ii++ ) + { + g_Layer_Name_Pair[ii] = ReturnPcbLayerName(ii) + wxT(" -> ") + _("No Change"); + } + pos.x = 5; pos.y = START_Y; + m_LayerList = new wxRadioBox(this, ID_SWAP_LAYER_SELECT, _("Layers"), + pos, wxSize(-1,-1), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS); + + winsize.y = m_LayerList->GetRect().GetBottom(); + + pos.x = m_LayerList->GetRect().GetRight() + 12; + Button = new wxButton(this,ID_SWAP_LAYER_CANCEL, + _("Cancel"), pos); + Button->SetForegroundColour(*wxRED); + winsize.x = MAX(winsize.x,Button->GetRect().GetRight()); + + pos.y += Button->GetSize().y + 5; + Button = new wxButton(this,ID_SWAP_LAYER_EXECUTE, + _("OK"), pos); + Button->SetForegroundColour(*wxBLUE); + winsize.x = MAX(winsize.x,Button->GetRect().GetRight()); + + pos.y += Button->GetSize().y + 15; + Button = new wxButton(this,ID_SWAP_LAYER_DESELECT, + _("Deselect"), pos); + Button->SetForegroundColour(wxColour(0,100,0)); + winsize.x = MAX(winsize.x,Button->GetRect().GetRight()); + + pos.y += Button->GetSize().y + 5; + Button = new wxButton(this,ID_SWAP_LAYER_BUTTON_SELECT, + _("Select"), pos); + Button->SetForegroundColour(wxColour(0,100,100)); + winsize.x = MAX(winsize.x,Button->GetRect().GetRight()); + + winsize.x += 10; winsize.y += 10; + SetClientSize(winsize); + +} + + +/***************************************************************/ +void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event) +/***************************************************************/ +{ + int ii, jj; + + ii = m_LayerList->GetSelection(); + + switch ( event.GetId()) + { + case ID_SWAP_LAYER_DESELECT: + if ( New_Layer[ii] != -1 ) + { + New_Layer[ii] = -1; + m_LayerList->SetString(ii, ReturnPcbLayerName(ii) + + + wxT(" -> ") + _("No Change") ); + } + break; + + case ID_SWAP_LAYER_BUTTON_SELECT: + case ID_SWAP_LAYER_SELECT: + jj = m_Parent->SelectLayer(ii, -1, -1); + if ( (jj < 0) || (jj >= 29) ) return; + + if ( ii != jj ) + { + New_Layer[ii] = jj; + m_LayerList->SetString(ii, + ReturnPcbLayerName(ii) + wxT(" -> ") + ReturnPcbLayerName(jj) ); + } + break; + } +} + +/*********************************************************/ +void WinEDA_SwapLayerFrame::Cancel(wxCommandEvent& event) +/*********************************************************/ +{ + EndModal(-1); +} + +/*********************************************************/ +void WinEDA_SwapLayerFrame::Execute(wxCommandEvent& event) +/*********************************************************/ +{ + EndModal(1); +} + + +/********************************************************/ +void WinEDA_PcbFrame::Swap_Layers(wxCommandEvent & event) +/********************************************************/ +/* Swap layers */ +{ +int ii, jj ; +TRACK * pt_segm ; +DRAWSEGMENT * pt_drawsegm; +EDA_BaseStruct * PtStruct; + + + /* Init default values */ + for ( ii = 0 ; ii < 32 ; ii++ ) New_Layer[ii] = -1 ; + +WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this); + ii = frame->ShowModal(); frame->Destroy(); + + if ( ii != 1 ) return; + + /* Modifications des pistes */ + pt_segm = (TRACK*) m_Pcb->m_Track; + for ( ; pt_segm != NULL;pt_segm = (TRACK*)pt_segm->Pnext ) + { + m_CurrentScreen->SetModify(); + if( pt_segm->m_StructType == TYPEVIA ) + { + SEGVIA * Via = (SEGVIA *) pt_segm; + if ( Via->Shape() == VIA_NORMALE ) continue; + int top_layer, bottom_layer; + Via->ReturnLayerPair(&top_layer, &bottom_layer); + if( New_Layer[bottom_layer] >= 0) + bottom_layer = New_Layer[bottom_layer]; + if( New_Layer[top_layer] >= 0) + top_layer = New_Layer[top_layer]; + Via->SetLayerPair(top_layer, bottom_layer); + } + else + { + jj = pt_segm->m_Layer; + if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj]; + } + } + + /* Modifications des zones */ + pt_segm = (TRACK*) m_Pcb->m_Zone; + for ( ; pt_segm != NULL;pt_segm = (TRACK*)pt_segm->Pnext ) + { + m_CurrentScreen->SetModify(); + jj = pt_segm->m_Layer; + if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj]; + } + + /* Modifications des autres segments */ + PtStruct = m_Pcb->m_Drawings; + for ( ; PtStruct != NULL ; PtStruct = PtStruct->Pnext ) + { + if( PtStruct->m_StructType == TYPEDRAWSEGMENT ) + { + m_CurrentScreen->SetModify(); + pt_drawsegm = (DRAWSEGMENT *) PtStruct; + jj = pt_drawsegm->m_Layer; + if( New_Layer[jj] >= 0) pt_drawsegm->m_Layer = New_Layer[jj]; + } + } + DrawPanel->Refresh(TRUE); +} + + diff --git a/pcbnew/tracemod.cpp b/pcbnew/tracemod.cpp index dc078ba528..ef55d7f635 100644 --- a/pcbnew/tracemod.cpp +++ b/pcbnew/tracemod.cpp @@ -64,26 +64,3 @@ WinEDA_BasePcbFrame * frame; frame->m_DisplayPadFill = tmp; } - -/***********************************************************************/ -void Affiche_1_Segment(WinEDA_DrawPanel * panel, wxDC * DC, - int ux0, int uy0, int dx, int dy, - int width, int mode, int color) -/***********************************************************************/ -/* Trace un segment origine ux0,uy0, fin en dx, dy, - largeur l_piste, mode FILL ou SKETCH, en couleur color - Les coord sont en 1/10000 pouce -*/ -{ -int zoom = panel->GetZoom(); - - if( (width/zoom) < L_MIN_DESSIN ) - GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, color) ; - - else - if( mode == SKETCH) - GRCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, width, color) ; - - else GRFillCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, width, color) ; -} - diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 0cfc83eac1..303a629052 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -42,7 +42,7 @@ PCB_SCREEN * screen = GetScreen(); if ( EraseBg ) DrawPanel->EraseScreen(DC); DrawPanel->DrawBackGround(DC); - TraceWorkSheet(DC, screen); + TraceWorkSheet(DC, screen, 0); Module = (MODULE*) m_Pcb->m_Modules; for ( ; Module != NULL; Module = (MODULE *) Module->Pnext ) @@ -81,7 +81,7 @@ PCB_SCREEN * Screen = GetScreen(); DrawPanel->DrawBackGround(DC); Trace_Pcb(DC, GR_OR); - TraceWorkSheet(DC, GetScreen()); + TraceWorkSheet(DC, GetScreen(), 0); Affiche_Status_Box(); /* Reaffichage des curseurs */ diff --git a/pcbnew/trpiste.cpp b/pcbnew/trpiste.cpp index dd071a3812..feca67a49e 100644 --- a/pcbnew/trpiste.cpp +++ b/pcbnew/trpiste.cpp @@ -143,7 +143,8 @@ int rayon; break; default: - if( mode == FILAIRE) GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, color) ; + if( mode == FILAIRE) + GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color) ; else if( mode == SKETCH) { GRCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 60f394a622..0f4a99f85e 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -545,17 +545,14 @@ D_PAD * pt_pad, * pt_old_pad; } - /*****************************************/ - /* static void Sel_NewMod_By_Liste(void) */ - /*****************************************/ - -/*affiche la liste des modules en librairie et selectione 1 nom */ - +/***************************************************************************/ void WinEDA_ExchangeModuleFrame::Sel_NewMod_By_Liste(wxCommandEvent& event) +/***************************************************************************/ +/*affiche la liste des modules en librairie et selectione 1 nom */ { wxString newname; - newname = m_Parent->Select_1_Module_From_List(this, wxEmptyString, wxEmptyString, wxEmptyString); + newname = m_Parent->Select_1_Module_From_List( m_Parent, wxEmptyString, wxEmptyString, wxEmptyString); if ( newname != wxEmptyString ) m_NewModule->SetValue(newname); } diff --git a/pcbnew/zones.cpp b/pcbnew/zones.cpp index 329c54d9a3..8613c6c008 100644 --- a/pcbnew/zones.cpp +++ b/pcbnew/zones.cpp @@ -47,7 +47,7 @@ static bool Zone_45_Only = FALSE; static bool Zone_Exclude_Pads = TRUE; static bool Zone_Genere_Freins_Thermiques = TRUE; -static int TimeStamp; /* signature temporelle pour la zone generee */ +static unsigned long s_TimeStamp; /* signature temporelle pour la zone generee */ /*! * WinEDA_ZoneFrame type definition @@ -328,7 +328,7 @@ void WinEDA_PcbFrame::Edit_Zone_Width(wxDC * DC, SEGZONE * Zone) */ { SEGZONE * pt_segm, * NextS ; -int TimeStamp; +unsigned long TimeStamp; bool modify = FALSE; double f_new_width; int w_tmp; @@ -376,7 +376,7 @@ void WinEDA_PcbFrame::Delete_Zone(wxDC * DC, SEGZONE * Zone) */ { SEGZONE * pt_segm, * NextS ; -int TimeStamp; +unsigned long TimeStamp; int nb_segm = 0; bool modify = FALSE; @@ -757,7 +757,7 @@ wxString msg; Trace_DrawSegmentPcb(DrawPanel, DC, PtLim, GR_XOR); } - TimeStamp = time( NULL ); + s_TimeStamp = time( NULL ); /* Calcul du pas de routage fixe a 5 mils et plus */ E_scale = g_GridRoutingSize / 50 ; if (g_GridRoutingSize < 1 ) g_GridRoutingSize = 1 ; @@ -975,7 +975,7 @@ wxString msg; pt_track->m_Width = g_GridRoutingSize; pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0; pt_track->m_End.x = ux1; pt_track->m_End.y = uy1; - pt_track->m_TimeStamp = TimeStamp; + pt_track->m_TimeStamp = s_TimeStamp; pt_track->Insert(frame->m_Pcb, NULL); pt_track->Draw(frame->DrawPanel, DC, GR_OR); nbsegm++; @@ -1010,7 +1010,7 @@ wxString msg; pt_track->m_NetCode = net_code; pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0; pt_track->m_End.x = ux1; pt_track->m_End.y = uy1; - pt_track->m_TimeStamp = TimeStamp; + pt_track->m_TimeStamp = s_TimeStamp; pt_track->Insert(frame->m_Pcb, NULL); pt_track->Draw(frame->DrawPanel, DC, GR_OR); nbsegm++; @@ -1175,7 +1175,7 @@ int sommet[4][2]; wxString msg; if( frame->m_Pcb->m_Zone == NULL ) return FALSE; /* pas de zone */ - if( frame->m_Pcb->m_Zone->m_TimeStamp != TimeStamp ) /* c'est une autre zone */ + if( frame->m_Pcb->m_Zone->m_TimeStamp != s_TimeStamp ) /* c'est une autre zone */ return FALSE; /* Calcul du nombre de pads a traiter et affichage */ @@ -1239,7 +1239,7 @@ wxString msg; pt_track->m_Start.x = cX; pt_track->m_Start.y = cY; pt_track->m_End.x = cX + sommet[jj][0]; pt_track->m_End.y = cY + sommet[jj][1]; - pt_track->m_TimeStamp = TimeStamp; + pt_track->m_TimeStamp = s_TimeStamp; /* tst si trace possible */ if( Drc(frame, DC, pt_track,frame->m_Pcb->m_Track,0) == BAD_DRC ) @@ -1249,7 +1249,7 @@ wxString msg; /* on doit pouvoir se connecter sur la zone */ loctrack = Locate_Zone(frame->m_Pcb->m_Zone,pt_track->m_End, layer); - if( (loctrack == NULL) || (loctrack->m_TimeStamp != TimeStamp) ) + if( (loctrack == NULL) || (loctrack->m_TimeStamp != s_TimeStamp) ) { delete pt_track; continue; } diff --git a/regex_doc.txt b/regex_doc.txt new file mode 100644 index 0000000000..3316f26102 --- /dev/null +++ b/regex_doc.txt @@ -0,0 +1,60 @@ +Regular expression +Tutorial du 1 mars 2005 - Aurélien Jarno +I - Significations des métacaractères : + + * \ sert à protéger un caractère, au cas où il aurait une autre interprétation possible. + Comme en C, il précède les caractères n, t, ... pour désigner la fin de ligne (\n), une tabulation (\t), etc .. + + * [ ] sert à désigner un ensemble de caractères à reconnaitre: + o [fa]oo par exemple recherche les chaines formées par f, ou a, suivi de "oo", soit foo ou bien aoo + o [a-z] représente l'ensemble des lettres minuscules + o [0-9] représente l'ensemble des chiffres + o [^O] le symbole ^ négative l'expression. Donc ici on cherche n'importe quelle lettre, O étant exclus. + o [^0-9] recherche n'importe quel caractère autre que numérique. + o [:alpha:] représente l'ensemble des caractères alphabétiques, donc [[:alpha:]] est équivalent à [A-Za-z] + o [=a=] représente la classe des caractères semblables à a, donc ici les lettres minuscules + o [=0=] représente la classe des chiffres + + * +, * et ? servent à exprimer une répétition : + o fo+ reconnait la chaine fo suivi de n fois la lettre O, donc foo, fooo, fooo, ... + o fo* reconnait les chaines f, fo, fo, ..., c'est à dire que le o est optionnel (de 0 à n fois) + o fo? Le ? signifie zéro ou 1 fois, donc reconnait seulement les chaines f et fo + + * {} servent à exprimer une répétition, mais avec plus de précision : + o {,3} signifie trois fois au plus + o {2,} signifie deux fois au minimum + o {2} signifie deux fois et deux fois seulement + Exemple : [a-f0-9]{8} cherche tous les chiffres hexadecimaux sur 8 caractères + + * Le caractère . représente n'importe quel caractère, autre que fin de ligne. Il est souvent associé à * pour désigner une succession quelconque de caractères + + * Les parenthèses () servent à grouper un ensemble de caractères tel que (ab) qui signifie "ab" en tant que chaine de caractères et non plus un ensemble de caractères. Avec certains outils, permet en plus de mémoriser l'occurence trouvée, laquelle peut-être réétiliser par la suite dans l'expression sous la forme : \1,\2,...\n. Par exemple : ([au]\1)+ reconnait une séquence de a ou de u comme par exemple "aaaaaa" ou "uuu". + + * Le caractère | sert à établir une alternative : (oo|ba) recherche la chaine "oo" ou bien "ba". + + * ?: se rajoute en début d'une expression entre parenthèses pour ne pas mémoriser : (?:oo|ba) + + * Les caractères ^ et $ repèrent les débuts et fin de ligne. + + * Les raccourcis : + o \w représente l'ensemble [A-Za-z] + o \W représente l'ensemble [^A-Za-z] (soit la négation du précédent) + o \d représente l'ensemble [0-9] + o \D représente l'ensemble [^0-9] + o \b représente les caractères d'espacement + o \B représente la négation de \b + + * Un remplacement d'une occurence par une chaine s'écrit : /chaine1/chaine2/, ou chaine2 viendra remplacer l'occurence de chaine1. Exemple : /foo/bar/ remplace "foo" par "bar" + + * ?!chaine négative la recherche d'une chaine + . Par exemple, pour chercher tous les fichiers autres que ceux ayant l'extension ".bat" ou ".pif", on écrit : + + ^.*\.(?!(bat|pif)$).*$, + où : + o ^ exprime le début de ligne, + o .* une série de caractères quelconques représentant le nom du fichier (sans extension), + o \. le caractère ".", + o (?!(bat|pif)$) la négation des chaines "bat" ou "pif", et seulement elles puisqu'elles doivent etre suivi du caractère de fin de ligne (présence du symbole $ à la suite), + o .* qui désigne les caractères correspondant à l'extension du fichier, + o $ pour la fin de ligne. + diff --git a/share/dialog_print.cpp b/share/dialog_print.cpp index 2b4813d163..3ed4a8280e 100644 --- a/share/dialog_print.cpp +++ b/share/dialog_print.cpp @@ -34,8 +34,6 @@ BEGIN_EVENT_TABLE( WinEDA_PrintFrame, wxDialog ) ////@begin WinEDA_PrintFrame event table entries EVT_RADIOBOX( ID_SET_PRINT_SCALE, WinEDA_PrintFrame::OnSetPrintScaleSelected ) - EVT_SPINCTRL( ID_PEN_WIDTH, WinEDA_PrintFrame::OnPenWidthUpdated ) - EVT_RADIOBOX( ID_SET_BW, WinEDA_PrintFrame::OnSetBwSelected ) EVT_BUTTON( ID_PRINT_SETUP, WinEDA_PrintFrame::OnPrintSetupClick ) @@ -63,6 +61,12 @@ WinEDA_PrintFrame::WinEDA_PrintFrame( WinEDA_DrawFrame* parent, wxWindowID id, c m_Parent = parent; m_XScaleAdjust = m_YScaleAdjust = 1.0; m_PagesOption = NULL; + wxConfig * Config = m_Parent->m_Parent->m_EDA_Config; + if ( Config ) + { + Config->Read(wxT("PrintPenWidth"), &s_PrintPenMinWidth); + } + Create(parent, id, caption, pos, size, style); } @@ -81,7 +85,7 @@ bool WinEDA_PrintFrame::Create( wxWindow* parent, wxWindowID id, const wxString& m_FineAdjustXscaleOpt = NULL; m_FineAdjustYscaleTitle = NULL; m_FineAdjustYscaleOpt = NULL; - m_ButtPenWidth = NULL; + m_DialogPenWidthSizer = NULL; m_Print_Sheet_Ref = NULL; m_Print_Mirror = NULL; m_ColorOption = NULL; @@ -112,7 +116,7 @@ void WinEDA_PrintFrame::CreateControls() SetFont(*g_DialogFont); ////@begin WinEDA_PrintFrame content construction - // Generated by DialogBlocks, 13/01/2007 16:42:47 (unregistered) + // Generated by DialogBlocks, 24/01/2007 16:36:31 (unregistered) WinEDA_PrintFrame* itemDialog1 = this; @@ -160,23 +164,20 @@ void WinEDA_PrintFrame::CreateControls() wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer12, 0, wxGROW|wxALL, 5); - wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen width mini"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer12->Add(itemStaticText13, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:")); + wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxVERTICAL); + itemBoxSizer12->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5); - m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 ); - itemBoxSizer12->Add(m_ButtPenWidth, 0, wxGROW|wxALL, 5); - - wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:")); - wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer(itemStaticBoxSizer15Static, wxVERTICAL); - itemBoxSizer12->Add(itemStaticBoxSizer15, 0, wxGROW|wxALL, 5); + m_DialogPenWidthSizer = new wxBoxSizer(wxVERTICAL); + itemStaticBoxSizer13->Add(m_DialogPenWidthSizer, 0, wxGROW|wxALL, 5); m_Print_Sheet_Ref = new wxCheckBox( itemDialog1, ID_PRINT_REF, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Print_Sheet_Ref->SetValue(false); - itemStaticBoxSizer15->Add(m_Print_Sheet_Ref, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer13->Add(m_Print_Sheet_Ref, 0, wxGROW|wxALL, 5); m_Print_Mirror = new wxCheckBox( itemDialog1, ID_CHECK_PRINT_MIROR, _("Mirror"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Print_Mirror->SetValue(false); - itemStaticBoxSizer15->Add(m_Print_Mirror, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer13->Add(m_Print_Mirror, 0, wxGROW|wxALL, 5); wxString m_ColorOptionStrings[] = { _("Color"), @@ -204,35 +205,37 @@ void WinEDA_PrintFrame::CreateControls() itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer22, 0, wxALIGN_TOP|wxALL, 5); + wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer2->Add(itemBoxSizer21, 0, wxALIGN_TOP|wxALL, 5); - itemBoxSizer22->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer21->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxButton* itemButton24 = new wxButton( itemDialog1, ID_PRINT_SETUP, _("Print S&etup"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton24->SetForegroundColour(wxColour(121, 118, 0)); - itemBoxSizer22->Add(itemButton24, 0, wxGROW|wxALL, 5); + wxButton* itemButton23 = new wxButton( itemDialog1, ID_PRINT_SETUP, _("Print S&etup"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton23->SetForegroundColour(wxColour(121, 118, 0)); + itemBoxSizer21->Add(itemButton23, 0, wxGROW|wxALL, 5); - wxButton* itemButton25 = new wxButton( itemDialog1, ID_PRINT_PREVIEW, _("Pre&view"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton25->SetForegroundColour(wxColour(0, 0, 196)); - itemBoxSizer22->Add(itemButton25, 0, wxGROW|wxALL, 5); + wxButton* itemButton24 = new wxButton( itemDialog1, ID_PRINT_PREVIEW, _("Pre&view"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton24->SetForegroundColour(wxColour(0, 0, 196)); + itemBoxSizer21->Add(itemButton24, 0, wxGROW|wxALL, 5); - wxButton* itemButton26 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _("&Print"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton26->SetForegroundColour(wxColour(0, 128, 64)); - itemBoxSizer22->Add(itemButton26, 0, wxGROW|wxALL, 5); + wxButton* itemButton25 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _("&Print"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton25->SetForegroundColour(wxColour(0, 128, 64)); + itemBoxSizer21->Add(itemButton25, 0, wxGROW|wxALL, 5); - wxButton* itemButton27 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer22->Add(itemButton27, 0, wxGROW|wxALL, 5); + wxButton* itemButton26 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer21->Add(itemButton26, 0, wxGROW|wxALL, 5); // Set validators m_ScaleOption->SetValidator( wxGenericValidator(& s_Scale_Select) ); - m_ButtPenWidth->SetValidator( wxGenericValidator(& PenMinWidth) ); m_Print_Sheet_Ref->SetValidator( wxGenericValidator(& s_Print_Sheet_Ref) ); m_Print_Mirror->SetValidator( wxGenericValidator(& s_PrintMirror) ); m_PagesOptionPcb->SetValidator( wxGenericValidator(& s_OptionPrintPage) ); m_PagesOptionEeschema->SetValidator( wxGenericValidator(& s_OptionPrintPage) ); ////@end WinEDA_PrintFrame content construction + m_DialogPenWidth = new WinEDA_ValueCtrl(this, _("Pen width mini"), s_PrintPenMinWidth, + g_UnitMetric, m_DialogPenWidthSizer, m_Parent->m_InternalUnits); + SetOthersDatas(); } @@ -307,16 +310,6 @@ void WinEDA_PrintFrame::OnCloseClick( wxCommandEvent& event ) } -/*! - * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_WIDTH - */ - -void WinEDA_PrintFrame::OnPenWidthUpdated( wxSpinEvent& event ) -{ - SetPenWidth(event); -} - - /*! * wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SET_PRINT_SCALE */ diff --git a/share/dialog_print.h b/share/dialog_print.h index 26cf4c8c89..04d7e1510f 100644 --- a/share/dialog_print.h +++ b/share/dialog_print.h @@ -20,7 +20,6 @@ ////@begin includes #include "wx/valgen.h" -#include "wx/spinctrl.h" ////@end includes /*! @@ -29,7 +28,6 @@ ////@begin forward declarations class wxBoxSizer; -class wxSpinCtrl; ////@end forward declarations /*! @@ -41,7 +39,6 @@ class wxSpinCtrl; #define ID_SET_PRINT_SCALE 10004 #define ID_TEXTCTRL 10009 #define ID_TEXTCTRL1 10010 -#define ID_PEN_WIDTH 10005 #define ID_PRINT_REF 10006 #define ID_CHECK_PRINT_MIROR 10011 #define ID_SET_BW 10007 @@ -90,9 +87,6 @@ public: /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SET_PRINT_SCALE void OnSetPrintScaleSelected( wxCommandEvent& event ); - /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_WIDTH - void OnPenWidthUpdated( wxSpinEvent& event ); - /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SET_BW void OnSetBwSelected( wxCommandEvent& event ); @@ -126,12 +120,12 @@ public: void OnPrintSetup(wxCommandEvent& event); void OnPrintPreview(wxCommandEvent& event); void EDA_PrintPage(wxCommandEvent& event); - void SetPenWidth(wxSpinEvent& event); void SetColorOrBlack(wxCommandEvent& event); void SetScale(wxCommandEvent& event); int SetLayerMaskFromListSelection(void); wxString BuildPrintTitle(void); void SetOthersDatas(void); + void SetPenWidth(void); ////@begin WinEDA_PrintFrame member variables @@ -142,7 +136,7 @@ public: wxTextCtrl* m_FineAdjustXscaleOpt; wxStaticText* m_FineAdjustYscaleTitle; wxTextCtrl* m_FineAdjustYscaleOpt; - wxSpinCtrl* m_ButtPenWidth; + wxBoxSizer* m_DialogPenWidthSizer; wxCheckBox* m_Print_Sheet_Ref; wxCheckBox* m_Print_Mirror; wxRadioBox* m_ColorOption; @@ -152,6 +146,7 @@ public: WinEDA_DrawFrame * m_Parent; wxRadioBox* m_PagesOption; + WinEDA_ValueCtrl * m_DialogPenWidth; wxCheckBox * m_BoxSelecLayer[32]; double m_XScaleAdjust, m_YScaleAdjust; }; diff --git a/share/dialog_print.pjd b/share/dialog_print.pjd index 7b03c564cc..e565f1dcc3 100644 --- a/share/dialog_print.pjd +++ b/share/dialog_print.pjd @@ -6,7 +6,7 @@ "" "" "" - 34 + 33 "" 0 0 @@ -718,124 +718,6 @@ 0 0 "<Any platform>" - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "28/12/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "wxStaticText" - "" - "Pen width mini" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxSpinCtrl: ID_PEN_WIDTH" - "dialog-control-document" - "" - "spinctrl" - 0 - 1 - 0 - 0 - "28/12/2006" - "wbSpinCtrlProxy" - "wxEVT_COMMAND_SPINCTRL_UPDATED|OnPenWidthUpdated" - "ID_PEN_WIDTH" - 10005 - "wxSpinCtrl" - "m_ButtPenWidth" - 0 - 100 - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "PenMinWidth" - "wxGenericValidator(& %VARIABLE%)" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - "wxStaticBoxSizer V" "dialog-control-document" @@ -869,6 +751,32 @@ 0 0 "<Any platform>" + + "wxBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "24/1/2007" + "wbBoxSizerProxy" + "Vertical" + "m_ButtPenWidthSizer" + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + "wxCheckBox: ID_PRINT_REF" "dialog-control-document" diff --git a/share/drawframe.cpp b/share/drawframe.cpp index 1eac6cbd96..b515e72ee5 100644 --- a/share/drawframe.cpp +++ b/share/drawframe.cpp @@ -59,7 +59,6 @@ wxSize minsize; m_MenuBar = NULL; // menu du haut d'ecran m_ID_current_state = 0; m_HTOOL_current_state = 0; - m_FrameIsActive = FALSE; m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessiné diff --git a/share/drawpanel.cpp b/share/drawpanel.cpp index 497293b6d9..5935c69fe1 100644 --- a/share/drawpanel.cpp +++ b/share/drawpanel.cpp @@ -94,18 +94,18 @@ wxPoint Cursor = GetScreen()->m_Curseur; int dx = m_ClipBox.GetWidth() * GetZoom(); int dy = m_ClipBox.GetHeight() * GetZoom(); GRLine(&m_ClipBox, DC, Cursor.x - dx, Cursor.y, - Cursor.x + dx, Cursor.y, color); // axe Y + Cursor.x + dx, Cursor.y, 0, color); // axe Y GRLine(&m_ClipBox, DC, Cursor.x, Cursor.y - dx, - Cursor.x, Cursor.y + dy, color); // axe X + Cursor.x, Cursor.y + dy, 0, color); // axe X } else { int len = CURSOR_SIZE * GetZoom(); GRLine(&m_ClipBox, DC, Cursor.x - len, Cursor.y, - Cursor.x + len, Cursor.y, color); + Cursor.x + len, Cursor.y, 0, color); GRLine(&m_ClipBox, DC, Cursor.x, Cursor.y - len, - Cursor.x, Cursor.y + len, color); + Cursor.x, Cursor.y + len, 0, color); } } @@ -161,8 +161,6 @@ wxSize WinEDA_DrawPanel::GetGrid(void) void WinEDA_DrawPanel::PrepareGraphicContext(wxDC * DC) /******************************************************/ { - DC->SetPen(*DrawPen); - DC->SetBrush(*DrawBrush); GRResetPenAndBrush(DC); DC->SetBackgroundMode(wxTRANSPARENT); #ifdef WX_ZOOM @@ -208,11 +206,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition(const wxPoint & ScreenPos) { wxPoint curpos; - curpos.x = ScreenPos.x * GetZoom(); - curpos.y = ScreenPos.y * GetZoom(); - - curpos.x += GetScreen()->m_DrawOrg.x; - curpos.y += GetScreen()->m_DrawOrg.y; + curpos = GetScreen()->CursorRealPosition(ScreenPos); return curpos; } @@ -376,7 +370,8 @@ int x,y; void WinEDA_DrawPanel::OnSize(wxSizeEvent & event) /*************************************************/ { - SetBoundaryBox(); + SetBoundaryBox(); + event.Skip(); } /******************************************/ @@ -587,11 +582,11 @@ double pasx, pasy; { /* Trace de l'axe vertical */ GRDashedLine(&m_ClipBox, DC, 0, -screen->ReturnPageSize().y, - 0, screen->ReturnPageSize().y, Color ); + 0, screen->ReturnPageSize().y, 0, Color ); /* Trace de l'axe horizontal */ GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, 0, - screen->ReturnPageSize().x, 0, Color ); + screen->ReturnPageSize().x, 0, 0, Color ); } /* trace des axes auxiliaires */ @@ -618,13 +613,13 @@ BASE_SCREEN * screen = GetScreen(); GRDashedLine(&m_ClipBox, DC, m_Parent->m_Auxiliary_Axis_Position.x, -screen->ReturnPageSize().y, m_Parent->m_Auxiliary_Axis_Position.x, screen->ReturnPageSize().y, - Color ); + 0, Color ); /* Trace de l'axe horizontal */ GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, - Color ); + 0, Color ); } /*******************************************************/ @@ -729,7 +724,10 @@ static WinEDA_DrawPanel * LastPanel; localrealbutt |= localbutt; /* compensation defaut wxGTK */ - screen->m_MousePosition = CalcAbsolutePosition(wxPoint(event.GetX(), event.GetY())); + /* Compute absolute m_MousePosition in pixel units: */ + screen->m_MousePositionInPixels = CalcAbsolutePosition(wxPoint(event.GetX(), event.GetY())); + /* Compute absolute m_MousePosition in user units: */ + screen->m_MousePosition = CursorRealPosition(screen->m_MousePositionInPixels); wxClientDC DC(this); int kbstat = 0; @@ -747,10 +745,10 @@ int kbstat = 0; // Appel des fonctions liées au Double Click ou au Click if( localbutt == (int)(GR_M_LEFT_DOWN|GR_M_DCLICK) ) - m_Parent->OnLeftDClick(&DC, screen->m_MousePosition); + m_Parent->OnLeftDClick(&DC, screen->m_MousePositionInPixels); else if ( event.LeftDown() ) - m_Parent->OnLeftClick(&DC, screen->m_MousePosition); + m_Parent->OnLeftClick(&DC, screen->m_MousePositionInPixels); if( event.ButtonUp(2) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) { // The middle button has been relached, with no block command: @@ -761,7 +759,7 @@ int kbstat = 0; /* Appel de la fonction generale de gestion des mouvements souris et commandes clavier */ - m_Parent->GeneralControle(&DC, screen->m_MousePosition); + m_Parent->GeneralControle(&DC, screen->m_MousePositionInPixels); /*******************************/ @@ -926,7 +924,7 @@ BASE_SCREEN * Screen = GetScreen(); else m_Parent->SetToolID(0, m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW, wxEmptyString); } - m_Parent->GeneralControle(&DC, Screen->m_MousePosition); + m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); } diff --git a/share/infospgm.cpp b/share/infospgm.cpp index 15944576e9..ce01bf5b88 100644 --- a/share/infospgm.cpp +++ b/share/infospgm.cpp @@ -7,6 +7,10 @@ #include "gr_basic.h" #include "common.h" +#ifdef KICAD_PYTHON +#include +#endif + // Import: extern wxString g_Main_Title; @@ -47,6 +51,13 @@ wxString Msg = MsgInfos; #else Msg << wxT(" - Ansi version"); #endif + +#ifdef KICAD_PYTHON + Msg << wxT("\n"); + Msg << wxT( "python : " ); + Msg << wxString::FromAscii( PyHandler::GetInstance()->GetVersion() ); +#endif + Msg << wxT("\n\n") << _("Author:"); Msg << wxT("JP CHARRAS\n\n") << _("Based on wxWidgets "); Msg << wxMAJOR_VERSION << wxT(".") << @@ -56,7 +67,7 @@ wxString Msg = MsgInfos; Msg << _("\n\nGPL License"); Msg << _("\n\nWeb sites:\n"); Msg << wxT("http://iut-tice.ujf-grenoble.fr/kicad/\n"); - Msg << wxT("http://www.lis.inpg.fr/realise_au_lis/kicad/"); + Msg << wxT("http://www.gipsa-lab.inpg.fr/realise_au_lis/kicad/"); wxMessageBox(Msg, wxEmptyString, wxICON_INFORMATION, frame); } diff --git a/share/svg_print.cpp b/share/svg_print.cpp index 42a0fea5c5..dfa5c03ec4 100644 --- a/share/svg_print.cpp +++ b/share/svg_print.cpp @@ -49,12 +49,16 @@ ////@end XPM images extern BASE_SCREEN * ActiveScreen; -extern int PenMinWidth; /* dim mini (en 1/100 mmm) pour les traits imprimes */ - +#ifdef EESCHEMA #define WIDTH_MAX_VALUE 100 +#else +#define WIDTH_MAX_VALUE 1000 +#endif #define WIDTH_MIN_VALUE 1 // Variables locales +static int s_SVGPenMinWidth; /* Minimum pen width (in internal units) for printing */ + static int Select_PrintAll = FALSE; static bool Print_Sheet_Ref = TRUE; static int s_PlotBlackAndWhite = 0; @@ -97,8 +101,6 @@ BEGIN_EVENT_TABLE( WinEDA_PrintSVGFrame, wxDialog ) ////@begin WinEDA_PrintSVGFrame event table entries EVT_CLOSE( WinEDA_PrintSVGFrame::OnCloseWindow ) - EVT_SPINCTRL( ID_SPINCTRL, WinEDA_PrintSVGFrame::OnSpinctrlUpdated ) - EVT_RADIOBOX( ID_RADIOBOX_SETPRINTMODE, WinEDA_PrintSVGFrame::OnRadioboxSetprintmodeSelected ) EVT_BUTTON( ID_PRINT_EXECUTE, WinEDA_PrintSVGFrame::OnPrintExecuteClick ) @@ -126,7 +128,7 @@ WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent, wxConfig * Config = m_Parent->m_Parent->m_EDA_Config; if ( Config ) { - Config->Read(wxT("PlotSVGPenWidth"), &PenMinWidth); + Config->Read(wxT("PlotSVGPenWidth"), &s_SVGPenMinWidth); Config->Read(wxT("PlotSVGModeColor"), &s_PlotBlackAndWhite); } @@ -140,7 +142,7 @@ WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent, bool WinEDA_PrintSVGFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin WinEDA_PrintSVGFrame member initialisation - m_ButtPenWidth = NULL; + m_DialogPenWidthSizer = NULL; m_ModeColorOption = NULL; m_Print_Sheet_Ref = NULL; m_PagesOption = NULL; @@ -171,7 +173,7 @@ void WinEDA_PrintSVGFrame::CreateControls() SetFont(*g_DialogFont); ////@begin WinEDA_PrintSVGFrame content construction - // Generated by DialogBlocks, 23/12/2006 12:58:00 (unregistered) + // Generated by DialogBlocks, 24/01/2007 19:00:23 (unregistered) WinEDA_PrintSVGFrame* itemDialog1 = this; @@ -184,11 +186,8 @@ void WinEDA_PrintSVGFrame::CreateControls() wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen width mini"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); - itemBoxSizer4->Add(m_ButtPenWidth, 0, wxALIGN_LEFT|wxALL, 5); + m_DialogPenWidthSizer = new wxBoxSizer(wxVERTICAL); + itemBoxSizer4->Add(m_DialogPenWidthSizer, 0, wxGROW|wxALL, 5); wxString m_ModeColorOptionStrings[] = { _("Color"), @@ -204,8 +203,8 @@ void WinEDA_PrintSVGFrame::CreateControls() itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 15); - wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer3->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxString m_PagesOptionStrings[] = { _("Current"), @@ -213,34 +212,37 @@ void WinEDA_PrintSVGFrame::CreateControls() }; m_PagesOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Page Print:"), wxDefaultPosition, wxDefaultSize, 2, m_PagesOptionStrings, 1, wxRA_SPECIFY_COLS ); m_PagesOption->SetSelection(0); - itemBoxSizer10->Add(m_PagesOption, 0, wxALIGN_LEFT|wxALL, 5); + itemBoxSizer9->Add(m_PagesOption, 0, wxALIGN_LEFT|wxALL, 5); - wxButton* itemButton12 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _("Create &File"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton12->SetDefault(); - itemButton12->SetForegroundColour(wxColour(0, 128, 0)); - itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5); + wxButton* itemButton11 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _("Create &File"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton11->SetDefault(); + itemButton11->SetForegroundColour(wxColour(0, 128, 0)); + itemBoxSizer9->Add(itemButton11, 0, wxGROW|wxALL, 5); - wxButton* itemButton13 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton13->SetForegroundColour(wxColour(0, 0, 198)); - itemBoxSizer10->Add(itemButton13, 0, wxGROW|wxALL, 5); + wxButton* itemButton12 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton12->SetForegroundColour(wxColour(0, 0, 198)); + itemBoxSizer9->Add(itemButton12, 0, wxGROW|wxALL, 5); - wxStaticText* itemStaticText14 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer2->Add(itemStaticText14, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer2->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_FileNameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer2->Add(m_FileNameCtrl, 0, wxGROW|wxALL, 5); - wxStaticText* itemStaticText16 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer2->Add(itemStaticText16, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_MessagesBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(-1, 100), wxTE_MULTILINE|wxTE_READONLY ); itemBoxSizer2->Add(m_MessagesBox, 0, wxGROW|wxALL, 5); // Set validators - m_ButtPenWidth->SetValidator( wxGenericValidator(& PenMinWidth) ); m_ModeColorOption->SetValidator( wxGenericValidator(& s_PlotBlackAndWhite) ); m_Print_Sheet_Ref->SetValidator( wxGenericValidator(& Print_Sheet_Ref) ); ////@end WinEDA_PrintSVGFrame content construction + + m_DialogPenWidth = new WinEDA_ValueCtrl(this, _("Pen width mini"), s_SVGPenMinWidth, + g_UnitMetric, m_DialogPenWidthSizer, m_Parent->m_InternalUnits); + } /*! @@ -291,22 +293,20 @@ wxString name, ext; } -/*********************************************************/ -void WinEDA_PrintSVGFrame::SetPenWidth(wxSpinEvent& event) -/*********************************************************/ +/********************************************/ +void WinEDA_PrintSVGFrame::SetPenWidth(void) +/********************************************/ { - PenMinWidth = m_ButtPenWidth->GetValue(); - if ( PenMinWidth > WIDTH_MAX_VALUE ) + s_SVGPenMinWidth = m_DialogPenWidth->GetValue(); + if ( s_SVGPenMinWidth > WIDTH_MAX_VALUE ) { - PenMinWidth = WIDTH_MAX_VALUE; - wxBell(); + s_SVGPenMinWidth = WIDTH_MAX_VALUE; } - if ( PenMinWidth < WIDTH_MIN_VALUE ) + if ( s_SVGPenMinWidth < WIDTH_MIN_VALUE ) { - PenMinWidth = WIDTH_MIN_VALUE; - wxBell(); + s_SVGPenMinWidth = WIDTH_MIN_VALUE; } - m_ButtPenWidth->SetValue(PenMinWidth); + m_DialogPenWidth->SetValue(s_SVGPenMinWidth); } @@ -327,8 +327,7 @@ wxString msg; if ( (m_Print_Sheet_Ref == NULL) || (m_Print_Sheet_Ref->GetValue() == FALSE) ) print_ref = FALSE; -wxSpinEvent spinevent; - SetPenWidth(spinevent); + SetPenWidth(); BASE_SCREEN * screen = m_Parent->m_CurrentScreen; @@ -424,8 +423,8 @@ wxSVGFileDC dc(FullFileName, SheetSize.x, SheetSize.y, dpi) ; { EDA_Rect tmp = panel->m_ClipBox; GRResetPenAndBrush(&dc); - PenMinWidth = m_ButtPenWidth->GetValue(); - SetPenMinWidth(PenMinWidth); + s_SVGPenMinWidth = m_DialogPenWidth->GetValue(); + SetPenMinWidth(s_SVGPenMinWidth); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : TRUE ); @@ -470,16 +469,6 @@ void WinEDA_PrintSVGFrame::OnCloseClick( wxCommandEvent& event ) } -/*! - * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL - */ - -void WinEDA_PrintSVGFrame::OnSpinctrlUpdated( wxSpinEvent& event ) -{ - SetPenWidth(event); -} - - /*! * wxEVT_CLOSE_WINDOW event handler for ID_DIALOG */ @@ -490,7 +479,7 @@ void WinEDA_PrintSVGFrame::OnCloseWindow( wxCloseEvent& event ) if ( Config ) { s_PlotBlackAndWhite = m_ModeColorOption->GetSelection(); - Config->Write(wxT("PlotSVGPenWidth"), PenMinWidth); + Config->Write(wxT("PlotSVGPenWidth"), s_SVGPenMinWidth); Config->Write(wxT("PlotSVGModeColor"), s_PlotBlackAndWhite); } event.Skip(); diff --git a/share/svg_print.h b/share/svg_print.h index 49fc86547b..5b99de8f8f 100644 --- a/share/svg_print.h +++ b/share/svg_print.h @@ -24,7 +24,6 @@ ////@begin includes #include "wx/valgen.h" -#include "wx/spinctrl.h" ////@end includes /*! @@ -32,7 +31,7 @@ */ ////@begin forward declarations -class wxSpinCtrl; +class wxBoxSizer; ////@end forward declarations /*! @@ -41,7 +40,6 @@ class wxSpinCtrl; ////@begin control identifiers #define ID_DIALOG 10000 -#define ID_SPINCTRL 10003 #define ID_RADIOBOX_SETPRINTMODE 10007 #define ID_CHECKBOX 10004 #define ID_RADIOBOX1 10008 @@ -93,9 +91,6 @@ public: /// wxEVT_CLOSE_WINDOW event handler for ID_DIALOG void OnCloseWindow( wxCloseEvent& event ); - /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL - void OnSpinctrlUpdated( wxSpinEvent& event ); - /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SETPRINTMODE void OnRadioboxSetprintmodeSelected( wxCommandEvent& event ); @@ -121,11 +116,10 @@ public: void PrintSVGDoc(wxCommandEvent& event); bool DrawPage(const wxString & FullFileName); - void SetPenWidth(wxSpinEvent& event); wxString ReturnFullFileName(void); ////@begin WinEDA_PrintSVGFrame member variables - wxSpinCtrl* m_ButtPenWidth; + wxBoxSizer* m_DialogPenWidthSizer; wxRadioBox* m_ModeColorOption; wxCheckBox* m_Print_Sheet_Ref; wxRadioBox* m_PagesOption; @@ -134,6 +128,8 @@ public: ////@end WinEDA_PrintSVGFrame member variables WinEDA_DrawFrame * m_Parent; + WinEDA_ValueCtrl * m_DialogPenWidth; + void SetPenWidth(); int m_PrintMaskLayer; int m_ImageXSize_mm; }; diff --git a/share/svg_print.pjd b/share/svg_print.pjd index 5879a76367..f3d8b6a2e4 100644 --- a/share/svg_print.pjd +++ b/share/svg_print.pjd @@ -6,7 +6,7 @@ "" "" "" - 24 + 23 "" 0 0 @@ -329,110 +329,19 @@ 0 "<Any platform>" - "wxStaticText: wxID_STATIC" + "wxBoxSizer V" "dialog-control-document" "" - "statictext" + "sizer" 0 1 0 0 - "5/7/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "wxStaticText" - "" - "Pen width mini" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxSpinCtrl: ID_SPINCTRL" - "dialog-control-document" - "" - "spinctrl" - 0 - 1 - 0 - 0 - "5/7/2006" - "wbSpinCtrlProxy" - "wxEVT_COMMAND_SPINCTRL_UPDATED|OnSpinctrlUpdated" - "ID_SPINCTRL" - 10003 - "wxSpinCtrl" - "m_ButtPenWidth" - 1 - 100 - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "PenMinWidth" - "wxGenericValidator(& %VARIABLE%)" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" + "24/1/2007" + "wbBoxSizerProxy" + "Vertical" + "m_DialogPenWidthSizer" + "Expand" "Centre" 0 5 @@ -443,8 +352,7 @@ 0 0 0 - "" - "" + "<Any platform>" "wxRadioBox: ID_RADIOBOX_SETPRINTMODE" diff --git a/share/wxprint.cpp b/share/wxprint.cpp index 58b2f096f1..58bae6fb62 100644 --- a/share/wxprint.cpp +++ b/share/wxprint.cpp @@ -61,17 +61,20 @@ static double s_ScaleList[] = #include "protos.h" //#define DEFAULT_ORIENTATION_PAPER wxPORTRAIT -#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE -#define WIDTH_MAX_VALUE 100 -#define WIDTH_MIN_VALUE 10 +#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE +#ifdef EESCHEMA +#define WIDTH_MAX_VALUE 100 +#else +#define WIDTH_MAX_VALUE 1000 +#endif +#define WIDTH_MIN_VALUE 1 // static print data and page setup data, to remember settings during the session static wxPrintData * g_PrintData; -/* exportees dans eeconfig.h */ -int PenMinWidth = 20; /* dim mini (en 1/100 mmm) pour les traits imprimes */ - // Variables locales +static int s_PrintPenMinWidth = 6; /* Minimum pen width (in internal units) for printing */ + static int s_PrintMaskLayer; static int s_OptionPrintPage = 0; static int s_Print_Black_and_White = TRUE; @@ -164,7 +167,6 @@ void WinEDA_PrintFrame::SetOthersDatas(void) m_Print_Mirror->Enable(false); #endif - m_ButtPenWidth->SetRange(WIDTH_MIN_VALUE,WIDTH_MAX_VALUE); m_FineAdjustXscaleOpt->SetToolTip(_("Set X scale adjust for exact scale plotting")); m_FineAdjustYscaleOpt->SetToolTip(_("Set Y scale adjust for exact scale plotting")); if ( s_Print_Black_and_White ) m_ColorOption->SetSelection(1); @@ -249,16 +251,24 @@ void WinEDA_PrintFrame::OnClosePrintDialog(void) /* called when WinEDA_PrintFrame is closed */ { + wxConfig * Config = m_Parent->m_Parent->m_EDA_Config; + if ( Config ) + { + Config->Write(wxT("PrintPenWidth"), s_PrintPenMinWidth); + } + if ( m_FineAdjustXscaleOpt ) m_FineAdjustXscaleOpt->GetValue().ToDouble(&m_XScaleAdjust); if ( m_FineAdjustYscaleOpt ) m_FineAdjustYscaleOpt->GetValue().ToDouble(&m_YScaleAdjust); + SetPenWidth(); + #ifdef PCBNEW - if ( m_Parent->m_Parent->m_EDA_Config ) + if ( Config ) { - m_Parent->m_Parent->m_EDA_Config->Write(wxT("PrintXFineScaleAdj"), m_XScaleAdjust); - m_Parent->m_Parent->m_EDA_Config->Write(wxT("PrintYFineScaleAdj"), m_YScaleAdjust); - m_Parent->m_Parent->m_EDA_Config->Write(wxT("PrintScale"), s_Scale_Select); + Config->Write(wxT("PrintXFineScaleAdj"), m_XScaleAdjust); + Config->Write(wxT("PrintYFineScaleAdj"), m_YScaleAdjust); + Config->Write(wxT("PrintScale"), s_Scale_Select); } #endif EndModal(0); @@ -295,22 +305,23 @@ void WinEDA_PrintFrame::SetScale(wxCommandEvent& event) #endif } -/*********************************************************/ -void WinEDA_PrintFrame::SetPenWidth(wxSpinEvent& event) -/*********************************************************/ +/****************************************/ +void WinEDA_PrintFrame::SetPenWidth(void) +/****************************************/ +/* Get the new pen width value, and verify min et max value + NOTE: s_PrintPenMinWidth is in internal units +*/ { - PenMinWidth = m_ButtPenWidth->GetValue(); - if ( PenMinWidth > WIDTH_MAX_VALUE ) + s_PrintPenMinWidth = m_DialogPenWidth->GetValue(); + if ( s_PrintPenMinWidth > WIDTH_MAX_VALUE ) { - PenMinWidth = WIDTH_MAX_VALUE; - wxBell(); + s_PrintPenMinWidth = WIDTH_MAX_VALUE; } - if ( PenMinWidth < WIDTH_MIN_VALUE ) + if ( s_PrintPenMinWidth < WIDTH_MIN_VALUE ) { - PenMinWidth = WIDTH_MIN_VALUE; - wxBell(); + s_PrintPenMinWidth = WIDTH_MIN_VALUE; } - m_ButtPenWidth->SetValue(PenMinWidth); + m_DialogPenWidth->SetValue(s_PrintPenMinWidth); } @@ -343,10 +354,8 @@ wxPoint WPos; int x, y; bool print_ref = TRUE; -wxSpinEvent spinevent; - SetScale(event); - SetPenWidth(spinevent); + SetPenWidth(); if ( m_PagesOption ) s_OptionPrintPage = m_PagesOption->GetSelection(); @@ -404,8 +413,7 @@ bool print_ref = TRUE; if ( s_OptionPrintPage ) SetLayerMaskFromListSelection(); #endif -wxSpinEvent spinevent; - SetPenWidth(spinevent); + SetPenWidth(); wxPrintDialogData printDialogData( * g_PrintData); @@ -664,13 +672,17 @@ double accurate_Xscale, accurate_Yscale; #ifdef EESCHEMA /* set Pen min width */ -float ftmp; - // PenMinWidth est donné en 1/100 mm, a convertir en pixels - ftmp = (float)PenMinWidth / 100; // ftmp est en mm - ftmp *= (float)PlotAreaSize.x / PageSize_in_mm.x; /* ftmp est en pixels */ - SetPenMinWidth((int)ftmp); +double ftmp, xdcscale, ydcscale; + // s_PrintPenMinWidth is in internal units ( 1/1000 inch), and must be converted in pixels + ftmp = (float)s_PrintPenMinWidth * 25.4 / EESCHEMA_INTERNAL_UNIT; // ftmp est en mm + ftmp *= (float)PlotAreaSize.x / PageSize_in_mm.x; /* ftmp is in pixels */ + /* because the pen size will be scaled by the dc scale, we modify the size + in order to keep the requested value */ + dc->GetUserScale(&xdcscale, &ydcscale); + ftmp /= xdcscale; + SetPenMinWidth((int)round(ftmp)); #else - SetPenMinWidth(1); + SetPenMinWidth(1); // min width = 1 pixel #endif WinEDA_DrawPanel * panel = m_Parent->DrawPanel; @@ -686,7 +698,7 @@ EDA_Rect tmp = panel->m_ClipBox; #endif #ifdef PCBNEW if ( m_Print_Sheet_Ref ) - m_Parent->TraceWorkSheet( dc, ActiveScreen); + m_Parent->TraceWorkSheet( dc, ActiveScreen, 0); if ( userscale == 1.0 ) // Draw the Sheet refs at optimum scale, and board at 1.0 scale