This commit is contained in:
Pandagrapher 2018-12-28 15:55:04 +01:00
parent 39c53119eb
commit 34ea953c23
2 changed files with 21 additions and 0 deletions

View File

@ -1314,6 +1314,8 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(int id)
{
printf("getSpot: %d\n", id);
MyMutex::MyLock lock(mTreeview);
SpotRow* r = new SpotRow();
Gtk::TreeModel::Children children = treemodel_->children();
@ -1352,6 +1354,8 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(int id)
std::vector<int>* ControlSpotPanel::getSpotIdList()
{
MyMutex::MyLock lock(mTreeview);
std::vector<int>* r = new std::vector<int>();
Gtk::TreeModel::Children children = treemodel_->children();
@ -1369,6 +1373,8 @@ int ControlSpotPanel::getSelectedSpot()
{
printf("getSelectedSpot\n");
MyMutex::MyLock lock(mTreeview);
const auto s = treeview_.get_selection();
// Check if treeview has row, otherwise return 0
@ -1387,6 +1393,8 @@ void ControlSpotPanel::setSelectedSpot(int id)
{
printf("setSelectedSpot: %d\n", id);
MyMutex::MyLock lock(mTreeview);
disableParamlistener(true);
Gtk::TreeModel::Children children = treemodel_->children();
@ -1407,6 +1415,8 @@ void ControlSpotPanel::setSelectedSpot(int id)
int ControlSpotPanel::getNewId()
{
MyMutex::MyLock lock(mTreeview);
// Looking for maximum used id
int max_row_id = 0;
Gtk::TreeModel::Children children = treemodel_->children();
@ -1428,6 +1438,8 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot)
{
printf("addControlSpot: %d\n", newSpot->id);
MyMutex::MyLock lock(mTreeview);
disableParamlistener(true);
Gtk::TreeModel::Row row = * (treemodel_->append());
row[spots_.id] = newSpot->id;
@ -1462,6 +1474,8 @@ int ControlSpotPanel::updateControlSpot(SpotRow* spot)
{
printf("updateControlSpot: %d\n", spot->id);
MyMutex::MyLock lock(mTreeview);
disableParamlistener(true);
Gtk::TreeModel::Children children = treemodel_->children();
@ -1506,6 +1520,8 @@ void ControlSpotPanel::deleteControlSpot(int id)
{
printf("deleteControlSpot: %d\n", id);
MyMutex::MyLock lock(mTreeview);
disableParamlistener(true);
Gtk::TreeModel::Children children = treemodel_->children();
@ -1517,6 +1533,7 @@ void ControlSpotPanel::deleteControlSpot(int id)
if (row[spots_.id] == id) {
deleteControlSpotCurve(row);
treemodel_->erase(iter);
break;
}
}

View File

@ -25,6 +25,7 @@
#include "adjuster.h"
#include "edit.h"
#include "guiutils.h"
#include "threadutils.h"
#include "toolpanel.h"
#include <gtkmm.h>
#include <string>
@ -328,6 +329,9 @@ private:
bool nameChanged_;
int eventType; // 0 = No event, 1 = Spot creation event, 2 = Spot deletion event, 3 = Spot selection event
// Treeview mutex
MyMutex mTreeview;
};
#endif // _CONTROLSPOTPANEL_H_