| 1 |
#pragma once |
| 2 |
#include <gtkmm.h> |
| 3 |
#include "common/common.hpp" |
| 4 |
#include <memory> |
| 5 |
#include "util/window_state_store.hpp" |
| 6 |
#include "util/pool_goto_provider.hpp" |
| 7 |
#include "util/item_set.hpp" |
| 8 |
#include "rules/rules.hpp" |
| 9 |
|
| 10 |
namespace horizon { |
| 11 |
|
| 12 |
class EditorWindow : public Gtk::Window, public PoolGotoProvider { |
| 13 |
public: |
| 14 |
EditorWindow(ObjectType type, const std::string &filename, class IPool *p, class PoolParametric *pp, bool read_only, |
| 15 |
bool is_temp); |
| 16 |
void reload(); |
| 17 |
bool get_need_update() const; |
| 18 |
void save(); |
| 19 |
void force_close(); |
| 20 |
bool get_needs_save() const; |
| 21 |
std::string get_filename() const; |
| 22 |
void set_original_filename(const std::string &s); |
| 23 |
ObjectType get_object_type() const; |
| 24 |
const UUID &get_uuid() const; |
| 25 |
|
| 26 |
void select(const ItemSet &items); |
| 27 |
|
| 28 |
typedef sigc::signal<void, std::string> type_signal_filename_changed; |
| 29 |
type_signal_filename_changed signal_filename_changed() |
| 30 |
{ |
| 31 |
return s_signal_filename_changed; |
| 32 |
} |
| 33 |
type_signal_filename_changed signal_saved() |
| 34 |
{ |
| 35 |
return s_signal_saved; |
| 36 |
} |
| 37 |
|
| 38 |
type_signal_goto signal_open_item() |
| 39 |
{ |
| 40 |
return s_signal_open_item; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
private: |
| 45 |
ObjectType type; |
| 46 |
class PoolEditorBase *iface = nullptr; |
| 47 |
Gtk::Button *save_button = nullptr; |
| 48 |
Gtk::MenuButton *check_button = nullptr; |
| 49 |
Gtk::Stack *check_button_stack = nullptr; |
| 50 |
class ColorBox *check_color_box = nullptr; |
| 51 |
Gtk::Popover *check_popover = nullptr; |
| 52 |
Gtk::Label *check_label = nullptr; |
| 53 |
Gtk::InfoBar *info_bar = nullptr; |
| 54 |
Gtk::Label *info_bar_label = nullptr; |
| 55 |
Gtk::Button *undo_button = nullptr; |
| 56 |
Gtk::Button *redo_button = nullptr; |
| 57 |
void update_undo_redo(); |
| 58 |
class IPool &pool; |
| 59 |
class PoolParametric *pool_parametric; |
| 60 |
bool need_update = false; |
| 61 |
std::string original_filename; |
| 62 |
|
| 63 |
type_signal_filename_changed s_signal_filename_changed; |
| 64 |
type_signal_filename_changed s_signal_saved; |
| 65 |
|
| 66 |
WindowStateStore state_store; |
| 67 |
void run_checks(); |
| 68 |
bool read_only; |
| 69 |
|
| 70 |
unsigned int saved_version = 0; |
| 71 |
void update_version_warning(); |
| 72 |
|
| 73 |
type_signal_goto s_signal_open_item; |
| 74 |
}; |
| 75 |
} // namespace horizon |