DayZ 1.24
Loading...
Searching...
No Matches
ScriptConsoleConfigTab Class Reference
Inheritance diagram for ScriptConsoleConfigTab:
[legend]
Collaboration diagram for ScriptConsoleConfigTab:
[legend]

Protected Member Functions

void ScriptConsoleConfigTab (Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
 
void ~ScriptConsoleConfigTab ()
 
override bool OnChange (Widget w, int x, int y, bool finished)
 
override bool OnItemSelected (Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
 
void RenderClassPath ()
 
override bool OnClick (Widget w, int x, int y, int button)
 
override void Update (float timeslice)
 
void Init ()
 
void DumpParam (string param, string relativePath)
 
void ChangeConfigFilter ()
 
void ClearHierarchy ()
 
void FindInHierarchy (string class_name)
 
void ExpandHierarchy (int row)
 
void CollapseHierarchy (int row)
 
void RenderVariables (int row)
 

Protected Attributes

ref TStringArray m_BaseConfigClasses = new TStringArray
 
ref TStringArray m_BaseConfigClassesToggled = new TStringArray
 
ref map< CheckBoxWidget, intm_ClassCheckboxes = new map<CheckBoxWidget, int>
 
EditBoxWidget m_ObjectConfigFilter
 
EditBoxWidget m_VariableConfigFilter
 
TextListboxWidget m_ConfigHierarchyTextListbox
 
TextListboxWidget m_ConfigVariablesTextListbox
 
ButtonWidget m_SelectedRowCopy
 
ButtonWidget m_DumpParamButton
 
TextWidget m_ClassPath
 
Widget m_WgtClassesConfig
 
PluginConfigViewer m_ModuleConfigViewer
 
int m_Row
 

Static Protected Attributes

static string m_ConfigTextField
 
static string m_VariableTextField
 
static ref ConfigParamsEx m_ConfigData
 

Additional Inherited Members

- Private Member Functions inherited from ScriptConsoleTabBase
void ScriptConsoleTabBase (Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
 
void Init (int id)
 
int GetID ()
 
Widget GetRoot ()
 
bool IsSelected ()
 
void Select (bool select, ScriptConsoleTabBase selectedHandler)
 
void OnSelected ()
 
void Show (bool show, ScriptConsoleTabBase selectedHandler)
 
Widget GetButton ()
 
void Update (float timeslice)
 
bool OnChange (Widget w, int x, int y, bool finished)
 
bool OnClick (Widget w, int x, int y, int button)
 
bool OnItemSelected (Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
 
bool OnKeyDown (Widget w, int x, int y, int key)
 
bool OnDoubleClick (Widget w, int x, int y, int button)
 
void OnRPCEx (int rpc_type, ParamsReadContext ctx)
 
bool OnMouseButtonDown (Widget w, int x, int y, int button)
 
bool OnKeyPress (Widget w, int x, int y, int key)
 
void AddItemToClipboard (TextListboxWidget text_listbox_widget)
 
- Private Attributes inherited from ScriptConsoleTabBase
int m_Id
 
bool m_IsSelected
 
Widget m_ParentRoot
 
Widget m_Root
 
Widget m_Button
 
ScriptConsole m_ScriptConsole
 
ScriptConsoleTabBase m_Parent
 
PluginConfigDebugProfile m_ConfigDebugProfile
 
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed
 

Detailed Description

Definition at line 4 of file ScriptConsoleConfigTab.c.

Constructor & Destructor Documentation

◆ ScriptConsoleConfigTab()

void ScriptConsoleConfigTab::ScriptConsoleConfigTab ( Widget root,
ScriptConsole console,
Widget button,
ScriptConsoleTabBase parent = null )
inlineprotected

Definition at line 27 of file ScriptConsoleConfigTab.c.

28 {
29 m_WgtClassesConfig = root.FindAnyWidget("ClassesPanel");
30 m_DumpParamButton = ButtonWidget.Cast(root.FindAnyWidget("DumpParamButton"));
31 m_ObjectConfigFilter = EditBoxWidget.Cast(root.FindAnyWidget("ObjectConfigFilter"));
32 m_VariableConfigFilter = EditBoxWidget.Cast(root.FindAnyWidget("VariableConfigFilter"));
33 m_ConfigHierarchyTextListbox = TextListboxWidget.Cast(root.FindAnyWidget("ConfigHierarchy"));
34 m_ConfigVariablesTextListbox = TextListboxWidget.Cast(root.FindAnyWidget("ConfigVariables"));
35 m_SelectedRowCopy = ButtonWidget.Cast(root.FindAnyWidget("SelectedRowCopy"));
36 m_ClassPath = TextWidget.Cast(root.FindAnyWidget("ClassPath"));
37
42 Init();
43 }
TextListboxWidget m_ConfigVariablesTextListbox
TextListboxWidget m_ConfigHierarchyTextListbox

References Init(), m_ClassPath, m_ConfigHierarchyTextListbox, m_ConfigTextField, m_ConfigVariablesTextListbox, m_DumpParamButton, m_ObjectConfigFilter, m_SelectedRowCopy, m_VariableConfigFilter, m_VariableTextField, and m_WgtClassesConfig.

◆ ~ScriptConsoleConfigTab()

void ScriptConsoleConfigTab::~ScriptConsoleConfigTab ( )
inlineprotected

Definition at line 45 of file ScriptConsoleConfigTab.c.

46 {
48
49 foreach (int i: m_ClassCheckboxes)
50 {
51 Widget w = m_ClassCheckboxes.GetKeyByValue(i);
52 w.GetParent().Unlink();
53 }
54 }
ref map< CheckBoxWidget, int > m_ClassCheckboxes

References m_ClassCheckboxes, m_VariableConfigFilter, and m_VariableTextField.

Member Function Documentation

◆ ChangeConfigFilter()

void ScriptConsoleConfigTab::ChangeConfigFilter ( )
inlineprotected

Definition at line 288 of file ScriptConsoleConfigTab.c.

289 {
291
292 if (m_ConfigTextField == "")
294 else
296 }
void FindInHierarchy(string class_name)

References ClearHierarchy(), FindInHierarchy(), m_ConfigTextField, and m_ObjectConfigFilter.

Referenced by Init(), and OnChange().

◆ ClearHierarchy()

void ScriptConsoleConfigTab::ClearHierarchy ( )
inlineprotected

Definition at line 298 of file ScriptConsoleConfigTab.c.

299 {
300 m_ConfigHierarchyTextListbox.ClearItems();
301 m_ConfigVariablesTextListbox.ClearItems();
302
303 string config_path = "configfile";
305 for (int i = 0; i < variables.Count(); i++)
306 {
307 string variable = variables.Get(i);
308
309 for (int j = 0; j < m_BaseConfigClassesToggled.Count(); j++)
310 {
312 {
313 string new_config_path = (config_path + " " + variable).Trim();
315 }
316 }
317 }
318 }
Param6< bool, string, int, string, int, string > ConfigParamsEx
PluginConfigViewer m_ModuleConfigViewer
ref TStringArray m_BaseConfigClassesToggled

References m_BaseConfigClassesToggled, m_ConfigHierarchyTextListbox, m_ConfigVariablesTextListbox, and m_ModuleConfigViewer.

Referenced by ChangeConfigFilter(), Init(), and OnClick().

◆ CollapseHierarchy()

void ScriptConsoleConfigTab::CollapseHierarchy ( int row)
inlineprotected

Definition at line 396 of file ScriptConsoleConfigTab.c.

397 {
399 return;
400
405
407 return;
408 int deep = config_params.param5;
409 int deep_next = config_params_next.param5;
410 int max_count = m_ConfigHierarchyTextListbox.GetNumItems();
411 int remove_lines_count = 0;
412 // Print(max_count);
413 for (int i = row + 1; i < max_count; i++)
414 {
415 if (deep < deep_next && i <= max_count)
416 {
420 }
421 }
422
423 // remove remove_lines_count lines from row
424 // remove_lines_count = remove_lines_count - 1;
425 for (i = 1; i < remove_lines_count; i++)
426 {
427 int x = row + 1;
428 if (x < max_count)
430 }
431
432 string offset = "";
433 for (i = 0; i < deep; i++)
434 offset = offset + " ";
435 m_ConfigHierarchyTextListbox.SetItem(row, offset + "+ " + config_params.param2, new ConfigParamsEx(false, config_params.param2, 0, config_params.param4, deep, ""), 0);
436 /* //not sure why this is here, but it's causing issues when collapsing items in config viewer, disabling for now
437 if (deep == 0)
438 {
439 ClearHierarchy();
440 }
441 */
442 }
Icon x

References m_ConfigHierarchyTextListbox, and x.

Referenced by OnClick().

◆ DumpParam()

void ScriptConsoleConfigTab::DumpParam ( string param,
string relativePath )
inlineprotected

Definition at line 248 of file ScriptConsoleConfigTab.c.

249 {
250 if (relativePath)
252 for (int i = 0; i < m_BaseConfigClassesToggled.Count(); i++)
253 {
255
256 int objects_count = GetGame().ConfigGetChildrenCount(config_path);
257
258 for (int j = 0; j < objects_count; j++)
259 {
260 string child_name;
261 GetGame().ConfigGetChildName(config_path, j, child_name);
262
263
264 //string dispName;
265 //GetGame().ConfigGetText( config_path + " " + child_name + " displayName",dispName );
266 string value;
267 string path = config_path + " " + child_name + relativePath + " " + param;
268 if (GetGame().ConfigIsExisting(path))
269 {
270 GetGame().ConfigGetText(path, value);
271 if (value)
272 Print(child_name + "," + param + "," + value);
273 }
274
275
276 /*
277 int scope = GetGame().ConfigGetInt( config_path + " " + child_name + " scope" );
278 {
279 if ( scope == 2)
280 {
281
282 }
283 }*/
284 }
285 }
286 }
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.

References GetGame(), m_BaseConfigClassesToggled, path, and Print().

Referenced by OnClick().

◆ ExpandHierarchy()

void ScriptConsoleConfigTab::ExpandHierarchy ( int row)
inlineprotected

Definition at line 359 of file ScriptConsoleConfigTab.c.

360 {
362 return;
363
365
366 // get current row data
369
370 string config_path = config_params.param4;
371 int deep = config_params.param5;
372
373
374 string offset = "";
375 for (int i = 0; i < deep; i++)
376 offset = offset + " ";
377
378 // change selected node
379 variables = m_ModuleConfigViewer.GetConfigHierarchy(config_path);
380 int childrens_count = variables.Count();
382
383 offset = offset + " ";
384
385 // render children
386 deep = deep + 1;
387 childrens_count = 0;
388 for (i = variables.Count() - 1; i >= 0; i--)
389 {
390 string new_config_path = (config_path + " " + variables.Get(i)).Trim();
391 m_ConfigHierarchyTextListbox.AddItem(offset + "+ " + variables.Get(i), new ConfigParamsEx(false, variables.Get(i), childrens_count, new_config_path, deep, config_params.param2), 0, (row + 1));
392 }
393 }

References m_ConfigHierarchyTextListbox, and m_ModuleConfigViewer.

Referenced by OnClick().

◆ FindInHierarchy()

void ScriptConsoleConfigTab::FindInHierarchy ( string class_name)
inlineprotected

Definition at line 320 of file ScriptConsoleConfigTab.c.

321 {
322 m_ConfigHierarchyTextListbox.ClearItems();
323 m_ConfigVariablesTextListbox.ClearItems();
324
325 class_name.ToLower();
326 string config_base_path = "configfile";
327
328 string filter_lower = class_name;
329 filter_lower.ToLower();
330
332 filter_lower.Split(" ", filters);
333
334 for (int i = 0; i < m_BaseConfigClassesToggled.Count(); i++)
335 {
339
340 for (int j = 0; j < variables.Count(); j++)
341 {
342 string variable = variables.Get(j);
343 string variable_lower = variable;
344 variable_lower.ToLower();
345
346 for (int k = 0; k < filters.Count(); k++)
347 {
348 if (variable_lower.Contains(filters.Get(k)))
349 {
350 string new_config_path = (config_path + " " + variable).Trim();
352 break;
353 }
354 }
355 }
356 }
357 }
class OptionSelectorMultistate extends OptionSelector class_name
array< string > TStringArray
Definition EnScript.c:666

References class_name, m_BaseConfigClassesToggled, m_ConfigHierarchyTextListbox, m_ConfigVariablesTextListbox, and m_ModuleConfigViewer.

Referenced by ChangeConfigFilter().

◆ Init()

void ScriptConsoleConfigTab::Init ( )
inlineprotected

Definition at line 217 of file ScriptConsoleConfigTab.c.

218 {
220 m_ModuleConfigViewer = PluginConfigViewer.Cast(GetPlugin(PluginConfigViewer));
221 int flag1;
222
224 flag1 = m_ConfigDebugProfile.GetConfigClassesFlag();
225 //Print("------------------------------------------------");
226 foreach (string s: m_BaseConfigClasses)
227 {
228 Widget w = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/config_class_item.layout", m_WgtClassesConfig);
229 CheckBoxWidget cbw = CheckBoxWidget.Cast(w.FindAnyWidget("Item"));
230 //cbw.SetColor(Colors.RED);
231 cbw.SetText(s);
232 int indx = m_ClassCheckboxes.Count();
233 m_ClassCheckboxes.Insert(cbw, indx);
234 //Print("adding "+cbw +" at index:" + indx);
235
236 if (flag1 & (int)Math.Pow(2, indx))
237 {
240 cbw.SetChecked(true);
241 }
242 }
243
246 }
PluginBase GetPlugin(typename plugin_type)
Definition Debug.c:14
static void GetBaseConfigClasses(out TStringArray base_classes)
Returns some of base config classes strings like CfgVehicles, CfgWeapons, etc. for searching purposes...
Definition Debug.c:523
Definition EnMath.c:7
ref TStringArray m_BaseConfigClasses
PluginConfigDebugProfile m_ConfigDebugProfile
static proto float Pow(float v, float power)
Return power of v ^ power.

References ChangeConfigFilter(), ClearHierarchy(), Debug::GetBaseConfigClasses(), GetGame(), GetPlugin(), m_BaseConfigClasses, m_BaseConfigClassesToggled, m_ClassCheckboxes, ScriptConsoleTabBase::m_ConfigDebugProfile, m_ModuleConfigViewer, m_WgtClassesConfig, and Math::Pow().

Referenced by ScriptConsoleConfigTab().

◆ OnChange()

override bool ScriptConsoleConfigTab::OnChange ( Widget w,
int x,
int y,
bool finished )
inlineprotected

Definition at line 56 of file ScriptConsoleConfigTab.c.

57 {
58 super.OnChange(w, x, y, finished);
60 {
62 return true;
63 }
64 else if (w == m_VariableConfigFilter)
65 {
67 return true;
68 }
69
70 return false;
71 }
Icon y

References ChangeConfigFilter(), m_ObjectConfigFilter, m_Row, m_VariableConfigFilter, RenderVariables(), x, and y.

◆ OnClick()

override bool ScriptConsoleConfigTab::OnClick ( Widget w,
int x,
int y,
int button )
inlineprotected

Definition at line 94 of file ScriptConsoleConfigTab.c.

95 {
96 super.OnClick(w, x, y, button);
97
99
100 if (w == m_DumpParamButton)
101 {
102 int selectedRowIndex = m_ConfigVariablesTextListbox.GetSelectedRow();
103 string paramFinal;
104 if (selectedRowIndex > -1)
105 {
106 string param;
108 int index = param.IndexOf("=");
109 if (index > 0)
110 paramFinal = param.Substring(0, index).Trim();
111 }
112
116 {
119 string path = params.param4;
121 path.Split(" ", pathArr);
122 string relativePath;
123
124 foreach (int indx, string s: pathArr)
125 {
126 if (indx > 2)
127 relativePath += s + " ";
128 }
129
130 if (relativePath)
131 relativePath = relativePath.Trim();
132
134 Print(path);
135 }
136
137 if (paramFinal)
139
140 return true;
141 }
143 {
145 //Print(objects_row_index);
146
148 {
151
152 if (config_params.param1 == false)
154 else
156
159 }
160 return true;
161 }
162 else if (cbw && m_ClassCheckboxes.Contains(cbw))
163 {
166
168
169 int flag, new_flag;
170
172 flag = m_ConfigDebugProfile.GetConfigClassesFlag();
173
174 if (cbw.IsChecked())
175 {
176 if (index_toggled == -1)//not found
177 {
179
182 }
183 }
184 else if (index_toggled != -1)
185 {
187
190 }
191 m_ConfigDebugProfile.SetConfigClassesFlag(new_flag);
192 /*
193 Print("-----------------------------------------");
194 Print("flag = " + new_flag);
195 foreach (string text:m_BaseConfigClassesToggled)
196 {
197 Print(text);
198 }
199 Print("-----------------------------------------");
200 */
202 }
203 else if (w == m_SelectedRowCopy)
204 {
206 return true;
207 }
208 return false;
209 }
Param3 int
void DumpParam(string param, string relativePath)
void AddItemToClipboard(TextListboxWidget text_listbox_widget)
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
Definition EnString.c:396

References ScriptConsoleTabBase::AddItemToClipboard(), ClearHierarchy(), CollapseHierarchy(), DumpParam(), ExpandHierarchy(), m_BaseConfigClasses, m_BaseConfigClassesToggled, m_ClassCheckboxes, ScriptConsoleTabBase::m_ConfigDebugProfile, m_ConfigHierarchyTextListbox, m_ConfigVariablesTextListbox, m_DumpParamButton, m_Row, m_SelectedRowCopy, path, Math::Pow(), Print(), RenderVariables(), string::Split(), x, and y.

◆ OnItemSelected()

override bool ScriptConsoleConfigTab::OnItemSelected ( Widget w,
int x,
int y,
int row,
int column,
int oldRow,
int oldColumn )
inlineprotected

Definition at line 73 of file ScriptConsoleConfigTab.c.

74 {
75 super.OnItemSelected(w, x, y, row, column, oldRow, oldColumn);
76
78 {
80 wgt.GetItemData(row, 0, m_ConfigData);
82
83 return true;
84 }
85 return false;
86 }
static ref ConfigParamsEx m_ConfigData

References m_ConfigData, m_ConfigHierarchyTextListbox, RenderClassPath(), x, and y.

◆ RenderClassPath()

void ScriptConsoleConfigTab::RenderClassPath ( )
inlineprotected

Definition at line 88 of file ScriptConsoleConfigTab.c.

89 {
90 m_ClassPath.SetText(m_ModuleConfigViewer.GetBaseClasses(m_ConfigData.param4, m_ConfigData.param2));
91 }

References m_ClassPath, m_ConfigData, and m_ModuleConfigViewer.

Referenced by OnItemSelected().

◆ RenderVariables()

void ScriptConsoleConfigTab::RenderVariables ( int row)
inlineprotected

Definition at line 444 of file ScriptConsoleConfigTab.c.

445 {
446 if (row > -1 && row < m_ConfigHierarchyTextListbox.GetNumItems())
447 {
448 string filter_lower = m_VariableConfigFilter.GetText();
449 filter_lower.ToLower();
450
452 filter_lower.Split(" ", filters);
453
455
457 m_ConfigVariablesTextListbox.ClearItems();
459 string path = config_params.param4;
460 variables = m_ModuleConfigViewer.GetConfigVariables(path);
461
462 for (int i = 0; i < variables.Count(); i++)
463 {
464 string var = variables.Get(i);
465
466 if (filters.Count() == 0)
468 else
469 {
470 foreach (string f: filters)
471 {
472 var.ToLower();
473 if (var.Contains(f))
475 }
476 }
477 }
478 }
479 }

References m_ConfigHierarchyTextListbox, m_ConfigVariablesTextListbox, m_ModuleConfigViewer, m_VariableConfigFilter, and path.

Referenced by OnChange(), and OnClick().

◆ Update()

override void ScriptConsoleConfigTab::Update ( float timeslice)
inlineprotected

Definition at line 211 of file ScriptConsoleConfigTab.c.

212 {
213 super.Update(timeslice);
214
215 }

Member Data Documentation

◆ m_BaseConfigClasses

ref TStringArray ScriptConsoleConfigTab::m_BaseConfigClasses = new TStringArray
protected

Definition at line 10 of file ScriptConsoleConfigTab.c.

Referenced by Init(), and OnClick().

◆ m_BaseConfigClassesToggled

ref TStringArray ScriptConsoleConfigTab::m_BaseConfigClassesToggled = new TStringArray
protected

Definition at line 11 of file ScriptConsoleConfigTab.c.

Referenced by ClearHierarchy(), DumpParam(), FindInHierarchy(), Init(), and OnClick().

◆ m_ClassCheckboxes

ref map<CheckBoxWidget, int> ScriptConsoleConfigTab::m_ClassCheckboxes = new map<CheckBoxWidget, int>
protected

Definition at line 12 of file ScriptConsoleConfigTab.c.

Referenced by Init(), OnClick(), and ~ScriptConsoleConfigTab().

◆ m_ClassPath

TextWidget ScriptConsoleConfigTab::m_ClassPath
protected

Definition at line 20 of file ScriptConsoleConfigTab.c.

Referenced by RenderClassPath(), and ScriptConsoleConfigTab().

◆ m_ConfigData

ref ConfigParamsEx ScriptConsoleConfigTab::m_ConfigData
staticprotected

Definition at line 9 of file ScriptConsoleConfigTab.c.

Referenced by OnItemSelected(), and RenderClassPath().

◆ m_ConfigHierarchyTextListbox

TextListboxWidget ScriptConsoleConfigTab::m_ConfigHierarchyTextListbox
protected

◆ m_ConfigTextField

string ScriptConsoleConfigTab::m_ConfigTextField
staticprotected

Definition at line 7 of file ScriptConsoleConfigTab.c.

Referenced by ChangeConfigFilter(), and ScriptConsoleConfigTab().

◆ m_ConfigVariablesTextListbox

TextListboxWidget ScriptConsoleConfigTab::m_ConfigVariablesTextListbox
protected

◆ m_DumpParamButton

ButtonWidget ScriptConsoleConfigTab::m_DumpParamButton
protected

Definition at line 19 of file ScriptConsoleConfigTab.c.

Referenced by OnClick(), and ScriptConsoleConfigTab().

◆ m_ModuleConfigViewer

PluginConfigViewer ScriptConsoleConfigTab::m_ModuleConfigViewer
protected

◆ m_ObjectConfigFilter

EditBoxWidget ScriptConsoleConfigTab::m_ObjectConfigFilter
protected

Definition at line 14 of file ScriptConsoleConfigTab.c.

Referenced by ChangeConfigFilter(), OnChange(), and ScriptConsoleConfigTab().

◆ m_Row

int ScriptConsoleConfigTab::m_Row
protected

Definition at line 25 of file ScriptConsoleConfigTab.c.

Referenced by OnChange(), and OnClick().

◆ m_SelectedRowCopy

ButtonWidget ScriptConsoleConfigTab::m_SelectedRowCopy
protected

Definition at line 18 of file ScriptConsoleConfigTab.c.

Referenced by OnClick(), and ScriptConsoleConfigTab().

◆ m_VariableConfigFilter

EditBoxWidget ScriptConsoleConfigTab::m_VariableConfigFilter
protected

◆ m_VariableTextField

string ScriptConsoleConfigTab::m_VariableTextField
staticprotected

Definition at line 8 of file ScriptConsoleConfigTab.c.

Referenced by ScriptConsoleConfigTab(), and ~ScriptConsoleConfigTab().

◆ m_WgtClassesConfig

Widget ScriptConsoleConfigTab::m_WgtClassesConfig
protected

Definition at line 23 of file ScriptConsoleConfigTab.c.

Referenced by Init(), and ScriptConsoleConfigTab().


The documentation for this class was generated from the following file: