From cadb26421183319de4d876d560e6a32efbd0865d Mon Sep 17 00:00:00 2001 From: Steffen Pohle Date: Mon, 6 Sep 2021 11:51:51 +0200 Subject: [PATCH] initial upload --- ChangeLog | 0 LICENSE | 6 + Makefile | 77 +++++++++++++ Makefile.rules.linux | 9 ++ README.md | 3 + gui.cc | 47 ++++++++ gui.h | 44 +++++++ main.cc | 61 ++++++++++ simpleskycam.ui | 266 +++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 513 insertions(+) create mode 100644 ChangeLog create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 Makefile.rules.linux create mode 100644 README.md create mode 100644 gui.cc create mode 100644 gui.h create mode 100644 main.cc create mode 100644 simpleskycam.ui diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..28cf119 --- /dev/null +++ b/LICENSE @@ -0,0 +1,6 @@ + +The license model for this software (SimpleSkyCam) is not yet choosen. +At the moment you can use this software free of charge at your own risk. + +06.Sep.2021 Steffen Pohle + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e50851f --- /dev/null +++ b/Makefile @@ -0,0 +1,77 @@ +.SILENT: help +VERSION = 0.0.1 +APP = simpleskycam + +-include Makefile.rules + +OBJECTS = gui.oo main.oo +DISTNAME=simpleskycam-$(VERSION) + +ifeq ($(TARGET),) +noconfig: help +endif + +all: Makefile.rules $(TARGET) + +help: + echo "set up configuration" + echo " make configlinux to generate the linix build" + +configlinux: clean + cp -f Makefile.rules.linux Makefile.rules + make config + +configwindows: clean + cp -f Makefile.rules.windows Makefile.rules + make config + +configcross: clean + cp -f Makefile.rules.crosswindows Makefile.rules + make config + +config: Makefile.rules + echo "#ifndef _CONFIG_H_" > config.h + echo "#define _CONFIG_H_" >> config.h + echo "" >> config.h + echo "#define VERSION \"$(VERSION)\"" >> config.h + echo "" >> config.h + echo "#endif" >> config.h + + +$(TARGET): $(OBJECTS) + $(CPP) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBS) + +.SUFFIXES: +.SUFFIXES: .c .cc .C .cpp .oo + +.cc.oo : $(INCLUDES) + $(CPP) -o $@ -c $(CPPFLAGS) $< + +clean: + rm -f *.o *.oo *.c~ *.h~ *.cc~ *.ui~ $(APP) Makefile~ + rm -rf config.h + rm -rf *.dll + rm -rf *.exe + rm -rf Makefile.rules + +dist: clean + rm -rf $(DISTNAME) + mkdir $(DISTNAME) + cp Makefile* $(DISTNAME) + cp Readme $(DISTNAME) + cp COPYING $(DISTNAME) + cp Changelog $(DISTNAME) + cp *.ui $(DISTNAME) + cp -rf *.h $(DISTNAME) + cp -rf *.cc $(DISTNAME) + tar cvzf $(DISTNAME).tgz $(DISTNAME) + rm -rf $(DISTNAME) + +dep: + $(CXX) -MM `ls *.cc` $(CXXFLAGS) > $(DEPENDFILE) + +-include $(DEPENDFILE) + +.PHONY: all +.PHONY: count +.PHONY: clean diff --git a/Makefile.rules.linux b/Makefile.rules.linux new file mode 100644 index 0000000..ee96141 --- /dev/null +++ b/Makefile.rules.linux @@ -0,0 +1,9 @@ + +TARGET = $(APP) + +CPP = c++ +CPPFLAGS = -ggdb -Wall -O0 `pkg-config --cflags gtk+-3.0 gmodule-export-2.0` -Wl,--export-dynamic -I/usr/include -DBUILD_LINUX=1 +INCLUDES = +LDFLAGS = +LIBS = `pkg-config --libs gtk+-3.0 gmodule-export-2.0` -L/usr/lib + diff --git a/README.md b/README.md new file mode 100644 index 0000000..4982c1d --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# SimpleSkyCam + +Simple application to create images using a teleskope and a cameramodul. \ No newline at end of file diff --git a/gui.cc b/gui.cc new file mode 100644 index 0000000..06bbe70 --- /dev/null +++ b/gui.cc @@ -0,0 +1,47 @@ +/*************************************************************************************** + * + * main.cc is part of SimpleSkyCam. + * + *****************************************************************************************/ + +#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) +#else + #include /* close() */ +#endif +#include +#include +#include "gui.h" +#include "config.h" + +extern GtkBuilder *_builder_; // work around for threads + +////////////////////////////////////////////////////////////////////////////////////////////////// +// +// call back functions +// + +gboolean cb_window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) { +// GtkBuilder *builder = (GtkBuilder *) data; + + return FALSE; +} + +void cb_window_show (GtkWidget *widget, gpointer data) { +// GtkBuilder *builder = (GtkBuilder *) data; +// g_timeout_add(100, gui_loop, NULL); +}; + +void displayerror (std::string error) { + GtkWidget *dialog; + GtkWidget *window = GTK_WIDGET (gtk_builder_get_object (_builder_, "main-window")); + dialog = gtk_message_dialog_new(GTK_WINDOW(window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + error.c_str()); + gtk_window_set_title(GTK_WINDOW(dialog), "Error"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + + diff --git a/gui.h b/gui.h new file mode 100644 index 0000000..5793551 --- /dev/null +++ b/gui.h @@ -0,0 +1,44 @@ +/*************************************************************************************** + * + * gui.h is part of SimpleSkyCam. + * + *****************************************************************************************/ + +#ifndef _GUI_H_ +#define _GUI_H_ + +#include +#include +#include + +#include +#include +#include + +#define BUILDER_FILE "simpleskycam.ui" + +void displayerror (std::string error); + +#ifdef __cplusplus +extern "C" { +#endif + + +// *********************************************************************** +// +// main windows call backs +// +G_MODULE_EXPORT void cb_window_show (GtkWidget *widget, gpointer data); +G_MODULE_EXPORT gboolean cb_window_delete_event (GtkWidget *widget, + GdkEvent *event, gpointer data); + +// +// thread handles +G_MODULE_EXPORT gboolean cb_thread_video (gpointer data); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/main.cc b/main.cc new file mode 100644 index 0000000..69d8176 --- /dev/null +++ b/main.cc @@ -0,0 +1,61 @@ +/*************************************************************************************** + * + * main.cc is part of SimpleSkyCam. + * + *****************************************************************************************/ + +#include + +#include "config.h" +#include "gui.h" + +////////////////////////////////////////////////////////////////////////////////////////////////// +// +// global variables +// + +GtkBuilder *_builder_ = NULL; // work around for the thread situation + +int main (int argc, char **argv) { + GtkBuilder *builder; + GObject *window; + +#ifdef BUILD_WINDOWS + char buffer[16]; + setvbuf (stdout, buffer, _IONBF, 16); +#endif + + printf ("SimpleSkyCam - %s\n", VERSION); + printf (" written by Steffen Pohle \n"); + + gtk_init (&argc, &argv); + _builder_ = builder = gtk_builder_new (); + gtk_builder_add_from_file (builder, BUILDER_FILE, NULL); + gtk_builder_connect_signals(builder, builder); + + // + // #if defined _WIN32 || defined _WIN64 || defined __CYGWIN__ + // #else + // #endif + // + + window = gtk_builder_get_object (builder, "window-main"); + gtk_widget_show_all (GTK_WIDGET(window)); + + gtk_main (); + + return 0; +} + + +float get_cycletime(struct timeval *t) { + struct timeval t1; + float f = 0.0; + + t1 = *t; + gettimeofday(t, NULL); + f = (float)(t->tv_sec - t1.tv_sec) + ((t->tv_usec - t1.tv_usec) / 1000000.0); + + return f; +} + diff --git a/simpleskycam.ui b/simpleskycam.ui new file mode 100644 index 0000000..fec100a --- /dev/null +++ b/simpleskycam.ui @@ -0,0 +1,266 @@ + + + + + + False + 1024 + 786 + + + True + True + 700 + True + True + + + True + True + vertical + 250 + True + True + + + True + False + + + False + True + + + + + True + True + + + True + False + vertical + + + True + False + 7 + + + True + False + Device: + + + False + True + 0 + + + + + True + False + True + + + False + + + + + False + True + 1 + + + + + gtk-refresh + True + True + True + True + True + + + False + True + 2 + + + + + gtk-apply + True + True + True + True + True + + + False + True + 3 + + + + + False + True + 3 + 0 + + + + + + + + + + + + + True + False + page 1 + + + False + + + + + + + + True + False + page 2 + + + 1 + False + + + + + + + + True + False + page 3 + + + 2 + False + + + + + True + True + + + + + False + True + + + + + True + False + vertical + + + True + True + vertical + 500 + True + True + + + True + False + Video Object + + + False + True + + + + + True + False + Image Filtered + + + True + True + + + + + True + True + 0 + + + + + True + False + + + button + True + True + True + + + False + True + 0 + + + + + button + True + True + True + + + False + True + 6 + 1 + + + + + + + + False + True + 4 + 1 + + + + + True + True + + + + + +