]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 9 Mar 2017 21:17:07 +0000 (16:17 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 9 Mar 2017 21:17:07 +0000 (16:17 -0500)
12 files changed:
CMakeLists.txt
applis/CMakeLists.txt [new file with mode: 0644]
applis/PipelineEditor/PipelineEditor.cxx [new file with mode: 0644]
applis/PipelineEditor/PipelineEditor.h [new file with mode: 0644]
applis/PipelineEditor/PipelineEditor.ui [new file with mode: 0644]
cmake/Functions.cmake
cmake/Options.cmake
cmake/QtTools.cmake
libs/CMakeLists.txt [new file with mode: 0644]
libs/cpPipelineEditor/Canvas.cxx [new file with mode: 0644]
libs/cpPipelineEditor/Canvas.h [new file with mode: 0644]
libs/cpPipelineEditor/MainHelper.h [new file with mode: 0644]

index d584f6e8ba961be5af0d887443142a28eba79432..0f910161de4a1f986dfbe405235adcd1e9751dfa 100644 (file)
@@ -5,11 +5,15 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
 ## ========================
 
 SET(prj_NAME cpPlugins)
-SET(prj_MAJ_VERSION 0)
-SET(prj_MIN_VERSION 1)
+SET(prj_MAJ_VERSION 1)
+SET(prj_MIN_VERSION 0)
 SET(prj_REL_VERSION 0)
-SET(_subdirs cmake bash lib tools plugins appli)
 SET(_policies CMP0015 CMP0020 CMP0042)
+SET(
+  _subdirs
+  applis
+  libs
+  )
 
 ## ==========================
 ## == Some useful policies ==
@@ -35,8 +39,8 @@ SET(prj_SHORT_VERSION "${prj_MAJ_VERSION}")
 
 INCLUDE(cmake/BaseConfig.cmake)
 INCLUDE(cmake/Options.cmake)
-INCLUDE(cmake/KitwareTools.cmake)
 INCLUDE(cmake/QtTools.cmake)
+#INCLUDE(cmake/KitwareTools.cmake)
 INCLUDE(cmake/Functions.cmake)
 
 ## ===========================
diff --git a/applis/CMakeLists.txt b/applis/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e434293
--- /dev/null
@@ -0,0 +1,22 @@
+## ========================
+## == Build applications ==
+## ========================
+
+SET(
+  _apps
+  PipelineEditor
+  )
+
+OPTION(BUILD_APPLICATIONS "Build applications." OFF)
+IF(BUILD_APPLICATIONS AND Qt4_FOUND)
+  INCLUDE_DIRECTORIES(
+    ${PROJECT_SOURCE_DIR}/libs
+    ${PROJECT_BINARY_DIR}/libs
+    )
+  FOREACH(_app ${_apps})
+    cpPlugins_BuildApplicationFromDirectory(${_app} ${_app})
+    TARGET_LINK_LIBRARIES(${_app} cpPipelineEditor)
+  ENDFOREACH(_app)
+ENDIF(BUILD_APPLICATIONS AND Qt4_FOUND)
+
+## eof - $RCSfile$
diff --git a/applis/PipelineEditor/PipelineEditor.cxx b/applis/PipelineEditor/PipelineEditor.cxx
new file mode 100644 (file)
index 0000000..4acc6dc
--- /dev/null
@@ -0,0 +1,25 @@
+#include "PipelineEditor.h"
+#include "ui_PipelineEditor.h"
+
+// -------------------------------------------------------------------------
+PipelineEditor::
+PipelineEditor( int argc, char* argv[], QWidget* parent )
+  : Superclass( parent ),
+    m_UI( new Ui::PipelineEditor )
+{
+  this->m_UI->setupUi( this );
+}
+
+// -------------------------------------------------------------------------
+PipelineEditor::
+~PipelineEditor( )
+{
+  delete this->m_UI;
+}
+
+// -------------------------------------------------------------------------
+#include <cpPipelineEditor/MainHelper.h>
+cpPipelineEditor_Main( PipelineEditor );
+cpPipelineEditor_MainComplement;
+
+// eof - $RCSfile$
diff --git a/applis/PipelineEditor/PipelineEditor.h b/applis/PipelineEditor/PipelineEditor.h
new file mode 100644 (file)
index 0000000..fc0ae2d
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef __cpPlugins__applis__PipelineEditor__h__
+#define __cpPlugins__applis__PipelineEditor__h__
+
+#include <QMainWindow>
+
+namespace Ui { class PipelineEditor; }
+
+/**
+ */
+class PipelineEditor
+  : public QMainWindow
+{
+  Q_OBJECT;
+public:
+  typedef PipelineEditor Self;
+  typedef QMainWindow    Superclass;
+
+public:
+  explicit PipelineEditor(
+    int argc, char* argv[],
+    QWidget* parent = NULL
+    );
+  virtual ~PipelineEditor( );
+
+private:
+  Ui::PipelineEditor* m_UI;
+};
+
+#endif // __cpPlugins__applis__PipelineEditor__h__
+
+// eof - $RCSfile$
diff --git a/applis/PipelineEditor/PipelineEditor.ui b/applis/PipelineEditor/PipelineEditor.ui
new file mode 100644 (file)
index 0000000..3709dba
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PipelineEditor</class>
+ <widget class="QMainWindow" name="PipelineEditor">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget"/>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="actionExit"/>
+   </widget>
+   <addaction name="menuFile"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionExit">
+   <property name="text">
+    <string>E&amp;xit</string>
+   </property>
+  </action>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>actionExit</sender>
+   <signal>triggered()</signal>
+   <receiver>PipelineEditor</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>299</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index d7555872cda546b799c5ee0a9e418b3bb48252a4..f1ab6ce1ac5f33a297b6ff46213a8129d77f59fe 100644 (file)
@@ -1,52 +1,36 @@
 ## -------------------------------------------------------------------------
-FUNCTION(NormPaths output_files)
-SET(_out)
+FUNCTION(cpPlugins_GetFiles output)
+SET(_o)
 FOREACH(_f ${ARGN})
-  SET(_d)
-  FILE(TO_CMAKE_PATH ${_f} _d)
-  LIST(APPEND _out ${_d})
+  FILE(GLOB_RECURSE _r "${_f}")
+  LIST(APPEND _o ${_r})
 ENDFOREACH(_f)
-SET(${output_files} "${_out}" PARENT_SCOPE)
+SET(${output} "${_o}" PARENT_SCOPE)
 ENDFUNCTION()
-
 ## -------------------------------------------------------------------------
-FUNCTION(Wrap_Qt_CPP output_files)
-SET(_out)
-FOREACH(_f ${ARGN})
-  IF(EXISTS ${_f})
-    FILE(READ ${_f} _txt)
-    STRING(FIND "${_txt}" "Q_OBJECT" _pos)
-    IF(NOT ${_pos} EQUAL -1)
-      SET(_s)
-      QT4_WRAP_CPP(_s ${_f})
-      SET(_out ${_out} ${_s})
-    ENDIF(NOT ${_pos} EQUAL -1)
-  ENDIF(EXISTS ${_f})
-ENDFOREACH(_f)
-SET(${output_files} "${_out}" PARENT_SCOPE)
-ENDFUNCTION()
 
 ## -------------------------------------------------------------------------
 FUNCTION(Wrap_Qt_UI output_files)
-NormPaths(_source_dir ${PROJECT_SOURCE_DIR})
-NormPaths(_binary_dir ${PROJECT_BINARY_DIR})
+GET_FILENAME_COMPONENT(_src ${PROJECT_SOURCE_DIR} ABSOLUTE)
+GET_FILENAME_COMPONENT(_bin ${PROJECT_BINARY_DIR} ABSOLUTE)
 SET(_out)
 FOREACH(_f ${ARGN})
   IF(EXISTS ${_f})
     GET_FILENAME_COMPONENT(_name ${_f} NAME_WE)
     GET_FILENAME_COMPONENT(_dir ${_f} DIRECTORY)
-    SET(_base_dir ${_source_dir})
+    SET(_base_dir ${_src})
     STRING(FIND "${_dir}" "${_base_dir}" _pos)
     IF(${_pos} EQUAL -1)
-      SET(_base_dir ${_binary_dir})
+      SET(_base_dir ${_bin})
       STRING(FIND "${_dir}" "${_base_dir}" _pos)
     ENDIF(${_pos} EQUAL -1)
     IF(NOT ${_pos} EQUAL -1)
       STRING(REPLACE "${_base_dir}/" "" _dir ${_dir})
-      SET(_out_f ${_binary_dir}/${_dir}/ui_${_name}.h)
+      SET(_out_f ${_bin}/${_dir}/ui_${_name}.h)
       LIST(APPEND _out ${_out_f})
       ADD_CUSTOM_COMMAND(
         OUTPUT ${_out_f}
+        COMMAND ${CMAKE_COMMAND} -E make_directory ${_bin}/${_dir}
         COMMAND Qt4::uic
         ARGS -o ${_out_f} ${_f}
         MAIN_DEPENDENCY ${_f} VERBATIM
@@ -56,273 +40,127 @@ FOREACH(_f ${ARGN})
 ENDFOREACH(_f)
 SET(${output_files} "${_out}" PARENT_SCOPE)
 ENDFUNCTION()
-
 ## -------------------------------------------------------------------------
-FUNCTION(
-  PrepareSourceFiles
-  lib_name
-  out_sources_list
-  out_headers_list
-  out_headers_paths
-  )
-SET(_config_extensions .c.in .cpp.in .cxx.in .h.in .hpp.in .hxx.in .ui.in)
-SET(_sources_extensions .c .cpp .cxx)
-SET(_headers_extensions .h .hpp .hxx)
-SET(_qt_ui_extensions .ui)
-SET(_demangler_extensions .d)
-SET(_instances_extensions .i)
 
-## -- Configure inputs
-SET(_all_files)
-FOREACH(_file ${ARGN})
-  GET_FILENAME_COMPONENT(_ext ${_file} EXT)
-  LIST(FIND _config_extensions ${_ext} _cfg)
-  IF(NOT ${_cfg} EQUAL -1)
-    STRING(
-      REPLACE
-      ${PROJECT_SOURCE_DIR}
-      ${PROJECT_BINARY_DIR}
-      _file_bin
-      ${_file}
-      )
-    STRING(LENGTH ${_file_bin} _file_bin_len)
-    MATH(EXPR _file_bin_len "${_file_bin_len}-3")
-    STRING(SUBSTRING ${_file_bin} 0 ${_file_bin_len} _file_bin)
-    CONFIGURE_FILE(${_file} ${_file_bin} @ONLY)
-    LIST(APPEND _all_files ${_file_bin})
-  ELSE(NOT ${_cfg} EQUAL -1)
-    LIST(APPEND _all_files ${_file})
-  ENDIF(NOT ${_cfg} EQUAL -1)
-ENDFOREACH(_file)
+## -------------------------------------------------------------------------
+FUNCTION(cpPlugins_PrepareFiles out_src out_hdr out_dirs)
 
-## -- Separate files
-SET(_srcs)
-SET(_hdrs)
-SET(_qts)
-SET(_demanglers)
-SET(_instances)
-FOREACH(_file ${_all_files})
-  GET_FILENAME_COMPONENT(_ext ${_file} EXT)
-  LIST(FIND _sources_extensions ${_ext} _src)
-  LIST(FIND _headers_extensions ${_ext} _hdr)
-  LIST(FIND _qt_ui_extensions ${_ext} _ui)
-  LIST(FIND _demangler_extensions ${_ext} _dem)
-  LIST(FIND _instances_extensions ${_ext} _ins)
-  IF(NOT ${_src} EQUAL -1)
-    LIST(APPEND _srcs ${_file})
-  ENDIF(NOT ${_src} EQUAL -1)
-  IF(NOT ${_hdr} EQUAL -1)
-    LIST(APPEND _hdrs ${_file})
-  ENDIF(NOT ${_hdr} EQUAL -1)
-  IF(NOT ${_ui} EQUAL -1)
-    LIST(APPEND _qts ${_file})
-  ENDIF(NOT ${_ui} EQUAL -1)
-  IF(NOT ${_dem} EQUAL -1)
-    LIST(APPEND _demanglers ${_file})
-  ENDIF(NOT ${_dem} EQUAL -1)
-  IF(NOT ${_ins} EQUAL -1)
-    LIST(APPEND _instances ${_file})
-  ENDIF(NOT ${_ins} EQUAL -1)
-ENDFOREACH(_file)
+## -- Separe files by extension
+SET(_src)
+SET(_hdr)
+SET(_ui)
+SET(_dirs)
+FOREACH(_f ${ARGN})
+  GET_FILENAME_COMPONENT(_file ${_f} ABSOLUTE)
+  GET_FILENAME_COMPONENT(_e ${_file} EXT)
+  STRING(TOLOWER ${_e} _ext)
+  STRING(COMPARE EQUAL "${_ext}" ".c" _cmp_c)
+  STRING(COMPARE EQUAL "${_ext}" ".cpp" _cmp_cpp)
+  STRING(COMPARE EQUAL "${_ext}" ".cxx" _cmp_cxx)
+  STRING(COMPARE EQUAL "${_ext}" ".h" _cmp_h)
+  STRING(COMPARE EQUAL "${_ext}" ".hpp" _cmp_hpp)
+  STRING(COMPARE EQUAL "${_ext}" ".hxx" _cmp_hxx)
+  STRING(COMPARE EQUAL "${_ext}" ".ui" _cmp_ui)
+  IF(_cmp_c OR _cmp_cpp OR _cmp_cxx)
+    LIST(APPEND _src ${_file})
+  ENDIF(_cmp_c OR _cmp_cpp OR _cmp_cxx)
+  IF(_cmp_h OR _cmp_hpp OR _cmp_hxx)
+    LIST(APPEND _hdr ${_file})
+    GET_FILENAME_COMPONENT(_d ${_file} DIRECTORY)
+    LIST(APPEND _dirs ${_d})
+  ENDIF(_cmp_h OR _cmp_hpp OR _cmp_hxx)
+  IF(_cmp_ui)
+    LIST(APPEND _ui ${_file})
+  ENDIF(_cmp_ui)
+ENDFOREACH(_f)
 
-# -- Prepare Qt4-based code
+## -- Wrap possible Qt code
 IF(Qt4_FOUND)
-  ## -- Guess what headers sould be qt-moc'ed
-  Wrap_Qt_CPP(_moc ${_hdrs})
-  IF(_moc)
-    LIST(APPEND _srcs ${_moc})
-  ENDIF(_moc)
 
-  ## -- Guess what qt-ui's sould be qt-uic'ed
-  ## -- Wrap qt-ui headers: this is equivalent to QT4_WRAP_UI except to change
-  ## -- the output file
-  Wrap_Qt_UI(_qt_hdrs ${_qts})
-  IF(_qt_hdrs)
-    LIST(APPEND _hdrs ${_qt_hdrs})
-  ENDIF(_qt_hdrs)
+  ## -- Wrap user interfaces
+  Wrap_Qt_UI(_qt_ui_hdr ${_ui})
+  FOREACH(_h ${_qt_ui_hdr})
+    LIST(APPEND _hdr ${_h})
+    GET_FILENAME_COMPONENT(_d ${_h} DIRECTORY)
+    LIST(APPEND _dirs ${_d})
+  ENDFOREACH(_h)
+
+  ## -- Wrap headers
+  SET(_qt_src)
+  FOREACH(_f ${_hdr} ${_src})
+    IF(EXISTS ${_f})
+      FILE(READ ${_f} _txt)
+      STRING(FIND "${_txt}" "Q_OBJECT" _pos)
+      IF(NOT ${_pos} EQUAL -1)
+        SET(_s)
+        QT4_WRAP_CPP(_s ${_f})
+        LIST(APPEND _qt_src ${_s})
+      ENDIF(NOT ${_pos} EQUAL -1)
+    ENDIF(EXISTS ${_f})
+  ENDFOREACH(_f ${_hdr} ${_src})
+  LIST(APPEND _src ${_qt_src})
 ENDIF(Qt4_FOUND)
 
-## -- Create demanglers
-FOREACH(_d ${_demanglers})
-  STRING(
-    REPLACE
-    ${PROJECT_SOURCE_DIR}
-    ${PROJECT_BINARY_DIR}
-    _d_bin
-    ${_d}
-    )
-  GET_FILENAME_COMPONENT(_d_path ${_d_bin} DIRECTORY)
-  GET_FILENAME_COMPONENT(_out_name ${_d_bin} NAME_WE)
-  SET(_d_out ${_d_path}/${_out_name}_Demanglers.h)
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_d_out}
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${_d_path}
-    COMMAND ${cpPlugins_bash_CreateDemanglers_APP} ${_d} ${_out_name} ${_d_out}
-    DEPENDS ${cpPlugins_bash_CreateDemanglers_APP} ${_d}
-    )
-  LIST(APPEND _hdrs ${_d_out})
-ENDFOREACH(_d)
-
-## -- Create instances
-FOREACH(_i ${_instances})
-  STRING(
-    REPLACE
-    ${PROJECT_SOURCE_DIR}
-    ${PROJECT_BINARY_DIR}
-    _i_bin
-    ${_i}
-    )
-  GET_FILENAME_COMPONENT(_i_path ${_i_bin} DIRECTORY)
-  GET_FILENAME_COMPONENT(_out_name ${_i} NAME_WE)
-
-  ## -- Infere source code filenames
-  MATH(EXPR _last_range "${cpPlugins_NUMBER_OF_FILES}-1")
-  SET(_out_code)
-  FOREACH(_n RANGE 0 ${_last_range})
-    LIST(APPEND _out_code ${_i_path}/${_out_name}_${_n}.cxx)
-    LIST(APPEND _srcs ${_i_path}/${_out_name}_${_n}.cxx)
-  ENDFOREACH(_n)
-
-  ## -- Command to write source code
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_out_code}
-    DEPENDS ${cpPlugins_bash_CreateInstances_APP} ${_i}
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${_i_path}
-    COMMAND ${cpPlugins_bash_CreateInstances_APP} ${_i} ${lib_name} ${_i_path}/${_out_name}
-    )
-ENDFOREACH(_i)
-
-## -- Real compilation
-SET(_hdrs_paths)
-FOREACH(_hdr ${_hdrs})
-  GET_FILENAME_COMPONENT(_path ${_hdr} DIRECTORY)
-  LIST(FIND _hdrs_paths ${_path} _path_idx)
-  IF(${_path_idx} EQUAL -1)
-    LIST(APPEND _hdrs_paths ${_path})
-  ENDIF(${_path_idx} EQUAL -1)
-ENDFOREACH(_hdr)
-
-SET(${out_sources_list} ${_srcs} PARENT_SCOPE)
-SET(${out_headers_list} ${_hdrs} PARENT_SCOPE)
-SET(${out_headers_paths} ${_hdrs_paths} PARENT_SCOPE)
+## -- Outputs
+SET(${out_src} "${_src}" PARENT_SCOPE)
+SET(${out_hdr} "${_hdr}" PARENT_SCOPE)
+SET(${out_dirs} "${_dirs}" PARENT_SCOPE)
 
 ENDFUNCTION()
