~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/main/gui/callibration/wxwizardcalibradoginkgo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Tille
  • Date: 2011-05-02 08:09:26 UTC
  • Revision ID: james.westby@ubuntu.com-20110502080926-bql5wep49c7hg91t
Tags: upstream-2.4.1.1
ImportĀ upstreamĀ versionĀ 2.4.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  
 
3
 *  $Id: wxwizardcalibradoginkgo.cpp 3526 2011-03-16 19:56:19Z carlos $
 
4
 *  Ginkgo CADx Project
 
5
 *
 
6
 *  Copyright 2008-10 MetaEmotion S.L. All rights reserved.
 
7
 *  http://ginkgo-cadx.com
 
8
 *
 
9
 *  This file is licensed under LGPL v3 license.
 
10
 *  See License.txt for details
 
11
 *
 
12
 *
 
13
 */
 
14
#include <api/ientorno.h>
 
15
 
 
16
#include <wx/filename.h>
 
17
#include <wx/file.h>
 
18
#include <wx/dir.h>
 
19
#include <wx/busyinfo.h>
 
20
#include <wx/ginkgostyle/ginkgostyle.h>
 
21
 
 
22
#include "wxwizardcalibradoginkgo.h"
 
23
#include "procesarcalibrado.h"
 
24
#include "refinarcalibrado.h"
 
25
#include "datospersistentescalibrado.h"
 
26
 
 
27
#include <vector>
 
28
#include <sstream>
 
29
 
 
30
#include <main/entorno.h>
 
31
#include <main/controllers/controladorextensiones.h>
 
32
#include <main/controllers/controladorcomandos.h>
 
33
#include <main/controllers/controladorimportacionpacs.h>
 
34
#include <resources/ginkgoresourcemanager.h>
 
35
 
 
36
 
 
37
 
 
38
namespace GNC {
 
39
        namespace GUI {
 
40
                        wxWidzardCalibradoGinkgo::wxWidzardCalibradoGinkgo(wxWindow* pParent, GNC::GCS::IVista* pVista,vtkImageData* pImagen, int slice) : wxWizardGinkgoBase(pParent)
 
41
                        {
 
42
                                SetTitle(wxT("Asistente de calibrado automatico"));
 
43
                                m_datosPersistentes.m_pVista = pVista;
 
44
                                m_datosPersistentes.m_slice = slice;
 
45
 
 
46
                                m_datosPersistentes.m_pImageData = pImagen;
 
47
 
 
48
                                m_OK = false;
 
49
                                if(pVista == NULL){
 
50
                                        return;
 
51
                                }
 
52
                                m_pVista = pVista;
 
53
 
 
54
                                //se pillan los pasos
 
55
                                IPasoWizard* pPaso=NULL;
 
56
 
 
57
                                pPaso = new ProcesarCalibrado(m_pPanelPrincipal,this,&m_datosPersistentes);
 
58
                                m_ListaPasos.push_back(pPaso);
 
59
 
 
60
                                pPaso = new RefinarCalibrado(m_pPanelPrincipal,this,&m_datosPersistentes);
 
61
 
 
62
                                m_ListaPasos.push_back(pPaso);
 
63
 
 
64
                                //
 
65
                                m_currentPaso=m_ListaPasos.begin();
 
66
                                m_currentPasoIndex=1;
 
67
                                CargarCurrent();
 
68
                        }
 
69
 
 
70
                        wxWidzardCalibradoGinkgo::~wxWidzardCalibradoGinkgo()
 
71
                        {
 
72
                                m_ListaPasos.clear();
 
73
                        }
 
74
 
 
75
                        bool wxWidzardCalibradoGinkgo::IsOK()
 
76
                        {
 
77
                                return m_OK;
 
78
                        }
 
79
 
 
80
                        float wxWidzardCalibradoGinkgo::GetHorizontalSpacing()
 
81
                        {
 
82
                                return m_datosPersistentes.m_spacingHorizontal;
 
83
                        }
 
84
 
 
85
                        float wxWidzardCalibradoGinkgo::GetVerticalSpacing()
 
86
                        {
 
87
                                return m_datosPersistentes.m_spacingVertical;
 
88
                        }
 
89
                        
 
90
 
 
91
                        void wxWidzardCalibradoGinkgo::OnCancelarClick(wxCommandEvent& )
 
92
                        {
 
93
                                Close();
 
94
                        }
 
95
 
 
96
                        void wxWidzardCalibradoGinkgo::OnSiguienteClick(wxCommandEvent& )
 
97
                        {
 
98
                                if((*m_currentPaso)->Validar()){
 
99
                                        (*m_currentPaso)->Detach(m_pSizerPrincipal);
 
100
                                        ++m_currentPasoIndex;
 
101
                                        ++m_currentPaso;
 
102
                                        if(m_currentPaso==m_ListaPasos.end()){
 
103
                                                Hide();
 
104
                                                m_OK = true;
 
105
                                                Close();
 
106
                                        }else{
 
107
                                                CargarCurrent();
 
108
                                        }
 
109
                                }
 
110
                        }
 
111
 
 
112
                        void wxWidzardCalibradoGinkgo::OnAnteriorClick(wxCommandEvent &)
 
113
                        {
 
114
                                if(m_currentPaso!=m_ListaPasos.begin()){
 
115
                                        (*m_currentPaso)->Detach(m_pSizerPrincipal);
 
116
                                        --m_currentPaso;
 
117
                                        --m_currentPasoIndex;
 
118
                                        CargarCurrent();
 
119
                                }
 
120
                        }
 
121
 
 
122
                         void wxWidzardCalibradoGinkgo::CargarCurrent(){
 
123
                                (*m_currentPaso)->Attach(m_pSizerPrincipal);
 
124
                                wxString label=wxT("Paso ") + wxString::Format(wxT("%d"),m_currentPasoIndex) + wxT(" de ") + wxString::Format(wxT("%d"),m_ListaPasos.size()) + wxT(": ");
 
125
                                m_pHeader->SetTitle(label+wxString::FromUTF8((*m_currentPaso)->GetTitle().c_str()));
 
126
                                m_pHeader->SetSubtitle(wxString::FromUTF8((*m_currentPaso)->GetSubTitle().c_str()));
 
127
                                m_pBSiguiente->Enable((*m_currentPaso)->Siguiente());
 
128
                                m_pBAnterior->Enable((*m_currentPaso)->Anterior());
 
129
                                m_pBCerrar->Enable((*m_currentPaso)->Cancelar());
 
130
                                if(*(m_currentPaso)==m_ListaPasos.back()){
 
131
                                        m_pBSiguiente->SetLabel(wxT("&Terminar"));
 
132
                                }else{
 
133
                                        m_pBSiguiente->SetLabel(wxT("&Siguiente >"));
 
134
                                }
 
135
                                Layout();
 
136
                         }
 
137
        };
 
138
 
 
139
};