aboutsummaryrefslogtreecommitdiff
path: root/src/hdfsee.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-12-15 05:54:51 -0800
committerThomas White <taw@bitwiz.org.uk>2009-12-16 01:54:12 -0800
commita97808a51b9e15df23307115ca889e01c604c0dc (patch)
tree67c6987fe5f561616d17a548beeb0b05714c2204 /src/hdfsee.c
parent4d4aa2f6e2a98461d022d6ce494c58b04b586711 (diff)
Introduce 'hdfsee'
Diffstat (limited to 'src/hdfsee.c')
-rw-r--r--src/hdfsee.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/hdfsee.c b/src/hdfsee.c
new file mode 100644
index 00000000..073ee036
--- /dev/null
+++ b/src/hdfsee.c
@@ -0,0 +1,85 @@
+/*
+ * hdfsee.c
+ *
+ * Quick yet non-crappy HDF viewer
+ *
+ * (c) 2006-2009 Thomas White <thomas.white@desy.de>
+ *
+ * Part of CrystFEL - crystallography with a FEL
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <glib/gthread.h>
+
+#include "displaywindow.h"
+#include "utils.h"
+
+
+/* Global program state */
+DisplayWindow *main_window_list[64];
+size_t main_n_windows = 0;
+
+
+/* Called to notify that an image display window has been closed */
+void hdfsee_window_closed(DisplayWindow *dw)
+{
+ size_t i;
+
+ for ( i=0; i<main_n_windows; i++ ) {
+
+ if ( main_window_list[i] == dw ) {
+
+ size_t j;
+
+ for ( j=i+1; j<main_n_windows; j++ ) {
+ main_window_list[j] = main_window_list[j+1];
+ }
+
+ }
+
+ }
+
+ main_n_windows--;
+
+ if ( main_n_windows == 0 ) gtk_exit(0);
+
+}
+
+
+int main(int argc, char *argv[])
+{
+ g_thread_init(NULL);
+ gtk_init(&argc, &argv);
+
+ if ( argc == 1 ) {
+
+ main_n_windows = 1;
+ main_window_list[0] = displaywindow_open(NULL);
+ if ( main_window_list[0] == NULL ) {
+ ERROR("Couldn't open display window\n");
+ }
+
+ } else {
+
+ size_t i;
+
+ main_n_windows = argc - 1;
+ for ( i=0; i<main_n_windows; i++ ) {
+ main_window_list[i] = displaywindow_open(argv[i+1]);
+ if ( main_window_list[i] == NULL ) {
+ ERROR("Couldn't open display window\n");
+ }
+ }
+
+ }
+
+ gtk_main();
+
+ return 0;
+}