+## -------------------------------------------------------------------------
 
 ## -------------------------------------------------------------------------
 FUNCTION(cpPlugins_BuildLibrary lib_name lib_type)
-# -- Detect all source files
-SET(_all_files)
-FOREACH(_c ${ARGN})
-  GET_FILENAME_COMPONENT(_cname ${_c} ABSOLUTE)
-  SET(_files)
-  IF(IS_DIRECTORY ${_cname})
-    FILE(GLOB_RECURSE _files "${_cname}/*")
-  ELSE(IS_DIRECTORY ${_cname})
-    SET(_files ${_cname})
-  ENDIF(IS_DIRECTORY ${_cname})
-  LIST(APPEND _all_files ${_files})
-ENDFOREACH(_c ${ARGN})
-
-## -- Prepare sources by types
-PrepareSourceFiles(${lib_name} _srcs _hdrs _paths ${_all_files})
 
-## -- Build library
-IF(_srcs)
-  INCLUDE_DIRECTORIES(
-    ${CMAKE_CURRENT_SOURCE_DIR}
-    ${CMAKE_CURRENT_BINARY_DIR}
-    )
-  ADD_LIBRARY(${lib_name} ${lib_type} ${_srcs} ${_hdrs})
-  GENERATE_EXPORT_HEADER(
-    ${lib_name}
-    BASE_NAME ${lib_name}
-    EXPORT_MACRO_NAME ${lib_name}_EXPORT
-    EXPORT_FILE_NAME ${lib_name}_Export.h
-    STATIC_DEFINE ${lib_name}_BUILT_AS_STATIC
-    )
-ENDIF(_srcs)
+## -- Prepare files
+cpPlugins_PrepareFiles(_src _hdr _dirs ${ARGN})
+
+## -- Create library
+ADD_LIBRARY(${lib_name} ${lib_type} ${_src} ${_hdr})
+GENERATE_EXPORT_HEADER(
+  ${lib_name}
+  BASE_NAME ${lib_name}
+  EXPORT_MACRO_NAME ${lib_name}_EXPORT
+  EXPORT_FILE_NAME ${lib_name}_Export.h
+  STATIC_DEFINE ${lib_name}_BUILT_AS_STATIC
+  )
 
 ENDFUNCTION()
