📄 gsegycursorpanel.c
字号:
/* * GTKSEISVIEWUI - Library of interface elements for GSEGYView * * Copyright (C) 2006 Vladimir Bashkardin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more av. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Author: Vladimir Bashkardin <vovizmus@users.sourceforge.net> */#include "gsegyfileaux.h"#include "gsegycursorpanel.h"G_DEFINE_TYPE (GSEGYCursorPanel, g_segy_cursor_panel, G_TYPE_OBJECT)#define G_SEGY_CURSOR_PANEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), G_SEGY_TYPE_CURSOR_PANEL, GSEGYCursorPanelPrivate))typedef struct _GSEGYCursorPanelPrivate GSEGYCursorPanelPrivate;struct _GSEGYCursorPanelPrivate { GtkWidget *frame; GtkWidget *hpaned; GtkWidget *vbox1; GtkWidget *vbox2; GtkWidget *table1; GtkWidget *table2; GtkWidget *table3; GtkWidget *table4; GtkWidget *z_label; GtkWidget *z_value_label; GtkWidget *amp_label; GtkWidget *amp_value_label; GtkWidget *field1_label; GtkWidget *field1_value_label; GtkWidget *field2_label; GtkWidget *field2_value_label; GtkSeisViewGl *aux_seis_view; GtkSeisViewGl *seis_view; gboolean seis_view_is_threaded; gulong aux_pointer_position_signal_id; gulong aux_pointer_leave_signal_id; gulong pointer_position_signal_id; gulong pointer_leave_signal_id; gfloat *samples; gfloat *samples_display; guint32 slow_num; guint32 fast_num; gint current_ensemble; gboolean real_amplitude; gboolean has_real_amplitudes; gfloat sample_interval; guint16 field1_id; guint16 field2_id; GPtrArray *sort_labels; GSEGYSeismicAccessor *seismic_accessor;};static void g_segy_cursor_panel_init (GSEGYCursorPanel *self) { GSEGYCursorPanelPrivate *private = G_SEGY_CURSOR_PANEL_GET_PRIVATE (self); private->frame = NULL; private->hpaned = NULL; private->vbox1 = NULL; private->vbox2 = NULL; private->table1 = NULL; private->table2 = NULL; private->table3 = NULL; private->table4 = NULL; private->z_label = NULL; private->z_value_label = NULL; private->amp_label = NULL; private->amp_value_label = NULL; private->field1_label = NULL; private->field1_value_label = NULL; private->field2_label = NULL; private->field2_value_label = NULL; private->seis_view = NULL; private->aux_seis_view = NULL; private->seis_view_is_threaded = FALSE; private->seismic_accessor = NULL; private->samples = NULL; private->samples_display = NULL; private->slow_num = 0; private->fast_num = 0; private->current_ensemble = 0; private->real_amplitude = TRUE; private->has_real_amplitudes = TRUE; private->sample_interval = 0; private->sort_labels = NULL; private->field1_id = 0; private->field2_id = 0; private->pointer_position_signal_id = 0; private->pointer_leave_signal_id = 0; private->aux_pointer_position_signal_id = 0; private->aux_pointer_leave_signal_id = 0;#ifdef DEBUG g_print ("<GSEGYCursorPanel is inited>\n");#endif}static void g_segy_cursor_panel_finalize (GObject *object) { GSEGYCursorPanel *self = G_SEGY_CURSOR_PANEL (object); GSEGYCursorPanelPrivate *private = G_SEGY_CURSOR_PANEL_GET_PRIVATE (self); g_signal_handler_disconnect (G_OBJECT (private->seis_view), private->pointer_position_signal_id); g_signal_handler_disconnect (G_OBJECT (private->seis_view), private->pointer_leave_signal_id); if (private->aux_seis_view) { g_signal_handler_disconnect (G_OBJECT (private->aux_seis_view), private->aux_pointer_position_signal_id); g_signal_handler_disconnect (G_OBJECT (private->aux_seis_view), private->aux_pointer_leave_signal_id); } if (private->frame) gtk_widget_destroy (private->frame); if (private->aux_seis_view) g_object_unref (G_OBJECT (private->aux_seis_view)); if (private->seis_view) g_object_unref (G_OBJECT (private->seis_view)); if (private->seismic_accessor) g_object_unref (G_OBJECT (private->seismic_accessor));#ifdef DEBUG g_print ("<GSEGYCursorPanel is finalized>\n");#endif if (G_OBJECT_CLASS (g_segy_cursor_panel_parent_class)->finalize) G_OBJECT_CLASS (g_segy_cursor_panel_parent_class)->finalize (object);}static void g_segy_cursor_panel_class_init (GSEGYCursorPanelClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = g_segy_cursor_panel_finalize; g_type_class_add_private (klass, sizeof (GSEGYCursorPanelPrivate));#ifdef DEBUG g_print ("<GSEGYCursorPanel class is inited>\n");#endif}void g_segy_cursor_panel_set_ensemble_data (GSEGYCursorPanel *self, gfloat *samples, gfloat *samples_display, gint current_ensemble, guint32 slow_num, guint32 fast_num) { GSEGYCursorPanelPrivate *private = G_SEGY_CURSOR_PANEL_GET_PRIVATE (self); private->samples = samples; private->samples_display = samples_display; private->slow_num = slow_num; private->fast_num = fast_num; private->current_ensemble = current_ensemble; private->has_real_amplitudes = gtk_seis_view_gl_has_real_amplitudes (GTK_SEIS_VIEW_GL (private->seis_view));}void g_segy_cursor_panel_set_fields_ids (GSEGYCursorPanel *self, guint16 field1_id, guint32 field2_id) { GSEGYCursorPanelPrivate *private = G_SEGY_CURSOR_PANEL_GET_PRIVATE (self); private->field1_id = field1_id; private->field2_id = field2_id; if (private->frame) { if (field1_id != 0) { gtk_widget_show (private->field1_label); gtk_widget_show (private->field1_value_label); gtk_label_set_text (GTK_LABEL (private->field1_label), g_ptr_array_index (private->sort_labels, private->field1_id - 1)); } else { gtk_widget_hide (private->field2_label); gtk_widget_hide (private->field2_value_label); } if (field2_id != 0 && field1_id != field2_id) { gtk_widget_show (private->field2_label); gtk_widget_show (private->field2_value_label); gtk_label_set_text (GTK_LABEL (private->field2_label), g_ptr_array_index (private->sort_labels, private->field2_id - 1)); } else { gtk_widget_hide (private->field2_label); gtk_widget_hide (private->field2_value_label); } }}void g_segy_cursor_panel_show_real_amplitude (GSEGYCursorPanel *self, gboolean show) { GSEGYCursorPanelPrivate *private = G_SEGY_CURSOR_PANEL_GET_PRIVATE (self); private->real_amplitude = show;}static void g_segy_cursor_pointer_position_handler (GtkSeisViewGl *seis_view, gdouble slow_pos_data, gdouble fast_pos_data, gpointer data) { GSEGYCursorPanel *self = G_SEGY_CURSOR_PANEL (data); GSEGYCursorPanelPrivate *private = G_SEGY_CURSOR_PANEL_GET_PRIVATE (self); gchar gbuffer[G_ASCII_DTOSTR_BUF_SIZE]; if (NULL == private->samples) return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -