From 3eb2ed59378f51ea91100dc36d6ae176b696f926 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Fri, 7 Dec 2012 17:27:07 +0000 Subject: Add a propery editor window --- tikzit/src/gtk/Window.m | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'tikzit/src/gtk/Window.m') diff --git a/tikzit/src/gtk/Window.m b/tikzit/src/gtk/Window.m index 930b296..1856b9d 100644 --- a/tikzit/src/gtk/Window.m +++ b/tikzit/src/gtk/Window.m @@ -51,7 +51,7 @@ static void clipboard_paste_contents (GtkClipboard *clipboard, // }}} // {{{ Signals -static void window_toplevel_focus_changed_cb (GObject *gobject, GParamSpec *pspec, GraphEditorPanel *panel); +static void window_toplevel_focus_changed_cb (GObject *gobject, GParamSpec *pspec, Window *window); static void graph_divider_position_changed_cb (GObject *gobject, GParamSpec *pspec, Window *window); static void tikz_buffer_changed_cb (GtkTextBuffer *buffer, Window *window); static gboolean main_window_delete_event_cb (GtkWidget *widget, GdkEvent *event, Window *window); @@ -572,7 +572,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc g_signal_connect (G_OBJECT (window), "notify::has-toplevel-focus", G_CALLBACK (window_toplevel_focus_changed_cb), - graphPanel); + self); g_signal_connect (G_OBJECT (tikzPaneSplitter), "notify::position", G_CALLBACK (graph_divider_position_changed_cb), @@ -739,17 +739,28 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc } } +- (GraphEditorPanel*) _graphPanel { + return graphPanel; +} + @end // }}} // {{{ GTK+ callbacks -static void window_toplevel_focus_changed_cb (GObject *gobject, GParamSpec *pspec, GraphEditorPanel *panel) { +static void window_toplevel_focus_changed_cb (GObject *gobject, GParamSpec *pspec, Window *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; gboolean hasfocus; g_object_get (gobject, "has-toplevel-focus", &hasfocus, NULL); if (hasfocus) { - [panel grabTool]; + [[NSNotificationCenter defaultCenter] + postNotificationName:@"WindowGainedFocus" + object:window]; + [[window _graphPanel] grabTool]; + } else { + [[NSNotificationCenter defaultCenter] + postNotificationName:@"WindowLostFocus" + object:window]; } [pool drain]; } -- cgit v1.2.3