diff options
Diffstat (limited to 'window.cpp')
-rw-r--r-- | window.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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); |