diff --git a/VERSION b/VERSION index 308edfb80706b54a58467c56badd05a9efe8a6cd..2de9e584c517d34dacb95b57bff01bb387674bed 100644 --- a/VERSION +++ b/VERSION @@ -23,4 +23,4 @@ # systems refuse to accept these arbitrary version strings. # The current version string: -VERSION=1.3.0+hgX +VERSION=1.3.1+hgX diff --git a/src/qt4gui/icons/ColorWheel.png b/src/qt4gui/icons/ColorWheel.png new file mode 100644 index 0000000000000000000000000000000000000000..165b8e9165f94e1c9e759146039481ad34b4b60f Binary files /dev/null and b/src/qt4gui/icons/ColorWheel.png differ diff --git a/src/qt4gui/icons/ColorWheel.xpm b/src/qt4gui/icons/ColorWheel.xpm new file mode 100644 index 0000000000000000000000000000000000000000..3eba1071205b4d28fc23f5c4439ad9b618072352 --- /dev/null +++ b/src/qt4gui/icons/ColorWheel.xpm @@ -0,0 +1,574 @@ +/* XPM */ +const char * ColorWheel_xpm[] = { +"32 32 539 2", +" c None", +". c #1A5D00", +"+ c #236200", +"@ c #2E6700", +"# c #396D00", +"$ c #437200", +"% c #4F7700", +"& c #035400", +"* c #166C0E", +"= c #46A731", +"- c #74D54E", +"; c #89DF54", +"> c #ABFD68", +", c #B8FD68", +"' c #ADE354", +") c #B0DC4E", +"! c #99BA31", +"~ c #77900E", +"{ c #6F8000", +"] c #005609", +"^ c #197D1D", +"/ c #45C344", +"( c #7DFF75", +"_ c #A9FF9E", +": c #CDFFC2", +"< c #D9FFCA", +"[ c #EEFFE3", +"} c #F0FFE4", +"| c #E9FFCA", +"1 c #ECFFC2", +"2 c #EAFF9F", +"3 c #ECFF77", +"4 c #C8D445", +"5 c #9A9F1A", +"6 c #7F8000", +"7 c #005A13", +"8 c #2EA13F", +"9 c #7DFD87", +"0 c #BAFFBB", +"a c #D7FFD6", +"b c #D0FFCC", +"c c #C8FFBF", +"d c #C6FFB3", +"e c #CAFFAD", +"f c #D3FFAD", +"g c #DFFFB4", +"h c #ECFFC0", +"i c #F5FFCD", +"j c #FAFFD7", +"k c #FBFFBD", +"l c #FCFE80", +"m c #B9B42E", +"n c #887800", +"o c #00601F", +"p c #34AC55", +"q c #97FFA9", +"r c #C4FFCA", +"s c #B8FFBB", +"t c #A1FFA1", +"u c #94FF8F", +"v c #93FF84", +"w c #9BFF7F", +"x c #A9FF7B", +"y c #B9FF7C", +"z c #CBFF81", +"A c #DDFF88", +"B c #EBFF92", +"C c #F6FFA5", +"D c #FDFFBA", +"E c #FFFEC6", +"F c #FFF999", +"G c #C3B134", +"H c #8F6D00", +"I c #00672C", +"J c #2EA95F", +"K c #84FFA8", +"L c #AAFFBC", +"M c #9CFFAA", +"N c #83FF8D", +"O c #78FF7C", +"P c #7BFF79", +"Q c #89FF7E", +"R c #9CFF83", +"S c #ADFF86", +"T c #BEFF87", +"U c #CFFF86", +"V c #DFFF83", +"W c #ECFF7F", +"X c #F6FF7F", +"Y c #FEFF89", +"Z c #FFFBA1", +"` c #FFF6AD", +" . c #FFEB89", +".. c #C39C2E", +"+. c #955E00", +"@. c #15894F", +"#. c #63FFA2", +"$. c #8EFFB3", +"%. c #8DFFAB", +"&. c #7AFF95", +"*. c #76FF88", +"=. c #7DFF85", +"-. c #86FF86", +";. c #94FF8D", +">. c #A4FF93", +",. c #B6FF96", +"'. c #C7FF98", +"). c #D8FF96", +"!. c #E7FF93", +"~. c #F3FF8D", +"{. c #FCFF86", +"]. c #FFFB7F", +"^. c #FFF283", +"/. c #FFEC93", +"(. c #FFE594", +"_. c #FFD267", +":. c #AD6D15", +"<. c #007243", +"[. c #39C786", +"}. c #72FFB1", +"|. c #86FFB7", +"1. c #7CFFA9", +"2. c #76FF9D", +"3. c #7FFF99", +"4. c #8AFF98", +"5. c #94FF99", +"6. c #9FFF9D", +"7. c #AFFFA4", +"8. c #C0FFA8", +"9. c #D1FFAA", +"0. c #E0FFA8", +"a. c #EEFFA4", +"b. c #F9FF9D", +"c. c #FFFE94", +"d. c #FFF58A", +"e. c #FFE981", +"f. c #FFE085", +"g. c #FFDA8D", +"h. c #FFC978", +"i. c #D98F3B", +"j. c #9C4200", +"k. c #139064", +"l. c #58FFBA", +"m. c #74FFBF", +"n. c #7EFFBE", +"o. c #77FFB3", +"p. c #7DFFAE", +"q. c #8AFFAC", +"r. c #96FFAC", +"s. c #A2FFAC", +"t. c #ADFFAE", +"u. c #BAFFB5", +"v. c #CAFFB9", +"w. c #DBFFBB", +"x. c #E9FFB9", +"y. c #F6FFB5", +"z. c #FEFFAD", +"A. c #FFF9A2", +"B. c #FFED96", +"C. c #FFDF8A", +"D. c #FFD383", +"E. c #FFCB88", +"F. c #FFBF7D", +"G. c #FFA75F", +"H. c #B04D13", +"I. c #007B59", +"J. c #2FBF94", +"K. c #5AFFC9", +"L. c #70FFCB", +"M. c #78FFC7", +"N. c #79FFC1", +"O. c #86FFC0", +"P. c #94FFC0", +"Q. c #A2FFC0", +"R. c #B0FFC0", +"S. c #BBFFC1", +"T. c #C6FFC5", +"U. c #D5FFCA", +"V. c #E4FFCC", +"W. c #F1FFCA", +"X. c #FBFFC5", +"Y. c #FFFCBB", +"Z. c #FFF1B0", +"`. c #FFE4A2", +" + c #FFD594", +".+ c #FFC587", +"++ c #FFBB84", +"@+ c #FFAF7B", +"#+ c #FF9A63", +"$+ c #D36130", +"%+ c #A12500", +"&+ c #007E62", +"*+ c #3EDEB9", +"=+ c #59FFD6", +"-+ c #6FFFD7", +";+ c #76FFD5", +">+ c #7EFFD3", +",+ c #8DFFD2", +"'+ c #9DFFD2", +")+ c #ADFFD2", +"!+ c #BBFFD3", +"~+ c #C8FFD3", +"{+ c #D3FFD5", +"]+ c #DFFFDA", +"^+ c #ECFFDC", +"/+ c #F8FFDA", +"(+ c #FFFED3", +"_+ c #FFF5C8", +":+ c #FFE9BB", +"<+ c #FFDAAD", +"[+ c #FFC99D", +"}+ c #FFB88D", +"|+ c #FFAC85", +"1+ c #FFA07A", +"2+ c #FF8A63", +"3+ c #E86542", +"4+ c #A31A00", +"5+ c #00806B", +"6+ c #47EED4", +"7+ c #5AFEE3", +"8+ c #6DFFE4", +"9+ c #78FFE3", +"0+ c #83FFE3", +"a+ c #93FFE3", +"b+ c #A4FFE3", +"c+ c #B5FFE4", +"d+ c #C5FFE4", +"e+ c #D3FFE5", +"f+ c #DFFFE5", +"g+ c #E8FFE8", +"h+ c #F4FFEA", +"i+ c #FDFFE8", +"j+ c #FFF9DF", +"k+ c #FFEDD3", +"l+ c #FFDFC5", +"m+ c #FFCFB5", +"n+ c #FFBDA4", +"o+ c #FFAC93", +"p+ c #FF9F87", +"q+ c #FF907B", +"r+ c #FE7B65", +"s+ c #F1634E", +"t+ c #A50F00", +"u+ c #008073", +"v+ c #4AF4E5", +"w+ c #58FBEC", +"x+ c #67FEEF", +"y+ c #78FFF0", +"z+ c #86FFF1", +"A+ c #96FFF1", +"B+ c #A8FFF2", +"C+ c #B9FFF2", +"D+ c #CAFFF3", +"E+ c #DAFFF4", +"F+ c #E8FFF4", +"G+ c #F2FFF4", +"H+ c #FAFFF6", +"I+ c #FFFDF2", +"J+ c #FFF2E8", +"K+ c #FFE4DA", +"L+ c #FFD5CA", +"M+ c #FFC3B9", +"N+ c #FFB2A8", +"O+ c #FFA196", +"P+ c #FF9187", +"Q+ c #FE7F75", +"R+ c #FB6E64", +"S+ c #F55C52", +"T+ c #A70700", +"U+ c #00807A", +"V+ c #47F1EC", +"W+ c #55F7F2", +"X+ c #66FCF8", +"Y+ c #76FEFA", +"Z+ c #87FFFB", +"`+ c #98FFFC", +" @ c #AAFFFD", +".@ c #BBFFFD", +"+@ c #CCFFFE", +"@@ c #DCFFFE", +"#@ c #EAFFFE", +"$@ c #F6FFFF", +"%@ c #FFFFFF", +"&@ c #FFF6F6", +"*@ c #FFEAEA", +"=@ c #FFDCDC", +"-@ c #FFCCCC", +";@ c #FFBBBB", +">@ c #FFAAAA", +",@ c #FF9898", +"'@ c #FE8686", +")@ c #FC7474", +"!@ c #F76161", +"~@ c #F25050", +"{@ c #A80000", +"]@ c #007F81", +"^@ c #3EE3E5", +"/@ c #51F1F4", +"(@ c #62F6F9", +"_@ c #74F9FD", +":@ c #86FBFF", +"<@ c #96FAFF", +"[@ c #A8F9FF", +"}@ c #B9F9FF", +"|@ c #CAF8FF", +"1@ c #DAF7FF", +"2@ c #E8F6FF", +"3@ c #F2F5FF", +"4@ c #FAF6FF", +"5@ c #FFF2FD", +"6@ c #FFE8F3", +"7@ c #FFDAE5", +"8@ c #FFCAD5", +"9@ c #FFB9C4", +"0@ c #FFA8B3", +"a@ c #FF96A1", +"b@ c #FD848E", +"c@ c #F9707B", +"d@ c #F45D67", +"e@ c #E94550", +"f@ c #A80009", +"g@ c #007A87", +"h@ c #30C6D2", +"i@ c #4BE3EF", +"j@ c #5DE9F6", +"k@ c #71EDFC", +"l@ c #82EDFE", +"m@ c #93EDFF", +"n@ c #A4ECFF", +"o@ c #B5EAFF", +"p@ c #C5E9FF", +"q@ c #D3E8FF", +"r@ c #DFE7FF", +"s@ c #E8E8FF", +"t@ c #F3EAFF", +"u@ c #FDE8FF", +"v@ c #FFDFFB", +"w@ c #FFD3EF", +"x@ c #FFC5E1", +"y@ c #FFB5D1", +"z@ c #FFA4C0", +"A@ c #FE92AD", +"B@ c #FC809A", +"C@ c #F66B85", +"D@ c #EF566E", +"E@ c #DB364D", +"F@ c #A80015", +"G@ c #00738B", +"H@ c #1FA3BC", +"I@ c #44D0EA", +"J@ c #56D6F2", +"K@ c #69DBF9", +"L@ c #7CDCFD", +"M@ c #8DDCFF", +"N@ c #9DDAFF", +"O@ c #ADD8FF", +"P@ c #BBD7FF", +"Q@ c #C8D5FF", +"R@ c #D3D5FF", +"S@ c #DEDAFF", +"T@ c #EBDCFF", +"U@ c #F7DAFF", +"V@ c #FED3FF", +"W@ c #FFC8F8", +"X@ c #FFBBEC", +"Y@ c #FFADDD", +"Z@ c #FF9DCD", +"`@ c #FD8BBA", +" # c #F978A5", +".# c #F2628E", +"+# c #EA4E78", +"@# c #CA224B", +"## c #A80024", +"$# c #0D79A1", +"%# c #3CBCE5", +"&# c #4CBFEC", +"*# c #61C5F5", +"=# c #74C8FB", +"-# c #85C8FE", +";# c #94C7FF", +"># c #A2C4FF", +",# c #B0C3FF", +"'# c #BBC2FF", +")# c #C6C5FF", +"!# c #D4CAFF", +"~# c #E2CCFF", +"{# c #EFCAFF", +"]# c #F9C5FF", +"^# c #FFBBFF", +"/# c #FFB0F5", +"(# c #FFA2E9", +"_# c #FE93D9", +":# c #FB82C6", +"<# c #F56EB0", +"[# c #EC5898", +"}# c #E54582", +"|# c #B30D44", +"1# c #005D95", +"2# c #1C85BF", +"3# c #40A7E4", +"4# c #53ABED", +"5# c #68B1F7", +"6# c #7AB2FC", +"7# c #89B0FE", +"8# c #96AFFF", +"9# c #A2AEFF", +"0# c #ADAEFF", +"a# c #BAB5FF", +"b# c #C9B9FF", +"c# c #D9BBFF", +"d# c #E7B9FF", +"e# c #F2B5FF", +"f# c #FBADFF", +"g# c #FFA2FC", +"h# c #FE95F1", +"i# c #FC87E3", +"j# c #F775CF", +"k# c #ED5EB6", +"l# c #E44A9E", +"m# c #C72274", +"n# c #A8004A", +"o# c #0E5BA6", +"p# c #358EDD", +"q# c #4490E4", +"r# c #5894EE", +"s# c #6B98F6", +"t# c #7C9BFC", +"u# c #8999FE", +"v# c #949AFF", +"w# c #9F9DFF", +"x# c #AEA4FF", +"y# c #BEA8FF", +"z# c #CFAAFF", +"A# c #DDA8FF", +"B# c #EAA4FF", +"C# c #F59DFF", +"D# c #FC93FE", +"E# c #FC87F7", +"F# c #F676E6", +"G# c #EE63D1", +"H# c #E44EBA", +"I# c #DD3DA5", +"J# c #B30E6E", +"K# c #00429C", +"L# c #0F51B2", +"M# c #3373D9", +"N# c #4375E1", +"O# c #567AEB", +"P# c #687DF3", +"Q# c #7781F9", +"R# c #8383FC", +"S# c #918BFD", +"T# c #A292FE", +"U# c #B395FE", +"V# c #C397FE", +"W# c #D395FE", +"X# c #E091FD", +"Y# c #EB8AFC", +"Z# c #F180F9", +"`# c #F271F3", +" $ c #EB60E4", +".$ c #E14CCF", +"+$ c #D93BBA", +"@$ c #B8128D", +"#$ c #A80072", +"$$ c #002F9E", +"%$ c #0A35AD", +"&$ c #3058D5", +"*$ c #3E58DC", +"=$ c #4E5CE4", +"-$ c #5D61EC", +";$ c #6D6BF2", +">$ c #8075F6", +",$ c #927CF8", +"'$ c #A581FA", +")$ c #B682FA", +"!$ c #C37FF8", +"~$ c #D07AF6", +"{$ c #D971F2", +"]$ c #DF65EC", +"^$ c #DF55E4", +"/$ c #DC46DB", +"($ c #D537CC", +"_$ c #B20E9D", +":$ c #A70089", +"<$ c #001FA1", +"[$ c #0E23B0", +"}$ c #2C3ED2", +"|$ c #353DD5", +"1$ c #4141DB", +"2$ c #544DE1", +"3$ c #6555E5", +"4$ c #795DE8", +"5$ c #8C61EA", +"6$ c #9D62EA", +"7$ c #AB5FE8", +"8$ c #B75AE5", +"9$ c #C051E1", +"0$ c #C747DB", +"a$ c #CA3BD5", +"b$ c #CF32D2", +"c$ c #B20EAF", +"d$ c #A7009C", +"e$ c #0010A4", +"f$ c #1017B0", +"g$ c #1518BD", +"h$ c #302DD1", +"i$ c #3F33D3", +"j$ c #4F39D5", +"k$ c #603DD6", +"l$ c #7241D8", +"m$ c #8342D8", +"n$ c #913FD6", +"o$ c #9F3CD5", +"p$ c #AB37D3", +"q$ c #B531D1", +"r$ c #AD19BD", +"s$ c #AA10B2", +"t$ c #A600A7", +"u$ c #0000A1", +"v$ c #110BAE", +"w$ c #2315BB", +"x$ c #3A1FC7", +"y$ c #4C23C9", +"z$ c #632DD0", +"A$ c #742ED0", +"B$ c #7C24C9", +"C$ c #8821C7", +"D$ c #8C15BB", +"E$ c #8C0BAE", +"F$ c #8B00A0", +"G$ c #0E007B", +"H$ c #1B0097", +"I$ c #28009B", +"J$ c #3900A8", +"K$ c #4800A8", +"L$ c #51009B", +"M$ c #5C0096", +"N$ c #55007A", +" ", +" ", +" . + @ # $ % ", +" & * = - ; > , ' ) ! ~ { ", +" ] ^ / ( _ : < [ } | 1 2 3 4 5 6 ", +" 7 8 9 0 a b c d e f g h i j k l m n ", +" o p q r s t u v w x y z A B C D E F G H ", +" I J K L M N O P Q R S T U V W X Y Z ` ...+. ", +" @.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:. ", +" <.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j. ", +" k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H. ", +" I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+%+ ", +" &+*+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+<+[+}+|+1+2+3+4+ ", +" 5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+ ", +" u+v+w+x+y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+ ", +" U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@ ", +" ]@^@/@(@_@:@<@[@}@|@1@2@3@4@5@6@7@8@9@0@a@b@c@d@e@f@ ", +" g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@ ", +" G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.#+#@### ", +" $#%#&#*#=#-#;#>#,#'#)#!#~#{#]#^#/#(#_#:#<#[#}#|# ", +" 1#2#3#4#5#6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n# ", +" o#p#q#r#s#t#u#v#w#x#y#z#A#B#C#D#E#F#G#H#I#J# ", +" K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#`# $.$+$@$#$ ", +" $$%$&$*$=$-$;$>$,$'$)$!$~${$]$^$/$($_$:$ ", +" <$[$}$|$1$2$3$4$5$6$7$8$9$0$a$b$c$d$ ", +" e$f$g$h$i$j$k$l$m$n$o$p$q$r$s$t$ ", +" u$v$w$x$y$z$A$B$C$D$E$F$ ", +" G$H$I$J$K$L$M$N$ ", +" ", +" ", +" ", +" "}; diff --git a/src/qt4gui/icons/WIcons.xpm b/src/qt4gui/icons/WIcons.xpm index 019d1bbee2a3eabb615efcf03399cf4f19472b58..6f613556ef24ffac49168a2bc4c46e07cfa721ec 100644 --- a/src/qt4gui/icons/WIcons.xpm +++ b/src/qt4gui/icons/WIcons.xpm @@ -60,4 +60,6 @@ #include "moduleDefault.xpm" +#include "ColorWheel.xpm" + #endif // WICONS_H diff --git a/src/qt4gui/qt4/WMainWindow.cpp b/src/qt4gui/qt4/WMainWindow.cpp index fa0e8e9773cdd540af87ed54e4146a9371bd72d3..a913e28a364833f265937905de1dd0d244b5e443 100644 --- a/src/qt4gui/qt4/WMainWindow.cpp +++ b/src/qt4gui/qt4/WMainWindow.cpp @@ -181,6 +181,12 @@ void WMainWindow::setupGUI() m_iconManager.addIcon( std::string( "video" ), video_xpm ); m_iconManager.addIcon( std::string( "image" ), image_xpm ); m_iconManager.addIcon( std::string( "preferences" ), preferences_xpm ); + m_iconManager.addIcon( std::string( "colorwheel" ), ColorWheel_xpm ); + m_iconManager.addIcon( std::string( "ROI icon" ), box_xpm ); + m_iconManager.addIcon( std::string( "Reset icon" ), o_xpm ); + m_iconManager.addIcon( std::string( "axial icon" ), axial_xpm ); + m_iconManager.addIcon( std::string( "coronal icon" ), cor_xpm ); + m_iconManager.addIcon( std::string( "sagittal icon" ), sag_xpm ); try { @@ -270,17 +276,10 @@ void WMainWindow::setupGUI() m_permanentToolBar = new WQtToolBar( "Standard Toolbar", this ); addToolBar( Qt::TopToolBarArea, m_permanentToolBar ); - m_iconManager.addIcon( std::string( "ROI icon" ), box_xpm ); - m_iconManager.addIcon( std::string( "Reset icon" ), o_xpm ); - m_iconManager.addIcon( std::string( "axial icon" ), axial_xpm ); - m_iconManager.addIcon( std::string( "coronal icon" ), cor_xpm ); - m_iconManager.addIcon( std::string( "sagittal icon" ), sag_xpm ); - m_loadButton = new QAction( m_iconManager.getIcon( "load" ), "Load Dataset or Project", m_permanentToolBar ); m_loadButton->setShortcut( QKeySequence( QKeySequence::Open ) ); QAction* roiButton = new QAction( m_iconManager.getIcon( "ROI icon" ), "ROI", m_permanentToolBar ); QAction* resetButton = new QAction( m_iconManager.getIcon( "view" ), "Reset", m_permanentToolBar ); - resetButton->setShortcut( QKeySequence( Qt::Key_Escape ) ); m_saveAction = new QAction( m_iconManager.getIcon( "saveProject" ), "Save Project", m_permanentToolBar ); connect( m_loadButton, SIGNAL( triggered( bool ) ), this, SLOT( openLoadDialog() ) ); @@ -326,15 +325,11 @@ void WMainWindow::setupGUI() // This QAction stuff is quite ugly and complicated some times ... There is no nice constructor which takes name, slot keysequence and so on // directly -> set shortcuts, and some further properties using QAction's interface - QMenu* bgColorMenu = new QMenu( "Background Colors" ); - bgColorMenu->addAction( mainGLDock->getGLWidget()->getBackgroundColorAction() ); - m_viewAction = new QAction( "View", this ); m_viewMenu = m_menuBar->addMenu( "View" ); m_viewMenu->addAction( hideMenuAction ); m_viewMenu->addSeparator(); m_viewMenu->addAction( showNavWidgets ); - m_viewMenu->addMenu( bgColorMenu ); m_viewMenu->addSeparator(); m_viewMenu->addMenu( m_permanentToolBar->getStyleMenu() ); m_viewAction->setMenu( m_viewMenu ); @@ -355,50 +350,14 @@ void WMainWindow::setupGUI() m_settingsMenu->addMenu( logLevels ); m_settingsAction->setMenu( m_settingsMenu ); - // a separate menu for some presets - QMenu* cameraPresetMenu = m_cameraMenu->addMenu( "Presets" ); - QAction* controlPanelTrigger = m_controlPanel->toggleViewAction(); QList< QKeySequence > controlPanelShortcut; controlPanelShortcut.append( QKeySequence( Qt::Key_F9 ) ); controlPanelTrigger->setShortcuts( controlPanelShortcut ); this->addAction( controlPanelTrigger ); // this enables the action even if the menu bar is invisible - // NOTE: the shortcuts for these view presets should be chosen carefully. Most keysequences have another meaning in the most applications - // so the user may get confused. It is also not a good idea to take letters as they might be used by OpenSceneGraph widget ( like "S" for - // statistics ). - // By additionally adding the action to the main window, we ensure the action can be triggered even if the menu bar is hidden. - QAction* tmpAction = cameraPresetMenu->addAction( m_iconManager.getIcon( "sagittal icon" ), "Left", this, SLOT( setPresetViewLeft() ), - QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_L ) ); - tmpAction->setIconVisibleInMenu( true ); - this->addAction( tmpAction ); - - tmpAction = cameraPresetMenu->addAction( m_iconManager.getIcon( "sagittal icon" ), "Right", this, SLOT( setPresetViewRight() ), - QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_R ) ); - tmpAction->setIconVisibleInMenu( true ); - this->addAction( tmpAction ); - - tmpAction = cameraPresetMenu->addAction( m_iconManager.getIcon( "axial icon" ), "Superior", this, SLOT( setPresetViewSuperior() ), - QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_S ) ); - tmpAction->setIconVisibleInMenu( true ); - this->addAction( tmpAction ); - - tmpAction = cameraPresetMenu->addAction( m_iconManager.getIcon( "axial icon" ), "Inferior", this, SLOT( setPresetViewInferior() ), - QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_I ) ); - tmpAction->setIconVisibleInMenu( true ); - this->addAction( tmpAction ); - - tmpAction = cameraPresetMenu->addAction( m_iconManager.getIcon( "coronal icon" ), "Anterior", this, SLOT( setPresetViewAnterior() ), - QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_A ) ); - tmpAction->setIconVisibleInMenu( true ); - this->addAction( tmpAction ); - - tmpAction = cameraPresetMenu->addAction( m_iconManager.getIcon( "coronal icon" ), "Posterior", this, SLOT( setPresetViewPosterior() ), - QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_P ) ); - tmpAction->setIconVisibleInMenu( true ); - this->addAction( tmpAction ); - - resetButton->setMenu( cameraPresetMenu ); + resetButton->setMenu( m_mainGLWidget->getCameraPresetsMenu() ); + m_cameraMenu->addMenu( m_mainGLWidget->getCameraPresetsMenu() ); m_helpAction = new QAction( "Help", this ); m_helpMenu = m_menuBar->addMenu( "Help" ); @@ -440,10 +399,6 @@ void WMainWindow::setupGUI() m_navSagittal->getGLWidget()->setCameraManipulator( WQtGLWidget::NO_OP ); m_glDock->addDockWidget( Qt::LeftDockWidgetArea, m_navSagittal.get() ); - - bgColorMenu->addAction( m_navAxial->getGLWidget()->getBackgroundColorAction() ); - bgColorMenu->addAction( m_navCoronal->getGLWidget()->getBackgroundColorAction() ); - bgColorMenu->addAction( m_navSagittal->getGLWidget()->getBackgroundColorAction() ); } } @@ -776,60 +731,6 @@ void WMainWindow::openOpenWalnutHelpDialog() #endif } -void WMainWindow::setPresetViewLeft() -{ - boost::shared_ptr< WGEViewer > viewer; - viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Main View" ); - osg::ref_ptr cm = osg::dynamic_pointer_cast( viewer->getCameraManipulator() ); - osg::Quat q( 0.5, -0.5, -0.5, 0.5 ); - cm->setRotation( q ); -} - -void WMainWindow::setPresetViewRight() -{ - boost::shared_ptr< WGEViewer > viewer; - viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Main View" ); - osg::ref_ptr cm = osg::dynamic_pointer_cast( viewer->getCameraManipulator() ); - osg::Quat q( -0.5, -0.5, -0.5, -0.5 ); - cm->setRotation( q ); -} - -void WMainWindow::setPresetViewSuperior() -{ - boost::shared_ptr< WGEViewer > viewer; - viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Main View" ); - osg::ref_ptr cm = osg::dynamic_pointer_cast( viewer->getCameraManipulator() ); - osg::Quat q( 0., 0., 0., 1 ); - cm->setRotation( q ); -} - -void WMainWindow::setPresetViewInferior() -{ - boost::shared_ptr< WGEViewer > viewer; - viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Main View" ); - osg::ref_ptr cm = osg::dynamic_pointer_cast( viewer->getCameraManipulator() ); - osg::Quat q( 0., -1., 0., 0. ); - cm->setRotation( q ); -} - -void WMainWindow::setPresetViewAnterior() -{ - boost::shared_ptr< WGEViewer > viewer; - viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Main View" ); - osg::ref_ptr cm = osg::dynamic_pointer_cast( viewer->getCameraManipulator() ); - osg::Quat q( 0., -0.707107, -0.707107, 0. ); - cm->setRotation( q ); -} - -void WMainWindow::setPresetViewPosterior() -{ - boost::shared_ptr< WGEViewer > viewer; - viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Main View" ); - osg::ref_ptr cm = osg::dynamic_pointer_cast( viewer->getCameraManipulator() ); - osg::Quat q( 0.707107, 0., 0., 0.707107 ); - cm->setRotation( q ); -} - void WMainWindow::openNotImplementedDialog() { QMessageBox::information( this, "Not yet implemented!", diff --git a/src/qt4gui/qt4/WMainWindow.h b/src/qt4gui/qt4/WMainWindow.h index daa3f037dd09ee857000d93ae29325454ba522cb..9cddf00997079789aa47fe015d3de537d83dd114 100644 --- a/src/qt4gui/qt4/WMainWindow.h +++ b/src/qt4gui/qt4/WMainWindow.h @@ -283,36 +283,6 @@ public slots: */ void openOpenWalnutHelpDialog(); - /** - * Sets the left preset view of the main viewer. - */ - void setPresetViewLeft(); - - /** - * Sets the right preset view of the main viewer. - */ - void setPresetViewRight(); - - /** - * Sets the superior preset view of the main viewer. - */ - void setPresetViewSuperior(); - - /** - * Sets the inferior preset view of the main viewer. - */ - void setPresetViewInferior(); - - /** - * Sets the anterior preset view of the main viewer. - */ - void setPresetViewAnterior(); - - /** - * Sets the posterior preset view of the main viewer. - */ - void setPresetViewPosterior(); - /** * Gets called when a menu entry that has no functionality yet is activated. */ diff --git a/src/qt4gui/qt4/WQt4Gui.cpp b/src/qt4gui/qt4/WQt4Gui.cpp index ccfbcf41cc07d4ac162e822ea987672abf778637..cc156daf633da827abbe8bab4ba0bf9155ca9fc9 100644 --- a/src/qt4gui/qt4/WQt4Gui.cpp +++ b/src/qt4gui/qt4/WQt4Gui.cpp @@ -95,6 +95,11 @@ WMainWindow* WQt4Gui::getMainWindow() return m_mainWindow; } +WIconManager* WQt4Gui::getIconManager() +{ + return getMainWindow()->getIconManager(); +} + void WQt4Gui::deferredLoad() { m_deferredLoadMutex.lock(); diff --git a/src/qt4gui/qt4/WQt4Gui.h b/src/qt4gui/qt4/WQt4Gui.h index 77f9f373ffd11729ea2d417a29684cd64348291b..b6dbde611bbb84e31568439606cb28583f68e201 100644 --- a/src/qt4gui/qt4/WQt4Gui.h +++ b/src/qt4gui/qt4/WQt4Gui.h @@ -41,6 +41,8 @@ #include "core/gui/WGUI.h" +#include "WIconManager.h" + class WMainWindow; class WKernel; @@ -186,6 +188,13 @@ public: */ static QSettings& getSettings(); + /** + * Get the icon manager of this gui instance. + * + * \return the icon manager. + */ + static WIconManager* getIconManager(); + /** * Returns the option map for the current instance of this GUI. This can be useful to parse further commandline parameters * diff --git a/src/qt4gui/qt4/WQtGLDockWidget.cpp b/src/qt4gui/qt4/WQtGLDockWidget.cpp index 0d781158e60da10bef499866d90293a583071196..b364ca6762bf9823341f00e6fb4627f19ebcf26d 100644 --- a/src/qt4gui/qt4/WQtGLDockWidget.cpp +++ b/src/qt4gui/qt4/WQtGLDockWidget.cpp @@ -22,9 +22,12 @@ // //--------------------------------------------------------------------------- +#include #include #include +#include "WQt4Gui.h" + #include "WQtGLDockWidget.h" #include "WQtGLDockWidget.moc" @@ -56,6 +59,25 @@ WQtGLDockWidget::WQtGLDockWidget( QString viewTitle, QString dockTitle, QWidget* // we need to know whether the dock is visible or not connect( this, SIGNAL( visibilityChanged( bool ) ), this, SLOT( handleVisibilityChange( bool ) ) ); + + // create the dock widget context menu + + // important: do not use this menu for the m_panel widget but ensure the right click event to be sent to the widget + m_panel->setContextMenuPolicy( Qt::PreventContextMenu ); + setContextMenuPolicy( Qt::ActionsContextMenu ); + + // reset the scene + QAction* resetButton = new QAction( WQt4Gui::getIconManager()->getIcon( "view" ), "Reset", this ); + connect( resetButton, SIGNAL( triggered( bool ) ), m_glWidget.get(), SLOT( reset() ) ); + addAction( resetButton ); + + // camera presets + QAction* camPresets = new QAction( WQt4Gui::getIconManager()->getIcon( "view" ), "Camera Presets", this ); + camPresets->setMenu( getGLWidget()->getCameraPresetsMenu() ); + addAction( camPresets ); + + // change background color + addAction( getGLWidget()->getBackgroundColorAction() ); } WQtGLDockWidget::~WQtGLDockWidget() diff --git a/src/qt4gui/qt4/WQtGLWidget.cpp b/src/qt4gui/qt4/WQtGLWidget.cpp index 79faec98fe5cbef917d855e8111b10557fe3cd4e..018801ed5c81606d1ef1660006b70f297debc0b4 100644 --- a/src/qt4gui/qt4/WQtGLWidget.cpp +++ b/src/qt4gui/qt4/WQtGLWidget.cpp @@ -46,6 +46,7 @@ #include "core/graphicsEngine/WGraphicsEngineMode.h" #include "core/kernel/WKernel.h" +#include "WQt4Gui.h" #include "WQtGLScreenCapture.h" #include "events/WRenderedFrameEvent.h" #include "events/WEventTypes.h" @@ -106,7 +107,7 @@ WQtGLWidget::WQtGLWidget( std::string nameOfViewer, QWidget* parent, WGECamera:: // set bg color updateViewerBackground(); // this action manages the above settings - m_changeBGColorAction = new QAction( QString::fromStdString( nameOfViewer ), parent ); + m_changeBGColorAction = new QAction( WQt4Gui::getIconManager()->getIcon( "colorwheel" ), "Change Background Color", parent ); connect( m_changeBGColorAction, SIGNAL( triggered( bool ) ), this, SLOT( changeBGColor() ) ); // enable throwing of wanted @@ -117,6 +118,31 @@ WQtGLWidget::WQtGLWidget( std::string nameOfViewer, QWidget* parent, WGECamera:: false ); connect( m_allowThrowSetting, SIGNAL( change( bool ) ), this, SLOT( updateThrowing() ) ); updateThrowing(); + + // a separate menu for some presets + m_cameraPresetMenu = new QMenu( "Camera Presets" ); + // NOTE: the shortcuts for these view presets should be chosen carefully. Most keysequences have another meaning in the most applications + // so the user may get confused. It is also not a good idea to take letters as they might be used by OpenSceneGraph widget ( like "S" for + // statistics ). + // By additionally adding the action to the main window, we ensure the action can be triggered even if the menu bar is hidden. + QAction* tmpAction = m_cameraPresetMenu->addAction( WQt4Gui::getIconManager()->getIcon( "sagittal icon" ), "Left", this, SLOT( setPresetViewLeft() ), + QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_L ) ); + tmpAction->setIconVisibleInMenu( true ); + tmpAction = m_cameraPresetMenu->addAction( WQt4Gui::getIconManager()->getIcon( "sagittal icon" ), "Right", this, SLOT( setPresetViewRight() ), + QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_R ) ); + tmpAction->setIconVisibleInMenu( true ); + tmpAction = m_cameraPresetMenu->addAction( WQt4Gui::getIconManager()->getIcon( "axial icon" ), "Superior", this, SLOT( setPresetViewSuperior() ), + QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_S ) ); + tmpAction->setIconVisibleInMenu( true ); + tmpAction = m_cameraPresetMenu->addAction( WQt4Gui::getIconManager()->getIcon( "axial icon" ), "Inferior", this, SLOT( setPresetViewInferior() ), + QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_I ) ); + tmpAction->setIconVisibleInMenu( true ); + tmpAction = m_cameraPresetMenu->addAction( WQt4Gui::getIconManager()->getIcon( "coronal icon" ), "Anterior", this, SLOT( setPresetViewAnterior() ), + QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_A ) ); + tmpAction->setIconVisibleInMenu( true ); + tmpAction = m_cameraPresetMenu->addAction( WQt4Gui::getIconManager()->getIcon( "coronal icon" ), "Posterior", this, SLOT( setPresetViewPosterior() ), + QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_P ) ); + tmpAction->setIconVisibleInMenu( true ); } WQtGLWidget::~WQtGLWidget() @@ -400,3 +426,97 @@ WQtGLScreenCapture* WQtGLWidget::getScreenCapture( WMainWindow* parent ) const return sc; } +void WQtGLWidget::setPresetViewLeft() +{ + osg::ref_ptr cm = osg::dynamic_pointer_cast( m_Viewer->getCameraManipulator() ); + osg::Quat q( 0.5, -0.5, -0.5, 0.5 ); + // is it a trackball manipulator? + if( cm ) + { + cm->setRotation( q ); + } + else + { + wlog::warn( "WQtGLWidget(" + m_Viewer->getName() + ")" ) << "GL Widget does not use a TrackballManipulator. Preset cannot be used."; + } +} + +void WQtGLWidget::setPresetViewRight() +{ + osg::ref_ptr cm = osg::dynamic_pointer_cast( m_Viewer->getCameraManipulator() ); + osg::Quat q( -0.5, -0.5, -0.5, -0.5 ); + // is it a trackball manipulator? + if( cm ) + { + cm->setRotation( q ); + } + else + { + wlog::warn( "WQtGLWidget(" + m_Viewer->getName() + ")" ) << "GL Widget does not use a TrackballManipulator. Preset cannot be used."; + } +} + +void WQtGLWidget::setPresetViewSuperior() +{ + osg::ref_ptr cm = osg::dynamic_pointer_cast( m_Viewer->getCameraManipulator() ); + osg::Quat q( 0., 0., 0., 1 ); + // is it a trackball manipulator? + if( cm ) + { + cm->setRotation( q ); + } + else + { + wlog::warn( "WQtGLWidget(" + m_Viewer->getName() + ")" ) << "GL Widget does not use a TrackballManipulator. Preset cannot be used."; + } +} + +void WQtGLWidget::setPresetViewInferior() +{ + osg::ref_ptr cm = osg::dynamic_pointer_cast( m_Viewer->getCameraManipulator() ); + osg::Quat q( 0., -1., 0., 0. ); + // is it a trackball manipulator? + if( cm ) + { + cm->setRotation( q ); + } + else + { + wlog::warn( "WQtGLWidget(" + m_Viewer->getName() + ")" ) << "GL Widget does not use a TrackballManipulator. Preset cannot be used."; + } +} + +void WQtGLWidget::setPresetViewAnterior() +{ + osg::ref_ptr cm = osg::dynamic_pointer_cast( m_Viewer->getCameraManipulator() ); + osg::Quat q( 0., -0.707107, -0.707107, 0. ); + // is it a trackball manipulator? + if( cm ) + { + cm->setRotation( q ); + } + else + { + wlog::warn( "WQtGLWidget(" + m_Viewer->getName() + ")" ) << "GL Widget does not use a TrackballManipulator. Preset cannot be used."; + } +} + +void WQtGLWidget::setPresetViewPosterior() +{ + osg::ref_ptr cm = osg::dynamic_pointer_cast( m_Viewer->getCameraManipulator() ); + osg::Quat q( 0.707107, 0., 0., 0.707107 ); + // is it a trackball manipulator? + if( cm ) + { + cm->setRotation( q ); + } + else + { + wlog::warn( "WQtGLWidget(" + m_Viewer->getName() + ")" ) << "GL Widget does not use a TrackballManipulator. Preset cannot be used."; + } +} + +QMenu* WQtGLWidget::getCameraPresetsMenu() +{ + return m_cameraPresetMenu; +} diff --git a/src/qt4gui/qt4/WQtGLWidget.h b/src/qt4gui/qt4/WQtGLWidget.h index 5eb60f5e9cff445eec068fea3e9d90f60aec8d96..97c7da97d268eb3ea282ea787d23f2ef6b86aef7 100644 --- a/src/qt4gui/qt4/WQtGLWidget.h +++ b/src/qt4gui/qt4/WQtGLWidget.h @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -145,6 +146,13 @@ public: */ WQtGLScreenCapture* getScreenCapture( WMainWindow* parent ) const; + /** + * The presets menu. + * + * \return the menu + */ + QMenu* getCameraPresetsMenu(); + signals: /** @@ -158,6 +166,36 @@ public slots: */ void reset(); + /** + * Sets the left preset view of the main viewer. + */ + void setPresetViewLeft(); + + /** + * Sets the right preset view of the main viewer. + */ + void setPresetViewRight(); + + /** + * Sets the superior preset view of the main viewer. + */ + void setPresetViewSuperior(); + + /** + * Sets the inferior preset view of the main viewer. + */ + void setPresetViewInferior(); + + /** + * Sets the anterior preset view of the main viewer. + */ + void setPresetViewAnterior(); + + /** + * Sets the posterior preset view of the main viewer. + */ + void setPresetViewPosterior(); + protected: /** * The viewer to the scene. @@ -308,6 +346,11 @@ private: */ void notifyFirstRenderedFrame(); + /** + * Camera menu + */ + QMenu* m_cameraPresetMenu; + private slots: /** * Function to handle updates in the setting \ref m_allowThrowSetting.