~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/api/iwizard.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (1.2.1) (7.1.6 experimental)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20130721115853-0aii5ee76hxm8z1f
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  
 
3
 *  $Id: iwizard.h $
 
4
 *  Ginkgo CADx Project
 
5
 *
 
6
 *  Copyright 2008-12 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
#include <wx/string.h>
 
14
#include "iwizard.h"
 
15
 
 
16
        IWizard::~IWizard()
 
17
        {
 
18
        }
 
19
 
 
20
        IPasoWizard::IPasoWizard(IWizard * pWizard) :
 
21
                m_pListaFicheros(NULL),
 
22
                m_pWizard(pWizard)
 
23
        {
 
24
        }
 
25
 
 
26
        IPasoWizard::~IPasoWizard()
 
27
        {
 
28
        }
 
29
 
 
30
        bool IPasoWizard::Attach()
 
31
        {
 
32
                return true;
 
33
        }
 
34
 
 
35
        bool IPasoWizard::Detach()
 
36
        {
 
37
                return true;
 
38
        }
 
39
 
 
40
        std::string IPasoWizard::GetSubTitle()
 
41
        {
 
42
                return "";
 
43
        }
 
44
 
 
45
        bool IPasoWizard::AllowCancel() 
 
46
        {
 
47
                return true;
 
48
        }
 
49
 
 
50
        void IPasoWizard::OnCancelled() {}
 
51
 
 
52
        void IPasoWizard::AsignarListaFicheros(ListaFicheros &lista)
 
53
        {
 
54
                m_pListaFicheros=&lista;
 
55
        }
 
56
 
 
57
        void IPasoWizard::SiguientePaso(){
 
58
                m_pWizard->SiguientePaso();
 
59
        }
 
60
 
 
61
        void IPasoWizard::EnableSiguiente(bool enable){
 
62
                m_pWizard->EnableSiguiente(enable);
 
63
        }
 
64
 
 
65
        void IPasoWizard::EnableAnterior(bool enable){
 
66
                m_pWizard->EnableAnterior(enable);
 
67
        }
 
68
 
 
69
        void IPasoWizard::EnableCancelar(bool enable){
 
70
                m_pWizard->EnableCancelar(enable);
 
71
        }
 
72
        //helpers
 
73
        bool IPasoWizard::ValidarDouble(std::string strNumero, double min, double max, bool obligatorio, bool estricto){
 
74
                if(strNumero != ""){
 
75
                        wxString wxStr = wxString::FromUTF8(strNumero.c_str());
 
76
                        double valor;
 
77
                        if(!wxStr.ToDouble(&valor)) {
 
78
                                return false;
 
79
                        } else {
 
80
                                if (estricto) {
 
81
                                        if(valor <= min || valor >= max){
 
82
                                                return false;
 
83
                                        }
 
84
                                }
 
85
                                else {
 
86
                                        if(valor < min || valor > max){
 
87
                                                return false;
 
88
                                        }
 
89
                                }
 
90
                        }
 
91
                        return true;
 
92
                } else {
 
93
                        if(obligatorio){
 
94
                                return false;
 
95
                        } else {
 
96
                                return true;
 
97
                        }
 
98
                }
 
99
        }
 
100
 
 
101
        bool IPasoWizard::ValidarLong(std::string strNumero, long min, long max, bool obligatorio, bool estricto){
 
102
                if(strNumero != ""){
 
103
                        wxString wxStr = wxString::FromUTF8(strNumero.c_str());
 
104
                        long valor;
 
105
                        if(!wxStr.ToLong(&valor)) {
 
106
                                return false;
 
107
                        } else {
 
108
                                if (estricto) {
 
109
                                        if(valor<=min || valor >=max){
 
110
                                                return false;
 
111
                                        }
 
112
                                }
 
113
                                else {
 
114
                                        if(valor < min || valor > max){
 
115
                                                return false;
 
116
                                        }
 
117
                                }
 
118
                        }
 
119
                        return true;
 
120
                } else {
 
121
                        if(obligatorio){
 
122
                                return false;
 
123
                        } else {
 
124
                                return true;
 
125
                        }
 
126
                }
 
127
        }