forked from blackhole89/notekit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
105 lines (83 loc) · 2.13 KB
/
mainwindow.h
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "config.h"
#include <gtkmm.h>
#include <json/json.h>
#include "notebook.h"
#include "navigation.h"
enum {
WND_ACTION_COLOR,
WND_ACTION_NEXT_NOTE,
WND_ACTION_PREV_NOTE,
WND_ACTION_TOGGLE_SIDEBAR
};
class CMainWindow : public Gtk::ApplicationWindow
{
public:
CMainWindow(const Glib::RefPtr<Gtk::Application> &);
virtual ~CMainWindow();
std::string active_document;
std::string selected_document;
sigc::connection close_handler;
void HardClose();
void FetchAndSave();
void OpenDocument(std::string filename);
void SetActiveFilename(std::string filename);
void FetchAndExport();
void FocusDocument();
void GetColor(int id, float &r, float &g, float &b);
void SetColor(int id, float r, float g, float b);
protected:
//Signal handlers:
bool on_close(GdkEventAny* any_event);
void on_action(std::string name,int type, int param);
bool on_click_color(GdkEventButton *btn, int num);
bool on_motion_notify(GdkEventMotion* event);
sigc::connection idle_timer;
bool on_idle();
Gtk::HBox split;
//Gtk::Box filler;
/* config */
std::string config_path;
std::string default_base_path;
std::string data_path;
void CalculatePaths();
Json::Value config;
void LoadConfig();
void SaveConfig();
void RunConfigWindow();
/* tree view on the left */
Gtk::ScrolledWindow nav_scroll;
Gtk::TreeView nav;
CNavigationView nav_model;
/* document view */
Gtk::ScrolledWindow sview_scroll;
CNotebook sview;
Glib::RefPtr<Gsv::Buffer> sbuffer;
Glib::RefPtr<Gdk::Cursor> pen_cursor, text_cursor, eraser_cursor, selection_cursor;
/* tool palette */
Glib::RefPtr<Gtk::Builder> toolbar_builder;
Glib::RefPtr<Gtk::CssProvider> toolbar_style;
Gtk::Toolbar *toolbar;
void InitToolbar();
void UpdateToolbarColors();
/* header */
bool use_hbar;
Gtk::HeaderBar hbar;
Gtk::MenuButton appbutton;
/* menu */
Gtk::Menu appmenu;
struct {
Gtk::MenuItem prefs;
Gtk::SeparatorMenuItem sep;
Gtk::CheckMenuItem hide_sidebar;
Gtk::MenuItem exprt;
} am;
/* classic menu */
struct {
Gtk::VBox menu_box;
Gtk::MenuBar mbar;
Gtk::MenuItem view;
} cm;
};
#endif // MAINWINDOW_H