saving and restoring windows position and size on exit and startup

master
Steffen Pohle 3 years ago
parent bf30a38282
commit e3b65f1c9d

@ -1,3 +1,6 @@
2022-12-06:
- saving and restoring windows position and size on exit and startup
2022-12-04:
- RAW8 format support for SVB camera, also fixed RGB24 format
- many bug fixes for RGB conversions

@ -108,6 +108,43 @@ void Configuration::SaveConfig(std::string filename) {
jp.AddObject(je);
}
//
// save windows position
for (i = 0; i < 5; i++) {
int x, y, w, h;
string name;
switch (i) {
case 0:
name = "window-main";
break;
case 1:
name = "window-input";
break;
case 2:
name = "window-output";
break;
case 3:
name = "window-detect";
break;
case 4:
name = "window-histogram";
break;
}
GtkWidget *wnd = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), name.c_str()));
if (wnd) {
gtk_window_get_position (GTK_WINDOW(wnd), &x, &y);
gtk_window_get_size (GTK_WINDOW(wnd), &w, &h);
jp.AddObject(name+"_x", x);
jp.AddObject(name+"_y", y);
jp.AddObject(name+"_w", w);
jp.AddObject(name+"_h", h);
}
}
//
// save config
if (jp.SaveToFile(filename)) {
@ -185,6 +222,41 @@ void Configuration::LoadConfig(std::string filename) {
ctrli++;
}
}
//
// load windows position
for (i = 0; i < 5; i++) {
int x, y, w, h;
string name;
switch (i) {
case 0:
name = "window-main";
break;
case 1:
name = "window-input";
break;
case 2:
name = "window-output";
break;
case 3:
name = "window-detect";
break;
case 4:
name = "window-histogram";
break;
}
if (jp.GetValueInt(name+"_x", &x) && jp.GetValueInt(name+"_y", &y) &&
jp.GetValueInt(name+"_w", &w) && jp.GetValueInt(name+"_h", &h)) {
GtkWidget *wnd = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), name.c_str()));
if (wnd) {
gtk_window_move (GTK_WINDOW(wnd), x, y);
gtk_window_resize (GTK_WINDOW(wnd), w, h);
}
}
}
}
};

@ -1,6 +1,8 @@
#ifndef _DEBAYER_H_
#define _DEBAYER_H_
#include <stdint.h>
void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h,
uint8_t * dst, int dst_w, int dst_h);
void debayer_grbg8_simple (uint8_t * src, int src_w, int src_h,

Loading…
Cancel
Save