]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMProjectMapDialog.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMProjectMapDialog.cpp
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Sant�)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and 
11 #  abiding by the rules of distribution of free software. You can  use, 
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
13 #  license as circulated by CEA, CNRS and INRIA at the following URL 
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability. 
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ 
26  */
27
28
29 /*
30  * wxCDMProjectMapDialog.cpp
31  *
32  *  Created on: 25/4/2013
33  *      Author: Daniel Felipe Gonzalez Obando
34  */
35
36 #include "wxCDMProjectMapDialog.h"
37
38 #include "creaDevManagerIds.h"
39 #include "../../src/creaSystem.h"
40 #include "CDMUtilities.h"
41
42 BEGIN_EVENT_TABLE(wxCDMProjectMapDialog, wxDialog)
43 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectMapDialog::OnFinish)
44 EVT_PAINT(wxCDMProjectMapDialog::PaintEvent)
45 END_EVENT_TABLE()
46
47 wxCDMProjectMapDialog::wxCDMProjectMapDialog(
48     wxWindow* parent,
49     wxWindowID id,
50     const wxString& caption,
51     const wxPoint& position,
52     const wxSize& size,
53     long style
54 )
55 {
56   wxCDMProjectMapDialog::Create(parent, id, caption, position, size, style);
57 }
58
59 wxCDMProjectMapDialog::~wxCDMProjectMapDialog()
60 {
61 }
62
63 bool wxCDMProjectMapDialog::Create(
64     wxWindow* parent,
65     wxWindowID id,
66     const wxString& caption,
67     const wxPoint& position,
68     const wxSize& size,
69     long int style
70 )
71 {
72   wxDialog::Create(parent, id, caption, position, size, style);
73   this->SetMaxSize(wxSize(650,-1));
74
75   this->CreateControls();
76
77   return TRUE;
78 }
79
80 void wxCDMProjectMapDialog::CreateControls()
81 {
82
83   wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
84
85
86   wxStaticText* instruction = new wxStaticText(
87       this,
88       wxID_ANY,
89       crea::std2wx(
90           "This is the map of the possible routes for project development in CreaTools.\n"
91           "It's a simple image guide. For more information please read the user manual.\n"
92           " - Each bubble represents a step in the project development.\n"
93           " - The arrows are the possible routes of the development.\n"
94           " - The icons represent the different software used in each step."
95           ),
96           wxDefaultPosition,
97           wxDefaultSize,
98           wxALIGN_LEFT
99   );
100   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
101
102   wxScrolledWindow* imageWindow = new wxScrolledWindow(this);
103   imageWindow->FitInside();
104   imageWindow->SetScrollRate(5,5);
105   imagePanel = new wxPanel(imageWindow);
106   imagePanel->SetMinSize(wxSize(600,1641));
107   imageWindow->SetSizer(new wxBoxSizer(wxVERTICAL));
108   imageWindow->GetSizer()->Add(imagePanel,1,wxEXPAND);
109
110   wxImage::AddHandler(new wxPNGHandler);
111   image = new wxImage();
112
113   std::string pathToImage = crea::System::GetExecutablePath() + CDMUtilities::SLASH + ".." + CDMUtilities::SLASH + "share" + CDMUtilities::SLASH + "creaDevManager" + CDMUtilities::SLASH +  "data" + CDMUtilities::SLASH + "projectMap.png";
114   image->LoadFile(crea::std2wx(pathToImage), wxBITMAP_TYPE_PNG);
115
116
117   wxPaintDC* canvas = new wxPaintDC(imageWindow);
118
119
120
121   v_sizer1->Add(imageWindow, 1, wxEXPAND);
122
123   v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
124
125   SetSizer(v_sizer1);
126 }
127
128 void
129 wxCDMProjectMapDialog::PaintEvent(wxPaintEvent& evt)
130 {
131   wxPaintDC* canvas = new wxPaintDC(imagePanel);
132   canvas->DrawBitmap(wxBitmap(image->Scale(600,1641,wxIMAGE_QUALITY_HIGH)),0,0, false);
133 }
134
135 void wxCDMProjectMapDialog::OnFinish(wxCommandEvent& event)
136 {
137   this->EndDialog(wxID_CANCEL);
138 }
139
140