Code

remove many unnecessary to_2geom and from_2geom calls
[inkscape.git] / src / interface.cpp
index 2e1fda1e5527a250220d4215e4314a75521f364c..0259ecb6602dd52d7f62c0f53e5a7cded9f1d31e 100644 (file)
@@ -89,15 +89,15 @@ typedef enum {
 } ui_drop_target_info;
 
 static GtkTargetEntry ui_drop_target_entries [] = {
-    {"text/uri-list", 0, URI_LIST},
-    {"image/svg+xml", 0, SVG_XML_DATA},
-    {"image/svg",     0, SVG_DATA},
-    {"image/png",     0, PNG_DATA},
-    {"image/jpeg",    0, JPEG_DATA},
+    {(gchar *)"text/uri-list",                0, URI_LIST        },
+    {(gchar *)"image/svg+xml",                0, SVG_XML_DATA    },
+    {(gchar *)"image/svg",                    0, SVG_DATA        },
+    {(gchar *)"image/png",                    0, PNG_DATA        },
+    {(gchar *)"image/jpeg",                   0, JPEG_DATA       },
 #if ENABLE_MAGIC_COLORS
-    {"application/x-inkscape-color", 0, APP_X_INKY_COLOR},
+    {(gchar *)"application/x-inkscape-color", 0, APP_X_INKY_COLOR},
 #endif // ENABLE_MAGIC_COLORS
-    {"application/x-color", 0, APP_X_COLOR}
+    {(gchar *)"application/x-color",          0, APP_X_COLOR     }
 };
 
 static GtkTargetEntry *completeDropTargets = 0;
@@ -152,6 +152,9 @@ sp_create_window(SPViewWidget *vw, gboolean editable)
 
     Gtk::Window *win = Inkscape::UI::window_new("", TRUE);
 
+    gtk_container_add(GTK_CONTAINER(win->gobj()), GTK_WIDGET(vw));
+    gtk_widget_show(GTK_WIDGET(vw));
+
     if (editable) {
                g_object_set_data(G_OBJECT(vw), "window", win);
                
@@ -160,16 +163,13 @@ sp_create_window(SPViewWidget *vw, gboolean editable)
                
                desktop_widget->window = win;
 
-        /* fixme: doesn't allow making window any smaller than this */
-        win->set_default_size(640, 480);
-               
         win->set_data("desktop", desktop);
         win->set_data("desktopwidget", desktop_widget);
                
         win->signal_delete_event().connect(sigc::mem_fun(*(SPDesktop*)vw->view, &SPDesktop::onDeleteUI));
                win->signal_window_state_event().connect(sigc::mem_fun(*desktop, &SPDesktop::onWindowStateEvent));
                win->signal_focus_in_event().connect(sigc::mem_fun(*desktop_widget, &SPDesktopWidget::onFocusInEvent));
-               
+       
         gint prefs_geometry = 
             (2==prefs_get_int_attribute("options.savewindowgeometry", "value", 0));
         if (prefs_geometry) {
@@ -217,9 +217,6 @@ sp_create_window(SPViewWidget *vw, gboolean editable)
         gtk_window_set_policy(GTK_WINDOW(win->gobj()), TRUE, TRUE, TRUE);
     }
 
-    gtk_container_add(GTK_CONTAINER(win->gobj()), GTK_WIDGET(vw));
-    gtk_widget_show(GTK_WIDGET(vw));
-
     if ( completeDropTargets == 0 || completeDropTargetsCount == 0 )
     {
         std::vector<gchar*> types;
@@ -1183,7 +1180,7 @@ sp_ui_drag_data_received(GtkWidget *widget,
                         Path *livarot_path = Path_for_item(item, true, true);
                         livarot_path->ConvertWithBackData(0.04);
 
-                        NR::Maybe<Path::cut_position> position = get_nearest_position_on_Path(livarot_path, button_doc);
+                        boost::optional<Path::cut_position> position = get_nearest_position_on_Path(livarot_path, button_doc);
                         if (position) {
                             NR::Point nearest = get_point_on_Path(livarot_path, position->piece, position->t);
                             NR::Point delta = nearest - button_doc;
@@ -1255,7 +1252,7 @@ sp_ui_drag_data_received(GtkWidget *widget,
                 int const saved_pref = prefs_get_int_attribute("options.transform", "pattern", 1);
                 prefs_set_int_attribute("options.transform", "pattern", 1);
                 sp_document_ensure_up_to_date(sp_desktop_document(desktop));
-                NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+                boost::optional<NR::Rect> sel_bbox = selection->bounds();
                 if (sel_bbox) {
                     NR::Point m( desktop->point() - sel_bbox->midpoint() );
                     sp_selection_move_relative(selection, m);