Added small icon to expand the bottom panel (and shortcut too)

This commit is contained in:
Juan Linietsky 2018-07-15 22:38:14 -03:00
parent a3f1ee5c57
commit af7d8fb844
4 changed files with 181 additions and 2 deletions

View file

@ -3861,7 +3861,7 @@ ToolButton *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) {
tb->set_focus_mode(Control::FOCUS_NONE);
bottom_panel_vb->add_child(p_item);
bottom_panel_hb->raise();
bottom_panel_hb->add_child(tb);
bottom_panel_hb_editors->add_child(tb);
p_item->set_v_size_flags(Control::SIZE_EXPAND_FILL);
p_item->hide();
BottomPanelItem bpi;
@ -3925,7 +3925,7 @@ void EditorNode::remove_bottom_panel_item(Control *p_item) {
_bottom_panel_switch(false, 0);
}
bottom_panel_vb->remove_child(bottom_panel_items[i].control);
bottom_panel_hb->remove_child(bottom_panel_items[i].button);
bottom_panel_hb_editors->remove_child(bottom_panel_items[i].button);
memdelete(bottom_panel_items[i].button);
bottom_panel_items.remove(i);
break;
@ -3955,6 +3955,11 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
}
center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE);
center_split->set_collapsed(false);
if (bottom_panel_raise->is_pressed()) {
top_split->hide();
}
bottom_panel_raise->show();
} else {
bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
for (int i = 0; i < bottom_panel_items.size(); i++) {
@ -3964,6 +3969,10 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
}
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
center_split->set_collapsed(true);
bottom_panel_raise->hide();
if (bottom_panel_raise->is_pressed()) {
top_split->show();
}
}
}
@ -4373,6 +4382,17 @@ Vector<Ref<EditorResourceConversionPlugin> > EditorNode::find_resource_conversio
return ret;
}
void EditorNode::_bottom_panel_raise_toggled(bool p_pressed) {
if (p_pressed) {
top_split->hide();
bottom_panel_raise->set_icon(gui_base->get_icon("ShrinkBottomDock", "EditorIcons"));
} else {
top_split->show();
bottom_panel_raise->set_icon(gui_base->get_icon("ExpandBottomDock", "EditorIcons"));
}
}
void EditorNode::_bind_methods() {
ClassDB::bind_method("_menu_option", &EditorNode::_menu_option);
@ -4441,6 +4461,7 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout);
ClassDB::bind_method(D_METHOD("_resources_reimported"), &EditorNode::_resources_reimported);
ClassDB::bind_method(D_METHOD("_bottom_panel_raise_toggled"), &EditorNode::_bottom_panel_raise_toggled);
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
@ -5269,6 +5290,19 @@ EditorNode::EditorNode() {
bottom_panel_hb = memnew(HBoxContainer);
bottom_panel_vb->add_child(bottom_panel_hb);
bottom_panel_hb_editors = memnew(HBoxContainer);
bottom_panel_hb_editors->set_h_size_flags(Control::SIZE_EXPAND_FILL);
bottom_panel_hb->add_child(bottom_panel_hb_editors);
bottom_panel_raise = memnew(ToolButton);
bottom_panel_raise->set_icon(gui_base->get_icon("ExpandBottomDock", "EditorIcons"));
bottom_panel_raise->set_shortcut(ED_SHORTCUT("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KEY_MASK_SHIFT | KEY_F12));
bottom_panel_hb->add_child(bottom_panel_raise);
bottom_panel_raise->hide();
bottom_panel_raise->set_toggle_mode(true);
bottom_panel_raise->connect("toggled", this, "_bottom_panel_raise_toggled");
log = memnew(EditorLog);
ToolButton *output_button = add_bottom_panel_item(TTR("Output"), log);
log->set_tool_button(output_button);

View file

@ -377,7 +377,11 @@ private:
PanelContainer *bottom_panel;
HBoxContainer *bottom_panel_hb;
HBoxContainer *bottom_panel_hb_editors;
VBoxContainer *bottom_panel_vb;
ToolButton *bottom_panel_raise;
void _bottom_panel_raise_toggled(bool);
EditorInterface *editor_interface;

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
version="1.1"
viewBox="0 0 16 16"
id="svg6"
sodipodi:docname="icon_expand_bottom_dock.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1853"
inkscape:window-height="1016"
id="namedview8"
showgrid="false"
inkscape:zoom="20.85965"
inkscape:cx="9.4509357"
inkscape:cy="6.016355"
inkscape:window-x="67"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg6" />
<path
style="fill:#e0e0e0"
d="M 4.2130251,4.516057 0.6774912,8.0515909 H 3.2131761 V 13.025308 H 5.2130155 V 8.0515909 H 7.7487004 L 4.2131665,4.516057 Z"
id="path829"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
inkscape:connector-curvature="0"
id="path831"
d="M 11.907306,4.6119359 8.3717718,8.1474698 h 2.5356852 v 4.9737172 h 1.999839 V 8.1474698 h 2.535685 L 11.907447,4.6119359 Z"
style="fill:#e0e0e0"
sodipodi:nodetypes="ccccccccc" />
<rect
style="fill:#e0e0e0;fill-opacity:1"
id="rect855"
width="14"
height="1.8305085"
x="1.2881356"
y="1.3700738" />
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
version="1.1"
viewBox="0 0 16 16"
id="svg6"
sodipodi:docname="icon_shrink_bottom_dock.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1853"
inkscape:window-height="1016"
id="namedview8"
showgrid="false"
inkscape:zoom="20.85965"
inkscape:cx="9.4509357"
inkscape:cy="6.016355"
inkscape:window-x="67"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg6" />
<path
style="fill:#e0e0e0"
d="M 11.907447,9.9752038 15.442981,6.4396699 H 12.907296 V 1.4659528 h -1.999839 l 0,4.9737171 -2.5356852,0 3.5355342,3.5355339 z"
id="path829"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
inkscape:connector-curvature="0"
id="path831"
d="M 4.2131662,9.8793249 7.7487004,6.343791 H 5.2130152 V 1.3700738 H 3.2131762 V 6.343791 h -2.535685 l 3.535534,3.5355339 z"
style="fill:#e0e0e0"
sodipodi:nodetypes="ccccccccc" />
<rect
style="fill:#e0e0e0;fill-opacity:1"
id="rect855"
width="14"
height="1.8305085"
x="-14.832336"
y="-13.121187"
transform="scale(-1)" />
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB