|
|
|
@@ -565,7 +565,7 @@ void TileSheetEditorModel::cut() {
|
|
|
|
|
const auto pt1 = m_selectionOrigin == geo::Point(-1, -1) ? geo::Point(0, 0) : m_selectionOrigin;
|
|
|
|
|
const auto pt2 = geo::Point(s->columns * TileWidth, s->rows * TileHeight);
|
|
|
|
|
setClipboardObject(m_ctx, std::move(cb));
|
|
|
|
|
pushCommand(new CutPasteCommand<CommandId::Cut>(&m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb));
|
|
|
|
|
pushCommand(ox::make<CutPasteCommand<CommandId::Cut>>(&m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TileSheetEditorModel::copy() {
|
|
|
|
@@ -594,7 +594,7 @@ void TileSheetEditorModel::paste() {
|
|
|
|
|
const auto s = activeSubSheet();
|
|
|
|
|
const auto pt1 = m_selectionOrigin == geo::Point(-1, -1) ? geo::Point(0, 0) : m_selectionOrigin;
|
|
|
|
|
const auto pt2 = geo::Point(s->columns * TileWidth, s->rows * TileHeight);
|
|
|
|
|
pushCommand(new CutPasteCommand<CommandId::Paste>(&m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
|
|
|
|
|
pushCommand(ox::make<CutPasteCommand<CommandId::Paste>>(&m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ox::FileAddress &TileSheetEditorModel::palPath() const noexcept {
|
|
|
|
@@ -602,7 +602,7 @@ const ox::FileAddress &TileSheetEditorModel::palPath() const noexcept {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ox::Error TileSheetEditorModel::setPalette(const ox::String &path) noexcept {
|
|
|
|
|
pushCommand(new PaletteChangeCommand(activeSubSheetIdx(), &m_img, path));
|
|
|
|
|
pushCommand(ox::make<PaletteChangeCommand>(activeSubSheetIdx(), &m_img, path));
|
|
|
|
|
return OxError(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -615,7 +615,7 @@ void TileSheetEditorModel::drawCommand(const geo::Point &pt, std::size_t palIdx)
|
|
|
|
|
if (m_ongoingDrawCommand) {
|
|
|
|
|
m_updated = m_updated || m_ongoingDrawCommand->append(idx);
|
|
|
|
|
} else if (activeSubSheet.getPixel(m_img.bpp, idx) != palIdx) {
|
|
|
|
|
pushCommand(new DrawCommand(&m_img, m_activeSubsSheetIdx, idx, static_cast<int>(palIdx)));
|
|
|
|
|
pushCommand(ox::make<DrawCommand>(&m_img, m_activeSubsSheetIdx, idx, static_cast<int>(palIdx)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -624,23 +624,23 @@ void TileSheetEditorModel::endDrawCommand() noexcept {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TileSheetEditorModel::addSubsheet(const TileSheet::SubSheetIdx &parentIdx) noexcept {
|
|
|
|
|
pushCommand(new AddSubSheetCommand(&m_img, parentIdx));
|
|
|
|
|
pushCommand(ox::make<AddSubSheetCommand>(&m_img, parentIdx));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TileSheetEditorModel::rmSubsheet(const TileSheet::SubSheetIdx &idx) noexcept {
|
|
|
|
|
pushCommand(new RmSubSheetCommand(&m_img, idx));
|
|
|
|
|
pushCommand(ox::make<RmSubSheetCommand>(&m_img, idx));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TileSheetEditorModel::insertTiles(const TileSheet::SubSheetIdx &idx, std::size_t tileIdx, std::size_t tileCnt) noexcept {
|
|
|
|
|
pushCommand(new InsertTilesCommand(&m_img, idx, tileIdx, tileCnt));
|
|
|
|
|
pushCommand(ox::make<InsertTilesCommand>(&m_img, idx, tileIdx, tileCnt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TileSheetEditorModel::deleteTiles(const TileSheet::SubSheetIdx &idx, std::size_t tileIdx, std::size_t tileCnt) noexcept {
|
|
|
|
|
pushCommand(new DeleteTilesCommand(&m_img, idx, tileIdx, tileCnt));
|
|
|
|
|
pushCommand(ox::make<DeleteTilesCommand>(&m_img, idx, tileIdx, tileCnt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ox::Error TileSheetEditorModel::updateSubsheet(const TileSheet::SubSheetIdx &idx, const ox::String &name, int cols, int rows) noexcept {
|
|
|
|
|
pushCommand(new UpdateSubSheetCommand(&m_img, idx, name, cols, rows));
|
|
|
|
|
pushCommand(ox::make<UpdateSubSheetCommand>(&m_img, idx, name, cols, rows));
|
|
|
|
|
return OxError(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -670,7 +670,7 @@ void TileSheetEditorModel::fill(const geo::Point &pt, int palIdx) noexcept {
|
|
|
|
|
if (m_ongoingDrawCommand) {
|
|
|
|
|
m_updated = m_updated || m_ongoingDrawCommand->append(idxList);
|
|
|
|
|
} else if (s.getPixel(m_img.bpp, pt) != palIdx) {
|
|
|
|
|
pushCommand(new DrawCommand(&m_img, m_activeSubsSheetIdx, idxList, palIdx));
|
|
|
|
|
pushCommand(ox::make<DrawCommand>(&m_img, m_activeSubsSheetIdx, idxList, palIdx));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|