-
 ## -------------------------------------------------------------------------
-FUNCTION(cpPlugins_BuildPluginsLibrary lib_name)
-# -- Detect all source files
-SET(_all_files)
-FOREACH(_c ${ARGN})
-  GET_FILENAME_COMPONENT(_cname ${_c} ABSOLUTE)
-  SET(_files)
-  IF(IS_DIRECTORY ${_cname})
-    FILE(GLOB_RECURSE _files "${_cname}/*")
-  ELSE(IS_DIRECTORY ${_cname})
-    SET(_files ${_cname})
-  ENDIF(IS_DIRECTORY ${_cname})
-  LIST(APPEND _all_files ${_files})
-ENDFOREACH(_c ${ARGN})
 
-## -- Prepare sources by types
-PrepareSourceFiles(${lib_name} _srcs _hdrs _paths ${_all_files})
+## -------------------------------------------------------------------------
+FUNCTION(cpPlugins_BuildLibraryFromDirectory lib_name lib_type lib_dir)
+INCLUDE_DIRECTORIES(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}
+  )
+cpPlugins_GetFiles(_files "${lib_dir}/*")
+cpPlugins_BuildLibrary(${lib_name} ${lib_type} ${_files} ${ARGN})
+ENDFUNCTION()
+## -------------------------------------------------------------------------
 
