Pcbnew: Fix 2 minor bugs about pcb texts: flipped texts have an incorrect rotation angle,

and text dialog editor did not handle properly negative rotation angles values.
Eeschema: fix bug when rotating (only using the Rotate hotkey) a field.
This commit is contained in:
jean-pierre charras 2011-09-28 10:32:31 +02:00
commit cac9951682
4 changed files with 339 additions and 171 deletions

View File

@ -1,169 +1,335 @@
/* XPM */
static char *icon_kicad[] = {
static const char *icon_kicad_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 131 2",
" c #A33E03",
". c #A44006",
"X c #A5430A",
"o c #A84C16",
"O c #A94D18",
"+ c #AB511D",
"@ c #876900",
"# c #8C6D00",
"$ c #947300",
"% c #997700",
"& c #9D7A00",
"* c #A17D00",
"= c #AC5420",
"- c #AD5826",
"; c #B15F2E",
": c #B2602F",
"> c #B56637",
", c #B5663A",
"< c #B6693D",
"1 c #B66D42",
"2 c #B86D41",
"3 c #B87045",
"4 c #BA744B",
"5 c #BC7B54",
"6 c #BC7D58",
"7 c #A58000",
"8 c #AB8500",
"9 c #AF8800",
"0 c #B38B00",
"q c #B88F00",
"w c #B79007",
"e c #BD9300",
"r c #B79212",
"t c #978138",
"y c #B89621",
"u c #B89A33",
"i c #C19600",
"p c #C59900",
"a c #C89B00",
"s c #C69C0B",
"d c #C59E18",
"f c #C6A32A",
"g c #C7A83F",
"h c #9F8D4F",
"j c #9D8C51",
"k c #A18F50",
"l c #BD815E",
"z c #A49251",
"x c #A99654",
"c c #AE9956",
"v c #B19E57",
"b c #B6A058",
"n c #BAA45B",
"m c #BDA85C",
"M c #BF8564",
"N c #A69A72",
"B c #AA9E74",
"V c #AFA277",
"C c #B2A679",
"Z c #B6A87B",
"A c #BAAC7D",
"S c #C3845F",
"D c #C2AC5E",
"F c #C9B05A",
"G c #D1B658",
"H c #C28764",
"J c #C18B6C",
"K c #C88F6E",
"L c #C9906F",
"P c #C49174",
"I c #C99577",
"U c #C69679",
"Y c #C99679",
"T c #CB9B7F",
"R c #C7B060",
"E c #CCB462",
"W c #D0B864",
"Q c #CBB977",
"! c #A79F81",
"~ c #BEB080",
"^ c #B6B6B6",
"/ c #BDBCBC",
"( c #C89C81",
") c #CAA38C",
"_ c #D0A389",
"` c #C2B483",
"' c #CFA790",
"] c #CFAC97",
"[ c #D2A991",
"{ c #D2AF9A",
"} c #D3B19D",
"| c #C2B4AC",
" . c #C9B8AF",
".. c #D3B4A1",
"X. c #D8B5A1",
"o. c #D4B8A7",
"O. c #D9B9A6",
"+. c #D6BAAA",
"@. c #D8BBAA",
"#. c #C0BFBF",
"$. c #D5BFB2",
"%. c #CEC092",
"&. c #DACC9B",
"*. c #D1C8A9",
"=. c #D6C2B5",
"-. c #DEC5B7",
";. c #DCC6B9",
":. c #D1CBB9",
">. c #DAC9BE",
",. c #DDD5B9",
"<. c #C6C6C6",
"1. c #CCCCCC",
"2. c #D2CFC6",
"3. c #DCCEC5",
"4. c #DCD3CD",
"5. c #DED9C9",
"6. c #D4D4D4",
"7. c #DFD6D0",
"8. c #DFDCD5",
"9. c #DDDCDC",
"0. c #E1DBC9",
"q. c #E2DAD6",
"w. c #E8DDD6",
"e. c #E1DDDA",
"r. c #E4E0DE",
"t. c #E4E4E4",
"y. c #EBEBEB",
"u. c #F1EAE6",
"i. c #F4F4F4",
"p. c #F9F9F9",
"a. c None",
"32 32 297 2",
"tX c #CACACA",
"O. c #D4D2CC",
"O c #C69A00",
"- c #C19600",
"K c #A94C15",
"v c #BC9200",
"S c #B78E00",
"P c #E8E8E8",
"#. c #C3B47D",
"LX c #AA9D6F",
"k. c #A88200",
"a. c #BE7E58",
"G c #F7F7F7",
") c #C8B880",
"N c #D0A084",
"[. c #B16030",
"yX c #B97750",
"-X c #CAC4C0",
"]X c #94750C",
"7. c #EDE9E7",
"oX c #B9744D",
"%o c #B4B4B4",
",X c #C3C3C3",
"=. c #E1E1E1",
"f. c #D6B7A5",
"N. c #C9997C",
"; c #D5C487",
">o c #886A00",
"z. c #BCAD79",
" c #FFFFFF",
"ZX c #B77148",
"L. c #AA501A",
"*. c #D1A78E",
"HX c #BCBCBC",
"Z. c #CBCBCB",
"[ c #D5D3CD",
"i c #BD9300",
",. c #DADADA",
"( c #B38B00",
"@. c #AE8700",
"L c #C48662",
"0 c #E9E9E9",
"S. c #A47F00",
"M c #F8F8F8",
"rX c #B0A272",
"p. c #BF7F5A",
"w c #D1A185",
" X c #A4820C",
"A. c #A9860D",
"n c #CEBD83",
"IX c #C28F70",
"kX c #CFAD9A",
"<X c #9F7E0C",
"]. c #B26132",
"/. c #BA7851",
"NX c #9A7A0C",
",o c #8B6E0A",
"C c #B69200",
"9X c #D7C1B4",
"PX c #DFD8D4",
"zX c #C28C6C",
"V c #C2A338",
"+ c #CC9900",
"C. c #D7BBAA",
"I c #D8D7D1",
")X c #C4C4C4",
"I. c #CA9D82",
"F. c #D3D3D3",
"z c #DDDBD6",
"F c #E2E2E2",
"Oo c #8E6F00",
"~. c #B8AA77",
"> c #F1F1F1",
"Y. c #D2B19D",
"Z c #BB9000",
"@o c #A4976B",
"s. c #BD7C56",
"{. c #B05E2E",
"0. c #ECE7E4",
"EX c #C89D83",
"5X c #B3683A",
"#o c #BDBDBD",
"X c #C89C00",
"$o c #CCCCCC",
"b c #B99000",
"$. c #DBDBDB",
"G. c #EAEAEA",
"3. c #AA8400",
"VX c #AC9F70",
"6X c #A6470F",
".X c #A07C00",
"T c #CABA81",
"k c #F9F9F9",
"M. c #C8977A",
"j. c #AA870D",
"A c #AAAA00",
"XX c #B6A775",
"[X c #917000",
"^X c #96770C",
";o c #8C6F0B",
"dX c #C6A08A",
"nX c #E0D9D5",
"_. c #B66F44",
"] c #D5AF99",
"Xo c #B6B6B6",
"$X c #C5C5C5",
"x. c #D4D4D4",
"3X c #CAC9C9",
"o. c #E3E3E3",
"o c #C69900",
"'. c #B16233",
"*o c #8A6C00",
", c #F2F2F2",
"r. c #BEAF7A",
"8. c #CB9B7F",
"8X c #E3E0DE",
"SX c #D6C2B6",
"1 c #D8B6A3",
"B. c #C69173",
"4 c #CBAC3F",
"MX c #BEBEBE",
"* c #C49900",
"`X c #BC805D",
"8 c #BF9500",
"). c #AC5220",
"h. c #CDCDCD",
"^ c #D7D5CF",
"r c #E1E0DB",
">X c #DCDCDC",
"} c #B08900",
"H c #D3A68C",
"AX c #D9C9BF",
"l. c #A68100",
"l c #EBEBEB",
"2X c #B2A473",
"R. c #A74811",
"J. c #DECDC3",
"q c #FAFAFA",
"hX c #977500",
"%X c #A1800C",
"@X c #E6E4E3",
"h c #D0BF84",
"5 c #BF9200",
"FX c #E1DDDC",
"sX c #C49174",
"7 c #BF8F00",
"uX c #BF8462",
"OX c #AA4F19",
"B c #DAD9D3",
"&. c #C48865",
".o c #D5D5D5",
"s c #DFDDD8",
"m c #E4E4E4",
"6 c #C29600",
"`. c #B26334",
".. c #F3F3F3",
"}X c #A6996C",
"/ c #BD9E35",
"J c #AD531E",
"$ c #E2DED0",
"vX c #BD815E",
"c c #BB9200",
"E. c #CA9C81",
":. c #AC8600",
" . c #DDDDDD",
"cX c #DACAC0",
"!. c #A27E00",
"P. c #BD7E59",
"c. c #ECECEC",
"aX c #B06030",
"*X c #9D7A00",
"w. c #AC890D",
"=X c #B3A574",
"# c #D6C17B",
"KX c #937200",
"iX c #A84913",
"wX c #9D7D0C",
"JX c #98790C",
"&o c #8E710B",
"d. c #BD7B54",
"H. c #DAC4B7",
"n. c #C58F70",
"< c #DFC8BA",
"+X c #B87148",
"7X c #C08868",
"%. c #C58C6B",
"'X c #B8B8B8",
"|. c #C7C7C7",
"-. c #D1CFC9",
"y. c #CDA086",
"t. c #D6D6D6",
". c #C89B00",
"g. c #E5E5E5",
"f c #BE9300",
";. c #AF8A08",
"` c #F4F4F4",
"TX c #BB7B56",
"| c #C5B57E",
"<o c #8C7111",
"& c #CDAE40",
"+. c #B99B33",
"u. c #BB754C",
"(. c #C38C6C",
"DX c #D3BAAB",
"b. c #AE5725",
"fX c #C0C0C0",
"pX c #BE825F",
"q. c #CFCFCF",
"3 c #E3E2DD",
"#X c #DEDEDE",
"e. c #A88300",
"4X c #DBCBC1",
"a c #EDEDED",
"eX c #997700",
"{X c #8F6F00",
"p c #D2C186",
":o c #8A6B00",
"d c #C6A73B",
"9. c #B97247",
"UX c #B46B3F",
"bX c #C9A088",
" o c #D1B7A8",
"' c #C68D6C",
"!X c #D7D7D7",
"@ c #C49800",
"y c #BF9400",
"j c #E6E6E6",
"1o c #886B01",
"=o c #A3976B",
"}. c #C99A7F",
"X. c #B46536",
"Y c #B58C00",
">. c #C1B27C",
"E c #F5F5F5",
"! c #C1805A",
"U. c #D1AE99",
"lX c #D4BBAC",
"x c #C4A439",
"CX c #C79A80",
"^. c #D0D0D0",
"_ c #DFDFDF",
"&X c #9F7C00",
"2. c #AE8B0D",
"i. c #BF805B",
"2 c #EEEEEE",
"BX c #957400",
"oo c #90730B",
"GX c #D7C5BB",
"D. c #BAAB78",
";X c #A5440B",
":X c #E4E0DE",
"RX c #B56C41",
"W c #C78E6D",
"~X c #BABABA",
"% c #E2DDCD",
"W. c #C9C9C9",
"5. c #D8D8D8",
"u c #C09500",
"g c #BB9100",
": c #E7E7E7",
"~ c #B56637",
"(X c #A99C6E",
"WX c #CDAB97",
"jX c #AEA071",
"D c #CCBB82",
"Q. c #A7840D",
"mX c #CDA893",
"|X c #DDD6D2",
"QX c #C08A6A",
"{ c #BB9D34",
"_X c #C08A6B",
"<. c #A33E03",
"U c #C0A137",
"YX c #DDD3CD",
"-o c #B3B3B3",
"qX c #C2C2C2",
"Q c #B86D42",
"xX c #B36638",
"1. c #D1D1D1",
"R c #E0E0E0",
"1X c #9B7900",
"0X c #D3C2B8",
"6. c #EFEFEF",
"/X c #917100",
"gX c #9B7C0C",
"+o c #8C6D00",
"9 c #D4C387",
"2o c #876900",
"4. c #C0B07B",
"V. c #A6450D",
"e c #C07E57",
"T. c #D0AC96",
"v. c #C89578",
"t c #C8A93D",
"= c #BF9F00",
"m. c #C38B6A",
"K. c #C38B6C",
/* pixels */
"a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.",
"a.a.a.a a a a a a a a a a a a a a a a.a.a.a.a a a a a a a a a.a.",
"a.a.p p p p p p a p p a a p p p p p p a.a.a.p p p p p p a a a a.",
"a.p p G 0.0.0.0.0.0.0.0.0.0.0.0.0.&.s p p a.a.p p p p i i i p a.",
"a.i i W t.i.i.y.i.i.i.i.} X.i.i.i.t.,.d i i a.a.i i i i i i i a.",
"a.e i E t.p.p.p.p.p.p.p.S K p.p.p.p.t.5.f i e a.a.e i i i i i a.",
"a.e e E 9.p.p.p.p.p.p.p.S L p.p.p.p.p.y.8.g e e a.a.a.e e e e a.",
"a.e e E 9.p.p.p.p.p.p.p.S L p.p.p.p.p.p.y.9.F e e a.a.a.e e e a.",
"a.q q R 9.i.i.p.p.p.p.u.6 H u.p.i.p.i.p.p.y.9.Q e q a.a.a.e a.a.",
"a.q q D 9.i.p.i.i.i.i.> > p.p.p.i.p.p.i.y.9.%.w q 0 a.a.a.a.",
"a.0 0 D 6.i.i.i.i.i.i.> { _ > i.i.i.p.i.i.i.i.i.9.*.r 0 q a.a.a.",
"a.0 0 D 9.i.i.i.i.i.i.; X.[ > i.i.i.i.i.i.i.i.i.i.9.:.y 0 0 a.a.",
"a.0 9 D 6.i.i.y.i.i.i.; } [ > i.i.i.i.i.i.i.i.i.i.i.9.2.u 9 9 a.",
"a.8 9 m 6.y.i.i.y.i.i.; 2 2 > i.i.i.y.i.i.i.y.i.i.y.i.9.` 8 9 a.",
"a.8 8 n 1.y.i.y.i.i.y.P = ; I y.i.i.i.w.>.-.-.-.-.q.y.6.` 8 8 a.",
"a.8 8 b 1.y.y.i.y.y.y.i.5 T y.i.y.y.y.I . X . X +.6.~ 8 8 a.",
"a.* * v 1.y.y.y.y.y.y.y.5 X O O O O O , < y.y.y.y.4 X .~ 7 8 a.",
"a.8 * v <.y.y.y.y.r.4 e.1 4 +.+.@.@.+.H o O + = X ) 6.A 7 7 a.",
"a.* * v <.t.y.y.y.q. ( { y.y.y.t.y.3...} } } } =.y.1.A * * a.",
"a.* * c <.3.o.+.o.] +.t.t.y.y.y.y.t.y.t.y.t.y.y.t.1.A & * a.",
"a.* * c <.6 O O O o S t.y.t.t.t.t.t.y.t.t.t.y.t.y.y.<.Z & & a.",
"a.* & c #.t.t.t.t.q. } t.t.y.y.t.y.t.t.y.y.t.t.t.t.<.Z % & a.",
"a.& % x #.t.t.t.t.4. ( ..t.t.t.t.' 1 1 1 1 1 1 1 1 | C % % a.",
"a.$ $ x #.t.t.t.t.r.' e.6 6 t.t.t.t.J =.( ( q.=.( ) ) <.V % % a.",
"a.% $ x / t.t.t.t.t.t.r.6 P 9.t.t.t.J $.U U 8.o.P P P <.B $ $ a.",
"a.$ $ z / 9.9.t.t.t.t.2.5 6 3.t.t.t.J $.7.7.9.t.9.3.3.#.B $ $ a.",
"a.$ # k ^ t.t.t.9.t.t.1 - t.t.t.M P X $.t... / B # # a.",
"a.# # k ^ 9.t.9.t.t.9.t.9.t.t.9.t.9.2.9.t.t.t.t.9.4.3./ N $ # a.",
"a.# # j ^ <.<.<.<.<.<.1.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.^ N # # a.",
"a.# # t ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! j # # a.",
"a.a.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # @ @ @ @ @ a.a.",
"a.a.a.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ a.a.a."
" . . . . . . . . . . . . . . . . . X . . . . . . . ",
" o o o o o o o o o o o o o o o o o o O O O O O O O O + ",
" @ @ # $ $ $ $ $ $ $ $ $ $ $ % & @ @ @ . * @ @ @ @ @ @ = ",
" - - ; : > > > > , , < 1 , , 2 3 4 - - - 5 6 6 6 6 6 6 7 ",
" 8 8 9 0 q q q q q q w e q q q 2 r t y y y 5 u u u u u 7 ",
" i i p : q q q q q q w e q q q q a s d i i i 5 f f f f 7 ",
" g g h j k k k k k k w e k k k k k l z x g g g 5 c v v 7 ",
" b b n m M M M M M M N e M M M M M M 0 B V b b b C Z g A ",
" S S D F G G G G G H J K L G G G G G G P I U S S S ",
" Y Y T R E E E E E W Q ! ~ E E E E E E E j ^ / Y Y Y ",
" ( ( ) _ ` ` ` ` ` ' ' ] ~ ` ` ` ` ` ` ` ` m [ { ( ( ( ",
" } } | ...........' ' ] X...................o.O.+.} } ",
" @.@.#.$., , , , , %.&.*.X., , , , , , , , , , =.-.;.@.@. ",
" :.:.>.,.> > > > > %.<.<.X.> > > > > > > > > > P 1.2.:.:. ",
" 3.3.4.5.6.6.6.6.6.7.8.9.0.6.6.6.6.6.6.6.6.6.6.j q.w.3.3. ",
" e.e.r.t.2 2 2 2 2 2 y.u.2 2 2 2 i.p.a.s.d.f.2 g.h.j.k.k. ",
" l.l.z.x.c.c.c.c.c.c.v.b.n.n.n.n.<.m.M.N.B.V.C.o.Z.A.l.l. ",
" S.S.D.F.G.G.G.G.H.J.K.L.P.P.P.P.<.I.U.Y.T.R.E.=.W.Q.S.S. ",
" !.!.~.^.0 0 0 0 /.(.)._.0 0 0 0 `.'.].[.{.}.0 _ |. X!.!. ",
" .X.XXXq.: : : : oXOX+X@X: : : : : : : : : : : #X$X%X&X&X ",
" *X*X=X-X<.<.<.<.<.;X:Xj j j j j j j j j j j j >X,X<X*X*X ",
" 1X1X2X3X4X4X4X4X5X6X7Xg.g.g.g.8X9X9X9X9X9X9X9X0XqXwX1X1X ",
" eXeXrXtXg.g.g.g.yXuXiXpXg.g.g.4XaXsXsXsXsXsXsXdXfXgXeXeX ",
" hXhXjXW.m m m m kXlXzXxXm m m cXvXbXsXnXsXsXmX,.MXNXhXhX ",
" BXBXVX|.o.o.o.o.o.o.CXZXo.o.o.AXvXSXDXFXDXDXGX5.HXJXBXBX ",
" KXKXLX$Xo.o.o.o.o.PXIXUXYXo.o.AXvXTXRXEXWXQXo.!X~X^XKXKX ",
" /X/X(X)XF F F F F _X<.<.'.F F AX`XF F F F F F t.'X]X[X[X ",
" {X{X}XqX=.=.=.=.=.=.=.=.=.=.=.|X o=.=.=.=.=.=..oXoooOoOo ",
" +o+o@o#o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o$o%o&o+o+o ",
" *o*o=o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o;o:o:o ",
" >o>o,o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o<o1o>o>o ",
" 2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o2o "
};

View File

@ -595,13 +595,15 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case SCH_FIELD_T:
cmd.SetId( ID_POPUP_SCH_ROTATE_FIELD );
wxPostEvent( this, cmd );
break;
case SCH_BITMAP_T:
cmd.SetId( ID_POPUP_SCH_ROTATE_IMAGE );
wxPostEvent( this, cmd );
break;
default:
;
break;
}
break;

View File

@ -305,10 +305,7 @@ void TEXTE_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
{
RotatePoint( &m_Pos, aRotCentre, aAngle );
m_Orient += aAngle;
while( m_Orient >= 3600 )
m_Orient -= 3600;
while( m_Orient < -3600 )
m_Orient += 3600;
NORMALIZE_ANGLE_360( m_Orient );
}
@ -320,7 +317,7 @@ void TEXTE_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
void TEXTE_PCB::Flip(const wxPoint& aCentre )
{
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
NEGATE( m_Orient );
// NEGATE( m_Orient ); not needed: m_Mirror handles this
if( ( GetLayer() == LAYER_N_BACK ) || ( GetLayer() == LAYER_N_FRONT ) )
{
m_Mirror = not m_Mirror; /* inverse mirror */

View File

@ -120,12 +120,15 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
m_OrientationCtrl->SetSelection( 0 );
break;
case 900:
case -2700:
m_OrientationCtrl->SetSelection( 1 );
break;
case 1800:
case -1800:
m_OrientationCtrl->SetSelection( 2 );
break;
case 2700:
case -900:
m_OrientationCtrl->SetSelection( 3 );
break;
}