📄 gseisviewtool.c
字号:
}void g_seis_view_tool_key_event (GSeisViewTool *tool, GtkWidget *seis_view_gl, GdkEventKey *event, GSeisViewDataVisibility *data_visibility) { GSeisViewToolPrivate *private = G_SEIS_VIEW_TOOL_GET_PRIVATE (tool); if (GDK_KEY_PRESS == event->type) { if (tool->show_cross && private->current_tool == tool) { if ((GDK_Control_L == event->keyval || GDK_Control_R == event->keyval) && private->alt_tool1) { g_seis_view_tool_detach_notify (private->current_tool, seis_view_gl); private->current_tool = private->alt_tool1; g_seis_view_tool_attach_notify (private->current_tool, seis_view_gl); } else if ((GDK_Shift_L == event->keyval || GDK_Shift_R == event->keyval) && private->alt_tool2) { g_seis_view_tool_detach_notify (private->current_tool, seis_view_gl); private->current_tool = private->alt_tool2; g_seis_view_tool_attach_notify (private->current_tool, seis_view_gl); } else if ((GDK_Alt_L == event->keyval || GDK_Alt_R == event->keyval) && private->alt_tool3) { g_seis_view_tool_detach_notify (private->current_tool, seis_view_gl); private->current_tool = private->alt_tool3; g_seis_view_tool_attach_notify (private->current_tool, seis_view_gl); } } } else if (GDK_KEY_RELEASE == event->type) { if (private->current_tool != tool && (GDK_Control_L == event->keyval || GDK_Control_R == event->keyval || GDK_Shift_L == event->keyval || GDK_Shift_R == event->keyval || GDK_Alt_L == event->keyval || GDK_Alt_R == event->keyval)) { g_seis_view_tool_detach_notify (private->current_tool, seis_view_gl); private->current_tool = tool; g_seis_view_tool_attach_notify (private->current_tool, seis_view_gl); } } if (0 == (private->current_tool->event_mask & G_SEIS_VIEW_TOOL_KEY_EVENT)) return; G_SEIS_VIEW_TOOL_GET_CLASS (G_OBJECT (private->current_tool))->view_key_event (private->current_tool, seis_view_gl, event, data_visibility); if (private->current_tool != tool) tool->show_cross = private->current_tool->show_cross;}void g_seis_view_tool_redraw_event (GSeisViewTool *tool, GtkWidget *seis_view_gl, GSeisViewDataVisibility *data_visibility) { GSeisViewToolPrivate *private = G_SEIS_VIEW_TOOL_GET_PRIVATE (tool); if (0 == (private->current_tool->event_mask & G_SEIS_VIEW_TOOL_REDRAW_EVENT)) return; G_SEIS_VIEW_TOOL_GET_CLASS (G_OBJECT (private->current_tool))->view_redraw_event (private->current_tool, seis_view_gl, data_visibility); if (private->current_tool != tool) tool->show_cross = private->current_tool->show_cross;}void g_seis_view_tool_resize_event (GSeisViewTool *tool, GtkWidget *seis_view_gl, GSeisViewDataVisibility *data_visibility) { GSeisViewToolPrivate *private = G_SEIS_VIEW_TOOL_GET_PRIVATE (tool); if (0 == (private->current_tool->event_mask & G_SEIS_VIEW_TOOL_RESIZE_EVENT)) return; G_SEIS_VIEW_TOOL_GET_CLASS (G_OBJECT (private->current_tool))->view_resize_event (private->current_tool, seis_view_gl, data_visibility); if (private->current_tool != tool) tool->show_cross = private->current_tool->show_cross;}static void g_seis_view_tool_init (GSeisViewTool *self) { GSeisViewToolPrivate *private = G_SEIS_VIEW_TOOL_GET_PRIVATE (self); self->event_mask = 0; private->current_tool = self; private->alt_tool1 = NULL; private->alt_tool2 = NULL; private->alt_tool3 = NULL;#ifdef DEBUG g_print ("<GSeisViewTool is inited>\n");#endif}static void g_seis_view_tool_finalize (GObject *object) { GSeisViewTool *self = G_SEIS_VIEW_TOOL (object); GSeisViewToolPrivate *private = G_SEIS_VIEW_TOOL_GET_PRIVATE (self); if (private->alt_tool1) g_object_unref (G_OBJECT (private->alt_tool1)); if (private->alt_tool2) g_object_unref (G_OBJECT (private->alt_tool2)); if (private->alt_tool3) g_object_unref (G_OBJECT (private->alt_tool3));#ifdef DEBUG g_print ("<GSeisViewTool is finalized>\n");#endif if (G_OBJECT_CLASS (g_seis_view_tool_parent_class)->finalize) G_OBJECT_CLASS (g_seis_view_tool_parent_class)->finalize (object);}enum { PROP_0, PROP_EVENT_MASK, PROP_SHOW_CROSS, PROP_NUM};static void g_seis_view_tool_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { switch (prop_id) { case PROP_EVENT_MASK: case PROP_SHOW_CROSS: default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; }}static void g_seis_view_tool_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GSeisViewTool *self = G_SEIS_VIEW_TOOL (object); switch (prop_id) { case PROP_EVENT_MASK: g_value_set_uint (value, self->event_mask); break; case PROP_SHOW_CROSS: g_value_set_boolean (value, self->event_mask); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; }}static void g_seis_view_tool_class_init (GSeisViewToolClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = g_seis_view_tool_finalize; g_type_class_add_private (klass, sizeof (GSeisViewToolPrivate)); klass->view_attach_notify = g_seis_view_tool_attach_notify_base; klass->view_detach_notify = g_seis_view_tool_detach_notify_base; klass->view_button_event = g_seis_view_tool_button_event_base; klass->view_scroll_event = g_seis_view_tool_scroll_event_base; klass->view_enter_event = g_seis_view_tool_enter_event_base; klass->view_leave_event = g_seis_view_tool_leave_event_base; klass->view_motion_event = g_seis_view_tool_motion_event_base; klass->view_key_event = g_seis_view_tool_key_event_base; klass->view_redraw_event = g_seis_view_tool_redraw_event_base; klass->view_resize_event = g_seis_view_tool_resize_event_base; gobject_class->set_property = g_seis_view_tool_set_property; gobject_class->get_property = g_seis_view_tool_get_property; g_object_class_install_property (gobject_class, PROP_EVENT_MASK, g_param_spec_uint ("event_mask", "Event Mask", "Events the tool is intrested in", 0, G_SEIS_VIEW_TOOL_ALL_EVENTS, G_SEIS_VIEW_TOOL_ALL_EVENTS, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, PROP_SHOW_CROSS, g_param_spec_boolean ("show_cross", "ShowCross", "Show cross in cursor's location", FALSE, G_PARAM_READABLE));#ifdef DEBUG g_print ("<GSeisViewTool class is inited>\n");#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -