📄 gsegydataview.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> */#if defined WIN32#include <stdarg.h>#include <windef.h>#include <winbase.h>#elif defined LINUX#include <sys/sysinfo.h>#endif#include <gdk/gdkkeysyms.h>#include <gtkseisviewgl/gtkseisviewgl.h>#include <gtkseisviewgl/gseisviewtoolaux.h>#include <gtkseisviewgl/gseisviewtoolhlight.h>#include <gtkseisviewgl/gseisviewtoolmagnify.h>#include <gtkseisviewgl/gseisviewtoolmotion.h>#include <gtkseisviewgl/gseisviewtoolscale.h>#include "gsegyfileaux.h"#include "gsegywigglepanel.h"#include "gsegytoolpanel.h"#include "gsegycursorpanel.h"#include "gsegygainpanel.h"#include "gsegyviewscaling.h"#include "gsegysaveimage.h"#include "gsegycolormanager.h"#include "gsegyproperties.h"#include "gsegyensembleselect.h"#include "gsegytraceinfo.h"#include "gsegydataview.h"#include "gsegyfileui_marshal.h"G_DEFINE_TYPE (GSEGYDataView, g_segy_data_view, G_TYPE_OBJECT)#define G_SEGY_DATA_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), G_SEGY_TYPE_DATA_VIEW, GSEGYDataViewPrivate))typedef struct _GSEGYDataViewPrivate GSEGYDataViewPrivate;struct _GSEGYDataViewPrivate { GtkWidget *data_window; GtkWidget *main_vbox; GtkWidget *handle; GtkWidget *top_hbox; GtkWidget *middle_vbox; GtkWidget *bottom_hbox; GtkWidget *seis_view_frame; GtkWidget *seis_view_gl; GtkWidget *magnify_view_window; GtkWidget *magnify_view_frame; GtkWidget *magnify_view_gl; GtkWidget *trace_info_window; GtkWidget *trace_info_frame; GtkWidget *trace_info_scrolled; GtkWindowGroup *window_group; GdkCursor *watch_cursor; gchar *name; GStringChunk *ensembles_chunk; GPtrArray *ensembles_labels; GStringChunk *trace_header_chunk; GPtrArray *trace_header_labels; GAsyncQueue *dataset_progress; GThread *dataset_thread; GMutex *data_mutex; GSEGYFileError error; gfloat *data; gint current_ensemble; guint32 fast_num; guint32 slow_num; gboolean reload; GSEGYWigglePanel *wiggle_panel; GSEGYToolPanel *tool_panel; GSEGYCursorPanel *cursor_panel; GSEGYGainPanel *gain_panel; GSEGYViewScaling *view_scaling; GSEGYSaveImage *save_image; GSEGYColorManager *color_manager; GSEGYProperties *properties; GSEGYEnsembleSelect *ensemble_select; gboolean fullscreen; gboolean show_trace_info; gboolean seis_view_is_threaded; GSEGYDataViewPref *data_view_pref; GSeisViewToolMotion *motion_tool; GSeisViewToolHighlight *hlight_tool; GSeisViewToolScale *scale_tool; GSeisViewToolAuxilary *aux_tool; GSeisViewToolMagnify *magnify_tool; GSeisViewToolHighlight *trace_tool; GSEGYTraceInfo *trace_info; GSEGYSeismicAccessor *seismic_accessor;};static void g_segy_data_view_init (GSEGYDataView *self) { GSEGYDataViewPrivate *private = G_SEGY_DATA_VIEW_GET_PRIVATE (self); private->data_window = NULL; private->main_vbox = NULL; private->handle = NULL; private->top_hbox = NULL; private->middle_vbox = NULL; private->bottom_hbox = NULL; private->seis_view_frame = NULL; private->seis_view_gl = NULL; private->seis_view_is_threaded = TRUE; private->magnify_view_window = NULL; private->magnify_view_frame = NULL; private->magnify_view_gl = NULL; private->trace_info_window = NULL; private->trace_info_frame = NULL; private->trace_info_scrolled = NULL; private->window_group = NULL; private->trace_info = NULL; private->motion_tool = NULL; private->aux_tool = NULL; private->hlight_tool = NULL; private->scale_tool = NULL; private->magnify_tool = NULL; private->trace_tool = NULL; private->name = NULL; private->ensembles_chunk = NULL; private->ensembles_labels = NULL; private->wiggle_panel = NULL; private->tool_panel = NULL; private->cursor_panel = NULL; private->gain_panel = NULL; private->view_scaling = NULL; private->save_image = NULL; private->color_manager = NULL; private->properties = NULL; private->ensemble_select = NULL; private->seismic_accessor = NULL; private->data_view_pref = NULL; private->data = NULL; private->current_ensemble = 0; private->slow_num = 0; private->fast_num = 0; private->reload = FALSE; private->show_trace_info = FALSE; private->fullscreen = FALSE; private->watch_cursor = gdk_cursor_new (GDK_WATCH); private->dataset_progress = g_async_queue_new (); private->dataset_thread = NULL; private->data_mutex = g_mutex_new (); private->error.gerror = NULL; private->error.id = G_SEGY_FILE_NO_ERROR; private->trace_header_chunk = NULL; private->trace_header_labels = NULL;#ifdef DEBUG g_print ("<GSEGYDataView is inited>\n");#endif}static void g_segy_data_view_stop_thread (GSEGYDataView *self) { GSEGYDataViewPrivate *private = G_SEGY_DATA_VIEW_GET_PRIVATE (self); if (private->dataset_progress && private->dataset_thread) { g_async_queue_push (private->dataset_progress, self); g_thread_join (private->dataset_thread); }}static void g_segy_data_view_finalize (GObject *object) { GSEGYDataView *self = G_SEGY_DATA_VIEW (object); GSEGYDataViewPrivate *private = G_SEGY_DATA_VIEW_GET_PRIVATE (self); g_segy_data_view_stop_thread (self); while (g_idle_remove_by_data ((gpointer)self)); if (private->window_group) g_object_unref (G_OBJECT (private->window_group)); if (private->gain_panel) g_object_unref (G_OBJECT (private->gain_panel)); if (private->tool_panel) g_object_unref (G_OBJECT (private->tool_panel)); if (private->cursor_panel) g_object_unref (G_OBJECT (private->cursor_panel)); if (private->wiggle_panel) g_object_unref (G_OBJECT (private->wiggle_panel)); if (private->view_scaling) g_object_unref (G_OBJECT (private->view_scaling)); if (private->save_image) g_object_unref (G_OBJECT (private->save_image)); if (private->color_manager) g_object_unref (G_OBJECT (private->color_manager)); if (private->properties) g_object_unref (G_OBJECT (private->properties)); if (private->ensemble_select) g_object_unref (G_OBJECT (private->ensemble_select)); if (private->name) g_free (private->name); if (private->seismic_accessor) g_object_unref (G_OBJECT (private->seismic_accessor)); if (private->ensembles_chunk) g_string_chunk_free (private->ensembles_chunk); if (private->ensembles_labels) g_ptr_array_free (private->ensembles_labels, TRUE); if (private->watch_cursor) gdk_cursor_unref (private->watch_cursor); if (private->motion_tool) g_object_unref (G_OBJECT (private->motion_tool)); if (private->hlight_tool) g_object_unref (G_OBJECT (private->hlight_tool)); if (private->scale_tool) g_object_unref (G_OBJECT (private->scale_tool)); if (private->aux_tool) g_object_unref (G_OBJECT (private->aux_tool)); if (private->magnify_tool) g_object_unref (G_OBJECT (private->magnify_tool)); if (private->magnify_view_window) { gtk_widget_hide (private->magnify_view_window); gtk_widget_destroy (private->magnify_view_window); } if (private->trace_info) g_object_unref (G_OBJECT (private->trace_info)); if (private->trace_info_window) { gtk_widget_hide (private->trace_info_window); gtk_widget_destroy (private->trace_info_window); } if (private->data_window) { gtk_widget_hide (private->data_window); gtk_seis_view_gl_stop_rendering_thread (GTK_SEIS_VIEW_GL (private->seis_view_gl)); } if (private->data_window) gtk_widget_destroy (private->data_window); if (private->dataset_progress) g_async_queue_unref (private->dataset_progress); if (private->data_mutex) g_mutex_free (private->data_mutex); if (private->error.gerror) g_error_free (private->error.gerror); if (private->trace_header_chunk) g_string_chunk_free (private->trace_header_chunk); if (private->trace_header_labels) g_ptr_array_free (private->trace_header_labels, TRUE); if (private->data) g_free (private->data);#ifdef DEBUG g_print ("<GSEGYDataView is finalized>\n");#endif if (G_OBJECT_CLASS (g_segy_data_view_parent_class)->finalize) G_OBJECT_CLASS (g_segy_data_view_parent_class)->finalize (object);}static gboolean g_segy_data_view_remove_signal (GSEGYDataView *self) { g_signal_emit (self, G_SEGY_DATA_VIEW_GET_CLASS (self)->view_remove_id, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -