Commits

Shankar Giri committed 040c24d Merge

Merging with parent fork after resolving merge conflicts

Comments (0)

Files changed (71)

     "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Angelscript/add_on/vector3"
     "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Angelscript/add_on/debugger"
     "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/OFS/include"
+    "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/ImageConverter/include"
     "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericTextEditor/include"
     "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericImageEditor/include"
 )
         set(OGITOR_LIBOGREOFSPLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "libOgreOfsPlugin path" FORCE)
     endif(OGITOR_DIST)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Templates/plugins.cfg.in ${OGITOR_WORK_DIR}/RunPath/bin/plugins.cfg)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Templates/resources.cfg.in ${OGITOR_WORK_DIR}/RunPath/bin/resources.cfg)
 else(UNIX)
     # We are on Windows
     set(OGITOR_BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor bin path" FORCE)
     set(OGITOR_LIBOGREOFSPLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "libOgreOfsPlugin path" FORCE)
 endif(UNIX)
 
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Templates/resources.cfg.in ${OGITOR_WORK_DIR}/RunPath/bin/resources.cfg)
+
 # hide advanced options
 mark_as_advanced(
     OGITOR_BIN_PATH
 #add_subdirectory(Dependencies/lua)
 add_subdirectory(Dependencies/SkyX)
 add_subdirectory(Dependencies/OFS)
+add_subdirectory(Dependencies/ImageConverter)
 add_subdirectory(Dependencies/GenericTextEditor)
 add_subdirectory(Dependencies/GenericImageEditor)
 IF(OGITOR_MESHMAGICK_INTERFACE)
 		DESTINATION ${PREFIX}/sdk/dependencies/include/OFS
 		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
 	)
+	# SDK: ImageConverter headers
+	FILE(GLOB ImageConverter_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/ImageConverter/include/*.hxx")
+	install(FILES ${ImageConverter_headers}
+		DESTINATION ${PREFIX}/sdk/dependencies/include/ImageConverter
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
 	# SDK: GenericImageEditor headers
 	FILE(GLOB GenericImageEditor_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericImageEditor/include/*.hxx")
 	install(FILES ${GenericImageEditor_headers}
 ${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/OFS
         CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
     )
+    # SDK: ImageConverter headers
+    FILE(GLOB ImageConverter_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/ImageConverter/include/*.hxx")
+    install(FILES ${ImageConverter_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/ImageConverter
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
     # SDK: GenericImageEditor headers
     FILE(GLOB GenericImageEditor_headers
 "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericImageEditor/include/*.hxx")

CMakeModules/Templates/resources.cfg.in

 [EditorResources]
 FileSystem=@OGITOR_MEDIA_PATH@/editorResources
 
-[Hydrax]
-FileSystem=@OGITOR_MEDIA_PATH@/editorResources/Hydrax
-
-[Caelum]
-FileSystem=@OGITOR_MEDIA_PATH@/editorResources/Caelum
-
-[SkyX]
-FileSystem=@OGITOR_MEDIA_PATH@/editorResources/SkyX
-
 [Brushes]
 FileSystem=@OGITOR_MEDIA_PATH@/brushes
-
-[Plants]
-FileSystem=@OGITOR_MEDIA_PATH@/plants
-
-[TerrainTextures]
-FileSystem=@OGITOR_MEDIA_PATH@/terrainTextures

CMakeModules/VisualStudioUserFile.vcproj.user.in

 			Name="Debug|Win32"
 			>
 			<DebugSettings
-				Command="@OGRE_BINARY_DIR@/bin/$(ConfigurationName)/$(TargetFileName)"
-				WorkingDirectory="@OGRE_WORK_DIR@/bin/$(ConfigurationName)"
+				Command="@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName)"
+				WorkingDirectory="@OGITOR_WORK_DIR@/RunPath/bin"
 				CommandArguments=""
 				Attach="false"
 				DebuggerType="3"
 			Name="Release|Win32"
 			>
 			<DebugSettings
-				Command="@OGRE_BINARY_DIR@/bin/$(ConfigurationName)/$(TargetFileName)"
-				WorkingDirectory="@OGRE_BINARY_DIR@/bin/$(ConfigurationName)"
+				Command="@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName)"
+				WorkingDirectory="@OGITOR_WORK_DIR@/RunPath/bin"
 				CommandArguments=""
 				Attach="false"
 				DebuggerType="3"
 			Name="RelWithDebInfo|Win32"
 			>
 			<DebugSettings
-				Command="@OGRE_BINARY_DIR@/bin/$(ConfigurationName)/$(TargetFileName)"
-				WorkingDirectory="@OGRE_BINARY_DIR@/bin/$(ConfigurationName)"
+				Command="@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName)"
+				WorkingDirectory="@OGITOR_WORK_DIR@/RunPath/bin"
 				CommandArguments=""
 				Attach="false"
 				DebuggerType="3"
 			Name="MinSizeRel|Win32"
 			>
 			<DebugSettings
-				Command="@OGRE_BINARY_DIR@/bin/$(ConfigurationName)/$(TargetFileName)"
-				WorkingDirectory="@OGRE_BINARY_DIR@/bin/$(ConfigurationName)"
+				Command="@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName)"
+				WorkingDirectory="@OGITOR_WORK_DIR@/RunPath/bin"
 				CommandArguments=""
 				Attach="false"
 				DebuggerType="3"

CMakeModules/VisualStudioUserFile.vcxproj.user.in

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+	<LocalDebuggerCommand>@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName)</LocalDebuggerCommand>
+    <LocalDebuggerWorkingDirectory>@OGITOR_WORK_DIR@/RunPath/bin</LocalDebuggerWorkingDirectory>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LocalDebuggerCommand>@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName)</LocalDebuggerCommand>    
+    <LocalDebuggerWorkingDirectory>@OGITOR_WORK_DIR@/RunPath/bin</LocalDebuggerWorkingDirectory>
+	<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">
+    <LocalDebuggerCommand>@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName))</LocalDebuggerCommand>    
+    <LocalDebuggerWorkingDirectory>@OGITOR_WORK_DIR@/RunPath/bin</LocalDebuggerWorkingDirectory>
+	<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">
+    <LocalDebuggerCommand>@OGITOR_WORK_DIR@/RunPath/bin/$(TargetFileName)</LocalDebuggerCommand>    
+    <LocalDebuggerWorkingDirectory>@OGITOR_WORK_DIR@/RunPath/bin</LocalDebuggerWorkingDirectory>
+	<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+</Project>

Dependencies/GenericImageEditor/CMakeLists.txt

     file(GLOB UI_FILES *.ui)
 
     set(HEADER_FILES
-        ./include/genericimageeditor.hxx
+        ./include/genericimageeditor.hxx       
+        ./include/genericimageeditorcodec.hxx
+        ./include/genericimageeditordocument.hxx
+        ./include/heightimageeditorcodec.hxx
         ./include/iimageeditorcodec.hxx
-        ./include/genericimageeditorcodec.hxx
-        ./include/heightimageeditorcodec.hxx
     )
 
     set(SOURCE_FILES
-        ./src/genericimageeditor.cpp
+        ./src/genericimageeditor.cpp        
         ./src/genericimageeditorcodec.cpp
+        ./src/genericimageeditordocument.cpp
         ./src/heightimageeditorcodec.cpp
     )
 
     SET(MOC_SRCS2
-        ./include/genericimageeditor.hxx
+        ./include/genericimageeditor.hxx       
+        ./include/genericimageeditorcodec.hxx
+        ./include/genericimageeditordocument.hxx
+        ./include/heightimageeditorcodec.hxx
         ./include/iimageeditorcodec.hxx
-        ./include/genericimageeditorcodec.hxx
-        ./include/heightimageeditorcodec.hxx
     )
 
     qt4_wrap_cpp(MOC_SRCS ${MOC_SRCS2})
 
     include_directories(.)
     include_directories(${OGITOR_INCLUDES})
-        include_directories(../OFS/include)
+    include_directories(../OFS/include)
+    include_directories(../ImageConverter/include)
 
-    link_libraries(${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} OFS Ogitor)
+    link_libraries(${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} OFS Ogitor ImageConverter)
     add_library(GenericImageEditor SHARED ${SRCS})
     set(LIBRARY_OUTPUT_PATH ../lib)
 
-        add_dependencies(GenericImageEditor OFS)
+	add_dependencies(GenericImageEditor OFS)
+	add_dependencies(GenericImageEditor ImageConverter)
 
     if(NOT OGITOR_DIST)
         set_target_properties(GenericImageEditor PROPERTIES INSTALL_RPATH ${OGRE_INSTALL_DIR}/lib/OGRE)
         add_custom_command(TARGET GenericImageEditor PRE_BUILD
             COMMAND mkdir -p ../../RunPath/lib)
         add_custom_command(TARGET GenericImageEditor POST_BUILD
-            COMMAND cp -r ../lib/libGenericImageEditor_Ogitor.*
-../../RunPath/lib/)
+            COMMAND cp -r ../lib/libGenericImageEditor_Ogitor.* ../../RunPath/lib/)
     endif(UNIX AND NOT APPLE)
 
     if(WIN32)

Dependencies/GenericImageEditor/include/genericimageeditor.hxx

 /// THE SOFTWARE.
 ////////////////////////////////////////////////////////////////////////////////*/
 
-#ifndef GENERIC_IMAGE_EDITOR_HXX
-#define GENERIC_IMAGE_EDITOR_HXX
+#pragma once
 
 #include <QtCore/QFile>
 #include <QtCore/QTextStream>
 #include "Ogitors.h"
 
 #include "genericimageeditorcodec.hxx"
+#include "genericimageeditordocument.hxx"
 #include "ofs.h"
 
 class QPaintEvent;
 
 public:
     GenericImageEditor(QString editorName, QWidget *parent = 0);
+    virtual ~GenericImageEditor();
 
-    bool                            displayImageFromFile(QString filePath);
-    void                            moveToForeground();
+    bool displayImageFromFile(QString filePath);
+    void moveToForeground();
+    void saveAll();
 
-    static void                     registerCodecFactory(QString extension, IImageEditorCodecFactory* codec);
-    static void                     unregisterCodecFactory(QString extension);
+    static void registerCodecFactory(QString extension, IImageEditorCodecFactory* codec);
+    static void unregisterCodecFactory(QString extension);
     static IImageEditorCodecFactory* findMatchingCodecFactory(QString extensionOrFileName);
 
-    inline void                     setAllowDoubleDisplay(bool allow) {mAllowDoubleDisplay = allow;}
-    inline bool                     isAllowDoubleDisplay() {return mAllowDoubleDisplay;}
+    inline void setAllowDoubleDisplay(bool allow) {mAllowDoubleDisplay = allow;}
+    inline bool isAllowDoubleDisplay() {return mAllowDoubleDisplay;}
 
-    void                            onLoadStateChanged(Ogitors::IEvent* evt);
+    void onModifiedStateChanged(Ogitors::IEvent* evt);
+    void onLoadStateChanged(Ogitors::IEvent* evt);
+
+    GenericImageEditorDocument* getActiveDocument() { return mActiveDocument; }
+    void setActiveDocument(GenericImageEditorDocument* document);
 
 signals:
-    void    currentChanged(int);
+    void currentChanged(int);
+
+public slots:
+    void tabContentChange();
+//    void pasteAvailable();
+    void onSave();
+//    void onClipboardChanged();
 
 protected:
-    bool    isPathAlreadyShowing(QString filePath, GenericImageEditorDocument*& document);
-    bool    isDocAlreadyShowing(QString docName, GenericImageEditorDocument*& document);
-    void    closeEvent(QCloseEvent *event);  
-
-protected slots:
-	void	tabChanged(int index);
+    bool isPathAlreadyShowing(QString filePath, GenericImageEditorDocument*& document);
+    bool isDocAlreadyShowing(QString docName, GenericImageEditorDocument*& document);
+    void closeEvent(QCloseEvent *event);
 
 private slots:
-    void    closeTab(int index);
+    void closeTab(int index);
 
 private:
-     static ImageCodecExtensionFactoryMap   mRegisteredCodecFactories;
-     QTabWidget*                            mParentTabWidget;
-     bool                                   mAllowDoubleDisplay;
-     GenericImageEditorDocument*            mLastDocument;
-     QToolBar*                              mMainToolBar;
-     QAction*                               mActZoomIn;
-     QAction*                               mActZoomOut;
+    void disconnectActiveDocument();
+    void addTab(GenericImageEditorDocument* newDocument, IImageEditorCodec* codec);
+
+    static ImageCodecExtensionFactoryMap mRegisteredCodecFactories;
+
+    QTabWidget *mParentTabWidget;
+    QTabBar *mTabBar;
+    GenericImageEditorDocument *mActiveDocument;    
+    
+    bool mAllowDoubleDisplay;
+    
+    QToolBar   *mMainToolBar;
+    QAction    *mActZoomIn;
+    QAction    *mActZoomOut;
+    QAction    *mActSave;
+//    QAction    *mActEditCut;
+//    QAction    *mActEditCopy;
+//    QAction    *mActEditPaste;
 };
 
