/[Sims3RigEditor]/trunk/gr2lib_cpp/gr2lib_rigeditor.h
ViewVC logotype

Contents of /trunk/gr2lib_cpp/gr2lib_rigeditor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 79 - (show annotations) (download)
Sat Aug 14 12:02:56 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 7464 byte(s)
Add missing files
1 #pragma once
2
3 #include "gr2lib_core.h"
4 #include "gr2lib_core_imports.h"
5 using namespace System;
6 using namespace System::ComponentModel;
7 using namespace System::Collections;
8 using namespace System::Windows::Forms;
9 using namespace System::Data;
10 using namespace System::Drawing;
11 using namespace System::Runtime::InteropServices;
12
13 namespace gr2lib
14 {
15 namespace core
16 {
17 namespace rigeditor
18 {
19 /// <summary>
20 /// Summary for gr2lib_rigeditor
21 /// </summary>
22 public ref class gr2lib_rigeditor : public System::Windows::Forms::UserControl
23 {
24 private:
25 grannyfile* _grn_file;
26 public:
27 #pragma region Events
28 delegate void OnExit(Object^ sender, EventArgs^ e);
29 event OnExit^ OnExitEventHandler;
30 #pragma endregion
31 gr2lib_rigeditor(void)
32 {
33 InitializeComponent();
34 //
35 //TODO: Add the constructor code here
36 //
37 }
38 gr2lib_rigeditor(grannyfile* grn_file)
39 {
40 InitializeComponent();
41 // parse art tool info
42 _grn_file = grn_file;
43 propgrid->SelectedObject = ArtToolInfo_ToManaged(_grn_file->GrannyFileInfo->ArtToolInfo);
44 }
45
46 protected:
47 /// <summary>
48 /// Clean up any resources being used.
49 /// </summary>
50 ~gr2lib_rigeditor()
51 {
52 if (components)
53 {
54 delete components;
55 }
56 }
57 private: System::Windows::Forms::MenuStrip^ mainmenu;
58 private: System::Windows::Forms::PropertyGrid^ propgrid;
59 private: System::Windows::Forms::ToolStripMenuItem^ mnuFile;
60 private: System::Windows::Forms::ToolStripMenuItem^ mnuItemExit;
61 protected:
62
63 protected:
64
65 private:
66 /// <summary>
67 /// Required designer variable.
68 /// </summary>
69 System::ComponentModel::Container ^components;
70
71 #pragma region Windows Form Designer generated code
72 /// <summary>
73 /// Required method for Designer support - do not modify
74 /// the contents of this method with the code editor.
75 /// </summary>
76 void InitializeComponent(void)
77 {
78 this->mainmenu = (gcnew System::Windows::Forms::MenuStrip());
79 this->propgrid = (gcnew System::Windows::Forms::PropertyGrid());
80 this->mnuFile = (gcnew System::Windows::Forms::ToolStripMenuItem());
81 this->mnuItemExit = (gcnew System::Windows::Forms::ToolStripMenuItem());
82 this->mainmenu->SuspendLayout();
83 this->SuspendLayout();
84 //
85 // mainmenu
86 //
87 this->mainmenu->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->mnuFile});
88 this->mainmenu->Location = System::Drawing::Point(0, 0);
89 this->mainmenu->Name = L"mainmenu";
90 this->mainmenu->Size = System::Drawing::Size(558, 24);
91 this->mainmenu->TabIndex = 1;
92 this->mainmenu->Text = L"menuStrip1";
93 //
94 // propgrid
95 //
96 this->propgrid->Dock = System::Windows::Forms::DockStyle::Fill;
97 this->propgrid->Location = System::Drawing::Point(0, 24);
98 this->propgrid->Name = L"propgrid";
99 this->propgrid->PropertySort = System::Windows::Forms::PropertySort::Categorized;
100 this->propgrid->Size = System::Drawing::Size(558, 500);
101 this->propgrid->TabIndex = 2;
102 this->propgrid->ToolbarVisible = false;
103 //
104 // mnuFile
105 //
106 this->mnuFile->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->mnuItemExit});
107 this->mnuFile->Name = L"mnuFile";
108 this->mnuFile->Size = System::Drawing::Size(37, 20);
109 this->mnuFile->Text = L"&File";
110 //
111 // mnuItemExit
112 //
113 this->mnuItemExit->Name = L"mnuItemExit";
114 this->mnuItemExit->Size = System::Drawing::Size(152, 22);
115 this->mnuItemExit->Text = L"&Exit";
116 //
117 // gr2lib_rigeditor
118 //
119 this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
120 this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
121 this->Controls->Add(this->propgrid);
122 this->Controls->Add(this->mainmenu);
123 this->Name = L"gr2lib_rigeditor";
124 this->Size = System::Drawing::Size(558, 524);
125 this->mainmenu->ResumeLayout(false);
126 this->mainmenu->PerformLayout();
127 this->ResumeLayout(false);
128 this->PerformLayout();
129
130 }
131 #pragma endregion
132
133 ArtToolInfo^ _ArtToolInfo;
134
135 #pragma region MarshalToMananaged
136
137 #pragma region ArtToolInfo
138 ArtToolInfo^ ArtToolInfo_ToManaged(granny_art_tool_info* toolinfo)
139 {
140 _ArtToolInfo = gcnew ArtToolInfo();
141 // Tool Name
142 _ArtToolInfo->FromArtToolName = gcnew String(reinterpret_cast<const char*>(toolinfo->FromArtToolName));
143
144 // Tool Vector
145 Vector3* Origin = new Vector3(
146 toolinfo->Origin[0],
147 toolinfo->Origin[1],
148 toolinfo->Origin[2]);
149 Vector3* Right = new Vector3(
150 toolinfo->RightVector[0],
151 toolinfo->RightVector[1],
152 toolinfo->RightVector[2]);
153 Vector3* Up = new Vector3(
154 toolinfo->UpVector[0],
155 toolinfo->UpVector[1],
156 toolinfo->UpVector[2]);
157 Vector3* Back = new Vector3(
158 toolinfo->BackVector[0],
159 toolinfo->BackVector[1],
160 toolinfo->BackVector[2]);
161 _ArtToolInfo->Vector = gcnew ArtToolInfoVector(*Origin,*Right,*Up,*Back);
162
163 // Tool Version
164 _ArtToolInfo->ToolVersion = gcnew ArtToolInfoVersion(toolinfo->ArtToolMajorRevision,toolinfo->ArtToolMinorRevision);
165 // Tool Units Per Meter
166 _ArtToolInfo->UnitsPerMeter = toolinfo->UnitsPerMeter;
167 return _ArtToolInfo;
168 }
169 #pragma endregion
170
171 #pragma region MarshalToNative
172
173 #pragma region ArtToolInfo
174 void ArtToolInfo_ToNative()
175 {
176
177 _grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName = (char*)Marshal::StringToHGlobalAnsi(_ArtToolInfo->FromArtToolName).ToPointer();
178 _grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMajorRevision = _ArtToolInfo->ToolVersion->Major;
179 _grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMinorRevision = _ArtToolInfo->ToolVersion->Minor;
180 _grn_file->GrannyFileInfo->ArtToolInfo->UnitsPerMeter = _ArtToolInfo->UnitsPerMeter;
181
182
183 _grn_file->GrannyFileInfo->ArtToolInfo->Origin[0] = _ArtToolInfo->Vector->Origin.x;
184 _grn_file->GrannyFileInfo->ArtToolInfo->Origin[1] = _ArtToolInfo->Vector->Origin.y;
185 _grn_file->GrannyFileInfo->ArtToolInfo->Origin[2] = _ArtToolInfo->Vector->Origin.z;
186
187 _grn_file->GrannyFileInfo->ArtToolInfo->RightVector[0] = _ArtToolInfo->Vector->Right.x;
188 _grn_file->GrannyFileInfo->ArtToolInfo->RightVector[1] = _ArtToolInfo->Vector->Right.y;
189 _grn_file->GrannyFileInfo->ArtToolInfo->RightVector[2] = _ArtToolInfo->Vector->Right.z;
190
191 _grn_file->GrannyFileInfo->ArtToolInfo->UpVector[0] = _ArtToolInfo->Vector->Up.x;
192 _grn_file->GrannyFileInfo->ArtToolInfo->UpVector[1] = _ArtToolInfo->Vector->Up.y;
193 _grn_file->GrannyFileInfo->ArtToolInfo->UpVector[2] = _ArtToolInfo->Vector->Up.z;
194
195 _grn_file->GrannyFileInfo->ArtToolInfo->BackVector[0] = _ArtToolInfo->Vector->Back.x;
196 _grn_file->GrannyFileInfo->ArtToolInfo->BackVector[1] = _ArtToolInfo->Vector->Back.y;
197 _grn_file->GrannyFileInfo->ArtToolInfo->BackVector[2] = _ArtToolInfo->Vector->Back.z;
198
199 }
200 #pragma endregion
201
202 #pragma endregion
203
204 #pragma endregion
205
206
207 };
208 }
209 }
210 }

  ViewVC Help
Powered by ViewVC 1.1.22