-## -- Check which headers need to be wrapped to build host code
-SET(_hdrs_to_wrap)
-FOREACH(_hdr ${_hdrs})
-  IF(EXISTS ${_hdr})
-    FILE(READ ${_hdr} _txt)
-    STRING(FIND "${_txt}" "cpPluginsObject" _res)
-    IF(NOT ${_res} EQUAL -1)
-      LIST(APPEND _hdrs_to_wrap ${_hdr})
-    ENDIF(NOT ${_res} EQUAL -1)
-  ENDIF(EXISTS ${_hdr})
-ENDFOREACH(_hdr)
+## -------------------------------------------------------------------------
+FUNCTION(cpPlugins_BuildApplicationFromDirectory app_name app_dir)
 
-## -- Wrap headers
-IF(_hdrs_to_wrap)
-  SET(_host ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_host.cxx)
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_host}
-    DEPENDS ${cpPlugins_bash_HostCreator_APP} ${_hdrs_to_wrap}
-    COMMAND ${cpPlugins_bash_HostCreator_APP} ${lib_name} ${_host} ${_hdrs_to_wrap}
-    )
-  LIST(APPEND _all_files ${_host})
-ENDIF(_hdrs_to_wrap)
+## -- Prepare files
+cpPlugins_GetFiles(_files "${app_dir}/*")
+cpPlugins_PrepareFiles(_src _hdr _dirs ${_files})
 
