initial commit of code tree

git-svn-id: http://svn.lsim.tuxzone.org/trunk@2 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
catdog2
2008-10-08 22:11:27 +00:00
parent fa55af9942
commit 509cacdca6
41 changed files with 6455 additions and 0 deletions

11
src/ReadMe Normal file
View File

@@ -0,0 +1,11 @@
READ THIS IN ORDER TO COMPILE THE Qt4 TEMPLATE
----------------------------------------------
Before compiling, check the Qt Options, go to
Project->Project Options->C++ Support and open the Qt Options tab.
Check that the Qt installation directory is correct for the Qt version you've chosen.
------------------
Andreas Pakulat
July 2006

10
src/application.qrc Normal file
View File

@@ -0,0 +1,10 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>editcopy.xpm</file>
<file>editcut.xpm</file>
<file>filenew.xpm</file>
<file>fileopen.xpm</file>
<file>editpaste.xpm</file>
<file>filesave.xpm</file>
</qresource>
</RCC>

21
src/constants.h Normal file
View File

@@ -0,0 +1,21 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <cmath>
const double PI = acos( -1.0 );

193
src/editcopy.xpm Normal file
View File

@@ -0,0 +1,193 @@
/* XPM */
static char *editcopy[] = {
/* columns rows colors chars-per-pixel */
"32 32 155 2",
" c black",
". c #191000",
"X c #221700",
"o c #2E2300",
"O c #452E00",
"+ c #433200",
"@ c #493000",
"# c #553800",
"$ c #5D4600",
"% c #6B5000",
"& c #724B00",
"* c #7D5E00",
"= c #6E694F",
"- c #7E795F",
"; c #865900",
": c #8A5C00",
"> c #8B6800",
", c #936200",
"< c #926D00",
"1 c #926B1A",
"2 c #967000",
"3 c #9B721D",
"4 c #9B7625",
"5 c #9E792A",
"6 c #A47C00",
"7 c #AA7D00",
"8 c #A1761A",
"9 c #A57816",
"0 c #A4791D",
"q c #AD8200",
"w c #B28500",
"e c #AE8530",
"r c #B99626",
"t c #97906D",
"y c #B18D48",
"u c #B49049",
"i c #B89542",
"p c #BA9C4D",
"a c #BD9E52",
"s c #BFA053",
"d c #B8AE78",
"f c #BEB47E",
"g c #C49300",
"h c #C89600",
"j c #C19D2C",
"k c #C1A43F",
"l c #C09E4E",
"z c #CFB457",
"x c #C9B159",
"c c #CAB573",
"v c #D4BF7C",
"b c #FFDF62",
"n c #FFE064",
"m c #FFE16D",
"M c #FFE372",
"N c #FFE479",
"B c #A19D8E",
"V c #ABA89A",
"C c #BEB580",
"Z c #BDB488",
"A c #B8B496",
"S c #AEADAA",
"D c #B3AFA1",
"F c #BCBBB6",
"G c #BFBFB9",
"H c #C0B680",
"J c #C4BA85",
"K c #C6BD8B",
"L c #CBB589",
"P c #C8BE88",
"I c #C3BC90",
"U c #CBC18C",
"Y c #CCC493",
"T c #D7CB8C",
"R c #DAC786",
"E c #D8C789",
"W c #DAC98B",
"Q c #D0C690",
"! c #D4CA94",
"~ c #D4CC9B",
"^ c #D8CE98",
"/ c #DCD29C",
"( c #C6C3B7",
") c #C8C6BE",
"_ c #D5C5A5",
"` c #DBC8A1",
"' c #DBD4A2",
"] c #DED9AE",
"[ c #D9D5B1",
"{ c #E0CC82",
"} c #E8D98B",
"| c #E8D991",
" . c #E1D7A1",
".. c #E5DBA5",
"X. c #E4DCAB",
"o. c #E8DDAA",
"O. c #E1DCB2",
"+. c #E1DCB8",
"@. c #FFE683",
"#. c #FFE78A",
"$. c #FFE885",
"%. c #FFE88D",
"&. c #FFE992",
"*. c #FFEC9D",
"=. c #FFF09F",
"-. c #ECE2AC",
";. c #E5E0B6",
":. c #E5E1B8",
">. c #EBE4B6",
",. c #EAE5BC",
"<. c #F0E5A8",
"1. c #FFEDA3",
"2. c #FFEDA9",
"3. c #F1E8B8",
"4. c #FFEFB1",
"5. c #FFF1A5",
"6. c #FFF2AD",
"7. c #FFF2B4",
"8. c #FFF2BC",
"9. c #CAC8C2",
"0. c #D6D4CB",
"q. c #DFDAC5",
"w. c #D4D2D0",
"e. c #E0D7C5",
"r. c #E4DAC3",
"t. c #E8DEC7",
"y. c #E0DFD3",
"u. c #E6E2C2",
"i. c #E8E1C5",
"p. c #EBE3CB",
"a. c #EEE9C2",
"s. c #E8E6DC",
"d. c #F3EDC3",
"f. c #F2EDCB",
"g. c #F7F2CD",
"h. c #FFF3C3",
"j. c #FFF4CA",
"k. c #FFF8C5",
"l. c #FFF8CD",
"z. c #FDF5D2",
"x. c #FFF7D8",
"c. c #FFF9D4",
"v. c #FFF9DC",
"b. c #E9E8E7",
"n. c #F3EFE3",
"m. c #F2F0E3",
"M. c #F4F2EA",
"N. c #FBF7E6",
"B. c #FEF9E3",
"V. c #FFFBEC",
"C. c #F4F4F3",
"Z. c #F8F7F6",
"A. c #FEFCF4",
"S. c #FEFEFC",
"D. c None",
/* pixels */
"D.D.D.D.D.D.D.D.D.D.D.D.h g g g g g g g g g g w * D.D.D.D.D.",
"D.D.D.D.D.D.D.D.D.D.D.D.g z.z.g.g.g.g.g.g.z.g.R 2 D.D.D.D.D.",
"D.D.D.D.D.D.D.D.D.D.D.D.g z.d.3.3.3.3.3.3.>.f.g.z < D.D.D.D.",
"D.D.D.D.D., : ; , : : : 7 a i a R -.-.-.-.' m.u.g.j > D.D.D.",
"D.D.D.D., u y y L L L L ` t.t.e.e v -.-.-.Y b.S.+.d.q D.D.D.",
"D.D.D.D., S.S.S.S.S.S.S.S.Z.b.S.e.i W o.o.K w.S.A.u.q D.D.D.",
"D.D.D.D., S.S.S.A.S.S.S.S.M.w.S.S._ a E ..K 0.S.S.q.7 D.D.D.",
"D.D.D.D., S.A.V.A.A.A.V.A.n.9.S.S.C._ a ..Y t = - A 6 D.D.D.",
"D.D.D.D., A.A.V.A.V.V.V.A.n.9.S.S.S.Z.3 ' ' K Z A ] 7 D.D.D.",
"D.D.D.D., A.V.B.V.V.B.V.V.n.( F S S G 5 ' | / / X.f.q D.D.D.",
"D.D.D.D., A.V.x.B.x.V.B.N.B.e.D B V ) 3 / / ^ ^ ' a.q D.D.D.",
"D.D.D.D., V.N.N.B.B.B.v.v.N.z.p.i.p.n.8 ^ / ! Q ' a.q D.D.D.",
"D.D.D.D., B.B.x.v.x.z.j.j.x.z.z.c.B.B.0 ! ! ! ^ ' ,.q D.D.D.",
"D.D.D.D., B.h.h.z.z.x.x.z.z.z.h.j.x.v.0 ! Q Y ! ~ ,.q D.D.D.",
"D.D.D.D., v.c.k.x.h.j.j.j.z.8.h.k.j.v.0 U T U U ~ ,.q D.D.D.",
"D.D.D.D., v.k.z.h.h.h.j.8.j.h.h.j.k.v.0 U U U U Y ;.q D.D.D.",
"D.D.D.D., x.h.8.8.h.j.8.8.4.h.4.8.h.x.8 P H P P ~ ;.q D.D.D.",
"D.D.D.D., v.h.4.4.8.8.4.1.z.h.8.4.h.c.8 H J H J Y ;.q D.D.D.",
"D.D.D.D., c.2.z.j.4.*.1.1.8.2.2.*.2.l.8 J J H J U ] q D.D.D.",
"D.D.D.D., l.h.2.4.4.1.%.1.&.2.4.8.7.k.8 f d f H U ] q D.D.D.",
"D.D.D.D., z.8.#.1.4.1.*.1.1.1.*.N 4.l.8 f f C K ~ :.q D.D.D.",
"D.D.D.D., 8.&.4.#.%.4.&.@.#.%.%.&.2.l.8 K K Y ~ ] ,.6 D.D.D.",
"D.D.D.D., h.&.#.*.1.1.%.N N #.&.*.1.l.0 ' ] T x r 6 % D.D.D.",
"D.D.D.D., 4.4.%.*.#.b &.N M b M 2.1.k.9 k 7 > $ o D.D.D.",
"D.D.D.D., 7.&.N 5.&.N @.*.b N M N =.k., + D.D.D.",
"D.D.D.D., 6.N N M M &.#.N 2.$.%.8.6.<.& D.D.D.D.D.",
"D.D.D.D., 5.&.7.n $.m M 1.7.7.o.c 5 & @ D.D.D.D.D.D.D.D.D.",
"D.D.D.D., 7.*.m %.=.&.7.} p 1 % # X D.D.D.D.D.D.D.D.D.D.",
"D.D.D.D., 6.5.5.5.| a 1 & + . D.D.D.D.D.D.D.D.D.D.",
"D.D.D.D., 6.-.a 1 & O . D.D.D.D.D.D.D.D.D.D.D.D.",
"D.D.D.D.; : % O . D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.",
"D.D.D.D. D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D."
};

252
src/editcut.xpm Normal file
View File

@@ -0,0 +1,252 @@
/* XPM */
static char *editcut[] = {
/* columns rows colors chars-per-pixel */
"32 32 214 2",
" c #000000",
". c #0B0B0B",
"X c #181300",
"o c #1D190B",
"O c #131313",
"+ c #1B1B1B",
"@ c #211E11",
"# c #26231A",
"$ c #2A2513",
"% c #2E2912",
"& c #2E2A19",
"* c #372E0B",
"= c #302A12",
"- c #312C1B",
"; c #3A320F",
": c #3C3415",
"> c #3C351B",
", c #232323",
"< c #2B2922",
"1 c #2C2C2C",
"2 c #302E26",
"3 c #353120",
"4 c #3F3B2D",
"5 c #313131",
"6 c #3A3A3A",
"7 c #423814",
"8 c #493E17",
"9 c #413D2F",
"0 c #423F32",
"q c #4F4319",
"w c #5C4A00",
"e c #5F4F0D",
"r c #514410",
"t c #554813",
"y c #4E472C",
"u c #444136",
"i c #4A483F",
"p c #534B2B",
"a c #504B37",
"s c #514C3A",
"d c #654F04",
"f c #604F0B",
"g c #665200",
"h c #675509",
"j c #6B5405",
"k c #6C5807",
"l c #6C590B",
"z c #745B04",
"x c #715D0A",
"c c #7B5B02",
"v c #625B3B",
"b c #7E6815",
"n c #6C643E",
"m c #4D4B42",
"M c #494949",
"N c #504D43",
"B c #54534C",
"V c #515151",
"C c #5D5B54",
"Z c #656048",
"A c #736A44",
"S c #726C54",
"D c #77725B",
"F c #696968",
"G c gray50",
"H c #826203",
"J c #806609",
"K c #836907",
"L c #8D6A03",
"P c #9A6F00",
"I c #9B7005",
"U c #9E730E",
"Y c #9C7511",
"T c #85732C",
"R c #88783B",
"E c #AE7C00",
"W c #A87B13",
"Q c #847B53",
"! c #827D64",
"~ c #9C862E",
"^ c #A98A1F",
"/ c #B28D0A",
"( c #B88D00",
") c #B2821A",
"_ c #B18E1B",
"` c #B3941C",
"' c #A88E2C",
"] c #A28C36",
"[ c #AE9224",
"{ c #89815E",
"} c #87826D",
"| c #858174",
" . c #888370",
".. c #8E8A7D",
"X. c #928C71",
"o. c #A28E44",
"O. c #AA9F74",
"+. c #B9A456",
"@. c #BDA85B",
"#. c #B2A068",
"$. c #C28700",
"%. c #CC8E00",
"&. c #C29A00",
"*. c #C4962F",
"=. c #CCA100",
"-. c #D6A800",
";. c #D1AC1B",
":. c #DDB31A",
">. c #D2A922",
",. c #D4AE2B",
"<. c #DBA12E",
"1. c #DBA433",
"2. c #DDB428",
"3. c #D2B23B",
"4. c #E6A200",
"5. c #E8A509",
"6. c #EAAF00",
"7. c #EFAC1E",
"8. c #F5A100",
"9. c #FFAD02",
"0. c #FCAF0D",
"q. c #FCB005",
"w. c #FFB60C",
"e. c #FFBD00",
"r. c #FFBD16",
"t. c #E3B432",
"y. c #E8BF3C",
"u. c #F6BE2F",
"i. c #C6A949",
"p. c #D9A948",
"a. c #D8AB52",
"s. c #DBBA45",
"d. c #C5B162",
"f. c #ECB74D",
"g. c #EFB841",
"h. c #EFBE4A",
"j. c #EABA55",
"k. c #FDC006",
"l. c #FFC10B",
"z. c #FFC800",
"x. c #FFC90D",
"c. c #FAC113",
"v. c #FBC11C",
"b. c #FDC910",
"n. c #EDC233",
"m. c #F5C32D",
"M. c #FFC728",
"N. c #F4C537",
"B. c #F6C63A",
"V. c #F5CB36",
"C. c #FFD73D",
"Z. c #E9C659",
"A. c #EAC85A",
"S. c #FFDA4B",
"D. c #FFDD5D",
"F. c #E9CD6B",
"G. c #FFD560",
"H. c #FFE06C",
"J. c gray56",
"K. c #959595",
"L. c gray62",
"P. c #A6A18A",
"I. c #A8A69E",
"U. c #AEA895",
"Y. c #B3AC8F",
"T. c #B8AF8B",
"R. c #B4AD96",
"E. c #B8B199",
"W. c #A4A4A4",
"Q. c #AAAAAA",
"!. c #B0ADA3",
"~. c #BBB6A3",
"^. c #B1B1B1",
"/. c #B9B9B6",
"(. c #BBBBBA",
"). c #C5BC9D",
"_. c #C2BCA2",
"`. c #C1BEB5",
"'. c #D2C38E",
"]. c #DCC78C",
"[. c #C7C0A7",
"{. c #C7C2AE",
"}. c #C7C3B2",
"|. c #C5C2B8",
" X c #CAC6B6",
".X c #CBC9BE",
"XX c #D9D3BB",
"oX c #E6D08A",
"OX c #E7DEBD",
"+X c #ECDEB3",
"@X c #FFF0B9",
"#X c #C5C5C5",
"$X c #CECCC7",
"%X c #D0CEC5",
"&X c #D0CFC8",
"*X c #D2D1CB",
"=X c #DBD6C5",
"-X c #DBD7C9",
";X c #D3D3D1",
":X c #DBDBDB",
">X c #E5E1D6",
",X c #E5E3DA",
"<X c #E8E5D9",
"1X c #EDEADC",
"2X c #FEF6DE",
"3X c #E6E6E6",
"4X c #E9E7E2",
"5X c #E9E8E4",
"6X c #EDECEA",
"7X c #F2F1EB",
"8X c #F1F1F1",
"9X c #F8F7F4",
"0X c #F9F8F8",
"qX c None",
/* pixels */
"qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqXqXqX5 5 5 1 , qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqXqX5 V /.&XQ.F 1 , qXqXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqXqX5 _.D.S.H.@X&X6 . qXqXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqXqX5 S.=.w g &.C...+ qXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqXqX5 -.' + o t z.d., qXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqX5 C V.@.+ 3 :.3., qXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqX5 '.b.F.6 , 1 s.,., qXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqX1 b ( n.OXE.E.F.^ + qXqXqXqXqXqXqXqX5 5 1 , ",
"qXqXqXqXqXqXqX l x K A.oXoXZ.i., qXqXqXqXqXqX5 V &X0X6X, ",
"qXqXqXqXqXqXqX 8 ( c.v.k.N.1 qXqXqXqX5 V $X0X0X9XXX, ",
"qXqXqXqXqXqXqXqX O t 6.e.e.k.S O 5 5 V $X8X8X8X1XD : O ",
"qXqXqXqXqXqXqXqXqXqX 3 J e.G.7X#.+ . 5 C |.3X3X5X4X_.4 % ",
"qXqXqXqXqXqXqXqXqXqX q ].0X0X+X, B }.:X:X:X:X=XS & o ",
"qXqXqXqXqXqXqXqXqXqXqX + M 8X8X7XU.Q.#X*X*X*XR.< % qX",
"qXqXqXqXqXqXqXqXqXqXqXqX, 1 X6XW.G Q.L.^.{.Z @ . qXqX",
"qXqXqXqXqXqXqXqXqXqX5 5 m P.W.:X6 . 3X/.X., @ qXqXqXqX",
"qXqXqXqXqXqXqX5 5 5 n +.R.W.J.K.W.^.:X:X1Xm + qXqXqXqXqX",
"qXqXqXqXqX5 5 i o.y.v.q./ P.I.} | R.&X*X;X8X ., qXqXqXqXqXqX",
"qXqX5 5 5 R 3.M.5.E L 7.4._ 0 + O + i ).#X#X5X~., O qXqXqXqX",
"qX5 u ] m.r.%.H r : , t.0.P 7 $ , { `.(.;X-X, + qXqXqX",
"5 u 2.w.$.k t o , ~ h.P l , u T.^.#X<XN , qXqX",
"5 >.9.U r . . , T B.*.x qX + , Q !.Q.<XC , qX",
"p q.1.> . + 1 [ m.p.k . qXqXqXqX , u O.W.;X! + ",
"4 8.j.` p 5 y ;.u.a.d % qXqXqXqXqXqX O , A P._., ",
"1 x <.f.m.x.b.y.a.g ; qXqXqXqXqXqXqXqX + 0 v O ",
" - h c W W W W z : qXqXqXqXqXqXqXqXqXqX . . ",
" * e l l f X qXqXqXqXqXqXqXqXqXqXqXqXqX ",
"qX qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX qX",
"qXqXqX qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX",
"qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX"
};

295
src/editpaste.xpm Normal file
View File

@@ -0,0 +1,295 @@
/* XPM */
static char *editpaste[] = {
/* columns rows colors chars-per-pixel */
"32 32 257 2",
" c black",
". c #0D0900",
"X c #191000",
"o c #221700",
"O c #2A1B00",
"+ c #332200",
"@ c #3E2900",
"# c #3A2804",
"$ c #4D3300",
"% c #4B3E15",
"& c #44391B",
"* c #543800",
"= c #5A3B00",
"- c #4D4015",
"; c #524E25",
": c #5A4F2C",
"> c #524E3D",
", c #58562F",
"< c #53503E",
"1 c #5E623B",
"2 c #634100",
"3 c #684500",
"4 c #6E4900",
"5 c #614F11",
"6 c #685416",
"7 c #734C00",
"8 c #784F00",
"9 c #755B00",
"0 c #7C5200",
"q c #7C5A00",
"w c #7B570F",
"e c #69562F",
"r c #786600",
"t c #7F6A00",
"y c #766300",
"u c #60613F",
"i c #7C6422",
"p c #545143",
"a c #54524B",
"s c gray32",
"d c #5D5D57",
"f c #616641",
"g c #67695D",
"h c #6B734D",
"j c #6C7553",
"k c #616261",
"l c #686A64",
"z c #6B7162",
"x c #727272",
"c c #003DFF",
"v c #0043FF",
"b c #004BFF",
"n c #0053FF",
"m c #015AFF",
"M c #0063FF",
"N c #046DFF",
"B c #0865FF",
"V c #0378FF",
"C c #1663FF",
"Z c #1576FF",
"A c #2678FF",
"S c #6F7B84",
"D c #77856D",
"F c #7B8B75",
"G c #0083FF",
"H c #0197FF",
"J c #0B92FF",
"K c #1385FF",
"L c #01A5FF",
"P c #0DB5FF",
"I c #3096FF",
"U c #2DADFF",
"Y c #2FBCFF",
"T c #22C6FF",
"R c #2AC5FF",
"E c #30D0FF",
"W c #38D5FF",
"Q c #4493F1",
"! c #5F83FF",
"~ c #5F8AFF",
"^ c #5290E4",
"/ c #5F92FF",
"( c #4CAAFE",
") c #40B8FF",
"_ c #779DCB",
"` c #6693E2",
"' c #6290FF",
"] c #649DFF",
"[ c #71A6E5",
"{ c #79A4FF",
"} c #7FB3FF",
"| c #68B8F3",
" . c #42DCFF",
".. c #47E0FF",
"X. c #58E9FF",
"o. c #64C0EB",
"O. c #6ADFEF",
"+. c #825600",
"@. c #845A00",
"#. c #8B5C00",
"$. c #905F00",
"%. c #8C6103",
"&. c #876807",
"*. c #8A6111",
"=. c #886E1B",
"-. c #887600",
";. c #8C7A00",
":. c #936200",
">. c #986800",
",. c #926C22",
"<. c #987A3F",
"1. c #A07200",
"2. c #A27511",
"3. c #A97D15",
"4. c #A77B14",
"5. c #998712",
"6. c #A68000",
"7. c #A78F00",
"8. c #AD8016",
"9. c #AC9600",
"0. c #BB8F00",
"q. c #A99B2A",
"w. c #B9A000",
"e. c #B3A63C",
"r. c #958D43",
"t. c #988F44",
"y. c #9A9346",
"u. c #9F9948",
"i. c #8B897C",
"p. c #958F6F",
"a. c #98937B",
"s. c #A68443",
"d. c #B08C41",
"f. c #AF9462",
"g. c #B39864",
"h. c #B2A850",
"j. c #BDB355",
"k. c #C3972F",
"l. c #C5A400",
"z. c #CCAC00",
"x. c #D7BB00",
"c. c #CCA030",
"v. c #CBB43E",
"b. c #E4AD0C",
"n. c #ECB600",
"m. c #EDB900",
"M. c #F2BB00",
"N. c #C1B84C",
"B. c #C1B757",
"V. c #C5BB58",
"C. c #C9BE5A",
"Z. c #C2A978",
"A. c #DFC000",
"S. c #FDCB00",
"D. c #F6C300",
"F. c #FFD100",
"G. c #FEDB00",
"H. c #FFDF0E",
"J. c #F5D500",
"K. c #FBCD39",
"L. c #FFE832",
"P. c #FFE432",
"I. c #CEC25C",
"U. c #D7C648",
"Y. c #DDC74B",
"T. c #D0C55E",
"R. c #D3C85F",
"E. c #D5C960",
"W. c #DDD264",
"Q. c #E0CA4C",
"!. c #E7D14E",
"~. c #EFDA51",
"^. c #F4D050",
"/. c #F9D452",
"(. c #FEDD53",
"). c #E2D765",
"_. c #E9DD69",
"`. c #E6DD68",
"'. c #FDDB6E",
"]. c #FFEE4F",
"[. c #FEE354",
"{. c #FEEA55",
"}. c #F7E153",
"|. c #FFF056",
" X c #ECE16A",
".X c #F1E56D",
"XX c #F7EA6F",
"oX c #F7EB70",
"OX c #F9EC70",
"+X c #FEF372",
"@X c #979486",
"#X c gray60",
"$X c #969596",
"%X c #8AA193",
"&X c #82A89B",
"*X c #8CAEA3",
"=X c #86A7A9",
"-X c #8BA2B1",
";X c #ACA580",
":X c #A5A291",
">X c #B3AF98",
",X c #B8B7AF",
"<X c #B3B2AB",
"1X c #B1B1B1",
"2X c #A6B8FF",
"3X c #88DEE0",
"4X c #8BF0FE",
"5X c #A4CFC6",
"6X c #BFD5FF",
"7X c #BFDCFF",
"8X c #C2AD82",
"9X c #CBB489",
"0X c #D2BF9B",
"qX c #D1C19F",
"wX c #C8C4AA",
"eX c #CFCBB7",
"rX c #D8C7A6",
"tX c #D2C2A3",
"yX c #D5CCB3",
"uX c #DAD1A1",
"iX c #DDD5BB",
"pX c #D7D1B3",
"aX c #ECE5BB",
"sX c #F5EBB5",
"dX c #F5ECBC",
"fX c #F8EEB8",
"gX c #FCF2BC",
"hX c #CBCBCB",
"jX c #D8D6C7",
"kX c #DDDDDD",
"lX c #E4DAC2",
"zX c #ECE6C7",
"xX c #EBE6D9",
"cX c #E9E3D0",
"vX c #F5EDC4",
"bX c #F6EFC9",
"nX c #F0EBD5",
"mX c #F3EFDB",
"MX c #FCF3C5",
"NX c #FCF4CA",
"BX c #F7F0CA",
"VX c #F6F0D2",
"CX c #F9F3D3",
"ZX c #F9F4DC",
"AX c #FFF8D4",
"SX c #FFF9DB",
"DX c #E7E7E4",
"FX c #EBEBE9",
"GX c #F1EDE1",
"HX c #F9F6E5",
"JX c #FDF9E4",
"KX c #FEFBEB",
"LX c #F6F2E6",
"PX c #FEFCF3",
"IX c #FEFDFD",
"UX c #F4F4F3",
"YX c None",
/* pixels */
"YXYXYXYXYXYX YXYXYXYXYXYXYXYXYXYXYXYXYX",
"YXYXYXYX:.:.+ IXIXIXIXIXIXIXIXFX# +.7 YXYXYXYXYXYXYXYXYXYXYX",
"YXYXYX>.k.c.6 FXkXkXkXDXkXkXkXx i b.>.+ YXYXYXYXYXYXYXYXYXYX",
"YXYXYX:.'.K.=.hX1X1X1X1X1X1X1Xd &.0.%.* 7 #.#.:.$.#.2 YXYXYX",
"YXYXYX:./.M.%.$Xk k d s s s e w >.2.d.s.Z.9XrXlXxX0X7 YXYXYX",
"YXYXYX:.^.M.1.: % % - % 5 6 &.GXIXIXPXPXPXPXPXLXIXIXg.3 YXYX",
"YXYX#X:.^.m.v.y.r.r.r.r.h.h.2.IXPXPXKXKXPXKXHXxXUXIXIXf.4 YX",
"YXYX#X:.^.m.Y.I.B.j.j.j.V.I.4.PXKXJXKXJXKXKXmXjXFXIXIXUX+. YX",
"YXYX#X:.^.m.Y.E.I.j.j.j.I.R.8.PXKXSXJXJXJXSXnXeXDXIXIXUX<. YX",
"YXYXYX:./.M.!.W.R.I.T.R.E.W.8.UXJXJXSXSXSXSXnXeX:X@Xi.<X7 ",
"YXYXYX:./.D.~._.`.W.W.W.W. X8.PXJXSXAXSXSXSXVXjX>X@X@X,X4 ",
"YXYXYX:.(.S.}..X X X X X X X8.PXSXAXAXAXAXAXNXzXpXwXwXjX7 ",
"YXYXYX:.(.S.[.OXOXOXoXoXt.; O s a p p p p a.AXMXvXaXzXGX+. ",
"YXYXYX:.(.S.[.+X+X+XOX+X; 7X2X] / / ~ ! 2Xp MXNXNXNXSXKX+. YX",
"YXYXYX:.(.F.|.+X+X+X+X+Xy., _ A m b v c ! p MXMXgXMXAXKX+. YX",
"YXYXYX:.(.F.|.+X+X+X+X+X+Xj.& ^ B n b v ' < gXMXgXgXNXKX+. YX",
"YXYXYX:.(.F.U.W.+X+X+X+X).y.g Q N m n b ~ < gXgXgXgXAXJXq YX",
"YXYXYX:.[.l.j j y.I.j.r.1 =X( K N M m b ~ < gXgXgXgXNXKX+. YX",
"YXYXYX:.[.t 5X4X&XD F =X| U J G V Z A C / < fXgXgXgXMXHX+. YX",
"YXYXYX:.[.l.h 3XX...W T P L H K I [ S ` { < fXfXfXfXMXKX+. YX",
"YXYXYX:.[.G.e.1 *XO...E R Y Y | -Xd Z.k 6X> fXfXfXfXBXJX+. YX",
"YXYXYX:.[.G.{.`.u.1 F &X*X%Xz l a.uXfXp.> p.sXsXsXfXBXJX+. YX",
"YXYXYX:.{.G.|.+X+X XN.q.5.7.q cXvXsXsXsXsXsXsXsXsXsXBXKX+. YX",
"YXYXYX:.|.G.].|.L.H.G.G.G.A.1.JXvXsXsXsXsXsXsXsXfXdXCXPX+. YX",
"YXYXYX:.{.G.G.G.G.G.x.w.;.t :.HXdXsXsXsXsXsXdXvXBXZXLXtX= YX",
"YXYXYX:.{.G.J.x.9.;.r 9 q 0 #.KXvXsXaXsXvXBXCXHXiXg.*.= O YX",
"YXYXYX:.L.9.-.y 9 q 0 = + #.HXbXdXbXVXZXcX8X,.3 $ . YX",
"YXYXYX%.z.9 q 7 * o $.PXZXmXmX0Xs.0 $ X YX",
"YXYXYX8 0 = o :.IXpXg.*.= O YXYXYXYX",
"YXYXYX YXYX@.#.2 @ . YXYXYXYXYXYX",
"YXYXYX YXYXYXYXYX YXYXYXYXYXYXYXYXYX",
"YXYXYXYXYXYXYXYXYXYXYXYXYXYX YXYXYXYXYXYXYXYXYXYXYXYX"
};

99
src/expdoublespinbox.cpp Normal file
View File

@@ -0,0 +1,99 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "expdoublespinbox.h"
#include <QRegExp>
#include <QLocale>
#include <QRegExpValidator>
#include <QLineEdit>
#include <QtDebug>
#include <cmath>
ExpDoubleSpinBox::ExpDoubleSpinBox()
: QDoubleSpinBox() {
setPositiveExp(4);
setNegativeExp(3);
}
ExpDoubleSpinBox::~ExpDoubleSpinBox() {
}
double ExpDoubleSpinBox::valueFromText ( const QString& text ) const {
return text.toDouble();
}
QString ExpDoubleSpinBox::textFromValue ( double val ) const {
//qDebug() << val;
if((val < pow(10,getPositiveExp()) && val > 1) || (val > -pow(10,getPositiveExp()) && val < -1) || val == 0) {
//return QDoubleSpinBox::textFromValue ( val );
return QString("%L1").arg(val,0,'f',decimals());
}
else if ( (val >= pow(10, -getNegativeExp()) && val <= 1 ) || (val <= -pow(10, -getNegativeExp()) && val >= -1 ) ){
//return QDoubleSpinBox::textFromValue ( val );
return QString("%L1").arg(val,0,'f',decimals());
}
else {
return QString("%L1").arg(val,0,'e',decimals());
}
//return QDoubleSpinBox::textFromValue ( val );
}
QValidator::State ExpDoubleSpinBox::validate ( QString & input, int & pos ) const {
QLocale loc;
QChar decpoint = loc.decimalPoint(); //Locale abhaengiger dezimaltrenner
QString regExpString =QString("[\\-,\\+]?\\d*\\%1?\\d+([e,E][\\-,\\+]\\d+)?").arg(decpoint);
QRegExp regExp(regExpString);
QValidator *validator = new QRegExpValidator(regExp, 0);
//qDebug() << validator->validate(input,pos);
return validator->validate(input,pos);
}
QDoubleSpinBox::StepEnabled ExpDoubleSpinBox::stepEnabled () const {
QAbstractSpinBox::StepEnabled enabled = QDoubleSpinBox::stepEnabled();
if(
(value() > 0 && value() < pow(10, -getNegativeExp())) ||
(value() < 0 && value() > -pow(10, -getNegativeExp()))
) { //kein step bei negativen Zehnerpotenzen
enabled = QAbstractSpinBox::StepNone;
}
return enabled;
}
void ExpDoubleSpinBox::setNegativeExp (int exponent) {
if (negativeExp != exponent && exponent >= 0) negativeExp = exponent;
}
void ExpDoubleSpinBox::setPositiveExp (int exponent) {
if (positiveExp != exponent && exponent >= 0) positiveExp = exponent;
}
const int ExpDoubleSpinBox::getNegativeExp () const{
return negativeExp;
}
const int ExpDoubleSpinBox::getPositiveExp () const{
return positiveExp;
}
void ExpDoubleSpinBox::stepBy ( int steps ) {
QDoubleSpinBox::stepBy(steps);
}

60
src/expdoublespinbox.h Normal file
View File

@@ -0,0 +1,60 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef EXPDOUBLESPINBOX_H
#define EXPDOUBLESPINBOX_H
#include <QDoubleSpinBox>
#include <QValidator>
//! DoubleSpinBox f&uuml;r Zehnerpotenzen
/**
Eine DoubleSpinBox, die mit Zehnerpotenzen umgehen kann
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class ExpDoubleSpinBox : public QDoubleSpinBox {
public:
ExpDoubleSpinBox();
~ExpDoubleSpinBox();
virtual double valueFromText ( const QString& text ) const;
virtual QString textFromValue ( double val ) const;
virtual QValidator::State validate ( QString & input, int & pos ) const;
virtual void stepBy ( int steps );
///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden
void setNegativeExp (int exponent);
///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden
const int getNegativeExp () const;
///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden
void setPositiveExp (int exponent);
///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden
const int getPositiveExp () const;
protected:
virtual QDoubleSpinBox::StepEnabled stepEnabled () const;
private:
int negativeExp;
int positiveExp;
};
#endif

130
src/fielditem.cpp Normal file
View File

@@ -0,0 +1,130 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "fielditem.h"
#include "homoefielditem.h"
#include <QDebug>
FieldItem::FieldItem()
: QGraphicsItem() {
myRotation = 0;
myScenePos = QPointF(0,0);
}
FieldItem::~FieldItem() {
}
/*!
\fn FieldItem::isFieldItem(QGraphicsItem *item)
*/
bool FieldItem::isFieldItem(QGraphicsItem *item) {
QList<int> fieldItemTypes;
// ---- Definiert die FieldItem typen
fieldItemTypes << HomoEFieldItem::Type;
// ----
for (int i=0; i<fieldItemTypes.count();++i) {
if (item->type() == fieldItemTypes.at(i)) {
return true;
}
}
return false;
//return item->type() == HomoEFieldItem::Type;
}
void FieldItem::handleSceneChange(const QList<QRectF> & /*region*/) {
if (myScenePos != scenePos()) {
myScenePos = scenePos();
emit ScenePosChanged(myScenePos);
emit ScenePosXChanged(myScenePos.x());
emit ScenePosYChanged(myScenePos.y());
}
}
void FieldItem::setScenePosX(double newXPos) {
moveBy(newXPos - scenePos().x(), 0);
//qDebug() << mapFromScene(0 , 0);
}
void FieldItem::setScenePosY(double newYPos) {
moveBy(0,newYPos - scenePos().y());
}
void FieldItem::setRotation(int angle) {
if (angle == myRotation) return;
setTransform(QTransform().translate(boundingRect().width()/2.0, boundingRect().height()/2.0).rotate(angle).translate(-boundingRect().width()/2.0, -boundingRect().height()/2.0));
myRotation = angle;
emit rotationChanged(angle);
emit rotationChanged();
}
void FieldItem::setRectFHeight(double newHeight) {
QRectF currRect = getRectF();
if (currRect.height() == newHeight) return;
currRect.setHeight(newHeight);
setRectF(currRect);
}
void FieldItem::setRectFWidth(double newWidth) {
QRectF currRect = getRectF();
if (currRect.width() == newWidth) return;
currRect.setWidth(newWidth);
setRectF(currRect);
}
void FieldItem::setRectF(QRectF rect) {
if (rect == sizeRect) return;
double newHeight = rect.height();
double newWidth = rect.width();
double oldHeight = sizeRect.height();
double oldWidth = sizeRect.width();
prepareGeometryChange();
sizeRect = rect;
prepareGeometryChange();
//breite geandert
if (newWidth != oldWidth) emit widthChanged(newWidth);
//hoehe geandert
if (newHeight != oldHeight) emit heightChanged(newHeight);
}
void FieldItem::setRect(QRectF rect) {
setRectF(rect);
}
QRectF FieldItem::getRectF() const {
return sizeRect;
}
QRectF FieldItem::rect() const {
return getRectF();
}
/*!
\fn FieldItem::getRotation()
*/
int FieldItem::getRotation()
{
return myRotation;
}

107
src/fielditem.h Normal file
View File

@@ -0,0 +1,107 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef FIELDITEM_H
#define FIELDITEM_H
#include <QGraphicsItem>
#include <QList>
//! Ein abstraktes Feld GraphicsItem
/**
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class QPointF;
class FieldItem :public QObject, public QGraphicsItem {
Q_OBJECT
public:
FieldItem();
virtual ~FieldItem();
//! gibt das Rechteck des Feldes zur&uuml;ck
virtual QRectF getRectF() const;
//! alias f&uuml;r getRectF()
QRectF rect() const;
virtual QRectF boundingRect() const = 0;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) = 0;
virtual QWidget* getDockWidget() const = 0;
//! Pr&uuml;ft, ob ein allgemeines Item ein FiledItem ist
/*!
Die Liste der Item Typen wird in der Funktion definiert
\param item Das zu pruefende Item
*/
static bool isFieldItem(QGraphicsItem *item);
int getRotation();
protected:
QPointF myScenePos;
int myRotation;
QRectF sizeRect;
public slots:
virtual void handleSceneChange(const QList<QRectF> & region);
virtual void setScenePosX(double newXPos);
virtual void setScenePosY(double newYPos);
virtual void setRotation(int angle);
public slots:
//! setzt das rechteck des Widgets
/*!
\param rect Das neue QRectF
*/
virtual void setRectF ( QRectF rect );
//! alias f&uuml;r setRectF()
/*!
\param rect Das neue QRectF
*/
void setRect ( QRectF rect );
//! Breite des Item Rechtecks setzen
/*!
\param newWidth Die neue Breite
*/
virtual void setRectFWidth ( double newWidth );
//! H&ouml;he des Item Rechtecks setzen
/*!
\param newHeight Die neue H&ouml;he
*/
virtual void setRectFHeight ( double newHeight );
signals:
void ScenePosChanged(QPointF newpos);
void ScenePosXChanged(double newX);
void ScenePosYChanged(double newY);
void rotationChanged(int angle);
void rotationChanged();
void heightChanged ( double height );
void widthChanged ( double width );
};
#endif

216
src/filenew.xpm Normal file
View File

@@ -0,0 +1,216 @@
/* XPM */
static char *filenew[] = {
/* columns rows colors chars-per-pixel */
"32 32 178 2",
" c black",
". c #191000",
"X c #221700",
"o c #452E00",
"O c #4A3100",
"+ c #4E3400",
"@ c #553800",
"# c #604000",
"$ c #6A4600",
"% c #6D4800",
"& c #704A00",
"* c #724C00",
"= c #744C00",
"- c #764E00",
"; c #785000",
": c #805500",
"> c #815500",
", c #835700",
"< c #865900",
"1 c #875A00",
"2 c #8A5B00",
"3 c #8A5C00",
"4 c #8B5C00",
"5 c #8C5D00",
"6 c #8D5D00",
"7 c #8F5E00",
"8 c #805911",
"9 c #905F00",
"0 c #906000",
"q c #926000",
"w c #946200",
"e c #956300",
"r c #966400",
"t c #976400",
"y c #956913",
"u c #926C22",
"i c #9B7732",
"p c #B18D48",
"a c #B28E49",
"s c #B4904A",
"d c #BAA373",
"f c #A1A195",
"g c #ABAB9F",
"h c #ADADAB",
"j c #AFAFAB",
"k c #B3B3A6",
"l c #BCBCB8",
"z c #BFBFBC",
"x c #CBB489",
"c c #CBB58A",
"v c #CDB78B",
"b c #CAB891",
"n c #C9BB9E",
"m c #CEBEA2",
"M c #C6C6BC",
"N c #D9C8A8",
"B c #E8E1BA",
"V c #E8E1BB",
"C c #FEFFA1",
"Z c #FFFFA0",
"A c #FEFFA3",
"S c #FEFFA4",
"D c #FEFFA6",
"F c #FEFFA8",
"G c #FEFFA9",
"H c #FFFFA8",
"J c #FEFFAA",
"K c #FEFFAB",
"L c #FFFFAB",
"P c #FEFFAC",
"I c #FFFFAC",
"U c #FEFFAE",
"Y c #FEFFAF",
"T c #FEFFB0",
"R c #FEFFB1",
"E c #FFFFB0",
"W c #FEFFB4",
"Q c #FEFFB5",
"! c #FFFFB4",
"~ c #FEFFB8",
"^ c #FEFFB9",
"/ c #FFFFB8",
"( c #FFFFB9",
") c #FEFFBB",
"_ c #FFFFBA",
"` c #FEFFBD",
"' c #FFFFBD",
"] c #FEFFBE",
"[ c #FFFFBE",
"{ c #C8C8C1",
"} c #CACAC4",
"| c #CBCBC6",
" . c #DBD2C1",
".. c #DEDFCF",
"X. c #D4D4D1",
"o. c #E1D5C1",
"O. c #E3D9C3",
"+. c #E5DCCC",
"@. c #E8E8D3",
"#. c #ECECD7",
"$. c #F0EBDA",
"%. c #FEFFC2",
"&. c #FEFFC3",
"*. c #FFFFC2",
"=. c #FEFFC7",
"-. c #FFFFC7",
";. c #FEFFCB",
":. c #FEFFCC",
">. c #FFFFCC",
",. c #FEFFCE",
"<. c #FEFFD0",
"1. c #FEFFD1",
"2. c #FFFFD0",
"3. c #FFFFD1",
"4. c #FFFFD3",
"5. c #FEFFD5",
"6. c #FFFFD5",
"7. c #FEFFD6",
"8. c #FEFFD7",
"9. c #FFFFD6",
"0. c #FFFFD8",
"q. c #FEFFDA",
"w. c #FFFFDA",
"e. c #FFFFDB",
"r. c #FFFFDC",
"t. c #FEFFDE",
"y. c #FEFFDF",
"u. c #FFFFDE",
"i. c #FFFFDF",
"p. c #E9E9E7",
"a. c #F3F3E9",
"s. c #F3F3EB",
"d. c #F5F5E8",
"f. c #F8F8E3",
"g. c #FEFFE0",
"h. c LightYellow",
"j. c #FFFFE1",
"k. c #FEFFE3",
"l. c #FFFFE3",
"z. c #FDFEE7",
"x. c #FEFFE4",
"c. c #FEFFE5",
"v. c #FFFFE4",
"b. c #FBFBE9",
"n. c #FEFFE8",
"m. c #FFFFE8",
"M. c #FFFFE9",
"N. c #FFFFEA",
"B. c #FEFFEC",
"V. c #FEFFED",
"C. c #FFFFEC",
"Z. c #FFFFED",
"A. c #FEFFEF",
"S. c #F4F4F0",
"D. c #F4F4F3",
"F. c #F5F5F4",
"G. c #F8F8F6",
"H. c ivory",
"J. c #FFFFF1",
"K. c #FEFFF3",
"L. c #FFFFF3",
"P. c #FEFFF4",
"I. c #FFFFF4",
"U. c #FEFFF7",
"Y. c #FFFFF6",
"T. c #FFFFF7",
"R. c #FBFBFB",
"E. c #FFFFF8",
"W. c #FFFFF9",
"Q. c #FFFFFA",
"!. c #FFFFFB",
"~. c gray99",
"^. c #FEFFFD",
"/. c #FFFFFC",
"(. c #FFFFFD",
"). c #FFFFFE",
"_. c gray100",
"`. c None",
/* pixels */
"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.`.w 2 1 w 4 4 4 6 w 9 6 - `.`.`.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.r s p p c c c c N O.+.o.y # `.`.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.r ).).).).).).).).F.p.). .& o `.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w ).E.).E.).E.E.E.S.X.).R.n $ + `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w E.Y.Y.E.Y.E.E.E.a.| ).).D.m % `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w E.Y.Y.J.Y.J.Y.Y.a.| ).).).D.> `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w Y.J.J.J.J.J.J.J.a.M l h h { ; `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w Y.B.B.B.N.N.B.B.b...k f h } ; `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w J.N.N.N.N.N.N.N.l.f.#.@.#.a.> `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w J.l.l.l.l.l.l.l.l.l.l.l.l.J.> `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w J.r.l.l.r.l.r.l.r.l.r.l.r.J.1 `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w B.r.r.q.q.q.q.q.q.r.q.q.r.B.> `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w N.5.5.5.5.q.5.5.5.5.5.5.5.B., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w N.<.<.<.<.<.<.<.5.<.<.<.<.N., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w l.,.;.;.;.,.;.,.;.,.;.;.;.l., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w l.-.-.-.-.-.-.;.-.-.-.-.;.l.> `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w l.-.%.%.%.%.%.%.%.%.%.%.%.l., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w r.' ' ' ' ' ) ' ' ' ' ' ' r., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w r.) ) W ) ) ) ) ) ) W ) ) q., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w q.W W W W W W W W W W W W q., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w 5.Y Y W Y Y Y Y Y Y Y Y Y 5., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w 5.J J J Y J Y Y J Y J J Y q., `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w 5.J J D J J D J D J W ) ,.$.- `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w <.Z D D Z D J Y ' ,.B b i - O `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w <.Z Z Z Y ) <.B d u & @ X `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w ,.J ) ,.B d y & o . `.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.w Y.V d u & o . `.`.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`.1 4 & o . `.`.`.`.`.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`. `.`.`.`.`.`.`.`.`.`.`.`.`.`.",
"`.`.`.`.`.`.`.`. `.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`."
};

295
src/fileopen.xpm Normal file
View File

