fix place 2 issues

calc dockable field size with wrong size for the percentage weight
crash when access a non-existing dockable field
This commit is contained in:
Jinhao 2015-10-19 20:53:46 +08:00
parent 1326bae10f
commit 65f5d5f494

View File

@ -1939,7 +1939,7 @@ namespace nana
double weight; double weight;
if (child->weight.is_not_none()) if (child->weight.is_not_none())
{ {
weight = child->weight.get_value(is_vert ? area.height : area.width); weight = child->weight.get_value(is_vert ? room.height : room.width);
if (weight > room_px) if (weight > room_px)
weight = room_px; weight = room_px;
} }
@ -2800,7 +2800,7 @@ namespace nana
} }
//Create the pane if it has not a name //Create the pane if it has not a name
if (factory_name.empty()) if (factory_name.empty() && dock_ptr->attached)
{ {
dock_ptr->attached->set_display(true); dock_ptr->attached->set_display(true);
impl_->collocate(); impl_->collocate();
@ -2825,6 +2825,8 @@ namespace nana
throw std::invalid_argument("invalid factory name(" + factory + ") of dockpane"); throw std::invalid_argument("invalid factory name(" + factory + ") of dockpane");
auto dock_ptr = i->second; auto dock_ptr = i->second;
if (dock_ptr->attached)
{
dock_ptr->attached->set_display(true); dock_ptr->attached->set_display(true);
impl_->collocate(); impl_->collocate();
@ -2837,6 +2839,7 @@ namespace nana
} }
dock_ptr->dockarea->add_pane(i->second->factories[factory]); dock_ptr->dockarea->add_pane(i->second->factories[factory]);
}
return *this; return *this;
} }