# HG changeset patch
# User Eldar Insafutdinov
# Date 1278796593 -3600
# Node ID a795eeb3b21f23b93448857dccb24a5ec8e609d4
# Parent 7341c47790d4f4d1fc033ada5bedd078734d3e9f# Parent 8f7d09e4efc0217923564273698a443cef729e27
example minor change
diff -r 8f7d09e4efc0 -r a795eeb3b21f CMakeLists.txt
--- a/CMakeLists.txt Fri Jul 09 22:54:51 2010 +0600
+++ b/CMakeLists.txt Sat Jul 10 22:16:33 2010 +0100
@@ -51,7 +51,7 @@
set(GENERATE_DI_FILES OFF) ## Very experimental option. Temporarily disabled.
option(VERBOSE_DEBUG "Verbose debug" "OFF")
-set(all_packages Core Gui OpenGL Xml Svg Network WebKit CACHE INTERNAL "")
+set(all_packages Core Gui OpenGL Xml Svg Network WebKit Qwt CACHE INTERNAL "")
## Init D toolkit.
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
@@ -93,12 +93,30 @@
foreach(package_big ${all_packages})
string(TOLOWER ${package_big} package)
string(TOUPPER ${package_big} package_upper)
- option(BUILD_QT_${package_upper} "Build Qt${package_big}" "ON")
+ set(package_default_option "ON")
+ if(${package_big} STREQUAL "Qwt")
+ set(package_default_option "OFF")
+ endif()
+ option(BUILD_QT_${package_upper} "Build Qt${package_big}" ${package_default_option})
if(BUILD_QT_${package_upper})
set(packages ${packages} ${package_big})
endif()
endforeach()
+set(QWT_INCLUDE_PATH "/usr/include/qwt-qt4" CACHE STRING "Qwt include path")
+
+set(inc_paths "")
+
+if(CMAKE_HOST_WIN32)
+ set(sep ";")
+else()
+ set(sep ":")
+endif()
+
+if(BUILD_QT_QWT)
+ set(inc_paths ${inc_paths}${sep}${QWT_INCLUDE_PATH})
+endif()
+
add_subdirectory(generator)
add_custom_target(main ALL)
@@ -151,6 +169,9 @@
math(EXPR QTD_VERSION "(${QT_VERSION_MAJOR} << 16) + (${QT_VERSION_MINOR} << 8) + ${QT_VERSION_PATCH}")
include_directories(${QT_INCLUDES} ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include)
+if(${BUILD_QT_QWT})
+ include_directories(${QWT_INCLUDE_PATH})
+endif()
# System specifc settings.
if(CMAKE_HOST_WIN32)
@@ -342,30 +363,30 @@
set(all_req_found 1)
if(BUILD_QT_${package_upper})
- foreach(req ${required})
- set(req_found)
- foreach(pack ${packages_big})
- if(${pack} STREQUAL ${req})
- set(req_found 1)
- endif()
- endforeach(pack ${packages})
- if(NOT req_found)
+ foreach(req ${required})
set(req_found)
- foreach(pack ${all_packages})
- if(${pack} STREQUAL ${req})
- set(req_found 1)
- endif(${pack} STREQUAL ${req})
- endforeach(pack ${all_packages})
- if(req_found)
- message(STATUS "Package '${package_big}' requires '${req}', but it is not active")
- else()
- message(STATUS "Package '${package_big}' requires '${req}', but it is not found")
+ foreach(pack ${packages_big})
+ if(${pack} STREQUAL ${req})
+ set(req_found 1)
endif()
- set(all_req_found)
- endif()
- endforeach(req ${required})
+ endforeach(pack ${packages})
+ if(NOT req_found)
+ set(req_found)
+ foreach(pack ${all_packages})
+ if(${pack} STREQUAL ${req})
+ set(req_found 1)
+ endif(${pack} STREQUAL ${req})
+ endforeach(pack ${all_packages})
+ if(req_found)
+ message(STATUS "Package '${package_big}' requires '${req}', but it is not active")
+ else()
+ message(STATUS "Package '${package_big}' requires '${req}', but it is not found")
+ endif()
+ set(all_req_found)
+ endif()
+ endforeach(req ${required})
else(BUILD_QT_${package_upper})
- set(all_req_found)
+ set(all_req_found)
endif(BUILD_QT_${package_upper})
if("${all_req_found}" EQUAL 1)
diff -r 8f7d09e4efc0 -r a795eeb3b21f build/qwt.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/build/qwt.txt Sat Jul 10 22:16:33 2010 +0100
@@ -0,0 +1,23 @@
+set(required Core Gui)
+
+set(classes
+ QwtPlot
+ QwtPlotDict
+ QwtPlotItem
+ QwtLegendItemManager
+ QwtText
+ QwtLegend
+ QwtScaleMap
+ QwtScaleWidget
+ QwtScaleTransformation
+ QwtTextLabel
+ QwtScaleDraw
+ QwtAbstractScaleDraw
+ QwtPlotCanvas
+ QwtPlotMarker
+ QwtPlotCurve
+ QwtData
+ QwtPolygonFData
+ QwtArrayData
+ QwtCPointerData
+ )
diff -r 8f7d09e4efc0 -r a795eeb3b21f examples/qwt/simpleplot/build.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/qwt/simpleplot/build.sh Sat Jul 10 22:16:33 2010 +0100
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+dmd simple.d -L-lqtdqwt -L-lqtdgui -L-lqtdcore -L-lcpp_qwt -L-lcpp_core -L-lcpp_gui -L-lqwt-qt4 -L-lQtGui -L-lQtCore -ofsimple
diff -r 8f7d09e4efc0 -r a795eeb3b21f examples/qwt/simpleplot/simple.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/qwt/simpleplot/simple.d Sat Jul 10 22:16:33 2010 +0100
@@ -0,0 +1,131 @@
+module simple;
+
+import std.math;
+
+import qt.gui.QApplication;
+import qt.qwt.QwtPlot;
+import qt.qwt.QwtPlotMarker;
+import qt.qwt.QwtPlotCurve;
+import qt.qwt.QwtLegend;
+import qt.qwt.QwtData;
+import qt.qwt.QwtText;
+
+//-----------------------------------------------------------------
+// simple.d
+//
+// A simple example which shows how to use QwtPlot and QwtData
+//-----------------------------------------------------------------
+
+real mysin(real arg)
+{
+ return sin(arg);
+}
+
+real mycos(real arg)
+{
+ return cos(arg);
+}
+
+alias real function(real) double_func;
+
+class SimpleData: QwtData
+{
+ // The x values depend on its index and the y values
+ // can be calculated from the corresponding x value.
+ // So we don't need to store the values.
+ // Such an implementation is slower because every point
+ // has to be recalculated for every replot, but it demonstrates how
+ // QwtData can be used.
+
+public:
+ this(const double_func y, size_t size)
+ {
+ d_size = size;
+ d_y = y;
+ }
+
+ QwtData copy() const
+ {
+ return new SimpleData(d_y, d_size);
+ }
+
+ size_t size() const
+ {
+ return d_size;
+ }
+
+ double x(size_t i) const
+ {
+ return 0.1 * i;
+ }
+
+ double y(size_t i) const
+ {
+ return d_y(x(i));
+ }
+private:
+ size_t d_size;
+ const double_func d_y;
+};
+
+class Plot : QwtPlot
+{
+public:
+ this()
+ {
+ super(cast(QWidget)null);
+ setTitle("A Simple QwtPlot Demonstration");
+ insertLegend(new QwtLegend(cast(QWidget)null), QwtPlot.RightLegend);
+
+ // Set axis titles
+ setAxisTitle(xBottom, "x -->");
+ setAxisTitle(yLeft, "y -->");
+
+ // Insert new curves
+ auto cSin = new QwtPlotCurve("y = sin(x)");
+ cSin.setRenderHint(QwtPlotItem.RenderAntialiased);
+ cSin.setPen(new QPen(new QColor(Qt.red)));
+ cSin.attach(this);
+
+ auto cCos = new QwtPlotCurve("y = cos(x)");
+ cCos.setRenderHint(QwtPlotItem.RenderAntialiased);
+ cCos.setPen(new QPen(new QColor(Qt.blue)));
+ cCos.attach(this);
+
+ // Create sin and cos data
+ const int nPoints = 100;
+ cSin.setData(new SimpleData(&mysin, nPoints));
+ cCos.setData(new SimpleData(&mycos, nPoints));
+
+ // Insert markers
+
+ // ...a horizontal line at y = 0...
+ auto mY = new QwtPlotMarker();
+ mY.setLabel(new QwtText("y = 0"));
+ mY.setLabelAlignment(Qt.AlignRight | Qt.AlignTop);
+ mY.setLineStyle(QwtPlotMarker.HLine);
+ mY.setYValue(0.0);
+ mY.attach(this);
+
+ // ...a vertical line at x = 2 * pi
+ auto mX = new QwtPlotMarker();
+ mX.setLabel(new QwtText("x = 2 pi"));
+ mX.setLabelAlignment(Qt.AlignLeft | Qt.AlignBottom);
+ mX.setLabelOrientation(Qt.Vertical);
+ mX.setLineStyle(QwtPlotMarker.VLine);
+ mX.setLinePen(new QPen(new QBrush(Qt.black), 0, Qt.DashDotLine));
+ mX.setXValue(2.0 * PI);
+ mX.attach(this);
+ }
+
+};
+
+int main(string[] args)
+{
+ auto a = new QApplication(args);
+
+ scope plot = new Plot;
+ plot.resize(600,400);
+ plot.show();
+ return a.exec();
+}
diff -r 8f7d09e4efc0 -r a795eeb3b21f generator/CMakeLists.txt
--- a/generator/CMakeLists.txt Fri Jul 09 22:54:51 2010 +0600
+++ b/generator/CMakeLists.txt Sat Jul 10 22:16:33 2010 +0100
@@ -140,7 +140,7 @@
)
## Includes path.
-set(inc_paths
+set(inc_paths_for_build
${CMAKE_CURRENT_SOURCE_DIR}/../common
${CMAKE_CURRENT_SOURCE_DIR}/parser
${CMAKE_CURRENT_SOURCE_DIR}
@@ -158,8 +158,8 @@
include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR})
-set(inc_paths
- ${inc_paths}
+set(inc_paths_for_build
+ ${inc_paths_for_build}
${QT_INCLUDES}
)
set(lib_paths
@@ -176,7 +176,7 @@
set (all_srcs
${srcs} ${moc_srcs}
${res_wrapped_files})
-include_directories(${inc_paths})
+include_directories(${inc_paths_for_build})
add_executable(generator ${all_srcs} )
target_link_libraries(generator ${libs})
@@ -201,17 +201,23 @@
file(REMOVE ${jambi_inc})
file(APPEND ${dgen_build_conf} "\n")
foreach(package_normal ${packages})
- string(TOLOWER ${package_normal} package)
- string(TOUPPER ${package_normal} package_upper)
- file(APPEND ${dgen_build_conf} " \n")
- file(APPEND ${jambi_inc} "#include <${QT_QT${package_upper}_INCLUDE_DIR}/Qt${package_normal}>\n")
- endforeach(package_normal ${packages})
+ string(TOLOWER ${package_normal} package)
+ string(TOUPPER ${package_normal} package_upper)
+ file(APPEND ${dgen_build_conf} " \n")
+ # only append include if we have QT_QT${MODULE}_INCLUDE_DIR defined, otherwise handle customly
+ if(NOT ${QT_QT${package_upper}_INCLUDE_DIR} STREQUAL "")
+ file(APPEND ${jambi_inc} "#include <${QT_QT${package_upper}_INCLUDE_DIR}/Qt${package_normal}>\n")
+ endif()
+ endforeach()
file(APPEND ${dgen_build_conf} "\n")
set(packages_in_build_txt ${packages} CACHE INTERNAL "")
-endif( NOT "${packages_in_build_txt}" STREQUAL "${packages}"
- OR NOT EXISTS ${dgen_build_conf}
- OR NOT EXISTS ${jambi_inc})
-
+ # merge include file for Qwt
+ if(BUILD_QT_QWT)
+ file(READ "${CMAKE_SOURCE_DIR}/include/qwt_masterinclude.h" jambi_inc_qwt)
+ file(APPEND ${jambi_inc} ${jambi_inc_qwt})
+ endif()
+endif()
+
set(gen_sources)
foreach(package_normal ${packages})
string(TOLOWER ${package_normal} package)
@@ -219,25 +225,22 @@
set(d_inc_file_found d_inc_file_found-NOTFOUND)
find_file(d_inc_file_found typesystem_${package}-java.java PATHS ${CMAKE_CURRENT_SOURCE_DIR}/)
if(d_inc_file_found)
- set(gen_sources ${gen_sources} ${d_inc_file_found})
- endif(d_inc_file_found)
-endforeach(package_normal ${packages})
+ set(gen_sources ${gen_sources} ${d_inc_file_found})
+ endif()
+endforeach()
mark_as_advanced(d_inc_file_found)
set(d_inc_file_found 1)
-if(CMAKE_HOST_WIN32)
- set(sep ";")
-else(CMAKE_HOST_WIN32)
- set(sep ":")
-endif(CMAKE_HOST_WIN32)
foreach(path ${QT_INCLUDES})
- set(inc_paths ${path}${sep})
-endforeach(path ${QT_INCLUDES})
+ set(inc_paths_tmp ${path}${sep})
+endforeach()
+set(inc_paths ${inc_paths}${sep}${inc_paths_tmp})
+
if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
set(out_dir ${CMAKE_SOURCE_DIR})
-else(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
+else()
set(out_dir ${CMAKE_BINARY_DIR}/build)
-endif(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
+endif()
set(dgen_impl ${out_dir}/cpp/qt_core/ArrayOps_shell.cpp)
add_custom_command(OUTPUT ${dgen_impl}
COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl}
diff -r 8f7d09e4efc0 -r a795eeb3b21f generator/abstractmetalang.cpp
--- a/generator/abstractmetalang.cpp Fri Jul 09 22:54:51 2010 +0600
+++ b/generator/abstractmetalang.cpp Sat Jul 10 22:16:33 2010 +0100
@@ -2048,15 +2048,16 @@
return;
m_instance = new ArgumentReplace();
- m_instance->data["version"] = "_version";
- m_instance->data["parent"] = "_parent";
- m_instance->data["delegate"] = "_delegate";
- m_instance->data["align"] = "_align";
- m_instance->data["in"] = "_in";
- m_instance->data["out"] = "_out";
- m_instance->data["scope"] = "_scope";
- m_instance->data["default"] = "_default";
- m_instance->data["body"] = "_body";
+ m_instance->data["version"] = "version_";
+ m_instance->data["parent"] = "parent_";
+ m_instance->data["delegate"] = "delegate_";
+ m_instance->data["align"] = "align_";
+ m_instance->data["in"] = "in_";
+ m_instance->data["out"] = "out_";
+ m_instance->data["scope"] = "scope_";
+ m_instance->data["default"] = "default_";
+ m_instance->data["body"] = "body_";
+ m_instance->data["ref"] = "ref_";
}
QString ArgumentReplace::translate(QString arg)
diff -r 8f7d09e4efc0 -r a795eeb3b21f generator/cppimplgenerator.cpp
--- a/generator/cppimplgenerator.cpp Fri Jul 09 22:54:51 2010 +0600
+++ b/generator/cppimplgenerator.cpp Sat Jul 10 22:16:33 2010 +0100
@@ -3164,6 +3164,8 @@
} else {
// qtd s << fromObject(java_type->typeEntry(),
// qtd (java_type->isReference() ? "&" : "") + qt_name) << endl;
+ if (java_type->isReference())
+ s << "&";
s << qt_name << ";" << endl;
}
}
diff -r 8f7d09e4efc0 -r a795eeb3b21f generator/dgenerator.cpp
--- a/generator/dgenerator.cpp Fri Jul 09 22:54:51 2010 +0600
+++ b/generator/dgenerator.cpp Sat Jul 10 22:16:33 2010 +0100
@@ -71,7 +71,7 @@
<< "signed short" << "Array" << "GLuint" << "GLenum" << "GLint"
<< "unsigned long" << "ulong" << "long" << "QByteRef"
<< "QStringList" << "QVector" << "QPair"
- << "QSet" << "QStringRef" << "quintptr";
+ << "QSet" << "QStringRef" << "quintptr" << "size_t";
}
QString DGenerator::fileNameForClass(const AbstractMetaClass *d_class) const
diff -r 8f7d09e4efc0 -r a795eeb3b21f generator/typesystem_core.xml
--- a/generator/typesystem_core.xml Fri Jul 09 22:54:51 2010 +0600
+++ b/generator/typesystem_core.xml Sat Jul 10 22:16:33 2010 +0100
@@ -111,6 +111,8 @@
+
+
diff -r 8f7d09e4efc0 -r a795eeb3b21f generator/typesystem_qwt.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/generator/typesystem_qwt.xml Sat Jul 10 22:16:33 2010 +0100
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 8f7d09e4efc0 -r a795eeb3b21f include/qtd_core.h
--- a/include/qtd_core.h Fri Jul 09 22:54:51 2010 +0600
+++ b/include/qtd_core.h Sat Jul 10 22:16:33 2010 +0100
@@ -84,6 +84,12 @@
#define QTD_WEBKIT_DLL_PUBLIC QTD_DLL_IMPORT
#endif
+#ifdef QTD_QWT
+ #define QTD_QWT_DLL_PUBLIC QTD_DLL_EXPORT
+#else
+ #define QTD_QWT_DLL_PUBLIC QTD_DLL_IMPORT
+#endif
+
//TODO: ditch
struct QModelIndexAccessor {
int row;
diff -r 8f7d09e4efc0 -r a795eeb3b21f include/qwt_masterinclude.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/qwt_masterinclude.h Sat Jul 10 22:16:33 2010 +0100
@@ -0,0 +1,70 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+