-//-----------------------------------------------------------------------------------------
-
-class GIEExport GenericImageEditorDocument : public QScrollArea
-{
-    Q_OBJECT
-
-public:
-    GenericImageEditorDocument(QWidget *parent = 0);
-    ~GenericImageEditorDocument();
-
-    void displayImageFromFile(QString docName, QString filePath);
-    void displayImage(QString docName, Ogre::DataStreamPtr stream);
-    void releaseFile();
-    
-    inline QString getDocName(){return mDocName;}
-    inline QString getFilePath(){return mFilePath;}
-    inline IImageEditorCodec* getCodec(){return mCodec;}
-    inline void setCodec(IImageEditorCodec* codec){mCodec = codec;}
-    inline bool isOfsFile(){return mIsOfsFile;};
-    inline OFS::OfsPtr getOfsPtr(){return mOfsPtr;};
-    inline OFS::OFSHANDLE getOfsFileHandle(){return mOfsFileHandle;};
-    ToolTipLabel* getLabel(){return mLabel;};
-
-public slots:
-    void onZoomIn();
-    void onZoomOut();
-
-protected:
-    void contextMenuEvent(QContextMenuEvent *event);
-    void mousePressEvent(QMouseEvent *event);
-    void closeEvent(QCloseEvent* event);
-    void wheelEvent(QWheelEvent* event);
-
-    void scaleImage(float factor);
-
-protected:
-    IImageEditorCodec*  mCodec;
-    bool                mIsOfsFile;
-    QString             mDocName;
-    QString             mFilePath;
-    QFile               mFile;
-    OFS::OfsPtr         mOfsPtr;
-    OFS::OFSHANDLE      mOfsFileHandle;
-    ToolTipLabel*       mLabel;
-};
-
-//-----------------------------------------------------------------------------------------
-
-class GIEExport ToolTipLabel : public QLabel
-{
-    Q_OBJECT
-
-public:
-    ToolTipLabel(GenericImageEditorDocument* genImgEdDoc, QWidget *parent = 0);
-
-    void mouseMoveEvent(QMouseEvent *event);
-
-private:
-    GenericImageEditorDocument* mGenImgEdDoc;
-};
-
-//-----------------------------------------------------------------------------------------
-
-#endif
-
-//-----------------------------------------------------------------------------------------

Dependencies/GenericImageEditor/include/genericimageeditorcodec.hxx

 
 #endif
 
-//----------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------

Dependencies/GenericImageEditor/include/genericimageeditordocument.hxx

