Browse Source

crash guard, remove some debug

Odilitime 5 years ago
parent
commit
c4c1ca8b60
  1. 14
      src/graphics/components/TabbedComponent.cpp

14
src/graphics/components/TabbedComponent.cpp

@ -361,7 +361,7 @@ void TabbedComponent::selectTab(std::shared_ptr<Tab> tab) { @@ -361,7 +361,7 @@ void TabbedComponent::selectTab(std::shared_ptr<Tab> tab) {
i++;
}
//std::cout << "i" << i << "/" << this->tabs.size() << std::endl;
std::cout << "TabbedComponent::selectTab - selector found: " << found << std::endl;
//std::cout << "TabbedComponent::selectTab - selector found: " << found << std::endl;
if (found) {
// was there a previously selected tab?
//if (this->selectedTab != this->tabs.end() && this->selectedTab != this->tabs.begin()) {
@ -408,7 +408,11 @@ void TabbedComponent::selectTab(std::shared_ptr<Tab> tab) { @@ -408,7 +408,11 @@ void TabbedComponent::selectTab(std::shared_ptr<Tab> tab) {
// doesn't move, will this double free?
this->mpSelectedTab = tab; // pointer
this->updateWindowState(ab->getValue());
if (ab) {
this->updateWindowState(ab->getValue());
} else {
std::cout << "TabbedComponent::selectTab - cant update window no address bar" << std::endl;
}
}
// we expect the tab to be set up (all components allocated)
@ -572,7 +576,7 @@ void TabbedComponent::removeTab(size_t tabId) { @@ -572,7 +576,7 @@ void TabbedComponent::removeTab(size_t tabId) {
std::vector<std::shared_ptr<Tab>>::iterator prev = this->tabs.begin();
for(std::vector<std::shared_ptr<Tab>>::iterator it = this->tabs.begin(); it!=this->tabs.end(); prev = it, ++it) {
if (it->get()->id == tabId) {
std::cout << "TabbedComponent::removeTab - found our tab" << std::endl;
//std::cout << "TabbedComponent::removeTab - found our tab" << std::endl;
// remove our components form the component tree
std::vector<std::shared_ptr<Component>>::iterator it2;
it2 = std::find(this->rootComponent->children.begin(), this->rootComponent->children.end(), it->get()->selectorBox);
@ -601,7 +605,7 @@ void TabbedComponent::removeTab(size_t tabId) { @@ -601,7 +605,7 @@ void TabbedComponent::removeTab(size_t tabId) {
// unload components
docComponent->setDOM(std::make_shared<Node>(NodeType::ROOT));
} else {
std::cout << "our contents aren't a document component" << std::endl;
std::cout << "TabbedComponent::removeTab - our contents aren't a document component" << std::endl;
}
it2->get()->parent = nullptr;
this->rootComponent->children.erase(it2);
@ -650,7 +654,7 @@ void TabbedComponent::removeTab(size_t tabId) { @@ -650,7 +654,7 @@ void TabbedComponent::removeTab(size_t tabId) {
}
// we need to move (relayout) all remove tabs after this id
if (found) {
std::cout << "TabbedComponent::removeTab - Need to adjust: " << it->get()->id << std::endl;
//std::cout << "TabbedComponent::removeTab - Need to adjust: " << it->get()->id << std::endl;
it->get()->titleBox->x -= widthToRemove;
it->get()->titleBox->resize(windowWidth, windowHeight); // TextComponent, need a resize() to move vertices
it->get()->selectorBox->x -= widthToRemove;

Loading…
Cancel
Save