From dd9de710df141a074f10d0cab27b217425ecab20 Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Tue, 25 Jun 2013 10:45:02 +0200 Subject: [PATCH] Feature #1711 CreaDevManager application implementation Feature: Now Code Files can be directly opened in the text editor --- lib/creaDevManagerLib/images/CFIcon20.xpm | 134 ++++++++ lib/creaDevManagerLib/images/CFIcon64.xpm | 290 ++++++++++++++++++ lib/creaDevManagerLib/modelCDMAppli.cpp | 33 +- lib/creaDevManagerLib/modelCDMApplication.cpp | 133 +++++--- lib/creaDevManagerLib/modelCDMApplication.h | 1 + lib/creaDevManagerLib/modelCDMCodeFile.cpp | 94 ++++++ lib/creaDevManagerLib/modelCDMCodeFile.h | 77 +++++ lib/creaDevManagerLib/modelCDMFolder.cpp | 36 ++- lib/creaDevManagerLib/modelCDMFolder.h | 1 + lib/creaDevManagerLib/modelCDMLib.cpp | 34 +- lib/creaDevManagerLib/modelCDMLibrary.cpp | 33 +- lib/creaDevManagerLib/modelCDMPackage.cpp | 36 ++- lib/creaDevManagerLib/modelCDMPackageSrc.cpp | 28 +- lib/creaDevManagerLib/modelCDMProject.cpp | 36 ++- lib/creaDevManagerLib/modelCDMProject.h | 1 + .../wxCDMCodeFileDescriptionPanel.cpp | 230 ++++++++++++++ .../wxCDMCodeFileDescriptionPanel.h | 128 ++++++++ lib/creaDevManagerLib/wxCDMMainFrame.cpp | 61 ++-- .../wxCDMProjectsTreeCtrl.cxx | 20 +- lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h | 4 + 20 files changed, 1313 insertions(+), 97 deletions(-) create mode 100644 lib/creaDevManagerLib/images/CFIcon20.xpm create mode 100644 lib/creaDevManagerLib/images/CFIcon64.xpm create mode 100644 lib/creaDevManagerLib/modelCDMCodeFile.cpp create mode 100644 lib/creaDevManagerLib/modelCDMCodeFile.h create mode 100644 lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.cpp create mode 100644 lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.h diff --git a/lib/creaDevManagerLib/images/CFIcon20.xpm b/lib/creaDevManagerLib/images/CFIcon20.xpm new file mode 100644 index 0000000..90c1425 --- /dev/null +++ b/lib/creaDevManagerLib/images/CFIcon20.xpm @@ -0,0 +1,134 @@ +/* XPM */ +const static char * CFIcon20[] = { +"20 20 111 2", +" c None", +". c #181F28", +"+ c #666B71", +"@ c #8F9297", +"# c #909499", +"$ c #8F9397", +"% c #696F75", +"& c #192029", +"* c #686C72", +"= c #ECEDED", +"- c #919499", +"; c #878B8F", +"> c #ECECED", +", c #6A6F75", +"' c #686C73", +") c #A7A9AD", +"! c #EBEBEC", +"~ c #EAEBEC", +"{ c #EBECED", +"] c #EAECEC", +"^ c #ECEDEE", +"/ c #686D73", +"( c #888B90", +"_ c #EDEDEE", +": c #373D45", +"< c #111821", +"[ c #141B25", +"} c #101721", +"| c #111822", +"1 c #131A23", +"2 c #0F1620", +"3 c #101821", +"4 c #0F1720", +"5 c #363C44", +"6 c #909498", +"7 c #84898D", +"8 c #1D242D", +"9 c #1E242D", +"0 c #1E252E", +"a c #86898E", +"b c #7F8388", +"c c #1A212A", +"d c #3F454C", +"e c #7B7F84", +"f c #585D63", +"g c #232A32", +"h c #7B7F85", +"i c #82858A", +"j c #6D7177", +"k c #19212A", +"l c #82868B", +"m c #7E8186", +"n c #9FA2A6", +"o c #E8E9EA", +"p c #B3B6B9", +"q c #CCCED0", +"r c #595E64", +"s c #2B313A", +"t c #FEFEFE", +"u c #A9ACAF", +"v c #B0B2B5", +"w c #92959A", +"x c #7E8387", +"y c #7F8287", +"z c #444951", +"A c #F4F4F5", +"B c #2A3039", +"C c #FFFFFF", +"D c #7D8186", +"E c #7F8288", +"F c #5C6167", +"G c #9C9FA3", +"H c #F3F3F4", +"I c #DDDEDF", +"J c #DFE0E2", +"K c #72767C", +"L c #7D8187", +"M c #818589", +"N c #4E535A", +"O c #DBDCDE", +"P c #7E8286", +"Q c #808489", +"R c #E2E3E4", +"S c #C2C4C7", +"T c #75797E", +"U c #909398", +"V c #4F545B", +"W c #7C8085", +"X c #E7E8E9", +"Y c #BDBFC2", +"Z c #424850", +"` c #293038", +" . c #7E8287", +".. c #7F8488", +"+. c #8E9296", +"@. c #A4A7AB", +"#. c #151C25", +"$. c #8D9196", +"%. c #6B7075", +"&. c #B4B6B9", +"*. c #818489", +"=. c #81858A", +"-. c #81868A", +";. c #7A7E83", +">. c #B1B3B7", +",. c #65696F", +"'. c #8D9095", +"). c #919599", +"!. c #8C9095", +"~. c #64686E", +"{. c #171E27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; ; ; ; ; ; ; ; ; ; - > , ", +" ' ) ! = ~ = { ] ~ { = ] ^ ! ) / ", +" ( _ : < [ } < | 1 < 2 3 4 5 _ ( ", +" 6 7 & 8 8 8 9 0 0 8 8 8 8 & a 6 ", +" # b c 8 d e f 8 g h i i j k l 6 ", +" 6 m c n o p q r s t u v w c x # ", +" 6 y z A 0 8 8 8 B C 8 8 8 c D # ", +" # E F G 8 8 8 8 B H I J K c L # ", +" # M N O 8 8 8 8 B C 8 8 8 c P # ", +" # Q 0 R S T U V B C 8 8 8 c W - ", +" # Q c 8 ) X Y Z ` X 8 8 8 c .# ", +" # b c 8 8 8 8 8 8 8 8 8 8 c ..# ", +" +.@.#.c c k c c k c c & c [ @.$. ", +" %.C &.h x *.Q Q =...=.-.;.>.C ,. ", +" c , '.).# # # # # # # # ).!.~.{. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/CFIcon64.xpm b/lib/creaDevManagerLib/images/CFIcon64.xpm new file mode 100644 index 0000000..baed55e --- /dev/null +++ b/lib/creaDevManagerLib/images/CFIcon64.xpm @@ -0,0 +1,290 @@ +/* XPM */ +const static char * CFIcon64[] = { +"64 64 223 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #252B34", +"}. c #F0F1F1", +"|. c #292F38", +"1. c #3D434B", +"2. c #888B90", +"3. c #C5C7C9", +"4. c #E3E4E5", +"5. c #F7F8F8", +"6. c #DBDCDE", +"7. c #BEC0C2", +"8. c #808489", +"9. c #3E444C", +"0. c #71757B", +"a. c #ECEDED", +"b. c #2E353D", +"c. c #ABAEB1", +"d. c #FEFEFE", +"e. c #EAEBEB", +"f. c #444951", +"g. c #74797E", +"h. c #323840", +"i. c #E6E6E7", +"j. c #E7E7E8", +"k. c #989B9F", +"l. c #63686E", +"m. c #4D535A", +"n. c #4F545B", +"o. c #60656B", +"p. c #8E9296", +"q. c #C3C5C7", +"r. c #EBECEC", +"s. c #3F454D", +"t. c #B8BABD", +"u. c #94979B", +"v. c #ECEDEE", +"w. c #4A4F57", +"x. c #82858A", +"y. c #EDEEEE", +"z. c #C8C9CC", +"A. c #EFF0F0", +"B. c #D3D4D6", +"C. c #232932", +"D. c #EDEDEE", +"E. c #393F47", +"F. c #CDCED0", +"G. c #787C81", +"H. c #919499", +"I. c #E0E0E2", +"J. c #41474E", +"K. c #ACAFB2", +"L. c #20272F", +"M. c #B1B3B6", +"N. c #C1C3C5", +"O. c #3A4048", +"P. c #262D35", +"Q. c #1F252E", +"R. c #282E37", +"S. c #FBFBFB", +"T. c #BABDBF", +"U. c #7E8287", +"V. c #62676D", +"W. c #5B6066", +"X. c #6F7379", +"Y. c #C7C8CB", +"Z. c #5E6369", +"`. c #42484F", +" + c #BBBDC0", +".+ c #262D36", +"++ c #30363F", +"@+ c #AFB1B5", +"#+ c #CCCED0", +"$+ c #E7E8E9", +"%+ c #D2D4D5", +"&+ c #B4B7B9", +"*+ c #2F353E", +"=+ c #121923", +"-+ c #51575E", +";+ c #F2F2F2", +">+ c #B6B8BB", +",+ c #B5B7BA", +"'+ c #D8DADB", +")+ c #9B9EA2", +"!+ c #121A23", +"~+ c #CED0D1", +"{+ c #AEB0B3", +"]+ c #75797F", +"^+ c #40454E", +"/+ c #2C333B", +"(+ c #9C9FA3", +"_+ c #131A23", +":+ c #5C6167", +"<+ c #F8F8F9", +"[+ c #F7F7F7", +"}+ c #929699", +"|+ c #F3F3F3", +"1+ c #6E7378", +"2+ c #161E27", +"3+ c #5D6268", +"4+ c #ABADB1", +"5+ c #D6D6D8", +"6+ c #EBECED", +"7+ c #CDCFD0", +"8+ c #9DA0A4", +"9+ c #454B52", +"0+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 }.[.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + |./ 3 / > $ . ", +" . $ > / 3 O [.. . . . . . . . 1.2.3.4.5.}.6.7.8.9.. . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . i / 3 / > $ . ", +" . $ > / 3 a.:.. . . . . . b.c.).3 3 3 3 3 3 3 3 3 n . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . -./ 3 / > $ . ", +" . $ > / d.e.i + . . . . f.4.3 3 3 3 3 3 3 3 3 3 3 g.. . . . . 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . %./ 3 / > $ . ", +" . $ > / d.e.|.+ . . . h.i.3 3 3 j.k.l.m.n.o.p.q.r., . . . . . 3 3 3 s.s.s.s.s.s.s.s.s.B . . . - / 3 / > $ . ", +" . $ > / d.e.|.+ . . . t.3 3 3 u.... . . . . . . /.. . . . . . 3 3 3 . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / d.v.i + . . w.3 3 3 x.. . . . . . . . . . . . . . . . 3 3 3 . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / 3 y.i . . . k.3 3 z.. . . . . . . . . . . . . . . . . 3 3 3 . . . . . . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 A.[.. . . B.3 3 0.. . . . . . . . . . . . . . . . . 3 3 3 . . . . . . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 }.C.. . . D.3 3 f.. . . . . . . . . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 k.. . . . - }.3 / > $ . ", +" . $ > / 3 / ..+ . . L 3 3 ... . . . . . . . . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 k.. . . . C.}.3 / > $ . ", +" . $ > / 3 / i . . . ( 3 3 E.. . . . . . . . . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 k.. . . . ..A.3 / > $ . ", +" . $ > / 3 / r + . . F.3 3 G.. . . . . . . . . . . . . . . . . 3 3 3 . . . . . . . + . . . . . +.A.3 / > $ . ", +" . $ > / 3 / i . . . H.3 3 I.' . . . . . . . . . . . . . . . . 3 3 3 . . . . . . . . . . . . . C.A.3 / > $ . ", +" . $ > / 3 / t . . . J.8 3 3 K.^.. . . . . . . . . . . . . . . 3 3 3 . . . . . . . . . . . . . L.}.3 / > $ . ", +" . $ > / 3 / ... . . . M.3 3 3 N.O.. . . . . . . P.^.. . . . . 3 3 3 . . . . . . . . . . . . . Q.}.3 / > $ . ", +" . $ > / 3 / R.. . . . C 4.3 3 3 S.T.U.V.W.X.p.Y.M Z.. . . . . 3 3 3 . . . . . . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / B + . . . . `.T 3 3 3 3 3 3 3 3 3 3 3 +. . . . . 3 3 3 . . . . . . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / .++ . . . . . ++@+3 3 3 3 3 3 3 3 3 8 3.%.. . . . 3 3 3 . . . . . . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . . . . . . . `.p.#+$+M r.%+&+g.*+. . . . . . 3 3 3 . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . :./ 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . R./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + =+-+).3 ;+> $ . ", +" . $ B a.3 3 >+| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| ,+3 3 z , % . ", +" . & t '+3 3 3 )+&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + !+-.)+3 3 3 ~+L.} . ", +" . + 5 {+3 3 3 3 s ]+^+-.^.. /.%.-.:.:.:.:.:.:.+.-.|./+C C [.$.q :.:.i R.#.> i l /.. ^.++]+s 3 3 3 3 (+_+. . ", +" . . _+:+3 3 3 3 3 3 <+/ / / / / / / / / / / / / }.P P P P }./ / / / / / / / / / / / / <+3 3 3 3 3 [+f.k . . ", +" . + >.}+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 |+1+= . . ", +" . @ 2+3+4+5+6+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / $+7+8+9+= + . ", +" . . + !+5 &.|.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > R.- !+) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # 0++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index c66cbb8..70471a7 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -90,6 +90,8 @@ modelCDMAppli::modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -97,6 +99,17 @@ modelCDMAppli::modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } + //if is a code file, create modelCDMCodeFile + else if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } //if is an unknown file, create file else { @@ -344,6 +357,8 @@ const bool modelCDMAppli::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -361,6 +376,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) return false; } } + //if is a code file, create modelCDMCodeFile //if is an unknown file, create file else { @@ -378,8 +394,21 @@ const bool modelCDMAppli::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } } diff --git a/lib/creaDevManagerLib/modelCDMApplication.cpp b/lib/creaDevManagerLib/modelCDMApplication.cpp index 5d0f597..d214ac4 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.cpp +++ b/lib/creaDevManagerLib/modelCDMApplication.cpp @@ -122,59 +122,76 @@ modelCDMApplication::modelCDMApplication(modelCDMIProjectTreeNode* parent, const while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); + //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } - //if is an unknown file, create file else { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - std::string extension = stdfileName.substr(stdfileName.size()-4); - //if is cxx or cpp check if is the main file. - if (mainFile == NULL && (extension == ".cxx" || extension == ".cpp")) + //if is a code file, create modelCDMCodeFile and check for main file + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) { - std::ifstream fileStream((this->path + CDMUtilities::SLASH + stdfileName).c_str()); + modelCDMCodeFile* file = new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - if (fileStream.is_open()) + if (mainFile == NULL && (fileType == ".cxx" || fileType == ".cpp")) { - std::string fileContent = ""; - char ch = fileStream.get(); - while(!fileStream.eof()) - { - fileContent.push_back(ch); - ch = fileStream.get(); - } - fileStream.close(); - - boost::regex expression("^\\h*IMPLEMENT_APP[#\\s\\(]"); - std::string::const_iterator start, end; - start = fileContent.begin(); - end = fileContent.end(); - boost::match_results what; - boost::match_flag_type flags = boost::match_default; - if(boost::regex_search(start, end, what, expression, flags)) - { - std::cout << "found main wxwidgets file: " << stdfileName << std::endl; - this->mainFile = file; - } - else + std::ifstream fileStream((this->path + CDMUtilities::SLASH + stdfileName).c_str()); + + if (fileStream.is_open()) { - expression = boost::regex("^\\h*int\\h+main[#\\s\\(]"); + std::string fileContent = ""; + char ch = fileStream.get(); + while(!fileStream.eof()) + { + fileContent.push_back(ch); + ch = fileStream.get(); + } + fileStream.close(); + + boost::regex expression("^\\h*IMPLEMENT_APP[#\\s\\(]"); + std::string::const_iterator start, end; start = fileContent.begin(); end = fileContent.end(); + boost::match_results what; + boost::match_flag_type flags = boost::match_default; if(boost::regex_search(start, end, what, expression, flags)) { - std::cout << "found main console file: " << stdfileName << std::endl; + std::cout << "found main wxwidgets file: " << stdfileName << std::endl; this->mainFile = file; } + else + { + expression = boost::regex("^\\h*int\\h+main[#\\s\\(]"); + start = fileContent.begin(); + end = fileContent.end(); + if(boost::regex_search(start, end, what, expression, flags)) + { + std::cout << "found main console file: " << stdfileName << std::endl; + this->mainFile = file; + } + } } } - + this->children.push_back(file); + } + //if is an unknown file, create file + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); } - this->children.push_back(file); + } cont = dir.GetNext(&fileName); @@ -347,6 +364,8 @@ const bool modelCDMApplication::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -364,7 +383,8 @@ const bool modelCDMApplication::Refresh(std::string*& result) return false; } } - //if is an unknown file, create file + // if is a code file, create modelCDMCodeFile + // if is an unknown file, create file else { bool found = false; @@ -392,7 +412,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP") { - this->mainFile = dynamic_cast(children[i]); + this->mainFile = dynamic_cast(children[i]); } } fileStream.close(); @@ -402,29 +422,40 @@ const bool modelCDMApplication::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - - std::string extension = stdfileName.substr(stdfileName.size()-4); - if (mainFile == NULL && (extension == ".cxx" || extension == ".cpp")) + if (fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) { - std::ifstream fileStream; - std::string word; - fileStream.open((this->path + CDMUtilities::SLASH + stdfileName).c_str()); - while (fileStream.is_open() && !fileStream.eof()) + modelCDMCodeFile* file = new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + + if(mainFile == NULL && (fileType == ".cxx" || fileType == ".cpp")) { - //get sets - std::getline(fileStream,word,'('); - std::vector wordBits; - CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); - if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP") + std::ifstream fileStream; + std::string word; + fileStream.open((this->path + CDMUtilities::SLASH + stdfileName).c_str()); + while (fileStream.is_open() && !fileStream.eof()) { - this->mainFile = file; + //get sets + std::getline(fileStream,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); + if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP") + { + this->mainFile = file; + } } + fileStream.close(); } - fileStream.close(); + this->children.push_back(file); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); } - - this->children.push_back(file); } } diff --git a/lib/creaDevManagerLib/modelCDMApplication.h b/lib/creaDevManagerLib/modelCDMApplication.h index 18cb7c5..9693066 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.h +++ b/lib/creaDevManagerLib/modelCDMApplication.h @@ -41,6 +41,7 @@ #include "modelCDMFolder.h" #include "modelCDMFile.h" +#include "modelCDMCodeFile.h" /** * Class representing an application in a Crea project. An Application is an stand alone application that uses the project libraries to show their functionalities. diff --git a/lib/creaDevManagerLib/modelCDMCodeFile.cpp b/lib/creaDevManagerLib/modelCDMCodeFile.cpp new file mode 100644 index 0000000..7e97862 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMCodeFile.cpp @@ -0,0 +1,94 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMCodeFile.cpp + * + * Created on: Jun 24, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "modelCDMCodeFile.h" + +#include + +#include +#include + +#include "CDMUtilities.h" + +modelCDMCodeFile::modelCDMCodeFile() +{ +} + +modelCDMCodeFile::modelCDMCodeFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating code file: " + path + "\n"; + this->parent = parent; + this->children.clear(); + this->level = level; + this->type = wxDIR_FILES; + this->name = name; + this->path = path; + + std::ifstream in(path.c_str(), std::ifstream::in | std::ifstream::binary); + in.seekg(0, std::ifstream::end); + this->length = in.tellg(); + in.close(); +} + +modelCDMCodeFile::~modelCDMCodeFile() +{ +} + +bool modelCDMCodeFile::OpenFile(std::string*& result) +{ + + if (!CDMUtilities::openTextEditor(this->path)) + return true; + else + { + result = new std::string("Couldn't open CMakeLists file."); + return false; + } +} + +const bool modelCDMCodeFile::Refresh(std::string*& result) +{ + //std::cout << "refreshing cmakelists" << std::endl; + std::ifstream in((this->path).c_str()); + if(!in.is_open()) + { + in.close(); + return false; + } + std::ifstream in2(path.c_str(), std::ifstream::in | std::ifstream::binary); + in2.seekg(0, std::ifstream::end); + this->length = in2.tellg(); + in2.close(); + return true; +} diff --git a/lib/creaDevManagerLib/modelCDMCodeFile.h b/lib/creaDevManagerLib/modelCDMCodeFile.h new file mode 100644 index 0000000..b57a812 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMCodeFile.h @@ -0,0 +1,77 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMCodeFile.h + * + * Created on: Jun 24, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef MODELCDMCODEFILE_H_ +#define MODELCDMCODEFILE_H_ + +#include "modelCDMFile.h" + +/** + * Class representing a code file in a folder of a Crea project. + */ +class modelCDMCodeFile : public modelCDMFile +{ +public: + /** + * Default Constructor. + */ + modelCDMCodeFile(); + /** + * Code file Constructor. + * @param parent Parent node of the Code file node. + * @param path Full path to the Code file node. + * @param name File name of the Code file node. + * @param level Project hierarchy level of the Code file node. + */ + modelCDMCodeFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 1); + /** + * Destructor + */ + ~modelCDMCodeFile(); + + /** + * Opens the file in the system default code editor. + * @param result Result message. + * @return True if the operation was successful. + */ + bool OpenFile(std::string*& result); + /** + * Refreshes the state of the code file. + * @param result Result message. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); +}; + +#endif /* MODELCDMCODEFILE_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMFolder.cpp b/lib/creaDevManagerLib/modelCDMFolder.cpp index bcef483..c2796e8 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.cpp +++ b/lib/creaDevManagerLib/modelCDMFolder.cpp @@ -83,6 +83,8 @@ modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::stri while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -90,11 +92,23 @@ modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::stri this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } + //if is a code file, create code file + else if(fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + modelCDMCodeFile* file = new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + //if is an unknown file, create file else { this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } - //if is an unknown file, create file + cont = dir.GetNext(&fileName); } } @@ -211,6 +225,8 @@ const bool modelCDMFolder::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -246,8 +262,22 @@ const bool modelCDMFolder::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + //if is a code file, create modelCDMCodeFile + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } } diff --git a/lib/creaDevManagerLib/modelCDMFolder.h b/lib/creaDevManagerLib/modelCDMFolder.h index 2a44830..e9cae7c 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.h +++ b/lib/creaDevManagerLib/modelCDMFolder.h @@ -40,6 +40,7 @@ #include "modelCDMIProjectTreeNode.h" #include "modelCDMCMakeListsFile.h" +#include "modelCDMCodeFile.h" /** * Class representing a folder in the project hierarchy. diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index 3dcf9b8..994ae85 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -91,6 +91,8 @@ modelCDMLib::modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& pa while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -98,6 +100,17 @@ modelCDMLib::modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& pa this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } + //if is a code file, create modelCDMCodeFile + else if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } //if is an unknown file, create file else { @@ -268,6 +281,9 @@ const bool modelCDMLib::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); + //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -302,8 +318,22 @@ const bool modelCDMLib::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + //if is a code file, create modelCDMCodeFile + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } } diff --git a/lib/creaDevManagerLib/modelCDMLibrary.cpp b/lib/creaDevManagerLib/modelCDMLibrary.cpp index 72310c7..c3dcc6a 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.cpp +++ b/lib/creaDevManagerLib/modelCDMLibrary.cpp @@ -120,6 +120,8 @@ modelCDMLibrary::modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::st while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -127,6 +129,17 @@ modelCDMLibrary::modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::st this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } + //if is a code file, create code file + else if(fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + modelCDMCodeFile* file = new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } //if is an unknown file, create file else { @@ -295,6 +308,8 @@ const bool modelCDMLibrary::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -329,8 +344,22 @@ const bool modelCDMLibrary::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + //if is a code file, create modelCDMCodeFile + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } } diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index 5816dc4..f6fc8bc 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -163,6 +163,8 @@ modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::st while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -170,11 +172,23 @@ modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::st this->CMakeLists = new modelCDMCMakeListsFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } + //if is a code file, create code file + else if(fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + modelCDMCodeFile* file = new modelCDMCodeFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + //if is an unknown file, create file else { this->children.push_back(new modelCDMFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } - //if is an unknown file, create file + cont = dir.GetNext(&fileName); } } @@ -529,6 +543,8 @@ const bool modelCDMPackage::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -563,8 +579,22 @@ const bool modelCDMPackage::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + //if is a code file, create modelCDMCodeFile + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } } diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp index 529bfe2..97e4dde 100644 --- a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp @@ -88,11 +88,13 @@ modelCDMPackageSrc::modelCDMPackageSrc(modelCDMIProjectTreeNode* parent, const s while (cont) { std::string stdfileName = crea::wx2std(fileName); - modelCDMFile* file; + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); + modelCDMCodeFile* file; if(stdfileName.substr(0,2) == "bb") { - file = new modelCDMFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + file = new modelCDMCodeFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); modelCDMBlackBox* blackBox = new modelCDMBlackBox(this, path, stdfileName.substr(2,stdfileName.size()-4), level + 1); blackBox->SetHeaderFile(file); @@ -100,7 +102,7 @@ modelCDMPackageSrc::modelCDMPackageSrc(modelCDMIProjectTreeNode* parent, const s cont = dir2.GetFirst(&fileName, crea::std2wx(stdfileName.substr(0,stdfileName.size()-2) + ".cxx"), wxDIR_FILES); if (cont) { - file = new modelCDMFile(this, path + CDMUtilities::SLASH + crea::wx2std(fileName), crea::wx2std(fileName), this->level + 1); + file = new modelCDMCodeFile(this, path + CDMUtilities::SLASH + crea::wx2std(fileName), crea::wx2std(fileName), this->level + 1); this->children.push_back(file); blackBox->SetSourceFile(file); } @@ -327,6 +329,8 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -361,8 +365,22 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + //if is a code file, create modelCDMCodeFile + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } } diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 7edde9a..7d0b454 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -189,6 +189,8 @@ modelCDMProject::modelCDMProject( while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -196,11 +198,23 @@ modelCDMProject::modelCDMProject( this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } + //if is a code file, create modelCDMCodeFile + else if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + //if is an unknown file, create file else { this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } - //if is an unknown file, create file + cont = dir.GetNext(&fileName); } } @@ -629,6 +643,8 @@ const bool modelCDMProject::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -646,6 +662,7 @@ const bool modelCDMProject::Refresh(std::string*& result) return false; } } + //if is a code file, create modelCDMCodeFile //if is an unknown file, create file else { @@ -663,8 +680,21 @@ const bool modelCDMProject::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } } diff --git a/lib/creaDevManagerLib/modelCDMProject.h b/lib/creaDevManagerLib/modelCDMProject.h index a3459d7..be8f244 100644 --- a/lib/creaDevManagerLib/modelCDMProject.h +++ b/lib/creaDevManagerLib/modelCDMProject.h @@ -44,6 +44,7 @@ #include "modelCDMAppli.h" #include "modelCDMPackage.h" #include "modelCDMCMakeListsFile.h" +#include "modelCDMCodeFile.h" /** * Project model class. diff --git a/lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.cpp new file mode 100644 index 0000000..723f229 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.cpp @@ -0,0 +1,230 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMCodeFileDescriptionPanel.cpp + * + * Created on: Jun 24, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMCodeFileDescriptionPanel.h" + +#include + +#include "wxCDMMainFrame.h" + +#include "creaDevManagerIds.h" +#include "images/CFIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMCodeFileDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMCodeFileDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_OPEN_FILE, wxCDMCodeFileDescriptionPanel::OnBtnOpenInEditor) +EVT_BUTTON(ID_BUTTON_OPEN_COMMAND, wxCDMCodeFileDescriptionPanel::OnBtnOpenWithCommand) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMCodeFileDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMCodeFileDescriptionPanel::wxCDMCodeFileDescriptionPanel( + wxWindow* parent, + modelCDMCodeFile* codefile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMCodeFileDescriptionPanel::Create(parent, codefile, id, caption, pos, size, style); +} + +wxCDMCodeFileDescriptionPanel::~wxCDMCodeFileDescriptionPanel() +{ +} + +bool wxCDMCodeFileDescriptionPanel::Create( + wxWindow* parent, + modelCDMCodeFile* codefile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->codeFile = codefile; + CreateControls(); + // this part makes the scrollbars show up + this->FitInside(); // ask the sizer about the needed size + this->SetScrollRate(5, 5); + return TRUE; +} + +void wxCDMCodeFileDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->codeFile->GetParents(); + for (int i = 0; i < (int)(parents.size()); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + + linksSizer->Add(new wxStaticText(this, wxID_ANY, crea::std2wx(this->codeFile->GetName())), 0, wxALIGN_CENTER, 0); + + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(CFIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Code File")),0, wxALIGN_LEFT, 0); + //File Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->codeFile->GetName())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //File Properties + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + + wxStaticText *pLocation = new wxStaticText(propertiesPanel, -1, wxT("Location")); + wxStaticText *pLength = new wxStaticText(propertiesPanel, -1, wxT("File Size")); + + wxStaticText* pLocationtc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->codeFile->GetPath())); + pLocationtc->SetMaxSize(wxSize(300,-1)); + int lgth = this->codeFile->GetLength(); + std::stringstream ss; + ss << lgth / 1024; + std::string lgths = ss.str() + " KB"; + wxStaticText* pLengthtc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(lgths)); + + propertiesGridSizer->Add(pLocation, 0, wxALIGN_RIGHT | wxALIGN_TOP); + propertiesGridSizer->Add(pLocationtc, 1, wxEXPAND); + propertiesGridSizer->Add(pLength, 0, wxALIGN_RIGHT | wxALIGN_TOP); + propertiesGridSizer->Add(pLengthtc, 1, wxEXPAND); + + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND); + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 1, wxALL|wxEXPAND, 5); + + sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + + wxButton* editfilebt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FILE, _T("Open File")); + editfilebt->SetToolTip(wxT("Open the code file in the default text editor.")); + actionsGridSizer->Add(editfilebt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Containing Folder")); + openFolderbt->SetToolTip(wxT("Open the folder where the code file is located in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + wxButton* openfilebt = new wxButton(actionsPanel, ID_BUTTON_OPEN_COMMAND, _T("Open With Command")); + openfilebt->SetToolTip(wxT("Open the code file with a specific command.")); + actionsGridSizer->Add(openfilebt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +void wxCDMCodeFileDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) +{ + std::vector parents = this->codeFile->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMCodeFileDescriptionPanel::OnBtnOpenInEditor(wxCommandEvent& event) +{ + std::string* result; + if(!this->codeFile->OpenFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Code File - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMCodeFileDescriptionPanel::OnBtnOpenWithCommand(wxCommandEvent& event) +{ + //get command + wxString commandEx = wxGetTextFromUser( + _T("Enter the command to execute file"), + _T("Execute File - creaDevManager"), + _T("") + ); + //check name + if(commandEx.Len() > 0) + { + std::string* result; + if(!((modelCDMFile*)this->codeFile)->OpenFile(result, crea::wx2std(commandEx))) + wxMessageBox(crea::std2wx(*result),_T("Execute Code File - Error!"),wxOK | wxICON_ERROR); + } +} + +void wxCDMCodeFileDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->codeFile->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open File in Folder - Error!"),wxOK | wxICON_ERROR); +} diff --git a/lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.h new file mode 100644 index 0000000..f75f5a3 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMCodeFileDescriptionPanel.h @@ -0,0 +1,128 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMCodeFileDescriptionPanel.h + * + * Created on: June 24, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMCODEFILEDESCRIPTIONPANEL_H_ +#define WXCDMCODEFILEDESCRIPTIONPANEL_H_ + +#include +#include + +#include "modelCDMCodeFile.h" + +/** + * Code File description panel. Shows the file properties and the available actions for it. + */ +class wxCDMCodeFileDescriptionPanel : public wxScrolledWindow +{ + DECLARE_EVENT_TABLE() +public: + /** + * CMakeLists File description panel Constructor. + * @param parent Parent window reference. + * @param codefile CodeFile class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMCodeFileDescriptionPanel( + wxWindow* parent, + modelCDMCodeFile* codefile, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMCodeFileDescriptionPanel(); + + /** + * CMakeLists File description panel Constructor. + * @param parent Parent window reference. + * @param codefile CodeFile class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if the creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMCodeFile* codefile, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * CMakeLists file described. + */ + modelCDMCodeFile* codeFile; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the open file in text editor button is pressed. + */ + void OnBtnOpenInEditor(wxCommandEvent& event); + /** + * Handles when the open file with command button is pressed. + */ + void OnBtnOpenWithCommand(wxCommandEvent& event); + /** + * Handles when the open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); +}; + +#endif /* WXCDMCODEFILEDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 6b8536a..6ef4155 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -51,6 +51,7 @@ #include "wxCDMLibraryDescriptionPanel.h" #include "wxCDMPackageDescriptionPanel.h" #include "wxCDMBlackBoxDescriptionPanel.h" +#include "wxCDMCodeFileDescriptionPanel.h" #include "wxCDMCMakeListsDescriptionPanel.h" #include "wxCDMFolderDescriptionPanel.h" #include "wxCDMFileDescriptionPanel.h" @@ -1004,14 +1005,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //folder - modelCDMFolder* elementFolder = dynamic_cast(element); - if(elementFolder != NULL) + //CodeFile + modelCDMCodeFile* elementCodeFile = dynamic_cast(element); + if(elementCodeFile != NULL) { //create element description - description = new wxCDMFolderDescriptionPanel( + description = new wxCDMCodeFileDescriptionPanel( this, - elementFolder, + elementCodeFile, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -1021,14 +1022,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //file - modelCDMFile* elementFile = dynamic_cast(element); - if(elementFile != NULL) + //folder + modelCDMFolder* elementFolder = dynamic_cast(element); + if(elementFolder != NULL) { //create element description - description = new wxCDMFileDescriptionPanel( + description = new wxCDMFolderDescriptionPanel( this, - elementFile, + elementFolder, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -1038,17 +1039,35 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - - //main if not any - //create element description - description = new wxCDMMainDescriptionPanel( - this, - ID_WINDOW_PROPERTIES, - wxT("Description Panel"), - wxDefaultPosition, - wxSize(600, 400), - 0 - ); + //file + modelCDMFile* elementFile = dynamic_cast(element); + if(elementFile != NULL) + { + //create element description + description = new wxCDMFileDescriptionPanel( + this, + elementFile, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + + //main if not any + //create element description + description = new wxCDMMainDescriptionPanel( + this, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } } } } diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx index 2d21718..653397d 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx @@ -45,6 +45,7 @@ #include "images/ApIcon20.xpm" #include "images/BBIcon20.xpm" #include "images/CIcon20.xpm" +#include "images/CFIcon20.xpm" #include "images/CMIcon20.xpm" #include "images/FdIcon20.xpm" #include "images/FlIcon20.xpm" @@ -92,6 +93,7 @@ bool wxCDMProjectsTreeCtrl::Create( this->ID_CMIcon = images->Add(wxIcon(CMIcon20)); this->ID_FdIcon = images->Add(wxIcon(FdIcon20)); this->ID_FlIcon = images->Add(wxIcon(FlIcon20)); + this->ID_CFIcon = images->Add(wxIcon(CFIcon20)); this->ID_LbIcon = images->Add(wxIcon(LbIcon20)); this->ID_LIcon = images->Add(wxIcon(LIcon20)); this->ID_PrIcon = images->Add(wxIcon(PrIcon20)); @@ -210,21 +212,29 @@ int wxCDMProjectsTreeCtrl::GetIconId(modelCDMIProjectTreeNode* node) } else { - element = dynamic_cast(node); + element = dynamic_cast(node); if(element != NULL) { - return this->ID_FdIcon; + return this->ID_CFIcon; } else { - element = dynamic_cast(node); + element = dynamic_cast(node); if(element != NULL) { - return this->ID_FlIcon; + return this->ID_FdIcon; } else { - return this->ID_Cicon; + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_FlIcon; + } + else + { + return this->ID_Cicon; + } } } } diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h index 08b52b6..8d63e58 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h @@ -117,6 +117,10 @@ private: * C Icon ID. */ int ID_Cicon; + /** + * CF Icon ID. + */ + int ID_CFIcon; /** * CM Icon ID. */ -- 2.47.1