+/*/////////////////////////////////////////////////////////////////////////////////
+/// An
+///    ___   ____ ___ _____ ___  ____
+///   / _ \ / ___|_ _|_   _/ _ \|  _ \
+///  | | | | |  _ | |  | || | | | |_) |
+///  | |_| | |_| || |  | || |_| |  _ <
+///   \___/ \____|___| |_| \___/|_| \_\
+///                              File
+///
+/// Copyright (c) 2008-2012 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
+//
+/// The MIT License
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a copy
+/// of this software and associated documentation files (the "Software"), to deal
+/// in the Software without restriction, including without limitation the rights
+/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/// copies of the Software, and to permit persons to whom the Software is
+/// furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+/// THE SOFTWARE.
+////////////////////////////////////////////////////////////////////////////////*/
+
+#pragma once
+
+#include <QtCore/QFile>
+#include <QtCore/QTextStream>
+
+#include <QtGui/QScrollArea>
+#include <QtGui/QWidget>
+#include <QtGui/QScrollBar>
+#include <QtGui/QMdiArea>
+#include <QtGui/QMdiSubWindow>
+#include <QtGui/QLabel>
+#include <QtGui/QToolBar>
+#include <QtGui/QAction>
+
+#include "OgreSingleton.h"
+#include "Ogitors.h"
+
+#include "genericimageeditorcodec.hxx"
+#include "ofs.h"
+
+class QPaintEvent;
+class QResizeEvent;
+class QSize;
+class QWidget;
+class QPainter;
+class QRectF;
+class QSizeF;
+
+class GenericImageEditorDocument;
+class ToolTipLabel;
+
+//----------------------------------------------------------------------------------------
+
+#if defined( __WIN32__ ) || defined( _WIN32 )
+   #ifdef GENERICIMAGEEDITOR_EXPORT
+     #define GIEExport __declspec (dllexport)
+   #else
+     #define GIEExport __declspec (dllimport)
+   #endif
+#else
+   #define GIEExport
+#endif
+
+//----------------------------------------------------------------------------------------
+
+class GIEExport GenericImageEditorDocument : public QScrollArea
+{
+    Q_OBJECT
+
+public:
+    GenericImageEditorDocument(QWidget *parent = 0);
+    virtual ~GenericImageEditorDocument();
+
+    void displayImageFromFile(QString docName, QString filePath);
+    void displayImage(QString docName, Ogre::DataStreamPtr stream);
+    bool saveDefaultLogic();
+    inline QString getDocName(){return mDocName;}
+    inline QString getFilePath(){return mFilePath;}
+    inline bool isModified(){return mModified;}
+    inline void setModified(bool modified);
+    
+    inline IImageEditorCodec* getCodec(){return mCodec;}
+    inline void setCodec(IImageEditorCodec* codec){mCodec = codec;}
+    inline bool isOfsFile(){return mIsOfsFile;};
+    inline OFS::OfsPtr getOfsPtr(){return mOfsPtr;};
+    inline OFS::OFSHANDLE getOfsFileHandle(){return mOfsFileHandle;};
+    ToolTipLabel* getLabel(){return mLabel;};
+
+public slots:
+    void onZoomIn();
+    void onZoomOut();
+    void save();
+
+protected:
+    void contextMenuEvent(QContextMenuEvent *event);
+    void mousePressEvent(QMouseEvent *event);
+    void closeEvent(QCloseEvent* event);
+    void showEvent(QShowEvent* event);
+    void wheelEvent(QWheelEvent* event);
+
+    void scaleImage(float factor);
+
+protected:
+    IImageEditorCodec*  mCodec;
+    bool                mIsOfsFile;
+    bool                mModified;
+    QString             mDocName;
+    QString             mFilePath;
+    QFile               mFile;
+    OFS::OfsPtr         mOfsPtr;
+    OFS::OFSHANDLE      mOfsFileHandle;
+    ToolTipLabel*       mLabel;
+};
+
+//-----------------------------------------------------------------------------------------
+
+class GIEExport ToolTipLabel : public QLabel
+{
+    Q_OBJECT
+
+public:
+    ToolTipLabel(GenericImageEditorDocument* genImgEdDoc, QWidget *parent = 0);
+
+    void mouseMoveEvent(QMouseEvent *event);
+
+private:
+    GenericImageEditorDocument* mGenImgEdDoc;
+};
+

Dependencies/GenericImageEditor/include/iimageeditorcodec.hxx

     virtual void        onAfterDisplay(){};
 
     /**
+    * Called when a save request was issued, but only if the member variable mUseDefaultSaveLogic
+    * was set to false. Otherwise the default saving logic of the generic text editor will be used.
+    */
+    virtual void        onSave(){};
+
+    /**
+    * Called after each successful save, regardless of whether it was executed by the codec's save
+    * logic or whether the default save logic from the editor was used.
+    */
+    virtual void        onAfterSave(){};
+
+    /**
     * Called when a context menu request was triggered.
     */
     virtual void        onContextMenu(QContextMenuEvent* event){};
     */
     virtual QToolBar*   getCustomToolBar(){return 0;};
 
-    QPixmap             getPixmap(){return mPixmap;}
-    QString             getDocumentIcon(){return mDocumentIcon;}
-    float               getScaleFactor(){return mScaleFactor;}
+    QPixmap getPixmap(){return mPixmap;}
+    QString getDocumentIcon(){return mDocumentIcon;}
+    bool isUseDefaultSaveLogic(){return mUseDefaultSaveLogic;};
+    float getScaleFactor(){return mScaleFactor;}
 
 protected:
     GenericImageEditorDocument*     mGenImgEdDoc;
-    unsigned char*                  mBuffer;
+    unsigned char*                 mBuffer;
     QPixmap                         mPixmap;
     QString                         mDocName;
     QString                         mDocumentIcon;
     float                           mScaleFactor;
+    bool                            mUseDefaultSaveLogic;
 };
 
 //----------------------------------------------------------------------------------------
 
 #endif
 
-//----------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------

Dependencies/GenericImageEditor/src/genericimageeditor.cpp

     setObjectName(editorName);
     setViewMode(QMdiArea::TabbedView);
     
-    QTabBar* tabBar = findChildren<QTabBar*>().at(0);
-    tabBar->setTabsClosable(true);
+    mTabBar = findChildren<QTabBar*>().at(0);
+    mTabBar->setTabsClosable(true);
 
-    connect(tabBar,         SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
-    connect(tabBar,         SIGNAL(currentChanged(int)),    this, SLOT(tabChanged(int)));
-    connect(this,           SIGNAL(currentChanged(int)),    this, SLOT(tabChanged(int)));
+    connect(mTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
 
     mActZoomIn = new QAction(tr("Zoom In"), this);
     mActZoomIn->setStatusTip(tr("Zoom In"));
     QMainWindow *mw = static_cast<QMainWindow*>(this->parentWidget());
     mw->addToolBar(Qt::TopToolBarArea, mMainToolBar);
 
-    mLastDocument = 0;
+    mActiveDocument = 0;
+
+    //connect(mActEditCut,                SIGNAL(triggered()),    this, SLOT(pasteAvailable()));
+    //connect(mActEditCopy,               SIGNAL(triggered()),    this, SLOT(pasteAvailable()));
+    //connect(mActSave,                   SIGNAL(triggered()),    this, SLOT(onSave()));
+    //connect(QApplication::clipboard(),  SIGNAL(dataChanged()),  this, SLOT(onClipboardChanged()));
 
     // Register the standard generic text editor codec extensions
     GenericImageEditorCodecFactory* genCodecFactory = new GenericImageEditorCodecFactory();
     GenericImageEditor::registerCodecFactory("tiff",        genCodecFactory);
     GenericImageEditor::registerCodecFactory("xbm",         genCodecFactory);
     GenericImageEditor::registerCodecFactory("xpm",         genCodecFactory);
-
     GenericImageEditor::registerCodecFactory("f32",         heightCodecFactory);
 
+    // Below are files generated via render target. Perhaps only make these read only.
+    GenericImageEditor::registerCodecFactory("dds",         genCodecFactory);
+
+    Ogitors::EventManager::getSingletonPtr()->connectEvent(Ogitors::EventManager::MODIFIED_STATE_CHANGE, this, true, 0, true, 0, EVENT_CALLBACK(GenericImageEditor, onModifiedStateChanged));
     Ogitors::EventManager::getSingletonPtr()->connectEvent(Ogitors::EventManager::LOAD_STATE_CHANGE, this, true, 0, true, 0, EVENT_CALLBACK(GenericImageEditor, onLoadStateChanged));
 }
 //-----------------------------------------------------------------------------------------
+GenericImageEditor::~GenericImageEditor()
+{
+    Ogitors::EventManager::getSingletonPtr()->disconnectEvent(Ogitors::EventManager::MODIFIED_STATE_CHANGE, this);
+    Ogitors::EventManager::getSingletonPtr()->disconnectEvent(Ogitors::EventManager::LOAD_STATE_CHANGE, this);
+}
+//-----------------------------------------------------------------------------------------
+/*void GenericImageEditor::pasteAvailable()
+{
+    mActEditPaste->setEnabled(true);
+}*/
+//-----------------------------------------------------------------------------------------
+void GenericImageEditor::onSave()
+{
+  //  mActSave->setEnabled(false);
+}
+//-----------------------------------------------------------------------------------------
 void GenericImageEditor::registerCodecFactory(QString extension, IImageEditorCodecFactory* codec)
 {
     mRegisteredCodecFactories.insert(ImageCodecExtensionFactoryMap::value_type(extension.toStdString(), codec));
         IImageEditorCodec* codec = codecFactory->create(document, filePath);
         document->setCodec(codec);
         document->displayImageFromFile(QFile(filePath).fileName(), filePath);
-
-        QMdiSubWindow* subWindow = new QMdiSubWindow;
-        subWindow->setWidget(document);
-        subWindow->setAttribute(Qt::WA_DeleteOnClose);
-        subWindow->setWindowIcon(QIcon(codec->getDocumentIcon()));
-        addSubWindow(subWindow);
-
-        document->showMaximized();
-        QTabBar* tabBar = findChildren<QTabBar*>().at(0);
-        tabBar->setTabToolTip(findChildren<QMdiSubWindow*>().size() - 1, QFile(filePath).fileName());
+    
+        addTab(document, codec);
     }
     else
     {
-        document->getCodec()->onDisplayRequest();
-        setActiveSubWindow(qobject_cast<QMdiSubWindow*>(document->window()));
-        document->setFocus(Qt::ActiveWindowFocusReason);
+        setActiveDocument(document);
     }
 
     moveToForeground();
     foreach(QMdiSubWindow *window, subWindowList()) 
     {
         document = qobject_cast<GenericImageEditorDocument*>(window->widget());
-        if(document->getFilePath() == filePath)
+        if(document != 0 && document->getFilePath() == filePath)
             return true;
     }
 
+    document = 0;
     return false;
 }
 //-----------------------------------------------------------------------------------------
     foreach(QMdiSubWindow *window, subWindowList()) 
     {
         document = qobject_cast<GenericImageEditorDocument*>(window->widget());
-        if(document->getDocName() == docName)
+        if(document != 0 && document->getDocName() == docName)
             return true;
     }
 
