Fixed libPNG warnings in ObjectsEditor and factored lists rendering by using ObjectListDialogsHelper

This commit is contained in:
Florian Rival
2015-03-15 14:41:05 +13:00
parent 8cac0d1260
commit e7fcb2e3de
7 changed files with 162 additions and 291 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 943 B

View File

@@ -15,6 +15,7 @@
#if !defined(GD_NO_WX_GUI)
#include <wx/treectrl.h>
#include <wx/bitmap.h>
#include <wx/log.h>
#endif
namespace gd
@@ -81,101 +82,35 @@ std::vector<std::string> ObjectListDialogsHelper::GetMatchingObjects() const
}
#if !defined(GD_NO_WX_GUI)
void ObjectListDialogsHelper::RefreshLists(wxTreeCtrl * sceneObjectsList, wxTreeCtrl * sceneGroupsList, wxTreeCtrl * globalObjectsList, wxTreeCtrl * globalGroupsList)
{
bool searching = searchText.empty() ? false : true;
sceneObjectsList->DeleteAllItems();
sceneObjectsList->AddRoot( _( "All objects groups of the scene" ) );
for ( unsigned int i = 0;i < layout.GetObjectsCount();i++ )
{
std::string name = layout.GetObject(i).GetName();
//Only add the object if it has the correct type
if (( objectTypeAllowed.empty() || layout.GetObject(i).GetType() == objectTypeAllowed ) &&
( !searching || (searching && gd::StrUppercase(name).find(gd::StrUppercase(searchText)) != std::string::npos)))
{
sceneObjectsList->AppendItem( sceneObjectsList->GetRootItem(), name );
}
}
sceneObjectsList->ExpandAll();
sceneGroupsList->DeleteAllItems();
sceneGroupsList->AddRoot( _( "All groups of the scene" ) );
for ( unsigned int i = 0;i < layout.GetObjectGroups().size();i++ )
{
std::string name = layout.GetObjectGroups()[i].GetName();
//Only add the group if it has all objects of the correct type
if (( objectTypeAllowed.empty() || gd::GetTypeOfObject(project, layout, layout.GetObjectGroups()[i].GetName()) == objectTypeAllowed ) &&
( !searching || (searching && gd::StrUppercase(name).find(gd::StrUppercase(searchText)) != std::string::npos)))
{
sceneGroupsList->AppendItem( sceneGroupsList->GetRootItem(), name );
}
}
sceneGroupsList->ExpandAll();
globalObjectsList->DeleteAllItems();
globalObjectsList->AddRoot( _( "All globals objects" ) );
for ( unsigned int i = 0;i < project.GetObjectsCount();i++ )
{
std::string name = project.GetObject(i).GetName();
//Only add the object if it has the correct type
if ((objectTypeAllowed.empty() || project.GetObject(i).GetType() == objectTypeAllowed ) &&
( !searching || (searching && gd::StrUppercase(name).find(gd::StrUppercase(searchText)) != std::string::npos)))
{
globalObjectsList->AppendItem( globalObjectsList->GetRootItem(), name );
}
}
globalObjectsList->ExpandAll();
globalGroupsList->DeleteAllItems();
globalGroupsList->AddRoot( _( "All globals groups" ) );
for ( unsigned int i = 0;i < project.GetObjectGroups().size();i++ )
{
std::string name = project.GetObjectGroups()[i].GetName();
//Only add the group if it has all objects of the correct type
if (( objectTypeAllowed.empty() || gd::GetTypeOfObject(project, layout, project.GetObjectGroups()[i].GetName()) == objectTypeAllowed ) &&
( !searching || (searching && gd::StrUppercase(name).find(gd::StrUppercase(searchText)) != std::string::npos)))
{
globalGroupsList->AppendItem( globalGroupsList->GetRootItem(), name );
}
}
globalGroupsList->ExpandAll();
}
void ObjectListDialogsHelper::RefreshList(wxTreeCtrl * objectsList)
void ObjectListDialogsHelper::RefreshList(wxTreeCtrl * objectsList, wxTreeItemId * objectsRootItem_, wxTreeItemId * groupsRootItem_)
{
objectsList->DeleteAllItems();
objectsList->AssignImageList(imageList);
objectsList->AddRoot( "Root" );
imageList->RemoveAll();
imageList->Add(gd::SkinHelper::GetIcon("object", 24));
imageList->Add(gd::SkinHelper::GetIcon("group", 24));
if (!objectsList->GetImageList())
objectsList->AssignImageList(new wxImageList(24,24, true));
objectsList->GetImageList()->RemoveAll();
objectsList->GetImageList()->Add(gd::SkinHelper::GetIcon("object", 24));
objectsList->GetImageList()->Add(gd::SkinHelper::GetIcon("group", 24));
wxTreeItemId objectsRootItem = objectsList->AppendItem(objectsList->GetRootItem(), _("Objects"), 0);
wxTreeItemId groupsRootItem = objectsList->AppendItem(objectsList->GetRootItem(), _("Groups"), 1);
AddObjectsToList(objectsList, objectsRootItem, layout, false, false);
if ( groupsAllowed ) AddGroupsToList(objectsList, groupsRootItem, layout.GetObjectGroups(), false, false);
AddObjectsToList(objectsList, objectsRootItem, project, true, false);
if ( groupsAllowed ) AddGroupsToList(objectsList, groupsRootItem, project.GetObjectGroups(), true, false);
AddObjectsToList(objectsList, objectsRootItem, layout, false);
if ( groupsAllowed ) AddGroupsToList(objectsList, groupsRootItem, layout.GetObjectGroups(), false);
AddObjectsToList(objectsList, objectsRootItem, project, true);
if ( groupsAllowed ) AddGroupsToList(objectsList, groupsRootItem, project.GetObjectGroups(), true);
objectsList->ExpandAll();
objectsList->Expand(objectsRootItem);
objectsList->Expand(groupsRootItem);
//If asked, return the root items for the objects and groups.
if (objectsRootItem_) *objectsRootItem_ = objectsRootItem;
if (groupsRootItem_) *groupsRootItem_ = groupsRootItem;
}
wxTreeItemId ObjectListDialogsHelper::AddObjectsToList(wxTreeCtrl * objectsList, wxTreeItemId rootItem, const gd::ClassWithObjects & objects, bool globalObjects, bool substituteIfEmpty)
wxTreeItemId ObjectListDialogsHelper::AddObjectsToList(wxTreeCtrl * objectsList, wxTreeItemId rootItem, const gd::ClassWithObjects & objects, bool globalObjects)
{
bool searching = searchText.empty() ? false : true;
@@ -188,12 +123,16 @@ wxTreeItemId ObjectListDialogsHelper::AddObjectsToList(wxTreeCtrl * objectsList,
if ((objectTypeAllowed.empty() || objects.GetObject(i).GetType() == objectTypeAllowed ) &&
( !searching || (searching && gd::StrUppercase(name).find(searchText) != std::string::npos)) )
{
wxLogNull noLogPlease; //Discard any warning when loading thumbnaiils.
int thumbnailID = -1;
wxBitmap thumbnail;
if ( objects.GetObject(i).GenerateThumbnail(project, thumbnail) && thumbnail.IsOk() )
if (objectsList->GetImageList() &&
objects.GetObject(i).GenerateThumbnail(project, thumbnail) &&
thumbnail.IsOk() )
{
imageList->Add(thumbnail);
thumbnailID = imageList->GetImageCount()-1;
objectsList->GetImageList()->Add(thumbnail);
thumbnailID = objectsList->GetImageList()->GetImageCount()-1;
}
wxTreeItemId item = objectsList->AppendItem( rootItem,
@@ -208,7 +147,7 @@ wxTreeItemId ObjectListDialogsHelper::AddObjectsToList(wxTreeCtrl * objectsList,
return lastAddedItem;
}
wxTreeItemId ObjectListDialogsHelper::AddGroupsToList(wxTreeCtrl * objectsList, wxTreeItemId rootItem, const std::vector <ObjectGroup> & groups, bool globalGroup, bool substituteIfEmpty)
wxTreeItemId ObjectListDialogsHelper::AddGroupsToList(wxTreeCtrl * objectsList, wxTreeItemId rootItem, const std::vector <ObjectGroup> & groups, bool globalGroup)
{
bool searching = searchText.empty() ? false : true;
@@ -222,6 +161,8 @@ wxTreeItemId ObjectListDialogsHelper::AddGroupsToList(wxTreeCtrl * objectsList,
objectsList->SetItemData(item, new gd::TreeItemStringData(globalGroup ? "GlobalGroup" : "LayoutGroup"));
if ( globalGroup ) objectsList->SetItemBold(item, true);
if (hasGroupExtraRendering) groupExtraRendering(item);
lastAddedItem = item;
}
}

View File

@@ -8,6 +8,7 @@
#define GDCORE_OBJECTLISTDIALOGSHELPER_H
#include <string>
#include <functional>
#include <vector>
namespace gd { class Project; }
namespace gd { class Layout; }
@@ -38,17 +39,34 @@ public:
* \param project Project
* \param layout Layout
*/
ObjectListDialogsHelper(const gd::Project & project_, const gd::Layout & layout_) : project(project_), layout(layout_), groupsAllowed(true)
ObjectListDialogsHelper(const gd::Project & project_, const gd::Layout & layout_) :
project(project_),
layout(layout_),
groupsAllowed(true),
hasGroupExtraRendering(false)
{
#if !defined(GD_NO_WX_GUI)
imageList = new wxImageList(24,24, true);
#endif
};
virtual ~ObjectListDialogsHelper() {};
/**
* \brief Specify the filter text: only objects and groups having a name
* containing this text will be shown when calling RefreshList.
* \param searchText The filter text
*/
void SetSearchText(std::string searchText_);
/**
* \brief Specify a type of object to display. Only objects of this type will
* be shown when calling RefreshList.
* \param allowedObjectType The type of objects. For example, "Sprite" or "TextObject::Text".
*/
void SetAllowedObjectType(std::string allowedObjectType_) { objectTypeAllowed = allowedObjectType_; }
/**
* \brief Set if groups of objects are displayed when calling RefreshList (true by default).
* \param canSelectGroup true to show groups, false to hide them.
*/
void SetGroupsAllowed(bool canSelectGroup) { groupsAllowed = canSelectGroup; }
/**
@@ -57,34 +75,25 @@ public:
std::vector<std::string> GetMatchingObjects() const;
#if !defined(GD_NO_WX_GUI)
/**
* \brief Update tree controls with objects and objects groups from the project and layout
* \param sceneObjectsList The wxTreeCtrl which will contain the layout objects
* \param sceneGroupsList The wxTreeCtrl which will contain the layout groups
* \param globalObjectsList The wxTreeCtrl which will contain the project objects
* \param globalGroupsList The wxTreeCtrl which will contain the project groups
* \param objectTypeAllowed If not empty, only objects of this type will be displayed
* \param searchText The text in the search box, which is used to filter objects
*/
void RefreshLists(wxTreeCtrl * sceneObjectsList,
wxTreeCtrl * sceneGroupsList,
wxTreeCtrl * globalObjectsList,
wxTreeCtrl * globalGroupsList);
/**
* \brief Update a tree control with all objects and objects groups from the project and layout
* \note The wxTreeCtrl must have an image list containing the object icon and the object group icon
* ( at index 0 and 1 )
* \param objectsList The wxTreeCtrl which will contain the objects and groups
* \param objectTypeAllowed If not empty, only objects of this type will be displayed
* \param searchText The text in the search box, which is used to filter objects
* \aram objectsRootItem Optional pointer to a wxTreeItemId which will be filled with the item being the root item for objects.
* \aram groupsRootItem Optional pointer to a wxTreeItemId which will be filled with the item being the root item for groups.
*/
void RefreshList(wxTreeCtrl * objectsList);
void RefreshList(wxTreeCtrl * objectsList, wxTreeItemId * objectsRootItem = NULL,
wxTreeItemId * groupsRootItem = NULL);
void SetGroupExtraRendering(std::function<void(wxTreeItemId)> function)
{
hasGroupExtraRendering = true;
groupExtraRendering = function;
}
#endif
private:
wxTreeItemId AddObjectsToList(wxTreeCtrl * tree, wxTreeItemId rootItem, const gd::ClassWithObjects & objects, bool globalObjects, bool substituteIfEmpty);
wxTreeItemId AddGroupsToList(wxTreeCtrl * tree, wxTreeItemId rootItem, const std::vector <gd::ObjectGroup> & groups, bool globalGroup, bool substituteIfEmpty);
wxTreeItemId AddObjectsToList(wxTreeCtrl * tree, wxTreeItemId rootItem, const gd::ClassWithObjects & objects, bool globalObjects);
wxTreeItemId AddGroupsToList(wxTreeCtrl * tree, wxTreeItemId rootItem, const std::vector <gd::ObjectGroup> & groups, bool globalGroup);
const Project & project;
const Layout & layout;
@@ -92,9 +101,8 @@ private:
std::string searchText;
bool groupsAllowed;
#if !defined(GD_NO_WX_GUI)
wxImageList *imageList;
#endif
bool hasGroupExtraRendering;
std::function<void(wxTreeItemId)> groupExtraRendering;
};
}

View File

@@ -221,7 +221,7 @@ void ExternalLayoutEditor::SetupForScene(gd::Layout & layout)
layoutEditorCanvas->SetScrollbars(scrollBar1, scrollBar2);
//Creating external editors and linking them to the layout canvas
objectsEditor = std::shared_ptr<gd::ObjectsEditor>(new gd::ObjectsEditor(this, project, &layout, mainFrameWrapper));
objectsEditor = std::shared_ptr<gd::ObjectsEditor>(new gd::ObjectsEditor(this, project, layout, mainFrameWrapper));
layersEditor = std::shared_ptr<gd::LayersEditorPanel>(new gd::LayersEditorPanel(this, project, layout, mainFrameWrapper) );
propertiesPnl = std::shared_ptr<LayoutEditorPropertiesPnl>(new LayoutEditorPropertiesPnl(this, project, layout, layoutEditorCanvas, mainFrameWrapper) );
initialInstancesBrowser = std::shared_ptr<InitialPositionBrowserDlg>(new InitialPositionBrowserDlg(this, instanceContainer, *layoutEditorCanvas) );

View File

@@ -26,6 +26,7 @@
#include "GDCore/IDE/Dialogs/ChooseVariableDialog.h"
#include "GDCore/IDE/Dialogs/ChooseAutomatismTypeDialog.h"
#include "GDCore/IDE/Dialogs/ChooseObjectTypeDialog.h"
#include "GDCore/IDE/Dialogs/ObjectListDialogsHelper.h"
#include "GDCore/Tools/HelpFileAccess.h"
#include "GDCore/IDE/CommonBitmapManager.h"
#include "GDCore/IDE/wxTools/TreeItemStringData.h"
@@ -54,12 +55,12 @@ namespace
class ObjectsListDnd : public wxTextDropTarget
{
public:
ObjectsListDnd(wxTreeCtrl *ctrl, wxTreeItemId groupsRootItem_, gd::Project & project_, gd::Layout * layout_)
ObjectsListDnd(wxTreeCtrl *ctrl, wxTreeItemId groupsRootItem_, gd::Project & project_, gd::Layout & layout_)
: treeCtrl(ctrl), groupsRootItem(groupsRootItem_), project(project_), layout(layout_) {};
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text)
{
std::string objectName = text.ToStdString();
std::string objectName = gd::ToString(text);
//Get the item under the mouse
int dropFlags;
@@ -74,9 +75,9 @@ namespace
if(data)
{
std::vector<gd::ObjectGroup> *groups = NULL;
if(data && data->GetString() == "LayoutGroup" && layout)
groups = &layout->GetObjectGroups();
else if(data && data->GetString() == "GlobalGroup")
if(data->GetString() == "LayoutGroup")
groups = &layout.GetObjectGroups();
else if(data->GetString() == "GlobalGroup")
groups = &project.GetObjectGroups();
else
return false;
@@ -87,6 +88,7 @@ namespace
if ( group != groups->end() && !group->Find(objectName))
{
//Add the object in the group
std::cout << "Adding " << objectName << " to group" << std::endl;
group->AddObject(objectName);
}
else
@@ -107,7 +109,7 @@ namespace
gd::ObjectGroup newGroup;
newGroup.AddObject(gd::ToString(text));
std::vector<gd::ObjectGroup> & objectsGroups = !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
std::vector<gd::ObjectGroup> & objectsGroups = layout.GetObjectGroups();
std::string name = gd::ToString(text) + "Group";
for (unsigned int i = 2;
@@ -131,7 +133,7 @@ namespace
//Notify the game of the new group
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupAdded(project, layout ? layout : NULL, name);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupAdded(project, &layout, name);
gd::LogStatus( _( "The group was correctly added." ) );
//Expand the new group item
@@ -152,7 +154,7 @@ namespace
wxTreeItemId groupsRootItem;
gd::Project & project;
gd::Layout * layout;
gd::Layout & layout;
};
}
@@ -208,12 +210,13 @@ BEGIN_EVENT_TABLE(ObjectsEditor,wxPanel)
//*)
END_EVENT_TABLE()
ObjectsEditor::ObjectsEditor(wxWindow* parent, gd::Project & project_, gd::Layout * layout_, gd::MainFrameWrapper & mainFrameWrapper_) :
ObjectsEditor::ObjectsEditor(wxWindow* parent, gd::Project & project_, gd::Layout & layout_, gd::MainFrameWrapper & mainFrameWrapper_) :
project(project_),
layout(layout_),
mainFrameWrapper(mainFrameWrapper_),
propPnl(NULL),
propPnlManager(NULL)
propPnlManager(NULL),
listsHelper(project, layout)
{
//(*Initialize(ObjectsEditor)
wxMenuItem* delObjMenuI;
@@ -350,9 +353,6 @@ ObjectsEditor::ObjectsEditor(wxWindow* parent, gd::Project & project_, gd::Layou
if(theme) theme->SetWindowTheme((HWND) objectsList->GetHWND(), L"EXPLORER", NULL);
#endif
objectsImagesList = new wxImageList(24,24, true);
objectsList->AssignImageList(objectsImagesList);
Refresh();
}
@@ -430,84 +430,13 @@ void ObjectsEditor::ConnectEvents()
void ObjectsEditor::Refresh()
{
objectsList->DeleteAllItems();
objectsImagesList->RemoveAll();
objectsImagesList->Add(gd::SkinHelper::GetIcon("object", 24));
objectsImagesList->Add(gd::SkinHelper::GetIcon("group", 24));
objectsList->AddRoot( "Root", 0 );
objectsRootItem = objectsList->AppendItem(objectsList->GetRootItem(), _("Objects"), 0);
groupsRootItem = objectsList->AppendItem(objectsList->GetRootItem(), _("Groups"), 1);
AddObjectsToList(*layout, false);
AddGroupsToList(layout->GetObjectGroups(), false);
AddObjectsToList(project, true);
AddGroupsToList(project.GetObjectGroups(), true);
objectsList->Expand(objectsRootItem);
objectsList->Expand(groupsRootItem);
listsHelper.SetGroupExtraRendering([this](wxTreeItemId groupItem) {
this->UpdateGroup(groupItem);
});
listsHelper.RefreshList(objectsList, &objectsRootItem, &groupsRootItem);
objectsList->SetDropTarget(new ObjectsListDnd(objectsList, groupsRootItem, project, layout));
}
wxTreeItemId ObjectsEditor::AddObjectsToList(gd::ClassWithObjects & objects, bool globalObjects)
{
std::string searchText = gd::StrUppercase(gd::ToString(searchCtrl->GetValue()));
bool searching = searchText.empty() ? false : true;
wxTreeItemId lastAddedItem;
for ( unsigned int i = 0;i < objects.GetObjectsCount();i++ )
{
std::string name = objects.GetObject(i).GetName();
//Only add objects if they match the search criteria
if ( ( !searching || (searching && gd::StrUppercase(name).find(searchText) != std::string::npos)) )
{
int thumbnailID = -1;
wxBitmap thumbnail;
if ( objects.GetObject(i).GenerateThumbnail(project, thumbnail) && thumbnail.IsOk() )
{
objectsImagesList->Add(thumbnail);
thumbnailID = objectsImagesList->GetImageCount()-1;
}
wxTreeItemId item = objectsList->AppendItem( objectsRootItem,
objects.GetObject(i).GetName(), thumbnailID );
objectsList->SetItemData(item, new gd::TreeItemStringData(globalObjects ? "GlobalObject" : "LayoutObject"));
if ( globalObjects ) objectsList->SetItemBold(item, true);
lastAddedItem = item;
}
}
project.SetDirty();
return lastAddedItem;
}
wxTreeItemId ObjectsEditor::AddGroupsToList(std::vector <ObjectGroup> & groups, bool globalGroup)
{
std::string searchText = gd::StrUppercase(gd::ToString(searchCtrl->GetValue()));
bool searching = searchText.empty() ? false : true;
wxTreeItemId lastAddedItem;
for (unsigned int i = 0;i<groups.size();++i)
{
if ( ( !searching || (searching && gd::StrUppercase(groups[i].GetName()).find(searchText) != std::string::npos)) )
{
wxTreeItemId item = objectsList->AppendItem( groupsRootItem, groups[i].GetName(), 1 );
objectsList->SetItemData(item, new gd::TreeItemStringData(globalGroup ? "GlobalGroup" : "LayoutGroup"));
if ( globalGroup ) objectsList->SetItemBold(item, true);
UpdateGroup(item);
lastAddedItem = item;
}
}
project.SetDirty();
return lastAddedItem;
}
void ObjectsEditor::UpdateGroup(wxTreeItemId groupItem)
{
if(!groupItem.IsOk())
@@ -522,7 +451,7 @@ void ObjectsEditor::UpdateGroup(wxTreeItemId groupItem)
//Clear the group item content
objectsList->DeleteChildren(groupItem);
std::vector<gd::ObjectGroup> & groups = (data->GetString() == "LayoutGroup") ? layout->GetObjectGroups() : project.GetObjectGroups();
std::vector<gd::ObjectGroup> & groups = (data->GetString() == "LayoutGroup") ? layout.GetObjectGroups() : project.GetObjectGroups();
//Find the group in the container
vector<gd::ObjectGroup>::iterator i = std::find_if( groups.begin(),
@@ -672,12 +601,10 @@ void ObjectsEditor::OnobjectsListEndLabelEdit(wxTreeEvent& event)
if ( data && (data->GetString() == "GlobalObject" || data->GetString() == "LayoutObject") )
{
bool globalObject = data->GetString() == "GlobalObject";
gd::ClassWithObjects * objects = layout;
if ( globalObject ) objects = &project;
if (!objects) return;
gd::ClassWithObjects & objects = !globalObject ? static_cast<gd::ClassWithObjects&>(layout) : project;
//Be sure there is not already another object with this name
if ( objects->HasObjectNamed(newName) )
if ( objects.HasObjectNamed(newName) )
{
gd::LogWarning( _( "Unable to rename the object : another object has already this name." ) );
@@ -696,19 +623,19 @@ void ObjectsEditor::OnobjectsListEndLabelEdit(wxTreeEvent& event)
return;
}
if ( !objects->HasObjectNamed(oldName) ) return;
objects->GetObject(oldName).SetName( newName );
if ( !objects.HasObjectNamed(oldName) ) return;
objects.GetObject(oldName).SetName( newName );
if ( !globalObject && layout ) //Change the object name in the layout.
if ( !globalObject) //Change the object name in the layout.
{
gd::EventsRefactorer::RenameObjectInEvents(project.GetCurrentPlatform(), project, *layout, layout->GetEvents(), oldName, newName);
layout->GetInitialInstances().RenameInstancesOfObject(oldName, newName);
for (unsigned int g = 0;g<layout->GetObjectGroups().size();++g)
gd::EventsRefactorer::RenameObjectInEvents(project.GetCurrentPlatform(), project, layout, layout.GetEvents(), oldName, newName);
layout.GetInitialInstances().RenameInstancesOfObject(oldName, newName);
for (unsigned int g = 0;g<layout.GetObjectGroups().size();++g)
{
if ( layout->GetObjectGroups()[g].Find(oldName))
if ( layout.GetObjectGroups()[g].Find(oldName))
{
layout->GetObjectGroups()[g].RemoveObject(oldName);
layout->GetObjectGroups()[g].AddObject(newName);
layout.GetObjectGroups()[g].RemoveObject(oldName);
layout.GetObjectGroups()[g].AddObject(newName);
}
}
//TODO: Factor this? And change the name in external events.
@@ -752,14 +679,14 @@ void ObjectsEditor::OnobjectsListEndLabelEdit(wxTreeEvent& event)
}
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectRenamed(project, globalObject ? NULL : layout, objects->GetObject(newName), oldName);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectRenamed(project, globalObject ? NULL : &layout, objects.GetObject(newName), oldName);
}
// Rename a group
else if ( data && (data->GetString() == "GlobalGroup" || data->GetString() == "LayoutGroup") )
{
bool globalGroup = data->GetString() == "GlobalGroup";
vector<gd::ObjectGroup> & objectsGroups =
(globalGroup || !layout) ? project.GetObjectGroups() : layout->GetObjectGroups();
globalGroup ? project.GetObjectGroups() : layout.GetObjectGroups();
if (std::find_if(objectsGroups.begin(), objectsGroups.end(),
std::bind2nd(gd::GroupHasTheSameName(), gd::ToString(event.GetLabel()))) != objectsGroups.end())
@@ -779,8 +706,8 @@ void ObjectsEditor::OnobjectsListEndLabelEdit(wxTreeEvent& event)
i->SetName( newName );
//TODO: Factor this? And change the name in external events.
if (!globalGroup && layout)
gd::EventsRefactorer::RenameObjectInEvents(project.GetCurrentPlatform(), project, *layout, layout->GetEvents(), oldName, newName);
if (!globalGroup)
gd::EventsRefactorer::RenameObjectInEvents(project.GetCurrentPlatform(), project, layout, layout.GetEvents(), oldName, newName);
else
{
for (unsigned int i = 0;i<project.GetLayoutsCount();++i)
@@ -796,7 +723,7 @@ void ObjectsEditor::OnobjectsListEndLabelEdit(wxTreeEvent& event)
}
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupRenamed(project, globalGroup ? NULL : layout, newName, oldName);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupRenamed(project, globalGroup ? NULL : &layout, newName, oldName);
}
}
else
@@ -867,8 +794,8 @@ gd::Object * ObjectsEditor::GetSelectedObject()
gd::Object * object = NULL;
if ( globalObject && project.HasObjectNamed(objectName) )
object = &project.GetObject(objectName);
else if ( !globalObject && layout && layout->HasObjectNamed(objectName) )
object = &layout->GetObject(objectName);
else if ( !globalObject && layout.HasObjectNamed(objectName) )
object = &layout.GetObject(objectName);
return object;
}
@@ -880,7 +807,7 @@ gd::ObjectGroup * ObjectsEditor::GetSelectedGroup()
bool globalGroup = data->GetString() == "GlobalGroup";
std::vector<gd::ObjectGroup> & objectsGroups =
globalGroup || !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
globalGroup ? project.GetObjectGroups() : layout.GetObjectGroups();
std::vector<gd::ObjectGroup>::iterator it = std::find_if(objectsGroups.begin(), objectsGroups.end(),
std::bind2nd(gd::GroupHasTheSameName(), groupName));
@@ -902,7 +829,7 @@ void ObjectsEditor::OnMenuEditObjectSelected(wxCommandEvent& event)
object->EditObject(this, project, mainFrameWrapper);
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectEdited(project, globalObject ? NULL : layout, *object);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectEdited(project, globalObject ? NULL : &layout, *object);
//TODO: Set dirty only if modified.
project.SetDirty();
@@ -910,26 +837,22 @@ void ObjectsEditor::OnMenuEditObjectSelected(wxCommandEvent& event)
//Reload thumbnail
int thumbnailID = -1;
wxBitmap thumbnail;
if ( object->GenerateThumbnail(project, thumbnail) && thumbnail.IsOk() )
if ( objectsList->GetImageList() && object->GenerateThumbnail(project, thumbnail) && thumbnail.IsOk() )
{
objectsImagesList->Add(thumbnail);
thumbnailID = objectsImagesList->GetImageCount()-1;
objectsList->GetImageList()->Add(thumbnail);
thumbnailID = objectsList->GetImageList()->GetImageCount()-1;
}
objectsList->SetItemImage( lastSelectedItem, thumbnailID );
//Reload resources
if (layout)
{
//Reload resources : Do not forget to switch the working directory.
wxString oldWorkingDir = wxGetCwd();
if ( wxDirExists(wxFileName::FileName(project.GetProjectFile()).GetPath()))
wxSetWorkingDirectory(wxFileName::FileName(project.GetProjectFile()).GetPath());
//Reload resources : Do not forget to switch the working directory.
wxString oldWorkingDir = wxGetCwd();
if ( wxDirExists(wxFileName::FileName(project.GetProjectFile()).GetPath()))
wxSetWorkingDirectory(wxFileName::FileName(project.GetProjectFile()).GetPath());
object->LoadResources(project, *layout);
object->LoadResources(project, layout);
wxSetWorkingDirectory(oldWorkingDir);
}
wxSetWorkingDirectory(oldWorkingDir);
}
//Group clicked?
else if ( data && (data->GetString() == "GlobalGroup" || data->GetString() == "LayoutGroup") )
@@ -938,9 +861,9 @@ void ObjectsEditor::OnMenuEditObjectSelected(wxCommandEvent& event)
gd::ObjectGroup * group = GetSelectedGroup();
objectsList->Expand(lastSelectedItem);
if (!group || !layout) return;
if (!group) return;
ChooseObjectDialog dialog(this, project, *layout, /*canSelectGroup=*/false, "", /*multipleSelection=*/true);
ChooseObjectDialog dialog(this, project, layout, /*canSelectGroup=*/false, "", /*multipleSelection=*/true);
if (dialog.ShowModal() == 1) { //Add objects to the group
for(unsigned int i = 0;i < dialog.GetChosenObjects().size();++i)
group->AddObject(dialog.GetChosenObjects()[i]);
@@ -971,15 +894,13 @@ void ObjectsEditor::OnAddObjectSelected(wxCommandEvent& event)
if ( chooseTypeDialog.ShowModal() == 0 )
return;
gd::ClassWithObjects & objects = layout ? static_cast<gd::ClassWithObjects &>(*layout) : (project);
//Find a new unique name for the object
std::string name = ToString(_("NewObject"));
for (unsigned int i = 2;objects.HasObjectNamed(name);++i)
for (unsigned int i = 2;layout.HasObjectNamed(name);++i)
name = _("NewObject")+ToString(i);
//Add a new object of selected type to objects list
objects.InsertNewObject(project, chooseTypeDialog.GetSelectedObjectType(), ToString(name), objects.GetObjectsCount());
layout.InsertNewObject(project, chooseTypeDialog.GetSelectedObjectType(), ToString(name), layout.GetObjectsCount());
//And to the TreeCtrl
wxTreeItemId itemAdded;
@@ -992,10 +913,10 @@ void ObjectsEditor::OnAddObjectSelected(wxCommandEvent& event)
//Reload thumbnail
int thumbnailID = -1;
wxBitmap thumbnail;
if ( objects.GetObject(objects.GetObjectsCount()-1).GenerateThumbnail(project, thumbnail) )
if ( objectsList->GetImageList() && layout.GetObject(layout.GetObjectsCount()-1).GenerateThumbnail(project, thumbnail) )
{
objectsImagesList->Add(thumbnail);
thumbnailID = objectsImagesList->GetImageCount()-1;
objectsList->GetImageList()->Add(thumbnail);
thumbnailID = objectsList->GetImageList()->GetImageCount()-1;
}
objectsList->SetItemImage( itemAdded, thumbnailID );
@@ -1003,7 +924,7 @@ void ObjectsEditor::OnAddObjectSelected(wxCommandEvent& event)
objectsList->SetItemData( itemAdded, new gd::TreeItemStringData("LayoutObject") );
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectAdded(project, layout, objects.GetObject(name));
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectAdded(project, &layout, layout.GetObject(name));
objectsList->EditLabel(itemAdded);
renamedItemOldName = name; //With wxGTK, calling EditLabel do not update renamedItemOldName with the name of the new object.
@@ -1016,7 +937,7 @@ void ObjectsEditor::OnAddGroupSelected(wxCommandEvent& event)
{
gd::ObjectGroup newGroup;
vector<gd::ObjectGroup> & objectsGroups = !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
vector<gd::ObjectGroup> & objectsGroups = layout.GetObjectGroups();
std::string name = ToString(_("NewGroup"));
for (unsigned int i = 2;
@@ -1039,7 +960,7 @@ void ObjectsEditor::OnAddGroupSelected(wxCommandEvent& event)
objectsList->SetItemData( itemAdded, new gd::TreeItemStringData("LayoutGroup") );
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupAdded(project, layout ? layout : NULL, name);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupAdded(project, &layout, name);
gd::LogStatus( _( "The group was correctly added." ) );
//Make sure that the group root item is expanded
@@ -1089,7 +1010,7 @@ void ObjectsEditor::OnDeleteSelected(wxCommandEvent& event)
{
bool globalObject = data->GetString() == "GlobalObject";
std::string objectName = ToString(objectsList->GetItemText( selection[i] ));
gd::ClassWithObjects & objects = !globalObject && layout ? static_cast<gd::ClassWithObjects&>(*layout) : project;
gd::ClassWithObjects & objects = !globalObject ? static_cast<gd::ClassWithObjects&>(layout) : project;
//Generate also a list containing the names of the objects deleted :
if ( globalObject ) gObjectsDeleted.push_back(objectName);
else objectsDeleted.push_back(objectName);
@@ -1099,17 +1020,17 @@ void ObjectsEditor::OnDeleteSelected(wxCommandEvent& event)
//Remove objects
objects.RemoveObject(objectName);
if ( !globalObject && layout )
if ( !globalObject)
{
if ( answer == wxYES )
{
gd::EventsRefactorer::RemoveObjectInEvents(project.GetCurrentPlatform(), project, *layout, layout->GetEvents(), objectName);
for (unsigned int g = 0;g<layout->GetObjectGroups().size();++g)
gd::EventsRefactorer::RemoveObjectInEvents(project.GetCurrentPlatform(), project, layout, layout.GetEvents(), objectName);
for (unsigned int g = 0;g<layout.GetObjectGroups().size();++g)
{
if ( layout->GetObjectGroups()[g].Find(objectName)) layout->GetObjectGroups()[g].RemoveObject(objectName);
if ( layout.GetObjectGroups()[g].Find(objectName)) layout.GetObjectGroups()[g].RemoveObject(objectName);
}
}
layout->GetInitialInstances().RemoveInitialInstancesOfObject(objectName);
layout.GetInitialInstances().RemoveInitialInstancesOfObject(objectName);
//TODO: Refactor also in external events
}
else if ( globalObject )
@@ -1124,7 +1045,7 @@ void ObjectsEditor::OnDeleteSelected(wxCommandEvent& event)
std::string groupName = ToString(objectsList->GetItemText( selection[i] ));
std::vector<gd::ObjectGroup> & objectsGroups =
globalGroup || !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
globalGroup ? project.GetObjectGroups() : layout.GetObjectGroups();
vector<gd::ObjectGroup>::iterator g = std::find_if( objectsGroups.begin(),
objectsGroups.end(),
@@ -1134,14 +1055,14 @@ void ObjectsEditor::OnDeleteSelected(wxCommandEvent& event)
if ( answer == wxYES )
{
if ( !globalGroup && layout )
gd::EventsRefactorer::RemoveObjectInEvents(project.GetCurrentPlatform(), project, *layout, layout->GetEvents(), groupName);
if (!globalGroup)
gd::EventsRefactorer::RemoveObjectInEvents(project.GetCurrentPlatform(), project, layout, layout.GetEvents(), groupName);
else
;//TODO
}
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupDeleted(project, globalGroup ? NULL : layout, groupName);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupDeleted(project, globalGroup ? NULL : &layout, groupName);
}
else if( data->GetString() == "ObjectInGroup")
{
@@ -1159,7 +1080,7 @@ void ObjectsEditor::OnDeleteSelected(wxCommandEvent& event)
std::string groupName = ToString(objectsList->GetItemText( groupItem ));
std::vector<gd::ObjectGroup> & objectsGroups =
globalGroup || !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
globalGroup ? project.GetObjectGroups() : layout.GetObjectGroups();
vector<gd::ObjectGroup>::iterator g = std::find_if( objectsGroups.begin(),
objectsGroups.end(),
@@ -1183,7 +1104,7 @@ void ObjectsEditor::OnDeleteSelected(wxCommandEvent& event)
//Call the notifiers
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectsDeleted(project, layout, objectsDeleted);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectsDeleted(project, &layout, objectsDeleted);
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectsDeleted(project, NULL, gObjectsDeleted);
}
@@ -1200,7 +1121,7 @@ void ObjectsEditor::OnMoveupSelected(wxCommandEvent& event)
if ( data && (data->GetString() == "GlobalObject" || data->GetString() == "LayoutObject") )
{
bool globalObject = data->GetString() == "GlobalObject";
gd::ClassWithObjects & objects = !globalObject && layout ? static_cast<gd::ClassWithObjects &>(*layout) : (project);
gd::ClassWithObjects & objects = !globalObject ? static_cast<gd::ClassWithObjects&>(layout) : project;
unsigned int index = objects.GetObjectPosition(name);
if ( index >= objects.GetObjectsCount() )
@@ -1226,7 +1147,7 @@ void ObjectsEditor::OnMoveDownSelected(wxCommandEvent& event)
if ( data->GetString() == "GlobalObject" || data->GetString() == "LayoutObject" )
{
bool globalObject = data->GetString() == "GlobalObject";
gd::ClassWithObjects & objects = !globalObject && layout ? static_cast<gd::ClassWithObjects &>(*layout) : (project);
gd::ClassWithObjects & objects = !globalObject ? static_cast<gd::ClassWithObjects&>(layout) : project;
unsigned int index = objects.GetObjectPosition(name);
if ( index >= objects.GetObjectsCount() )
@@ -1270,7 +1191,7 @@ void ObjectsEditor::OnCopySelected(wxCommandEvent& event)
if ( data->GetString() == "GlobalObject" || data->GetString() == "LayoutObject" )
{
bool globalObject = data->GetString() == "GlobalObject";
gd::ClassWithObjects & objects = !globalObject && layout ? static_cast<gd::ClassWithObjects &>(*layout) : (project);
gd::ClassWithObjects & objects = !globalObject ? static_cast<gd::ClassWithObjects&>(layout) : project;
if ( !objects.HasObjectNamed(name) )
return;
@@ -1282,7 +1203,7 @@ void ObjectsEditor::OnCopySelected(wxCommandEvent& event)
{
bool globalGroup = data->GetString() == "GlobalGroup";
std::vector<gd::ObjectGroup> & objectsGroups =
globalGroup || !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
globalGroup ? project.GetObjectGroups() : layout.GetObjectGroups();
if ( !HasGroupNamed(name, objectsGroups) )
return;
@@ -1302,7 +1223,7 @@ void ObjectsEditor::OnCutSelected(wxCommandEvent& event)
if ( data->GetString() == "GlobalObject" || data->GetString() == "LayoutObject" )
{
bool globalObject = data->GetString() == "GlobalObject";
gd::ClassWithObjects & objects = !globalObject && layout ? static_cast<gd::ClassWithObjects &>(*layout) : (project);
gd::ClassWithObjects & objects = !globalObject ? static_cast<gd::ClassWithObjects&>(layout) : project;
if ( !objects.HasObjectNamed(name) )
return;
@@ -1315,13 +1236,13 @@ void ObjectsEditor::OnCutSelected(wxCommandEvent& event)
std::vector<std::string> objectsDeleted;
objectsDeleted.push_back(name);
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectsDeleted(project, globalObject ? NULL : layout, objectsDeleted);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectsDeleted(project, globalObject ? NULL : &layout, objectsDeleted);
}
else if ( data->GetString() == "GlobalGroup" || data->GetString() == "LayoutGroup" )
{
bool globalGroup = data->GetString() == "GlobalGroup";
std::vector<gd::ObjectGroup> & objectsGroups =
globalGroup || !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
globalGroup ? project.GetObjectGroups() : layout.GetObjectGroups();
if ( !HasGroupNamed(name, objectsGroups) )
return;
@@ -1331,7 +1252,7 @@ void ObjectsEditor::OnCutSelected(wxCommandEvent& event)
RemoveGroup(name, objectsGroups);
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupDeleted(project, globalGroup ? NULL : layout, name);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupDeleted(project, globalGroup ? NULL : &layout, name);
}
Refresh();
@@ -1346,7 +1267,7 @@ void ObjectsEditor::OnPasteSelected(wxCommandEvent& event)
if ( clipboard->HasObject() )
{
bool globalObject = data->GetString() == "GlobalObject";
gd::ClassWithObjects & objects = !globalObject && layout ? static_cast<gd::ClassWithObjects &>(*layout) : (project);
gd::ClassWithObjects & objects = !globalObject ? static_cast<gd::ClassWithObjects&>(layout) : project;
//Add a new object of selected type to objects list
gd::Object * object = clipboard->GetObject()->Clone();
@@ -1367,13 +1288,13 @@ void ObjectsEditor::OnPasteSelected(wxCommandEvent& event)
//Add it to the list
objects.InsertObject(*object, objects.GetObjectsCount());
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectAdded(project, globalObject ? NULL : layout, *object);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectAdded(project, globalObject ? NULL : &layout, *object);
}
else if ( clipboard->HasObjectGroup())
{
bool globalGroup = data->GetString() == "GlobalGroup";
std::vector<gd::ObjectGroup> & objectsGroups =
globalGroup || !layout ? project.GetObjectGroups() : layout->GetObjectGroups();
globalGroup ? project.GetObjectGroups() : layout.GetObjectGroups();
gd::ObjectGroup groupPasted = clipboard->GetObjectGroup();
@@ -1390,7 +1311,7 @@ void ObjectsEditor::OnPasteSelected(wxCommandEvent& event)
objectsGroups.push_back( groupPasted );
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupAdded(project, globalGroup ? layout : NULL, groupPasted.GetName());
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupAdded(project, globalGroup ? NULL : &layout, groupPasted.GetName());
}
//Refresh the list and select the newly added item
@@ -1407,7 +1328,7 @@ void ObjectsEditor::OnSetGlobalSelected(wxCommandEvent& event)
{
//Get the selected item
gd::TreeItemStringData * data = dynamic_cast<gd::TreeItemStringData*>(objectsList->GetItemData(lastSelectedItem));
if (!data || !layout) return;
if (!data) return;
//Object clicked?
if ( data->GetString() == "LayoutObject")
@@ -1422,13 +1343,13 @@ void ObjectsEditor::OnSetGlobalSelected(wxCommandEvent& event)
}
project.InsertObject(*object, -1);
layout->RemoveObject(objectName);
layout.RemoveObject(objectName);
std::vector<std::string> removedObject;
removedObject.push_back(objectName);
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
{
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectsDeleted(project, layout, removedObject);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectsDeleted(project, &layout, removedObject);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectAdded(project, NULL, project.GetObject(objectName));
}
@@ -1463,11 +1384,11 @@ void ObjectsEditor::OnSetGlobalSelected(wxCommandEvent& event)
return;
}
project.GetObjectGroups().push_back(*group);
RemoveGroup(groupName, layout->GetObjectGroups());
RemoveGroup(groupName, layout.GetObjectGroups());
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
{
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupDeleted(project, layout, groupName);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupDeleted(project, &layout, groupName);
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnObjectGroupAdded(project, NULL, groupName);
}
@@ -1540,8 +1461,8 @@ void ObjectsEditor::UpdateAssociatedPropertiesPanel()
if ( !object ) return;
//Log the selection
if ( layout && !globalObject )
LogFileManager::Get()->WriteToLogFile(ToString("Object \""+object->GetName()+"\" selected ( Layout \""+layout->GetName()+"\" )"));
if (!globalObject)
LogFileManager::Get()->WriteToLogFile(ToString("Object \""+object->GetName()+"\" selected ( Layout \""+layout.GetName()+"\" )"));
else
LogFileManager::Get()->WriteToLogFile(ToString("Object \""+object->GetName()+"\" selected"));
@@ -1694,7 +1615,7 @@ void ObjectsEditor::OnMenuAddAutomatismSelected(wxCommandEvent& event)
if ( !object ) return;
if ( gd::ChooseAutomatismTypeDialog::ChooseAndAddAutomatismToObject(this, project,
object, layout, globalObject))
object, &layout, globalObject))
UpdateAssociatedPropertiesPanel();
//Show and update the properties panel.

View File

@@ -21,6 +21,7 @@
#include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/Layout.h"
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "GDCore/IDE/Dialogs/ObjectListDialogsHelper.h"
#include "GDCore/IDE/Dialogs/LayoutEditorCanvas/LayoutEditorCanvasAssociatedEditor.h"
class LayoutEditorPropertiesPnl;
@@ -39,10 +40,11 @@ public:
* \brief Default constructor
* \param parent wxWidgets parent window
* \param project The project being edited
* \param layout The layout being edited. Can be NULL.
* \param layout The layout being edited.
* \param mainFrameWrapper gd::MainFrameWrapper object
*/
ObjectsEditor(wxWindow* parent, gd::Project & project, gd::Layout * layout, gd::MainFrameWrapper & mainFrameWrapper_);
ObjectsEditor(wxWindow* parent, gd::Project & project, gd::Layout & layout, gd::MainFrameWrapper & mainFrameWrapper_);
virtual ~ObjectsEditor();
/**
@@ -194,10 +196,8 @@ private:
gd::ObjectGroup & GetGroup(std::string name, std::vector<gd::ObjectGroup> & groups);
void RemoveGroup(std::string name, std::vector<gd::ObjectGroup> & groups);
wxImageList* objectsImagesList;
gd::Project & project;
gd::Layout * layout; ///< Layout edited. Can be NULL.
gd::Layout & layout;
gd::MainFrameWrapper & mainFrameWrapper;
static wxRibbonButtonBar * objectsRibbonBar;
@@ -207,6 +207,7 @@ private:
LayoutEditorPropertiesPnl * propPnl;
wxAuiManager * propPnlManager;
ObjectListDialogsHelper listsHelper; ///< The helper used for rendering lists.
wxTreeItemId objectsRootItem;
wxTreeItemId groupsRootItem;

View File

@@ -113,7 +113,7 @@ mainFrameWrapper(mainFrameWrapper_)
layoutEditorCanvas->SetScrollbars(hScrollbar, vScrollbar);
//Create all editors linked to scene canvas.
objectsEditor = std::shared_ptr<gd::ObjectsEditor>(new gd::ObjectsEditor(this, project, &layout, mainFrameWrapper) );
objectsEditor = std::shared_ptr<gd::ObjectsEditor>(new gd::ObjectsEditor(this, project, layout, mainFrameWrapper) );
layersEditor = std::shared_ptr<gd::LayersEditorPanel>(new gd::LayersEditorPanel(this, project, layout, mainFrameWrapper) );
initialInstancesBrowser = std::shared_ptr<InitialPositionBrowserDlg>(new InitialPositionBrowserDlg(this, layout.GetInitialInstances(), *layoutEditorCanvas) );
propertiesPnl = std::shared_ptr<LayoutEditorPropertiesPnl>(new LayoutEditorPropertiesPnl(this, project, layout, layoutEditorCanvas, mainFrameWrapper));