diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt
index 3e99bdc43..5916be455 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt
@@ -13,6 +13,7 @@ IF(WITH_GUI)
ENDIF(WITH_GUI)
ADD_SUBDIRECTORY(translation_manager)
+ADD_SUBDIRECTORY(tile_editor)
ADD_SUBDIRECTORY(bnp_manager)
# Note: Temporarily disabled until development continues.
#ADD_SUBDIRECTORY(zone_painter)
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/CMakeLists.txt
new file mode 100644
index 000000000..f3458c909
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/CMakeLists.txt
@@ -0,0 +1,47 @@
+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${LIBXML2_INCLUDE_DIR}
+ ${QT_INCLUDES})
+
+FILE(GLOB SRC *.cpp *.h)
+SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
+
+SET(OVQT_TILE_EDITOR_PLUGIN_HDR
+ tile_model.h
+ tile_editor_main_window.h
+ tile_editor_plugin.h)
+
+SET(OVQT_TILE_EDITOR_PLUGIN_UIS
+ tile_editor_main_window.ui)
+
+SET(OVQT_PLUG_TILE_EDITOR_RCS tile_editor.qrc)
+
+SET(QT_USE_QTGUI TRUE)
+SET(QT_USE_QTOPENGL TRUE)
+
+QT4_WRAP_CPP(OVQT_TILE_EDITOR_PLUGIN_MOC_SRC ${OVQT_TILE_EDITOR_PLUGIN_HDR})
+QT4_ADD_RESOURCES( OVQT_PLUG_TILE_EDITOR_RC_SRCS ${OVQT_PLUG_TILE_EDITOR_RCS})
+QT4_WRAP_UI(OVQT_TILE_EDITOR_PLUGIN_UI_HDRS ${OVQT_TILE_EDITOR_PLUGIN_UIS})
+
+SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_TILE_EDITOR_PLUGIN_UI_HDRS})
+SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_TILE_EDITOR_PLUGIN_MOC_SRC} ${OVQT_PLUG_TILE_EDITOR_RC_SRCS})
+SOURCE_GROUP("Tile Editor Plugin" FILES ${SRC})
+SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
+
+ADD_LIBRARY(ovqt_plugin_tile_editor MODULE ${SRC} ${OVQT_TILE_EDITOR_PLUGIN_MOC_SRC} ${OVQT_PLUG_TILE_EDITOR_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_TILE_EDITOR_PLUGIN_UI_HDRS})
+
+TARGET_LINK_LIBRARIES(ovqt_plugin_tile_editor ovqt_plugin_core nelmisc ${QT_LIBRARIES})
+
+IF(WITH_STLPORT)
+ TARGET_LINK_LIBRARIES(ovqt_plugin_tile_editor ${CMAKE_THREAD_LIBS_INIT})
+ENDIF(WITH_STLPORT)
+
+NL_DEFAULT_PROPS(ovqt_plugin_tile_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Tile Editor")
+NL_ADD_RUNTIME_FLAGS(ovqt_plugin_tile_editor)
+NL_ADD_LIB_SUFFIX(ovqt_plugin_tile_editor)
+
+ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
+
+INSTALL(TARGETS ovqt_plugin_tile_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/add_tile.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/add_tile.png
new file mode 100644
index 000000000..a9de8f51d
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/add_tile.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/delete_image.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/delete_image.png
new file mode 100644
index 000000000..1bc3b4e84
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/delete_image.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/delete_tile.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/delete_tile.png
new file mode 100644
index 000000000..613c6a5f8
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/delete_tile.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/down.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/down.png
new file mode 100644
index 000000000..b0033cf64
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/down.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/empty_image.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/empty_image.png
new file mode 100644
index 000000000..9a2e358ab
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/empty_image.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_add_item.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_add_item.png
new file mode 100644
index 000000000..bde338f78
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_add_item.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_delete_item.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_delete_item.png
new file mode 100644
index 000000000..a5a1787d5
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_delete_item.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_new.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_new.png
new file mode 100644
index 000000000..d45dcb467
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_new.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_open.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_open.png
new file mode 100644
index 000000000..c4992affd
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_open.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_save.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_save.png
new file mode 100644
index 000000000..7f7d35e9a
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_save.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_save_as.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_save_as.png
new file mode 100644
index 000000000..1558632b9
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/ic_nel_save_as.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/left.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/left.png
new file mode 100644
index 000000000..9c94db1aa
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/left.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/nel.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/nel.png
new file mode 100644
index 000000000..d2139bb25
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/nel.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/replace_image.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/replace_image.png
new file mode 100644
index 000000000..94d9b76c8
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/replace_image.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/reset.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/reset.png
new file mode 100644
index 000000000..6693e842c
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/reset.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/right.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/right.png
new file mode 100644
index 000000000..eb51b8385
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/right.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation0.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation0.png
new file mode 100644
index 000000000..7434c4959
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation0.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation180.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation180.png
new file mode 100644
index 000000000..7ce524883
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation180.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation270.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation270.png
new file mode 100644
index 000000000..32b47a97c
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation270.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation90.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation90.png
new file mode 100644
index 000000000..2eb11b322
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/rotation90.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/up.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/up.png
new file mode 100644
index 000000000..e5145d052
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/images/up.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/ovqt_plugin_tile_editor.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/ovqt_plugin_tile_editor.xml
new file mode 100644
index 000000000..0e21a2eb9
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/ovqt_plugin_tile_editor.xml
@@ -0,0 +1,10 @@
+
+ ovqt_plugin_tile_editor
+ TileEditor
+ 1.0
+ Ryzom Core
+ Tile bank editing plugin.
+
+
+
+
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor.qrc b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor.qrc
new file mode 100644
index 000000000..55950d217
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor.qrc
@@ -0,0 +1,29 @@
+
+
+ images/add_tile.png
+ images/delete_image.png
+ images/delete_tile.png
+ images/replace_image.png
+
+
+ images/ic_nel_add_item.png
+ images/ic_nel_new.png
+ images/ic_nel_open.png
+ images/ic_nel_save.png
+ images/ic_nel_save_as.png
+ images/down.png
+ images/left.png
+ images/reset.png
+ images/right.png
+ images/up.png
+
+
+ images/rotation0.png
+ images/rotation90.png
+ images/rotation180.png
+ images/rotation270.png
+
+
+ images/empty_image.png
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp
new file mode 100644
index 000000000..930ae9d8b
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp
@@ -0,0 +1,299 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#include "tile_editor_main_window.h"
+
+#include "nel/misc/path.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#include "../core/icore.h"
+#include "../core/core_constants.h"
+#include "../core/menu_manager.h"
+
+#include "tile_model.h"
+#include "tile_item.h"
+#include "tile_item_delegate.h"
+
+TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
+ : QMainWindow(parent),
+ m_ui(new Ui::TileEditorMainWindow)
+{
+ m_ui->setupUi(this);
+ m_undoStack = new QUndoStack(this);
+
+ // Retrieve the menu manager
+ Core::ICore *core = Core::ICore::instance();
+ Core::MenuManager *menuManager = core->menuManager();
+
+ // Create tile rotation drop down toolbar menu.
+ m_rotationMenu = new QMenu(tr("Rotate Tile"), m_ui->toolBar);
+ m_rotationMenu->setIcon(QIcon(":/tileRotation/images/rotation0.png"));
+ QList rotateActions;
+ rotateActions.push_back(m_ui->actionRotateTile0);
+ rotateActions.push_back(m_ui->actionRotateTile90);
+ rotateActions.push_back(m_ui->actionRotateTile180);
+ rotateActions.push_back(m_ui->actionRotateTile270);
+ m_rotationMenu->addActions(rotateActions);
+ m_ui->toolBar->addAction(m_rotationMenu->menuAction());
+
+ // Create the tile zoom menu.
+ m_zoomMenu = new QMenu(tr("Zoom"), m_ui->toolBar);
+ m_zoomActionGroup = new QActionGroup(this);
+ m_zoomSignalMapper = new QSignalMapper(this);
+ QList zoomActions;
+ zoomActions.push_back(m_ui->actionZoom50);
+ zoomActions.push_back(m_ui->actionZoom100);
+ zoomActions.push_back(m_ui->actionZoom200);
+ m_zoomActionGroup->addAction(m_ui->actionZoom50);
+ m_zoomActionGroup->addAction(m_ui->actionZoom100);
+ m_zoomActionGroup->addAction(m_ui->actionZoom200);
+ m_zoomMenu->addActions(zoomActions);
+ m_ui->toolBar->addAction(m_zoomMenu->menuAction());
+
+ m_tileEditorMenu = new QMenu(tr("Tile Editor"), core->menuManager()->menuBar());
+ m_tileDisplayMenu = new QMenu(tr("Tile Display"), m_ui->toolBar);
+ QList displayActions;
+ displayActions.push_back(m_ui->actionTileDisplayFilename);
+ displayActions.push_back(m_ui->actionTileDisplayIndex);
+ m_ui->actionTileDisplayIndex->setChecked(true);
+ m_tileDisplayMenu->addActions(displayActions);
+ m_tileEditorMenu->addMenu(m_tileDisplayMenu);
+ core->menuManager()->menuBar()->addMenu(m_tileEditorMenu);
+
+ // Set up the list views.
+ QStringList headers;
+ headers << "Tile Set";
+ m_model = new TileModel(headers, this);
+ m_tileItemDelegate = new TileItemDelegate();
+
+ // Set up the tile set list view.
+ m_ui->tileSetLV->setModel(m_model);
+ //m_ui->tileSetLV->setRootIndex(m_model->index(0,0));
+ connect(m_ui->tileSetAddTB, SIGNAL(clicked()), this, SLOT(onTileSetAdd()));
+ connect(m_ui->tileSetLV->selectionModel(),
+ SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
+ this, SLOT(changeActiveTileSet(const QModelIndex &, const QModelIndex &)));
+
+ // 128x128 List View
+ //m_ui->listView128->setItemDelegate(m_tileItemDelegate);
+ m_ui->listView128->setModel(m_model);
+ m_ui->listView128->addAction(m_ui->actionAddTile);
+ m_ui->listView128->addAction(m_ui->actionDeleteTile);
+ m_ui->listView128->addAction(m_ui->actionReplaceImage);
+ m_ui->listView128->addAction(m_ui->actionDeleteImage);
+
+ // 256x256 List View
+ //m_ui->listView256->setItemDelegate(m_tileItemDelegate);
+ m_ui->listView256->setModel(m_model);
+ m_ui->listView256->addAction(m_ui->actionAddTile);
+ m_ui->listView256->addAction(m_ui->actionDeleteTile);
+ m_ui->listView256->addAction(m_ui->actionReplaceImage);
+ m_ui->listView256->addAction(m_ui->actionDeleteImage);
+
+ // Transition List View
+ //m_ui->listViewTransition->setItemDelegate(m_tileItemDelegate);
+ m_ui->listViewTransition->setModel(m_model);
+ m_ui->listViewTransition->addAction(m_ui->actionReplaceImage);
+ m_ui->listViewTransition->addAction(m_ui->actionDeleteImage);
+
+ // Displacement List View
+ //m_ui->listViewDisplacement->setItemDelegate(m_tileItemDelegate);
+ m_ui->listViewDisplacement->setModel(m_model);
+ m_ui->listViewDisplacement->addAction(m_ui->actionReplaceImage);
+ m_ui->listViewDisplacement->addAction(m_ui->actionDeleteImage);
+
+
+ // Connect context menu actions up.
+ connect(m_ui->actionAddTile, SIGNAL(triggered(bool)), this, SLOT(onActionAddTile(bool)));
+ connect(m_ui->actionDeleteTile, SIGNAL(triggered(bool)), this, SLOT(onActionDeleteTile(bool)));
+ connect(m_ui->actionReplaceImage, SIGNAL(triggered(bool)), this, SLOT(onActionReplaceImage(bool)));
+ connect(m_ui->actionDeleteImage, SIGNAL(triggered(bool)), this, SLOT(onActioneleteImage(bool)));
+
+ connect(m_ui->actionTileDisplayFilename, SIGNAL(toggled(bool)), m_model, SLOT(selectFilenameDisplay(bool)));
+ connect(m_ui->actionTileDisplayIndex, SIGNAL(toggled(bool)), m_model, SLOT(selectIndexDisplay(bool)));
+
+ //connect(m_ui->tileViewTabWidget, SIGNAL(currentChanged(int)), m_tileItemDelegate, SLOT(currentTab(int)));
+
+ // Connect the zoom buttons.
+ connect(m_ui->actionZoom50, SIGNAL(triggered()), m_zoomSignalMapper, SLOT(map()));
+ m_zoomSignalMapper->setMapping(m_ui->actionZoom50, 0);
+ connect(m_ui->actionZoom100, SIGNAL(triggered()), m_zoomSignalMapper, SLOT(map()));
+ m_zoomSignalMapper->setMapping(m_ui->actionZoom100, 1);
+ connect(m_ui->actionZoom200, SIGNAL(triggered()), m_zoomSignalMapper, SLOT(map()));
+ m_zoomSignalMapper->setMapping(m_ui->actionZoom200, 2);
+ connect(m_zoomSignalMapper, SIGNAL(mapped(int)), this, SLOT(onZoomFactor(int)));
+}
+
+TileEditorMainWindow::~TileEditorMainWindow()
+{
+ delete m_ui;
+ delete m_undoStack;
+ delete m_rotationMenu;
+ delete m_zoomMenu;
+
+
+ delete m_tileDisplayMenu;
+ delete m_tileEditorMenu;
+
+ delete m_zoomMenu;
+ delete m_zoomActionGroup;
+ delete m_zoomSignalMapper;
+}
+
+void TileEditorMainWindow::onZoomFactor(int level)
+{
+ int tile128Scaled=TileModel::TILE_128_BASE_SIZE;
+ int tile256Scaled=TileModel::TILE_256_BASE_SIZE;
+ int tileTransScaled=TileModel::TILE_TRANSITION_BASE_SIZE;
+ int tileDispScaled=TileModel::TILE_DISPLACE_BASE_SIZE;
+ switch(level)
+ {
+ // Zoom Level 50%
+ case 0:
+ nlinfo("zooming to 50%");
+ TileModel::CurrentZoomFactor = TileModel::TileZoom50;
+ tile128Scaled /= 2;
+ tile256Scaled /= 2;
+ tileTransScaled /= 2;
+ tileDispScaled /= 2;
+ break;
+ case 1:
+ nlinfo("zooming to 100%");
+ TileModel::CurrentZoomFactor = TileModel::TileZoom100;
+ break;
+ case 2:
+ nlinfo("zooming to 200%");
+ TileModel::CurrentZoomFactor = TileModel::TileZoom200;
+ tile128Scaled *= 2;
+ tile256Scaled *= 2;
+ tileTransScaled *= 2;
+ tileDispScaled *= 2;
+ break;
+ default:
+ nlwarning("Invalid Time Zoom Factor passed.");
+ break;
+ };
+
+ nlinfo("resizing transition view. base size: %d factor %d to: %d", TileModel::TILE_TRANSITION_BASE_SIZE, level, tileTransScaled);
+
+ m_ui->listView128->setIconSize(QSize(tile128Scaled, tile128Scaled));
+ m_ui->listView128->setCurrentIndex(m_ui->listView128->model()->index(0, 0, m_ui->listView128->rootIndex()));
+ m_ui->listView256->setIconSize(QSize(tile256Scaled, tile256Scaled));
+ m_ui->listView256->setCurrentIndex(m_ui->listView256->model()->index(0, 0, m_ui->listView256->rootIndex()));
+ m_ui->listViewTransition->setIconSize(QSize(tileTransScaled, tileTransScaled));
+ m_ui->listViewTransition->setCurrentIndex(m_ui->listViewTransition->model()->index(0, 0, m_ui->listViewTransition->rootIndex()));
+ m_ui->listViewDisplacement->setIconSize(QSize(tileDispScaled, tileDispScaled));
+ m_ui->listViewDisplacement->setCurrentIndex(m_ui->listViewDisplacement->model()->index(0, 0, m_ui->listViewDisplacement->rootIndex()));
+ m_ui->listViewTransition->repaint();
+}
+
+void TileEditorMainWindow::onActionAddTile(bool triggered)
+{
+ onActionAddTile(m_ui->tileViewTabWidget->currentIndex());
+}
+
+void TileEditorMainWindow::onActionDeleteTile(bool triggered)
+{
+}
+
+void TileEditorMainWindow::onActionReplaceImage(bool triggered)
+{
+}
+
+void TileEditorMainWindow::onActionDeleteImage(bool triggered)
+{
+}
+
+void TileEditorMainWindow::onTileSetAdd()
+{
+ bool ok;
+ QString text = QInputDialog::getText(this, tr("Add Tile Set"), tr("Enter Tile Set name:"), QLineEdit::Normal, "", &ok);
+ if (ok && !text.isEmpty())
+ {
+ //if (ui.tileSetListWidget->findItems(text, Qt::MatchExactly).count() > 0)
+ //{
+ // QMessageBox::information( this, tr("Error Adding Tile Set"), tr("This name already exists") );
+ //}
+ //else
+ //{
+
+ //QModelIndex index = m_ui->tileSetLV->selectionModel()->currentIndex();
+ TileModel *model = static_cast(m_ui->tileSetLV->model());
+
+ //if(index.isValid())
+ //{
+ // if(!model->insertRow(index.row()+1, index.parent()))
+ // return;
+
+ // //updateActions()
+
+ // for(int column=0; columncolumnCount(index.parent()); column++)
+ // {
+ // QModelIndex child = model->index(index.row()+1, column, index.parent());
+ // model->setData(child, QVariant(text), Qt::EditRole);
+ // }
+ //}
+ //else
+ //{
+
+
+ // Create and append the new tile set to the model.
+ TileSetNode *tileSet = model->createTileSetNode(text);
+
+ // Retrieve how many rows there currently are and set the current index using that.
+ m_ui->tileSetLV->reset();
+ uint32 rows = model->rowCount();
+ m_ui->tileSetLV->setCurrentIndex(model->index(rows-1, 0));
+ }
+}
+
+void TileEditorMainWindow::onActionAddTile(int tabId)
+{
+ QFileDialog::Options options;
+ QString selectedFilter;
+ QStringList fileNames = QFileDialog::getOpenFileNames(this, "Choose Tile Texture", "." , "Images (*.png);;All Files (*.*)", &selectedFilter, options);
+}
+
+void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex)
+{
+ TileModel *model = static_cast(m_ui->tileSetLV->model());
+
+ QModelIndex tile128Idx = model->index(0, 0, newIndex);
+ QModelIndex tile256Idx = model->index(1, 0, newIndex);
+ QModelIndex tileTransIdx = model->index(2, 0, newIndex);
+ QModelIndex tileDispIdx = model->index(3, 0, newIndex);
+
+ m_ui->listView128->setRootIndex(tile128Idx);
+ m_ui->listView128->setCurrentIndex(m_ui->listView128->model()->index(0, 0, m_ui->listView128->rootIndex()));
+ m_ui->listView256->setRootIndex(tile256Idx);
+ m_ui->listView256->setCurrentIndex(m_ui->listView256->model()->index(0, 0, m_ui->listView256->rootIndex()));
+ m_ui->listViewTransition->setRootIndex(tileTransIdx);
+ m_ui->listViewTransition->setCurrentIndex(m_ui->listViewTransition->model()->index(0, 0, m_ui->listViewTransition->rootIndex()));
+ m_ui->listViewDisplacement->setRootIndex(tileDispIdx);
+ m_ui->listViewDisplacement->setCurrentIndex(m_ui->listViewDisplacement->model()->index(0, 0, m_ui->listViewDisplacement->rootIndex()));
+
+ //nlinfo("number of rows in displacement: %d", tileDispIdx.model()->rowCount(tileDispIdx));
+
+ //m_ui->listView128->reset();
+ //m_ui->listView256->reset();
+ //m_ui->listViewTransition->reset();
+ //m_ui->listViewDisplacement->reset();
+}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.h
new file mode 100644
index 000000000..ae3520465
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.h
@@ -0,0 +1,72 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef TILE_EDITOR_MAIN_WINDOW_H
+#define TILE_EDITOR_MAIN_WINDOW_H
+
+#include "ui_tile_editor_main_window.h"
+
+#include "nel/misc/types_nl.h"
+#include "nel/misc/sheet_id.h"
+
+#include
+#include
+
+namespace Ui {
+ class TileEditorMainWindow;
+}
+
+class TileModel;
+class TileItemDelegate;
+
+class TileEditorMainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit TileEditorMainWindow(QWidget *parent = 0);
+ ~TileEditorMainWindow();
+
+ QUndoStack *getUndoStack() { return m_undoStack; }
+
+public Q_SLOTS:
+ void onActionAddTile(bool triggered);
+ void onActionDeleteTile(bool triggered);
+ void onActionReplaceImage(bool triggered);
+ void onActionDeleteImage(bool triggered);
+ void onTileSetAdd();
+ void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
+ void onZoomFactor(int level);
+
+private:
+ void onActionAddTile(int tabId);
+
+ Ui::TileEditorMainWindow *m_ui;
+ QUndoStack *m_undoStack;
+ QMenu *m_rotationMenu;
+
+ QMenu *m_tileDisplayMenu;
+ QMenu *m_tileEditorMenu;
+
+ QMenu *m_zoomMenu;
+ QActionGroup *m_zoomActionGroup;
+ QSignalMapper *m_zoomSignalMapper;
+
+ TileModel *m_model;
+ TileItemDelegate *m_tileItemDelegate;
+};
+
+#endif // TILE_EDITOR_MAIN_WINDOW_H
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.ui
new file mode 100644
index 000000000..66a086179
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.ui
@@ -0,0 +1,795 @@
+
+
+ TileEditorMainWindow
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ MainWindow
+
+
+
+ -
+
+
+ 2
+
+
+
+ 128x128
+
+
+
-
+
+
+ Qt::ActionsContextMenu
+
+
+
+ 128
+ 128
+
+
+
+ QListView::LeftToRight
+
+
+ true
+
+
+ QListView::IconMode
+
+
+ true
+
+
+
+ -
+
+
+ Edit Channel
+
+
+
-
+
+
+ Diffuse
+
+
+ true
+
+
+
+ -
+
+
+ Additive
+
+
+
+
+
+
+
+
+
+
+ 256x256
+
+
+ -
+
+
+ Qt::ActionsContextMenu
+
+
+
+ 256
+ 256
+
+
+
+ QListView::LeftToRight
+
+
+ true
+
+
+ QListView::IconMode
+
+
+ true
+
+
+
+ -
+
+
+ Edit Channel
+
+
+
-
+
+
+ Diffuse
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Additive
+
+
+
+
+
+
+
+
+
+
+ Transition
+
+
+ -
+
+
+ Qt::ActionsContextMenu
+
+
+
+ 64
+ 64
+
+
+
+ QListView::Static
+
+
+ QListView::LeftToRight
+
+
+ true
+
+
+ QListView::Adjust
+
+
+ QListView::SinglePass
+
+
+ QListView::IconMode
+
+
+ true
+
+
+
+ -
+
+
+ Edit Channel
+
+
+
-
+
+
+ Diffuse
+
+
+ true
+
+
+
+ -
+
+
+ Additive
+
+
+
+ -
+
+
+ Alpha
+
+
+
+
+
+
+
+
+
+
+ Displacement
+
+
+ -
+
+
+ Qt::ActionsContextMenu
+
+
+
+ 32
+ 32
+
+
+
+ QListView::Static
+
+
+ QListView::LeftToRight
+
+
+ true
+
+
+ QListView::Fixed
+
+
+ QListView::IconMode
+
+
+ false
+
+
+
+
+
+
+
+ Tile Set Details
+
+
+ -
+
+
+ Qt::LeftToRight
+
+
+ Oriented
+
+
+
+ -
+
+
+ -
+
+
+ Surface Data:
+
+
+
+ -
+
+
+ Vegetation Set:
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ -
+
+
+
+
+
+
+ :/newPrefix/reset.png:/newPrefix/reset.png
+
+
+
+
+
+
+
+
+
+
+
+
+ Tile Editor Tool Bar
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+
+ Tile Bank
+
+
+ 1
+
+
+
+ -
+
+
+ Lands
+
+
+
-
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/ic_nel_add_item.png:/movementIcons/images/ic_nel_add_item.png
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/reset.png:/movementIcons/images/reset.png
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/ic_nel_open.png:/movementIcons/images/ic_nel_open.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Tile Sets
+
+
+
-
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/up.png:/movementIcons/images/up.png
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/down.png:/movementIcons/images/down.png
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/ic_nel_add_item.png:/movementIcons/images/ic_nel_add_item.png
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/reset.png:/movementIcons/images/reset.png
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/movementIcons/images/ic_nel_open.png:/movementIcons/images/ic_nel_open.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
-
+
+
+ ...
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ Tile Bank Texture Path
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+ :/movementIcons/images/ic_nel_open.png:/movementIcons/images/ic_nel_open.png
+
+
+ Open Tile Bank
+
+
+ Open Tile Bank
+
+
+
+
+
+ :/tileRotation/images/rotation0.png:/tileRotation/images/rotation0.png
+
+
+ 0
+
+
+ Rotate Tile 0 Degrees
+
+
+
+
+
+ :/movementIcons/images/ic_nel_save.png:/movementIcons/images/ic_nel_save.png
+
+
+ Save Tile Bank
+
+
+ Save Tile Bank
+
+
+
+
+
+ :/movementIcons/images/ic_nel_save_as.png:/movementIcons/images/ic_nel_save_as.png
+
+
+ Save Tile Bank As...
+
+
+ Save Tile Bank As...
+
+
+
+
+
+ :/tileRotation/images/rotation90.png:/tileRotation/images/rotation90.png
+
+
+ 90
+
+
+ Rotate Tile 90 Degrees
+
+
+
+
+
+ :/tileRotation/images/rotation180.png:/tileRotation/images/rotation180.png
+
+
+ 180
+
+
+ Rotate Tile180 Degrees
+
+
+
+
+
+ :/tileRotation/images/rotation270.png:/tileRotation/images/rotation270.png
+
+
+ 270
+
+
+ Rotate Tile 270 Degrees
+
+
+
+
+ Batch Load
+
+
+ Batch Load
+
+
+
+
+ Import Border
+
+
+ Import Border
+
+
+
+
+ Export Border
+
+
+ Export Border
+
+
+
+
+ true
+
+
+ true
+
+
+ Index
+
+
+ Display Tile Index
+
+
+
+
+ true
+
+
+ true
+
+
+ Filename
+
+
+ Display Tile Filename
+
+
+
+
+
+ :/tileTools/images/add_tile.png:/tileTools/images/add_tile.png
+
+
+ Add Tile
+
+
+ Add Tile
+
+
+
+
+
+ :/tileTools/images/delete_tile.png:/tileTools/images/delete_tile.png
+
+
+ Delete Tile
+
+
+ Delete Tile
+
+
+
+
+
+ :/tileTools/images/replace_image.png:/tileTools/images/replace_image.png
+
+
+ Replace Image
+
+
+ Replace Image
+
+
+
+
+
+ :/tileTools/images/delete_image.png:/tileTools/images/delete_image.png
+
+
+ Delete Image
+
+
+ Delete Image
+
+
+
+
+ true
+
+
+ Zoom 50%
+
+
+
+
+ true
+
+
+ true
+
+
+ Zoom 100%
+
+
+
+
+ true
+
+
+ Zoom 200%
+
+
+
+
+
+
+
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_plugin.cpp
new file mode 100644
index 000000000..ac12766b8
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_plugin.cpp
@@ -0,0 +1,75 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Project includes
+#include "tile_editor_plugin.h"
+#include "tile_editor_main_window.h"
+#include "../core/icore.h"
+#include "../core/menu_manager.h"
+#include "../core/core_constants.h"
+
+// Qt includes
+#include
+#include
+#include
+#include
+#include
+#include
+
+// NeL includes
+#include "nel/misc/debug.h"
+
+using namespace TileEditorPluginQt;
+
+TileEditorPlugin::~TileEditorPlugin()
+{
+ Q_FOREACH(QObject *obj, m_autoReleaseObjects)
+ {
+ m_plugMan->removeObject(obj);
+ }
+ qDeleteAll(m_autoReleaseObjects);
+ m_autoReleaseObjects.clear();
+}
+
+bool TileEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
+{
+ Q_UNUSED(errorString);
+ m_plugMan = pluginManager;
+ addAutoReleasedObject(new TileEditorContext());
+ return true;
+}
+
+void TileEditorPlugin::extensionsInitialized()
+{
+}
+
+void TileEditorPlugin::setNelContext(NLMISC::INelContext *nelContext)
+{
+#ifdef NL_OS_WINDOWS
+ // Ensure that a context doesn't exist yet.
+ // This only applies to platforms without PIC, e.g. Windows.
+ nlassert(!NLMISC::INelContext::isContextInitialised());
+#endif // NL_OS_WINDOWS
+ m_LibContext = new NLMISC::CLibraryContext(*nelContext);
+}
+
+void TileEditorPlugin::addAutoReleasedObject(QObject *obj)
+{
+ m_plugMan->addObject(obj);
+ m_autoReleaseObjects.prepend(obj);
+}
+
+Q_EXPORT_PLUGIN(TileEditorPlugin)
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_plugin.h
new file mode 100644
index 000000000..2398be2c4
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_plugin.h
@@ -0,0 +1,109 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef TILE_EDITOR_PLUGIN_H
+#define TILE_EDITOR_PLUGIN_H
+
+#include "../../extension_system/iplugin.h"
+#include "../core/icontext.h"
+
+#include "nel/misc/app_context.h"
+
+#include "tile_editor_main_window.h"
+
+#include
+
+namespace NLMISC
+{
+class CLibraryContext;
+}
+
+namespace TileEditorPluginQt
+{
+
+class TileEditorPlugin : public QObject, public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES(ExtensionSystem::IPlugin)
+public:
+
+ ~TileEditorPlugin();
+
+ bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
+ void extensionsInitialized();
+ void setNelContext(NLMISC::INelContext *nelContext);
+
+ void addAutoReleasedObject(QObject *obj);
+
+protected:
+ NLMISC::CLibraryContext *m_LibContext;
+
+private:
+ ExtensionSystem::IPluginManager *m_plugMan;
+ QList m_autoReleaseObjects;
+
+};
+
+class TileEditorContext: public Core::IContext
+{
+ Q_OBJECT
+public:
+ TileEditorContext(QObject *parent = 0) : IContext(parent)
+ {
+ m_tileEditorMainWindow = new TileEditorMainWindow();
+ }
+
+ virtual ~TileEditorContext()
+ {
+ delete m_tileEditorMainWindow;
+ }
+
+ virtual QString id() const
+ {
+ return QLatin1String("TileEditor");
+ }
+
+ virtual QString trName() const
+ {
+ return tr("Tile Editor");
+ }
+
+ virtual QIcon icon() const
+ {
+ return QIcon(":/tileRotation/images/rotation0.png");
+ }
+
+ virtual QUndoStack *undoStack()
+ {
+ return m_tileEditorMainWindow->getUndoStack();
+ }
+
+ virtual void open()
+ {
+ }
+
+ virtual QWidget *widget()
+ {
+ return m_tileEditorMainWindow;
+ }
+
+private:
+ TileEditorMainWindow *m_tileEditorMainWindow;
+};
+
+} // namespace TileEditorPluginQt
+
+#endif // TILE_EDITOR_PLUGIN_H
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.cpp
new file mode 100644
index 000000000..fcd14a61b
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.cpp
@@ -0,0 +1,292 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#include
+
+#include "tile_item.h"
+
+//#include "tile_widget.h"
+
+#include
+
+Node::Node() : m_parentItem(0)
+{
+}
+
+Node::Node(const QVector &data, Node *parent)
+{
+ m_parentItem = parent;
+ m_itemData = data;
+}
+
+Node::~Node()
+{
+ qDeleteAll(m_childItems);
+}
+
+void Node::appendChild(Node *item)
+{
+ m_childItems.append(item);
+}
+
+Node *Node::child(int row)
+{
+ //nlinfo("row %d and size %d", row, childItems.size());
+ return m_childItems.value(row);
+}
+
+int Node::childCount() const
+{
+ return m_childItems.count();
+}
+
+int Node::childNumber() const
+{
+ if(m_parentItem)
+ return m_parentItem->m_childItems.indexOf(const_cast(this));
+ return 0;
+}
+
+bool Node::insertChildren(int position, int count, int columns)
+{
+ if(position<0 || position>m_childItems.size())
+ return false;
+
+ for(int row = 0; row < count; row++)
+ {
+ QVector data(columns);
+ Node *item = new Node(data, this);
+ m_childItems.insert(position, item);
+ }
+
+ return true;
+}
+
+bool Node::removeChildren(int position, int count)
+{
+ if(position<0 || position+count>m_childItems.size())
+ return false;
+
+ for(int row=0; row m_itemData.size())
+ return false;
+
+ for(int column=0; columninsertColumns(position, columns);
+
+ return true;
+}
+
+int Node::row() const
+{
+ if(m_parentItem)
+ return m_parentItem->m_childItems.indexOf(const_cast(this));
+
+ return 0;
+}
+
+int Node::columnCount() const
+{
+ return m_itemData.count();
+}
+
+QVariant Node::data(int column, int role) const
+{
+ if(role == Qt::DisplayRole ||
+ role == TileModel::TileFilenameIndexRole ||
+ role == TileModel::TileFilenameRole ||
+ role == TileModel::TileIndexRole)
+ return m_itemData.value(column);
+ return QVariant();
+}
+
+bool Node::setData(int column, const QVariant &value)
+{
+ if(column < 0 || column >= m_itemData.size())
+ return false;
+
+ m_itemData[column] = value;
+ return true;
+}
+
+Node *Node::parent()
+{
+ return m_parentItem;
+}
+
+void Node::setParent(Node *parent)
+{
+ m_parentItem = parent;
+}
+
+void Node::appendRow(const QList &items)
+{
+ Q_FOREACH(Node *item, items)
+ appendRow(item);
+}
+
+void Node::appendRow(Node *item)
+{
+ item->setParent(this);
+ m_childItems.append(item);
+}
+
+///////////////////////////////////////////////////
+
+TileSetNode::TileSetNode(QString tileSetName, Node *parent) : m_tileSetName(tileSetName)
+{
+ m_parentItem = parent;
+}
+
+TileSetNode::~TileSetNode()
+{
+ qDeleteAll(m_childItems);
+}
+
+QVariant TileSetNode::data(int column, int role) const
+{
+ if(role == Qt::DisplayRole ||
+ role == TileModel::TileFilenameIndexRole ||
+ role == TileModel::TileFilenameRole ||
+ role == TileModel::TileIndexRole)
+ return QVariant(m_tileSetName);
+ return QVariant();
+}
+
+int TileSetNode::columnCount() const
+{
+ return 1;
+}
+
+///////////////////////////////////////////////////
+
+TileTypeNode::TileTypeNode(TileModel::TNodeTileType type, Node *parent) : m_nodeTileType(type)
+{
+ m_parentItem = parent;
+}
+
+TileTypeNode::~TileTypeNode()
+{
+ qDeleteAll(m_childItems);
+}
+
+QVariant TileTypeNode::data(int column, int role) const
+{
+ if(role == Qt::DisplayRole ||
+ role == TileModel::TileFilenameIndexRole ||
+ role == TileModel::TileFilenameRole ||
+ role == TileModel::TileIndexRole)
+ return QVariant(TileModel::getTileTypeName(m_nodeTileType));
+ return QVariant();
+
+}
+
+int TileTypeNode::columnCount() const
+{
+ return 1;
+}
+
+TileModel::TNodeTileType TileTypeNode::getTileType()
+{
+ return m_nodeTileType;
+}
+
+
+
+
+///////////////////////////////////////////////////
+
+TileItemNode::TileItemNode(int tileId, TileModel::TTileChannel channel, QString filename, Node *parent) : m_tileId(tileId)
+{
+ m_tileFilename[channel] = filename;
+ m_parentItem = parent;
+ //nlinfo("dispalying tile %d - %s", m_tileId, m_tileFilename[TileModel::TileDiffuse].toStdString().c_str());
+}
+
+TileItemNode::~TileItemNode()
+{
+ qDeleteAll(m_childItems);
+}
+
+void TileItemNode::setTileFilename(TileModel::TTileChannel channel, QString filename)
+{
+ m_tileFilename[channel] = filename;
+}
+
+QVariant TileItemNode::data(int column, int role) const
+{
+ // find some way to know which file/bitmap to display
+ QString tileFilename = m_tileFilename[TileModel::TileDiffuse];
+
+ if(role == TileModel::TilePixmapRole || role == Qt::DecorationRole)
+ {
+ TileTypeNode *parent = dynamic_cast(m_parentItem);
+ if(parent == NULL)
+ return QVariant();
+
+ // Retrieve the target tile size.
+ uint32 tileSize = TileModel::getTileTypeSize(parent->getTileType());
+
+ if(tileFilename.isEmpty() || tileFilename == "empty")
+ tileFilename = ":/placeHolder/images/empty_image.png";
+
+ QPixmap pixmap;// = new QPixmap();
+ if(!pixmap.load(tileFilename))
+ nlinfo("failed to load %s", tileFilename.toStdString().c_str());
+
+ if(TileModel::CurrentZoomFactor == TileModel::TileZoom200)
+ tileSize *= 2;
+ else if(TileModel::CurrentZoomFactor == TileModel::TileZoom50)
+ tileSize /= 2;
+
+ pixmap.scaled(tileSize, tileSize);
+
+ return pixmap;
+ }
+ else if(role == Qt::DisplayRole)
+ {
+ return QVariant(tileFilename);
+ }
+ else if(role == TileModel::TileFilenameRole)
+ {
+ return QVariant(tileFilename);
+ }
+ else if(role == TileModel::TileIndexRole)
+ {
+ return QVariant("("+QString::number(m_tileId)+")");
+ }
+ else if(role == TileModel::TileFilenameIndexRole)
+ {
+ return QVariant(tileFilename + " ("+QString::number(m_tileId)+")");
+ }
+
+ return QVariant();
+}
+
+int TileItemNode::columnCount() const
+{
+ return 1;
+}
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.h
new file mode 100644
index 000000000..f89b20ab7
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item.h
@@ -0,0 +1,103 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef TILE_ITEM_H
+#define TILE_ITEM_H
+
+#include "nel/misc/types_nl.h"
+
+#include
+#include
+
+#include "tile_model.h"
+
+class TileWidget;
+
+class Node
+{
+public:
+ Node();
+ Node(const QVector &data, Node *parent=0);
+ virtual ~Node();
+
+ void appendChild(Node *child);
+
+ Node *child(int row);
+ int childCount() const;
+ int childNumber() const;
+ virtual int columnCount() const;
+ bool setData(int column, const QVariant &value);
+ virtual QVariant data(int column, int role) const;
+
+ bool insertChildren(int position, int count, int columns);
+ bool removeChildren(int position, int count);
+ bool insertColumns(int position, int columns);
+
+ int row() const;
+ Node *parent();
+ void setParent(Node *parent);
+
+ void appendRow(const QList &items);
+ void appendRow(Node *item);
+
+protected:
+ QList m_childItems;
+ QVector m_itemData;
+ Node *m_parentItem;
+};
+
+class TileSetNode : public Node
+{
+public:
+ TileSetNode(QString tileSetName, Node *parent=0);
+ virtual ~TileSetNode();
+ QVariant data(int column, int role) const;
+ int columnCount() const;
+
+ const QString &getTileSetName();
+private:
+ QString m_tileSetName;
+};
+
+class TileTypeNode : public Node
+{
+public:
+
+ TileTypeNode(TileModel::TNodeTileType type, Node *parent=0);
+ virtual ~TileTypeNode();
+ QVariant data(int column, int role) const;
+ int columnCount() const;
+
+ TileModel::TNodeTileType getTileType();
+private:
+ TileModel::TNodeTileType m_nodeTileType;
+};
+
+class TileItemNode : public Node
+{
+public:
+ TileItemNode(int tileId, TileModel::TTileChannel channel, QString filename, Node *parent=0);
+ virtual ~TileItemNode();
+ QVariant data(int column, int role) const;
+ int columnCount() const;
+ void setTileFilename(TileModel::TTileChannel channel, QString filename);
+private:
+ int m_tileId;
+ QMap m_tileFilename;
+ QMap m_tileWidget;
+};
+
+#endif // TILE_ITEM_H
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item_delegate.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item_delegate.cpp
new file mode 100644
index 000000000..43751d612
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item_delegate.cpp
@@ -0,0 +1,122 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#include
+
+#include
+
+#include "tile_item_delegate.h"
+
+#include "tile_model.h"
+
+TileItemDelegate::TileItemDelegate()
+{
+ m_zoomFactor = ZoomNormal;
+ m_imageHint = 128;
+}
+
+TileItemDelegate::~TileItemDelegate()
+{
+}
+
+void TileItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+ QStyledItemDelegate::paint(painter,option,index);
+
+ painter->save();
+
+ QFont font = QApplication::font();
+
+ //font.setBold(true);
+ //SubFont.setWeight(SubFont.weight()-2);
+ QFontMetrics fm(font);
+
+ QPixmap tile = qvariant_cast(index.data(TileModel::TilePixmapRole));
+ QString tileFileText = qvariant_cast(index.data(TileModel::TileFilenameRole));
+ QString tileIdText = qvariant_cast(index.data(TileModel::TileIndexRole));
+
+ QSize tileSize = tile.size();
+
+ //QRect headerRect = option.rect;
+ QRect rect(option.rect);
+ //QRect tileRect(option.rect);
+ int textHeight = fm.height();
+ int iconPosModX = PIXMAP_MARGIN + (tile.width() / 2);
+ int iconPosModY = (option.rect.height() - tile.height()) / 2;
+
+ painter->drawPixmap(rect.adjusted(iconPosModX, iconPosModY, iconPosModX, iconPosModY).topLeft(), tile);
+
+
+
+ //tileRect.setRight(tileSize.width()+30);
+ //tileRect.setTop(tileRect.top()+5);
+ //headerRect.setLeft(tileRect.right());
+ //subheaderRect.setLeft(tileRect.right());
+ //headerRect.setTop(headerRect.top()+5);
+ //headerRect.setBottom(headerRect.top()+fm.height());
+
+ //subheaderRect.setTop(headerRect.bottom()+2);
+
+ //painter->drawPixmap(targetrect, pixmap, sourcerect)
+
+ //painter->drawPixmap(QPoint(iconRect.right()/2,iconRect.top()/2),icon.pixmap(iconsize.width(),iconsize.height()));
+ //painter->drawPixmap(QPoint(tileRect.left()+tileSize.width()/2+2,tileRect.top()+tileSize.height()/2+3),tile);
+
+ //painter->setFont(font);
+ //painter->drawText(headerRect,headerText);
+
+
+ //painter->setFont(SubFont);
+ //painter->drawText(subheaderRect.left(),subheaderRect.top()+17,subText);
+
+ painter->restore();
+}
+
+QSize TileItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const
+{
+ QPixmap tile = qvariant_cast(index.data(TileModel::TilePixmapRole));
+ QSize tileSize = tile.size();
+ QFont font = QApplication::font();
+ QFontMetrics fm(font);
+
+ return(QSize(tileSize.width()+(2*PIXMAP_MARGIN), tileSize.height()+fm.height()+(2*PIXMAP_MARGIN)));
+}
+
+TileItemDelegate::TZoomFactor TileItemDelegate::getZoomFactor()
+{
+ return m_zoomFactor;
+}
+
+void TileItemDelegate::setZoomFactor(TileItemDelegate::TZoomFactor zoomFactor)
+{
+ m_zoomFactor = zoomFactor;
+}
+
+// SLOTS
+
+void TileItemDelegate::currentTab(int index)
+{
+ if(index == 1)
+ {
+ nlinfo("switching delegate to 1 or 256");
+ m_imageHint = 256;
+ }
+ else
+ {
+ nlinfo("switching delegate to 0,2,3 or 128");
+ m_imageHint = 128;
+ }
+}
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item_delegate.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item_delegate.h
new file mode 100644
index 000000000..1b7058b48
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_item_delegate.h
@@ -0,0 +1,57 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+#ifndef TILE_ITEM_DELEGATE_H
+#define TILE_ITEM_DELEGATE_H
+
+#include
+#include
+#include
+
+#include "ui_tile_widget.h"
+
+#include
+
+class TileItemDelegate : public QStyledItemDelegate
+ {
+ public:
+
+ enum TZoomFactor
+ {
+ ZoomSmall = 0,
+ ZoomNormal = 1,
+ ZoomLarge = 2
+ };
+
+ static const int PIXMAP_MARGIN = 5;
+
+ TileItemDelegate();
+ virtual ~TileItemDelegate();
+
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const;
+
+ TZoomFactor getZoomFactor();
+ void setZoomFactor(TZoomFactor zoomFactor);
+
+public Q_SLOTS:
+ void currentTab(int index);
+
+ private:
+ TZoomFactor m_zoomFactor;
+ int m_imageHint;
+ };
+
+#endif // TILE_ITEM_DELEGATE_H
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.cpp
new file mode 100644
index 000000000..c167dbd44
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.cpp
@@ -0,0 +1,230 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#include "tile_model.h"
+#include "tile_item.h"
+
+#include
+
+#include
+
+// Initialize the static members
+TileModel::TTileZoomFactor TileModel::CurrentZoomFactor;
+
+TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
+{
+ QVector rootData;
+ Q_FOREACH(QString header, headers)
+ rootData << header;
+
+ rootItem = new Node(rootData);
+
+ TileModel::CurrentZoomFactor = TileModel::TileZoom100;
+ m_indexDisplay = true;
+ m_fileDisplay = true;
+}
+
+TileModel::~TileModel()
+{
+ delete rootItem;
+}
+
+Node *TileModel::getItem(const QModelIndex &index) const
+{
+ if(index.isValid())
+ {
+ Node *item = static_cast(index.internalPointer());
+ if(item) return item;
+ }
+ return rootItem;
+}
+
+QModelIndex TileModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if(parent.isValid() && parent.column() != 0)
+ return QModelIndex();
+
+ Node *parentItem = getItem(parent);
+
+ Node *childItem = parentItem->child(row);
+ if(childItem)
+ return createIndex(row, column, childItem);
+ else
+ return QModelIndex();
+}
+
+QModelIndex TileModel::parent(const QModelIndex &index) const
+{
+ if(!index.isValid())
+ return QModelIndex();
+
+ Node *childItem = getItem(index);
+ Node *parentItem = childItem->parent();
+
+ if(parentItem == rootItem)
+ return QModelIndex();
+
+ return createIndex(parentItem->childNumber(), 0, parentItem);
+}
+
+int TileModel::rowCount(const QModelIndex &parent) const
+{
+ Node *parentItem = getItem(parent);
+ return parentItem->childCount();
+}
+
+int TileModel::columnCount(const QModelIndex &parent) const
+{
+ Node *parentItem = getItem(parent);
+ return parentItem->columnCount();
+}
+
+QVariant TileModel::data(const QModelIndex &index, int role) const
+{
+ if(!index.isValid())
+ return QVariant();
+
+ Node *item = static_cast(index.internalPointer());
+
+ // Translate the display role to the settings-specific role.
+
+ if(role == Qt::DisplayRole)
+ {
+ if(m_indexDisplay && m_fileDisplay)
+ role = TileFilenameIndexRole;
+ else if(m_fileDisplay)
+ role = TileFilenameRole;
+ else if(m_indexDisplay)
+ role = TileIndexRole;
+ }
+ return item->data(index.column(), role);
+}
+
+Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
+{
+ if(!index.isValid())
+ return Qt::ItemIsEnabled;
+
+ return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
+}
+
+QVariant TileModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if(orientation == Qt::Horizontal && role == Qt::DisplayRole)
+ return rootItem->data(section,role);
+
+ return QVariant();
+}
+
+void TileModel::appendRow(const QList &items)
+{
+ rootItem->appendRow(items);
+}
+
+
+void TileModel::appendRow(Node *item)
+{
+ rootItem->appendRow(item);
+}
+
+TileSetNode *TileModel::createTileSetNode(QString tileSetName)
+{
+ // Create the new tile set.
+ TileSetNode *tileSet = new TileSetNode(tileSetName);
+
+ // child for 128x128 tiles
+ TileTypeNode *tile128= new TileTypeNode(Tile128);
+ tileSet->appendRow(tile128);
+
+ // child for 256x256 tiles
+ TileTypeNode *tile256= new TileTypeNode(Tile256);
+ tileSet->appendRow(tile256);
+
+ // child for transition tiles.
+ TileTypeNode *tileTrans= new TileTypeNode(TileTransition);
+ tileSet->appendRow(tileTrans);
+
+ // Add the default transition tiles.
+ // TODO tie this to CTileSet::count from NeL
+ for(int transPos=0; transPos<48; transPos++)
+ {
+ TileItemNode *transTile= new TileItemNode(transPos, TileDiffuse, QString("empty"));
+ tileTrans->appendRow(transTile);
+ }
+
+ // child for displacement tiles
+ TileTypeNode *tileDisp= new TileTypeNode(TileDisplacement);
+ tileSet->appendRow(tileDisp);
+
+ // Add the default displacement tiles.
+ // TODO tie this to CTileSet::CountDisplace from NeL
+ for(int dispPos=0; dispPos<16; dispPos++)
+ {
+ TileItemNode *dispTile= new TileItemNode(dispPos, TileDiffuse, QString("empty"));
+ tileDisp->appendRow(dispTile);
+ }
+
+ // Append them in the correct order to the tile set.
+ this->appendRow(tileSet);
+
+ return tileSet;
+}
+
+const char *TileModel::getTileTypeName(TileModel::TNodeTileType type)
+{
+ switch(type)
+ {
+ case Tile128:
+ return "128";
+ case Tile256:
+ return "256";
+ case TileTransition:
+ return "Transition";
+ case TileDisplacement:
+ return "Displacement";
+ default:
+ break;
+ }
+ return "UNKNOWN";
+}
+
+uint32 TileModel::getTileTypeSize(TileModel::TNodeTileType type)
+{
+ switch(type)
+ {
+ case Tile128:
+ return 128;
+ case Tile256:
+ return 256;
+ case TileTransition:
+ return 64;
+ case TileDisplacement:
+ return 32;
+ default:
+ break;
+ }
+ return 0;
+}
+
+void TileModel::selectFilenameDisplay(bool selected)
+{
+ m_fileDisplay = selected;
+}
+
+void TileModel::selectIndexDisplay(bool selected)
+{
+ m_indexDisplay = selected;
+}
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.h
new file mode 100644
index 000000000..bd7d808fb
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.h
@@ -0,0 +1,106 @@
+// Object Viewer Qt - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef TILE_MODEL_H
+#define TILE_MODEL_H
+
+#include "nel/misc/types_nl.h"
+
+#include
+
+class Node;
+class TileSetNode;
+
+class TileModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ enum TTileChannel
+ {
+ TileDiffuse = 0,
+ TileAdditive = 1,
+ TileAlpha = 2,
+ };
+
+ enum TNodeTileType
+ {
+ Tile128 = 0,
+ Tile256 = 1,
+ TileTransition = 2,
+ TileDisplacement = 3
+ };
+
+ enum TTileItemRole
+ {
+ TilePixmapRole = Qt::UserRole+1,
+ TileFilenameRole = Qt::UserRole+2,
+ TileIndexRole = Qt::UserRole+3,
+ TileFilenameIndexRole = Qt::UserRole+4
+ };
+
+ enum TTileZoomFactor
+ {
+ TileZoom50 = 0,
+ TileZoom100 = 1,
+ TileZoom200 = 2
+ };
+
+ static const int TILE_DISPLACE_BASE_SIZE = 32;
+ static const int TILE_TRANSITION_BASE_SIZE = 64;
+ static const int TILE_128_BASE_SIZE = 128;
+ static const int TILE_256_BASE_SIZE = 256;
+
+
+ TileModel(const QStringList &headers, QObject *parent);
+ ~TileModel();
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent= QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+ // Tile Model specific functions
+ void appendRow(const QList &items);
+ void appendRow(Node *item);
+
+ TileSetNode *createTileSetNode(QString tileSetName);
+
+ static const char *getTileTypeName(TNodeTileType type);
+ static uint32 getTileTypeSize(TileModel::TNodeTileType type);
+
+ static TTileZoomFactor CurrentZoomFactor;
+
+public Q_SLOTS:
+ void selectFilenameDisplay(bool selected);
+ void selectIndexDisplay(bool selected);
+
+private:
+ Node *getItem(const QModelIndex &index) const;
+
+ bool m_fileDisplay;
+ bool m_indexDisplay;
+ //TTileZoomFactor m_tileZoomFactor;
+
+ //QList m_tiles;
+ //int m_activeEditChannel;
+ Node *rootItem;
+};
+
+#endif // TILE_MODEL_H