[WIP] Improved event store and made group events added from template editable using the event store

This commit is contained in:
Florian Rival
2014-12-14 16:54:32 +01:00
parent 3be2561ceb
commit ef616baca3
9 changed files with 561 additions and 118 deletions

View File

@@ -20,6 +20,7 @@
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/IDE/Dialogs/GroupEventDialog.h"
#include "GDCore/IDE/Dialogs/EventStoreDialog.h"
using namespace std;
@@ -74,11 +75,30 @@ gd::BaseEvent::EditEventReturnType GroupEvent::EditEvent(wxWindow* parent_, gd::
events.InsertNewEvent(project, "BuiltinCommonInstructions::Standard");
#if !defined(GD_NO_WX_GUI)
GroupEventDialog dialog(parent_, *this);
dialog.ShowModal();
if (source.empty())
{
GroupEventDialog dialog(parent_, *this);
dialog.ShowModal();
return ChangesMadeButNoNeedForEventsRecompilation;
}
else
{
gd::EventStoreDialog dialog(parent_, project, scene);
size_t found = source.rfind("/");
if (found != std::string::npos && found < source.size()-1) {
std::string sourceId = source.substr(found+1, source.size());
dialog.RefreshWith(sourceId, parameters);
}
if (dialog.ShowModal() != 1) return Cancelled;
//Insert new events
*this = dialog.GetGroupEvent();
return ChangesMade;
}
#endif
return ChangesMadeButNoNeedForEventsRecompilation;
}
void GroupEvent::SetBackgroundColor(unsigned int colorR_, unsigned int colorG_, unsigned int colorB_)

View File