@@ -0,0 +1,295 @@
/* XPM */
static char *fileopen[] = {
/* columns rows colors chars-per-pixel */
"32 32 257 2",
" c black",
". c #0B0900",
"X c #130E00",
"o c #161100",
"O c #231A00",
"+ c #352600",
"@ c #3B311C",
"# c #433100",
"$ c #4F3B00",
"% c #4A3E16",
"& c #4A3D22",
"* c #4D421A",
"= c #54420D",
"- c #4E4529",
"; c #484338",
": c #484233",
"> c #5B4B24",
", c #624500",
"< c #674D00",
"1 c #6D4D00",
"2 c #6E4F17",
"3 c #6D5200",
"4 c #775500",
"5 c #745B0F",
"6 c #795200",
"7 c #7A5A00",
"8 c #715C18",
"9 c #764B0A",
"0 c #6C5423",
"q c #6D592E",
"w c #785E27",
"e c #735626",
"r c #665736",
"t c #7A631D",
"y c #7A672E",
"u c #776535",
"i c #5C5956",
"p c #78704F",
"a c #75726E",
"s c #8D4F00",
"d c #815700",
"f c #835A00",
"g c #8A5C00",
"h c #866400",
"j c #966100",
"k c #956F00",
"l c #9C6100",
"z c #9D7500",
"x c #856B2A",
"c c #8C752A",
"v c #8C723B",
"b c #977939",
"n c #A45D00",
"m c #A26100",
"M c #AA680D",
"N c #AB6700",
"B c #A07700",
"V c #A57B00",
"C c #AB7A00",
"Z c #AA7300",
"A c #AF721A",
"S c #B87E00",
"D c #B57B00",
"F c #B0731A",
"G c #B47C26",
"H c #B77E28",
"J c #897F59",
"K c #977C40",
"L c #927F58",
"P c #807A6C",
"I c #9C821D",
"U c #9F8A35",
"Y c #AC8000",
"T c #B28500",
"R c #B68800",
"E c #BB8B00",
"W c #A78337",
"Q c #A28B31",
"! c #AF9535",
"~ c #B58E3A",
"^ c #B88633",
"/ c #B49936",
"( c #BCA039",
") c #998445",
"_ c #978657",
"` c #8B8264",
"' c #8E8572",
"] c #978864",
"[ c #978C75",
"{ c #9F9072",
"} c #A38845",
"| c #A48952",
" . c #AA965C",
".. c #A89156",
"X. c #B5934D",
"o. c #B39D45",
"O. c #B49755",
"+. c #AB984A",
"@. c #AD9A65",
"#. c #A79778",
"$. c #A59874",
"%. c #A29B7A",
"&. c #A79775",
"*. c #BDA959",
"=. c #B3A46C",
"-. c #B1A07F",
";. c #B5A97A",
":. c #BEB37B",
">. c #C49200",
",. c #C89500",
"<. c #CC9800",
"1. c #C69812",
"2. c #D2A31C",
"3. c #C2A63E",
"4. c #D7AE37",
"5. c #C29840",
"6. c #C29B4E",
"7. c #C2A641",
"8. c #C6AA43",
"9. c #C8AC45",
"0. c #CBAF49",
"q. c #CAA746",
"w. c #C4A158",
"e. c #CAA65D",
"r. c #CEA857",
"t. c #CFA95A",
"y. c #C5AC50",
"u. c #CDB14B",
"i. c #CBB358",
"p. c #CAB152",
"a. c #D2AB59",
"s. c #D1B54D",
"d. c #D4B951",
"f. c #D6BC5B",
"g. c #DDB45E",
"h. c #D9BD56",
"j. c #D2B753",
"k. c #DAAB48",
"l. c #CEAE69",
"z. c #CCAD67",
"x. c #CCB662",
"c. c #CAB26B",
"v. c #C8B66B",
"b. c #CEB775",
"n. c #CEBE7F",
"m. c #D3AD66",
"M. c #D5BE64",
"N. c #D4BF6D",
"B. c #E4B34B",
"V. c #E0B75F",
"C. c #E1B85F",
"Z. c #E4BA61",
"A. c #E9BE63",
"S. c #DDC159",
"D. c #DAC269",
"F. c #D4C176",
"G. c #D8C67F",
"H. c #E1C55D",
"J. c #EFC05D",
"K. c #F1C15E",
"L. c #E0C264",
"P. c #E5C961",
"I. c #EDC164",
"U. c #E9CD65",
"Y. c #EFD36B",
"T. c #F2C564",
"R. c #F6C868",
"E. c #F8C760",
"W. c #FBCC6A",
"Q. c #FDCB63",
"!. c #F1D56D",
"~. c #FFD06C",
"^. c #F5D972",
"/. c #FED175",
"(. c #FADE77",
"). c #E4C87A",
"_. c #FEE27C",
"`. c #8F9192",
"'. c #9A9A96",
"]. c #A79F83",
"[. c #ADA583",
"{. c #A7A399",
"}. c #BBAC86",
"|. c #BDB088",
" X c #BBB298",
".X c #A7A8A6",
"XX c #ADAEB0",
"oX c #B5B6B4",
"OX c #BABCBC",
"+X c #C6B38E",
"@X c #D3BE80",
"#X c #D0BC95",
"$X c #C6BFA6",
"%X c #C5C29D",
"&X c #D2C283",
"*X c #DAC789",
"=X c #DBCA8B",
"-X c #D5C489",
";X c #DBCD94",
":X c #D6C699",
">X c #CFC8B1",
",X c #C8C6B7",
"<X c #D1C9A6",
"1X c #DBD3BA",
"2X c #E1C981",
"3X c #E0CD91",
"4X c #ECD686",
"5X c #EBD69E",
"6X c #FED682",
"7X c #FED88B",
"8X c #FEDC95",
"9X c #E3CEA3",
"0X c #EED9A9",
"qX c #E7DCB9",
"wX c #F4DDAF",
"eX c #FFE68A",
"rX c #FFE893",
"tX c #FFEA9F",
"yX c #FFE2A5",
"uX c #FFE3AC",
"iX c #FFECA7",
"pX c #FFEDAE",
"aX c #F1E0B6",
"sX c #FDE5B4",
"dX c #FFEEB4",
"fX c #F8E5BB",
"gX c #FFF0BC",
"hX c #C5C7C8",
"jX c #C7C8CA",
"kX c #CCCECF",
"lX c #CCCAC0",
"zX c #CDCED0",
"xX c #D1D1CF",
"cX c #D1D3D4",
"vX c #D6D8DA",
"bX c #DADCDE",
"nX c #DCDEE0",
"mX c #DEE0E2",
"MX c #E7DEC2",
"NX c #EBE1C5",
"BX c #F4E9C3",
"VX c #F7EACE",
"CX c #FEEAC3",
"ZX c #FAEBCA",
"AX c #FFF1C1",
"SX c #FFF3CC",
"DX c #FFF6DA",
"FX c #E1E3E5",
"GX c #E4E6E8",
"HX c #E7E9EA",
"JX c #E8E6E0",
"KX c #E9EAEC",
"LX c #ECEEF0",
"PX c #EEF0F2",
"IX c #F8F4E8",
"UX c #F1F3F5",
"YX c None",
/* pixels */
"YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX V E <.,.T YXYXYXYXYXYX",
"YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX< E 2.aXCXVXE 3 E <.E YXYX",
"YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX R ,.5XCX8XQ.wX<.1.$.OX<. YXYX",
"YXYXYXYXYXYXYXYXYXYXYXYXYXYX R >.L.ZXyXT.K.E.wX ..XKXKXR YXYX",
"YXYXYXYXYXYXYXYXYXYXYXYX V E 4.ZXsXW.K.I.Z.O.{.KXUXUXMXk YXYX",
"YXYXYXYXYXYX R E 7 YX< E 2.aXsX6XC.T.Z.w.[ xXUXUXUXUX2X3 YXYX",
"YXYXYXYX R >.).5X,.T ,.5XCX8XK.T.A.a.] OXUXUXUXUXUXUX2.O YXYX",
"YXYX Y E Z.ZXsX7XsX0XCXyXR.K.I.V._ .XUXUXUXUXUXLXKXJXV D N S 7 ",
" z E 4.fXsX/.K.~./.6X~.I.I.C...'.KXUXPXPXPXLXKXGXbXl.N m.SXm.D ",
" E 0XgX7XE.W.W.~.~.R.I.Z.w.' bXUXUXUXPXPXLXmXbX$X) ~ aXSXpXBXn ",
" <.CXT.Q.~.W.W.R.I.A.t._ hXUXUXUXUXPXLXGXnX,X .t XAXSXeX4Xl.Z ",
" <.sXB.W.W.W.T.A.g._ oXUXUXUXUXUXLXLXmXcX=.5 $.BXgXeX!.D.3Xm + ",
" <.sXB.R.R.A.V.| {.KXUXUXUXUXLXKXGXvX|.c u qXdXgX^.U.f.3XH f ",
" <.sXB.T.Z.m.[ nXUXUXUXUXPXKXHXbX,X) e <XdXiX_.S.u.P.F.t.h ",
" <.sXk.Z.r.K jXUXUXUXPXLXKXmXcX@.5 %.DXiX_.Y.S.d.h.D.*Xl X ",
" <.wXq.r.X.r UXUXPXPXKXmXvX|.y _ NXdXrX!.S.d.h.d.f.=XF 4 YX",
" ,.0X5.X.) a PXPXKXGXnX>X) y >XAXAX_.S.h.h.u.s.d.F.6.g YX",
" >.9X~ } u '.LXKXmXxX .5 [.IXAX_.!.S.h.h.d.8.s.D.n.j YXYX",
" >.:XW v & kXmXvX;.t ] BXAXrX!.U.u.S.9.u.3.7.i.;XM 1 YXYXYX",
" E #Xb u : nXcX_ u 1XSXgX^.U.H.S.d.8.s.d.u.b.-XG g YXYXYXYX",
" R +Xc r a zX[.= -XdX_.U.d.P.h.d.u.3.8.N.=Xw.l 1 YXYXYXYX",
" T }.x > `.oX> %.*.S.S.h.S.7.d.h.0.p.n.c.M d . YXYXYXYXYX",
" C ].w @ XXu p *.( h.S.s.u.u.u.p.N.*X^ g + YXYXYXYXYXYX",
" Z &.e ; ` * :.o.S.S.S.u.( 9.x.&XX.j , YXYXYXYXYXYX",
" B { 0 i % [.o.u.S.d.h.9.M.&Xz.M 6 YXYXYXYXYXYXYXYX",
" z { 0 - J *./ S.9.d.i.G.&XF g O YXYXYXYXYXYXYXYXYXYX",
" z $.2 w =.! s.d.p.N.;X^ l , YXYXYXYXYXYXYXYXYXYXYX",
" B &.9 ;.Q / j.x.@Xl.m 6 YXYXYXYXYXYXYXYXYXYXYXYXYX",
" h W @.+.I y.&Xb.F 7 O YXYXYXYXYXYXYXYXYXYXYXYXYXYXYX",
" $ s %XU F.=X^ j # YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX",
" g O.<Xe.l 1 YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX",
" o f n d . YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX"
};

295
src/filesave.xpm Normal file
View File

@@ -0,0 +1,295 @@
/* XPM */
static char *filesave[] = {
/* columns rows colors chars-per-pixel */
"32 32 257 2",
" c #000000",
". c #06060A",
"X c #09090D",
"o c #0B0B16",
"O c #101022",
"+ c #1E1E28",
"@ c #181829",
"# c #151F3A",
"$ c #1A263F",
"% c #1D2A3F",
"& c #272730",
"* c #2E2E3F",
"= c #212140",
"- c #212E41",
"; c #2F2F41",
": c #292A4A",
"> c #23224B",
", c #262353",
"< c #292655",
"1 c #2B2C54",
"2 c #2C2C5B",
"3 c #293746",
"4 c #2D304F",
"5 c #243243",
"6 c #2E315D",
"7 c #363647",
"8 c #303E4A",
"9 c #30325E",
"0 c #3C3C53",
"q c #2E2E60",
"w c #2F3160",
"e c #302E63",
"r c #313164",
"t c #363861",
"y c #353868",
"u c #384650",
"i c #284F6B",
"p c #2D547B",
"a c #3B486A",
"s c #36597D",
"d c #3D5D7C",
"f c #4C4C4C",
"g c #40405A",
"h c #414E56",
"j c #4B585E",
"k c #49545E",
"l c #555555",
"z c #4D4D6B",
"x c #434675",
"c c #4B5660",
"v c #4F5962",
"b c #41517E",
"n c #4B507D",
"m c #515C67",
"M c #505D6E",
"N c #5C5D7D",
"B c #546066",
"V c #54626D",
"C c #5B646D",
"Z c #55677A",
"A c #556B78",
"S c #5D6772",
"D c #6B6B6B",
"F c #646464",
"G c #616C73",
"H c #63707D",
"J c #6B7679",
"K c gray45",
"L c #00418E",
"P c #004494",
"I c #004894",
"U c #044F98",
"Y c #03509B",
"T c #0A5198",
"R c #13579C",
"E c #185DA1",
"W c #285888",
"Q c #2B6094",
"! c #396D9A",
"~ c #336A96",
"^ c #3D719B",
"/ c #226EB8",
"( c #326EA8",
") c #326BA3",
"_ c #3673AE",
"` c #3A76B4",
"' c #0B6FD1",
"] c #0F75D8",
"[ c #1479DA",
"{ c #1B7CDC",
"} c #466481",
"| c #42749C",
" . c #4A799E",
".. c #506A84",
"X. c #5F678D",
"o. c #576391",
"O. c #5A6592",
"+. c #5F6893",
"@. c #5B738B",
"#. c #507DA1",
"$. c #626283",
"%. c #636A94",
"&. c #656F98",
"*. c #657A8F",
"=. c #6B7299",
"-. c #717191",
";. c #797998",
":. c #687BA6",
">. c #2281DC",
",. c #3F81C0",
"<. c #3988D7",
"1. c #2785E1",
"2. c #2E8AE3",
"3. c #368FE5",
"4. c #3690E6",
"5. c #3D93E7",
"6. c #3D94E9",
"7. c #57839E",
"8. c #4787BC",
"9. c #5480A1",
"0. c #5B84A3",
"q. c #6E8496",
"w. c #6E8B9A",
"e. c #7D848E",
"r. c #728597",
"t. c #738598",
"y. c #768899",
"u. c #7B8B9B",
"i. c #6489A5",
"p. c #698EA7",
"a. c #6D8FA9",
"s. c #6E81AB",
"d. c #7683A6",
"f. c #768CB7",
"g. c #7395AD",
"h. c #7C96B0",
"j. c #4086CA",
"k. c #4986C3",
"l. c #4284C3",
"z. c #498ED2",
"x. c #4D95DB",
"c. c #548DC5",
"v. c #5D92C8",
"b. c #5593C9",
"n. c #5097DE",
"m. c #5198DE",
"M. c #4296E7",
"N. c #4895E2",
"B. c #4B99E5",
"V. c #4A9CEB",
"C. c #4599EB",
"Z. c #529DE6",
"A. c #589EE2",
"S. c #54A1EB",
"D. c #5AA1E6",
"F. c #5AA5EB",
"G. c #5EA8EF",
"H. c #53A3F1",
"J. c #5EAAF2",
"K. c #6699CB",
"L. c #799BC8",
"P. c #7EA6C9",
"I. c #60A2E5",
"U. c #65A7E8",
"Y. c #6BABE9",
"T. c #68ADF2",
"R. c #67B0F5",
"E. c #6DB3F6",
"W. c #70ADEA",
"Q. c #75B0E9",
"!. c #7CB5EB",
"~. c #73B9F8",
"^. c #7BBDFB",
"/. c #7CBAF6",
"(. c gray55",
"). c #828899",
"_. c #84949E",
"`. c #918E8A",
"'. c #949494",
"]. c #8F8FA9",
"[. c #8997A5",
"{. c #8A9AA9",
"}. c #9A9BAF",
"|. c #9399A9",
" X c #9FAAB5",
".X c #A29E9B",
"XX c #A7A7A7",
"oX c #ABABAB",
"OX c #A3A3B4",
"+X c #A8A8B7",
"@X c #A3ABB3",
"#X c #B4B5B5",
"$X c #B0B0BC",
"%X c #B7B9BC",
"&X c #BBB7B3",
"*X c #BBBBBB",
"=X c #82B1DB",
"-X c #81B7EC",
";X c #88BBED",
":X c #86BAED",
">X c #AEBBC8",
",X c #A6BDCD",
"<X c #BBBCC3",
"1X c #81C1F6",
"2X c #83C2FA",
"3X c #89C4FA",
"4X c #8CC8FC",
"5X c #95C2EF",
"6X c #93CBFD",
"7X c #9BCFFF",
"8X c #97D0FC",
"9X c #9CD3FE",
"0X c #BEC0C1",
"qX c #A3C7E7",
"wX c #A2CAF1",
"eX c #A1D4FF",
"rX c #A3D8FF",
"tX c #AADBFF",
"yX c #B0D1F2",
"uX c #BDD9F4",
"iX c #AAE0FF",
"pX c #B3E1FF",
"aX c #B9E6FF",
"sX c #BEE9FF",
"dX c #C4C4C4",
"fX c #C6C5CD",
"gX c #C6C8CB",
"hX c #CAC7C4",
"jX c #CAC8C6",
"kX c #CBCCCB",
"lX c #D1D0CE",
"zX c #D3D3D3",
"xX c #D4D7D9",
"cX c #D8D8D7",
"vX c #DBDBDB",
"bX c #C4ECFF",
"nX c #C9E0F6",
"mX c #C4F5FF",
"MX c #CCF2FF",
"NX c #D5E6F7",
"BX c #DDEBF9",
"VX c #DCFDFF",
"CX c #D3F1F5",
"ZX c #E1E0DE",
"AX c #E4E3E3",
"SX c #E4E7EA",
"DX c #E7E8E9",
"FX c #E8E6E4",
"GX c #EDE9E5",
"HX c #EBEBEB",
"JX c #E7EEF5",
"KX c #EAF2FA",
"LX c #F1EEEA",
"PX c #F3F3F3",
"IX c #F4F8FC",
"UX c #FDFDFC",
"YX c None",
/* pixels */
"YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXy y e 6 6 2 < < , , 1 YXYX",
"YXYXYX2 < , , q w 2 e r r r w e w r e 2 6 1 6 s :.f.L.y YXYX",
"YXYXYXx d.s.:.a # $ $ % - 5 3 8 u h k B S J ).,XF.b.7.r YXYX",
"YXYXYX&.mX~.8.V #X#X%XdXfXzXxXvXZXZXDXFXFXDXLXDX>.U i 9 YXYX",
"YXYXYXo.2X] L C UXDXcXzXkXkXkXjXjXdXdX%X%X&X%X*XN.' ~ 6 YXYX",
"YXYXYXo.1X] P k hXoXXXXXoXoX#X#X*X%X&X%X%XdXkXxXx.[ ~ 6 YXYX",
"YXYXYXO.3X[ I m FXkXjXjXkXkXkXkXkXkXzXzXzXcXZXSXx.{ ! 6 YXYX",
"YXYXYXo.3X{ I S UXvXxXzXkXkXkXkXkXjXdX*X%X#X&X%XZ.1.^ 9 YXYX",
"YXYXYXO.4X>.U j jX#X#X#X%XdXdXkXzXkXzXzXcXvXDXJXA.1.| 6 YXYX",
"YXYXYXO.6X>.T V PXZXZXZXAXSXDXDXFXHXDXHXHXHXHXSXI.2.| 9 YXYX",
"YXYXYXO.6X2.T G UXLXDXDXAXZXZXAXZXvXcXzXkXkXkXgXY.3. .6 YXYX",
"YXYXYXO.9X4.R m zXdXdXkXzXvXAXDXHXLXPXPXIXUXUXUXQ.6. .9 YXYX",
"YXYXYXO.9X5.R H UXIXUXUXUXUXUXUXUXUXUXUXIXKXJXBX-XC.#.9 YXYX",
"YXYXYXO.eXM./ h.UXUXIXKXBXNXnXuXyXwX5X:X!.Y.Y.Y.D.H.9.6 YXYX",
"YXYXYX+.rXB.<.x.Q.;X-XQ.Y.U.U.D.Z.Z.B.B.C.V.V.B.B.T.0.9 YXYX",
"YXYXYX+.tXB.N.B.B.B.B.C.V.V.H.H.H.D.N.z.8._ ( <.D.R.0.9 YXYX",
"YXYXYX+.tXS.Z.F.D.m.z.l.` ) Q W p s } @.r.[. X>XG.E.0.9 YXYX",
"YXYXYX+.pXU.m.) p d ..*.u.|.+X<XzXZXGXLXGXZXzXjX/.~.p.r YXYX",
"YXYXYX%.aXT.k.*.GXlX&X.X`..XhXlXzXvXvXvXvXxXkXgX2X^.a.w YXYX",
"YXYXYX%.aXE.k.r.LXoXl f l F *XlXzXvXvXvXvXcXzXgX4X:Xa.w YXYX",
"YXYXYX%.bX~.c.y.LX'.f D K D 0XkXzXvXvXvXvXvXzXfX6X4Xg.9 YXYX",
"YXYXYX%.bX^.c.y.LX'.l D K D 0XlXzXcXvXvXvXxXkXkX9X6Xw.r YXYX",
"YXYXYX%.bX2Xv.u.LX'.l K K K 0XlXzXcXvXvXvXvXkXfX9XP.M = YXYX",
"YXYXYX%.bX2XK.u.LX'.l K K D 0XlXxXcXvXZXvXxXzXkXqXZ : . YXYX",
"YXYXYX%.MX6XK.u.LX'.f F D D 0XkXzXcXvXvXvXvXcXkX_.: o YXYX",
"YXYXYX%.MX6XK.u.LXXX(.XX&XdXkXzXvXZXDXAXzX<X+X}.N O YXYX",
"YXYXYX%.VXiX=X{.FXzXkXkXjXdX<X$XOX].;.$.z 0 7 & X YXYXYX",
"YXYXYX=.CXq.A ).fX+X|.).-.N z 0 * + o YXYXYXYX",
"YXYXYXn $.t 6 , 4 0 * + . YXYXYXYXYXYX",
"YXYXYX> @ o YXYXYXYXYXYXYXYXYXYXYXYX",
"YXYXYX YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX",
"YXYXYX YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX"
};

131
src/graphicsellipseitem.cpp Normal file
View File

@@ -0,0 +1,131 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "graphicsellipseitem.h"
#include <QDrag>
#include <QGraphicsSceneMouseEvent>
#include <QMimeData>
#include <QDebug>
#include "simulscene.h"
#include "probechargewidget.h"
GraphicsEllipseItem::GraphicsEllipseItem() {
setFlag(ItemIsMovable);
setFlag(ItemIsSelectable);
setFlag(ItemIsFocusable);
//setCacheMode(QGraphicsItem::DeviceCoordinateCache);
//startTimer(100);
setMasse(9.10938188e-31);
setCharge(-1.6e-19);
myProbeChargeWidget = new ProbeChargeWidget(0,0,this);
currProbePath = new QList<QPointF>;
speedListX = new QList<double>;
speedListY = new QList<double>;
}
void GraphicsEllipseItem::timerEvent ( QTimerEvent * event ) {
static double vx;
vx++;
//moveBy(vx/20.0,vx/20.0*vx/20.0);
}
GraphicsEllipseItem::~GraphicsEllipseItem() {
}
void GraphicsEllipseItem::mousePressEvent ( QGraphicsSceneMouseEvent *event ) {
//QGraphicsEllipseItem::mousePressEvent(event);
}
/*!
\fn GraphicsEllipseItem::calculateProbePath()
*/
void GraphicsEllipseItem::calculateProbePath(QPointF startPoint, double startSpeedX , double startSpeedY) {
SimulScene* myScene = dynamic_cast<SimulScene*>(scene());
//wenn noch zu keiner scene gehoerend abbruch
if (myScene == 0) return;
//parameter der scene in lokale variablen uebernehmen
double timePerStep = myScene->getTimePerStep();
int steps = myScene->getSteps();
double meterPerPx = myScene->getMeterPerPx();
//listen leeren
currProbePath->clear();
speedListX->clear();
speedListY->clear();
//startwerte in die listen setzen
currProbePath->append(startPoint);
speedListX->append(startSpeedX);
speedListY->append(startSpeedY);
for(int i = 1; i< steps;++i) {
double powerX = myScene->getPowerAt(currProbePath->at(i-1), charge, 'x');
double powerY = myScene->getPowerAt(currProbePath->at(i-1), charge, 'y');
double deltaDistXconst = speedListX->at(i-1) * (timePerStep/1000.0);
double deltaDistYconst = speedListY->at(i-1) * (timePerStep/1000.0);
double deltaDistXaccel = 0.5 * (powerX/getMasse()) * (timePerStep/1000.0) * (timePerStep/1000.0);
double deltaDistYaccel = 0.5 * (powerY/getMasse()) * (timePerStep/1000.0) * (timePerStep/1000.0);
double deltaDistX = (deltaDistXconst + deltaDistXaccel);
double deltaDistY = (deltaDistYconst + deltaDistYaccel);
currProbePath->append(QPointF(currProbePath->at(i-1).x() + deltaDistX/meterPerPx,currProbePath->at(i-1).y() + deltaDistY/meterPerPx));
speedListX->append(speedListX->at(i-1) + (powerX/getMasse()) * (timePerStep/1000.0));
speedListY->append(speedListY->at(i-1) + (powerY/getMasse()) * (timePerStep/1000.0));
}
qDebug()<< "Probe Path: " <<*currProbePath;
qDebug()<< "speed x: "<<*speedListX;
qDebug()<< "speed y: "<<*speedListY;
qDebug()<<currProbePath->at(12);
qDebug()<<speedListY->at(12);
qDebug()<<"power x: "<< (double)myScene->getPowerAt(QPointF(0,0), charge, 'x');
qDebug()<<"power y: " << (double)myScene->getPowerAt(QPointF(0,0), charge, 'y');
}
long double GraphicsEllipseItem::getMasse() const {
return masse;
}
void GraphicsEllipseItem::setMasse ( const long double& theValue ) {
if (masse == theValue) return;
masse = theValue;
}
long double GraphicsEllipseItem::getCharge() const {
return charge;
}
void GraphicsEllipseItem::setCharge ( const long double& theValue ) {
if (charge == theValue) return;
charge = theValue;
}
QWidget * GraphicsEllipseItem::getDockWidget() const
{
return myProbeChargeWidget;
}

76
src/graphicsellipseitem.h Normal file
View File

@@ -0,0 +1,76 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef GRAPHICSELLIPSEITEM_H
#define GRAPHICSELLIPSEITEM_H
#include <QGraphicsEllipseItem>
class ProbeChargeWidget;
/**
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
public:
GraphicsEllipseItem();
QWidget* getDockWidget() const;
~GraphicsEllipseItem();
protected:
void mousePressEvent ( QGraphicsSceneMouseEvent *event );
void timerEvent ( QTimerEvent * event );
private:
QList<QPointF> *currProbePath;
///Liste Der Geschwindigkeitsanteile in x-richtung
QList<double> *speedListX;
///Liste Der Geschwindigkeitsanteile in y-richtung
QList<double> *speedListY;
///Masse der Probeladung in kg
double masse;
///Ladung der Probleadung in As
double charge;
///Zugeordnetes Probe Charge Widget
ProbeChargeWidget* myProbeChargeWidget;
public slots:
//! Berechnet die Bewegung der Probeladung
/*!
\param steps Anzahl der auszuf&uuml;renden Schriite
*/
void calculateProbePath (QPointF startPoint = QPointF(0,0), double startSpeedX = 0, double startSpeedY = 0);
void setMasse ( const long double& theValue );
long double getMasse() const;
void setCharge ( const long double& theValue );
long double getCharge() const;
};
#endif

49
src/graphicsview.cpp Normal file
View File

@@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "graphicsview.h"
#include <QGLWidget>
#include <QGraphicsItem>
GraphicsView::GraphicsView(): QGraphicsView() {
setMinimumSize(900,700);
//setDragMode(QGraphicsView::RubberBandDrag);
//scale(2.5,2.5);
}
void GraphicsView::enableOGLViewport() {
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
}
void GraphicsView::disableOGLViewport() {
setViewport(new QWidget(parentWidget()));
}
GraphicsView::~GraphicsView() {
}

45
src/graphicsview.h Normal file
View File

@@ -0,0 +1,45 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef GRAPHICSVIEW_H
#define GRAPHICSVIEW_H
#include <QGraphicsView>
class HomoEFieldItem;
class QTimeLine;
/**
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class GraphicsView : public QGraphicsView {
Q_OBJECT
public:
GraphicsView();
~GraphicsView();
public slots:
void enableOGLViewport();
void disableOGLViewport();
private:
};
#endif

124
src/homoefielditem.cpp Normal file
View File

@@ -0,0 +1,124 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "homoefielditem.h"
#include "homoefieldwidget.h"
#include <QPainter>
#include <cmath>
#include <QtDebug>
#include <QRectF>
HomoEFieldItem::HomoEFieldItem(QRectF sizeRect)
: FieldItem() {
setRectF(sizeRect);
dockWidget = new HomoEFieldWidget(0,0,this);
setFieldPower(2.8e+3);
setFieldLineDistance(10);
setFlag(ItemIsMovable);
setFlag(ItemIsSelectable);
setFlag(ItemIsFocusable);
outerPenWidth = 2;
//rotateslot(66);
}
void HomoEFieldItem::setFieldLineDistance(int pixel) {
fieldLineDistance = pixel;
}
QRectF HomoEFieldItem::boundingRect() const {
return QRectF(sizeRect.x() - outerPenWidth, sizeRect.y() - outerPenWidth,
sizeRect.width() + outerPenWidth, sizeRect.height() + outerPenWidth);
}
void HomoEFieldItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Qt::GlobalColor linecolor = Qt::blue;
painter->setPen(linecolor);
if (isSelected()) painter->setBrush(Qt::Dense6Pattern); //selection deutlich machen
painter->drawRect(sizeRect);
for (int i = 1; i <= floor(sizeRect.width()/(qreal)fieldLineDistance); ++i) {
const int top_bottom_space = 10;
const int arrow_height = 8; //pfeilhoehe
const int arrow_width_half = 3; //Halbe pfeilbreite
if ((i*fieldLineDistance)+arrow_width_half >= sizeRect.width() -2) break; //rechts ueberstehen verhindern
if (sizeRect.height() < top_bottom_space + arrow_height) break;//nur zeichnen, wenn sizeRect hoch genug
//Feldlinien zeichnen
painter->drawLine(
sizeRect.x() + (i*fieldLineDistance) ,
sizeRect.y() +top_bottom_space ,
sizeRect.x() + (i*fieldLineDistance) ,
sizeRect.y() + sizeRect.height() - top_bottom_space
);
//Pfeile Zeichnen
QPointF arrows[3] = {
QPointF(sizeRect.x()+(i*fieldLineDistance), sizeRect.y()+sizeRect.height()-top_bottom_space),
QPointF(sizeRect.x()+(i*fieldLineDistance)-arrow_width_half,sizeRect.y()+sizeRect.height()-top_bottom_space-arrow_height),
QPointF(sizeRect.x()+(i*fieldLineDistance)+arrow_width_half,sizeRect.y()+sizeRect.height()-top_bottom_space-arrow_height),
};
painter->setBrush(linecolor);
painter->drawPolygon(arrows,3);
painter->setBrush(Qt::NoBrush);
//qDebug() << pos();
}
}
int HomoEFieldItem::type() const {
return Type;
}
HomoEFieldItem::~HomoEFieldItem() {
}
/*!
\fn HomoEFieldItem::getDockWidget()
*/
QWidget * HomoEFieldItem::getDockWidget() const
{
return dockWidget;
}
double HomoEFieldItem::getFieldPower() const {
return fieldPower;
}
void HomoEFieldItem::setFieldPower (double fieldPower ) {
//if (this->fieldPower == fieldPower) return;
this->fieldPower = fieldPower;
emit fieldPowerChanged(fieldPower);
}

74
src/homoefielditem.h Normal file
View File

@@ -0,0 +1,74 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef HOMOEFIELDITEM_H
#define HOMOEFIELDITEM_H
#include <fielditem.h>
/**
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class QPainter;
class HomoEFieldWidget;
class QWidget;
class HomoEFieldItem : public FieldItem {
Q_OBJECT
public:
enum {Type = UserType + 1};
enum {MinimumWidth = 20};
enum {MinimumHeight = 30};
HomoEFieldItem ( QRectF sizeRect );
virtual ~HomoEFieldItem();
virtual QRectF boundingRect() const;
virtual void paint ( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget );
int type() const;
///pointer auf das zugehoerige einstellungs Widget
QWidget* getDockWidget() const;
//! setzt fieldLineDistance
/*!
\param pixel der Abstand
*/
virtual void setFieldLineDistance(int pixel);
double getFieldPower() const;
public slots:
void setFieldPower (double fieldPower );
signals:
void fieldPowerChanged(double fieldPower);
private:
//! Abstand der Feldlinien in der Zeichnung
int fieldLineDistance;
qreal outerPenWidth;
HomoEFieldWidget* dockWidget;
///Die Feldst&auml;rke E in V/m
double fieldPower;
};
#endif

141
src/homoefieldwidget.cpp Normal file
View File

@@ -0,0 +1,141 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "homoefieldwidget.h"
#include "homoefielditem.h"
#include "expdoublespinbox.h"
#include <QVBoxLayout>
#include <QtDebug>
#include <QDial>
#include <QGroupBox>
#include <QLabel>
HomoEFieldWidget::HomoEFieldWidget ( QWidget* parent, Qt::WindowFlags f, HomoEFieldItem* eField ) : QWidget ( parent, f ) {
homoEField = eField;
createWidget();
}
HomoEFieldWidget::~HomoEFieldWidget() {
}
/*!
\fn HomoEFieldWidget::createWidget()
*/
void HomoEFieldWidget::createWidget()
{
QDial *rotationDial = new QDial;
rotationDial->setRange(0,359);
rotationDial->setNotchesVisible(true);
rotationDial->setWrapping(true);
QDoubleSpinBox *heightBox = new QDoubleSpinBox;
heightBox->setRange(HomoEFieldItem::MinimumHeight, 5000);
connect(homoEField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) );
connect(heightBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFHeight(double)) );
QDoubleSpinBox *widthBox = new QDoubleSpinBox;
widthBox->setRange(HomoEFieldItem::MinimumWidth, 5000);
connect(homoEField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) );
connect(widthBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFWidth(double)) );
QLabel* xLabel = new QLabel(tr("x:"));
QLabel* yLabel = new QLabel(tr("y:"));
QLabel* widthLabel = new QLabel(tr("Breite(l):"));
QLabel* heightLabel = new QLabel(tr("H\366he(d):"));
QLabel* rotationLabel = new QLabel(tr("Rotation:"));
QDoubleSpinBox *posXBox = new QDoubleSpinBox;
posXBox->setRange(-5000, 5000);
connect(homoEField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) );
connect(posXBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosX(double)) );
QDoubleSpinBox *posYBox = new QDoubleSpinBox;
posYBox->setRange(-5000, 5000);
connect(homoEField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) );
connect(posYBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosY(double)) );
QSpinBox* rotationBox = new QSpinBox;
rotationBox->setRange(0,359);
rotationBox->setSuffix("\260");
rotationBox->setWrapping(true);
connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox ,SIGNAL(valueChanged(int)) );
connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox,SLOT(setValue(int)) );
connect(rotationBox, SIGNAL(valueChanged(int)),homoEField ,SLOT(setRotation(int)) );
connect(rotationBox, SIGNAL(valueChanged(int)),rotationDial ,SLOT(setValue(int)) );
QGridLayout* geomGridLayout = new QGridLayout;
//geomGridLayout->setSizeConstraint(QLayout::SetFixedSize);
geomGridLayout->addWidget(heightBox,4,1);
geomGridLayout->addWidget(rotationBox,0,1);
geomGridLayout->addWidget(posYBox,2,1);
geomGridLayout->addWidget(posXBox,1,1);
geomGridLayout->addWidget(xLabel,1,0,Qt::AlignRight);
geomGridLayout->addWidget(yLabel,2,0,Qt::AlignRight);
geomGridLayout->addWidget(heightLabel,4,0,Qt::AlignRight);
geomGridLayout->addWidget(widthLabel,3,0,Qt::AlignRight);
geomGridLayout->addWidget(rotationLabel,0,0,Qt::AlignRight);
geomGridLayout->addWidget(widthBox,3,1);
//geomGridLayout->addWidget(rotationDial, 1,0,2,2);
QGroupBox* geometryBox = new QGroupBox(tr("Geometrie"));
geometryBox->setLayout(geomGridLayout);
QLabel* fieldPowerLabel = new QLabel(tr("Feldst\344rke:"));
QLabel* voltageLabel = new QLabel(tr("Spannung:"));
ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox;
fieldPowerBox->setRange(-1e+200,1e+200);
connect(homoEField ,SIGNAL(fieldPowerChanged(double)),fieldPowerBox, SLOT(setValue(double)) );
connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setFieldPower(double)) );
ExpDoubleSpinBox* voltageBox = new ExpDoubleSpinBox;
voltageBox->setRange(-1e+200,1e+200);
QGridLayout* constGridLayout = new QGridLayout;
//constGridLayout->setSizeConstraint(QLayout::SetFixedSize);
constGridLayout->addWidget(fieldPowerBox,0,1);
constGridLayout->addWidget(voltageBox,1,1);
constGridLayout->addWidget(fieldPowerLabel,0,0,Qt::AlignRight);
constGridLayout->addWidget(voltageLabel,1,0,Qt::AlignRight);
QGroupBox* fieldConstantsBox = new QGroupBox(tr("Feldkonstanten"));
fieldConstantsBox->setLayout(constGridLayout);
QVBoxLayout * mainLayout = new QVBoxLayout(this);
mainLayout -> addWidget(geometryBox);
mainLayout -> addWidget(fieldConstantsBox);
mainLayout -> addStretch();
QWidget::setTabOrder (rotationBox, posXBox);
QWidget::setTabOrder (posXBox, posYBox);
QWidget::setTabOrder (posYBox, widthBox);
QWidget::setTabOrder (widthBox, heightBox);
this -> setLayout(mainLayout);
}

57
src/homoefieldwidget.h Normal file
View File

@@ -0,0 +1,57 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef HOMOEFIELDWIDGET_H
#define HOMOEFIELDWIDGET_H
#include <QWidget>
#include "homoefielditem.h"
//! Dock Widget fuer die Eigenschaften von HomoEFieldItem
/**
auf diesem Widget befinden sich Steuerelemente, mit denen man
die Eigenschaften von einem HomoEFieldItem manipulieren kann.
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class HomoEFieldWidget : public QWidget {
Q_OBJECT
public:
//! Erzeugt ein neues HomoEFieldWidget
/*!
\param parent Parent Widget, see Qt Documentaion
\param f Window Flags, see Qt Documentaion
\param eField HomoEFieldItem, zu dem das HomoEFieldWidget zugeordnet werden soll
*/
HomoEFieldWidget ( QWidget* parent, Qt::WindowFlags f, HomoEFieldItem* eField );
virtual ~HomoEFieldWidget();
private:
//!enth&auml;lt einen Zeiger auf das zugeordnete HomoEFieldItem
HomoEFieldItem* homoEField;
//! Erstellt die Steuerelemente
/*!
Wird von Konstruktor aufgerufen, um die Steuerelemente zu erzeugen
*/
void createWidget();
};
#endif

256
src/lsim.cpp Normal file
View File

@@ -0,0 +1,256 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QtGui>
#include "lsim.h"
#include "simulscene.h"
#include <QDockWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include <QActionGroup>
#include <QDoubleSpinBox>
#include <QListView>
#include <QStringListModel>
#include <QLabel>
#include "expdoublespinbox.h"
#include "homoefieldwidget.h"
lsim::lsim() {
gview = new GraphicsView();
setCentralWidget (gview);
createScene();
createActions();
simulscene->setSceneMode(SimulScene::FieldItemEdit);
createMenus();
createToolBars();
createStatusBar();
createDocks();
}
void lsim::closeEvent (QCloseEvent *event) {
//event->ignore();
}
void lsim::about() {
QMessageBox::about (this, tr ("\334ber lsim"),
tr ("Ein Proramm, dass noch fast gar nix kann usw..."));
}
void lsim::createActions() {
acts.aboutAct = new QAction (tr ("&About"), this);
acts.aboutAct->setStatusTip (tr ("Show the application's About box"));
connect (acts.aboutAct, SIGNAL (triggered()), this, SLOT (about()));
acts.aboutQtAct = new QAction (tr ("\334ber &Qt"), this);
acts.aboutQtAct->setStatusTip (tr ("Show the Qt library's About box"));
connect (acts.aboutQtAct, SIGNAL (triggered()), qApp, SLOT (aboutQt()));
acts.oglEnable = new QAction (tr ("Opengl ein"), this);
acts.oglEnable->setStatusTip (tr ("OGL ein"));
connect (acts.oglEnable, SIGNAL (triggered()), gview, SLOT (enableOGLViewport()));
acts.oglDisable = new QAction (tr ("Opengl aus"), this);
acts.oglDisable->setStatusTip (tr ("OGL aus"));
connect (acts.oglDisable, SIGNAL (triggered()), gview, SLOT (disableOGLViewport()));
acts.timerStart = new QAction (tr ("Timer Start"), this);
acts.timerStart->setStatusTip (tr ("Timer starten"));
connect (acts.timerStart, SIGNAL (triggered()), simulscene, SLOT (startTimer()));
acts.exitAct = new QAction (tr ("Beenden"), this);
acts.exitAct->setStatusTip (tr ("Die Anwendung beenden"));
connect (acts.exitAct, SIGNAL (triggered()), qApp, SLOT (quit()));
//Edit, insert, Modechange
acts.itemEditModeAct = new QAction (tr ("Edit"), this);
acts.itemEditModeAct->setStatusTip (tr ("Editiermode"));
acts.itemEditModeAct->setCheckable(true);
acts.itemEditModeAct->setData(QVariant(SimulScene::FieldItemEdit));
acts.insertEFieldItemAct = new QAction (tr ("E-Feld"), this);
acts.insertEFieldItemAct->setStatusTip (tr ("E-Feld Einfuegen"));
acts.insertEFieldItemAct->setCheckable(true);
acts.insertEFieldItemAct->setData(QVariant(SimulScene::HomoEFieldItemInsert));
modeChangeActGroup = new QActionGroup(this);
modeChangeActGroup->addAction(acts.itemEditModeAct);
modeChangeActGroup->addAction(acts.insertEFieldItemAct);
connect (modeChangeActGroup, SIGNAL (triggered(QAction*)), this, SLOT (actModeSwitcher(QAction*)));
connect (simulscene, SIGNAL(sceneModeChanged(int)) , this, SLOT(setSceneMode(int)));
}
void lsim::createMenus() {
fileMenu = menuBar()->addMenu("Datei");
fileMenu->addAction(acts.oglEnable);
fileMenu->addAction(acts.oglDisable);
fileMenu->addSeparator();
fileMenu->addAction(acts.exitAct);
menuBar()->addMenu("Bearbeiten");
menuBar()->addMenu("Ansicht");
menuBar()->addMenu("Einstellungen");
helpMenu = menuBar()->addMenu (tr ("&Help"));
helpMenu->addAction (acts.aboutAct);
helpMenu->addAction (acts.aboutQtAct);
}
void lsim::createToolBars() {
fileToolBar = addToolBar (tr ("File"));
fileToolBar->addAction(acts.oglEnable);
fileToolBar->addAction(acts.oglDisable);
editToolBar = addToolBar (tr ("Edit"));
editToolBar->addAction(acts.timerStart);
editToolBar->addSeparator();
editToolBar->addAction(acts.itemEditModeAct);
editToolBar->addAction(acts.insertEFieldItemAct);
}
void lsim::createStatusBar() {
statusBar()->showMessage (tr ("Ready"));
}
void lsim::createScene() {
simulscene = new SimulScene();
gview->setScene(simulscene);
}
void lsim::createDocks() {
QPushButton *button1 = new QPushButton("Loeschen");
QPushButton *button2 = new QPushButton("calculate");
ExpDoubleSpinBox *box = new ExpDoubleSpinBox;
box->setRange(-pow(10,33), pow(10,33));
box->setDecimals(4);
//box->setSuffix(" V");
QSlider *slider1 = new QSlider();
slider1->setMinimum(0);
slider1->setMaximum(360);
connect (button1, SIGNAL(clicked()) , simulscene, SLOT(deleteSelectedFieldItems()));
connect (button2, SIGNAL(clicked()) , simulscene, SLOT(startCalculation()));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(button1);
layout->addWidget(button2);
layout->addWidget(slider1);
layout->addWidget(box);
QWidget *widget2 = new QWidget;
widget2->setLayout(layout);
//HomoEFieldWidget *eFieldOpt = new HomoEFieldWidget(0,0,qgraphicsitem_cast<HomoEFieldItem *>(simulscene->items().first()));
//HomoEFieldItem *homoitem = new HomoEFieldItem(QRectF(44,44,99,99));
fieldItemEditDock = new QDockWidget(tr("Feldeinstellungen"), this);
fieldItemEditDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
fieldItemEditDock->setWidget(new QWidget);
addDockWidget(Qt::LeftDockWidgetArea, fieldItemEditDock);
connect (simulscene, SIGNAL(selectionChanged ()) , this, SLOT(updateDockFieldWidget()));
updateDockFieldWidget();
dock_2 = new QDockWidget(tr("Ein Testdock 2"), this);
dock_2->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
dock_2->setWidget((widget2));
addDockWidget(Qt::LeftDockWidgetArea, dock_2);
probeItemDock = new QDockWidget(tr("Probleladung"), this);
probeItemDock->setWidget(simulscene->getProbeDockWidget());
addDockWidget(Qt::LeftDockWidgetArea, probeItemDock);
tabifyDockWidget(dock_2,fieldItemEditDock);
tabifyDockWidget(fieldItemEditDock, probeItemDock);
setDockOptions(QMainWindow::VerticalTabs);
}
void lsim::actModeSwitcher(QAction *action) {
if (action->data().toInt() == SimulScene::FieldItemEdit) simulscene->setSceneMode(SimulScene::FieldItemEdit);
if (action->data().toInt() == SimulScene::HomoEFieldItemInsert) simulscene->setSceneMode(SimulScene::HomoEFieldItemInsert);
}
void lsim::setSceneMode(int mode) {
for (int i=0;i < modeChangeActGroup->actions().count();++i){
if(modeChangeActGroup->actions().at(i)->data().toInt() == mode) {
modeChangeActGroup->actions().at(i)->setChecked(true);
}
else {
modeChangeActGroup->actions().at(i)->setChecked(false);
}
}
/*
//Problem mit resizeRects, warum auch immer :(
//je nach sceneMode den cursor eintellen
switch (mode) {
case SimulScene::HomoEFieldItemInsert:
gview->setCursor(Qt::CrossCursor);
break;
default:
gview->unsetCursor();
}
*/
}
lsim::~lsim() {
}
/*!
\fn lsim::updateDockFieldWidget()
*/
void lsim::updateDockFieldWidget() {
QStringListModel *model = new QStringListModel();
QStringList list;
list << "a" << "b" << "c";
model->setStringList(list);
QListView * lview = new QListView;
lview->setModel(model);
QLabel* currLabel = new QLabel(tr("Bitte ein Feld ausw\344hlen"));
currLabel->setWordWrap(true);
currLabel->setAlignment(Qt::AlignCenter);
QWidget *currDockWidget =currLabel;
if(simulscene->selectedItems().count() == 1) {
QGraphicsItem *currItem = simulscene->selectedItems().first();
if (FieldItem::isFieldItem(currItem)) {
FieldItem *currFieldItem = qgraphicsitem_cast<FieldItem *>(currItem);
currDockWidget = currFieldItem->getDockWidget();
}
}
fieldItemEditDock->setWidget(currDockWidget);
}

99
src/lsim.h Normal file
View File

@@ -0,0 +1,99 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef LSIM_H
#define LSIM_H
#include <QMainWindow>
#include <QCloseEvent>
#include <graphicsview.h>
//Hauptfenster
/**
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class QAction;
class QMenu;
class QTextEdit;
class QDockWidget;
class SimulScene;
class QActionGroup;
class lsim: public QMainWindow {
Q_OBJECT
public:
lsim();
~lsim();
protected:
void closeEvent (QCloseEvent *event);
private slots:
void about();
void actModeSwitcher(QAction *action);
void setSceneMode(int mode);
void updateDockFieldWidget();
private:
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void createDocks();
void createScene();
GraphicsView *gview;
QMenu *fileMenu;
QMenu *editMenu;
QMenu *helpMenu;
QToolBar *fileToolBar;
QToolBar *editToolBar;
struct Actions {
QAction *aboutAct;
QAction *exitAct;
QAction *aboutQtAct;
QAction *oglEnable;
QAction *oglDisable;
QAction *timerStart;
QAction *itemEditModeAct;
QAction *insertEFieldItemAct;
};
Actions acts;
QActionGroup *modeChangeActGroup;
QDockWidget *fieldItemEditDock;
QDockWidget *probeItemDock;
QDockWidget *dock_2;
SimulScene *simulscene;
};
#endif

33
src/main.cpp Normal file
View File

@@ -0,0 +1,33 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QApplication>
#include "lsim.h"
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
lsim * mw = new lsim();
mw->show();
return app.exec();
}

126
src/probechargewidget.cpp Normal file
View File

@@ -0,0 +1,126 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "probechargewidget.h"
#include "graphicsellipseitem.h"
#include "expdoublespinbox.h"
#include <QVBoxLayout>
#include <QtDebug>
#include <QDial>
#include <QGroupBox>
#include <QLabel>
ProbeChargeWidget::ProbeChargeWidget ( QWidget* parent, Qt::WindowFlags f, GraphicsEllipseItem* ellipse ) : QWidget (parent, f ) {
createWidget();
}
ProbeChargeWidget::~ProbeChargeWidget() {
}
void ProbeChargeWidget::createWidget()
{
QDial *rotationDial = new QDial;
rotationDial->setRange(0,359);
rotationDial->setNotchesVisible(true);
rotationDial->setWrapping(true);
QDoubleSpinBox *heightBox = new QDoubleSpinBox;
QDoubleSpinBox *widthBox = new QDoubleSpinBox;
QLabel* xLabel = new QLabel(tr("x:"));
QLabel* yLabel = new QLabel(tr("y:"));
QLabel* widthLabel = new QLabel(tr("Breite(l):"));
QLabel* heightLabel = new QLabel(tr("H\366he(d):"));
QLabel* rotationLabel = new QLabel(tr("Rotation:"));
QDoubleSpinBox *posXBox = new QDoubleSpinBox;
posXBox->setRange(-5000, 5000);
QDoubleSpinBox *posYBox = new QDoubleSpinBox;
posYBox->setRange(-5000, 5000);
QSpinBox* rotationBox = new QSpinBox;
rotationBox->setRange(0,359);
rotationBox->setSuffix("\260");
rotationBox->setWrapping(true);
QGridLayout* geomGridLayout = new QGridLayout;
//geomGridLayout->setSizeConstraint(QLayout::SetFixedSize);
geomGridLayout->addWidget(heightBox,4,1);
geomGridLayout->addWidget(rotationBox,0,1);
geomGridLayout->addWidget(posYBox,2,1);
geomGridLayout->addWidget(posXBox,1,1);
geomGridLayout->addWidget(xLabel,1,0,Qt::AlignRight);
geomGridLayout->addWidget(yLabel,2,0,Qt::AlignRight);
geomGridLayout->addWidget(heightLabel,4,0,Qt::AlignRight);
geomGridLayout->addWidget(widthLabel,3,0,Qt::AlignRight);
geomGridLayout->addWidget(rotationLabel,0,0,Qt::AlignRight);
geomGridLayout->addWidget(widthBox,3,1);
//geomGridLayout->addWidget(rotationDial, 1,0,2,2);
QGroupBox* geometryBox = new QGroupBox(tr("Geometrie"));
geometryBox->setLayout(geomGridLayout);
QLabel* fieldPowerLabel = new QLabel(tr("Feldst\344rke:"));
QLabel* voltageLabel = new QLabel(tr("Spannung:"));
ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox;
fieldPowerBox->setRange(-1e+200,1e+200);
ExpDoubleSpinBox* voltageBox = new ExpDoubleSpinBox;
voltageBox->setRange(-1e+200,1e+200);
QGridLayout* constGridLayout = new QGridLayout;
//constGridLayout->setSizeConstraint(QLayout::SetFixedSize);
constGridLayout->addWidget(fieldPowerBox,0,1);
constGridLayout->addWidget(voltageBox,1,1);
constGridLayout->addWidget(fieldPowerLabel,0,0,Qt::AlignRight);
constGridLayout->addWidget(voltageLabel,1,0,Qt::AlignRight);
QGroupBox* fieldConstantsBox = new QGroupBox(tr("Feldkonstanten"));
fieldConstantsBox->setLayout(constGridLayout);
QVBoxLayout * mainLayout = new QVBoxLayout(this);
mainLayout -> addWidget(geometryBox);
mainLayout -> addWidget(fieldConstantsBox);
mainLayout -> addStretch();
QWidget::setTabOrder (rotationBox, posXBox);
QWidget::setTabOrder (posXBox, posYBox);
QWidget::setTabOrder (posYBox, widthBox);
QWidget::setTabOrder (widthBox, heightBox);
this -> setLayout(mainLayout);
}

55
src/probechargewidget.h Normal file
View File

@@ -0,0 +1,55 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef PROBECHARGEWIDGET_H
#define PROBECHARGEWIDGET_H
#include <QWidget>
class GraphicsEllipseItem;
//! Dock Widget fuer die Eigenschaften von HomoEFieldItem
/**
auf diesem Widget befinden sich Steuerelemente, mit denen man
die Eigenschaften von einem GraphicsEllipseItem (Probeladungen) manipulieren kann.
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class ProbeChargeWidget : public QWidget {
Q_OBJECT
public:
//! Erzeugt ein neues ProbeChargeWidget
/*!
\param parent Parent Widget, see Qt Documentaion
\param f Window Flags, see Qt Documentaion
\param eField HomoEFieldItem, zu dem das HomoEFieldWidget zugeordnet werden soll
*/
ProbeChargeWidget ( QWidget* parent, Qt::WindowFlags f, GraphicsEllipseItem* ellipse );
virtual ~ProbeChargeWidget();
private:
//!enth&auml;lt einen Zeiger auf das zugeordnete GraphicsEllipseItem
GraphicsEllipseItem* ellipseItem;
//! Erstellt die Steuerelemente
/*!
Wird von Konstruktor aufgerufen, um die Steuerelemente zu erzeugen
*/
void createWidget();
};
#endif

561
src/simulscene.cpp Normal file
View File

