Skip to content

Commit

Permalink
tools: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dbartolini committed Aug 4, 2024
1 parent 85189a6 commit 9bb0644
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 0 additions & 2 deletions tools/config.vala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,4 @@ const string THUMBNAIL_BOOT_DIR = "core/editors/thumbnail";
const string LEVEL_NONE = "";
const string LEVEL_EMPTY = "core/editors/levels/empty";

const uint32 DEFAULT_UNDO_REDO_MAX_SIZE = 8;

} /* namespace Crown */
24 changes: 6 additions & 18 deletions tools/level_editor/level_editor.vala
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,6 @@ public class LevelEditorApplication : Gtk.Application

_settings = SJSON.load_from_path(_settings_file.get_path());

// Set theme.
set_theme(Theme.DARK);
if (_settings.has_key("preferences")) {
Hashtable preferences = (Hashtable)_settings["preferences"];
if (preferences.has_key("theme"))
set_theme_from_name((string)preferences["theme"]);
}

// HACK: register CrownClamp type within GObject's type system to
// make GtkBuilder able to find it when creating the widget from
// .ui files.
Expand Down Expand Up @@ -654,16 +646,6 @@ public class LevelEditorApplication : Gtk.Application
_project.register_importer("Texture", { "png", "tga", "dds", "ktx", "pvr" }, TextureResource.import, 2.0);
_project.register_importer("Font", { "ttf", "otf" }, FontResource.import, 3.0);

uint32 undo_redo_size = DEFAULT_UNDO_REDO_MAX_SIZE;
if (_settings.has_key("preferences")) {
Hashtable preferences = (Hashtable)_settings["preferences"];
if (preferences.has_key("undo_redo_max_size"))
undo_redo_size = (uint32)(double)preferences["undo_redo_max_size"];
}
_undo_redo = new UndoRedo(undo_redo_size*1024*1024);
_database = new Database(_project, _undo_redo);
_database.key_changed.connect(() => { update_active_window_title(); });

_editor = new RuntimeInstance(_subprocess_launcher, "editor");
_editor.message_received.connect(on_message_received);
_editor.connected.connect(on_editor_connected);
Expand All @@ -674,6 +656,8 @@ public class LevelEditorApplication : Gtk.Application
_preferences_dialog.delete_event.connect(_preferences_dialog.hide_on_delete);
_preferences_dialog.decode(_settings);

set_theme_from_name(_preferences_dialog._theme_combo.value);

_resource_preview = new RuntimeInstance(_subprocess_launcher, "resource_preview");
_resource_preview.message_received.connect(on_message_received);
_resource_preview.connected.connect(on_runtime_connected);
Expand All @@ -692,6 +676,10 @@ public class LevelEditorApplication : Gtk.Application
_thumbnail.disconnected.connect(on_runtime_disconnected);
_thumbnail.disconnected_unexpected.connect(on_runtime_disconnected_unexpected);

_undo_redo = new UndoRedo((uint)_preferences_dialog._undo_redo_max_size.value * 1024 * 1024);
_database = new Database(_project, _undo_redo);
_database.key_changed.connect(() => { update_active_window_title(); });

_level = new Level(_database, _editor, _project);

// Editor state
Expand Down

0 comments on commit 9bb0644

Please sign in to comment.