-cpPlugins_BuildLibrary(${lib_name} SHARED ${_all_files})
-ENDFUNCTION()
+## -- Guess compilation source
+SET(_app_os_target)
+IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  SET(_app_os_target WIN32)
+ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+  SET(_app_os_target MACOSX_BUNDLE)
+ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
 
-## -------------------------------------------------------------------------
-FUNCTION(cpPlugins_BuildApplication app_name)
-OPTION(BUILD_${app_name} "Build \"${app_name}\" application?" OFF)
-IF(BUILD_${app_name})
-  # -- Detect all source files
-  SET(_all_files)
-  FOREACH(_c ${ARGN})
-    GET_FILENAME_COMPONENT(_cname ${_c} ABSOLUTE)
-    SET(_files)
-    IF(IS_DIRECTORY ${_cname})
-      FILE(GLOB_RECURSE _files "${_cname}/*")
-    ELSE(IS_DIRECTORY ${_cname})
-      SET(_files ${_cname})
-    ENDIF(IS_DIRECTORY ${_cname})
-    LIST(APPEND _all_files ${_files})
-  ENDFOREACH(_c ${ARGN})
+## -- Include directories
+INCLUDE_DIRECTORIES(${_dirs})
 
-  ## -- Prepare sources by types
-  PrepareSourceFiles(${app_name} _srcs _hdrs _paths ${_all_files})
+## -- Compile application
+ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_src} ${_hdr})
 
