v0.8.4
This commit is contained in:
parent
f28cbcc016
commit
ad70b68564
10 changed files with 57 additions and 13 deletions
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017 StefanSalewski
|
Copyright (c) 2017, 2018, 2019, 2020, 2021 StefanSalewski
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
||||||
11
README.adoc
11
README.adoc
|
|
@ -25,11 +25,12 @@ with code inserted from files directly.
|
||||||
NOTE: This work is partly based on earlier works of J. Mansour and has been supported by A. Rumpf, E. Bassi and other _Nim_ and _GTK/Gnome_ developers.
|
NOTE: This work is partly based on earlier works of J. Mansour and has been supported by A. Rumpf, E. Bassi and other _Nim_ and _GTK/Gnome_ developers.
|
||||||
The `combinatorics` module was kindly provided by R. Behrends.
|
The `combinatorics` module was kindly provided by R. Behrends.
|
||||||
|
|
||||||
NOTE: We are currently preparing gintro v0.8.4.
|
NOTE: This is version 0.8.4 of the gintro Nim GTK bindings. We do support the
|
||||||
You may install it with command [black yellow-background]#nimble install gintro@#head#.
|
libnice module now for Linux and Windows. And we added gtksourceview5 to
|
||||||
We now try to support optional var out parameters, see https://github.com/StefanSalewski/gintro/issues/102
|
support gtksourceview usage for GTK4. The module is called gtksourceview5
|
||||||
and tried to fix https://github.com/StefanSalewski/gintro/issues/99. And GtkGestures should work now, thanks
|
because the underlying C library has mayor version 5 already. So you can
|
||||||
to some hints of Mr. Bassi, see https://discourse.gnome.org/t/gtk4-gtkgesture-and-ref-count/4809.
|
write your own GTK4 Nim editor now. Additional optional var out parameters
|
||||||
|
are supported now and GtkGestures should work also.
|
||||||
|
|
||||||
NOTE: The version gintro v0.8.3 will have some internal cleanup, which removes the temporary
|
NOTE: The version gintro v0.8.3 will have some internal cleanup, which removes the temporary
|
||||||
Array types. In the past we used that names to indicate array parameters, it was working well, but still
|
Array types. In the past we used that names to indicate array parameters, it was working well, but still
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
## This test program was kindly provided by Mr. Tomohiro, see
|
||||||
|
## https://github.com/StefanSalewski/gintro/issues/99
|
||||||
|
|
||||||
# nim c libnice_simple_test.nim
|
# nim c libnice_simple_test.nim
|
||||||
#
|
#
|
||||||
# Test code for libnice.
|
# Test code for libnice.
|
||||||
|
|
@ -98,7 +101,7 @@ proc cbNiceRecv(agent: nice.Agent; streamID: cuint; componentID: cuint; len: cui
|
||||||
|
|
||||||
proc main =
|
proc main =
|
||||||
gio.networkingInit()
|
gio.networkingInit()
|
||||||
|
|
||||||
gloop = newMainLoop(nil, false)
|
gloop = newMainLoop(nil, false)
|
||||||
|
|
||||||
lagent = nice.newAgent(glib.getContext(gloop), nice.CompatibilityRfc5245)
|
lagent = nice.newAgent(glib.getContext(gloop), nice.CompatibilityRfc5245)
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ nim c gsettings.nim
|
||||||
nim c gstBasicTutorial1.nim
|
nim c gstBasicTutorial1.nim
|
||||||
nim c handy.nim
|
nim c handy.nim
|
||||||
nim c label.nim
|
nim c label.nim
|
||||||
|
nim c libnice_simple_test.nim
|
||||||
nim c listview.nim
|
nim c listview.nim
|
||||||
nim c menubar.nim
|
nim c menubar.nim
|
||||||
nim c overlay_tree1.nim
|
nim c overlay_tree1.nim
|
||||||
nim c simpledrawingarea.nim
|
nim c simpledrawingarea.nim
|
||||||
|
nim c simple_example.nim
|
||||||
nim c spinbutton.nim
|
nim c spinbutton.nim
|
||||||
nim c sourceview_test.nim
|
nim c sourceview_test.nim
|
||||||
nim c t0.nim
|
nim c t0.nim
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ nim c --gc:arc gsettings.nim
|
||||||
nim c --gc:arc gstBasicTutorial1.nim
|
nim c --gc:arc gstBasicTutorial1.nim
|
||||||
nim c --gc:arc handy.nim
|
nim c --gc:arc handy.nim
|
||||||
nim c --gc:arc label.nim
|
nim c --gc:arc label.nim
|
||||||
|
nim c --gc:arc libnice_simple_test.nim
|
||||||
nim c --gc:arc listview.nim
|
nim c --gc:arc listview.nim
|
||||||
nim c --gc:arc menubar.nim
|
nim c --gc:arc menubar.nim
|
||||||
nim c --gc:arc overlay_tree1.nim
|
nim c --gc:arc overlay_tree1.nim
|
||||||
nim c --gc:arc simpledrawingarea.nim
|
nim c --gc:arc simpledrawingarea.nim
|
||||||
|
nim c --gc:arc simple_example.nim
|
||||||
nim c --gc:arc spinbutton.nim
|
nim c --gc:arc spinbutton.nim
|
||||||
nim c --gc:arc sourceview_test.nim
|
nim c --gc:arc sourceview_test.nim
|
||||||
nim c --gc:arc t0.nim
|
nim c --gc:arc t0.nim
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
# ./sdp-example 0 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
# ./sdp-example 0 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
||||||
# ./sdp-example 1 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
# ./sdp-example 1 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
||||||
|
|
||||||
|
## This is a legacy Nim libnice example. Deprecated, we may remove it, or improve the code...
|
||||||
|
|
||||||
# https://forum.nim-lang.org/t/3752
|
# https://forum.nim-lang.org/t/3752
|
||||||
when (compiles do: import gintro/gtk):
|
when (compiles do: import gintro/gtk):
|
||||||
import gintro/[gtk, glib, gobject, gio, nice]
|
import gintro/[gtk, glib, gobject, gio, nice]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,15 @@
|
||||||
## simple-example 0 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
## simple-example 0 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
||||||
## simple-example 1 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
## simple-example 1 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
|
||||||
##
|
##
|
||||||
|
## this code contains the fixes of Mr. Tomohiro for Windows OS, see https://github.com/StefanSalewski/gintro/issues/99
|
||||||
|
|
||||||
|
## The construct "when (compiles do: import ..." is fragile -- we let it in for now
|
||||||
|
## to support windows OS without a full gtk version available.
|
||||||
|
## Of course we could use dummygtk always and avoid that construct.
|
||||||
|
## We may improse the situation later somehow...
|
||||||
|
# https://github.com/nim-lang/Nim/issues/16287
|
||||||
# https://forum.nim-lang.org/t/3752
|
# https://forum.nim-lang.org/t/3752
|
||||||
|
#
|
||||||
when (compiles do: import gintro/gtk):
|
when (compiles do: import gintro/gtk):
|
||||||
import gintro/[gtk, glib, gobject, gio, nice]
|
import gintro/[gtk, glib, gobject, gio, nice]
|
||||||
else:
|
else:
|
||||||
|
|
@ -190,7 +197,7 @@ proc cbCandidateGatheringDone(agent: nice.Agent; streamId: int) =
|
||||||
echo("")
|
echo("")
|
||||||
## Listen on stdin for the remote candidate list
|
## Listen on stdin for the remote candidate list
|
||||||
echo("Enter remote data (single line, no wrapping):")
|
echo("Enter remote data (single line, no wrapping):")
|
||||||
discard addWatch(ioStdin, glib.PRIORITY_DEFAULT, {IOCFlag.`in`} , stdinRemoteInfoCb, agent)
|
discard addWatch(ioStdin, glib.PRIORITY_DEFAULT, {IOCFlag.`in`}, stdinRemoteInfoCb, agent)
|
||||||
stdout.write("> ")
|
stdout.write("> ")
|
||||||
flushFile(stdout)
|
flushFile(stdout)
|
||||||
|
|
||||||
|
|
@ -223,7 +230,7 @@ proc cbComponentStateChanged(agent: nice.Agent; streamId: int; componentId: int;
|
||||||
echo(" [$1]:$2)" % [$ipaddr, $getPort(remote.impl.`addr`)])
|
echo(" [$1]:$2)" % [$ipaddr, $getPort(remote.impl.`addr`)])
|
||||||
## Listen to stdin and send data written to it
|
## Listen to stdin and send data written to it
|
||||||
echo("\nSend lines to remote (Ctrl-D to quit):")
|
echo("\nSend lines to remote (Ctrl-D to quit):")
|
||||||
discard addWatch(ioStdin, glib.PRIORITY_DEFAULT, {IOCFlag.`in`} , stdinSendDataCb, agent)
|
discard addWatch(ioStdin, glib.PRIORITY_DEFAULT, {IOCFlag.`in`}, stdinSendDataCb, agent)
|
||||||
stdout.write("> ")
|
stdout.write("> ")
|
||||||
flushFile(stdout)
|
flushFile(stdout)
|
||||||
elif state == ComponentState.failed.ord:
|
elif state == ComponentState.failed.ord:
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ proc prepareWindowForOrientation(orientation: gtk.Orientation) =
|
||||||
discard connect(window, "delete_event", onDeleteEvent)
|
discard connect(window, "delete_event", onDeleteEvent)
|
||||||
let mainbox = gtk.newBox(if orientation == gtk.Orientation.horizontal: Orientation.vertical else: Orientation.horizontal, 2)
|
let mainbox = gtk.newBox(if orientation == gtk.Orientation.horizontal: Orientation.vertical else: Orientation.horizontal, 2)
|
||||||
window.add(mainbox)
|
window.add(mainbox)
|
||||||
let wrapButton = newToggleButtonWithLabel("Wrap")
|
let wrapButton = newToggleButton("Wrap")
|
||||||
mainbox.add(wrapButton)
|
mainbox.add(wrapButton)
|
||||||
var max = 0
|
var max = 0
|
||||||
while max <= 999999999:
|
while max <= 999999999:
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ proc main =
|
||||||
box.append(content)
|
box.append(content)
|
||||||
let footer = newActionBar()
|
let footer = newActionBar()
|
||||||
footer.setCenterWidget(newCheckButton("Middle"))
|
footer.setCenterWidget(newCheckButton("Middle"))
|
||||||
let button = newToggleButtonWithLabel("Custom")
|
let button = newToggleButton("Custom")
|
||||||
button.connect("clicked", changeHeader, window)
|
button.connect("clicked", changeHeader, window)
|
||||||
footer.packStart(button)
|
footer.packStart(button)
|
||||||
#var button1 = newButton("Subtitle")
|
#var button1 = newButton("Subtitle")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# High level gobject-introspection based GTK3/GTK4 bindings for the Nim programming language
|
# High level gobject-introspection based GTK3/GTK4 bindings for the Nim programming language
|
||||||
# nimpretty --maxLineLen:130 gen.nim
|
# nimpretty --maxLineLen:130 gen.nim
|
||||||
# v 0.8.4 2020-DEC-06
|
# v 0.8.4 2020-DEC-14
|
||||||
# (c) S. Salewski 2018
|
# (c) S. Salewski 2018
|
||||||
|
|
||||||
# usefull for finding death code:
|
# usefull for finding death code:
|
||||||
|
|
@ -207,6 +207,8 @@ var suppressRaise = false
|
||||||
|
|
||||||
fixedProcNames["gtk_button_new_with_label"] = "newButton"
|
fixedProcNames["gtk_button_new_with_label"] = "newButton"
|
||||||
fixedProcNames["gtk_check_button_new_with_label"] = "newCheckButton"
|
fixedProcNames["gtk_check_button_new_with_label"] = "newCheckButton"
|
||||||
|
fixedProcNames["gtk_toggle_button_new_with_label"] = "newToggleButton"
|
||||||
|
fixedProcNames["gtk_link_button_new_with_label"] = "newLinkButton"
|
||||||
|
|
||||||
fixedProcNames["pango_font_description_from_string"] = "newFontDescription"
|
fixedProcNames["pango_font_description_from_string"] = "newFontDescription"
|
||||||
fixedProcNames["pango_language_from_string"] = "languageFromString"
|
fixedProcNames["pango_language_from_string"] = "languageFromString"
|
||||||
|
|
@ -1058,7 +1060,11 @@ proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil; ge
|
||||||
(h1, h2, h3) = hhh.split
|
(h1, h2, h3) = hhh.split
|
||||||
if name == h1 and str == h2:
|
if name == h1 and str == h2:
|
||||||
str.add(" = " & h3)
|
str.add(" = " & h3)
|
||||||
if genProxy and (str == "string" or str == "cstring") and mayBeNil and sym != "gtk_check_button_new_with_label":
|
|
||||||
|
if genProxy and (str == "string" or str == "cstring") and mayBeNil and not sym.contains("_button_new_with_label"):
|
||||||
|
|
||||||
|
|
||||||
|
#if genProxy and (str == "string" or str == "cstring") and mayBeNil and sym != "gtk_check_button_new_with_label":
|
||||||
str.add(" = \"\"")
|
str.add(" = \"\"")
|
||||||
if genProxy and m == 0:
|
if genProxy and m == 0:
|
||||||
if sym.contains("_set_") and str == "bool":
|
if sym.contains("_set_") and str == "bool":
|
||||||
|
|
@ -2975,6 +2981,23 @@ proc mainQuit*(w: Window) = mainQuit()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
const GTK4_EPI = """
|
||||||
|
|
||||||
|
proc getRootWidget*(self: Widget): Widget =
|
||||||
|
let h = self.getRoot
|
||||||
|
assert(toBool(g_type_check_instance_is_a(cast[ptr TypeInstance00](h.impl), gtk_widget_get_type())))
|
||||||
|
#g_type_check_instance_is_a(cast[ptr TypeInstance00](result.impl), gt)))
|
||||||
|
cast[Widget](h)
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
const GDK4_EPI = """
|
||||||
|
|
||||||
|
proc getPosition*(self: Event): (float, float) =
|
||||||
|
assert toBool(gdk_event_get_position(cast[ptr Event00](self.impl), result[0].float, result[1].float))
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
const GTK_EPI = """
|
const GTK_EPI = """
|
||||||
|
|
||||||
#proc loadFromData*(self: CssProvider; data: cstring): bool =
|
#proc loadFromData*(self: CssProvider; data: cstring): bool =
|
||||||
|
|
@ -3526,6 +3549,7 @@ proc init* =
|
||||||
output.write("include gimplgobj\n")
|
output.write("include gimplgobj\n")
|
||||||
output.write("include gimplgtk\n")
|
output.write("include gimplgtk\n")
|
||||||
else:
|
else:
|
||||||
|
output.write(GTK4_EPI)
|
||||||
output.write("include gisup4\n")
|
output.write("include gisup4\n")
|
||||||
output.write("include gimplgobj\n")
|
output.write("include gimplgobj\n")
|
||||||
output.write("include gimplgtk\n")
|
output.write("include gimplgtk\n")
|
||||||
|
|
@ -3613,6 +3637,9 @@ proc get$1*(builder: Builder; name: string): $1 =
|
||||||
if ISGTK3:
|
if ISGTK3:
|
||||||
output.write(GDK3_EPI.replace("SomeEvent", "Event"))
|
output.write(GDK3_EPI.replace("SomeEvent", "Event"))
|
||||||
output.write(GDK_EPI.replace("SomeEvent", "Event"))
|
output.write(GDK_EPI.replace("SomeEvent", "Event"))
|
||||||
|
if not ISGTK3:
|
||||||
|
output.write(GDK4_EPI)
|
||||||
|
|
||||||
if namespace == "GtkSource":
|
if namespace == "GtkSource":
|
||||||
output.write(GTK_SOURCE_EPI % fixedModName("gtksource"))
|
output.write(GTK_SOURCE_EPI % fixedModName("gtksource"))
|
||||||
output.flush
|
output.flush
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue