add desktop file and icon and have that installed, menu as popover, deb package cleanup
This commit is contained in:
parent
ece735f467
commit
c653d72cf4
10 changed files with 173 additions and 270 deletions
4
Makefile
4
Makefile
|
@ -14,6 +14,8 @@ $(PRG): $(OBJ) cam-thread.h planck.h
|
|||
|
||||
install:
|
||||
install -D $(PRG) $(DESTDIR)$(prefix)/bin/$(PRG)
|
||||
install -D flirgtk.desktop $(DESTDIR)$(prefix)/share/applications/flirgtk.desktop
|
||||
install -D flirgtk.png $(DESTDIR)$(prefix)/share/icons/hicolor/256x256/apps/flirgtk.png
|
||||
install -D 77-flirone-lusb.rules $(DESTDIR)/lib/udev/rules.d/77-flirone-lusb.rules
|
||||
|
||||
clean:
|
||||
|
@ -26,4 +28,4 @@ clean:
|
|||
rm -f debian/flirgtk.substvars
|
||||
|
||||
deb:
|
||||
dpkg-buildpackage -rfakeroot -b -uc -us -ui -i -i
|
||||
dpkg-buildpackage -rfakeroot -b -uc -us -ui -i
|
||||
|
|
14
NOTES.txt
14
NOTES.txt
|
@ -1,3 +1,17 @@
|
|||
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Example
|
||||
Icon=exampleapp
|
||||
StartupNotify=true
|
||||
Exec=@bindir@/exampleapp
|
||||
|
||||
|
||||
Scaling 0.5
|
||||
xoffst -71
|
||||
yoffset -40
|
||||
|
||||
|
||||
cairo_surface_t *cairo_get_target (cairo_t *cr);
|
||||
|
||||
int stride;
|
||||
|
|
29
README.md
29
README.md
|
@ -1,25 +1,34 @@
|
|||
# FLIR-GTK
|
||||
|
||||
GTK+ application for FLIR ONE USB thermal camera based on flir-v4l:
|
||||
Copyright (C) 2015-2016 Thomas <tomas123 @ EEVblog Electronics Community Forum>
|
||||
https://github.com/fnoop/flirone-v4l2
|
||||
> Copyright (C) 2015-2016 Thomas <tomas123 @ EEVblog Electronics Community Forum>
|
||||
|
||||
[https://github.com/fnoop/flirone-v4l2](https://github.com/fnoop/flirone-v4l2)
|
||||
|
||||
|
||||
== depdendencies ==
|
||||
## depdendencies
|
||||
```
|
||||
GTK+-3.0
|
||||
Cairo
|
||||
libusb-1.0
|
||||
libjpeg
|
||||
libcjson
|
||||
|
||||
```
|
||||
This should install everything under Debian and derivatives:
|
||||
|
||||
apt install libgtk-3-dev libjpeg-dev libusb-1.0-0-dev libcjson-dev
|
||||
|
||||
== building ==
|
||||
Makefile relies on pkg-config, if setup correctly simply running 'make'
|
||||
should build the application.
|
||||
## building
|
||||
If you check out the code from git you first need to clone submodule cairo-jpeg:
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
== libusb & udev ==
|
||||
cp 77-flirone-lusb.rules /lib/udev/rules.d/
|
||||
udevadm control --reload-rules
|
||||
Makefile relies on pkg-config, if setup correctly simply running 'make'
|
||||
should build the application which can be run from the source directory,
|
||||
'make deb' builds a Debian package (to the parent directory)
|
||||
|
||||
## libusb & udev
|
||||
For access rights of the application to the USB device:
|
||||
|
||||
cp 77-flirone-lusb.rules /lib/udev/rules.d/
|
||||
udevadm control --reload-rules
|
||||
|
|
145
cam-thread.c
145
cam-thread.c
|
@ -44,7 +44,7 @@ extern unsigned char *color_palette;
|
|||
#include <math.h>
|
||||
|
||||
#include "cam-thread.h"
|
||||
#include "plank.h"
|
||||
#include "planck.h"
|
||||
|
||||
|
||||
// -----------------START-ORG-CODE------------------------------------------
|
||||
|
@ -252,8 +252,6 @@ void vframe(char ep[],char EP_error[], int r, int actual_length, unsigned char b
|
|||
uint32_t JpgSize = buf85[16] + (buf85[17] << 8) + (buf85[18] << 16) + (buf85[19] << 24);
|
||||
uint32_t StatusSize = buf85[20] + (buf85[21] << 8) + (buf85[22] << 16) + (buf85[23] << 24);
|
||||
|
||||
//printf("FrameSize= %d (+28=%d), ThermalSize %d, JPG %d, StatusSize %d, Pointer %d\n",FrameSize,FrameSize+28, ThermalSize, JpgSize,StatusSize,buf85pointer);
|
||||
|
||||
if ( (FrameSize+28) > (buf85pointer) ) {
|
||||
// wait for next chunk
|
||||
return;
|
||||
|
@ -267,22 +265,6 @@ void vframe(char ep[],char EP_error[], int r, int actual_length, unsigned char b
|
|||
// get a full frame, first print the status
|
||||
t1=t2;
|
||||
gettimeofday(&t2, NULL);
|
||||
// fps as moving average over last 20 frames
|
||||
// fps_t = (19*fps_t+10000000/(((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec)))/20;
|
||||
|
||||
//filecount++;
|
||||
// printf("#%08i %lld/10 fps:",filecount,fps_t);
|
||||
#if 0
|
||||
for (i = 0; i < StatusSize; i++) {
|
||||
v=28+ThermalSize+JpgSize+i;
|
||||
if (buf85[v]>31) {
|
||||
printf("%c", buf85[v]);
|
||||
} else {
|
||||
printf("<%02x>", buf85[v]);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
buf85pointer=0;
|
||||
|
||||
unsigned short pix[160*120]; // original Flir 16 Bit RAW
|
||||
|
@ -336,46 +318,12 @@ void vframe(char ep[],char EP_error[], int r, int actual_length, unsigned char b
|
|||
}
|
||||
}
|
||||
|
||||
//char st1[100];
|
||||
//char st2[100];
|
||||
//struct tm *loctime;
|
||||
// Convert it to local time and Print it out in a nice format.
|
||||
//loctime = localtime (&now1);
|
||||
//strftime (st1, 60, "%H:%M:%S", loctime);
|
||||
|
||||
// calc medium of 2x2 center pixels
|
||||
int med = (pix[59 * 160 + 79]+pix[59 * 160 + 80]+pix[60 * 160 + 79]+pix[60 * 160 + 80])/4;
|
||||
|
||||
t_min = raw2temperature(min);
|
||||
t_max = raw2temperature(max);
|
||||
t_center = raw2temperature(med);
|
||||
// sprintf(st2," %.1f/%.1f/%.1f'C", raw2temperature(min), raw2temperature(med), raw2temperature(max));
|
||||
//strcat(st1, st2);
|
||||
|
||||
//#define MAXC 26 // max chars in line 160/6=26,6
|
||||
//strncpy(st2, st1, MAXC);
|
||||
// write zero to string !!
|
||||
//st2[MAXC-1] = '\0';
|
||||
//fprintf(stderr,"%s\r",st2);
|
||||
// font_write(fb_proc, 1, 120, st2);
|
||||
|
||||
// show crosshairs, remove if required
|
||||
// font_write(fb_proc, 80-2, 60-3, "+");
|
||||
|
||||
//maxx -= 4;
|
||||
//maxy -= 4;
|
||||
|
||||
//if (maxx < 0)
|
||||
// maxx = 0;
|
||||
//if (maxy < 0)
|
||||
// maxy = 0;
|
||||
//if (maxx > 150)
|
||||
// maxx = 150;
|
||||
//if (maxy > 110)
|
||||
// maxy = 110;
|
||||
|
||||
// font_write(fb_proc, 160-6, maxy, "<");
|
||||
// font_write(fb_proc, maxx, 120-8, "|");
|
||||
|
||||
if (ir_buffer == NULL) {
|
||||
ir_buffer = (unsigned char *)malloc(640*480*4);
|
||||
|
@ -383,93 +331,19 @@ void vframe(char ep[],char EP_error[], int r, int actual_length, unsigned char b
|
|||
}
|
||||
for (y = 0; y < 120; ++y) {
|
||||
for (x = 0; x < 160; ++x) {
|
||||
// unsigned int *p1, *pc;
|
||||
// fb_proc is the gray scale frame buffer
|
||||
v=fb_proc[y * 160 + x] ; // unsigned char!!
|
||||
#if 0
|
||||
// fb_proc2 is an 24bit RGB buffer
|
||||
fb_proc2[3*y * 160 + x*3] = colormap[3 * v]; // unsigned char!!
|
||||
fb_proc2[(3*y * 160 + x*3)+1] = colormap[3 * v + 1]; // unsigned char!!
|
||||
fb_proc2[(3*y * 160 + x*3)+2] = colormap[3 * v + 2]; // unsigned char!!
|
||||
#else
|
||||
//fbdata[4*y * 640 + x*4] = colormap[3 * v + 2]; // B
|
||||
//fbdata[(4*y * 640 + x*4)+1] = colormap[3 * v + 1]; // G
|
||||
//fbdata[(4*y * 640 + x*4)+2] = colormap[3 * v]; // R
|
||||
//fbdata[(4*y * 640 + x*4)+3] = 0x00; // empty
|
||||
|
||||
// fprintf(stderr, "%d %d %d %d\n",x ,y, (4*y * 160 + x*4), v);
|
||||
ir_buffer[4*y * 160 + x*4] =
|
||||
color_palette[3 * v + 2]; // B
|
||||
ir_buffer[(4*y * 160 + x*4)+1] =
|
||||
color_palette[3 * v + 1]; // G
|
||||
ir_buffer[(4*y * 160 + x*4)+2] =
|
||||
color_palette[3 * v]; // R
|
||||
// ir_buffer[(4*y * 160 + x*4)+3] =
|
||||
// 0x00; // A, empty
|
||||
#if 0
|
||||
// assemble one 32 bit pixel
|
||||
fbdata[16*y * 640 + x*16] = color_palette[3 * v + 2]; // B
|
||||
fbdata[(16*y * 640 + x*16)+1] = color_palette[3 * v + 1]; // G
|
||||
fbdata[(16*y * 640 + x*16)+2] = color_palette[3 * v]; // R
|
||||
// fbdata[(16*y * 640 + x*16)+3] = 0x00; // empty
|
||||
|
||||
// copy whole 32bit words hor/vert
|
||||
p1 = (unsigned int *)&fbdata[16*y * 640 + x*16];
|
||||
// quadruple horizontally
|
||||
pc = (unsigned int *)&fbdata[(16*y * 640 + x*16)+4];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(16*y * 640 + x*16)+8];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(16*y * 640 + x*16)+12];
|
||||
*pc = *p1;
|
||||
|
||||
// quadruple vertically+1
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+1) * 640 + x*16)];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+1) * 640 + x*16)+4];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+1) * 640 + x*16)+8];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+1) * 640 + x*16)+12];
|
||||
*pc = *p1;
|
||||
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+2) * 640 + x*16)];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+2) * 640 + x*16)+4];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+2) * 640 + x*16)+8];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+2) * 640 + x*16)+12];
|
||||
*pc = *p1;
|
||||
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+3) * 640 + x*16)];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+3) * 640 + x*16)+4];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+3) * 640 + x*16)+8];
|
||||
*pc = *p1;
|
||||
pc = (unsigned int *)&fbdata[(4*((y*4)+3) * 640 + x*16)+12];
|
||||
*pc = *p1;
|
||||
#endif
|
||||
#endif
|
||||
ir_buffer[4*y * 160 + x*4] =
|
||||
color_palette[3 * v + 2]; // B
|
||||
ir_buffer[(4*y * 160 + x*4)+1] =
|
||||
color_palette[3 * v + 1]; // G
|
||||
ir_buffer[(4*y * 160 + x*4)+2] =
|
||||
color_palette[3 * v]; // R
|
||||
// ir_buffer[(4*y * 160 + x*4)+3] =
|
||||
// 0x00; // A, empty
|
||||
}
|
||||
}
|
||||
|
||||
// write video to v4l2loopback(s)
|
||||
// write(fdwr0, fb_proc, framesize0); // gray scale Thermal Image
|
||||
//write(fdwr1, &buf85[28+ThermalSize], JpgSize); // jpg Visual Image
|
||||
#if 0
|
||||
fprintf(stderr, "jpgsize %d\n", JpgSize);
|
||||
{
|
||||
char fname[64];
|
||||
int fdf;
|
||||
|
||||
snprintf(fname, 64, "frame-%04d.jpg", fcnt++);
|
||||
fdf=open(fname, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
write (fdf, &buf85[28+ThermalSize], JpgSize);
|
||||
close(fdf);
|
||||
}
|
||||
#endif
|
||||
if (jpeg_size == 0 && JpgSize > 0) {
|
||||
jpeg_size=JpgSize;
|
||||
jpeg_buffer=(unsigned char *)malloc(jpeg_size);
|
||||
|
@ -486,7 +360,6 @@ void vframe(char ep[],char EP_error[], int r, int actual_length, unsigned char b
|
|||
update_fb();
|
||||
}
|
||||
}
|
||||
|
||||
// free memory
|
||||
free(fb_proc); // thermal RAW
|
||||
free(fb_proc2); // visible jpg
|
||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -2,7 +2,7 @@ Source: flirgtk
|
|||
Maintainer: Nicole Faerber <nicole.faerber@dpin.de>
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Standards-Version: 4.2.1
|
||||
Build-Depends:
|
||||
libgtk-3-dev,
|
||||
libjpeg-dev,
|
||||
|
|
6
debian/postinst
vendored
6
debian/postinst
vendored
|
@ -1,4 +1,2 @@
|
|||
# reload udev rules
|
||||
pkg_postinst_${PN}-udevreload () {
|
||||
udevadm control --reload-rules
|
||||
}
|
||||
#!/bin/sh
|
||||
udevadm control --reload-rules
|
||||
|
|
5
debian/postrm
vendored
5
debian/postrm
vendored
|
@ -1,4 +1,3 @@
|
|||
#!/bin/sh
|
||||
# reload udev rules
|
||||
pkg_postrm_${PN}-udevreload () {
|
||||
udevadm control --reload-rules
|
||||
}
|
||||
udevadm control --reload-rules
|
||||
|
|
226
flirgtk.c
226
flirgtk.c
|
@ -44,7 +44,7 @@
|
|||
// UI variables
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *image_darea = NULL;
|
||||
// static GtkApplication *gapp;
|
||||
static GtkApplication *gapp;
|
||||
static GtkWidget *play_button, *stop_button;
|
||||
// we paint everything in here and then into the drawing area widget
|
||||
static cairo_surface_t *psurface;
|
||||
|
@ -83,7 +83,7 @@ unsigned char *jpeg_buffer=NULL;
|
|||
unsigned int jpeg_size=0;
|
||||
|
||||
|
||||
static gboolean
|
||||
gboolean
|
||||
configure_event (GtkWidget *widget,
|
||||
GdkEventConfigure *event,
|
||||
gpointer data)
|
||||
|
@ -91,16 +91,6 @@ configure_event (GtkWidget *widget,
|
|||
//GtkAllocation allocation;
|
||||
|
||||
// g_printerr("configure event %d x %d\n", allocation.width, allocation.height);
|
||||
// if (surface)
|
||||
// cairo_surface_destroy (surface);
|
||||
|
||||
// gtk_widget_get_allocation (widget, &allocation);
|
||||
// surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
|
||||
// 640,
|
||||
// 500);
|
||||
// fbdata = cairo_image_surface_get_data(surface);
|
||||
// memset(fbdata, 0x00, 640*500*4);
|
||||
// draw_palette();
|
||||
|
||||
/* We've handled the configure event, no need for further processing. */
|
||||
return TRUE;
|
||||
|
@ -223,6 +213,7 @@ cairo_t *cr;
|
|||
cairo_restore(cr);
|
||||
cairo_surface_destroy (ir_surface);
|
||||
}
|
||||
|
||||
if (jpeg_size != 0 && jpeg_buffer != NULL) {
|
||||
if (take_vis_shot) {
|
||||
take_vis_shot=FALSE;
|
||||
|
@ -246,44 +237,44 @@ cairo_t *cr;
|
|||
|
||||
// then draw decoration on top
|
||||
// the color palette with min/max temperatures
|
||||
if (show_palette) {
|
||||
palette_surface=draw_palette();
|
||||
cairo_save(cr);
|
||||
cairo_rectangle(cr,0,481,640,500);
|
||||
cairo_clip(cr);
|
||||
cairo_set_source_surface (cr, palette_surface, 0, 481);
|
||||
cairo_paint (cr);
|
||||
cairo_restore(cr);
|
||||
}
|
||||
if (show_palette) {
|
||||
palette_surface=draw_palette();
|
||||
cairo_save(cr);
|
||||
cairo_rectangle(cr,0,481,640,500);
|
||||
cairo_clip(cr);
|
||||
cairo_set_source_surface (cr, palette_surface, 0, 481);
|
||||
cairo_paint (cr);
|
||||
cairo_restore(cr);
|
||||
}
|
||||
|
||||
if (show_crosshair) {
|
||||
// crosshair in the center
|
||||
cairo_set_line_width (cr, 3);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_move_to(cr, 320, 200);
|
||||
cairo_line_to(cr, 320, 280);
|
||||
cairo_stroke (cr);
|
||||
cairo_move_to(cr, 280, 240);
|
||||
cairo_line_to(cr, 360, 240);
|
||||
cairo_stroke (cr);
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
cairo_move_to(cr, 320, 200);
|
||||
cairo_line_to(cr, 320, 280);
|
||||
cairo_stroke (cr);
|
||||
cairo_move_to(cr, 280, 240);
|
||||
cairo_line_to(cr, 360, 240);
|
||||
cairo_stroke (cr);
|
||||
if (show_crosshair) {
|
||||
// crosshair in the center
|
||||
cairo_set_line_width (cr, 3);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_move_to(cr, 320, 200);
|
||||
cairo_line_to(cr, 320, 280);
|
||||
cairo_stroke (cr);
|
||||
cairo_move_to(cr, 280, 240);
|
||||
cairo_line_to(cr, 360, 240);
|
||||
cairo_stroke (cr);
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
cairo_move_to(cr, 320, 200);
|
||||
cairo_line_to(cr, 320, 280);
|
||||
cairo_stroke (cr);
|
||||
cairo_move_to(cr, 280, 240);
|
||||
cairo_line_to(cr, 360, 240);
|
||||
cairo_stroke (cr);
|
||||
|
||||
// print center temperature near crosshair
|
||||
snprintf(tdisp, 16, "%.1f°C", t_center);
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
cairo_select_font_face (cr, "Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, 24);
|
||||
cairo_move_to (cr, 330, 220);
|
||||
cairo_show_text (cr, tdisp);
|
||||
}
|
||||
// print center temperature near crosshair
|
||||
snprintf(tdisp, 16, "%.1f°C", t_center);
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
cairo_select_font_face (cr, "Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, 24);
|
||||
cairo_move_to (cr, 330, 220);
|
||||
cairo_show_text (cr, tdisp);
|
||||
}
|
||||
|
||||
// print battery % top right
|
||||
if (show_battery) {
|
||||
|
@ -387,8 +378,10 @@ static void
|
|||
close_window (void)
|
||||
{
|
||||
// clean up and quit
|
||||
window = NULL;
|
||||
gtk_main_quit();
|
||||
//window = NULL;
|
||||
// gtk_main_quit();
|
||||
// g_application_quit(gapp);
|
||||
gtk_application_remove_window(gapp, GTK_WINDOW(window));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -427,7 +420,9 @@ tempreflected_changed (GtkSpinButton *spin_button, gpointer user_data)
|
|||
}
|
||||
|
||||
void
|
||||
ir_settings_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
ir_settings_activate(GSimpleAction *simple,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog, *hb, *c, *vb, *w;
|
||||
GtkDialogFlags flags = GTK_DIALOG_USE_HEADER_BAR /*| GTK_DIALOG_MODAL*/ | GTK_DIALOG_DESTROY_WITH_PARENT;
|
||||
|
@ -516,7 +511,9 @@ show_crosshair_toggled (GtkToggleButton *togglebutton, gpointer user_data)
|
|||
}
|
||||
|
||||
void
|
||||
ui_settings_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
ui_settings_activate (GSimpleAction *simple,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog, *hb, *c, *vb, *w;
|
||||
GtkDialogFlags flags = GTK_DIALOG_USE_HEADER_BAR /*| GTK_DIALOG_MODAL*/ | GTK_DIALOG_DESTROY_WITH_PARENT;
|
||||
|
@ -584,7 +581,10 @@ vis_y_offset_changed (GtkSpinButton *spin_button, gpointer user_data)
|
|||
}
|
||||
|
||||
void
|
||||
vis_settings_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
vis_settings_activate
|
||||
(GSimpleAction *simple,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog, *hb, *c, *vb, *w;
|
||||
GtkDialogFlags flags = GTK_DIALOG_USE_HEADER_BAR /*| GTK_DIALOG_MODAL*/ | GTK_DIALOG_DESTROY_WITH_PARENT;
|
||||
|
@ -652,55 +652,62 @@ GtkDialogFlags flags = GTK_DIALOG_USE_HEADER_BAR /*| GTK_DIALOG_MODAL*/ | GTK_DI
|
|||
gtk_widget_destroy(dialog);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_main_window (void)
|
||||
|
||||
void
|
||||
quit_activate
|
||||
(GSimpleAction *simple,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
close_window ();
|
||||
}
|
||||
|
||||
void
|
||||
create_main_window (GtkWidget *appwindow)
|
||||
{
|
||||
//GtkWidget *gappw;
|
||||
GtkWidget *box;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *w, *i;
|
||||
GtkWidget *m, *mi;
|
||||
|
||||
// GtkWidget *da;
|
||||
//GtkWidget *m, *mi;
|
||||
GMenu *menu;
|
||||
GActionGroup *group;
|
||||
const GActionEntry entries[] = {
|
||||
{ "uisettings", ui_settings_activate },
|
||||
{ "irsettings", ir_settings_activate },
|
||||
{ "vissettings", vis_settings_activate },
|
||||
{ "quit", quit_activate },
|
||||
};
|
||||
|
||||
// init default color palette
|
||||
color_palette = palette_Rainbow;
|
||||
|
||||
// gappw=gtk_application_window_new(gapp);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
// window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
window = appwindow;
|
||||
gtk_window_set_title (GTK_WINDOW (window), "FLIR One");
|
||||
w=gtk_header_bar_new();
|
||||
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(w), TRUE);
|
||||
gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR(w), ":menu,close");
|
||||
// i = gtk_button_new_from_icon_name("open-menu-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||
i=gtk_menu_button_new();
|
||||
|
||||
m=gtk_menu_new();
|
||||
mi=gtk_menu_item_new_with_label("UI Settings");
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(m), mi);
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (ui_settings_activate), NULL);
|
||||
mi=gtk_menu_item_new_with_label("IR Settings");
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(m), mi);
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (ir_settings_activate), NULL);
|
||||
mi=gtk_menu_item_new_with_label("Vis Settings");
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(m), mi);
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (vis_settings_activate), NULL);
|
||||
mi=gtk_separator_menu_item_new ();
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(m), mi);
|
||||
mi=gtk_menu_item_new_with_label("Quit");
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(m), mi);
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
group = (GActionGroup*)g_simple_action_group_new ();
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL);
|
||||
menu=g_menu_new();
|
||||
g_menu_append(menu, "UI Settings", "menu.uisettings");
|
||||
g_menu_append(menu, "IR Settings", "menu.irsettings");
|
||||
g_menu_append(menu, "Vis Settings", "menu.vissettings");
|
||||
g_menu_append(menu, "Quit", "menu.quit");
|
||||
|
||||
gtk_widget_insert_action_group(i, "menu", group);
|
||||
gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(i), G_MENU_MODEL(menu));
|
||||
|
||||
gtk_menu_button_set_use_popover(GTK_MENU_BUTTON(i), TRUE);
|
||||
gtk_menu_button_set_popup (GTK_MENU_BUTTON(i), m);
|
||||
gtk_widget_show_all(m);
|
||||
gtk_menu_button_set_direction(GTK_MENU_BUTTON(i), GTK_ARROW_NONE);
|
||||
|
||||
|
||||
gtk_header_bar_pack_end(GTK_HEADER_BAR(w),i);
|
||||
gtk_window_set_titlebar(GTK_WINDOW (window), w);
|
||||
// g_signal_connect (w, "clicked",
|
||||
// G_CALLBACK (menu_clicked), NULL);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (close_window), NULL);
|
||||
|
@ -714,8 +721,6 @@ GtkWidget *m, *mi;
|
|||
// 48 GTK_ICON_SIZE_DIALOG
|
||||
// 32 GTK_ICON_SIZE_DND
|
||||
// media-playback-start
|
||||
// w = gtk_button_new_with_label("Start");
|
||||
// w = gtk_button_new_from_icon_name("media-playback-start", GTK_ICON_SIZE_DND);
|
||||
play_button = gtk_toggle_button_new();
|
||||
i = gtk_image_new_from_icon_name("media-playback-start", GTK_ICON_SIZE_DND);
|
||||
gtk_button_set_image(GTK_BUTTON(play_button),i);
|
||||
|
@ -724,9 +729,6 @@ GtkWidget *m, *mi;
|
|||
g_signal_connect (play_button, "clicked",
|
||||
G_CALLBACK (start_clicked), NULL);
|
||||
|
||||
// media-playback-stop
|
||||
// w = gtk_button_new_with_label("Stop");
|
||||
//w = gtk_button_new_from_icon_name("media-playback-stop", GTK_ICON_SIZE_DND);
|
||||
stop_button = gtk_toggle_button_new();
|
||||
i = gtk_image_new_from_icon_name("media-playback-stop", GTK_ICON_SIZE_DND);
|
||||
gtk_button_set_image(GTK_BUTTON(stop_button),i);
|
||||
|
@ -736,25 +738,6 @@ GtkWidget *m, *mi;
|
|||
g_signal_connect (stop_button, "clicked",
|
||||
G_CALLBACK (stop_clicked), NULL);
|
||||
|
||||
// drop down for color palettes
|
||||
#if 0
|
||||
w = gtk_combo_box_text_new();
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "7");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "15");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "17");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "85");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "92");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "Grayscale");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "Grey");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "Iron 2");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "Iron Black");
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(w), NULL, "Rainbow");
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX(w), 9);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), w);
|
||||
g_signal_connect (w, "changed",
|
||||
G_CALLBACK (palette_changed), NULL);
|
||||
#endif
|
||||
|
||||
w = gtk_toggle_button_new_with_label("IR");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(w), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), w);
|
||||
|
@ -767,8 +750,6 @@ GtkWidget *m, *mi;
|
|||
g_signal_connect (w, "clicked",
|
||||
G_CALLBACK (viscam_clicked), NULL);
|
||||
|
||||
// w = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL, 0.0, 1.0, .01);
|
||||
|
||||
psurface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 640, 500);
|
||||
|
||||
image_darea = gtk_drawing_area_new ();
|
||||
|
@ -789,18 +770,33 @@ GtkWidget *m, *mi;
|
|||
|
||||
gtk_widget_show_all(window);
|
||||
|
||||
return window;
|
||||
// return window;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
flirgtk_app_activate (GApplication *application, gpointer user_data)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_application_window_new (GTK_APPLICATION (application));
|
||||
create_main_window(widget);
|
||||
gtk_window_present (GTK_WINDOW(widget));
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
// gapp=gtk_application_new("org.gnome.flirgtk", G_APPLICATION_FLAGS_NONE);
|
||||
gtk_init(&argc, &argv);
|
||||
gapp=gtk_application_new("org.gnome.flirgtk", G_APPLICATION_FLAGS_NONE);
|
||||
// gtk_init(&argc, &argv);
|
||||
|
||||
create_main_window();
|
||||
//create_main_window();
|
||||
g_signal_connect(gapp, "activate", G_CALLBACK (flirgtk_app_activate), NULL);
|
||||
|
||||
gtk_main();
|
||||
g_application_run (G_APPLICATION (gapp), argc, argv);
|
||||
g_object_unref (gapp);
|
||||
|
||||
// gtk_main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
12
flirgtk.desktop
Normal file
12
flirgtk.desktop
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=FlirGTK
|
||||
GenericName=FlirGTK
|
||||
Comment=Live view and picture taking with FLIR ONE USB IR camera
|
||||
Comment[de]=Live view and picture taking with FLIR ONE USB IR camera
|
||||
Icon=flirgtk
|
||||
StartupNotify=true
|
||||
Terminal=false
|
||||
Exec=flirgtk
|
||||
Categories=GTK;GNOME;Utility;
|
||||
Keywords=flir;
|
BIN
flirgtk.png
Normal file
BIN
flirgtk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
Loading…
Reference in a new issue