@@ -12,13 +12,15 @@
#include "GDCore/IDE/EventsRefactorer.h"
#include "GDCore/CommonTools.h"
#include "SFML/Network.hpp"
#include <boost/algorithm/string.hpp>
#include <wx/htmllbox.h>
namespace gd
{
const std::string EventStoreDialog::host = "http://localhost";
const int EventStoreDialog::port = 3000;
const std::string EventStoreDialog::host = "http://gdevapp.com";
const int EventStoreDialog::port = 80;
gd::SerializerElement * EventStoreDialog::templates = NULL;
EventStoreDialog::EventStoreDialog(wxWindow* parent, gd::Project & project_, gd::Layout & layout_)
: BaseEventStoreDialog(parent),
@@ -26,7 +28,7 @@ EventStoreDialog::EventStoreDialog(wxWindow* parent, gd::Project & project_, gd:
layout(layout_),
parametersHelper(this, paramCheckboxes, paramSpacers1, paramTexts, paramSpacers2, paramBmpBts, paramEdits)
{
parametersHelper.SetSizer(parametersSizer);
parametersHelper.SetWindow(m_scrollWin148).SetSizer(parametersSizer);
templatesList->Connect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(EventStoreDialog::OnSelectionChanged), NULL, this);
FetchTemplates();
@@ -38,8 +40,19 @@ EventStoreDialog::~EventStoreDialog()
{
}
sf::Http::Response::Status EventStoreDialog::FetchTemplates()
void EventStoreDialog::RefreshWith(std::string templateId, const std::vector<std::string> & parameters)
{
FetchTemplate(templateId);
RefreshTemplate();
for(unsigned int i = 0;i<parameters.size() && i<paramEdits.size();++i) {
paramEdits[i]->SetValue(parameters[i]);
}
}
sf::Http::Response::Status EventStoreDialog::FetchTemplates(bool forceFetch)
{
if (templates && !forceFetch) return sf::Http::Response::Ok;
// Create request
sf::Http Http(host, port);
sf::Http::Request request;
@@ -50,7 +63,10 @@ sf::Http::Response::Status EventStoreDialog::FetchTemplates()
sf::Http::Response response = Http.sendRequest(request, sf::seconds(2));
if (response.getStatus() == sf::Http::Response::Ok)
templates = Serializer::FromJSON(response.getBody());
{
if (templates) delete templates;
templates = new gd::SerializerElement(Serializer::FromJSON(response.getBody()));
}
return response.getStatus();
}
@@ -58,7 +74,7 @@ sf::Http::Response::Status EventStoreDialog::FetchTemplates()
sf::Http::Response::Status EventStoreDialog::FetchTemplate(std::string id)
{
nameTxt->SetLabel("Loading the template...");
descriptionTxt->SetLabel("");
descriptionEdit->SetValue("");
wxSafeYield();
@@ -79,19 +95,30 @@ sf::Http::Response::Status EventStoreDialog::FetchTemplate(std::string id)
void EventStoreDialog::RefreshList()
{
templatesList->Clear();
templates.ConsiderAsArrayOf("Template");
for (unsigned int i = 0;i<templates.GetChildrenCount();++i) {
const SerializerElement & eventTemplate = templates.GetChild(i);
wxString name = eventTemplate.GetChild("name").GetValue().GetString();
wxString desc = eventTemplate.GetChild("description").GetValue().GetString();
wxString id = eventTemplate.GetChild("_id").GetValue().GetString();
if (desc.size() > 50) {
desc.Truncate(50).Append(_("..."));
}
templatesList->Clear();
std::string searchText = gd::ToString(searchCtrl->GetValue());
boost::to_upper(searchText);
bool searching = searchText.empty() ? false : true;
wxStringClientData * data = new wxStringClientData(id);
templatesList->Append("<b>"+name+"</b><br>"+desc, data);
if (!templates) return;
templates->ConsiderAsArrayOf("Template");
for (unsigned int i = 0;i<templates->GetChildrenCount();++i) {
const SerializerElement & eventTemplate = templates->GetChild(i);
std::string name = eventTemplate.GetChild("name").GetValue().GetString();
std::string desc = eventTemplate.GetChild("description").GetValue().GetString();
if (!searching || boost::to_upper_copy(name).find(searchText) != std::string::npos
|| boost::to_upper_copy(desc).find(searchText) != std::string::npos)
{
wxString id = eventTemplate.GetChild("_id").GetValue().GetString();
if (desc.size() > 50) {
desc.resize(50);
desc += "...";
}
wxStringClientData * data = new wxStringClientData(id);
templatesList->Append("<b>"+name+"</b><br>"+desc, data);
}
}
}
@@ -99,9 +126,12 @@ void EventStoreDialog::RefreshTemplate()
{
okBt->Enable();
nameTxt->SetLabel(loadedTemplate.GetChild("name").GetValue().GetString());
descriptionTxt->SetLabel(loadedTemplate.GetChild("description").GetValue().GetString());
descriptionEdit->SetValue(loadedTemplate.GetChild("description").GetValue().GetString());
authorTxt->SetLabel(_("By ")+loadedTemplate.GetChild("_ownerId").
GetChild("local").GetChild("username").GetValue().GetString());
RefreshParameters();
Layout();
}
void EventStoreDialog::RefreshParameters()
@@ -165,6 +195,7 @@ void EventStoreDialog::OnOkBtClick(wxCommandEvent& event)
}
void EventStoreDialog::OnSearchCtrlText(wxCommandEvent& event)
{
RefreshList();
}
void EventStoreDialog::OnSelectionChanged(wxCommandEvent& event)
@@ -183,7 +214,7 @@ void EventStoreDialog::OnSelectionChanged(wxCommandEvent& event)
else
{
nameTxt->SetLabel("Unable to load the template");
descriptionTxt->SetLabel("An error occured during the loading (Code: "+gd::ToString(status)+" )");
descriptionEdit->SetValue("An error occured during the loading (Code: "+gd::ToString(status)+" )");
}
}

View File

@@ -41,8 +41,13 @@ public:
*/
const gd::GroupEvent & GetGroupEvent() { return groupEvent; }
virtual ~EventStoreDialog();
/**
* \brief Update the dialog to show the specified template with the parameters
* filled with the specified content.
**/
void RefreshWith(std::string templateId, const std::vector<std::string> & parameters);
virtual ~EventStoreDialog();
protected:
virtual void OnCancelBtClick(wxCommandEvent& event);
@@ -62,13 +67,13 @@ protected:
gd::Layout & layout;
gd::SerializerElement loadedTemplate;
gd::SerializerElement templates;
static gd::SerializerElement * templates;
static const std::string host;
static const int port;
gd::GroupEvent groupEvent; ///< The event group created from the template
sf::Http::Response::Status FetchTemplates();
sf::Http::Response::Status FetchTemplate(std::string id);
sf::Http::Response::Status FetchTemplates(bool forceFetch = false);
void RefreshTemplate();
void RefreshList();
void RefreshParameters();

View File

@@ -111,7 +111,7 @@ BaseGroupEventDialog::BaseGroupEventDialog(wxWindow* parent, wxWindowID id, cons
bBitmapLoaded = true;
}
wxFlexGridSizer* flexGridSizer41 = new wxFlexGridSizer(0, 1, 0, 0);
wxFlexGridSizer* flexGridSizer41 = new wxFlexGridSizer(4, 1, 0, 0);
flexGridSizer41->SetFlexibleDirection( wxBOTH );
flexGridSizer41->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
flexGridSizer41->AddGrowableCol(0);
@@ -229,46 +229,72 @@ BaseEventStoreDialog::BaseEventStoreDialog(wxWindow* parent, wxWindowID id, cons
flexGridSizer853->Add(templatesList, 0, wxALL|wxEXPAND, 5);
templatesList->SetMinSize(wxSize(200,-1));
searchCtrl5 = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1,-1), 0);
searchCtrl = new wxSearchCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1,-1), 0);
searchCtrl->SetFocus();
flexGridSizer853->Add(searchCtrl5, 0, wxALL|wxEXPAND, 5);
flexGridSizer853->Add(searchCtrl, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, 5);
wxFlexGridSizer* flexGridSizer916 = new wxFlexGridSizer(0, 1, 0, 0);
flexGridSizer916->SetFlexibleDirection( wxBOTH );
flexGridSizer916->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
flexGridSizer916->AddGrowableCol(0);
flexGridSizer916->AddGrowableRow(3);
wxBoxSizer* boxSizer145 = new wxBoxSizer(wxVERTICAL);
boxSizer134->Add(flexGridSizer916, 3, wxALL|wxEXPAND, 0);
boxSizer134->Add(boxSizer145, 3, wxALL|wxEXPAND, 0);
nameTxt = new wxStaticText(this, wxID_ANY, _("No template chosen"), wxDefaultPosition, wxSize(-1,-1), 0);
wxFont nameTxtFont(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Segoe UI"));
nameTxt->SetFont(nameTxtFont);
flexGridSizer916->Add(nameTxt, 0, wxALL, 5);
boxSizer145->Add(nameTxt, 0, wxALL|wxEXPAND, 5);
nameTxt->SetMinSize(wxSize(350,-1));
descriptionTxt = new wxStaticText(this, wxID_ANY, _("Choose a template in the list"), wxDefaultPosition, wxSize(-1,-1), 0);
authorTxt = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1,-1), wxALIGN_RIGHT);
flexGridSizer916->Add(descriptionTxt, 0, wxALL, 5);
boxSizer145->Add(authorTxt, 0, wxLEFT|wxRIGHT|wxALIGN_RIGHT, 5);
wxBoxSizer* boxSizer146 = new wxBoxSizer(wxVERTICAL);
boxSizer145->Add(boxSizer146, 0, wxALL|wxEXPAND, 0);
descriptionEdit = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1,-1), wxTE_READONLY|wxTE_MULTILINE);
boxSizer146->Add(descriptionEdit, 0, wxALL|wxEXPAND, 5);
descriptionEdit->SetMinSize(wxSize(-1,55));
m_staticLine979 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), wxLI_HORIZONTAL);
flexGridSizer916->Add(m_staticLine979, 0, wxALL|wxEXPAND, 5);
boxSizer145->Add(m_staticLine979, 0, wxLEFT|wxRIGHT|wxEXPAND, 5);
m_scrollWin148 = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), wxVSCROLL);
m_scrollWin148->SetScrollRate(0, 5);
boxSizer145->Add(m_scrollWin148, 1, wxALL|wxEXPAND, 0);
wxGridSizer* gridSizer150 = new wxGridSizer(0, 1, 0, 0);
m_scrollWin148->SetSizer(gridSizer150);
parametersSizer = new wxFlexGridSizer(0, 3, 0, 0);
flexGridSizer916->Add(parametersSizer, 0, wxALL|wxEXPAND, 5);
gridSizer150->Add(parametersSizer, 1, wxALL|wxEXPAND, 0);
m_staticLine7911 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), wxLI_HORIZONTAL);
flexGridSizer731->Add(m_staticLine7911, 0, wxALL|wxEXPAND, 0);
wxFlexGridSizer* flexGridSizer7712 = new wxFlexGridSizer(0, 2, 0, 0);
wxFlexGridSizer* flexGridSizer7712 = new wxFlexGridSizer(0, 4, 0, 0);
flexGridSizer7712->SetFlexibleDirection( wxBOTH );
flexGridSizer7712->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
flexGridSizer7712->AddGrowableCol(0);
flexGridSizer7712->AddGrowableCol(1);
flexGridSizer731->Add(flexGridSizer7712, 1, wxALL|wxEXPAND, 0);
m_staticBitmap631 = new wxStaticBitmap(this, wxID_ANY, wxXmlResource::Get()->LoadBitmap(wxT("help16")), wxDefaultPosition, wxSize(-1,-1), 0 );
flexGridSizer7712->Add(m_staticBitmap631, 0, wxALL, 5);
m_hyperLink652 = new wxHyperlinkCtrl(this, wxID_ANY, _("Help"), wxT("http://wiki.compilgames.net/doku.php/en/game_develop/documentation/manual/event_store"), wxDefaultPosition, wxSize(-1,-1), wxHL_DEFAULT_STYLE);
m_hyperLink652->SetNormalColour(wxColour(wxT("#0000FF")));
m_hyperLink652->SetHoverColour(wxColour(wxT("#0000FF")));
m_hyperLink652->SetVisitedColour(wxColour(wxT("#FF0000")));
flexGridSizer7712->Add(m_hyperLink652, 0, wxRIGHT, 5);
okBt = new wxButton(this, wxID_ANY, _("Ok"), wxDefaultPosition, wxSize(-1,-1), 0);
flexGridSizer7712->Add(okBt, 0, wxALL|wxALIGN_RIGHT, 5);
@@ -278,13 +304,13 @@ BaseEventStoreDialog::BaseEventStoreDialog(wxWindow* parent, wxWindowID id, cons
flexGridSizer7712->Add(cancelBt, 0, wxALL, 5);
SetMinSize( wxSize(500,300) );
SetSizeHints(600,300);
SetSizeHints(750,450);
if ( GetSizer() ) {
GetSizer()->Fit(this);
}
Centre(wxBOTH);
// Connect events
templatesList->Connect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(BaseEventStoreDialog::OnSelectionChanged), NULL, this);
searchCtrl->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(BaseEventStoreDialog::OnSearchCtrlText), NULL, this);
okBt->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BaseEventStoreDialog::OnOkBtClick), NULL, this);
cancelBt->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BaseEventStoreDialog::OnCancelBtClick), NULL, this);
@@ -292,7 +318,7 @@ BaseEventStoreDialog::BaseEventStoreDialog(wxWindow* parent, wxWindowID id, cons
BaseEventStoreDialog::~BaseEventStoreDialog()
{
templatesList->Disconnect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(BaseEventStoreDialog::OnSelectionChanged), NULL, this);
searchCtrl->Disconnect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(BaseEventStoreDialog::OnSearchCtrlText), NULL, this);
okBt->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BaseEventStoreDialog::OnOkBtClick), NULL, this);
cancelBt->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BaseEventStoreDialog::OnCancelBtClick), NULL, this);

View File

@@ -31,6 +31,8 @@
#include <wx/statbmp.h>
#include <wx/hyperlink.h>
#include <wx/htmllbox.h>
#include "wx/srchctrl.h"
#include <wx/scrolwin.h>
class LayersEditorPanelBase : public wxPanel
{
@@ -85,7 +87,7 @@ protected:
virtual void onCancelBtClick(wxCommandEvent& event) { event.Skip(); }
public:
BaseGroupEventDialog(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit the events group properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400,200), long style = wxDEFAULT_DIALOG_STYLE);
BaseGroupEventDialog(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit the events group properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400,200), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
virtual ~BaseGroupEventDialog();
};
@@ -94,22 +96,26 @@ class BaseEventStoreDialog : public wxDialog
{
protected:
wxSimpleHtmlListBox* templatesList;
wxTextCtrl* searchCtrl5;
wxSearchCtrl* searchCtrl;
wxStaticText* nameTxt;
wxStaticText* descriptionTxt;
wxStaticText* authorTxt;
wxTextCtrl* descriptionEdit;
wxStaticLine* m_staticLine979;
wxScrolledWindow* m_scrollWin148;
wxFlexGridSizer* parametersSizer;
wxStaticLine* m_staticLine7911;
wxStaticBitmap* m_staticBitmap631;
wxHyperlinkCtrl* m_hyperLink652;
wxButton* okBt;
wxButton* cancelBt;
protected:
virtual void OnSelectionChanged(wxCommandEvent& event) { event.Skip(); }
virtual void OnSearchCtrlText(wxCommandEvent& event) { event.Skip(); }
virtual void OnOkBtClick(wxCommandEvent& event) { event.Skip(); }
virtual void OnCancelBtClick(wxCommandEvent& event) { event.Skip(); }
public:
BaseEventStoreDialog(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Add a template from the event store"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,300), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX);
BaseEventStoreDialog(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Add a template from the event store"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(750,450), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX);
virtual ~BaseEventStoreDialog();
};

View File

@@ -1,7 +1,7 @@
{
"metadata": {
"m_generatedFilesDir": ".",
"m_objCounter": 134,
"m_objCounter": 152,
"m_includeFiles": [],
"m_bitmapFunction": "wxC629BInitBitmapResources",
"m_bitmapsFile": "GDCoreDialogs_dialogs_bitmaps.cpp",
@@ -883,7 +883,7 @@
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": ["wxDEFAULT_DIALOG_STYLE"],
"m_styles": ["wxDEFAULT_DIALOG_STYLE", "wxRESIZE_BORDER"],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"],
"m_properties": [{
"type": "string",
@@ -1007,7 +1007,7 @@
}, {
"type": "string",
"m_label": "# Rows:",
"m_value": "0"
"m_value": "4"
}, {
"type": "string",
"m_label": "Growable columns:",
@@ -1891,7 +1891,7 @@
"m_properties": [{
"type": "string",
"m_label": "Size:",
"m_value": "600,300"
"m_value": "750,450"
}, {
"type": "string",
"m_label": "Minimum Size:",
@@ -2159,14 +2159,7 @@
"m_label": "Style:",
"m_value": ""
}],
"m_events": [{
"m_eventName": "wxEVT_COMMAND_LISTBOX_SELECTED",
"m_eventClass": "wxCommandEvent",
"m_eventHandler": "wxCommandEventHandler",
"m_functionNameAndSignature": "OnSelectionChanged(wxCommandEvent& event)",
"m_description": "",
"m_noBody": false
}],
"m_events": [],
"m_children": [],
"m_templInfoName": "wxSimpleHtmlListBox"
}, {
@@ -2176,7 +2169,7 @@
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
@@ -2192,7 +2185,7 @@
}, {
"type": "string",
"m_label": "Name:",
"m_value": "searchCtrl5"
"m_value": "searchCtrl"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
@@ -2220,15 +2213,15 @@
}, {
"type": "bool",
"m_label": "Focused",
"m_value": false
"m_value": true
}, {
"type": "string",
"m_label": "Class Name:",
"m_value": ""
"m_value": " wxSearchCtrl "
}, {
"type": "string",
"m_label": "Include File:",
"m_value": ""
"m_value": "wx/srchctrl.h"
}, {
"type": "string",
"m_label": "Style:",
@@ -2250,11 +2243,18 @@
"m_label": "Auto Complete Files:",
"m_value": false
}],
"m_events": [],
"m_events": [{
"m_eventName": "wxEVT_COMMAND_TEXT_UPDATED",
"m_eventClass": "wxCommandEvent",
"m_eventHandler": "wxCommandEventHandler",
"m_functionNameAndSignature": "OnSearchCtrlText(wxCommandEvent& event)",
"m_description": "Respond to a wxEVT_COMMAND_TEXT_UPDATED event, generated when the text changes.\nNotice that this event will be sent when the text controls contents changes\n - whether this is due to user input or comes from the program itself\n(for example, if SetValue() is called); see ChangeValue() for a function which does not send this event.",
"m_noBody": false
}],
"m_children": []
}]
}, {
"m_type": 4403,
"m_type": 4401,
"proportion": 3,
"border": 0,
"gbSpan": "1,1",
@@ -2264,35 +2264,16 @@
"m_properties": [{
"type": "string",
"m_label": "Name:",
"m_value": "flexGridSizer916"
"m_value": "boxSizer145"
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "string",
"m_label": "# Columns:",
"m_value": "1"
}, {
"type": "string",
"m_label": "# Rows:",
"m_value": "0"
}, {
"type": "string",
"m_label": "Growable columns:",
"m_value": "0"
}, {
"type": "string",
"m_label": "Growable rows:",
"m_value": "3"
}, {
"type": "string",
"m_label": "Horizontal gap:",
"m_value": "0"
}, {
"type": "string",
"m_label": "Vertical gap:",
"m_value": "0"
"type": "choice",
"m_label": "Orientation:",
"m_selection": 0,
"m_options": ["wxVERTICAL", "wxHORIZONTAL"]
}],
"m_events": [],
"m_children": [{
@@ -2302,7 +2283,7 @@
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
@@ -2314,7 +2295,7 @@
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": "-1,-1"
"m_value": "350,-1"
}, {
"type": "string",
"m_label": "Name:",
@@ -2376,8 +2357,8 @@
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"],
"m_styles": ["wxALIGN_RIGHT"],
"m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxALIGN_RIGHT"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
@@ -2393,7 +2374,7 @@
}, {
"type": "string",
"m_label": "Name:",
"m_value": "descriptionTxt"
"m_value": "authorTxt"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
@@ -2437,7 +2418,7 @@
}, {
"type": "multi-string",
"m_label": "Label:",
"m_value": "Choose a template in the list"
"m_value": ""
}, {
"type": "string",
"m_label": "Wrap:",
@@ -2445,6 +2426,113 @@
}],
"m_events": [],
"m_children": []
}, {
"m_type": 4401,
"proportion": 0,
"border": 0,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "string",
"m_label": "Name:",
"m_value": "boxSizer146"
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "choice",
"m_label": "Orientation:",
"m_selection": 0,
"m_options": ["wxVERTICAL", "wxHORIZONTAL"]
}],
"m_events": [],
"m_children": [{
"m_type": 4406,
"proportion": 0,
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": ["wxTE_READONLY", "wxTE_MULTILINE"],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
"m_winid": "wxID_ANY"
}, {
"type": "string",
"m_label": "Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": "-1,55"
}, {
"type": "string",
"m_label": "Name:",
"m_value": "descriptionEdit"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
"m_value": ""
}, {
"type": "colour",
"m_label": "Bg Colour:",
"colour": "<Default>"
}, {
"type": "colour",
"m_label": "Fg Colour:",
"colour": "<Default>"
}, {
"type": "font",
"m_label": "Font:",
"m_value": ""
}, {
"type": "bool",
"m_label": "Hidden",
"m_value": false
}, {
"type": "bool",
"m_label": "Disabled",
"m_value": false
}, {
"type": "bool",
"m_label": "Focused",
"m_value": false
}, {
"type": "string",
"m_label": "Class Name:",
"m_value": ""
}, {
"type": "string",
"m_label": "Include File:",
"m_value": ""
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "string",
"m_label": "Value:",
"m_value": ""
}, {
"type": "string",
"m_label": "Max Length:",
"m_value": "0"
}, {
"type": "bool",
"m_label": "Auto Complete Directories:",
"m_value": false
}, {
"type": "bool",
"m_label": "Auto Complete Files:",
"m_value": false
}],
"m_events": [],
"m_children": []
}]
}, {
"m_type": 4418,
"proportion": 0,
@@ -2452,7 +2540,7 @@
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": ["wxLI_HORIZONTAL"],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxEXPAND"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
@@ -2513,12 +2601,12 @@
"m_events": [],
"m_children": []
}, {
"m_type": 4465,
"proportion": 0,
"border": 5,
"m_type": 4440,
"proportion": 1,
"border": 0,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_styles": ["wxVSCROLL"],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
@@ -2535,7 +2623,7 @@
}, {
"type": "string",
"m_label": "Name:",
"m_value": "parametersSizer"
"m_value": "m_scrollWin148"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
@@ -2576,10 +2664,120 @@
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "string",
"m_label": "Scroll Rate X:",
"m_value": "0"
}, {
"type": "string",
"m_label": "Scroll Rate Y:",
"m_value": "5"
}],
"m_events": [],
"m_children": [],
"m_templInfoName": "wxFlexGridSizer"
"m_children": [{
"m_type": 4452,
"proportion": 1,
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "string",
"m_label": "Name:",
"m_value": "gridSizer150"
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "string",
"m_label": "# Columns:",
"m_value": "1"
}, {
"type": "string",
"m_label": "# Rows:",
"m_value": "0"
}, {
"type": "string",
"m_label": "Horizontal gap:",
"m_value": "0"
}, {
"type": "string",
"m_label": "Vertical gap:",
"m_value": "0"
}],
"m_events": [],
"m_children": [{
"m_type": 4465,
"proportion": 1,
"border": 0,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
"m_winid": "wxID_ANY"
}, {
"type": "string",
"m_label": "Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Name:",
"m_value": "parametersSizer"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
"m_value": ""
}, {
"type": "colour",
"m_label": "Bg Colour:",
"colour": "<Default>"
}, {
"type": "colour",
"m_label": "Fg Colour:",
"colour": "<Default>"
}, {
"type": "font",
"m_label": "Font:",
"m_value": ""
}, {
"type": "bool",
"m_label": "Hidden",
"m_value": false
}, {
"type": "bool",
"m_label": "Disabled",
"m_value": false
}, {
"type": "bool",
"m_label": "Focused",
"m_value": false
}, {
"type": "string",
"m_label": "Class Name:",
"m_value": ""
}, {
"type": "string",
"m_label": "Include File:",
"m_value": ""
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}],
"m_events": [],
"m_children": [],
"m_templInfoName": "wxFlexGridSizer"
}]
}]
}]
}]
}, {
@@ -2668,7 +2866,7 @@
}, {
"type": "string",
"m_label": "# Columns:",
"m_value": "2"
"m_value": "4"
}, {
"type": "string",
"m_label": "# Rows:",
@@ -2676,7 +2874,7 @@
}, {
"type": "string",
"m_label": "Growable columns:",
"m_value": "0"
"m_value": "1"
}, {
"type": "string",
"m_label": "Growable rows:",
@@ -2692,6 +2890,164 @@
}],
"m_events": [],
"m_children": [{
"m_type": 4409,
"proportion": 0,
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
"m_winid": "wxID_ANY"
}, {
"type": "string",
"m_label": "Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Name:",
"m_value": "m_staticBitmap631"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
"m_value": ""
}, {
"type": "colour",
"m_label": "Bg Colour:",
"colour": "<Default>"
}, {
"type": "colour",
"m_label": "Fg Colour:",
"colour": "<Default>"
}, {
"type": "font",
"m_label": "Font:",
"m_value": ""
}, {
"type": "bool",
"m_label": "Hidden",
"m_value": false
}, {
"type": "bool",
"m_label": "Disabled",
"m_value": false
}, {
"type": "bool",
"m_label": "Focused",
"m_value": false
}, {
"type": "string",
"m_label": "Class Name:",
"m_value": ""
}, {
"type": "string",
"m_label": "Include File:",
"m_value": ""
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "bitmapPicker",
"m_label": "Bitmap File:",
"m_path": "../../../../Binaries/Output/Release_Windows/res/icons_default/help16.png"
}],
"m_events": [],
"m_children": []
}, {
"m_type": 4438,
"proportion": 0,
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": ["wxHL_DEFAULT_STYLE"],
"m_sizerFlags": ["wxRIGHT"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
"m_winid": "wxID_ANY"
}, {
"type": "string",
"m_label": "Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Name:",
"m_value": "m_hyperLink652"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
"m_value": ""
}, {
"type": "colour",
"m_label": "Bg Colour:",
"colour": "<Default>"
}, {
"type": "colour",
"m_label": "Fg Colour:",
"colour": "<Default>"
}, {
"type": "font",
"m_label": "Font:",
"m_value": ""
}, {
"type": "bool",
"m_label": "Hidden",
"m_value": false
}, {
"type": "bool",
"m_label": "Disabled",
"m_value": false
}, {
"type": "bool",
"m_label": "Focused",
"m_value": false
}, {
"type": "string",
"m_label": "Class Name:",
"m_value": ""
}, {
"type": "string",
"m_label": "Include File:",
"m_value": ""
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "string",
"m_label": "Label:",
"m_value": "Help"
}, {
"type": "string",
"m_label": "URL:",
"m_value": "http://wiki.compilgames.net/doku.php/en/game_develop/documentation/manual/event_store"
}, {
"type": "colour",
"m_label": "Normal Colour:",
"colour": "#0000FF"
}, {
"type": "colour",
"m_label": "Visited Colour:",
"colour": "#FF0000"
}, {
"type": "colour",
"m_label": "Hover Colour:",
"colour": "#0000FF"
}],
"m_events": [],
"m_children": []
}, {
"m_type": 4400,
"proportion": 0,
"border": 5,

View File

@@ -45,7 +45,7 @@ void ParameterControlsHelper::UpdateControls(unsigned int count)
paramSpacers1.push_back(new wxPanel(window));
paramSpacers2.push_back(new wxPanel(window));
paramEdits.push_back(new wxTextCtrl( window, ID_EDITARRAY, "", wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "EditPara" + num )));
paramBmpBts.push_back(new wxBitmapButton( window, id, gd::CommonBitmapManager::Get()->expressionBt, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator, num));
paramBmpBts.push_back(new wxBitmapButton( window, id, gd::CommonBitmapManager::Get()->expressionBt, wxDefaultPosition, wxSize(32,-1), wxBU_AUTODRAW, wxDefaultValidator, num));
//Connecting events
window->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ParameterControlsHelper::OnParameterBtClick, this, id);

View File

@@ -53,6 +53,8 @@ public:
virtual ~ParameterControlsHelper() {};
ParameterControlsHelper & SetWindow(wxWindow * window_) { window = window_; return *this; };
/**
* \brief Set the sizer where controls must be created.
* \note The sizer must be contained inside the window set in the constructor.

View File

@@ -1603,18 +1603,15 @@ void EventsEditor::OnHelpBtClick(wxCommandEvent& event)
void EventsEditor::OnEventStoreBtClick( wxCommandEvent& event )
{
std::vector< EventItem > eventsSelected = selection.GetAllSelectedEventsWithoutSubEvents();
if ( eventsSelected.empty() || eventsSelected[0].eventsList == NULL )
{
gd::LogMessage(_("Please select an event before adding a template."));
return;
}
gd::EventStoreDialog dialog(this, game, scene);
if (dialog.ShowModal() != 1) return;
//Insert new events
eventsSelected[0].eventsList->InsertEvent(dialog.GetGroupEvent(), eventsSelected[0].positionInList);
std::vector< EventItem > eventsSelected = selection.GetAllSelectedEventsWithoutSubEvents();
if ( eventsSelected.empty() || eventsSelected[0].eventsList == NULL )
events->InsertEvent(dialog.GetGroupEvent());
else
eventsSelected[0].eventsList->InsertEvent(dialog.GetGroupEvent(), eventsSelected[0].positionInList);
ChangesMadeOnEvents();
}