-  ## -- Build library
-  IF(_srcs)
-    INCLUDE_DIRECTORIES(
-      ${CMAKE_CURRENT_SOURCE_DIR}
-      ${CMAKE_CURRENT_BINARY_DIR}
-      )
-    SET(_app_os_target)
-    IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-      SET(_app_os_target WIN32)
-      ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
-      SET(_app_os_target MACOSX_BUNDLE)
-    ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-    ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_srcs} ${_hdrs})
-  ENDIF(_srcs)
-ENDIF(BUILD_${app_name})
 ENDFUNCTION()
+## -------------------------------------------------------------------------
 
 ## eof - $RCSfile$
index 6800c630ed176b7ff660e9002f13475a447a6949..f2cc2423471ae88154adbf6f8d4d32af022f6697 100644 (file)
@@ -2,24 +2,4 @@
 ## == Some configurable options ==
 ## ===============================
 
-SET(cpPlugins_NUMBER_OF_FILES "10" CACHE STRING "Number of compiled files.")
-SET(cpPlugins_PROCESS_DIMS "1;2;3" CACHE STRING "Accepted processing dimensions.")
-SET(cpPlugins_VISUAL_DIMS "2;3" CACHE STRING "Accepted visual dimensions.")
-
-OPTION(BUILD_EXAMPLES "Build examples" OFF)
-OPTION(BUILD_QT4_COMPONENTS "Build Qt4-based code" OFF)
-
-SET(
-  _all_configs
-  cpPlugins_PROCESS_DIMS
-  cpPlugins_VISUAL_DIMS
-  )
-SET(_real_configs)
-FOREACH(_cfg ${_all_configs})
-  FOREACH(_type ${${_cfg}})
-    LIST(APPEND _real_configs "${_cfg}_${_type}")
-  ENDFOREACH(_type)
-ENDFOREACH(_cfg)
-SET(cpPlugins_ALL_CONFIGS "${_real_configs}" CACHE INTERNAL "All valid configurations." FORCE)
-
 ## eof - $RCSfile$
