summaryrefslogtreecommitdiffstats
path: root/window.cpp
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2007-09-16 21:06:02 +0200
committerneoraider <devnull@localhost>2007-09-16 21:06:02 +0200
commit5ea7f0464eb13581322215f0614eaae52393e02a (patch)
tree073163463ab20fd00016a5fbcd56c6dcf9857182 /window.cpp
parent01e98d51fedf65ad71d468c3b0410d6e7764a384 (diff)
downloadzoomedit-5ea7f0464eb13581322215f0614eaae52393e02a.tar
zoomedit-5ea7f0464eb13581322215f0614eaae52393e02a.zip
zoomedit: C++ized Polygon
Diffstat (limited to 'window.cpp')
-rw-r--r--window.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/window.cpp b/window.cpp
index f2a2eda..db4ec32 100644
--- a/window.cpp
+++ b/window.cpp
@@ -52,7 +52,7 @@ static gboolean buttonEvent(GtkWidget *widget, GdkEventButton *event, gpointer u
viewToImage(&v);
if(isVertexOk(&v)) {
- addVertex(&getActiveRoom()->polygon, &v);
+ getActiveRoom()->polygon.push_back(v);
updateSidebar();
}
}
@@ -68,10 +68,11 @@ gboolean crossingNotifyEvent(GtkWidget *widget, GdkEventCrossing *event, gpointe
Vertex v(event->x, event->y);
+
switch(event->type) {
case GDK_ENTER_NOTIFY:
viewToImage(&v);
-
+
setHoveredVertex(&v);
break;
@@ -87,7 +88,6 @@ gboolean motionNotifyEvent(GtkWidget *widget, GdkEventMotion *event, gpointer us
Vertex v(event->x, event->y);
ROOM *last = getHoveredRoom();
-
viewToImage(&v);
setHoveredVertex(&v);
@@ -165,7 +165,7 @@ static void sidebarButtonClicked(GtkButton *button, gpointer user_data) {
gtk_widget_queue_draw(drawingArea);
}
else if(button == GTK_BUTTON(buttonAddDo)) {
- if(getActiveRoom() &&getActiveRoom()->polygon.nVertices > 2 && isPolygonOk(&getActiveRoom()->polygon)) {
+ if(getActiveRoom() && getActiveRoom()->polygon.size() > 2 && isPolygonOk(&getActiveRoom()->polygon)) {
addRoom(getLevel(), getActiveRoom());
setActiveRoom(&getLevel()->rooms[getLevel()->nRooms-1]);
}
@@ -313,11 +313,11 @@ void updateSidebar() {
gtk_entry_set_text(GTK_ENTRY(entryName), getActiveRoom()->name);
gtk_widget_set_sensitive(entryName, TRUE);
- string = g_strdup_printf("%.2f", polygonArea(&getActiveRoom()->polygon));
+ string = g_strdup_printf("%.2f", getActiveRoom()->polygon.area());
gtk_label_set_text(GTK_LABEL(labelArea), string);
g_free(string);
- string = g_strdup_printf("%.2f", polygonPerimeter(&getActiveRoom()->polygon));
+ string = g_strdup_printf("%.2f", getActiveRoom()->polygon.perimeter());
gtk_label_set_text(GTK_LABEL(labelPerimeter), string);
g_free(string);
}
@@ -335,7 +335,7 @@ void updateSidebar() {
gtk_widget_show(sidebarAdd);
if(getActiveRoom()) {
- if(getActiveRoom()->polygon.nVertices > 2 && isPolygonOk(&getActiveRoom()->polygon))
+ if(getActiveRoom()->polygon.size() > 2 && isPolygonOk(&getActiveRoom()->polygon))
gtk_widget_set_sensitive(buttonAddDo, TRUE);
else
gtk_widget_set_sensitive(buttonAddDo, FALSE);