diff --git a/module/lua_juce_core/maths/Range.cpp b/module/lua_juce_core/maths/Range.cpp index f72db94..c21c42c 100644 --- a/module/lua_juce_core/maths/Range.cpp +++ b/module/lua_juce_core/maths/Range.cpp @@ -1,16 +1,12 @@ namespace lua_juce { + template auto juce_RangeImpl(sol::table& state, char const* name) -> void { - // clang-format off - auto range = state.new_usertype>(name, - sol::constructors(), juce::Range(T, T)>(), - "start", - sol::property(&juce::Range::getStart, &juce::Range::setStart), - "end", - sol::property(&juce::Range::getEnd, &juce::Range::setEnd) - ); - // clang-format on + auto range = state.new_usertype>(name, sol::constructors(), juce::Range(T, T)>()); + + range["getStart"] = LUA_JUCE_C_CALL(&juce::Range::getStart); + range["getEnd"] = LUA_JUCE_C_CALL(&juce::Range::getEnd); } auto juce_Range(sol::table& state) -> void diff --git a/tool/jml-docgen/README.md b/tool/jml-docgen/README.md index c309fe9..138de0c 100644 --- a/tool/jml-docgen/README.md +++ b/tool/jml-docgen/README.md @@ -16,10 +16,13 @@ - [MemoryBlock](#MemoryBlock) - [MemoryInputStream](#MemoryInputStream) - [MemoryOutputStream](#MemoryOutputStream) + - [NormalisableRange](#NormalisableRange) - [OutputStream](#OutputStream) - [Random](#Random) + - [Range](#Range) - [RelativeTime](#RelativeTime) - [Result](#Result) + - [StatisticsAccumulator](#StatisticsAccumulator) - [String](#String) - [StringArray](#StringArray) - [Time](#Time) @@ -39,7 +42,10 @@ - [Font](#Font) - [Graphics](#Graphics) - [Image](#Image) + - [Line](#Line) - [Path](#Path) + - [Point](#Point) + - [Rectangle](#Rectangle) - [juce_gui_basics](#juce_gui_basics) - [ArrowButton](#ArrowButton) - [Button](#Button) @@ -528,6 +534,23 @@ juce.MemoryOutputStream.toString(...) juce.MemoryOutputStream.toUTF8(...) ``` +## NormalisableRange + +```lua +juce.NormalisableRange.__eq(...) +juce.NormalisableRange.convertFrom0to1(...) +juce.NormalisableRange.convertTo0to1(...) +juce.NormalisableRange.end(...) +juce.NormalisableRange.getRange(...) +juce.NormalisableRange.interval(...) +juce.NormalisableRange.new(...) +juce.NormalisableRange.setSkewForCentre(...) +juce.NormalisableRange.skew(...) +juce.NormalisableRange.snapToLegalValue(...) +juce.NormalisableRange.start(...) +juce.NormalisableRange.symmetricSkew(...) +``` + ## OutputStream ```lua @@ -573,6 +596,15 @@ juce.Random.nextInt64(...) juce.Random.setSeed(...) ``` +## Range + +```lua +juce.Range.__eq(...) +juce.Range.getEnd(...) +juce.Range.getStart(...) +juce.Range.new(...) +``` + ## RelativeTime ```lua @@ -607,6 +639,19 @@ juce.Result.ok(...) juce.Result.wasOk(...) ``` +## StatisticsAccumulator + +```lua +juce.StatisticsAccumulator.__eq(...) +juce.StatisticsAccumulator.getAverage(...) +juce.StatisticsAccumulator.getCount(...) +juce.StatisticsAccumulator.getMaxValue(...) +juce.StatisticsAccumulator.getMinValue(...) +juce.StatisticsAccumulator.getStandardDeviation(...) +juce.StatisticsAccumulator.getVariance(...) +juce.StatisticsAccumulator.new(...) +``` + ## String ```lua @@ -1086,6 +1131,13 @@ juce.Image.rescaled(...) juce.Image.setPixelAt(...) ``` +## Line + +```lua +juce.Line.__eq(...) +juce.Line.new(...) +``` + ## Path ```lua @@ -1126,6 +1178,122 @@ juce.Path.toString(...) juce.Path.writePathToStream(...) ``` +## Point + +```lua +juce.Point.__eq(...) +juce.Point.__tostring(...) +juce.Point.addXY(...) +juce.Point.applyTransform(...) +juce.Point.getAngleToPoint(...) +juce.Point.getDistanceFrom(...) +juce.Point.getDistanceFromOrigin(...) +juce.Point.getDistanceSquaredFrom(...) +juce.Point.getDistanceSquaredFromOrigin(...) +juce.Point.getX(...) +juce.Point.getY(...) +juce.Point.isFinite(...) +juce.Point.isOrigin(...) +juce.Point.new(...) +juce.Point.roundToInt(...) +juce.Point.setX(...) +juce.Point.setXY(...) +juce.Point.setY(...) +juce.Point.toDouble(...) +juce.Point.toFloat(...) +juce.Point.toInt(...) +juce.Point.toString(...) +juce.Point.transformedBy(...) +juce.Point.translated(...) +juce.Point.withX(...) +juce.Point.withY(...) +``` + +## Rectangle + +```lua +juce.Rectangle.__eq(...) +juce.Rectangle.__tostring(...) +juce.Rectangle.constrainedWithin(...) +juce.Rectangle.enlargeIfAdjacent(...) +juce.Rectangle.expand(...) +juce.Rectangle.findAreaContainingPoints(...) +juce.Rectangle.fromString(...) +juce.Rectangle.getAspectRatio(...) +juce.Rectangle.getBottom(...) +juce.Rectangle.getBottomLeft(...) +juce.Rectangle.getBottomRight(...) +juce.Rectangle.getCentre(...) +juce.Rectangle.getCentreX(...) +juce.Rectangle.getCentreY(...) +juce.Rectangle.getConstrainedPoint(...) +juce.Rectangle.getHeight(...) +juce.Rectangle.getHorizontalRange(...) +juce.Rectangle.getIntersection(...) +juce.Rectangle.getPosition(...) +juce.Rectangle.getRelativePoint(...) +juce.Rectangle.getRight(...) +juce.Rectangle.getSmallestIntegerContainer(...) +juce.Rectangle.getTopLeft(...) +juce.Rectangle.getTopRight(...) +juce.Rectangle.getUnion(...) +juce.Rectangle.getVerticalRange(...) +juce.Rectangle.getWidth(...) +juce.Rectangle.getX(...) +juce.Rectangle.getY(...) +juce.Rectangle.isEmpty(...) +juce.Rectangle.isFinite(...) +juce.Rectangle.leftTopRightBottom(...) +juce.Rectangle.new(...) +juce.Rectangle.proportionOfHeight(...) +juce.Rectangle.proportionOfWidth(...) +juce.Rectangle.reduce(...) +juce.Rectangle.reduceIfPartlyContainedIn(...) +juce.Rectangle.reduced(...) +juce.Rectangle.removeFromBottom(...) +juce.Rectangle.removeFromLeft(...) +juce.Rectangle.removeFromRight(...) +juce.Rectangle.removeFromTop(...) +juce.Rectangle.setBottom(...) +juce.Rectangle.setBounds(...) +juce.Rectangle.setHeight(...) +juce.Rectangle.setHorizontalRange(...) +juce.Rectangle.setLeft(...) +juce.Rectangle.setRight(...) +juce.Rectangle.setSize(...) +juce.Rectangle.setTop(...) +juce.Rectangle.setVerticalRange(...) +juce.Rectangle.setWidth(...) +juce.Rectangle.setX(...) +juce.Rectangle.setY(...) +juce.Rectangle.toDouble(...) +juce.Rectangle.toFloat(...) +juce.Rectangle.toNearestInt(...) +juce.Rectangle.toNearestIntEdges(...) +juce.Rectangle.toString(...) +juce.Rectangle.transformedBy(...) +juce.Rectangle.translate(...) +juce.Rectangle.translated(...) +juce.Rectangle.withBottom(...) +juce.Rectangle.withBottomY(...) +juce.Rectangle.withCentre(...) +juce.Rectangle.withHeight(...) +juce.Rectangle.withLeft(...) +juce.Rectangle.withRight(...) +juce.Rectangle.withRightX(...) +juce.Rectangle.withSize(...) +juce.Rectangle.withSizeKeepingCentre(...) +juce.Rectangle.withTop(...) +juce.Rectangle.withTrimmedBottom(...) +juce.Rectangle.withTrimmedLeft(...) +juce.Rectangle.withTrimmedRight(...) +juce.Rectangle.withTrimmedTop(...) +juce.Rectangle.withWidth(...) +juce.Rectangle.withX(...) +juce.Rectangle.withY(...) +juce.Rectangle.withZeroOrigin(...) +``` + ## juce_gui_basics ## ArrowButton diff --git a/tool/jml-docgen/doxygen.lua b/tool/jml-docgen/doxygen.lua index 052230a..002c006 100644 --- a/tool/jml-docgen/doxygen.lua +++ b/tool/jml-docgen/doxygen.lua @@ -18,6 +18,9 @@ end local function select_xml_file(entity) entity = entity:gsub('_', '__') entity = entity:gsub('%.', '_1_1') + entity = entity:gsub('', '') + entity = entity:gsub('', '') + entity = entity:gsub('', '') local juce_root = "~/Developer/tobiashienzsch/JUCE" local xml = string.format("%s/docs/doxygen/xml", juce_root) diff --git a/tool/jml-docgen/main.lua b/tool/jml-docgen/main.lua index 507168b..a89f3ce 100644 --- a/tool/jml-docgen/main.lua +++ b/tool/jml-docgen/main.lua @@ -35,6 +35,7 @@ end local function write_usertype_as_lua_stubs(dir, modules) local docs, _ = sol2.parse_juce_types(modules) + for module_name, juce_module in pairs(docs) do for class_name, class in pairs(juce_module[2]) do local doxygen_spec = doxygen.parse_xml(class_name) @@ -43,7 +44,7 @@ local function write_usertype_as_lua_stubs(dir, modules) end -- Create lua file - local path = string.format("%s/%s.lua", dir, class_name, ".lua") + local path = string.format("%s/%s.lua", dir, class_name) local file = io.open(path, "w") if file == nil then print("error:", class_name) @@ -139,6 +140,31 @@ local function write_usertype_as_lua_stubs(dir, modules) file:close() end end + + -- --- Represents a colour, also including a transparency value. + -- -- @module juce + + -- --- Constant colors + -- -- @table Colours + -- -- @field black HTML black + -- Colours = { + -- black = "" + -- } + + local colours = io.open(string.format("%s/Colours.lua", dir), "w") + colours:write("--- JUCE framework\n") + colours:write("-- @module juce\n\n") + colours:write("--- Contains a set of predefined named colours\n") + colours:write("-- @table Colours\n") + for k, v in pairs(juce.Colours) do + colours:write(string.format("-- @field %s 0x%s\n", k, v)) + end + colours:write("Colours = {\n") + for k, v in pairs(juce.Colours) do + colours:write(string.format("\t%-20s = 0x%s\n", k, v)) + end + colours:write("}\n\n") + end local function write_usertype_as_markdown(file, modules) @@ -182,17 +208,18 @@ end local classes = { juce_core = { + -- juce.Array_double.new(), juce.BigInteger.new(), juce.File.new(), juce.abstract.InputStream, juce.abstract.MemoryInputStream, juce.IPAddress.new(), juce.MemoryBlock.new(), - -- juce.NormalisableRange_double.new(), + juce.NormalisableRange_double.new(), juce.Random.new(), - -- juce.Range_double.new(0.0, 1.0), + juce.Range_double.new(0.0, 1.0), juce.Result.ok(), - -- juce.StatisticsAccumulatorDouble.new(), + juce.StatisticsAccumulator.new(), juce.abstract.OutputStream, juce.abstract.MemoryOutputStream, juce.String.new(), @@ -220,7 +247,10 @@ local classes = { juce.Font.new(12.0), juce.Image.new(), juce.Graphics.new(juce.Image.new()), + juce.Line_double.new(), + juce.Point_double.new(), juce.Path.new(), + juce.Rectangle_double.new(), }, juce_gui_basics = { juce.abstract.Button, diff --git a/tool/jml-docgen/sol2.lua b/tool/jml-docgen/sol2.lua index 84c076c..9169335 100644 --- a/tool/jml-docgen/sol2.lua +++ b/tool/jml-docgen/sol2.lua @@ -34,6 +34,9 @@ local function parse_usertype(obj) doc.name = doc.name:gsub("*", "") doc.name = doc.name:gsub("&", "") doc.name = doc.name:gsub("::", ".") + doc.name = doc.name:gsub('', '') + doc.name = doc.name:gsub('', '') + doc.name = doc.name:gsub('', '') assert(doc.name ~= nil) for key, value in pairs(meta) do @@ -95,4 +98,5 @@ local function test() end test() + return sol2