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

« back to all changes in this revision

Viewing changes to src/cadxcore/main/gui/configuration/panelconfiguracionrenderingoptions.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: panelconfiguracionrenderingoptions.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 <vector>
 
15
#include <sstream>
 
16
 
 
17
#include <wx/msgdlg.h>
 
18
#include <wx/msgout.h>
 
19
#include <wx/filename.h>
 
20
#include <wx/confbase.h>
 
21
#include <wx/file.h>
 
22
#include <wx/dir.h>
 
23
#include <wx/xml/xml.h>
 
24
#include <api/internacionalizacion.h>
 
25
 
 
26
 
 
27
#include "panelconfiguracionrenderingoptions.h"
 
28
 
 
29
namespace GNC {
 
30
        namespace GUI {
 
31
 
 
32
                PanelConfiguracionRenderingOptions::PanelConfiguracionRenderingOptions(wxWindow* pParent,IDialogoConfiguracion* pDialogo): PanelConfiguracionRenderingOptionsBase(pParent), IPasoConfiguracion(pDialogo)
 
33
                {
 
34
                        Recargar();
 
35
                }
 
36
 
 
37
                PanelConfiguracionRenderingOptions::~PanelConfiguracionRenderingOptions()
 
38
                {
 
39
 
 
40
                }
 
41
 
 
42
                void PanelConfiguracionRenderingOptions::Recargar()
 
43
                {
 
44
                        wxConfigBase * config = wxConfigBase::Get();
 
45
                        //se actualiza el fichero de configuracion
 
46
                        config->SetPath(wxT("/GinkgoCore/RenderingOptions"));
 
47
 
 
48
                        bool valor;
 
49
                        config->Read(wxT("VisionEstereoscopica"),&valor,false);
 
50
                        m_pCheckEstereoscopica->SetValue(valor);
 
51
                }
 
52
 
 
53
                //region "Metodos de IPasoConfiguracion"
 
54
                wxWindow* PanelConfiguracionRenderingOptions::GetPanel()
 
55
                {
 
56
                        return this;
 
57
                }
 
58
 
 
59
                std::string PanelConfiguracionRenderingOptions::GetTitle()
 
60
                {
 
61
                        return _Std("Rendering options");
 
62
                }
 
63
 
 
64
                std::string PanelConfiguracionRenderingOptions::GetCabecera()
 
65
                {
 
66
                        return _Std("Setting display options");
 
67
                }
 
68
 
 
69
                bool PanelConfiguracionRenderingOptions::Validar()
 
70
                {
 
71
                        return true;
 
72
                }
 
73
 
 
74
                bool PanelConfiguracionRenderingOptions::Guardar()
 
75
                {
 
76
                        wxConfigBase * config = wxConfigBase::Get();
 
77
                        //se actualiza el fichero de configuracion
 
78
                        config->SetPath(wxT("/GinkgoCore/RenderingOptions"));
 
79
 
 
80
                        config->Write(wxT("VisionEstereoscopica"),m_pCheckEstereoscopica->IsChecked());
 
81
 
 
82
                        return true;
 
83
                }
 
84
 
 
85
                void PanelConfiguracionRenderingOptions::Exportar(wxXmlNode* pNodo)
 
86
                {
 
87
                        wxXmlNode* pRenderingOptions = NULL;
 
88
                        for(pRenderingOptions=pNodo->GetChildren(); pRenderingOptions!=NULL; pRenderingOptions = pRenderingOptions->GetNext()) {
 
89
                                if(pRenderingOptions->GetName() == wxT("RenderingOptions")) {
 
90
                                        break;
 
91
                                }
 
92
                        }
 
93
                        if(pRenderingOptions == NULL) {
 
94
                                pRenderingOptions = new wxXmlNode(pNodo,wxXML_ELEMENT_NODE,wxT("RenderingOptions"));
 
95
                        }
 
96
 
 
97
                        wxXmlNode* nodo  = new wxXmlNode(pRenderingOptions,wxXML_ELEMENT_NODE,wxT("VisionEstereoscopica"));
 
98
                        if(m_pCheckEstereoscopica->IsChecked()) {
 
99
                                new wxXmlNode(nodo,wxXML_TEXT_NODE,wxT(""),wxT("TRUE"));
 
100
                        } else {
 
101
                                new wxXmlNode(nodo,wxXML_TEXT_NODE,wxT(""),wxT("FALSE"));
 
102
                        }
 
103
                }
 
104
 
 
105
                void PanelConfiguracionRenderingOptions::Importar(wxXmlNode* pNodo)
 
106
                {
 
107
                        wxConfigBase * config = wxConfigBase::Get();
 
108
                        //se actualiza el fichero de configuracion
 
109
                        config->SetPath(wxT("/GinkgoCore/RenderingOptions"));
 
110
                        config->DeleteEntry(wxT("VisionEstereoscopica"));
 
111
 
 
112
                        wxXmlNode* pRenderingOptions = NULL;
 
113
                        for(pRenderingOptions=pNodo->GetChildren(); pRenderingOptions!=NULL; pRenderingOptions = pRenderingOptions->GetNext()) {
 
114
                                if(pRenderingOptions->GetName() == wxT("RenderingOptions")) {
 
115
                                        break;
 
116
                                }
 
117
                        }
 
118
                        if(pRenderingOptions != NULL) {
 
119
                                if(pRenderingOptions->GetChildren()!=NULL) {
 
120
                                        if(pRenderingOptions->GetChildren()->GetName() == wxT("VisionEstereoscopica"))
 
121
                                        {
 
122
                                                if(pRenderingOptions->GetChildren()->GetChildren()!=NULL) {
 
123
                                                        config->SetPath(wxT("/GinkgoCore/RenderingOptions"));
 
124
                                                        if(pRenderingOptions->GetChildren()->GetChildren()->GetContent() == wxT("TRUE"))
 
125
                                                        {
 
126
                                                                config->Write(wxT("VisionEstereoscopica"),true);
 
127
                                                        } else {
 
128
                                                                config->Write(wxT("VisionEstereoscopica"),false);
 
129
                                                        }
 
130
                                                }
 
131
                                        }
 
132
                                }
 
133
                        }
 
134
                }
 
135
                //endregion
 
136
 
 
137
                void PanelConfiguracionRenderingOptions::OnSize(wxSizeEvent& event) {
 
138
                        wxSize oldSize = m_staticTextExplicacion->GetSize();
 
139
                        Freeze();
 
140
                        m_staticTextExplicacion->Freeze();
 
141
                        m_staticTextExplicacion->SetLabel(_("This option enables stereoscopic vision (must bear the graphics card and requires the use of 3D glasses)"));
 
142
                        m_staticTextExplicacion->Wrap( event.GetSize().x-25 );
 
143
                        m_staticTextExplicacion->Thaw();
 
144
                        Thaw();
 
145
                        wxSize newSize = m_staticTextExplicacion->GetSize();
 
146
                        if (newSize != oldSize) {
 
147
                                Layout();
 
148
                                event.Skip(false);
 
149
                        } else {
 
150
                                event.Skip(true);
 
151
                        }
 
152
                }
 
153
 
 
154
                void PanelConfiguracionRenderingOptions::OnCheckRendering(wxCommandEvent &)
 
155
                {
 
156
                        OnPropiedadCambiada();
 
157
                }
 
158
 
 
159
        };
 
160
 
 
161
};