mirror of
https://github.com/godotengine/godot.git
synced 2026-02-07 11:21:49 +00:00
Merge pull request #115719 from dalexeev/theme-editor-remember-split-offset
Theme Editor: Remember split offset between editor sessions
This commit is contained in:
@@ -3962,6 +3962,18 @@ void ThemeEditor::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
void ThemeEditor::save_layout_to_config(Ref<ConfigFile> &p_layout, const String &p_section) const {
|
||||
const int split_offset = Math::round(main_hs->get_split_offset() / EDSCALE);
|
||||
p_layout->set_value(p_section, "split_offset", split_offset);
|
||||
}
|
||||
|
||||
void ThemeEditor::load_layout_from_config(const Ref<ConfigFile> &p_layout, const String &p_section) {
|
||||
if (p_layout->has_section_key(p_section, "split_offset")) {
|
||||
const int split_offset = p_layout->get_value(p_section, "split_offset");
|
||||
main_hs->set_split_offset(split_offset * EDSCALE);
|
||||
}
|
||||
}
|
||||
|
||||
ThemeEditor::ThemeEditor() {
|
||||
set_name(TTRC("Theme"));
|
||||
set_icon_name("ThemeDock");
|
||||
@@ -4026,7 +4038,7 @@ ThemeEditor::ThemeEditor() {
|
||||
theme_edit_dialog->hide();
|
||||
top_menu->add_child(theme_edit_dialog);
|
||||
|
||||
HSplitContainer *main_hs = memnew(HSplitContainer);
|
||||
main_hs = memnew(HSplitContainer);
|
||||
main_hs->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
content_vb->add_child(main_hs);
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ class Button;
|
||||
class CheckButton;
|
||||
class EditorFileDialog;
|
||||
class FilterLineEdit;
|
||||
class HSplitContainer;
|
||||
class ItemList;
|
||||
class Label;
|
||||
class LineEdit;
|
||||
@@ -454,6 +455,7 @@ class ThemeEditor : public EditorDock {
|
||||
|
||||
Label *theme_name = nullptr;
|
||||
ThemeItemEditorDialog *theme_edit_dialog = nullptr;
|
||||
HSplitContainer *main_hs = nullptr;
|
||||
|
||||
void _theme_save_button_cbk(bool p_save_as);
|
||||
void _theme_edit_button_cbk();
|
||||
@@ -477,6 +479,9 @@ class ThemeEditor : public EditorDock {
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
virtual void save_layout_to_config(Ref<ConfigFile> &p_layout, const String &p_section) const override;
|
||||
virtual void load_layout_from_config(const Ref<ConfigFile> &p_layout, const String &p_section) override;
|
||||
|
||||
public:
|
||||
void edit(const Ref<Theme> &p_theme);
|
||||
Ref<Theme> get_edited_theme();
|
||||
|
||||
Reference in New Issue
Block a user