⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsegyfileaux.c

📁 segy 显示程序!希望能给正在做这部分朋友提供一部分资料
💻 C
字号:
/*  * GTKSEISVIEWUI - Library of interface elements for GSEGYView * * Copyright (C) 2005-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"static gchar *gsegy_error_messages[G_SEGY_FILE_MESSAGES_NUM] = { NULL, NULL, NULL, NULL, NULL, NULL,                                                                 NULL, NULL, NULL, NULL, NULL, NULL };static void gsegy_view_init_file_error_messages (void) {     gsegy_error_messages[G_SEGY_FILE_NO_ERROR] = _("No error");     gsegy_error_messages[G_SEGY_FILE_MEMORY_ALLOCATION_FAIL] = _("Not enough memory for data to load");     gsegy_error_messages[G_SEGY_FILE_OPEN_ERROR] = _("File open error");     gsegy_error_messages[G_SEGY_FILE_DOES_NOT_EXIST] = _("File does not exist");     gsegy_error_messages[G_SEGY_FILE_NON_REGULAR] = _("Non regular file");     gsegy_error_messages[G_SEGY_FILE_UNKNOW_SAMPLE_ID] = _("Unknown sample ID in the file header");     gsegy_error_messages[G_SEGY_FILE_ZERO_NUMBER_OF_SAMPLES] = _("Number of samples is zero in the file header");     gsegy_error_messages[G_SEGY_FILE_ZERO_SAMPLE_INTERVAL] = _("Sample interval is zero in the file header");     gsegy_error_messages[G_SEGY_FILE_READ_ERROR] = _("File read error");     gsegy_error_messages[G_SEGY_FILE_PREMATURE_EOF] = _("Premature end of file");     gsegy_error_messages[G_SEGY_FILE_FORMAT_ALREADY_SET] = _("File format is already set");     gsegy_error_messages[G_SEGY_FILE_INTERRUPTED_BY_USER] = _("File operation is interrupted by user");}const gchar *gsegy_view_get_file_error_message (GSEGYFileError *file_error) {     if (NULL == gsegy_error_messages[0])         gsegy_view_init_file_error_messages ();     return gsegy_error_messages[file_error->id];}static gchar *gsegy_view_base_dir = NULL;void gsegy_view_init_dirs (int argc, char *argv[]) {    if (NULL == gsegy_view_base_dir && argc && argv && argv[0]) {        gchar *base_dir = g_path_get_dirname (argv[0]);        if (FALSE == g_path_is_absolute (base_dir)) {            gchar *current_dir = g_get_current_dir ();#ifdef WIN32            gsegy_view_base_dir = g_strconcat (current_dir, "\\", base_dir, NULL);#else            gsegy_view_base_dir = g_strconcat (current_dir, "/", base_dir, NULL);#endif            g_free (current_dir);            g_free (base_dir);        } else            gsegy_view_base_dir = base_dir;    }#ifdef DEBUG    g_printf ("Base dir is %s\n", gsegy_view_base_dir);#endif}static GdkPixbuf *gsegy_view_icon = NULL;void gsegy_view_set_window_icon (GtkWindow *window) {    if (NULL == gsegy_view_icon) {#ifdef WIN32        gchar *icon_filename = g_strconcat (gsegy_view_get_data_dir (), "\\pixmaps\\",                                            PACKAGE_NAME, ".png", NULL);#else        gchar *icon_filename = g_strconcat (gsegy_view_get_data_dir (), "/pixmaps/",                                            PACKAGE_NAME, ".png", NULL);#endif#ifdef DEBUG        g_printf ("Icon filename: %s\n", icon_filename);#endif        if (g_file_test (icon_filename, G_FILE_TEST_IS_REGULAR) &&            g_file_test (icon_filename, G_FILE_TEST_EXISTS)) {            GError *gerror = NULL;            gsegy_view_icon = gdk_pixbuf_new_from_file (icon_filename, &gerror);            if (gerror) {#ifdef DEBUG                g_printf ("%s\n", gerror->message);#endif                g_error_free (gerror);                g_free (icon_filename);                return;            }        } else {#ifdef DEBUG            g_printf ("Icon file does not exist or not accessible\n");#endif            g_free (icon_filename);            return;        }        g_free (icon_filename);    }    if (window)        gtk_window_set_icon (window, gsegy_view_icon);}static gchar *gsegy_view_data_dir = NULL;const gchar *gsegy_view_get_data_dir (void) {    if (NULL == gsegy_view_data_dir) {#ifdef WIN32        gsegy_view_data_dir = g_strdup (gsegy_view_base_dir);#else        gsegy_view_data_dir = g_strdup (DATA_DIR);#endif    }    return gsegy_view_data_dir;}static gchar *gsegy_view_locale_dir = NULL;const gchar *gsegy_view_get_locale_dir (void) {    if (NULL == gsegy_view_locale_dir) {#ifdef WIN32        gsegy_view_locale_dir = g_strconcat (gsegy_view_base_dir, "\\locale", NULL);#else        gsegy_view_locale_dir = g_strdup (PACKAGE_LOCALE_DIR);#endif    }    return gsegy_view_locale_dir;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -