-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI_MainConfig.cpp
97 lines (79 loc) · 2.82 KB
/
GUI_MainConfig.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "GUI_Common.h"
#include "Common.h"
#include "GUI_Elements.h"
#include "GUI_MainConstruct.h"
#include "GUIentity.h"
#include "GUIplugin.h"
#include "GUImanager.h"
#include "EventTypes.h"
#include "EventHandler.h"
#include "IMS.h"
#include "IMS_Module.h"
#include "GUI_Module.h"
#include "IMS_InputCallback.h"
#include "GUI_MainConfig.h"
#include "Managers.h"
#include "IMS_RcsManager.h"
#include "IMS_TouchdownPointManager.h"
#include "LayoutManager.h"
#include "GUI_Looks.h"
const static string FILENAME = "mainmenu/config.xml";
const static string RCS_ASSIST_CHKBX = "rcs_assist_chkbx";
const static string SCENED_ASSIST_CHKBX = "scened_assist_chkbx";
const static string STYLESETS_LISTBX = "stylesets_listbx";
const static string STYLESETS_LBL = "stylesets_lbl";
GUI_MainConfig::GUI_MainConfig(RECT mRect, GUI_ElementStyle *_style, IMS2 *_vessel)
: GUI_Page(mRect, MD_CONFIG_MENU, _style), vessel(_vessel)
{
GUImanager *gui = vessel->GetGUI();
//register element in manager BEFORE adding children
gui->RegisterGuiElement(this, GUI_MAIN_DISPLAY);
LAYOUTCOLLECTION *layouts = LayoutManager::GetLayout(FILENAME);
rcs_assist = gui->CreateCheckBox(getLayoutDataForElement(RCS_ASSIST_CHKBX, layouts), "RCS Assist", id, MD_CONFIG_RCSASSISTCHKBX);
rcs_assist->SetChecked(true);
scened_assist = gui->CreateCheckBox(getLayoutDataForElement(SCENED_ASSIST_CHKBX, layouts), "ScenEd placement assist", id, MD_CONFIG_SCENEDCHKBX);
scened_assist->SetChecked(false);
gui->CreateLabel(getLayoutDataForElement(STYLESETS_LBL, layouts), "Select Skin", id, -1);
stylesets = gui->CreateListBox(getLayoutDataForElement(STYLESETS_LISTBX, layouts), id, MD_CONFIG_STYLESETSLISTBX);
//populate the listbox with the available styles
vector<string> availablestylesets = GUI_Looks::GetAvailableStyleSets();
string currentstyleset = gui->GetStyleSet();
for (UINT i = 0; i < availablestylesets.size(); ++i)
{
string addedstyleset = availablestylesets[i];
if (currentstyleset == addedstyleset)
{
stylesets->AddElement(addedstyleset, true);
}
else
{
stylesets->AddElement(addedstyleset);
}
}
}
GUI_MainConfig::~GUI_MainConfig()
{
}
int GUI_MainConfig::ProcessChildren(GUI_MOUSE_EVENT _event, int _x, int _y)
{
//get the clicked element
int eventId = GUI_BaseElement::ProcessChildren(_event, _x, _y);
if (eventId == -1) return -1;
//handle results of click events
switch (eventId)
{
case MD_CONFIG_RCSASSISTCHKBX:
//toggle intelligent RCS assistance
vessel->GetRcsManager()->SetIntelligentRcs(rcs_assist->Checked());
break;
case MD_CONFIG_SCENEDCHKBX:
//toggle scenario editor placement assistance
vessel->GetTdPointManager()->SetScenedAssistance(scened_assist->Checked());
break;
case MD_CONFIG_STYLESETSLISTBX:
//set a new styleset
vessel->GetGUI()->SetStyleset(stylesets->GetSelectedText());
break;
}
return eventId;
}