From 73787c5a26e6b218b9e6c716dafc7d16330441e7 Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Mon, 3 Dec 2012 19:15:21 +0100 Subject: [PATCH] Feature #1711 CreaDevManager application implementation creation of library fully implemented. modelProject refresh method implemented. --- lib/creaDevManagerLib/creaDevManagerIds.h | 3 + lib/creaDevManagerLib/images/FdIcon.xpm | 274 ++++++++++++++++++ lib/creaDevManagerLib/images/FlIcon.xpm | 247 ++++++++++++++++ lib/creaDevManagerLib/modelCDMAppli.cpp | 8 - lib/creaDevManagerLib/modelCDMFile.cpp | 6 + lib/creaDevManagerLib/modelCDMFolder.cpp | 11 + lib/creaDevManagerLib/modelCDMFolder.h | 1 + .../modelCDMIProjectTreeNode.cpp | 5 + .../modelCDMIProjectTreeNode.h | 2 + lib/creaDevManagerLib/modelCDMLib.cpp | 89 ++++-- lib/creaDevManagerLib/modelCDMLib.h | 2 +- lib/creaDevManagerLib/modelCDMMain.cpp | 2 +- lib/creaDevManagerLib/modelCDMPackage.cpp | 8 - lib/creaDevManagerLib/modelCDMProject.cpp | 262 +++++++++++++++-- lib/creaDevManagerLib/modelCDMProject.h | 8 +- .../wxCDMBlackBoxDescriptionPanel.cpp | 2 +- .../wxCDMCMakeListsDescriptionPanel.cpp | 111 +++++++ .../wxCDMCMakeListsDescriptionPanel.h | 79 +++++ .../wxCDMFileDescriptionPanel.cpp | 145 +++++++++ .../wxCDMFileDescriptionPanel.h | 81 ++++++ .../wxCDMFolderDescriptionPanel.cpp | 121 ++++++++ .../wxCDMFolderDescriptionPanel.h | 81 ++++++ lib/creaDevManagerLib/wxCDMMainFrame.cpp | 118 +++++++- lib/creaDevManagerLib/wxCDMMainFrame.h | 5 + .../wxCDMProjectDescriptionPanel.cpp | 42 ++- .../wxCDMProjectDescriptionPanel.h | 3 +- lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h | 1 + 27 files changed, 1635 insertions(+), 82 deletions(-) create mode 100644 lib/creaDevManagerLib/images/FdIcon.xpm create mode 100644 lib/creaDevManagerLib/images/FlIcon.xpm create mode 100644 lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp create mode 100644 lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h create mode 100644 lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp create mode 100644 lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h create mode 100644 lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp create mode 100644 lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h diff --git a/lib/creaDevManagerLib/creaDevManagerIds.h b/lib/creaDevManagerLib/creaDevManagerIds.h index 7e8881e..ad2e0c6 100644 --- a/lib/creaDevManagerLib/creaDevManagerIds.h +++ b/lib/creaDevManagerLib/creaDevManagerIds.h @@ -84,5 +84,8 @@ #define ID_BUTTON_CREATE_FOLDER 10310 #define ID_BUTTON_OPEN_CXX 10311 #define ID_BUTTON_OPEN_HXX 10312 +#define ID_BUTTON_OPEN_FOLDER 10313 +#define ID_BUTTON_OPEN_FILE 10314 +#define ID_BUTTON_OPEN_COMMAND 10315 #endif /* CREADEVMANAGERIDS_H_ */ diff --git a/lib/creaDevManagerLib/images/FdIcon.xpm b/lib/creaDevManagerLib/images/FdIcon.xpm new file mode 100644 index 0000000..c00d8c1 --- /dev/null +++ b/lib/creaDevManagerLib/images/FdIcon.xpm @@ -0,0 +1,274 @@ +/* XPM */ +const static char * FdIcon[] = { +"64 64 207 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 #BFC1C3", +"|. c #F0F1F1", +"1. c #292F38", +"2. c #ECEDED", +"3. c #F4F4F4", +"4. c #B8BABD", +"5. c #FEFEFE", +"6. c #EAEBEB", +"7. c #ECEDEE", +"8. c #3A4048", +"9. c #93969A", +"0. c #CDCED0", +"a. c #EBECEC", +"b. c #EDEDEE", +"c. c #9C9FA3", +"d. c #EDEEEE", +"e. c #FBFBFB", +"f. c #EFF0F0", +"g. c #B4B7B9", +"h. c #C3C5C7", +"i. c #232932", +"j. c #9A9DA1", +"k. c #D1D3D5", +"l. c #B3B6B9", +"m. c #B2B4B7", +"n. c #C8C9CC", +"o. c #393F47", +"p. c #BCBEC1", +"q. c #41474E", +"r. c #8D9095", +"s. c #C9CBCD", +"t. c #62666D", +"u. c #E8E9EA", +"v. c #2F353E", +"w. c #20272F", +"x. c #363C44", +"y. c #1F252E", +"z. c #282E37", +"A. c #DCDDDE", +"B. c #73777C", +"C. c #AAACB0", +"D. c #E1E2E3", +"E. c #262D36", +"F. c #60656B", +"G. c #D8D9DA", +"H. c #1E252D", +"I. c #373D45", +"J. c #CBCDCF", +"K. c #C7C8CB", +"L. c #E0E1E2", +"M. c #3C4249", +"N. c #E7E8E9", +"O. c #3B4148", +"P. c #5C6168", +"Q. c #A9ABAF", +"R. c #DADBDD", +"S. c #656A70", +"T. c #121923", +"U. c #51575E", +"V. c #F2F2F2", +"W. c #B6B8BB", +"X. c #B5B7BA", +"Y. c #D8DADB", +"Z. c #9B9EA2", +"`. c #121A23", +" + c #CED0D1", +".+ c #AEB0B3", +"++ c #75797F", +"@+ c #40454E", +"#+ c #2C333B", +"$+ c #30363F", +"%+ c #131A23", +"&+ c #5C6167", +"*+ c #F8F8F9", +"=+ c #F7F7F7", +"-+ c #444951", +";+ c #929699", +">+ c #F3F3F3", +",+ c #6E7378", +"'+ c #161E27", +")+ c #5D6268", +"!+ c #ABADB1", +"~+ c #D6D6D8", +"{+ c #EBECED", +"]+ c #CDCFD0", +"^+ c #9DA0A4", +"/+ c #454B52", +"(+ 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 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./ 3 / > $ . ", +" . $ > / 3 O [.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 }.. . . . . . . . . . . . . . . . 3 3 3 3 . . i / 3 / > $ . ", +" . $ > / 3 2.:.. . 3 3 3 3 3.3.3.3.3.3.3.3.3.3.3.4.. . . . . . . . . . . . . . . . 3 3 3 3 . . -./ 3 / > $ . ", +" . $ > / 5.6.i + . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . %./ 3 / > $ . ", +" . $ > / 5.6.1.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . - / 3 / > $ . ", +" . $ > / 5.6.1.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . - / 3 / > $ . ", +" . $ > / 5.7.i + . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . 8.9.0.a.L b._ c.3 3 3 3 . . - / 3 / > $ . ", +" . $ > / 3 d.i . . 3 3 3 3 . . . . . . . . . . . . . . . . . . %.c.e.3 3 3 3 3 3 3 3 3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 f.[.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . . %.h.3 3 3 3 3 3 3 3 3 3 3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 |.i.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . . j.3 3 3 3 3 k.l.m.n.3.3 3 3 3 . . - |.3 / > $ . ", +" . $ > / 3 / ..+ . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . o.L 3 3 3 p.q.. . . . /.3 3 3 3 . . i.|.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . r.3 3 3 0./.. . . . . . 3 3 3 3 . . ..f.3 / > $ . ", +" . $ > / 3 / r + . 3 3 3 3 . . . . . . . . . . . . . . . . s.3 3 3 t.. . . . . . . 3 3 3 3 . . +.f.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 . . . . . . . . . . . . . . . . u.3 3 3 v.. . . . . . . 3 3 3 3 . . i.f.3 / > $ . ", +" . $ > / 3 / t . . 3 3 3 3 . . . . . . . . . . . . . . . . M 3 3 3 ' . . . . . . . 3 3 3 3 . . w.|.3 / > $ . ", +" . $ > / 3 / ... . 3 3 3 3 . . . . . . . . . . . . . . . . |.3 3 3 x.. . . . . . . 3 3 3 3 . . y.|.3 / > $ . ", +" . $ > / 3 / z.. . 3 3 3 3 . . . . . . . . . . . . . . . . A.3 3 3 B.. . . . . . . 3 3 3 3 . . . / 3 / > $ . ", +" . $ > / 3 / B + . 3 3 3 3 . . . . . . . . . . . . . . . . C.3 3 3 D.#.. . . . . . 3 3 3 3 . . . / 3 / > $ . ", +" . $ > / 3 / E.+ . 3 3 3 3 . . . . . . . . . . . . . . . . F.3 3 3 3 G.F.H.. . . I.3 3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . J.3 3 3 3 3 ( s.K.L.3 3 3 3 3 . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 . . . . . . . . . . . . . . . . . M.N.3 3 3 3 3 3 3 3 3 3 3 3 3 . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 . . . . . . . . . . . . . . . . . . O.s.3 3 3 3 3 3 3 3 M 3 3 3 . . :./ 3 / > $ . ", +" . $ > / 3 / [.. . 3 3 3 3 . . . . . . . . . . . . . . . . . . . H.P.Q.J.G 3.R.g.S.I.3 3 3 . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . z./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + T.U.).3 V.> $ . ", +" . $ B 2.3 3 W.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| X.3 3 z , % . ", +" . & t Y.3 3 3 Z.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + `.-.Z.3 3 3 +w.} . ", +" . + 5 .+3 3 3 3 s ++@+-.^.. /.%.-.:.:.:.:.:.:.+.-.1.#+C C [.$.q :.:.i z.#.> i l /.. ^.$+++s 3 3 3 3 c.%+. . ", +" . . %+&+3 3 3 3 3 3 *+/ / / / / / / / / / / / / |.P P P P |./ / / / / / / / / / / / / *+3 3 3 3 3 =+-+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 >+,+= . . ", +" . @ '+)+!+~+{+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / N.]+^+/+= + . ", +" . . + `.5 &.1.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > z.- `.) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # (++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/FlIcon.xpm b/lib/creaDevManagerLib/images/FlIcon.xpm new file mode 100644 index 0000000..c0fea95 --- /dev/null +++ b/lib/creaDevManagerLib/images/FlIcon.xpm @@ -0,0 +1,247 @@ +/* XPM */ +const static char * FlIcon[] = { +"64 64 180 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 #868A8E", +"}. c #252B34", +"|. c #F0F1F1", +"1. c #292F38", +"2. c #ECEDED", +"3. c #3C4249", +"4. c #FEFEFE", +"5. c #EAEBEB", +"6. c #ECEDEE", +"7. c #EDEEEE", +"8. c #EFF0F0", +"9. c #232932", +"0. c #6D7278", +"a. c #20272F", +"b. c #1F252E", +"c. c #282E37", +"d. c #262D36", +"e. c #2C333B", +"f. c #9C9FA3", +"g. c #2C323A", +"h. c #464C53", +"i. c #393F47", +"j. c #DEDFE0", +"k. c #74797E", +"l. c #A6A9AC", +"m. c #30363F", +"n. c #2F353E", +"o. c #DFE0E1", +"p. c #FBFBFB", +"q. c #E6E6E7", +"r. c #C3C5C7", +"s. c #83878C", +"t. c #121923", +"u. c #51575E", +"v. c #F2F2F2", +"w. c #B6B8BB", +"x. c #B5B7BA", +"y. c #D8DADB", +"z. c #9B9EA2", +"A. c #121A23", +"B. c #CED0D1", +"C. c #AEB0B3", +"D. c #75797F", +"E. c #40454E", +"F. c #131A23", +"G. c #5C6167", +"H. c #F8F8F9", +"I. c #F7F7F7", +"J. c #444951", +"K. c #929699", +"L. c #F3F3F3", +"M. c #6E7378", +"N. c #161E27", +"O. c #5D6268", +"P. c #ABADB1", +"Q. c #D6D6D8", +"R. c #EBECED", +"S. c #E7E8E9", +"T. c #CDCFD0", +"U. c #9DA0A4", +"V. c #454B52", +"W. 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 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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [.. . . . . 3 3 3 3 3 . . . . . . . + 1./ 3 / > $ . ", +" . $ > / 3 O }.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [.. . . . . 3 3 3 3 3 . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 2.:.. . . . 3 3 3 3 3 F F F F F F F F F F F F 3.. . . . . 3 3 3 3 3 . . . . . . . . -./ 3 / > $ . ", +" . $ > / 4.5.i + . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . %./ 3 / > $ . ", +" . $ > / 4.5.1.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . - / 3 / > $ . ", +" . $ > / 4.5.1.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . - / 3 / > $ . ", +" . $ > / 4.6.i + . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . - / 3 / > $ . ", +" . $ > / 3 7.i . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 8.}.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 |.9.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . . . . . . . - |.3 / > $ . ", +" . $ > / 3 / ..+ . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . . . . . . . 9.|.3 / > $ . ", +" . $ > / 3 / i . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . . + . . . . ..8.3 / > $ . ", +" . $ > / 3 / r + . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . + . . . . . +.8.3 / > $ . ", +" . $ > / 3 / i . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . 9.8.3 / > $ . ", +" . $ > / 3 / t . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . a.|.3 / > $ . ", +" . $ > / 3 / ... . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . b.|.3 / > $ . ", +" . $ > / 3 / c.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / B + . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / d.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 e.. . . . . . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 8 3 3 3 3 f.g.%.h.i.. . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . j.3 3 3 3 3 3 ).3 k.. . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . l.3 3 3 3 3 3 3 3 k.. . . :./ 3 / > $ . ", +" . $ > / 3 / }.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . m.5.3 3 3 3 3 3 3 k.. . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . n.: o.p.N q.r.s.g.. . . c./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + t.u.).3 v.> $ . ", +" . $ B 2.3 3 w.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| x.3 3 z , % . ", +" . & t y.3 3 3 z.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + A.-.z.3 3 3 B.a.} . ", +" . + 5 C.3 3 3 3 s D.E.-.^.. /.%.-.:.:.:.:.:.:.+.-.1.e.C C }.$.q :.:.i c.#.> i l /.. ^.m.D.s 3 3 3 3 f.F.. . ", +" . . F.G.3 3 3 3 3 3 H./ / / / / / / / / / / / / |.P P P P |./ / / / / / / / / / / / / H.3 3 3 3 3 I.J.k . . ", +" . + >.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 L.M.= . . ", +" . @ N.O.P.Q.R./ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / S.T.U.V.= + . ", +" . . + A.5 &.1.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > c.- A.) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # W.+ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index 8588123..2bba913 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -78,14 +78,6 @@ modelCDMAppli::modelCDMAppli(const std::string& path, const int& level) modelCDMAppli::~modelCDMAppli() { - for (int i = 0; i < this->applications.size(); i++) - { - if(this->applications[i] != NULL) - { - delete this->applications[i]; - this->applications[i] = NULL; - } - } } bool modelCDMAppli::CreateApplication( diff --git a/lib/creaDevManagerLib/modelCDMFile.cpp b/lib/creaDevManagerLib/modelCDMFile.cpp index 6fcfab6..8e8a40f 100644 --- a/lib/creaDevManagerLib/modelCDMFile.cpp +++ b/lib/creaDevManagerLib/modelCDMFile.cpp @@ -34,6 +34,7 @@ #include "modelCDMFile.h" +#include #include #include @@ -57,6 +58,11 @@ modelCDMFile::modelCDMFile(const std::string& path, const int& level) this->path = path; this->type = wxDIR_FILES; + + std::ifstream in(path.c_str(), std::ifstream::in | std::ifstream::binary); + in.seekg(0, std::ifstream::end); + this->length = in.tellg(); + } modelCDMFile::~modelCDMFile() diff --git a/lib/creaDevManagerLib/modelCDMFolder.cpp b/lib/creaDevManagerLib/modelCDMFolder.cpp index 537e636..bf9a951 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.cpp +++ b/lib/creaDevManagerLib/modelCDMFolder.cpp @@ -50,6 +50,7 @@ modelCDMFolder::modelCDMFolder(const std::string& path, const int& level) this->children.clear(); this->level = level; this->CMakeLists = NULL; + this->length = 0; std::vector words; std::string delimiters; @@ -103,6 +104,8 @@ modelCDMFolder::modelCDMFolder(const std::string& path, const int& level) modelCDMFolder::~modelCDMFolder() { + this->folders.clear(); + this->CMakeLists = NULL; for (int i = 0; i < this->children.size(); i++) { if(this->children[i] != NULL) @@ -111,6 +114,7 @@ modelCDMFolder::~modelCDMFolder() this->children[i] = NULL; } } + this->children.clear(); } bool modelCDMFolder::CreateFolder(const std::string& name, std::string*& result, @@ -131,3 +135,10 @@ const bool modelCDMFolder::Refresh(std::string*& result) //TODO: implement method return true; } + +bool +modelCDMFolder::HasCMakeLists() +{ + //TODO: implement method + return true; +} diff --git a/lib/creaDevManagerLib/modelCDMFolder.h b/lib/creaDevManagerLib/modelCDMFolder.h index fe88055..bcd2166 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.h +++ b/lib/creaDevManagerLib/modelCDMFolder.h @@ -56,6 +56,7 @@ public: bool OpenCMakeListsFile(std::string* & result); virtual const bool Refresh(std::string*& result); + bool HasCMakeLists(); private: std::vector folders; modelCDMCMakeListsFile* CMakeLists; diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp index b444af2..c8770d2 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp @@ -133,6 +133,11 @@ const bool modelCDMIProjectTreeNode::Refresh(std::string*& result) return false; } +const int& modelCDMIProjectTreeNode::GetLength() +{ + return this->length; +} + const bool modelCDMIProjectTreeNode::OpenInFileExplorer(std::string*& result) const { //TODO: implement method diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h index c07986d..6d5c680 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h @@ -53,6 +53,7 @@ public: const unsigned char& GetType() const; const int& GetLevel() const; const std::vector& GetChildren() const; + const int& GetLength(); void SetId(const wxTreeItemId& id); void SortChildren(); void SetChildren(const std::vector& children); @@ -66,6 +67,7 @@ protected: std::string name; unsigned char type; int level; + int length; std::vector children; }; diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index 50b32f5..2201891 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -34,6 +34,8 @@ #include "modelCDMLib.h" +#include + #include "CDMUtilities.h" #include "creaWx.h" #include "wx/dir.h" @@ -56,46 +58,75 @@ modelCDMLib::modelCDMLib(const std::string& path, const int& level) std::string pathFixed(CDMUtilities::fixPath(path)); this->libraries.clear(); - wxDir dir(crea::std2wx((pathFixed).c_str())); - if (dir.IsOpened()) - { - wxString fileName; - bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); - while (cont) - { - std::string stdfileName = crea::wx2std(fileName); - - modelCDMLibrary* library = new modelCDMLibrary(pathFixed + "/" + stdfileName, this->level + 1); - this->libraries.push_back(library); - this->children.push_back(library); - - cont = dir.GetNext(&fileName); - } - - } - this->SortChildren(); -} - -modelCDMLib::~modelCDMLib() -{ - for (int i = 0; i < this->libraries.size(); i++) + wxDir dir(crea::std2wx((pathFixed).c_str())); + if (dir.IsOpened()) { - if(this->libraries[i] != NULL) + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) { - delete this->libraries[i]; - this->libraries[i] = NULL; + std::string stdfileName = crea::wx2std(fileName); + + modelCDMLibrary* library = new modelCDMLibrary(pathFixed + "/" + stdfileName, this->level + 1); + this->libraries.push_back(library); + this->children.push_back(library); + + cont = dir.GetNext(&fileName); } + } + this->SortChildren(); +} + +modelCDMLib::~modelCDMLib() +{ } -bool modelCDMLib::CreateLibrary( +modelCDMIProjectTreeNode* modelCDMLib::CreateLibrary( const std::string& name, std::string*& result, const std::string& path ) { - //TODO: implement method - return true; + //copy template library folder with new name + std::string copyCommand = "cp -r " + this->path + "/template_lib " + this->path + "/" + name; + if(system(copyCommand.c_str())) + { + result = new std::string("An error occurred while running '" + copyCommand + "'."); + return NULL; + } + //TODO: set name of library in CMakeLists inside copied folder + std::string line; + std::ifstream in((this->path + "/" + name + "/CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return NULL; + } + std::ofstream out((this->path + "/" + name + "/CMakeLists.txt.tmp").c_str()); + while (getline(in, line)) + { + if(line == "SET ( LIBRARY_NAME MyLib )") + line = "SET ( LIBRARY_NAME " + name + " )"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file + std::string renameCommand = "mv " + this->path + "/" + name + "/CMakeLists.txt.tmp " + this->path + "/" + name + "/CMakeLists.txt"; + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return NULL; + } + + //add library to model + modelCDMLibrary* library = new modelCDMLibrary(this->path + "/" + name, this->level + 1); + this->libraries.push_back(library); + this->children.push_back(library); + + result = new std::string(this->path + "/" + name); + return library; } bool modelCDMLib::OpenCMakeListsFile(std::string*& result) diff --git a/lib/creaDevManagerLib/modelCDMLib.h b/lib/creaDevManagerLib/modelCDMLib.h index bf7db0d..3991384 100644 --- a/lib/creaDevManagerLib/modelCDMLib.h +++ b/lib/creaDevManagerLib/modelCDMLib.h @@ -48,7 +48,7 @@ public: modelCDMLib(const std::string& path, const int& level = 1); ~modelCDMLib(); - bool CreateLibrary( + modelCDMIProjectTreeNode* CreateLibrary( const std::string& name, std::string*& result, const std::string& path = "/" diff --git a/lib/creaDevManagerLib/modelCDMMain.cpp b/lib/creaDevManagerLib/modelCDMMain.cpp index 5c49116..bb37b3d 100644 --- a/lib/creaDevManagerLib/modelCDMMain.cpp +++ b/lib/creaDevManagerLib/modelCDMMain.cpp @@ -89,7 +89,7 @@ bool modelCDMMain::CreateProject( if (system (command.c_str())) { - result = new std::string("An error occured while running '" + command + "'."); + result = new std::string("An error occurred while running '" + command + "'."); return false; } diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index b7280b1..b201b50 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -59,14 +59,6 @@ modelCDMPackage::modelCDMPackage(const std::string& path, const int& level) modelCDMPackage::~modelCDMPackage() { - for (int i = 0; i < this->blackBoxes.size(); i++) - { - if(this->blackBoxes[i] != NULL) - { - delete this->blackBoxes[i]; - this->blackBoxes[i] = NULL; - } - } } const std::string& modelCDMPackage::GetNamePackage() const diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index dc9ac63..1c4b898 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include "CDMUtilities.h" @@ -204,14 +205,6 @@ modelCDMProject::modelCDMProject( modelCDMProject::~modelCDMProject() { - for (int i = 0; i < this->children.size(); i++) - { - if(this->children[i] != NULL) - { - delete this->children[i]; - this->children[i] = NULL; - } - } } const std::string& modelCDMProject::GetNameProject() const @@ -246,7 +239,7 @@ bool modelCDMProject::SetBuildPath(const std::string& path, std::string*& result return true; } -bool modelCDMProject::CreatePackage( +modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( const std::string& name, std::string*& result, const std::string& authors, @@ -256,30 +249,34 @@ bool modelCDMProject::CreatePackage( ) { //TODO: implement method - return true; + return NULL; } -bool modelCDMProject::CreateLibrary( +modelCDMIProjectTreeNode* modelCDMProject::CreateLibrary( const std::string& name, std::string*& result, const std::string& path ) { - //TODO: implement method - return true; + if(this->lib != NULL) + { + return this->lib->CreateLibrary(name, result); + } + result = new std::string("there is no lib folder in this project."); + return NULL; } -bool modelCDMProject::CreateApplication( +modelCDMIProjectTreeNode* modelCDMProject::CreateApplication( const std::string& name, std::string*& result, const std::string& path ) { //TODO: implement method - return true; + return NULL; } -bool modelCDMProject::CreateBlackBox( +modelCDMIProjectTreeNode* modelCDMProject::CreateBlackBox( const std::string& name, const std::string& package, const std::string& authors, @@ -289,7 +286,7 @@ bool modelCDMProject::CreateBlackBox( ) { //TODO: implement method - return true; + return NULL; } bool modelCDMProject::OpenCMakeListsFile(std::string*& result) @@ -300,7 +297,236 @@ bool modelCDMProject::OpenCMakeListsFile(std::string*& result) const bool modelCDMProject::Refresh(std::string*& result) { - //TODO: implement method + + //open makelists file + //TODO: set pathMakeLists for windows + std::string pathMakeLists = this->path + "/CMakeLists.txt"; + + std::ifstream confFile; + confFile.open((pathMakeLists).c_str()); + + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //std::cout << "leyendo " << word << std::endl; + //get project name + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "PROJECT") + { + std::getline(confFile,word,')'); + std::vector nameBits; + CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties); + + this->name = this->nameProject = ""; + for (int i = 0; i < nameBits.size(); i++) + { + if(i != 0) + this->name += " "; + this->name += nameBits[i]; + } + this->nameProject = this->name; + + } + + + if(wordBits[wordBits.size()-1] == "SET") + { + //get project version + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "PROJECT_MAJOR_VERSION") + { + version = wordBits[1]; + } + if(wordBits[0] == "PROJECT_MINOR_VERSION") + { + version += "." + wordBits[1]; + } + if(wordBits[0] == "PROJECT_BUILD_VERSION") + { + version += "." + wordBits[1]; + } + + //get project versionDate + if(wordBits[0] == "PROJECT_VERSION_DATE") + { + std::vector versionBits; + CDMUtilities::splitter::split(versionBits, wordBits[1], "\"", CDMUtilities::splitter::no_empties); + versionDate = versionBits[0]; + } + } + } + confFile.close(); + + this->type = wxDIR_DIRS; + this->level = 0; + + std::vector checked(this->children.size(), false); + std::vector checkedPackages(this->packages.size(), false); + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if appli, create appli + if(stdfileName == "appli") + { + if (this->appli == NULL) + { + this->appli = new modelCDMAppli(this->path + "/appli", this->level + 1); + this->children.push_back(this->appli); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->appli) - this->children.begin(); + checked[pos] = true; + if(!this->appli->Refresh(result)) + return false; + } + } + //if lib, create lib + else if(stdfileName == "lib") + { + if (this->lib == NULL) + { + this->lib = new modelCDMLib(this->path + "/lib", this->level + 1); + this->children.push_back(this->lib); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->lib) - this->children.begin(); + checked[pos] = true; + if(!this->lib->Refresh(result)) + return false; + } + + } + //if package , create package + else if(stdfileName.size() > 9 && stdfileName.substr(0,5) == "bbtk_" && stdfileName.substr(stdfileName.size()-4,4) == "_PKG") + { + std::string packageName = stdfileName.substr(5, stdfileName.size()-9); + bool found = false; + for (int i = 0;!found && i < this->packages.size(); i++) + { + if (this->packages[i]->GetName() == packageName) + { + found = true; + int pos = std::find(this->children.begin(), this->children.end(), this->packages[i]) - this->children.begin(); + checked[pos] = true; + checkedPackages[i] = true; + if(!this->packages[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMPackage* package = new modelCDMPackage(this->path + "/" + stdfileName, this->level + 1); + this->packages.push_back(package); + this->children.push_back(package); + } + + } + //if is an unknown folder, create folder + else + { + bool found = false; + for (int i = 0; !found && i < this->children.size(); i++) + { + if (this->children[i]->GetName() == stdfileName) + { + found = true; + checked[i] = true; + if(!this->children[i]->Refresh(result)) + return false; + } + } + + if(!found) + { + modelCDMFolder* folder = new modelCDMFolder(this->path + "/" + stdfileName, this->level + 1); + this->children.push_back(folder); + } + } + + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this->path + "/" + stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0; i children.size(); i++) + { + if (this->children[i]->GetName() == stdfileName) + { + found = true; + checked[i] = true; + if(!this->children[i]->Refresh(result)) + return false; + } + } + + if(!found) + { + modelCDMFile* file = new modelCDMFile(this->path + "/" + stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < checkedPackages.size(); i++) + { + if(!checkedPackages[i]) + { + this->packages.erase(this->packages.begin()+i); + checkedPackages.erase(checkedPackages.begin()+i); + i--; + } + } + for (int i = 0; i < checked.size(); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); return true; } diff --git a/lib/creaDevManagerLib/modelCDMProject.h b/lib/creaDevManagerLib/modelCDMProject.h index 00fff7c..b6f5662 100644 --- a/lib/creaDevManagerLib/modelCDMProject.h +++ b/lib/creaDevManagerLib/modelCDMProject.h @@ -61,7 +61,7 @@ public: bool SetVersion(const std::string& version, std::string*& result); bool SetBuildPath(const std::string& path, std::string*& result); - bool CreatePackage( + modelCDMIProjectTreeNode* CreatePackage( const std::string& name, std::string*& result, const std::string& authors = "info-dev", @@ -69,17 +69,17 @@ public: const std::string& version = "1.0.0", const std::string& description = "no description" ); - bool CreateLibrary( + modelCDMIProjectTreeNode* CreateLibrary( const std::string& name, std::string*& result, const std::string& path = "/lib" ); - bool CreateApplication( + modelCDMIProjectTreeNode* CreateApplication( const std::string& name, std::string*& result, const std::string& path = "/appli" ); - bool CreateBlackBox( + modelCDMIProjectTreeNode* CreateBlackBox( const std::string& name, const std::string& package = "", //if empty converts into "/bbtk_*projectName*_PKG" const std::string& authors = "unknown", diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp index 44d60e8..e893a65 100644 --- a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp @@ -26,7 +26,7 @@ */ /* - * wxCDMLibraryDescriptionPanel.cpp + * wxCDMBlackBoxDescriptionPanel.cpp * * Created on: Nov 27, 2012 * Author: Daniel Felipe Gonzalez Obando diff --git a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp new file mode 100644 index 0000000..54ff27f --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp @@ -0,0 +1,111 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMCMakeListsDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMCMakeListsDescriptionPanel.h" + +#include "creaDevManagerIds.h" +#include "images/CMIcon.xpm" + +BEGIN_EVENT_TABLE(wxCDMCMakeListsDescriptionPanel, wxPanel) +EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMCMakeListsDescriptionPanel::OnBtnOpenInEditor) +END_EVENT_TABLE() + +wxCDMCMakeListsDescriptionPanel::wxCDMCMakeListsDescriptionPanel( + wxWindow* parent, + modelCDMCMakeListsFile* makefile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMCMakeListsDescriptionPanel::Create(parent, makefile, id, caption, pos, size, style); +} + +wxCDMCMakeListsDescriptionPanel::~wxCDMCMakeListsDescriptionPanel() +{ +} + +bool wxCDMCMakeListsDescriptionPanel::Create( + wxWindow* parent, + modelCDMCMakeListsFile* makefile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->cMakeLists = makefile; + CreateControls(); + return TRUE; +} + +void wxCDMCMakeListsDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Welcome + sizer->Add(new wxStaticText(this, -1, _("File")),0, wxALIGN_CENTER, 0); + + //Image + sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(CMIcon)),0, wxALIGN_CENTER, 0); + + //File Name + sizer->Add(new wxStaticText(this, -1, crea::std2wx("CMake Configuration File (CMakeLists.txt)")), 0, wxALIGN_CENTER, 0); + + //Actions + wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); + wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); + sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit in file editor")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + + //Assign sizer + actionsBoxInnerSizer->SetSizeHints(this); + + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +void wxCDMCMakeListsDescriptionPanel::OnBtnOpenInEditor(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnOpenInEditor not implemented" << std::endl; + event.Skip(); + event.StopPropagation(); +} + diff --git a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h new file mode 100644 index 0000000..a48874c --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h @@ -0,0 +1,79 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMCMakeListsDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMCMAKELISTSDESCRIPTIONPANEL_H_ +#define WXCDMCMAKELISTSDESCRIPTIONPANEL_H_ + +#include +#include + +#include "modelCDMCMakeListsFile.h" + +class wxCDMCMakeListsDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + wxCDMCMakeListsDescriptionPanel( + wxWindow* parent, + modelCDMCMakeListsFile* makefile, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + ~wxCDMCMakeListsDescriptionPanel(); + + bool Create( + wxWindow* parent, + modelCDMCMakeListsFile* blackBox, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + void CreateControls(); + +private: + modelCDMCMakeListsFile* cMakeLists; + + //handlers +protected: + void OnBtnOpenInEditor(wxCommandEvent& event); +}; + +#endif /* WXCDMCMAKELISTSDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp new file mode 100644 index 0000000..b7d8df2 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp @@ -0,0 +1,145 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBlackBoxDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMFileDescriptionPanel.h" + +#include + +#include "creaDevManagerIds.h" +#include "images/FlIcon.xpm" + +BEGIN_EVENT_TABLE(wxCDMFileDescriptionPanel, wxPanel) +EVT_MENU(ID_BUTTON_OPEN_FOLDER, wxCDMFileDescriptionPanel::OnBtnOpenContainingFolder) +EVT_MENU(ID_BUTTON_OPEN_COMMAND, wxCDMFileDescriptionPanel::OnBtnOpenWithCommand) +END_EVENT_TABLE() + +wxCDMFileDescriptionPanel::wxCDMFileDescriptionPanel( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMFileDescriptionPanel::Create(parent, file, id, caption, pos, size, style); +} + +wxCDMFileDescriptionPanel::~wxCDMFileDescriptionPanel() +{ +} + +bool wxCDMFileDescriptionPanel::Create( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->file = file; + CreateControls(); + return TRUE; +} + +void wxCDMFileDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Welcome + sizer->Add(new wxStaticText(this, -1, _("File")),0, wxALIGN_CENTER, 0); + + //Image + sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(FlIcon)),0, wxALIGN_CENTER, 0); + + //BlackBox Name + sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->file->GetName())),0, wxALIGN_CENTER, 0); + + //BlackBox Properties + wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Properties")); + wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxVERTICAL); + + wxFlexGridSizer* flexGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + + wxStaticText *pLocation = new wxStaticText(this, -1, wxT("Location")); + wxStaticText *pLength = new wxStaticText(this, -1, wxT("File Length")); + + wxTextCtrl *pLocationtc = new wxTextCtrl(this, -1, crea::std2wx(this->file->GetPath())); + int lgth = this->file->GetLength(); + std::stringstream ss; + ss << lgth; + std::string lgths = ss.str(); + wxTextCtrl *pLengthtc = new wxTextCtrl(this, -1, crea::std2wx(lgths)); + + flexGridSizer->Add(pLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + flexGridSizer->Add(pLocationtc, 1, wxEXPAND); + flexGridSizer->Add(pLength, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + flexGridSizer->Add(pLengthtc, 1, wxEXPAND); + + propertiesBoxInnerSizer -> Add(flexGridSizer, 0, wxEXPAND); + sizer -> Add(propertiesBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + + + //Actions + wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); + wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); + sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_OPEN_FOLDER, _T("Open in File Explorer")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_OPEN_COMMAND, _T("Open with a command")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + + //Assign sizer + actionsBoxInnerSizer->SetSizeHints(this); + + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +void wxCDMFileDescriptionPanel::OnBtnOpenContainingFolder(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnOpenContainingFolder not implemented" << std::endl; + event.Skip(); +} + +void wxCDMFileDescriptionPanel::OnBtnOpenWithCommand(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnOpenWithCommand not implemented" << std::endl; + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h new file mode 100644 index 0000000..635761d --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h @@ -0,0 +1,81 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMFileDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMFILEDESCRIPTIONPANEL_H_ +#define WXCDMFILEDESCRIPTIONPANEL_H_ + +#include +#include + +#include "modelCDMFile.h" + +class wxCDMFileDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + wxCDMFileDescriptionPanel( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + ~wxCDMFileDescriptionPanel(); + + bool Create( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + void CreateControls(); + +private: + modelCDMFile* file; + + //handlers +protected: + void OnBtnOpenContainingFolder(wxCommandEvent& event); + void OnBtnOpenWithCommand(wxCommandEvent& event); + +}; + +#endif /* WXCDMBLACKBOXDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp new file mode 100644 index 0000000..5532cb6 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp @@ -0,0 +1,121 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMFolderDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMFolderDescriptionPanel.h" + +#include "creaDevManagerIds.h" +#include "images/FdIcon.xpm" + +BEGIN_EVENT_TABLE(wxCDMFolderDescriptionPanel, wxPanel) +EVT_MENU(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer) +EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists) +END_EVENT_TABLE() + +wxCDMFolderDescriptionPanel::wxCDMFolderDescriptionPanel( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMFolderDescriptionPanel::Create(parent, folder, id, caption, pos, size, style); +} + +wxCDMFolderDescriptionPanel::~wxCDMFolderDescriptionPanel() +{ +} + +bool wxCDMFolderDescriptionPanel::Create( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->folder = folder; + CreateControls(); + return TRUE; +} + +void wxCDMFolderDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Welcome + sizer->Add(new wxStaticText(this, -1, _("Folder")),0, wxALIGN_CENTER, 0); + + //Image + sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(FdIcon)),0, wxALIGN_CENTER, 0); + + //Welcome + sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->folder->GetName())),0, wxALIGN_CENTER, 0); + + //Actions + wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); + wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); + sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_OPEN_FOLDER, _T("Open in File Explorer")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + if(this->folder->HasCMakeLists()) + { + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + } + + //Assign sizer + actionsBoxInnerSizer->SetSizeHints(this); + + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +void wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnOpenInExplorer not implemented" << std::endl; + event.Skip(); +} + +void wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl; + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h new file mode 100644 index 0000000..ddda2eb --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h @@ -0,0 +1,81 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMFolderDescriptionPanel.h + * + * Created on: Dic 3, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMFOLDERDESCRIPTIONPANEL_H_ +#define WXCDMFOLDERDESCRIPTIONPANEL_H_ + +#include +#include + +#include "modelCDMFolder.h" + +class wxCDMFolderDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + wxCDMFolderDescriptionPanel( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + ~wxCDMFolderDescriptionPanel(); + + bool Create( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + void CreateControls(); + +private: + modelCDMFolder* folder; + + //handlers +protected: + void OnBtnEditCMakeLists(wxCommandEvent& event); + void OnBtnOpenInExplorer(wxCommandEvent& event); + +}; + +#endif /* WXCDMLIBDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 5538fa7..355b284 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -32,6 +32,7 @@ #include #include "wx/treectrl.h" +#include "wx/treebase.h" #include "CDMUtilities.h" #include "creaDevManagerIds.h" @@ -43,6 +44,9 @@ #include "wxCDMLibraryDescriptionPanel.h" #include "wxCDMPackageDescriptionPanel.h" #include "wxCDMBlackBoxDescriptionPanel.h" +#include "wxCDMCMakeListsDescriptionPanel.h" +#include "wxCDMFolderDescriptionPanel.h" +#include "wxCDMFileDescriptionPanel.h" #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.h" @@ -75,6 +79,7 @@ EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis) EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject) EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject) EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged) +EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete) END_EVENT_TABLE() wxCDMMainFrame::wxCDMMainFrame( @@ -110,6 +115,15 @@ bool wxCDMMainFrame::Create( return TRUE; } +void wxCDMMainFrame::RefreshProject() +{ + std::string* result; + std::cout << "refreshing project" << std::endl; + this->model->RefreshProject(result); + std::cout << "rebuilding project tree" << std::endl; + this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); +} + void wxCDMMainFrame::CreateMenus() { wxMenuBar* menuBar = new wxMenuBar; @@ -384,12 +398,14 @@ void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event) } void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event) { + std::cout << "closing project" << std::endl; std::string* result; if(!this->model->CloseProject(result)) { std::cout << "error closing project: " << *result << std::endl; wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR); } + tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); if(this->panel_Properties != NULL) @@ -726,11 +742,11 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) //delete old view if(this->panel_Properties!= NULL) { + auiManager.DetachPane(this->panel_Properties); this->panel_Properties->Hide(); this->panel_Properties->Destroy(); - auiManager.DetachPane(this->panel_Properties); - } + //set new view this->panel_Properties = description; auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties")); @@ -796,10 +812,95 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) event.Skip(); return; } - //TODO: CMakeLists - //TODO: folder + //CMakeLists + modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast(element); + if(elementCMakeLists != NULL) + { + //create element description + wxCDMCMakeListsDescriptionPanel* description = new wxCDMCMakeListsDescriptionPanel( + this, + elementCMakeLists, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(300, 400), + 0 + ); + //delete old view + if(this->panel_Properties!= NULL) + { + this->panel_Properties->Hide(); + this->panel_Properties->Destroy(); + auiManager.DetachPane(this->panel_Properties); + + } + //set new view + this->panel_Properties = description; + auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties")); + auiManager.Update(); + event.Skip(); + return; + } + //folder + modelCDMFolder* elementFolder = dynamic_cast(element); + if(elementFolder != NULL) + { + //create element description + wxCDMFolderDescriptionPanel* description = new wxCDMFolderDescriptionPanel( + this, + elementFolder, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(300, 400), + 0 + ); + //delete old view + if(this->panel_Properties!= NULL) + { + this->panel_Properties->Hide(); + this->panel_Properties->Destroy(); + auiManager.DetachPane(this->panel_Properties); + + } + //set new view + this->panel_Properties = description; + auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties")); + auiManager.Update(); + event.Skip(); + return; + } //TODO: file - //TODO: main + modelCDMFile* elementFile = dynamic_cast(element); + if(elementFile != NULL) + { + //create element description + wxCDMFileDescriptionPanel* description = new wxCDMFileDescriptionPanel( + this, + elementFile, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(300, 400), + 0 + ); + //delete old view + if(this->panel_Properties!= NULL) + { + this->panel_Properties->Hide(); + this->panel_Properties->Destroy(); + auiManager.DetachPane(this->panel_Properties); + + } + //set new view + this->panel_Properties = description; + auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties")); + auiManager.Update(); + event.Skip(); + return; + } + + //main if not any //create element description wxCDMMainDescriptionPanel* description = new wxCDMMainDescriptionPanel( this, @@ -825,3 +926,10 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) return; } + +void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event) +{ + std::cout << "inMainFrame " << event.GetInt() << std::endl; + this->tree_Projects->SelectItem(event.GetInt()); + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.h b/lib/creaDevManagerLib/wxCDMMainFrame.h index ff957d5..c3e578d 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.h +++ b/lib/creaDevManagerLib/wxCDMMainFrame.h @@ -60,6 +60,8 @@ public: long style = wxDEFAULT_FRAME_STYLE ); + void RefreshProject(); + protected: void CreateMenus(); void CreateControls(); @@ -116,6 +118,9 @@ protected: //Tree void OnTreeSelectionChanged(wxTreeEvent& event); + + //PropertiesPanel + void OnCreationComplete(wxCommandEvent& event); }; #endif diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp index 11d91ef..2d3aa8e 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp @@ -34,15 +34,18 @@ #include "wxCDMProjectDescriptionPanel.h" +#include "wxCDMMainFrame.h" + #include "creaDevManagerIds.h" #include "images/PrIcon.xpm" BEGIN_EVENT_TABLE(wxCDMProjectDescriptionPanel, wxPanel) -EVT_MENU(ID_BUTTON_CREATE_PACKAGE, wxCDMProjectDescriptionPanel::OnBtnCreatePackage) -EVT_MENU(ID_BUTTON_CREATE_BLACKBOX, wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox) -EVT_MENU(ID_BUTTON_CREATE_LIBRARY, wxCDMProjectDescriptionPanel::OnBtnCreateLibrary) -EVT_MENU(ID_BUTTON_CREATE_APPLICATION, wxCDMProjectDescriptionPanel::OnBtnCreateApplication) -EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMProjectDescriptionPanel::OnBtnCreatePackage) +EVT_BUTTON(ID_BUTTON_CREATE_BLACKBOX, wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox) +EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMProjectDescriptionPanel::OnBtnCreateLibrary) +EVT_BUTTON(ID_BUTTON_CREATE_APPLICATION, wxCDMProjectDescriptionPanel::OnBtnCreateApplication) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists) +EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMProjectDescriptionPanel::OnCreationComplete) END_EVENT_TABLE() wxCDMProjectDescriptionPanel::wxCDMProjectDescriptionPanel( @@ -154,8 +157,29 @@ void wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox(wxCommandEvent& event) void wxCDMProjectDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event) { - //TODO: implement method + //implement method std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl; + wxString libraryName = wxGetTextFromUser( + _T("Enter the new library name"), + _T("New Library - creaDevManager"), + _T("") + ); + std::string* result; + modelCDMIProjectTreeNode* library = this->project->CreateLibrary(crea::wx2std(libraryName),result); + if(library == NULL) + { + wxMessageBox(crea::std2wx(*result),_T("New Library - Error!"),wxOK | wxICON_ERROR); + event.Skip(); + return; + } + wxMessageBox(crea::std2wx("Library successfully created."),_T("New Library - Success!"),wxOK | wxICON_INFORMATION); + + //send event instead of calling parent to avoid crashing + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(library->GetId()); + wxPostEvent(this->GetParent(), *newEvent); event.Skip(); } @@ -172,3 +196,9 @@ void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl; event.Skip(); } + +void wxCDMProjectDescriptionPanel::OnCreationComplete(wxCommandEvent& event) +{ + std::cout << "catched" << std::endl; + +} diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h index 85aed83..f96063d 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h @@ -44,6 +44,7 @@ class wxCDMProjectDescriptionPanel : public wxPanel { DECLARE_EVENT_TABLE() public: + wxCDMProjectDescriptionPanel( wxWindow* parent, modelCDMProject* project, @@ -78,7 +79,7 @@ protected: void OnBtnCreateLibrary(wxCommandEvent& event); void OnBtnCreateApplication(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); - + void OnCreationComplete(wxCommandEvent& event); }; #endif /* WXCDMPROJECTDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h index 18649e0..596b0b1 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h @@ -68,6 +68,7 @@ public: ); void BuildTree(std::map< wxTreeItemId, modelCDMIProjectTreeNode* >& modelElements, modelCDMProject* tree = NULL); + private: void BuildTree(const std::vector& tree, std::map< wxTreeItemId, modelCDMIProjectTreeNode* >& modelElements, wxTreeItemId parent); }; -- 2.45.1