diff --git a/lib/tailor/GUI/MainWindow.rb b/lib/tailor/GUI/MainWindow.rb index 7eef7fe..0e8a936 100644 --- a/lib/tailor/GUI/MainWindow.rb +++ b/lib/tailor/GUI/MainWindow.rb @@ -67,6 +67,14 @@ module Tailor @palettePanel = Wx::ScrolledWindow.new(@mainPanel, Wx::ID_ANY) @paletteSizer = Wx::BoxSizer.new(Wx::VERTICAL) @paletteLibraryPanels = {} + + progdialog = Wx::ProgressDialog.new("Rebuilding Palette...", + "Rebuilding Palette...", + @collection.library.tile_count - 1, + self, + style = Wx::PD_SMOOTH | Wx::PD_AUTO_HIDE) + + idx = 0 @collection.library.each do |ts| tsExpandCollapseBtn = Wx::Button.new(@palettePanel, Wx::ID_ANY, ts.tileset_name) tsExpandCollapseBtn.set_min_size( @@ -79,6 +87,8 @@ module Tailor tgridSizer = Wx::GridSizer.new(cols=2) evt_button(tsExpandCollapseBtn.get_id()) { |event| on_LibExpandCollapseClicked(ts) } ts.tiles.each do |tile| + progdialog.update(idx) + idx += 1 tgridSizer.add(Wx::StaticBitmap.new(tpanel, Wx::ID_ANY, tile['image'].to_bitmap)) tgridSizer.add(Wx::StaticText.new(tpanel, Wx::ID_ANY, tile['name'])) end diff --git a/lib/tailor/Library.rb b/lib/tailor/Library.rb index d22d515..7b23e67 100644 --- a/lib/tailor/Library.rb +++ b/lib/tailor/Library.rb @@ -23,6 +23,18 @@ module Tailor end end + def count + @tilesets.size + end + + def tile_count + count = 0 + @tilesets.each do |ts| + count += ts.count + end + count + end + def delete(tileset) if tileset.instance_of?(String) @tilesets.delete(by_name(tileset)) diff --git a/lib/tailor/Tileset.rb b/lib/tailor/Tileset.rb index c13adef..543ed03 100644 --- a/lib/tailor/Tileset.rb +++ b/lib/tailor/Tileset.rb @@ -42,6 +42,10 @@ module Tailor self.tiles << {"name" => name, "image" => image} end + def count + @tiles.size + end + def get_tile(elem) if elem.instance_of?(String) self.tiles.each do