-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrontend.h
More file actions
59 lines (45 loc) · 1.57 KB
/
Copy pathfrontend.h
File metadata and controls
59 lines (45 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// by wuwbobo2021 <https://github.com/wuwbobo2021>, <wuwbobo@outlook.com>
// Licensed under LGPL version 2.1.
#ifndef SIMPLE_CAIRO_PLOT_FRONTEND_H
#define SIMPLE_CAIRO_PLOT_FRONTEND_H
#include <simple-cairo-plot/recorder.h>
#include <gtkmm/window.h>
#include <gtkmm/filechooserdialog.h>
#include <gtkmm/button.h>
namespace SimpleCairoPlot
{
class Frontend: public sigc::trackable
{
std::vector<VariableAccessPtr> ptrs; unsigned int buf_size;
Recorder* rec;
std::thread* thread_gtk = NULL;
Glib::Dispatcher* dispatcher_gtk = NULL;
Gtk::Window* window = NULL;
Gtk::FileChooserDialog* file_dialog;
Gtk::Button* button_start_stop;
void create_window();
void create_file_dialog();
void app_run();
void on_buffers_full();
void on_button_start_stop_clicked();
void on_button_open_clicked();
void on_button_save_clicked();
void close_window();
public:
// two frontends on the same computer must have different `app_name`.
std::string app_name = "org.simple-cairo-plot.frontend";
std::string title = "Recorder";
Frontend(); void init(std::vector<VariableAccessPtr>& ptrs, unsigned int buf_size);
Frontend(std::vector<VariableAccessPtr>& ptrs, unsigned int buf_size);
Frontend(const Frontend&) = delete;
Frontend& operator=(const Frontend&) = delete;
virtual ~Frontend();
#ifndef _WIN32
void open(); //create a new thread to run the frontend
#endif
Recorder& recorder() const; //notice: don't keep the returned reference when you need to close the frontend
void run(); //run in current thread or join the existing frontend thread, blocks
void close();
};
}
#endif