Rewrote ConnectionsDialog to use containers, should work fine on HiDPI, closes #5608
This commit is contained in:
parent
ef2f6a18d2
commit
e88e0607f8
|
@ -294,47 +294,33 @@ void ConnectDialog::_bind_methods() {
|
|||
|
||||
ConnectDialog::ConnectDialog() {
|
||||
|
||||
int margin = get_constant("margin","Dialogs");
|
||||
int button_margin = get_constant("button_margin","Dialogs");
|
||||
VBoxContainer *vbc = memnew( VBoxContainer );
|
||||
add_child(vbc);
|
||||
set_child_rect(vbc);
|
||||
|
||||
HBoxContainer *main_hb = memnew( HBoxContainer );
|
||||
vbc->add_child(main_hb);
|
||||
main_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
Label * label = memnew( Label );
|
||||
label->set_pos( Point2( 8,11) );
|
||||
label->set_text(TTR("Connect To Node:"));
|
||||
|
||||
|
||||
add_child(label);
|
||||
label = memnew( Label );
|
||||
label->set_anchor( MARGIN_LEFT, ANCHOR_RATIO );
|
||||
label->set_pos( Point2( 0.5,11) );
|
||||
label->set_text(TTR("Binds (Extra Params):"));
|
||||
add_child(label);
|
||||
VBoxContainer *vbc_left = memnew( VBoxContainer );
|
||||
main_hb->add_child(vbc_left);
|
||||
vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
|
||||
tree = memnew(SceneTreeEditor(false));
|
||||
tree->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO );
|
||||
tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
|
||||
tree->set_begin( Point2( 15,32) );
|
||||
tree->set_end( Point2( 0.5,127 ) );
|
||||
vbc_left->add_margin_child(TTR("Conect To Node:"),tree,true);
|
||||
|
||||
add_child(tree);
|
||||
|
||||
bind_editor = memnew( PropertyEditor );
|
||||
bind_editor->set_anchor( MARGIN_RIGHT, ANCHOR_END );
|
||||
bind_editor->set_anchor( MARGIN_LEFT, ANCHOR_RATIO );
|
||||
bind_editor->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
|
||||
bind_editor->set_begin( Point2( 0.51,42) );
|
||||
bind_editor->set_end( Point2( 15,127 ) );
|
||||
bind_editor->get_top_label()->hide();
|
||||
|
||||
add_child(bind_editor);
|
||||
VBoxContainer *vbc_right = memnew( VBoxContainer );
|
||||
main_hb->add_child(vbc_right);
|
||||
vbc_right->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
HBoxContainer *add_bind_hb = memnew( HBoxContainer );
|
||||
|
||||
type_list = memnew( OptionButton );
|
||||
type_list->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO );
|
||||
type_list->set_anchor( MARGIN_LEFT, ANCHOR_RATIO );
|
||||
type_list->set_begin( Point2( 0.51,32) );
|
||||
type_list->set_end( Point2( 0.75,33 ) );
|
||||
add_child(type_list);
|
||||
type_list->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
add_bind_hb->add_child(type_list);
|
||||
|
||||
|
||||
type_list->add_item("bool",Variant::BOOL);
|
||||
|
@ -356,65 +342,36 @@ ConnectDialog::ConnectDialog() {
|
|||
type_list->select(0);
|
||||
|
||||
Button *add_bind = memnew( Button );
|
||||
add_bind->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO );
|
||||
add_bind->set_anchor( MARGIN_LEFT, ANCHOR_RATIO );
|
||||
add_bind->set_begin( Point2( 0.76,32) );
|
||||
add_bind->set_end( Point2( 0.84,33 ) );
|
||||
|
||||
add_bind->set_text(TTR("Add"));
|
||||
add_child(add_bind);
|
||||
add_bind_hb->add_child(add_bind);
|
||||
add_bind->connect("pressed",this,"_add_bind");
|
||||
|
||||
Button *del_bind = memnew( Button );
|
||||
del_bind->set_anchor( MARGIN_RIGHT, ANCHOR_END );
|
||||
del_bind->set_anchor( MARGIN_LEFT, ANCHOR_RATIO );
|
||||
del_bind->set_begin( Point2( 0.85,32) );
|
||||
del_bind->set_end( Point2( 15,33 ) );
|
||||
del_bind->set_text(TTR("Remove"));
|
||||
add_child(del_bind);
|
||||
add_bind_hb->add_child(del_bind);
|
||||
del_bind->connect("pressed",this,"_remove_bind");
|
||||
|
||||
vbc_right->add_margin_child(TTR("Add Extra Call Argument:"),add_bind_hb);
|
||||
|
||||
bind_editor = memnew( PropertyEditor );
|
||||
bind_editor->hide_top_label();
|
||||
|
||||
vbc_right->add_margin_child(TTR("Extra Call Arguments:"),bind_editor,true);
|
||||
|
||||
label = memnew( Label );
|
||||
label->set_anchor( MARGIN_TOP, ANCHOR_END );
|
||||
label->set_begin( Point2( 8,124) );
|
||||
label->set_end( Point2( 15,99) );
|
||||
label->set_text(TTR("Path To Node:"));
|
||||
|
||||
add_child(label);
|
||||
|
||||
dst_path = memnew(LineEdit);
|
||||
dst_path->set_anchor( MARGIN_TOP, ANCHOR_END );
|
||||
dst_path->set_anchor( MARGIN_RIGHT, ANCHOR_END );
|
||||
dst_path->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
|
||||
dst_path->set_begin( Point2( 15,105) );
|
||||
dst_path->set_end( Point2( 15,80 ) );
|
||||
|
||||
add_child(dst_path);
|
||||
|
||||
label = memnew( Label );
|
||||
label->set_anchor( MARGIN_TOP, ANCHOR_END );
|
||||
label->set_anchor( MARGIN_RIGHT, ANCHOR_END );
|
||||
label->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
|
||||
label->set_begin( Point2( 8,78 ) );
|
||||
label->set_end( Point2( 15,52 ) );
|
||||
label->set_text(TTR("Method In Node:"));
|
||||
add_child(label);
|
||||
vbc->add_margin_child(TTR("Path to Node:"),dst_path);
|
||||
|
||||
|
||||
HBoxContainer *dstm_hb = memnew( HBoxContainer );
|
||||
dstm_hb->set_anchor( MARGIN_TOP, ANCHOR_END );
|
||||
dstm_hb->set_anchor( MARGIN_RIGHT, ANCHOR_END );
|
||||
dstm_hb->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
|
||||
dstm_hb->set_begin( Point2( 15,59) );
|
||||
dstm_hb->set_end( Point2( 15,39 ) );
|
||||
add_child(dstm_hb);
|
||||
vbc->add_margin_child("Method In Node:",dstm_hb);
|
||||
|
||||
dst_method = memnew(LineEdit);
|
||||
dst_method->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
dstm_hb->add_child(dst_method);
|
||||
|
||||
|
||||
|
||||
/*dst_method_list = memnew( MenuButton );
|
||||
dst_method_list->set_text("List..");
|
||||
dst_method_list->set_anchor( MARGIN_RIGHT, ANCHOR_END );
|
||||
|
@ -567,6 +524,7 @@ void ConnectionsDock::_connect_pressed() {
|
|||
|
||||
connect_dialog->edit(node);
|
||||
connect_dialog->popup_centered_ratio();
|
||||
connect_dialog->set_title(TTR("Connecting Signal:")+" "+signalname);
|
||||
connect_dialog->set_dst_method("_on_"+midname+"_"+signal);
|
||||
connect_dialog->set_dst_node(node->get_owner()?node->get_owner():node);
|
||||
|
||||
|
|
Loading…
Reference in New Issue