@@ -33,6 +33,7 @@ GuiInspector::GuiInspector()
33
33
{
34
34
mGroups .clear ();
35
35
mTarget = NULL ;
36
+ mOpenGroupList .clear ();
36
37
37
38
mGroupPanelProfile = NULL ;
38
39
setField (" GroupPanelProfile" , " GuiPanelProfile" );
@@ -278,12 +279,23 @@ void GuiInspector::clearGroups()
278
279
if ( mGroups .empty () )
279
280
return ;
280
281
281
- // Attempt to find it in the group list
282
- Vector<GuiInspectorGroup*>::iterator i = mGroups .begin ();
282
+ mOpenGroupList .clear ();
283
283
284
- for ( ; i != mGroups .end (); i++ )
285
- if ( (*i)->isProperlyAdded () )
286
- (*i)->deleteObject ();
284
+ for (Vector<GuiInspectorGroup*>::iterator i = mGroups .begin (); i != mGroups .end (); i++ )
285
+ {
286
+ if ((*i)->isProperlyAdded ())
287
+ {
288
+ GuiInspectorGroup* group = static_cast <GuiInspectorGroup*>(*i);
289
+
290
+ // First, save which groups are open by name
291
+ if (group->getExpanded ())
292
+ {
293
+ mOpenGroupList .push_back (group->getGroupName ());
294
+ }
295
+
296
+ group->deleteObject ();
297
+ }
298
+ }
287
299
288
300
mGroups .clear ();
289
301
@@ -326,6 +338,7 @@ void GuiInspector::inspectObject( SimObject *object )
326
338
general->registerObject ();
327
339
mGroups .push_back ( general );
328
340
addObject ( general );
341
+ checkOpenGroupList (general);
329
342
}
330
343
331
344
// Grab this objects field list
@@ -343,6 +356,7 @@ void GuiInspector::inspectObject( SimObject *object )
343
356
group->registerObject ();
344
357
mGroups .push_back ( group );
345
358
addObject ( group );
359
+ checkOpenGroupList (group);
346
360
}
347
361
}
348
362
}
@@ -373,6 +387,18 @@ void GuiInspector::inspectObject( SimObject *object )
373
387
guiCanvas->setFirstResponder ( currResponder );
374
388
}
375
389
390
+ void GuiInspector::checkOpenGroupList (GuiInspectorGroup* group)
391
+ {
392
+ for (Vector<StringTableEntry>::iterator i = mOpenGroupList .begin (); i != mOpenGroupList .end (); i++)
393
+ {
394
+ StringTableEntry text = static_cast <StringTableEntry>(*i);
395
+ if (dStrcmp (text, group->getGroupName ()) == 0 )
396
+ {
397
+ group->setExpandedInstant (true );
398
+ }
399
+ }
400
+ }
401
+
376
402
ConsoleMethod ( GuiInspector, inspect, void , 3 , 3 , " (obj) Goes through the object's fields and autogenerates editor boxes\n "
377
403
" @return No return value." )
378
404
{
0 commit comments