Skip to content

Commit

Permalink
Wire up most of the functionality in the stims and responses tabs. Cu…
Browse files Browse the repository at this point in the history
…stom stims tab still missing.
  • Loading branch information
codereader committed Dec 30, 2019
1 parent 5955243 commit 5dd1974
Show file tree
Hide file tree
Showing 8 changed files with 4,027 additions and 3,882 deletions.
6,800 changes: 3,452 additions & 3,348 deletions install/ui/stimresponseeditor.fbp

Large diffs are not rendered by default.

1,050 changes: 528 additions & 522 deletions install/ui/stimresponseeditor.xrc

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions plugins/dm.stimresponse/ClassEditor.cpp
Expand Up @@ -397,7 +397,7 @@ void ClassEditor::onContextMenu(wxDataViewEvent& ev)

void ClassEditor::onStimTypeSelect(wxCommandEvent& ev)
{
if (_updatesDisabled || _type == NULL) return; // Callback loop guard
if (_updatesDisabled || _type == nullptr) return; // Callback loop guard

std::string name = getStimTypeIdFromSelector(_type);

Expand All @@ -410,10 +410,10 @@ void ClassEditor::onStimTypeSelect(wxCommandEvent& ev)

void ClassEditor::onAddTypeSelect(wxCommandEvent& ev)
{
if (_updatesDisabled || _addType == NULL) return; // Callback loop guard
if (_updatesDisabled || _addType == nullptr) return; // Callback loop guard

wxComboBox* combo = dynamic_cast<wxComboBox*>(ev.GetEventObject());
assert(combo != NULL);
assert(combo != nullptr);

std::string name = getStimTypeIdFromSelector(combo);

Expand Down
24 changes: 22 additions & 2 deletions plugins/dm.stimresponse/ResponseEditor.cpp
Expand Up @@ -161,8 +161,6 @@ void ResponseEditor::setupPage()
_type->SetName("ResponseEditorTypeCombo");
#endif

_stimTypes.populateComboBox(_type);

_type->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(ResponseEditor::onStimTypeSelect), NULL, this);

// Active
Expand Down Expand Up @@ -196,6 +194,28 @@ void ResponseEditor::setupPage()
makeLabelBold(_mainPanel, "ResponseEditorFXLabel");

createEffectWidgets();

_addType = findNamedObject<wxBitmapComboBox>(_mainPanel, "ResponseTypeComboBox");
_addType->Bind(wxEVT_COMBOBOX, std::bind(&ResponseEditor::onAddTypeSelect, this, std::placeholders::_1));

auto addButton = findNamedObject<wxButton>(_mainPanel, "AddResponseButton");
auto removeButton = findNamedObject<wxButton>(_mainPanel, "RemoveResponseButton");

addButton->Bind(wxEVT_BUTTON, std::bind(&ResponseEditor::onAddSR, this, std::placeholders::_1));
removeButton->Bind(wxEVT_BUTTON, std::bind(&ResponseEditor::onRemoveSR, this, std::placeholders::_1));

reloadStimTypes();
}

void ResponseEditor::reloadStimTypes()
{
if (_stimTypes.getStimMap().empty())
{
_stimTypes.reload();
}

_stimTypes.populateComboBox(_addType);
_stimTypes.populateComboBox(_type);
}

void ResponseEditor::createEffectWidgets()
Expand Down
2 changes: 2 additions & 0 deletions plugins/dm.stimresponse/ResponseEditor.h
Expand Up @@ -57,6 +57,8 @@ class ResponseEditor :
*/
void update() override;

void reloadStimTypes();

private:
/** greebo: Updates the associated text fields when a check box
* is toggled.
Expand Down
18 changes: 15 additions & 3 deletions plugins/dm.stimresponse/StimEditor.cpp
Expand Up @@ -37,15 +37,27 @@ void StimEditor::setupPage()

setupEditPanel();

auto addType = findNamedObject<wxBitmapComboBox>(_mainPanel, "StimTypeComboBox");

addType->Bind(wxEVT_COMBOBOX, std::bind(&StimEditor::onAddTypeSelect, this, std::placeholders::_1));
_addType = findNamedObject<wxBitmapComboBox>(_mainPanel, "StimTypeComboBox");
_addType->Bind(wxEVT_COMBOBOX, std::bind(&StimEditor::onAddTypeSelect, this, std::placeholders::_1));

auto addButton = findNamedObject<wxButton>(_mainPanel, "AddStimButton");
auto removeButton = findNamedObject<wxButton>(_mainPanel, "RemoveStimButton");

addButton->Bind(wxEVT_BUTTON, std::bind(&StimEditor::onAddSR, this, std::placeholders::_1));
removeButton->Bind(wxEVT_BUTTON, std::bind(&StimEditor::onRemoveSR, this, std::placeholders::_1));

reloadStimTypes();
}

void StimEditor::reloadStimTypes()
{
if (_stimTypes.getStimMap().empty())
{
_stimTypes.reload();
}

_stimTypes.populateComboBox(_addType);
_stimTypes.populateComboBox(_type);
}

void StimEditor::setEntity(const SREntityPtr& entity)
Expand Down
2 changes: 2 additions & 0 deletions plugins/dm.stimresponse/StimEditor.h
Expand Up @@ -99,6 +99,8 @@ class StimEditor :
*/
void update() override;

void reloadStimTypes();

private:
/** greebo: Retrieves the formatted timer string h:m:s:ms
*/
Expand Down
7 changes: 3 additions & 4 deletions plugins/dm.stimresponse/StimResponseEditor.cpp
Expand Up @@ -89,9 +89,8 @@ void StimResponseEditor::populateWindow()

_notebook = findNamedObject<wxNotebook>(this, "SREditorNotebook");

// Set up the list containing the stims and responses

_stimEditor = new StimEditor(mainPanel, _stimTypes);
_responseEditor = new ResponseEditor(mainPanel, _stimTypes);

#if 0
SetSizer(new wxBoxSizer(wxVERTICAL));
Expand Down Expand Up @@ -128,9 +127,9 @@ void StimResponseEditor::populateWindow()
findNamedObject<wxButton>(this, "SREditorCancelButton")->Bind(
wxEVT_BUTTON, [this](wxCommandEvent& ev) { EndModal(wxID_CANCEL); });

if (_lastShownPage == -1 && _notebook->GetPageCount() > 0)
if (_lastShownPage == -1)
{
_lastShownPage = -1;
_lastShownPage = 0;
}

Layout();
Expand Down

0 comments on commit 5dd1974

Please sign in to comment.