summaryrefslogtreecommitdiff
path: root/tikzit/src/gtk/PropertiesWindow.m
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@cs.ox.ac.uk>2012-12-17 15:50:11 +0000
committerAlex Merry <alex.merry@cs.ox.ac.uk>2012-12-17 15:52:08 +0000
commit477b865da18f6004a5180d924997d9283c20250f (patch)
tree631dcb7651cd037c379a224ff5402368879562a2 /tikzit/src/gtk/PropertiesWindow.m
parent6d1332ac7513f564c36949ed5d95fd6874f8bbb2 (diff)
Remember the geometry of the utility windows
Code largely stolen from the GIMP.
Diffstat (limited to 'tikzit/src/gtk/PropertiesWindow.m')
-rw-r--r--tikzit/src/gtk/PropertiesWindow.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/tikzit/src/gtk/PropertiesWindow.m b/tikzit/src/gtk/PropertiesWindow.m
index acf18b2..98e4f4b 100644
--- a/tikzit/src/gtk/PropertiesWindow.m
+++ b/tikzit/src/gtk/PropertiesWindow.m
@@ -215,6 +215,9 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertiesWindow *pan
G_CALLBACK (edge_node_label_changed_cb),
self);
+ // hack to position the props window somewhere sensible
+ // (upper right)
+ gtk_window_parse_geometry (GTK_WINDOW (window), "-0+0");
}
return self;
@@ -289,12 +292,28 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertiesWindow *pan
}
- (void) loadConfiguration:(Configuration*)config {
+ if ([config hasGroup:@"PropertiesWindow"]) {
+ tz_restore_window (GTK_WINDOW (window),
+ [config integerEntry:@"x" inGroup:@"PropertiesWindow"],
+ [config integerEntry:@"y" inGroup:@"PropertiesWindow"],
+ [config integerEntry:@"w" inGroup:@"PropertiesWindow"],
+ [config integerEntry:@"h" inGroup:@"PropertiesWindow"]);
+ }
[self setVisible:[config booleanEntry:@"visible"
inGroup:@"PropertiesWindow"
withDefault:YES]];
}
- (void) saveConfiguration:(Configuration*)config {
+ gint x, y, w, h;
+
+ gtk_window_get_position (GTK_WINDOW (window), &x, &y);
+ gtk_window_get_size (GTK_WINDOW (window), &w, &h);
+
+ [config setIntegerEntry:@"x" inGroup:@"PropertiesWindow" value:x];
+ [config setIntegerEntry:@"y" inGroup:@"PropertiesWindow" value:y];
+ [config setIntegerEntry:@"w" inGroup:@"PropertiesWindow" value:w];
+ [config setIntegerEntry:@"h" inGroup:@"PropertiesWindow" value:h];
[config setBooleanEntry:@"visible"
inGroup:@"PropertiesWindow"
value:[self visible]];