mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 12:32:36 +00:00
new attempt at the editor
This commit is contained in:
parent
c8562d8442
commit
c3cd6e8a8a
@ -31,6 +31,7 @@ option(OGRE_STATIC "Link static build of Ogre and Ogre Plugins into the binaries
|
|||||||
option(BUILD_ESMTOOL "build ESM inspector" ON)
|
option(BUILD_ESMTOOL "build ESM inspector" ON)
|
||||||
option(BUILD_LAUNCHER "build Launcher" ON)
|
option(BUILD_LAUNCHER "build Launcher" ON)
|
||||||
option(BUILD_MWINIIMPORTER "build MWiniImporter" ON)
|
option(BUILD_MWINIIMPORTER "build MWiniImporter" ON)
|
||||||
|
option(BUILD_OPENCS "build OpenMW Construction Set" ON)
|
||||||
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
||||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest ang GMock frameworks" OFF)
|
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest ang GMock frameworks" OFF)
|
||||||
|
|
||||||
@ -244,7 +245,7 @@ if (APPLE)
|
|||||||
else ()
|
else ()
|
||||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG})
|
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
#set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/")
|
#set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/")
|
||||||
|
|
||||||
configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist
|
configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist
|
||||||
@ -462,6 +463,10 @@ if (BUILD_MWINIIMPORTER)
|
|||||||
add_subdirectory( apps/mwiniimporter )
|
add_subdirectory( apps/mwiniimporter )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_OPENCS)
|
||||||
|
add_subdirectory (apps/opencs)
|
||||||
|
endif()
|
||||||
|
|
||||||
# UnitTests
|
# UnitTests
|
||||||
if (BUILD_UNITTESTS)
|
if (BUILD_UNITTESTS)
|
||||||
add_subdirectory( apps/openmw_test_suite )
|
add_subdirectory( apps/openmw_test_suite )
|
||||||
|
44
apps/opencs/CMakeLists.txt
Normal file
44
apps/opencs/CMakeLists.txt
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
set (OPENCS_SRC
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
model/doc/documentmanager.cpp model/doc/document.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set (OPENCS_HDR
|
||||||
|
model/doc/documentmanager.hpp model/doc/document.hpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set (OPENCS_US
|
||||||
|
)
|
||||||
|
|
||||||
|
set (OPENCS_RES
|
||||||
|
)
|
||||||
|
|
||||||
|
source_group (opencs FILES ${OPENCS_SRC} ${OPENCS_HDR})
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(QT_USE_QTMAIN TRUE)
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
find_package(Qt4 COMPONENTS QtCore QtGui QtXml QtXmlPatterns REQUIRED)
|
||||||
|
include(${QT_USE_FILE})
|
||||||
|
|
||||||
|
qt4_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI})
|
||||||
|
qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR})
|
||||||
|
qt4_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
add_executable(opencs
|
||||||
|
${OPENCS_SRC}
|
||||||
|
${OPENCS_UI_HDR}
|
||||||
|
${OPENCS_MOC_SRC}
|
||||||
|
${OPENCS_RES_SRC}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(opencs
|
||||||
|
${Boost_LIBRARIES}
|
||||||
|
${QT_LIBRARIES}
|
||||||
|
components
|
||||||
|
)
|
5
apps/opencs/main.cpp
Normal file
5
apps/opencs/main.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
4
apps/opencs/model/doc/document.cpp
Normal file
4
apps/opencs/model/doc/document.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
#include "document.hpp"
|
||||||
|
|
||||||
|
CSMDoc::Document::Document() {}
|
17
apps/opencs/model/doc/document.hpp
Normal file
17
apps/opencs/model/doc/document.hpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef CSM_DOCUMENT_H
|
||||||
|
#define CSM_DOCUMENT_H
|
||||||
|
|
||||||
|
namespace CSMDoc
|
||||||
|
{
|
||||||
|
class Document
|
||||||
|
{
|
||||||
|
Document (const Document&);
|
||||||
|
Document& operator= (const Document&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Document();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
37
apps/opencs/model/doc/documentmanager.cpp
Normal file
37
apps/opencs/model/doc/documentmanager.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
#include "documentmanager.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "document.hpp"
|
||||||
|
|
||||||
|
CSMDoc::DocumentManager::DocumentManager() {}
|
||||||
|
|
||||||
|
CSMDoc::DocumentManager::~DocumentManager()
|
||||||
|
{
|
||||||
|
for (std::vector<Document *>::iterator iter (mDocuments.begin()); iter!=mDocuments.end(); ++iter)
|
||||||
|
delete *iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSMDoc::Document *CSMDoc::DocumentManager::addDocument()
|
||||||
|
{
|
||||||
|
Document *document = new Document;
|
||||||
|
|
||||||
|
mDocuments.push_back (document);
|
||||||
|
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSMDoc::DocumentManager::removeDocument (Document *document)
|
||||||
|
{
|
||||||
|
std::vector<Document *>::iterator iter = std::find (mDocuments.begin(), mDocuments.end(), document);
|
||||||
|
|
||||||
|
if (iter==mDocuments.end())
|
||||||
|
throw std::runtime_error ("removing invalid document");
|
||||||
|
|
||||||
|
mDocuments.erase (iter);
|
||||||
|
delete document;
|
||||||
|
|
||||||
|
return mDocuments.empty();
|
||||||
|
}
|
31
apps/opencs/model/doc/documentmanager.hpp
Normal file
31
apps/opencs/model/doc/documentmanager.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef CSM_DOCUMENTMGR_H
|
||||||
|
#define CSM_DOCUMENTMGR_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace CSMDoc
|
||||||
|
{
|
||||||
|
class Document;
|
||||||
|
|
||||||
|
class DocumentManager
|
||||||
|
{
|
||||||
|
std::vector<Document *> mDocuments;
|
||||||
|
|
||||||
|
DocumentManager (const DocumentManager&);
|
||||||
|
DocumentManager& operator= (const DocumentManager&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DocumentManager();
|
||||||
|
|
||||||
|
~DocumentManager();
|
||||||
|
|
||||||
|
Document *addDocument();
|
||||||
|
///< The ownership of the returned document is not transferred to the caller.
|
||||||
|
|
||||||
|
bool removeDocument (Document *document);
|
||||||
|
///< \return last document removed?
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user