Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pubby committed Sep 18, 2023
1 parent c0c025f commit ac159bc
Show file tree
Hide file tree
Showing 10 changed files with 356 additions and 9 deletions.
11 changes: 8 additions & 3 deletions src/chr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,14 @@ void chr_editor_t::on_open_collision(wxCommandEvent& event)
std::string filename = open_dialog.GetPath().ToStdString();
collision_filename->SetValue(filename);
model.collision_path = filename;
auto bm = load_collision_file(filename);
model.collision_bitmaps = std::move(bm.first);
model.collision_wx_bitmaps = std::move(bm.second);
try
{
auto bm = load_collision_file(filename);
model.collision_bitmaps = std::move(bm.first);
model.collision_wx_bitmaps = std::move(bm.second);
}
catch(...)
{}
Refresh();
model.modify();
}
Expand Down
2 changes: 2 additions & 0 deletions src/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ std::pair<std::vector<bitmap_t>, std::vector<wxBitmap>> load_collision_file(wxSt
return {};

std::pair<std::vector<bitmap_t>, std::vector<wxBitmap>> ret;

wxLogNull go_away;
wxImage base(string);
if(!base.IsOk())
return {};
Expand Down
6 changes: 6 additions & 0 deletions src/grid_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,3 +465,9 @@ void editor_t::select_all(bool select)
canvas_box().selector().select_all(select);
Refresh();
}

void editor_t::select_invert()
{
canvas_box().selector().select_invert();
Refresh();
}
1 change: 1 addition & 0 deletions src/grid_box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ class editor_t : public wxPanel

virtual tile_copy_t copy(bool cut);
virtual void select_all(bool select = true);
virtual void select_invert();
};

class base_tab_panel_t : public wxPanel
Expand Down
2 changes: 2 additions & 0 deletions src/id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ enum
ID_LEVEL_GRID,
ID_SELECT_ALL,
ID_SELECT_NONE,
ID_SELECT_USAGE,
ID_SELECT_INVERT,
};

#endif
18 changes: 18 additions & 0 deletions src/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,3 +1008,21 @@ void level_editor_t::select_all(bool select)
else
return editor_t::select_all(select);
}

void level_editor_t::select_invert()
{
if(level->current_layer == OBJECT_LAYER)
{
decltype(level->object_selector) new_selector;

for(unsigned i = 0; i < level->objects.size(); ++i)
if(level->object_selector.count(i) == 0)
new_selector.insert(i);

level->object_selector = std::move(new_selector);

Refresh();
}
else
return editor_t::select_invert();
}
1 change: 1 addition & 0 deletions src/level.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class level_editor_t : public editor_t
void on_active(unsigned i);

virtual void select_all(bool select = true) override;
virtual void select_invert() override;
public:
void model_refresh();
void load_metatiles();
Expand Down

0 comments on commit ac159bc

Please sign in to comment.