| 1 |
#pragma once |
| 2 |
#include "common/common.hpp" |
| 3 |
#include "pool/part.hpp" |
| 4 |
#include "pool/pool.hpp" |
| 5 |
#include "pool/pool_parametric.hpp" |
| 6 |
#include "util/uuid.hpp" |
| 7 |
#include "util/window_state_store.hpp" |
| 8 |
#include "util/paned_state_store.hpp" |
| 9 |
#include <array> |
| 10 |
#include <gtkmm.h> |
| 11 |
#include <set> |
| 12 |
#include "util/item_set.hpp" |
| 13 |
#include <optional> |
| 14 |
|
| 15 |
namespace horizon { |
| 16 |
|
| 17 |
class PartBrowserWindow : public Gtk::Window { |
| 18 |
public: |
| 19 |
PartBrowserWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, const std::string &pool_path, |
| 20 |
std::deque<UUID> &favs); |
| 21 |
static PartBrowserWindow *create(Gtk::Window *p, const std::string &pool_path, std::deque<UUID> &favs); |
| 22 |
typedef sigc::signal<void, UUID> type_signal_place_part; |
| 23 |
type_signal_place_part signal_place_part() |
| 24 |
{ |
| 25 |
return s_signal_place_part; |
| 26 |
} |
| 27 |
type_signal_place_part signal_assign_part() |
| 28 |
{ |
| 29 |
return s_signal_assign_part; |
| 30 |
} |
| 31 |
|
| 32 |
typedef sigc::signal<void, ItemSet> type_signal_open_pool_cache_window; |
| 33 |
type_signal_open_pool_cache_window signal_open_pool_cache_window() |
| 34 |
{ |
| 35 |
return s_signal_open_pool_cache_window; |
| 36 |
} |
| 37 |
|
| 38 |
void placed_part(const UUID &uu); |
| 39 |
void go_to_part(const UUID &uu); |
| 40 |
void set_can_assign(bool v); |
| 41 |
void set_pool_cache_status(const class PoolCacheStatus &st); |
| 42 |
void focus_search(); |
| 43 |
void pool_updated(const std::string &bp); |
| 44 |
void set_entity(const UUID &uu, const std::string &hint); |
| 45 |
|
| 46 |
private: |
| 47 |
Gtk::Menu *add_search_menu = nullptr; |
| 48 |
Gtk::Notebook *notebook = nullptr; |
| 49 |
Gtk::Button *place_part_button = nullptr; |
| 50 |
Gtk::Button *assign_part_button = nullptr; |
| 51 |
Gtk::ToggleButton *fav_button = nullptr; |
| 52 |
Gtk::ListBox *lb_favorites = nullptr; |
| 53 |
Gtk::ListBox *lb_recent = nullptr; |
| 54 |
Gtk::InfoBar *out_of_date_info_bar = nullptr; |
| 55 |
class PartPreview *preview = nullptr; |
| 56 |
class PoolBrowserPart *add_search(const UUID &part = UUID()); |
| 57 |
class PoolBrowserParametric *add_search_parametric(const std::string &table_name); |
| 58 |
void handle_switch_page(Gtk::Widget *w, guint index); |
| 59 |
void handle_fav_toggled(); |
| 60 |
void update_favorites(); |
| 61 |
void update_recents(); |
| 62 |
void handle_favorites_selected(Gtk::ListBoxRow *row); |
| 63 |
void handle_favorites_activated(Gtk::ListBoxRow *row); |
| 64 |
void handle_place_part(); |
| 65 |
void handle_assign_part(); |
| 66 |
void handle_activate_part(); |
| 67 |
sigc::connection fav_toggled_conn; |
| 68 |
std::set<Gtk::Widget *> search_views; |
| 69 |
Pool pool; |
| 70 |
PoolParametric pool_parametric; |
| 71 |
UUID part_current; |
| 72 |
void update_part_current(); |
| 73 |
void update_out_of_date_info_bar(); |
| 74 |
ItemSet items_out_of_date; |
| 75 |
std::deque<UUID> &favorites; |
| 76 |
std::deque<UUID> recents; |
| 77 |
|
| 78 |
type_signal_place_part s_signal_place_part; |
| 79 |
type_signal_place_part s_signal_assign_part; |
| 80 |
type_signal_open_pool_cache_window s_signal_open_pool_cache_window; |
| 81 |
bool can_assign = false; |
| 82 |
const class PoolCacheStatus *pool_cache_status = nullptr; |
| 83 |
|
| 84 |
WindowStateStore state_store; |
| 85 |
std::optional<PanedStateStore> paned_state_store; |
| 86 |
|
| 87 |
Gtk::InfoBar *entity_info_bar = nullptr; |
| 88 |
Gtk::Label *entity_label = nullptr; |
| 89 |
UUID entity_uuid; |
| 90 |
|
| 91 |
sigc::connection pool_updated_conn; |
| 92 |
bool needs_reload = false; |
| 93 |
void reload(); |
| 94 |
}; |
| 95 |
} // namespace horizon |