@@ -0,0 +1,561 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "constants.h"
#include "simulscene.h"
#include <QGraphicsRectItem>
#include <QTimeLine>
#include <QGraphicsItemAnimation>
#include <cmath>
#include "graphicsellipseitem.h"
#include "homoefielditem.h"
#include <QRectF>
#include <QGraphicsSceneMouseEvent>
#include <QtDebug>
#include <QApplication>
#include <QGraphicsRectItem>
#include <QKeyEvent>
#include <QGraphicsItemGroup>
SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
//variablen initialisieren
setTimePerStep(0.00001);
setSteps(200);
//setMeterPerPx(1/1000.0);
setMeterPerPx(1);
currHomoEfieldInsertItem = 0;
currHomoEfieldEditItem = 0;
createResizeRects();
addLine(0,-298,0,298,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
addLine(-398,0,398,0,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
for (int i = -39; i< 39; ++i) {
if(i!=0) {
QGraphicsLineItem *line = addLine(i*10,-298,i*10,298,QPen(Qt::lightGray, 1, Qt::DotLine) );
line ->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
line->setZValue(-1);
}
}
for (int i = -29; i< 29; ++i) {
if(i!=0) {
QGraphicsLineItem *line = addLine(-398,i*10,398,i*10,QPen(Qt::lightGray, 1, Qt::DotLine) );
line ->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
line->setZValue(-1);
}
}
ellipse1 = new GraphicsEllipseItem();
ellipse1->setRect(-2,-2,5,5);
ellipse1->setPen(Qt::NoPen);
ellipse1->setBrush(Qt::red);
ellipse1->setZValue(1);
//ellipse1->scale(4,4);
ellipse1->setAcceptDrops(true);
addItem(ellipse1);
timer = new QTimeLine( (200e-3/8.0e+6) *1000 * 2e+8);
//qDebug()<< (200e-3/8.0e+6) *1000 * 2e+8;
timer->setFrameRange(0,100);
timer->setUpdateInterval(25);
timer->setCurveShape(QTimeLine::LinearCurve);
//timer->toggleDirection();
QGraphicsItemAnimation *ani = new QGraphicsItemAnimation();
ani->setItem(ellipse1);
ani->setTimeLine(timer);
qreal E = 40/(2e-2);
qreal q = -1.6022e-19;
qreal m = 9.1094e-31;
qreal vx = 8.0e+6;
qreal ax=0;
qreal ay=q*E/m;
for (int i=0; i<=200; ++i) {
qreal x=i;
ani->setPosAt(i/200.0, QPointF(x , 0.5 * ay * pow(( (x/1000) /vx),2) *1000 ));
//ani->setPosAt((t+360)/720.0, QPointF((t), 80*abs(t/180.0*3.14) ));
//qDebug()<<QPointF(x , 0.5 * ay * pow(( (x/1000) /vx),2) *1000 );
}
}
void SimulScene::startTimer() {
timer->start();
}
void SimulScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) {
switch(myMode) {
case HomoEFieldItemInsert:
if (mouseEvent->button() != Qt::LeftButton) break; //benutze nur linke maustaste
currHomoEfieldInsertItem = new HomoEFieldItem(QRectF(mouseEvent->scenePos(),mouseEvent->scenePos()));
addItem(currHomoEfieldInsertItem);
QApplication::setOverrideCursor(QCursor(Qt::SizeFDiagCursor));
break;
default:
if (itemAt(mouseEvent->scenePos())->data(0) == ResizeRectItem && mouseEvent->button()==Qt::LeftButton) {
pressedResizeItem = itemAt(mouseEvent->scenePos());
if (selectedItems().first()->type() == HomoEFieldItem::Type) {
currHomoEfieldEditItem = qgraphicsitem_cast<HomoEFieldItem *>(selectedItems().first());
QApplication::setOverrideCursor(pressedResizeItem->cursor());
}
}
else {
QGraphicsScene::mousePressEvent(mouseEvent);
}
}
}
void SimulScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) {
if (currHomoEfieldInsertItem != 0) {
if (myMode == HomoEFieldItemInsert) {
QPointF point(currHomoEfieldInsertItem->getRectF().x(), currHomoEfieldInsertItem->getRectF().y());
update(currHomoEfieldInsertItem->getRectF());
if(point.x() <= mouseEvent->scenePos().x() && point.y() <= mouseEvent->scenePos().y()) {
QRectF rect(point,mouseEvent->scenePos());
currHomoEfieldInsertItem->setRectF(rect);
//update(QRectF(point,mouseEvent->lastScenePos()));
}
}
}
else if (currHomoEfieldEditItem != 0 ) {
QGraphicsRectItem *pressedRectItem = qgraphicsitem_cast<QGraphicsRectItem *>(pressedResizeItem);
QRectF currRect = currHomoEfieldEditItem->getRectF();
QPointF newPos = currHomoEfieldEditItem->pos();
calculateItemResize(mouseEvent,pressedRectItem,currRect,newPos,HomoEFieldItem::MinimumWidth,HomoEFieldItem::MinimumHeight);
//aenderungen uebernehmen
currHomoEfieldEditItem->setPos(newPos);
if (currRect != currHomoEfieldEditItem->getRectF()) {
currHomoEfieldEditItem->setRectF(currRect);
}
//resize rechtecke mitverschieben --> macht jetzt schon das Widget
//if(mouseEvent->scenePos() != mouseEvent->lastScenePos()) displayResizeRects(true);
}
else {
QGraphicsScene::mouseMoveEvent(mouseEvent);
if (mouseEvent->buttons() == Qt::LeftButton)
if(mouseEvent->scenePos() != mouseEvent->lastScenePos())
displayResizeRects(true);
}
}
void SimulScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) {
if (currHomoEfieldInsertItem != 0 && myMode == HomoEFieldItemInsert) {
if (currHomoEfieldInsertItem->getRectF().width() < HomoEFieldItem::MinimumWidth || currHomoEfieldInsertItem->getRectF().height() <HomoEFieldItem::MinimumHeight ) {
//removeItem(currHomoEfieldInsertItem); //segmention fault in kombination mit delete?
delete currHomoEfieldInsertItem; //zu kleines feld loeschen
}
else {
//setze Startpunkt des rechtecks auf 0,0, damit pos() richtig funktioniert
currHomoEfieldInsertItem->setVisible(false); //ausblenden, damit sich nix verschiebt
QRectF rect (currHomoEfieldInsertItem->getRectF());
QPointF posPoint(rect.x(),rect.y());
rect.setWidth(rect.width() - rect.x());
rect.setHeight(rect.height() - rect.y());
rect.setX(0);
rect.setY(0);
currHomoEfieldInsertItem->setRectF(rect);
currHomoEfieldInsertItem->setPos(posPoint);
currHomoEfieldInsertItem->setVisible(true); //und wieder einblenden
setSceneMode(FieldItemEdit);
//das neue item auswaehlen
clearSelection();
currHomoEfieldInsertItem->setSelected(true);
//die resize items aus und einblenden bei rotation
connect( currHomoEfieldInsertItem, SIGNAL(rotationChanged()), this, SLOT(displayResizeRects()));
//bei groesenanderung und verschieben resizerects mitverschieben
connect( currHomoEfieldInsertItem, SIGNAL(heightChanged(double)), this, SLOT(moveResizeRects()));
connect( currHomoEfieldInsertItem, SIGNAL(widthChanged(double)), this, SLOT(moveResizeRects()));
connect( currHomoEfieldInsertItem, SIGNAL(ScenePosChanged(QPointF)), this, SLOT(moveResizeRects()));
//item ueber sceneChange informieren
connect(this,SIGNAL(changed(QList<QRectF>)),currHomoEfieldInsertItem,SLOT(handleSceneChange(QList<QRectF>)));
}
update(); //moegliche darstellungsprobleme beseitigen
QApplication::restoreOverrideCursor();
}
else if (currHomoEfieldEditItem != 0) {
update();
QApplication::restoreOverrideCursor();
}
pressedResizeItem = 0;
currHomoEfieldInsertItem = 0;
currHomoEfieldEditItem = 0;
QGraphicsScene::mouseReleaseEvent(mouseEvent);
}
void SimulScene::keyPressEvent (QKeyEvent *keyevent) {
if(keyevent->key() == Qt::Key_Delete) {
deleteSelectedFieldItems();
}
}
void SimulScene::setSceneMode(SceneMode mode) {
if(myMode==mode) return;
myMode = mode;
emit sceneModeChanged(mode);
}
void SimulScene::createResizeRects() {
const QRectF resizeRectSize(0,0,7,7);
reRects.leftTopResizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.leftTopResizeItem->setCursor(Qt::SizeFDiagCursor);
reRects.leftTopResizeItem->setBrush(Qt::black);
reRects.leftTopResizeItem->setVisible(false);
reRects.leftTopResizeItem->setData(0, QVariant(ResizeRectItem)); //typ des items setzen
reRects.leftResizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.leftResizeItem->setCursor(Qt::SizeHorCursor);
reRects.leftResizeItem->setBrush(Qt::black);
reRects.leftResizeItem->setVisible(false);
reRects.leftResizeItem->setData(0, QVariant(ResizeRectItem));
reRects.leftBottomResizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.leftBottomResizeItem->setCursor(Qt::SizeBDiagCursor);
reRects.leftBottomResizeItem->setBrush(Qt::black);
reRects.leftBottomResizeItem->setVisible(false);
reRects.leftBottomResizeItem->setData(0, QVariant(ResizeRectItem));
reRects.bottomResizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.bottomResizeItem->setCursor(Qt::SizeVerCursor);
reRects.bottomResizeItem->setBrush(Qt::black);
reRects.bottomResizeItem->setVisible(false);
reRects.bottomResizeItem->setData(0, QVariant(ResizeRectItem));
reRects.rightBottomResizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.rightBottomResizeItem->setCursor(Qt::SizeFDiagCursor);
reRects.rightBottomResizeItem->setBrush(Qt::black);
reRects.rightBottomResizeItem->setVisible(false);
reRects.rightBottomResizeItem->setData(0, QVariant(ResizeRectItem));
reRects.rightRezizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.rightRezizeItem->setCursor(Qt::SizeHorCursor);
reRects.rightRezizeItem->setBrush(Qt::black);
reRects.rightRezizeItem->setVisible(false);
reRects.rightRezizeItem->setData(0, QVariant(ResizeRectItem));
reRects.rightTopResizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.rightTopResizeItem->setCursor(Qt::SizeBDiagCursor);
reRects.rightTopResizeItem->setBrush(Qt::black);
reRects.rightTopResizeItem->setVisible(false);
reRects.rightTopResizeItem->setData(0, QVariant(ResizeRectItem));
reRects.topResizeItem = new QGraphicsRectItem(resizeRectSize);
reRects.topResizeItem->setCursor(Qt::SizeVerCursor);
reRects.topResizeItem->setBrush(Qt::black);
reRects.topResizeItem->setVisible(false);
reRects.topResizeItem->setData(0, QVariant(ResizeRectItem));
addItem(reRects.leftTopResizeItem);
addItem(reRects.leftResizeItem);
addItem(reRects.leftBottomResizeItem);
addItem(reRects.bottomResizeItem);
addItem(reRects.rightBottomResizeItem);
addItem(reRects.rightRezizeItem);
addItem(reRects.rightTopResizeItem);
addItem(reRects.topResizeItem);
connect( this, SIGNAL(selectionChanged()), this, SLOT(displayResizeRects()) );
}
void SimulScene::displayResizeRects(bool move) {
if (
selectedItems().count() == 1 &&
FieldItem::isFieldItem(selectedItems().first()) &&
!selectedItems().first()->transform().isTranslating() //bei rotation nicht anzeigen
) {
const qreal oSPACE = 3; //Aussenabstand
//position des ausgewaehlten items
QPointF seletedPos = selectedItems().first()->pos();
qreal selPosX = seletedPos.x();
qreal selPosY = seletedPos.y();
//an die richtige stelle schieben
reRects.leftTopResizeItem->setPos(selPosX - reRects.leftTopResizeItem->rect().width()- oSPACE,
selPosY - reRects.leftTopResizeItem->rect().height() - oSPACE);
reRects.leftResizeItem->setPos(selPosX - reRects.leftResizeItem->rect().width()- oSPACE,
selPosY +
selectedItems().first()->boundingRect().height() / 2.0 -
reRects.leftResizeItem->rect().height() /2.0);
reRects.leftBottomResizeItem->setPos(selPosX - reRects.leftBottomResizeItem->rect().width()- oSPACE,
selPosY + selectedItems().first()->boundingRect().height() + oSPACE);
reRects.bottomResizeItem->setPos(selPosX +
selectedItems().first()->boundingRect().width() / 2.0 -
reRects.bottomResizeItem->rect().width() /2.0,
selPosY + selectedItems().first()->boundingRect().height() + oSPACE);
reRects.rightBottomResizeItem->setPos(selPosX + selectedItems().first()->boundingRect().width() + oSPACE,
selPosY + selectedItems().first()->boundingRect().height() + oSPACE);
reRects.rightRezizeItem->setPos(selPosX + selectedItems().first()->boundingRect().width() + oSPACE,
selPosY +
selectedItems().first()->boundingRect().height() / 2.0 -
reRects.rightRezizeItem->rect().height() /2.0);
reRects.rightTopResizeItem->setPos(selPosX + selectedItems().first()->boundingRect().width() + oSPACE,
selPosY - reRects.rightTopResizeItem->rect().height() - oSPACE);
reRects.topResizeItem->setPos(selPosX +
selectedItems().first()->boundingRect().width() / 2.0 -
reRects.topResizeItem->rect().width() /2.0,
selPosY - reRects.leftTopResizeItem->rect().height() - oSPACE);
if (!move) { //im verschiebemodus kann man von diesen dingen ausgehen
//nach oben bringen
qreal newZValue = getHighestZIndexVisible() + 0.000001;
reRects.leftTopResizeItem->setZValue(newZValue);
reRects.leftResizeItem->setZValue(newZValue);
reRects.leftBottomResizeItem->setZValue(newZValue);
reRects.bottomResizeItem->setZValue(newZValue);
reRects.rightBottomResizeItem->setZValue(newZValue);
reRects.rightRezizeItem->setZValue(newZValue);
reRects.rightTopResizeItem->setZValue(newZValue);
reRects.topResizeItem->setZValue(newZValue);
//sichtbar machen
reRects.leftTopResizeItem->setVisible(true);
reRects.leftResizeItem->setVisible(true);
reRects.leftBottomResizeItem->setVisible(true);
reRects.bottomResizeItem->setVisible(true);
reRects.rightBottomResizeItem->setVisible(true);
reRects.rightRezizeItem->setVisible(true);
reRects.rightTopResizeItem->setVisible(true);
reRects.topResizeItem->setVisible(true);
}
}
else if(!move && reRects.leftTopResizeItem->isVisible()) {
//unsichtbar machen
reRects.leftTopResizeItem->setVisible(false);
reRects.leftResizeItem->setVisible(false);
reRects.leftBottomResizeItem->setVisible(false);
reRects.bottomResizeItem->setVisible(false);
reRects.rightBottomResizeItem->setVisible(false);
reRects.rightRezizeItem->setVisible(false);
reRects.rightTopResizeItem->setVisible(false);
reRects.topResizeItem->setVisible(false);
}
}
void SimulScene::moveResizeRects() {
displayResizeRects(true);
}
qreal SimulScene::getHighestZIndexVisible() {
bool highestZValueSet = false;
qreal highestZValue = 0;
for (int i = 0; i < items().count() ; ++i ) {
if (items().at(i)->isVisible()) {
if (!highestZValueSet) {
highestZValue = items().at(i)->zValue();
highestZValueSet = true;
}
else if (highestZValue < items().at(i)->zValue()) {
highestZValue = items().at(i)->zValue();
}
}
}
return highestZValue;
}
void SimulScene::deleteSelectedFieldItems() {
QList<QGraphicsItem *> currSelectedItems = selectedItems();
for (int i = 0; i < currSelectedItems.count() ; ++i ) {
if (FieldItem::isFieldItem(currSelectedItems.at(i))) {
delete currSelectedItems.at(i);
}
}
}
void SimulScene::calculateItemResize(
QGraphicsSceneMouseEvent *mouseEvent,
QGraphicsRectItem *pressedRectItem,
QRectF &currRect,
QPointF &newPos,
qreal minWidth,
qreal minHeight
) {
qreal mouseDistanceX = mouseEvent->scenePos().x() - mouseEvent->lastScenePos().x();
qreal mouseDistanceY = mouseEvent->scenePos().y() - mouseEvent->lastScenePos().y();
if (reRects.rightRezizeItem == pressedRectItem) {
currRect.adjust(0,0,mouseDistanceX , 0);
}
else if (reRects.leftResizeItem == pressedRectItem) {
newPos = QPointF(newPos.x()+mouseDistanceX,newPos.y());
currRect.adjust(0,0,-mouseDistanceX , 0);
}
else if (reRects.topResizeItem == pressedRectItem) {
newPos = QPointF(newPos.x(),newPos.y()+mouseDistanceY);
currRect.adjust(0,0,0, -mouseDistanceY );
}
else if (reRects.bottomResizeItem == pressedRectItem) {
currRect.adjust(0,0,0, mouseDistanceY );
}
else if (reRects.rightBottomResizeItem == pressedRectItem) {
currRect.adjust(0,0,0, mouseDistanceY );
currRect.adjust(0,0,mouseDistanceX , 0);
}
else if (reRects.leftBottomResizeItem == pressedRectItem) {
currRect.adjust(0,0,0, mouseDistanceY );
newPos = QPointF(newPos.x()+mouseDistanceX,newPos.y());
currRect.adjust(0,0,-mouseDistanceX , 0);
}
else if (reRects.leftTopResizeItem == pressedRectItem) {
newPos = QPointF(newPos.x(),newPos.y()+mouseDistanceY);
currRect.adjust(0,0,0, -mouseDistanceY );
newPos = QPointF(newPos.x()+mouseDistanceX,newPos.y());
currRect.adjust(0,0,-mouseDistanceX , 0);
}
else if (reRects.rightTopResizeItem == pressedRectItem) {
newPos = QPointF(newPos.x(),newPos.y()+mouseDistanceY);
currRect.adjust(0,0,0, -mouseDistanceY );
currRect.adjust(0,0,mouseDistanceX , 0);
}
//gegen zu klein werden
if (currRect.width() <= minWidth) {
if (mouseEvent->lastScenePos().x() < mouseEvent->scenePos().x()) { //gegen rumspringen
newPos = QPointF(newPos.x() + (currRect.width() - minWidth) ,newPos.y());
}
currRect.setWidth(minWidth);
}
if (currRect.height() <= minHeight) {
if (mouseEvent->lastScenePos().y() < mouseEvent->scenePos().y()) { //gegen rumspringen
newPos = QPointF(newPos.x(), newPos.y() + (currRect.height() - minHeight));
}
currRect.setHeight(minHeight);
}
}
SimulScene::~SimulScene() {
}
/*!
\fn SimulScene::getTimePerStep()
*/
double SimulScene::getTimePerStep() {
return timePerStep;
}
/*!
\fn SimulScene::setTimePerStep(int time)
*/
void SimulScene::setTimePerStep(double time) {
if (time == timePerStep) return;
timePerStep = time;
emit timePerStepChanged(time);
}
/*!
\fn SimulScene::startCalculation()
*/
void SimulScene::startCalculation() {
ellipse1->calculateProbePath();
}
/*!
\fn SimulScene::getSteps()
*/
int SimulScene::getSteps() {
return steps;
}
/*!
\fn SimulScene::setSteps()
*/
void SimulScene::setSteps(int steps) {
if (this->steps == steps) return;
this->steps = steps;
emit stepsChanged(steps);
}
long double SimulScene::getPowerAt(QPointF point, long double charge, char xy) {
long double dPower = 0;
for(int i = 0; i < items(point).size(); ++i) {
//HomoEFieldItems Abarbeiten
if (qgraphicsitem_cast<HomoEFieldItem*> (items(point).at(i)) != 0) {
HomoEFieldItem* myHomoEfieldItem = qgraphicsitem_cast<HomoEFieldItem*> (items(point).at(i));
double power = (myHomoEfieldItem->getFieldPower() * charge);
double degAngle = myHomoEfieldItem->getRotation();
double radAngle = degAngle/180.0l*PI;
if(xy == 'x') {
if (degAngle != 180.0) dPower += power * -sin(radAngle);
}
if(xy == 'y') {
if (degAngle != 90.0 && degAngle != 270.0) dPower += power * cos(radAngle);
}
}
}
return dPower;
}
double SimulScene::getMeterPerPx() const {
return meterPerPx;
}
void SimulScene::setMeterPerPx ( double theValue ) {
if (theValue == meterPerPx) return;
meterPerPx = theValue;
}
/*!
\fn SimulScene::getProbeDockWidget() const
*/
QWidget* SimulScene::getProbeDockWidget() const {
return ellipse1->getDockWidget();
}

125
src/simulscene.h Normal file
View File

@@ -0,0 +1,125 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Dahlberg *
* pdahlberg@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef SIMULSCENE_H
#define SIMULSCENE_H
#include <QGraphicsScene>
class QTimeLine;
class HomoEFieldItem;
class QGraphicsRectItem;
class QGraphicsItemGroup;
class GraphicsEllipseItem;
/**
@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class SimulScene : public QGraphicsScene {
Q_OBJECT
public:
enum SceneMode {HomoEFieldItemInsert, FieldItemEdit };
enum ItemType {ResizeRectItem};
SimulScene ( QObject* parent = 0);
qreal getHighestZIndexVisible(); //hoechsten z-index der sichtbaren items ausgeben
~SimulScene();
double getTimePerStep();
int getSteps();
//! gibt die Wirkende Kraft zur&uuml;ck (in Newton)
/*!
\param point der Punkt der abgepr&uuml;ft werden soll
\param charge Die Ladung, auf die die Kraft ausge&uuml;bt wird
\param xy x oder y-Richtung
*/
long double getPowerAt(QPointF point, long double charge, char xy);
QWidget* getProbeDockWidget() const;
public slots:
void setSceneMode(SceneMode mode);
void startTimer();
void deleteSelectedFieldItems();
void setTimePerStep(double time);
///starte die Berechnung der teilchenbahn(en)
void startCalculation();
void setSteps(int steps);
void setMeterPerPx ( double theValue );
double getMeterPerPx() const;
private slots:
void displayResizeRects(bool move = false);
///does the same as displayResizeRects(true)
void moveResizeRects();
signals:
void sceneModeChanged(int mode);
void stepsChanged(int steps);
void timePerStepChanged(double timePerStep);
private:
QTimeLine *timer;
SceneMode myMode;
///Zeit pro Step in ms
double timePerStep;
///anzahl der Steps
int steps;
///ein Pixel entspricht so viel meter
double meterPerPx;
HomoEFieldItem *currHomoEfieldInsertItem; //Aktuell erstelltes Item
HomoEFieldItem *currHomoEfieldEditItem;
QGraphicsItem *pressedResizeItem;
GraphicsEllipseItem *ellipse1;
//rechtecke zur groesenaenderung
struct resizeRects {
QGraphicsRectItem *leftTopResizeItem;
QGraphicsRectItem *leftResizeItem;
QGraphicsRectItem *leftBottomResizeItem;
QGraphicsRectItem *bottomResizeItem;
QGraphicsRectItem *rightBottomResizeItem;
QGraphicsRectItem *rightRezizeItem;
QGraphicsRectItem *rightTopResizeItem;
QGraphicsRectItem *topResizeItem;
};
resizeRects reRects;
void createResizeRects();
void calculateItemResize(
QGraphicsSceneMouseEvent *mouseEvent,
QGraphicsRectItem *pressedRectItem,
QRectF &currRect,
QPointF &newPos,
qreal minWidth,
qreal minHeight
);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
void keyPressEvent ( QKeyEvent * keyEvent );
};
#endif

32
src/src.pro Normal file
View File

@@ -0,0 +1,32 @@
SOURCES += lsim.cpp \
main.cpp \
graphicsview.cpp \
graphicsellipseitem.cpp \
fielditem.cpp \
homoefielditem.cpp \
simulscene.cpp \
expdoublespinbox.cpp \
homoefieldwidget.cpp \
probechargewidget.cpp
HEADERS += lsim.h \
graphicsview.h \
graphicsellipseitem.h \
fielditem.h \
homoefielditem.h \
simulscene.h \
expdoublespinbox.h \
lsim_interface.h \
homoefieldwidget.h \
constants.h \
probechargewidget.h
TEMPLATE = app
CONFIG += warn_on \
thread \
qt \
debug
TARGET = ../bin/lsim
RESOURCES = application.qrc
QT += opengl
CONFIG -= release