+    document = 0;
     return false;
 }
 //-----------------------------------------------------------------------------------------
+void GenericImageEditor::tabContentChange()
+{
+  //  mActSave->setEnabled(true);
+}
+//-----------------------------------------------------------------------------------------
 void GenericImageEditor::closeTab(int index)
 {
-    if(mLastDocument)
+    QList<QMdiSubWindow*> list = findChildren<QMdiSubWindow*>();
+
+    GenericImageEditorDocument* document = static_cast<GenericImageEditorDocument*>(list[index]->widget());
+    setActiveDocument(document);
+
+    if (!document->close())
+        return;
+        
+    if (document == mActiveDocument)
+        disconnectActiveDocument();
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditor::addTab(GenericImageEditorDocument* newDocument, IImageEditorCodec* codec)
+{
+    QMdiSubWindow* subWindow = new QMdiSubWindow;
+    subWindow->setWidget(newDocument);
+    subWindow->setAttribute(Qt::WA_DeleteOnClose);
+    subWindow->setWindowIcon(QIcon(codec->getDocumentIcon()));
+
+    // [*] is special Qt thing to show the file as modified
+    QFileInfo pathInfo(newDocument->getDocName()+ "[*]");
+
+    subWindow->setWindowTitle(pathInfo.fileName());
+    addSubWindow(subWindow);
+
+    newDocument->showMaximized();
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditor::setActiveDocument(GenericImageEditorDocument* document)
+{  
+    disconnectActiveDocument();
+    
+    mActiveDocument = document;
+
+    //connect(mActSave, SIGNAL(triggered()), mActiveDocument, SLOT(save()));
+    //connect(mActEditCut, SIGNAL(triggered()), mActiveDocument, SLOT(cut()));
+    //connect(mActEditCopy, SIGNAL(triggered()), mActiveDocument, SLOT(copy()));
+    //connect(mActEditPaste, SIGNAL(triggered()), mActiveDocument, SLOT(paste()));
+
+    //connect(mActiveDocument, SIGNAL(textChanged()), this, SLOT(tabContentChange()));
+    //connect(mActiveDocument, SIGNAL(textChanged()), mActiveDocument, SLOT(documentWasModified()));
+
+    //connect(mActiveDocument, SIGNAL(copyAvailable(bool)), mActEditCopy, SLOT(setEnabled(bool)));
+    //connect(mActiveDocument, SIGNAL(copyAvailable(bool)), mActEditCut, SLOT(setEnabled(bool)));
+
+    
+    //mActSave->setEnabled(mActiveDocument->isModified());
+    //mActEditCut->setEnabled(false);
+    //mActEditCopy->setEnabled(false);
+
+    QToolBar *tb = document->getCodec()->getCustomToolBar();
+    if(tb != 0)
     {
-        disconnect(mActZoomIn,  SIGNAL(triggered()), mLastDocument, SLOT(onZoomIn()));
-        disconnect(mActZoomOut, SIGNAL(triggered()), mLastDocument, SLOT(onZoomOut()));
-        mLastDocument = 0;
+        QMainWindow *mw = static_cast<QMainWindow*>(this->parentWidget());
+        mw->addToolBar(Qt::TopToolBarArea, tb);
+        tb->show();
     }
-    
-    emit currentChanged(subWindowList().indexOf(activeSubWindow()));
+
+    mActiveDocument->setFocus(Qt::ActiveWindowFocusReason);
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditor::disconnectActiveDocument()
+{
+    if (mActiveDocument == 0)
+        return;
+
+    /*
+    TODO: I have commented out functionality however it should be implemented later. Keeping it
+    commented out so you can see where you need to implement features.
+     */
+
+    //disconnect(mActSave, SIGNAL(triggered()), mActiveDocument, SLOT(save()));
+    //disconnect(mActEditCut, SIGNAL(triggered()), mActiveDocument, SLOT(cut()));
+    //disconnect(mActEditCopy, SIGNAL(triggered()), mActiveDocument, SLOT(copy()));
+    //disconnect(mActEditPaste, SIGNAL(triggered()), mActiveDocument, SLOT(paste()));
+    //disconnect(mActiveDocument, SIGNAL(textChanged()), this, SLOT(tabContentChange()));
+    //disconnect(mActiveDocument, SIGNAL(copyAvailable(bool)), mActEditCopy, SLOT(setEnabled(bool)));
+    //disconnect(mActiveDocument, SIGNAL(copyAvailable(bool)), mActEditCut, SLOT(setEnabled(bool)));
+
+    QToolBar *tb = mActiveDocument->getCodec()->getCustomToolBar();
+    if(tb != 0)
+    {
+        QMainWindow *mw = static_cast<QMainWindow*>(this->parentWidget());
+        mw->removeToolBar(tb);
+    }
+
+    //mActSave->setEnabled(false);
+    //mActEditCut->setEnabled(false);
+    //mActEditCopy->setEnabled(false);
+    //mActEditPaste->setEnabled(false);
+
+    mActiveDocument = 0;
 }
 //-----------------------------------------------------------------------------------------
 void GenericImageEditor::closeEvent(QCloseEvent *event)
     mParentTabWidget->setCurrentIndex(mParentTabWidget->indexOf(this->parentWidget()));
 }
 //-----------------------------------------------------------------------------------------
-void GenericImageEditor::tabChanged(int index)
+void GenericImageEditor::saveAll()
 {
-    QMainWindow *mw = static_cast<QMainWindow*>(this->parentWidget());
+    GenericImageEditorDocument* document;
+    QList<QMdiSubWindow*> list = subWindowList();
+    for(int i = 0; i < list.size(); i++)
+    { 
+        document = static_cast<GenericImageEditorDocument*>(list[i]->widget());
+        document->save();
+    }
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditor::onModifiedStateChanged(Ogitors::IEvent* evt)
+{
+    Ogitors::SceneModifiedChangeEvent *change_event = Ogitors::event_cast<Ogitors::SceneModifiedChangeEvent*>(evt);
 
-    if(mLastDocument)
-    {
-        disconnect(mActZoomIn,  SIGNAL(triggered()), mLastDocument, SLOT(onZoomIn()));
-        disconnect(mActZoomOut, SIGNAL(triggered()), mLastDocument, SLOT(onZoomOut()));
+    if(!change_event)
+        return;
 
-        QToolBar *tb = mLastDocument->getCodec()->getCustomToolBar();
-        if(tb != 0)
-            mw->removeToolBar(tb);
-    }
-    
-    // -1 means that the last tab was just closed and so there is no one left anymore to switch to
-    if(index != -1)
-    {
-        GenericImageEditorDocument* document;
-        QList<QMdiSubWindow*> list = subWindowList();
-        document = static_cast<GenericImageEditorDocument*>(list[index]->widget());
-        document->getCodec()->onTabChange();
+    bool state = change_event->getState();
 
-        connect(mActZoomIn,  SIGNAL(triggered()), document, SLOT(onZoomIn()));
-        connect(mActZoomOut, SIGNAL(triggered()), document, SLOT(onZoomOut()));
-        mActZoomIn->setEnabled(true);
-        mActZoomOut->setEnabled(true);
-        
-        mLastDocument = document;
-
-        QToolBar *tb = mLastDocument->getCodec()->getCustomToolBar();
-        if(tb != 0)
-        {
-            mw->addToolBar(Qt::TopToolBarArea, tb);
-            tb->show();
-        }
-    }
-    else
-    {
-        mActZoomIn->setEnabled(false);
-        mActZoomOut->setEnabled(false);
-        mLastDocument = 0;
-    }
+    // If scene is not modified anymore, the user saved it, so we need to save the
+    // documents as well.
+    if(!state)
+        saveAll();
 }
 //-----------------------------------------------------------------------------------------
 void GenericImageEditor::onLoadStateChanged(Ogitors::IEvent* evt)
 {
     Ogitors::LoadStateChangeEvent *change_event = Ogitors::event_cast<Ogitors::LoadStateChangeEvent*>(evt);
 
-    if(change_event)
+    if(!change_event)
+        return;
+    
+    Ogitors::LoadState state = change_event->getType();
+
+    if(state == Ogitors::LS_UNLOADED)
     {
-        Ogitors::LoadState state = change_event->getType();
-
-        if(state == Ogitors::LS_UNLOADED)
-        {
-            if(mLastDocument)
-            {
-                disconnect(mActZoomIn,  SIGNAL(triggered()), mLastDocument, SLOT(onZoomIn()));
-                disconnect(mActZoomOut, SIGNAL(triggered()), mLastDocument, SLOT(onZoomOut()));
-
-                QMainWindow *mw = static_cast<QMainWindow*>(this->parentWidget());
-
-                QToolBar *tb = mLastDocument->getCodec()->getCustomToolBar();
-                if(tb != 0)
-                    mw->removeToolBar(tb);
-            }
-
-            mLastDocument = 0;
-
-            closeAllSubWindows();
-        }
-    }
-}
-/************************************************************************/
-GenericImageEditorDocument::GenericImageEditorDocument(QWidget *parent) : QScrollArea(parent), 
-mCodec(0), mDocName(""), mFilePath(""), mFile(0), mIsOfsFile(false)
-{
-    mLabel = new ToolTipLabel(this);
-    mLabel->setScaledContents(true);
-}
-//-----------------------------------------------------------------------------------------
-GenericImageEditorDocument::~GenericImageEditorDocument()
-{
-    mOfsPtr.unmount();
-    delete mCodec;
-    mCodec = 0;
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::displayImageFromFile(QString docName, QString filePath)
-{
-    mDocName = docName;
-    mFilePath = filePath;
-
-    int pos = filePath.indexOf("::");
-    if(pos > 0)
-    {
-        QString ofsFile = filePath.mid(0, pos);
-        filePath.remove(0, pos + 2);
-        
-        if(mOfsPtr.mount(ofsFile.toStdString().c_str()) != OFS::OFS_OK)
-            return;
-
-        OFS::OFSHANDLE *handle = new OFS::OFSHANDLE();
-
-        if(mOfsPtr->openFile(*handle, filePath.toStdString().c_str(), OFS::OFS_READ) != OFS::OFS_OK)
-        {
-            mOfsPtr.unmount();
-            return;
-        }
-
-        mIsOfsFile = true;
-
-        Ogre::DataStreamPtr stream(new Ogitors::OfsDataStream(mOfsPtr, handle));
-        
-        displayImage(docName, stream);
-    }
-    else
-    {
-        mIsOfsFile = false;
-
-        std::ifstream inpstr(filePath.toStdString().c_str());
-        Ogre::DataStreamPtr stream(new Ogre::FileStreamDataStream(&inpstr, false));
-
-        displayImage(docName, stream);
-    }   
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::displayImage(QString docName, Ogre::DataStreamPtr stream)
-{
-    mLabel->setMouseTracking(true);
-    mLabel->setPixmap(mCodec->onBeforeDisplay(stream));
-    mLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
-
-    setWidget(mLabel);
-
-    QString tabTitle = docName;
-    if(tabTitle.length() > 25)
-        tabTitle = tabTitle.left(12) + "..." + tabTitle.right(10);
-    setWindowTitle(tabTitle + QString("[*]"));
-    setWindowModified(false);
-
-    mCodec->onAfterDisplay();
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::contextMenuEvent(QContextMenuEvent *event)
-{
-    mCodec->onContextMenu(event);
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::mousePressEvent(QMouseEvent *event)
-{
-    // Rewrite the right click mouse event to a left button event so the cursor is moved to the location of the click
-    if(event->button() == Qt::RightButton)
-        event = new QMouseEvent(QEvent::MouseButtonPress, event->pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
-    QScrollArea::mousePressEvent(event);
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::releaseFile()
-{
-    mFile.close();
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::closeEvent(QCloseEvent* event)
-{
-    getCodec()->onClose();
-    releaseFile();
-    close();
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::wheelEvent(QWheelEvent* event)
-{
-    int numDegrees = event->delta() / 8;
-    float numSteps = numDegrees / 15;
-
-    scaleImage(1 + (float)(numSteps / 10));
-    event->accept();
-}
-//-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::scaleImage(float factor)
-{  
-    // Currently limited to 5120px to prevent huge slowdowns when trying to zoom in any further.
-    // Changing the logic to only deal with the part of the image / pixmap that is actually displayed 
-    // might help to reduce the load in future revisions.
-    if(getCodec()->getScaleFactor() * factor * mLabel->pixmap()->size().height() < 5120)
-    {
-        QPixmap map = getCodec()->onScaleImage(factor);
-        qDebug(QString::number(map.height()).toAscii());
-        mLabel->resize(getCodec()->onScaleImage(factor).size());
+        closeAllSubWindows();
     }
 }
 //-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::onZoomIn()
+/*void GenericImageEditor::onClipboardChanged()
 {
-    scaleImage(1.1f);
-}
+    const QClipboard* clipboard = QApplication::clipboard();
+    const QMimeData* mimeData = clipboard->mimeData();
+
+    if(mimeData->hasText())
+        emit pasteAvailable();
+}*/
 //-----------------------------------------------------------------------------------------
-void GenericImageEditorDocument::onZoomOut()
-{
-    scaleImage(0.9f);
-}
-/************************************************************************/
-ToolTipLabel::ToolTipLabel(GenericImageEditorDocument* genImgEdDoc, QWidget *parent) : QLabel(parent),
-mGenImgEdDoc(genImgEdDoc)
-{
-    setMouseTracking(true);
-}
-//-----------------------------------------------------------------------------------------
-void ToolTipLabel::mouseMoveEvent(QMouseEvent *event)
-{
-    QToolTip::showText(event->globalPos(), mGenImgEdDoc->getCodec()->onToolTip(event), this);
-}
-//-----------------------------------------------------------------------------------------

Dependencies/GenericImageEditor/src/genericimageeditorcodec.cpp

 ////////////////////////////////////////////////////////////////////////////////*/
 
 #include "genericimageeditorcodec.hxx"
+#include "imageconverter.hxx"
 
 //-----------------------------------------------------------------------------------------
 GenericImageEditorCodec::GenericImageEditorCodec(GenericImageEditorDocument* genImgEdDoc, QString docName, QString documentIcon) : 
     Ogre::Image image;
     image.load(stream);
 
-    int w = image.getWidth();
-    int h = image.getHeight();
+    ImageConverter imageConverter(image.getWidth(), image.getHeight());
 
-    mBuffer = new unsigned char[4 * w * h];
-    Ogre::PixelBox pb(w, h, 1, Ogre::PF_A8R8G8B8, mBuffer);
+    if (mPixmap.convertFromImage(imageConverter.fromOgreImage(image)))
+        return mPixmap;
 
-    Ogre::PixelUtil::bulkPixelConversion(image.getPixelBox(), pb);
-
-    QImage tmpImage = QImage(mBuffer, w, h, QImage::Format_ARGB32);
-    mPixmap = QPixmap(QPixmap::fromImage(tmpImage));
-
+    mPixmap = 0;
     return mPixmap;
 }
 //-----------------------------------------------------------------------------------------
 {
     return new GenericImageEditorCodec(genImgEdDoc, docName, ":/icons/paint.svg");
 }
-//-----------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------

Dependencies/GenericImageEditor/src/genericimageeditordocument.cpp

+/*/////////////////////////////////////////////////////////////////////////////////
+/// An
+///    ___   ____ ___ _____ ___  ____
+///   / _ \ / ___|_ _|_   _/ _ \|  _ \
+///  | | | | |  _ | |  | || | | | |_) |
+///  | |_| | |_| || |  | || |_| |  _ <
+///   \___/ \____|___| |_| \___/|_| \_\
+///                              File
+///
+/// Copyright (c) 2008-2012 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
+//
+/// The MIT License
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a copy
+/// of this software and associated documentation files (the "Software"), to deal
+/// in the Software without restriction, including without limitation the rights
+/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/// copies of the Software, and to permit persons to whom the Software is
+/// furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+/// THE SOFTWARE.
+////////////////////////////////////////////////////////////////////////////////*/
+
+#include <QtGui/QtGui>
+#include "genericimageeditordocument.hxx"
+#include "genericimageeditor.hxx"
+#include "heightimageeditorcodec.hxx"
+
+#include "Ogitors.h"
+#include "OgitorsDefinitions.h"
+#include "DefaultEvents.h"
+#include "EventManager.h"
+#include "OFSDataStream.h"
+
+GenericImageEditorDocument::GenericImageEditorDocument(QWidget *parent) : QScrollArea(parent), 
+mCodec(0), mDocName(""), mFilePath(""), mFile(0), mIsOfsFile(false)
+{
+    mLabel = new ToolTipLabel(this);
+    mLabel->setScaledContents(true);
+}
+//-----------------------------------------------------------------------------------------
+GenericImageEditorDocument::~GenericImageEditorDocument()
+{
+    mFile.close();
+    mOfsPtr.unmount();
+    delete mCodec;
+    mCodec = 0;
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::displayImageFromFile(QString docName, QString filePath)
+{
+    mDocName = docName;
+    mFilePath = filePath;
+
+    int pos = filePath.indexOf("::");
+    if(pos > 0)
+    {
+        QString ofsFile = filePath.mid(0, pos);
+        filePath.remove(0, pos + 2);
+        
+        if(mOfsPtr.mount(ofsFile.toStdString().c_str()) != OFS::OFS_OK)
+            return;
+
+        OFS::OFSHANDLE *handle = new OFS::OFSHANDLE();
+
+        if(mOfsPtr->openFile(*handle, filePath.toStdString().c_str(), OFS::OFS_READ) != OFS::OFS_OK)
+        {
+            mOfsPtr.unmount();
+            return;
+        }
+
+        mIsOfsFile = true;
+        Ogre::DataStreamPtr stream(new Ogitors::OfsDataStream(mOfsPtr, handle));
+        displayImage(docName, stream);
+    }
+    else
+    {
+        mIsOfsFile = false;
+
+        std::ifstream inpstr(filePath.toStdString().c_str());
+        Ogre::DataStreamPtr stream(new Ogre::FileStreamDataStream(&inpstr, false));
+
+        displayImage(docName, stream);
+    }   
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::displayImage(QString docName, Ogre::DataStreamPtr stream)
+{
+    mLabel->setMouseTracking(true);
+    mLabel->setPixmap(mCodec->onBeforeDisplay(stream));
+    mLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+
+    setWidget(mLabel);
+    setWindowModified(false);
+
+    mCodec->onAfterDisplay();
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::contextMenuEvent(QContextMenuEvent *event)
+{
+    mCodec->onContextMenu(event);
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::mousePressEvent(QMouseEvent *event)
+{
+    // Rewrite the right click mouse event to a left button event so the cursor is moved to the location of the click
+    if(event->button() == Qt::RightButton)
+        event = new QMouseEvent(QEvent::MouseButtonPress, event->pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+    QScrollArea::mousePressEvent(event);
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::setModified(bool modified)
+{
+    mModified = modified; 
+    setWindowModified(modified);
+    Ogitors::OgitorsRoot::getSingletonPtr()->ChangeSceneModified(modified);
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::save()
+{
+    if(isModified())
+    {
+        if(!mCodec->isUseDefaultSaveLogic())
+            mCodec->onSave();
+        else
+            if(!saveDefaultLogic())
+                QMessageBox::information(QApplication::activeWindow(), "qtOgitor", QObject::tr("Error saving file %1").arg(mFilePath));
+
+        mCodec->onAfterSave();
+    }
+
+    setModified(false);
+}
+//-----------------------------------------------------------------------------------------
+bool GenericImageEditorDocument::saveDefaultLogic()
+{
+    // unimplemented
+    return false;
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::closeEvent(QCloseEvent* event)
+{
+    if(isWindowModified())
+    {
+        int result = QMessageBox::information(QApplication::activeWindow(), "qtOgitor", "Document has been modified. Should the changes be saved?", QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+        switch(result)
+        {
+        case QMessageBox::Yes:      save(); break;
+        case QMessageBox::No:       break;
+        case QMessageBox::Cancel:   event->ignore(); return;
+        }
+    }
+
+    event->accept();
+    getCodec()->onClose();
+    close();
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::showEvent(QShowEvent* event)
+{
+    GenericImageEditor* editor = (GenericImageEditor*) ((QMdiSubWindow*)parent())->mdiArea();
+    editor->setActiveDocument(this);
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::wheelEvent(QWheelEvent* event)
+{
+    int numDegrees = event->delta() / 8;
+    float numSteps = numDegrees / 15;
+
+    scaleImage(1 + (float)(numSteps / 10));
+    event->accept();
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::scaleImage(float factor)
+{  
+    // Currently limited to 5120px to prevent huge slowdowns when trying to zoom in any further.
+    // Changing the logic to only deal with the part of the image / pixmap that is actually displayed 
+    // might help to reduce the load in future revisions.
+    if(getCodec()->getScaleFactor() * factor * mLabel->pixmap()->size().height() < 5120)
+    {
+        QPixmap map = getCodec()->onScaleImage(factor);
+        qDebug(QString::number(map.height()).toAscii());
+        mLabel->resize(getCodec()->onScaleImage(factor).size());
+    }
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::onZoomIn()
+{
+    scaleImage(1.1f);
+}
+//-----------------------------------------------------------------------------------------
+void GenericImageEditorDocument::onZoomOut()
+{
+    scaleImage(0.9f);
+}
+/************************************************************************/
+ToolTipLabel::ToolTipLabel(GenericImageEditorDocument* genImgEdDoc, QWidget *parent) : QLabel(parent),
+mGenImgEdDoc(genImgEdDoc)
+{
+    setMouseTracking(true);
+}
+//-----------------------------------------------------------------------------------------
+void ToolTipLabel::mouseMoveEvent(QMouseEvent *event)
+{
+    QToolTip::showText(event->globalPos(), mGenImgEdDoc->getCodec()->onToolTip(event), this);
+}
+//-----------------------------------------------------------------------------------------

Dependencies/GenericTextEditor/CMakeLists.txt

 
     file(GLOB UI_FILES *.ui)
 
-    set(HEADER_FILES
+    set(HEADER_FILES        
         ./include/generictexteditor.hxx
-        ./include/itexteditorcodec.hxx
         ./include/generictexteditorcodec.hxx
-	   ./include/xmltexteditorcodec.hxx
+        ./include/generictexteditordocument.hxx
+        ./include/itexteditorcodec.hxx        
+	    ./include/xmltexteditorcodec.hxx
     )
 
     set(SOURCE_FILES
         ./src/generictexteditor.cpp
         ./src/generictexteditorcodec.cpp
-	   ./src/xmltexteditorcodec.cpp
+        ./src/generictexteditordocument.cpp        
+	    ./src/xmltexteditorcodec.cpp
     )
 
     SET(MOC_SRCS2
         ./include/generictexteditor.hxx
-        ./include/itexteditorcodec.hxx
         ./include/generictexteditorcodec.hxx
-	   ./include/xmltexteditorcodec.hxx
+        ./include/generictexteditordocument.hxx
+        ./include/itexteditorcodec.hxx        
+	    ./include/xmltexteditorcodec.hxx
     )
 
     qt4_wrap_cpp(MOC_SRCS ${MOC_SRCS2})
     include_directories(${OGITOR_INCLUDES})
         include_directories(../OFS/include)
 
-
     link_libraries(${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} OFS Ogitor)
     add_library(GenericTextEditor SHARED ${SRCS})
     set(LIBRARY_OUTPUT_PATH ../lib)
 
-        add_dependencies(GenericTextEditor OFS)
+    add_dependencies(GenericTextEditor OFS)
 
     if(NOT OGITOR_DIST)
         set_target_properties(GenericTextEditor PROPERTIES INSTALL_RPATH ${OGRE_INSTALL_DIR}/lib/OGRE)
         add_custom_command(TARGET GenericTextEditor PRE_BUILD
             COMMAND mkdir -p ../../RunPath/lib)
         add_custom_command(TARGET GenericTextEditor POST_BUILD
-            COMMAND cp -r ../lib/libGenericTextEditor_Ogitor.*
-../../RunPath/lib/)
+            COMMAND cp -r ../lib/libGenericTextEditor_Ogitor.* ../../RunPath/lib/)
     endif(UNIX AND NOT APPLE)
 
     if(WIN32)

Dependencies/GenericTextEditor/include/generictexteditor.hxx

 #ifndef GENERIC_TEXT_EDITOR_HXX
 #define GENERIC_TEXT_EDITOR_HXX
 
-#include <QtCore/QFile>
-#include <QtCore/QTextStream>
-
-#include <QtGui/QScrollArea>
-#include <QtGui/QWidget>
-#include <QtGui/QPlainTextEdit>
-#include <QtGui/QScrollBar>
-#include <QtGui/QMdiArea>
-#include <QtGui/QMdiSubWindow>
-#include <QtGui/QToolBar>
-#include <QtGui/QStringListModel>
-#include <QtGui/QCompleter>
-#include <QtGui/QAction>
+#include "generictexteditordocument.hxx"
+#include "generictexteditorcodec.hxx"
 
 #include "Ogitors.h"
 #include "OgreSingleton.h"
-
-#include "generictexteditorcodec.hxx"
-#include "ofs.h"
-
-class QPaintEvent;
-class QResizeEvent;
-class QSize;
-class QWidget;
-class QTextDocument;
-class QTextFormat;
-class QPainter;
-class QRectF;
-class QSizeF;
-
-class GenericTextEditorDocument;
-class LineNumberArea;
+#include "OgitorsDefinitions.h"
 
 #if defined( __WIN32__ ) || defined( _WIN32 )
    #ifdef GENERICTEXTEDITOR_EXPORT
 
 public:
     GenericTextEditor(QString editorName, QWidget *parent = 0);
-    ~GenericTextEditor();
+    virtual ~GenericTextEditor();
 
-    bool                            displayTextFromFile(QString filePath, QString optionalData = "");
-    bool                            displayText(QString docName, QString text, QString extension = "", QString optionalData = "");
-    void                            moveToForeground();
-    void                            saveAll();
+    bool displayTextFromFile(QString filePath, QString optionalData = "");
+    bool displayText(QString docName, QString text, QString extension = "", QString optionalData = "");
+    void moveToForeground();
+    void saveAll();
 
-    static void                     registerCodecFactory(QString extension, ITextEditorCodecFactory* codec);
-    static void                     unregisterCodecFactory(QString extension);
+    static void registerCodecFactory(QString extension, ITextEditorCodecFactory* codec);
+    static void unregisterCodecFactory(QString extension);
     static ITextEditorCodecFactory* findMatchingCodecFactory(QString extensionOrFileName);
 
-    static QStringListModel*        modelFromFile(const QString& fileName);
+    static QStringListModel* modelFromFile(const QString& fileName);
 
-    inline void                     setAllowDoubleDisplay(bool allow) {mAllowDoubleDisplay = allow;}
-    inline bool                     isAllowDoubleDisplay() {return mAllowDoubleDisplay;}
+    inline void setAllowDoubleDisplay(bool allow) {mAllowDoubleDisplay = allow;}
+    inline bool isAllowDoubleDisplay() {return mAllowDoubleDisplay;}
 
-    void                            onModifiedStateChanged(Ogitors::IEvent* evt);
-    void                            onLoadStateChanged(Ogitors::IEvent* evt);
-    GenericTextEditorDocument*      getLastDocument() { return mLastDocument; }
+    void onModifiedStateChanged(Ogitors::IEvent* evt);
+    void onLoadStateChanged(Ogitors::IEvent* evt);
+
+    GenericTextEditorDocument* getActiveDocument() { return mActiveDocument; }
+    void setActiveDocument(GenericTextEditorDocument* document);
 
 signals:
-    void                            currentChanged(int);
+    void currentChanged(int);
 
 public slots:
-    void                            tabContentChange();
-    void                            pasteAvailable();
-    void                            onSave();
-    void                            onClipboardChanged();
+    void tabContentChange();
+    void pasteAvailable();
+    void onSave();
+    void onClipboardChanged();
 
 protected:
-    bool                            isPathAlreadyShowing(QString filePath, GenericTextEditorDocument*& document);
-    bool                            isDocAlreadyShowing(QString docName, GenericTextEditorDocument*& document);
-    void                            closeEvent(QCloseEvent *event);  
-
-protected slots:
-	void	                        tabChanged(int index);
+    bool isPathAlreadyShowing(QString filePath, GenericTextEditorDocument*& document);
+    bool isDocAlreadyShowing(QString docName, GenericTextEditorDocument*& document);
+    void closeEvent(QCloseEvent *event);
 
 private slots:
-    void                            closeTab(int index);
+    void closeTab(int index);
 
 private:
-     static TextCodecExtensionFactoryMap    mRegisteredCodecFactories;   
-     QTabWidget*                            mParentTabWidget;
-     bool                                   mAllowDoubleDisplay;
-     GenericTextEditorDocument*             mLastDocument;
-     QToolBar*                              mMainToolBar;
-     QAction*                               mActSave;
-     QAction*                               mActEditCut;
-     QAction*                               mActEditCopy;
-     QAction*                               mActEditPaste;
+    void disconnectActiveDocument();
+    void addTab(GenericTextEditorDocument* newDocument, ITextEditorCodec* codec);
+
+    static TextCodecExtensionFactoryMap mRegisteredCodecFactories;   
+    bool mAllowDoubleDisplay;
+
+    QTabWidget *mParentTabWidget;
+    QTabBar *mTabBar;
+    GenericTextEditorDocument *mActiveDocument;
+
+    QToolBar   *mMainToolBar;
+    QAction    *mActSave;
+    QAction    *mActEditCut;
+    QAction    *mActEditCopy;
+    QAction    *mActEditPaste;
 };
 
-//-----------------------------------------------------------------------------------------
-
-class GTEExport GenericTextEditorDocument : public QPlainTextEdit
-{
-    Q_OBJECT
-
-public:
-    GenericTextEditorDocument(QWidget *parent = 0);
-    ~GenericTextEditorDocument();
-
-    void lineNumberAreaPaintEvent(QPaintEvent *event);
-    int  lineNumberAreaWidth();
-
-    void displayTextFromFile(QString docName, QString filePath, QString optionalData);
-    void displayText(QString docName, QString text, QString optionalData);
-    bool saveDefaultLogic();
-    void releaseFile();
-    void addCompleter(const QString keywordListFilePath);
-    void addCompleter(const QStringList stringList);
-
-    inline QString getDocName(){return mDocName;}
-    inline QString getFilePath(){return mFilePath;}
-    inline ITextEditorCodec* getCodec(){return mCodec;}
-    inline bool isTextModified(){return mTextModified;}
-    inline void setTextModified(bool modified);
-    inline void setCodec(ITextEditorCodec* codec){mCodec = codec;}
-    inline bool isOfsFile(){return mIsOfsFile;};
-    inline OFS::OfsPtr getOfsPtr(){return mOfsPtr;};
-    inline OFS::OFSHANDLE getOfsFileHandle(){return mOfsFileHandle;};
-    inline QFile* getFile(){return &mFile;};
-    inline void setInitialDisplay(bool initial){mInitialDisplay = initial;};
-    inline bool isIntialDisplay(){return mInitialDisplay;};
-
-public slots:
-    void save();
-    void closeEvent(QCloseEvent* event);
-
-protected:
-    void resizeEvent(QResizeEvent *event);
-    void keyPressEvent(QKeyEvent *event);
-    void focusInEvent(QFocusEvent *event);
-    void contextMenuEvent(QContextMenuEvent *event);
-    void mousePressEvent(QMouseEvent *event);
-    QString textUnderCursor() const;
-    int  calculateIndentation(const QString& str);
-
-protected slots:
-    void updateLineNumberAreaWidth(int newBlockCount);
-    void highlightCurrentLine();
-    void updateLineNumberArea(const QRect &, int);
-    void insertCompletion(const QString &completion);
-    void documentWasModified();
-
-protected:
-    ITextEditorCodec*   mCodec;
-    bool                mIsOfsFile;
-    QString             mDocName;
-    QString             mFilePath;
-    QFile               mFile;
-    OFS::OfsPtr         mOfsPtr;
-    OFS::OFSHANDLE      mOfsFileHandle;
-    QWidget*            mLineNumberArea;
-    QCompleter*         mCompleter;
-    bool                mTextModified;
-    bool                mInitialDisplay;
-};
-
-//-----------------------------------------------------------------------------------------
-
-class GTEExport LineNumberArea : public QWidget
-{
-public:
-    LineNumberArea(GenericTextEditorDocument *document) : QWidget(document) 
-    {
-        genericTextEditorDocument = document;
-    }
-
-    QSize sizeHint() const {return QSize(genericTextEditorDocument->lineNumberAreaWidth(), 0);}
-
-protected:
-    void paintEvent(QPaintEvent *event){genericTextEditorDocument->lineNumberAreaPaintEvent(event);}
-
-private:
-    GenericTextEditorDocument *genericTextEditorDocument;
-};
-
-//-----------------------------------------------------------------------------------------
-
 #endif
 
-//-----------------------------------------------------------------------------------------

Dependencies/GenericTextEditor/include/generictexteditordocument.hxx

+/*/////////////////////////////////////////////////////////////////////////////////
+/// An
+///    ___   ____ ___ _____ ___  ____
+///   / _ \ / ___|_ _|_   _/ _ \|  _ \
+///  | | | | |  _ | |  | || | | | |_) |
+///  | |_| | |_| || |  | || |_| |  _ <
+///   \___/ \____|___| |_| \___/|_| \_\
+///                              File
+///
+/// Copyright (c) 2008-2012 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
+//
+/// The MIT License
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a copy
+/// of this software and associated documentation files (the "Software"), to deal
+/// in the Software without restriction, including without limitation the rights
+/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/// copies of the Software, and to permit persons to whom the Software is
+/// furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+/// THE SOFTWARE.
+////////////////////////////////////////////////////////////////////////////////*/
+
+#ifndef GENERIC_TEXT_EDITOR_DOCUMENT_HXX
+#define GENERIC_TEXT_EDITOR_DOCUMENT_HXX
+
+#include "generictexteditorcodec.hxx"
+#include "ofs.h"
+
+#include <QtCore/QFile>
+#include <QtCore/QTextStream>
+
+#include <QtGui/QScrollArea>
+#include <QtGui/QWidget>
+#include <QtGui/QPlainTextEdit>
+#include <QtGui/QScrollBar>
+#include <QtGui/QMdiArea>
+#include <QtGui/QMdiSubWindow>
+#include <QtGui/QToolBar>
+#include <QtGui/QStringListModel>
+#include <QtGui/QCompleter>
+#include <QtGui/QAction>
+
+
+class QPaintEvent;
+class QResizeEvent;
+class QSize;
+class QWidget;
+class QTextDocument;
+class QTextFormat;
+class QPainter;
+class QRectF;
+class QSizeF;
+
+#if defined( __WIN32__ ) || defined( _WIN32 )
+   #ifdef GENERICTEXTEDITOR_EXPORT
+     #define GTEExport __declspec (dllexport)
+   #else
+     #define GTEExport __declspec (dllimport)
+   #endif
+#else
+   #define GTEExport
+#endif
+
+class GTEExport GenericTextEditorDocument : public QPlainTextEdit
+{
+    Q_OBJECT
+
+public:
+    GenericTextEditorDocument(QWidget *parent = 0);
+    virtual ~GenericTextEditorDocument();
+
+    void lineNumberAreaPaintEvent(QPaintEvent *event);
+    int  lineNumberAreaWidth();
+
+    void displayTextFromFile(QString docName, QString filePath, QString optionalData);
+    void displayText(QString docName, QString text, QString optionalData);
+    bool saveDefaultLogic();
+    void releaseFile();
+    void addCompleter(const QString keywordListFilePath);
+    void addCompleter(const QStringList stringList);
+
+    inline QString getDocName(){return mDocName;}
+    inline QString getFilePath(){return mFilePath;}
+    inline ITextEditorCodec* getCodec(){return mCodec;}
+    inline bool isTextModified(){return mTextModified;}
+    inline void setTextModified(bool modified);
+    inline void setCodec(ITextEditorCodec* codec){mCodec = codec;}
+    inline bool isOfsFile(){return mIsOfsFile;};
+    inline OFS::OfsPtr getOfsPtr(){return mOfsPtr;};
+    inline OFS::OFSHANDLE getOfsFileHandle(){return mOfsFileHandle;};
+    inline QFile* getFile(){return &mFile;};
+    inline void setInitialDisplay(bool initial){mInitialDisplay = initial;};
+    inline bool isIntialDisplay(){return mInitialDisplay;};
+
+public slots:
+    void save();
+    void closeEvent(QCloseEvent* event);
+    void showEvent(QShowEvent* event);
+
+protected:
+    void resizeEvent(QResizeEvent *event);
+    void keyPressEvent(QKeyEvent *event);
+    void focusInEvent(QFocusEvent *event);
+    void contextMenuEvent(QContextMenuEvent *event);
+    void mousePressEvent(QMouseEvent *event);
+    QString textUnderCursor() const;
+    int  calculateIndentation(const QString& str);
+
+protected slots:
+    void updateLineNumberAreaWidth(int newBlockCount);
+    void highlightCurrentLine();
+    void updateLineNumberArea(const QRect &, int);
+    void insertCompletion(const QString &completion);
+    void documentWasModified();
+
+protected:
+    ITextEditorCodec*   mCodec;
+    bool                mIsOfsFile;
+    QString             mDocName;
+    QString             mFilePath;
+    QFile               mFile;
+    OFS::OfsPtr         mOfsPtr;
+    OFS::OFSHANDLE      mOfsFileHandle;
+    QWidget*            mLineNumberArea;
+    QCompleter*         mCompleter;
+    bool                mTextModified;
+    bool                mInitialDisplay;
+};
+
+//-----------------------------------------------------------------------------------------
+
+class GTEExport LineNumberArea : public QWidget
+{
+public:
+    LineNumberArea(GenericTextEditorDocument *document) : QWidget(document) 
+    {
+        genericTextEditorDocument = document;
+    }
+
+    QSize sizeHint() const {return QSize(genericTextEditorDocument->lineNumberAreaWidth(), 0);}
+
+protected:
+    void paintEvent(QPaintEvent *event){genericTextEditorDocument->lineNumberAreaPaintEvent(event);}
+
+private:
+    GenericTextEditorDocument *genericTextEditorDocument;
+};
+
+#endif
+

Dependencies/GenericTextEditor/include/itexteditorcodec.hxx

     */
     virtual QToolBar*   getCustomToolBar(){return 0;};
 
-    QString         getDocumentIcon(){return mDocumentIcon;}
-    void            setOptionalData(QString optionalData){mOptionalData = optionalData;};
-    bool            isUseDefaultSaveLogic(){return mUseDefaultSaveLogic;};
+    QString getDocumentIcon(){return mDocumentIcon;}
+    void setOptionalData(QString optionalData){mOptionalData = optionalData;};
+    bool isUseDefaultSaveLogic(){return mUseDefaultSaveLogic;};