index f4dd0cd8d20e1e7fef2bdbda5dd3f61e936f3170..47a3dd44f420be5ab94276bf35c6ffcc0ba69739 100644 (file)
@@ -2,25 +2,26 @@
 ## == Find Qt4 and check if it was well configured ==
 ## ==================================================
 
+OPTION(BUILD_QT4_COMPONENTS "Build Qt4-based code" OFF)
 IF(BUILD_QT4_COMPONENTS)
   FIND_PACKAGE(Qt4 REQUIRED)
   INCLUDE(${QT_USE_FILE})
-  SET(
-    _modules
-    vtkGUISupportQt
-    )
-  FOREACH(_m ${_modules})
-    IF(NOT ${_m}_LOADED)
-      MESSAGE(FATAL_ERROR "${_m} module is required but not available.")
-      BREAK()
-    ENDIF(NOT ${_m}_LOADED)
-  ENDFOREACH(_m)
-  SET(
-    cpPlugins_Qt4_VTKWidget
-    QVTKWidget
-    CACHE STRING "Base Qt4-based vtkRenderWindow"
-    )
-  MARK_AS_ADVANCED(CLEAR cpPlugins_Qt4_VTKWidget)
+  #  SET(
+  #    _modules
+  #    vtkGUISupportQt
+  #    )
+  #  FOREACH(_m ${_modules})
+  #    IF(NOT ${_m}_LOADED)
+  #      MESSAGE(FATAL_ERROR "${_m} module is required but not available.")
+  #      BREAK()
+  #    ENDIF(NOT ${_m}_LOADED)
+  #  ENDFOREACH(_m)
+  #  SET(
+  #    cpPlugins_Qt4_VTKWidget
+  #    QVTKWidget
+  #    CACHE STRING "Base Qt4-based vtkRenderWindow"
+  #    )
+  #  MARK_AS_ADVANCED(CLEAR cpPlugins_Qt4_VTKWidget)
 ENDIF(BUILD_QT4_COMPONENTS)
 
 ## eof - $RCSfile$
diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f73c9b5
--- /dev/null
@@ -0,0 +1,11 @@
+
+## ==============================
+## == Compile Qt-based widgets ==
+## ==============================
+
+IF(Qt4_FOUND)
+  cpPlugins_BuildLibraryFromDirectory(cpPipelineEditor SHARED cpPipelineEditor)
+  TARGET_LINK_LIBRARIES(cpPipelineEditor ${QT_LIBRARIES})
+ENDIF(Qt4_FOUND)
+
+## eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/Canvas.cxx b/libs/cpPipelineEditor/Canvas.cxx
new file mode 100644 (file)
index 0000000..7ee861f
--- /dev/null
@@ -0,0 +1,20 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#include <cpPipelineEditor/Canvas.h>
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Canvas::
+Canvas( QWidget* parent )
+  : Superclass( parent )
+{
+}
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Canvas::
+~Canvas( )
+{
+}
+
+// eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/Canvas.h b/libs/cpPipelineEditor/Canvas.h
new file mode 100644 (file)
index 0000000..ec6c5f7
--- /dev/null
@@ -0,0 +1,33 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __cpPipelineEditor__Canvas__h__
+#define __cpPipelineEditor__Canvas__h__
+
+#include <cpPipelineEditor_Export.h>
+#include <QGraphicsView>
+
+namespace cpPipelineEditor
+{
+  /**
+   */
+  class Canvas
+    : QGraphicsView
+  {
+    Q_OBJECT;
+
+  public:
+    typedef Canvas        Self;
+    typedef QGraphicsView Superclass;
+
+  public:
+    Canvas( QWidget* parent = NULL );
+    virtual ~Canvas( );
+  };
+
+} // ecapseman
+
+#endif // __cpPipelineEditor__Canvas__h__
+
+// eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/MainHelper.h b/libs/cpPipelineEditor/MainHelper.h
new file mode 100644 (file)
index 0000000..dd748d5
--- /dev/null
@@ -0,0 +1,89 @@
+#ifndef __cpPipelineEditor__MainHelper__h__
+#define __cpPipelineEditor__MainHelper__h__
+
+#include <cstdlib>
+#include <QApplication>
+
+// -------------------------------------------------------------------------
+#define cpPipelineEditor_Main( _window_class_ )                 \
+  int main( int argc, char* argv[] )                            \
+  {                                                             \
+    QApplication a( argc, argv );                               \
+    _window_class_ w( argc, argv );                             \
+    w.show( );                                                  \
+    return( a.exec( ) );                                        \
+  }
+
+// -------------------------------------------------------------------------
+
+#ifdef _WIN32
+
+#  include <memory>
+#  include <vector>
+#  include <windows.h>
+#  include <shellapi.h>
+
+// -------------------------------------------------------------------------
+namespace cpPipelineEditor
+{
+  /**
+   */
+  class Win32CommandLineConverter
+  {
+  private:
+    std::unique_ptr< char*[ ] > argv_;
+    std::vector< std::unique_ptr< char[ ] > > storage_;
+
+  public:
+    Win32CommandLineConverter( )
+      {
+        LPWSTR cmd_line = GetCommandLineW( );
+        int argc;
+        LPWSTR* w_argv = CommandLineToArgvW( cmd_line, &argc );
+        argv_ = std::unique_ptr< char*[ ] >( new char*[ argc ] );
+        storage_.reserve( argc );
+        for( int i = 0; i < argc; ++i )
+        {
+          storage_.push_back( ConvertWArg( w_argv[ i ] ) );
+          argv_[ i ] = storage_.back( ).get( );
+
+        } // rof
+        LocalFree( w_argv );
+      }
+    int argc( ) const
+      {
+        return( static_cast< int >(storage_.size( ) ) );
+      }
+    char** argv( ) const
+      {
+        return( argv_.get( ) );
+      }
+    static std::unique_ptr< char[ ] > ConvertWArg( LPWSTR w_arg )
+      {
+        int size = WideCharToMultiByte(
+          CP_UTF8, 0, w_arg, -1, nullptr, 0, nullptr, nullptr
+          );
+        std::unique_ptr< char[ ] > ret( new char[ size ] );
+        WideCharToMultiByte(
+          CP_UTF8, 0, w_arg, -1, ret.get( ), size, nullptr, nullptr
+          );
+        return( ret );
+      }
+  };
+
+} // ecapseman
+
+// -------------------------------------------------------------------------
+#  define cpPipelineEditor_MainComplement                               \
+  int CALLBACK WinMain( HINSTANCE i, HINSTANCE p, LPSTR c, int s )      \
+  {                                                                     \
+    cpPipelineEditor::Win32CommandLineConverter cmd_line;               \
+    return( main( cmd_line.argc( ), cmd_line.argv( ) ) );               \
+  }
+#else  // _WIN32
+#  define cpPipelineEditor_MainComplement
+#endif // _WIN32
+
+#endif // __cpPipelineEditor__MainHelper__h__
+
+// eof - $RCSfile$