From: dvlierop2 Date: Sun, 31 May 2009 12:51:33 +0000 (+0000) Subject: Store the maximized state in the document (closes bug #168422) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ce3901afdf65b574e35f0b150e8a321a362889b1;p=inkscape.git Store the maximized state in the document (closes bug #168422) --- diff --git a/src/attributes-test.h b/src/attributes-test.h index 5593deeba..d6851a42b 100644 --- a/src/attributes-test.h +++ b/src/attributes-test.h @@ -372,6 +372,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"inkscape:window-height", true}, {"inkscape:window-x", true}, {"inkscape:window-y", true}, + {"inkscape:window-maximized", true}, {"inkscape:current-layer", true}, {"inkscape:connector-type", true}, {"inkscape:connection-start", true}, diff --git a/src/attributes.cpp b/src/attributes.cpp index f2fb62a1c..a0801920e 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -86,6 +86,7 @@ static SPStyleProp const props[] = { {SP_ATTR_INKSCAPE_WINDOW_HEIGHT, "inkscape:window-height"}, {SP_ATTR_INKSCAPE_WINDOW_X, "inkscape:window-x"}, {SP_ATTR_INKSCAPE_WINDOW_Y, "inkscape:window-y"}, + {SP_ATTR_INKSCAPE_WINDOW_MAXIMIZED, "inkscape:window-maximized"}, {SP_ATTR_INKSCAPE_SNAP_GLOBAL, "inkscape:snap-global"}, {SP_ATTR_INKSCAPE_SNAP_BBOX, "inkscape:snap-bbox"}, {SP_ATTR_INKSCAPE_SNAP_NODES, "inkscape:snap-nodes"}, @@ -98,8 +99,7 @@ static SPStyleProp const props[] = { {SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS, "inkscape:snap-object-midpoints"}, {SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS, "inkscape:snap-bbox-edge-midpoints"}, {SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS, "inkscape:snap-bbox-midpoints"}, - //{SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE, "inkscape:snap-intersection-grid-guide"}, - {SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS, "inkscape:snap-intersection-paths"}, + {SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS, "inkscape:snap-intersection-paths"}, {SP_ATTR_INKSCAPE_OBJECT_PATHS, "inkscape:object-paths"}, {SP_ATTR_INKSCAPE_OBJECT_NODES, "inkscape:object-nodes"}, {SP_ATTR_INKSCAPE_BBOX_PATHS, "inkscape:bbox-paths"}, diff --git a/src/attributes.h b/src/attributes.h index fc9e49f2b..08ece3483 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -86,6 +86,7 @@ enum SPAttributeEnum { SP_ATTR_INKSCAPE_WINDOW_HEIGHT, SP_ATTR_INKSCAPE_WINDOW_X, SP_ATTR_INKSCAPE_WINDOW_Y, + SP_ATTR_INKSCAPE_WINDOW_MAXIMIZED, SP_ATTR_INKSCAPE_SNAP_GLOBAL, SP_ATTR_INKSCAPE_SNAP_BBOX, SP_ATTR_INKSCAPE_SNAP_NODES, diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index c9732eece..9b4b7b3e7 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -241,6 +241,7 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape: sp_object_read_attr(object, "inkscape:window-height"); sp_object_read_attr(object, "inkscape:window-x"); sp_object_read_attr(object, "inkscape:window-y"); + sp_object_read_attr(object, "inkscape:window-maximized"); sp_object_read_attr(object, "inkscape:snap-global"); sp_object_read_attr(object, "inkscape:snap-bbox"); sp_object_read_attr(object, "inkscape:snap-nodes"); @@ -442,7 +443,11 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va nv->window_y = value ? atoi(value) : 0; object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_INKSCAPE_SNAP_GLOBAL: + case SP_ATTR_INKSCAPE_WINDOW_MAXIMIZED: + nv->window_maximized = value ? atoi(value) : 0; + object->requestModified(SP_OBJECT_MODIFIED_FLAG); + break; + case SP_ATTR_INKSCAPE_SNAP_GLOBAL: nv->snap_manager.snapprefs.setSnapEnabledGlobally(value ? sp_str_to_bool(value) : TRUE); object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; @@ -746,16 +751,23 @@ void sp_namedview_window_from_document(SPDesktop *desktop) // restore window size and position stored with the document if (geometry_from_file) { - gint w = MIN(gdk_screen_width(), nv->window_width); - gint h = MIN(gdk_screen_height(), nv->window_height); - gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x); - gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y); - if (w>0 && h>0) { - desktop->setWindowSize(w, h); - x = MIN(gdk_screen_width() - w, x); - y = MIN(gdk_screen_height() - h, y); - desktop->setWindowPosition(Geom::Point(x, y)); - } + if (nv->window_maximized) { + Gtk::Window *win = desktop->getToplevel(); + if (win){ + win->maximize(); + } + } else { + gint w = MIN(gdk_screen_width(), nv->window_width); + gint h = MIN(gdk_screen_height(), nv->window_height); + gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x); + gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y); + if (w>0 && h>0) { + desktop->setWindowSize(w, h); + x = MIN(gdk_screen_width() - w, x); + y = MIN(gdk_screen_height() - h, y); + desktop->setWindowPosition(Geom::Point(x, y)); + } + } } // restore zoom and view @@ -819,12 +831,13 @@ void sp_namedview_document_from_window(SPDesktop *desktop) sp_repr_set_svg_double(view, "inkscape:cy", r.midpoint()[Geom::Y]); if (save_geometry_in_file) { - gint w, h, x, y; + gint w, h, x, y; desktop->getWindowGeometry(x, y, w, h); sp_repr_set_int(view, "inkscape:window-width", w); sp_repr_set_int(view, "inkscape:window-height", h); sp_repr_set_int(view, "inkscape:window-x", x); sp_repr_set_int(view, "inkscape:window-y", y); + sp_repr_set_int(view, "inkscape:window-maximized", desktop->is_maximized()); } view->setAttribute("inkscape:current-layer", SP_OBJECT_ID(desktop->currentLayer())); diff --git a/src/sp-namedview.h b/src/sp-namedview.h index 7eafd1249..048096d8c 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -47,6 +47,7 @@ struct SPNamedView : public SPObjectGroup { gint window_height; gint window_x; gint window_y; + gint window_maximized; SnapManager snap_manager; GSList * grids;