summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-08-06 19:00:54 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-08-06 19:00:54 -0300
commit9890c1d2ca76dc936e23f5263a4fd296bfc68996 (patch)
treebe0d304ab3f3b19e3460eee5e0bbdf68d0028f12 /scene/gui
parent259418f8275371fc2f0bab6892caa4ef66b84240 (diff)
Likely with bugs and with some features are missing, as well as profiler support, but VisualScript should be more or less done!
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/graph_edit.cpp24
-rw-r--r--scene/gui/graph_edit.h2
-rw-r--r--scene/gui/graph_node.cpp33
-rw-r--r--scene/gui/graph_node.h14
-rw-r--r--scene/gui/text_edit.h4
5 files changed, 73 insertions, 4 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 888e884d87..458e51b4fd 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -100,6 +100,15 @@ void GraphEdit::get_connection_list(List<Connection> *r_connections) const {
*r_connections=connections;
}
+void GraphEdit::set_scroll_ofs(const Vector2& p_ofs) {
+
+ setting_scroll_ofs=true;
+ h_scroll->set_val(p_ofs.x);
+ v_scroll->set_val(p_ofs.y);
+ _update_scroll();
+ setting_scroll_ofs=false;
+}
+
Vector2 GraphEdit::get_scroll_ofs() const{
return Vector2(h_scroll->get_val(),v_scroll->get_val());
@@ -113,6 +122,10 @@ void GraphEdit::_scroll_moved(double) {
//must redraw grid
update();
}
+
+ if (!setting_scroll_ofs) {//in godot, signals on change value are avoided as a convention
+ emit_signal("scroll_offset_changed",get_scroll_ofs());
+ }
}
void GraphEdit::_update_scroll_offset() {
@@ -1042,6 +1055,7 @@ void GraphEdit::_bind_methods() {
ObjectTypeDB::bind_method(_MD("disconnect_node","from","from_port","to","to_port"),&GraphEdit::disconnect_node);
ObjectTypeDB::bind_method(_MD("get_connection_list"),&GraphEdit::_get_connection_list);
ObjectTypeDB::bind_method(_MD("get_scroll_ofs"),&GraphEdit::get_scroll_ofs);
+ ObjectTypeDB::bind_method(_MD("set_scroll_ofs","ofs"),&GraphEdit::set_scroll_ofs);
ObjectTypeDB::bind_method(_MD("set_zoom","p_zoom"),&GraphEdit::set_zoom);
ObjectTypeDB::bind_method(_MD("get_zoom"),&GraphEdit::get_zoom);
@@ -1079,6 +1093,7 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
ADD_SIGNAL(MethodInfo("_end_node_move"));
+ ADD_SIGNAL(MethodInfo("scroll_offset_changed",PropertyInfo(Variant::VECTOR2,"ofs")));
}
@@ -1109,6 +1124,13 @@ GraphEdit::GraphEdit() {
box_selecting = false;
dragging = false;
+ //set large minmax so it can scroll even if not resized yet
+ h_scroll->set_min(-10000);
+ h_scroll->set_max(10000);
+
+ v_scroll->set_min(-10000);
+ v_scroll->set_max(10000);
+
h_scroll->connect("value_changed", this,"_scroll_moved");
v_scroll->connect("value_changed", this,"_scroll_moved");
@@ -1149,6 +1171,6 @@ GraphEdit::GraphEdit() {
snap_amount->connect("value_changed",this,"_snap_value_changed");
zoom_hb->add_child(snap_amount);
-
+ setting_scroll_ofs=false;
}
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index ad20fbefce..6d35e1518f 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -107,6 +107,7 @@ private:
Rect2 box_selecting_rect;
List<GraphNode*> previus_selected;
+ bool setting_scroll_ofs;
bool right_disconnects;
bool updating;
List<Connection> connections;
@@ -188,6 +189,7 @@ public:
void add_valid_left_disconnect_type(int p_type);
void remove_valid_left_disconnect_type(int p_type);
+ void set_scroll_ofs(const Vector2& p_ofs);
Vector2 get_scroll_ofs() const;
void set_selected(Node* p_child);
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index a4776aebde..66d2725ad2 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -205,6 +205,20 @@ void GraphNode::_notification(int p_what) {
draw_style_box(sb,Rect2(Point2(),get_size()));
+ switch(overlay) {
+ case OVERLAY_DISABLED: {
+
+ } break;
+ case OVERLAY_BREAKPOINT: {
+
+ draw_style_box(get_stylebox("breakpoint"),Rect2(Point2(),get_size()));
+ } break;
+ case OVERLAY_POSITION: {
+ draw_style_box(get_stylebox("position"),Rect2(Point2(),get_size()));
+
+ } break;
+ }
+
int w = get_size().width-sb->get_minimum_size().x;
if (show_close)
@@ -605,6 +619,16 @@ Color GraphNode::get_modulate() const{
return modulate;
}
+void GraphNode::set_overlay(Overlay p_overlay) {
+
+ overlay=p_overlay;
+ update();
+}
+
+GraphNode::Overlay GraphNode::get_overlay() const{
+
+ return overlay;
+}
void GraphNode::_bind_methods() {
@@ -641,6 +665,9 @@ void GraphNode::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_show_close_button","show"),&GraphNode::set_show_close_button);
ObjectTypeDB::bind_method(_MD("is_close_button_visible"),&GraphNode::is_close_button_visible);
+ ObjectTypeDB::bind_method(_MD("set_overlay","overlay"),&GraphNode::set_overlay);
+ ObjectTypeDB::bind_method(_MD("get_overlay"),&GraphNode::get_overlay);
+
ADD_PROPERTY( PropertyInfo(Variant::STRING,"title"),_SCS("set_title"),_SCS("get_title"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"show_close"),_SCS("set_show_close_button"),_SCS("is_close_button_visible"));
@@ -648,9 +675,15 @@ void GraphNode::_bind_methods() {
ADD_SIGNAL(MethodInfo("dragged",PropertyInfo(Variant::VECTOR2,"from"),PropertyInfo(Variant::VECTOR2,"to")));
ADD_SIGNAL(MethodInfo("raise_request"));
ADD_SIGNAL(MethodInfo("close_request"));
+
+ BIND_CONSTANT( OVERLAY_DISABLED );
+ BIND_CONSTANT( OVERLAY_BREAKPOINT );
+ BIND_CONSTANT( OVERLAY_POSITION );
}
GraphNode::GraphNode() {
+
+ overlay=OVERLAY_DISABLED;
show_close=false;
connpos_dirty=true;
set_stop_mouse(false);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index 3e1729440e..e87fb15b93 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -34,8 +34,14 @@
class GraphNode : public Container {
OBJ_TYPE(GraphNode,Container);
+public:
-
+ enum Overlay {
+ OVERLAY_DISABLED,
+ OVERLAY_BREAKPOINT,
+ OVERLAY_POSITION
+ };
+private:
struct Slot {
bool enable_left;
@@ -78,6 +84,8 @@ class GraphNode : public Container {
Vector2 drag_from;
bool selected;
+ Overlay overlay;
+
Color modulate;
protected:
@@ -133,10 +141,14 @@ public:
void set_modulate(const Color& p_color);
Color get_modulate() const;
+ void set_overlay(Overlay p_overlay);
+ Overlay get_overlay() const;
+
virtual Size2 get_minimum_size() const;
GraphNode();
};
+VARIANT_ENUM_CAST( GraphNode::Overlay )
#endif // GRAPH_NODE_H
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index c3bdf7c856..f0301fc250 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -438,7 +438,7 @@ public:
bool is_highlight_all_occurrences_enabled() const;
bool is_selection_active() const;
int get_selection_from_line() const;
- int get_selection_from_column() const;
+ int get_selection_from_column() const;
int get_selection_to_line() const;
int get_selection_to_column() const;
String get_selection_text() const;
@@ -496,7 +496,7 @@ public:
String get_text_for_completion();
- virtual bool is_text_field() const;
+ virtual bool is_text_field() const;
TextEdit();
~TextEdit();
};