| 1 |
#pragma once |
| 2 |
#include <gtkmm.h> |
| 3 |
#include "common/common.hpp" |
| 4 |
#include "editor_base.hpp" |
| 5 |
#include "util/sort_helper.hpp" |
| 6 |
#include "pool/unit.hpp" |
| 7 |
#include "rules/rules.hpp" |
| 8 |
|
| 9 |
namespace horizon { |
| 10 |
|
| 11 |
class UnitEditor : public Gtk::Box, public PoolEditorBase { |
| 12 |
friend class PinEditor; |
| 13 |
|
| 14 |
public: |
| 15 |
UnitEditor(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, const std::string &filename, |
| 16 |
class IPool &p); |
| 17 |
static UnitEditor *create(const std::string &filename, class IPool &p); |
| 18 |
void select(const ItemSet &items) override; |
| 19 |
|
| 20 |
void save_as(const std::string &fn) override; |
| 21 |
std::string get_name() const override; |
| 22 |
const UUID &get_uuid() const override; |
| 23 |
RulesCheckResult run_checks() const override; |
| 24 |
const FileVersion &get_version() const override; |
| 25 |
unsigned int get_required_version() const override; |
| 26 |
ObjectType get_type() const override; |
| 27 |
|
| 28 |
virtual ~UnitEditor(){}; |
| 29 |
|
| 30 |
private: |
| 31 |
Unit unit; |
| 32 |
Gtk::Entry *name_entry = nullptr; |
| 33 |
Gtk::Entry *manufacturer_entry = nullptr; |
| 34 |
Gtk::ListBox *pins_listbox = nullptr; |
| 35 |
Gtk::Button *add_button = nullptr; |
| 36 |
Gtk::Button *delete_button = nullptr; |
| 37 |
Gtk::CheckButton *cross_probing_cb = nullptr; |
| 38 |
Gtk::Label *pin_count_label = nullptr; |
| 39 |
|
| 40 |
Glib::RefPtr<Gtk::SizeGroup> sg_direction; |
| 41 |
Glib::RefPtr<Gtk::SizeGroup> sg_name; |
| 42 |
Glib::RefPtr<Gtk::SizeGroup> sg_names; |
| 43 |
|
| 44 |
void handle_add(); |
| 45 |
void handle_delete(); |
| 46 |
void sort(); |
| 47 |
void handle_activate(class PinEditor *ed); |
| 48 |
void update_pin_count(); |
| 49 |
|
| 50 |
SortHelper sort_helper; |
| 51 |
void load(); |
| 52 |
bool propagating = false; |
| 53 |
|
| 54 |
std::unique_ptr<HistoryManager::HistoryItem> make_history_item(const std::string &comment) override; |
| 55 |
void history_load(const HistoryManager::HistoryItem &it) override; |
| 56 |
}; |
| 57 |
} // namespace horizon |