Re: GTK 3.20 Nim wrapper

2016-12-27 Thread vlad1777d
again I missed a book )

Stefan_Salewski, it's good news =) I had some work several days, so I'll try to 
test it as soon as possible =) Thank you all =)


Re: GTK 3.20 Nim wrapper

2016-12-26 Thread dom96
50% off Nim in Action today 
[https://twitter.com/d0m96/status/813491834064355329](https://twitter.com/d0m96/status/813491834064355329)
 :)


Re: GTK 3.20 Nim wrapper

2016-12-26 Thread Stefan_Salewski
I have just uploaded the initial release of nim-rsvg:

[https://github.com/ngtk3/nim-rsvg](https://github.com/ngtk3/nim-rsvg)

The API is really tiny, so it was not much work making the wrapper.

I have decided to remove the Rsvg prefix from data types, as we generally do. 
If that should give too many type name conflicts we may add that prefix again.

Currently I have only this tiny test program, it reads a SVG file and generates 
a PNG file. Note that we do not need the close() proc here, the close proc may 
be needed when proc rsvg_handle_write () is used.


import cairo
import rsvg
import glib
import gobject

const FileName = "/usr/share/gnome-chess/pieces/simple/whiteKing.svg" # you 
may try other files!

var
  s: Surface
  cr: Context
  error: GError
  handle: rsvg.Handle

s = imageSurfaceCreate(FORMAT.ARGB32, 1250, 1250) # that is the svg size 
displayed by eog!
cr = create(s)
handle = newHandle(FileName, error)
if error != nil:
  echo error.message
  free(error)
assert handle != nil
assert renderCairo(handle, cr)
objectUnref(handle)
discard writeToPng(s, "image.png")
destroy(cr)
destroy(s)



Re: GTK 3.20 Nim wrapper

2016-12-24 Thread Stefan_Salewski
> I'm confused in all that pointer-reference-object_itself stuff

I have already downloaded the source code of librsvg-2.40.16. Seems to be 
really a tiny lib, and the c headers contains not many strange macros, so 
building the wrapper should be easy. (There are bitfields used, but fortunately 
latest c2nim supports that :)

I do not understand that lib well, so testing will be some work. For example I 
still wonder about your mentioned rsvg_handle_close (). From the API 
documentation: "Closes handle , to indicate that loading the image is complete. 
This will return TRUE if the loader closed successfully. Note that handle isn't 
freed until g_object_unref is called.". No idea currently.

I think the wrapper will be finished in a few days, but maybe I will just 
ignore testing.


Re: GTK 3.20 Nim wrapper

2016-12-22 Thread Stefan_Salewski
> @Stefan_Salewski, seems that RsvgHandle has not svg data it's nil instead

Of course making such a gtk related wrapper is not fully trivial.

I think I once said that RSVG is not a very big library, so it should not be 
too much work to make the wrapper. Unfortunately I have never used RSVG myself, 
so I would have to read about it first a bit, so that I can do at least some 
minimal testing. So for me I assume it would be about one week fulltime. May be 
justified when people really need it.


Re: GTK 3.20 Nim wrapper

2016-12-22 Thread vlad1777d
@dom96, ok, I'll look there from time to time.

@Stefan_Salewski, seems that RsvgHandle has not svg data it's nil instead... I 
have troubles with RSVG: 
[https://pp.vk.me/c638428/v638428447/163f4/kS8kbEjzctU.jpg](https://pp.vk.me/c638428/v638428447/163f4/kS8kbEjzctU.jpg)
 If I'll comment line 59 - I'll have the same error in line 63. File exists, I 
checked. Handle created, I checked... Why when trying to readclose it it writes 
that it's trying to read from nil ?

Asked in gtk+ and Nim channel - have not resolved.

Thanks.


Re: GTK 3.20 Nim wrapper

2016-12-22 Thread dom96
It looks like Manning is doing some sort of discounts throughout December. So 
keep checking this page: 
[http://freecontent.manning.com](http://forum.nim-lang.org///freecontent.manning.com)/


Re: GTK 3.20 Nim wrapper

2016-12-21 Thread Krux02
@vlad1999d

Yes learning the second programming language is much easier that the first one. 
I learned nim very well with the online material, and with the great help of 
the community here. You guys are really great. Am now at language twenty 
something, and the process to learn a new language has almost became a routine. 
But learning the details always takes a real project to understand them, and 
even then you are most of the time just programming in a subset of the 
programming language that you feel comfortable in, and other people solve the 
same problem very differently.


Re: GTK 3.20 Nim wrapper

2016-12-21 Thread vlad1777d
@dom96, ok, this is not very problem for me. I heard that learning second 
language (I know Python) is much easier than first one. So if there will be 
possibilitywish to receive the book - I'll do that, if no - no. I'm sure in 
myself =)

@Stefan_Salewski, I started to make RSVG wrapper in the image and likeness of 
youth wrappers =) But manually, because I don't know Ruby and principles of 
it's building: 
[https://pp.vk.me/c638428/v638428447/16141/JwP6810n33E.jpg](https://pp.vk.me/c638428/v638428447/16141/JwP6810n33E.jpg)
 (I wondered, it had compiled =) I'll try to make cells with it now) I'll only 
add there needed one information. But if you'll have time - you could make full 
version, RSVG is bound to GTK, so it would be good addition to your wrappers 
collection.


Re: GTK 3.20 Nim wrapper

2016-12-21 Thread dom96
> @dom96, but maybe there is a way for me to pay you directly and receive a 
> digital version of book ? Or this is illegal because of your contract with 
> Manning ?

Indeed. Afraid I can't do that.


Re: GTK 3.20 Nim wrapper

2016-12-21 Thread vlad1777d
Oh, I had missed a discussion about a book.

@dom96, but maybe there is a way for me to pay you directly and receive a 
digital version of book ? Or this is illegal because of your contract with 
Manning ? 


Re: GTK 3.20 Nim wrapper

2016-12-21 Thread vlad1777d
I'll ask about book than =)

First success: 
[https://pp.vk.me/c638428/v638428447/15f63/8Bgg0dH70NQ.jpg](https://pp.vk.me/c638428/v638428447/15f63/8Bgg0dH70NQ.jpg)
 Thanks for your wrapper and explainings =)


Re: GTK 3.20 Nim wrapper

2016-12-19 Thread Stefan_Salewski
Dom, I think he told us that it is nearly impossible to order the book in his 
country. I think it is Ukraine.


Re: GTK 3.20 Nim wrapper

2016-12-19 Thread dom96
As it happens, you can grab a printed version of [my 
book](https://manning.com/books/nim-in-action?a_aid=niminaction_bid=78a27e81) 
for half price using code `dotd121916`. (This expires in 7 hours though!).

Perhaps this would be affordable enough?


Re: GTK 3.20 Nim wrapper

2016-12-19 Thread Stefan_Salewski
> Than I don't understand how I can buy  book from someone in this 
> forum.

I don't know about the the legal issues about reselling digital books.

I was more talking about giving it away for free as a gift, I don't think that 
for that case there are legal issues.

Some months ago someone already gave away his book for free, but I think that 
was a paper version. And maybe there are some more people who have ordered a 
book but lost interest in Nim. 


Re: GTK 3.20 Nim wrapper

2016-12-19 Thread vlad1777d
I thought that you're talking about  book =)

Than I don't understand how I can buy  book from someone in this 
forum. I understand that I'll somehow send him money, than he'll send me 
 book and remove it from his PC? I don't know about copyright in this 
sphere, when I buy book, I must sign/agree some license agreement?


Re: GTK 3.20 Nim wrapper

2016-12-18 Thread Stefan_Salewski
I have only the epub and pdf version of the book, I got it for 20 $ in manning 
discount. And I can not imagine why someone would buy the real paper version in 
these days -- why kill trees for it, waste energy for printing and generate 
waste? (Of course for some books, which you study hundreds of hours paper is 
fine still.)

Ints are not converted to cint automatically by default. On a 64 bit system 
Nim's int is 64 bit, while cint may be only 32 bit, so you would lost 
information. You may use a converter if you really want automatic conversion. 
But I generally use cint when that data type is needed for a C library.


Re: GTK 3.20 Nim wrapper

2016-12-18 Thread vlad1777d
Thank you. Do you mean the  book, not the  one? Because if you 
mean paper, I'm afraid that it'll be hardexpensive to send it into Ukraine.

About cint, I thought, that int is automatically converted to cint for C-type 
procs, as it's for strings, in manual andor tutorials I have not found 
information about cint. I'll look more today.


Re: GTK 3.20 Nim wrapper

2016-12-16 Thread Stefan_Salewski
> But problem is still present:

Yes, and the error message is very clear: expected are cint parameters for 
width and high, but you pass int.

You should really try to get Dom's book, you may be the target audience. You 
may ask in the forum, maybe someone has a copy which he do not need any more. I 
myself have still to read the last chapter more carefully, so I can not give 
away my copy yet.

> Got confused with all amount of that text files and references =)

Yes, GTK with other languages than C can be very hard to manage at some points. 
I have used GTK with Ruby for a few years, and while most stuff was easy, at 
some points it was very hard. And because there is no Ruby-GTK community any 
more I spent many hours for some simple proc calls, finding the right 
parameters. But for current Nim-GTK3 it is much easier, compiler gives you 
messages, and the wrapper follows original C code very closely. Your int/cint 
problem and the invalid nil for var parameter is very easy to resolve when you 
have some basic Nim knowledge. (GTK with Python may be easy too, because there 
may exist up to date tutorials/documentation and a small community. For Ruby 
unfortunately that is not the case any more.) 


Re: GTK 3.20 Nim wrapper

2016-12-16 Thread vlad1777d
Thank you. My intentions are to learn Nim and Gtk by rewriting chess from 
Python + Gtk into Nim + Gtk =) Now I try to build indie game with my friend and 
than want to pass it into Steam's Greenlight: 
[https://vk.com/open_oasis](https://vk.com/open_oasis) (it's it's blog in 
Russian, you can read it through Google translate if you want)

As for the strange approach with images - it's more fast and clear way to tell 
somebody some information.

I looked into your chess and Ned, but I had not found the solution. I thought 
that it must be GdkPixbufError enum, not dummy variable of GError type. But I 
had not found such enum neither in your project's code, nor in Gtk wrapper's 
sources. Really, the dummy variable, seems, may help: 
[https://pp.vk.me/c638428/v638428447/14075/sVqom7GQb2M.jpg](https://pp.vk.me/c638428/v638428447/14075/sVqom7GQb2M.jpg)
 I didn't think about it, don't know why. Got confused with all amount of that 
text files and references =)

But problem is still present: 
[https://pp.vk.me/c638428/v638428447/1408b/-nrBS6er9l0.jpg](https://pp.vk.me/c638428/v638428447/1408b/-nrBS6er9l0.jpg)

I think that I must remove it manually - I'll remember better the solution and 
will not bother other with it. In Python this worked more simply: 
[https://pp.vk.me/c638428/v638428447/1409d/RcS_L9V4ewc.jpg](https://pp.vk.me/c638428/v638428447/1409d/RcS_L9V4ewc.jpg)
 but that's official binding + Nim is my first compiled language, so it's not 
so easy as Python for me =)

As for GC for GTK, I think that if all works well and looking to amount of 
interested people, it's not the most needed thing for now. As it works well - 
let it work well.

But if you're not against, I'll ask sometimes you questions about Gtk wrapper =)


Re: GTK 3.20 Nim wrapper

2016-12-15 Thread vlad1777d
Thanks, all went normally, but I stacked with creating pixbuf from image.

I decided to use this: 
[https://pp.vk.me/c638428/v638428447/13ff8/5by3ijiErV4.jpg](https://pp.vk.me/c638428/v638428447/13ff8/5by3ijiErV4.jpg)
 function, but I got an error: 
[https://pp.vk.me/c638428/v638428447/13fef/309fNgF4xlc.jpg](https://pp.vk.me/c638428/v638428447/13fef/309fNgF4xlc.jpg)
 .

I searched in manuals how to fix it, tried many ways: 
[https://pp.vk.me/c638428/v638428447/13fe6/bom-MQo64JQ.jpg](https://pp.vk.me/c638428/v638428447/13fe6/bom-MQo64JQ.jpg)
 
[https://pp.vk.me/c638428/v638428447/1400a/iYzeqZ_XEzI.jpg](https://pp.vk.me/c638428/v638428447/1400a/iYzeqZ_XEzI.jpg)
 , but I have not found that enumeration (from last screenshot) in .nim wrapper 
files.

I tried to use it directly, but I got error anyway: 
[https://pp.vk.me/c638428/v638428447/14001/vbiPiJPxcxA.jpg](https://pp.vk.me/c638428/v638428447/14001/vbiPiJPxcxA.jpg)

So I give up. Maybe you could make me some help?)


Re: GTK 3.20 Nim wrapper

2016-11-13 Thread Stefan_Salewski
For your last question:


grep WindowObj src/gtk3.nim
Window* =  ptr WindowObj
WindowPtr* = ptr WindowObj
WindowObj* = object of BinObj

In Nim as in many other OOP languages we can use hyrachical object structures, 
by using the "object of" notation. In C GTK related structs have generally a 
parent field as first component. We can do it in the same way in Nim, but we 
can also drop that field by using the object of notation. This way we can avoid 
many casts. So for example Window is a "subclass" of Bin object, which already 
is a subclass of Widget. This means that procs which expects a widget parameter 
will accept a Bin or a Window as well without cast. This is convenient, but it 
may be not as typesafe as pure Nim code of course. If you need a type 
conversion in rare cases, you can use Nim's type conversion like 
Window(widget), or better use the lower case GTK casting templates like


template window*(obj: expr): expr =
  (gTypeCheckInstanceCast(obj, typeWindow, WindowObj))

They do runtime type checking.

For your first question:

GTK3 programs can be written in the traditional GTK2 way, or with App design. 
For traditional code, we have to init gtk lib before using it. In my examples 
that is done this way:


$ cat test.nim
"..."
gtk3.initWithArgv()
# your code
gtk3.main()

For the app design, we do not need an explicit init -- that is the reason why 
gtk3.initWithArgv() is not called automatically. For the app design NEd editor 
is an example, and I also provided a Nim version of the so called application10 
of GTK docs:

[https://github.com/ngtk3/nim-app](https://github.com/ngtk3/nim-app)

The App style is more advanced, but for that style generally only C and Nim 
examples exists, I am not aware of fully functional Python or Ruby or 
Java-Script examples.

As I already told you -- it may be really hard for you to learn GTK3 and Nim at 
the same time. There may exist other GUI toolkits which are much better suited 
for your tasks, maybe in conjunction with another programming language.

PS: Recently I updated my box from GTK 3.18 to 3.20 and just discovered that 
some color settings do not works any more. The CSS notation has changed. So for 
NEd editor with dark color scheme tooltip background is dark also, which is 
really not nice. It is not very easy to fix, I already contacted two of the few 
remaining GTK developers, but we still have no really nice solution. I will try 
to fix that as soon as possible. That CSS problem also concerns the colors.nim 
example, currently setting of background color does not work. That should be 
very easy to fix, but has low priority.


Re: GTK 3.20 Nim wrapper

2016-11-12 Thread vlad1777d
But do you know what to do with this error? 
[https://pp.vk.me/c638518/v638518447/8b77/4XL_Mn8aakE.jpg](https://pp.vk.me/c638518/v638518447/8b77/4XL_Mn8aakE.jpg)


Re: GTK 3.20 Nim wrapper

2016-11-03 Thread Stefan_Salewski
> One thing I lack - RSVG Nim wrapper

Let us know when you really need that. I think that lib is not that large, so 
it should not be much work to build the wrapper.

Have you already solved your gtksourceview missing lib problem? I saw your 
github issue -- but one line comment that you can not load it is not enough. Is 
the lib available on your box at all. Maybe gtksourceview devel is a separate 
package for your distro.


Re: GTK 3.20 Nim wrapper

2016-11-03 Thread vlad1777d
Thank you, I'll try to buy the book some time. 20 dollars is really not much. 
If it would be in my language - I would even ask a digital version of it. But 
in English it's not really good to read it. I use translator through every 2-3 
sentences.

I had already read tutorials and manual, I understood not all, but when I don't 
understand something - I re-read tutorialmanualmodule reference. If I did not 
understood after this - I ask in IRC or forum.

I had some experience with gtk - I started making Omega Chess in Python and 
GTK. It was not finished (there was only board with switchable colors of cells, 
when you resize window - board resezed too), I learned Python and GTK through 
it, but I decided to learn Nim by re-writing this application to Nim and GTK. I 
spent many time reading API and asking questions in GTK+ IRC =)

One thing I lack - RSVG Nim wrapper - in GTK IRC suggested me that if I want to 
keep images in RAM than to create from them GDK_Pixbuf -es, than I need to use 
RSVG. Without it images every window re-size are read from hard disk.

I have only a little experience with compiled languages.

Thank you for help.


Re: GTK 3.20 Nim wrapper

2016-11-03 Thread Stefan_Salewski
When that is already a problem for you, you should ask yourself if you really 
need GTK. Do you have already much experience with GTK? You may know that GTK 
community is not very active currently, so it is very difficult to get help. 
The Krause book is only for GTK2, and the online API docs are fine, but it 
takes some time to read and understand it.

And try to get the Dom book, I think you are the target audience. I already 
answered you in IRC -- contact Manning and ask how you can get the book in your 
country, 20$ is really not that expensive.. We should find a way. And read the 
Tutorial, it is really fine.

For your question: TOPLEVEL flag is the default for newWindow(), so you do not 
need it. And when you want it, GTK3 flags are pure, so the identifier is 
WindowType.TOPLEVEL.


Re: GTK 3.20 Nim wrapper

2016-10-31 Thread Stefan_Salewski
No not as a library. But I have not investigated the remaining crashes.

I worked on it two months ago for the last time and used the editor then while 
working on the chess game. For me some crashes are no problem, I saved every 
ten minutes. And I think there are no other users beside me.

One reason why I have not done further investigations was that there are still 
some bugs open in nimsuggest bug tracker, and I wanted not to add more. I think 
you have more important work to do.

When I started with Nim two years ago I had a short look into aporia code -- 
there all nimsuggest related code was incapsulated deeply in try/except blocks 
with permannently restarting the nimsuggest process. I was not really happy 
with that design.

My current code has no try/except and no restart of nimsuggest. For some 
problems I know why they occur, I have reported a few at nimsuggest bug 
tracker, and can report some more. For the remaining problems I have to do some 
investigations. Some problems my be GTK related, fixing these should be easy.

[https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd)


Re: GTK 3.20 Nim wrapper

2016-10-31 Thread Araq
Do you use nimsuggest as a library? Because otherwise a crashing process should 
not break your editor process.


Re: GTK 3.20 Nim wrapper

2016-10-31 Thread vlad1777d
Not nice solution, but better than having crashes when you work on code =)


Re: GTK 3.20 Nim wrapper

2016-10-31 Thread Stefan_Salewski
Yes indeed, the test files needs some links before they work. For example in 
~/ngtk3/nim-gtk3/test there is a file called "mach" (make in german language), 
I execute bash make followed by nim c test.nim and ./test. But these tests are 
nearly obsolete now, as long as chess works. It may be possible to avoid all 
these links when you enter all the wrapper directories and type somethink like 
"nimble install" there. I tried that once, it was working for me. But I guess 
it will generate problems for people who have installed the legacy aporia 
related gtk2 nimble wrappers.

But when you manage to get nim-chess2 working, you can follow exactly that 
pattern for every Nim GTK3 application. You may also try the Nim GTK3 editor 
NEd from [https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd). I have 
not yet tested it with latest Nim v 0.15.2 -- with v 0.15.0 it was working, but 
still sometimes crashed. Some crashes are related to nimsuggest, so fixing is 
not that easy. Of course I may wrap the nimsuggest crashes with try/except and 
so more or less ignore it. But I consider that not a really nice solution. 


Re: GTK 3.20 Nim wrapper

2016-10-31 Thread vlad1777d
I took information from here: 
[http://nim-lang.org/docs/nimc.html](http://forum.nim-lang.org///nim-lang.org/docs/nimc.html)
 about path option and .cfg files, here: 
[http://nim-lang.org/docs/manual.html#modules-import-statement](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#modules-import-statement)
 about import system, and added nim.cfg with:\--path: "gui"|   
---|---  
  
, added folder "gui", where were simulinks to all .nim wrappers - all worked.

I'll try to work with it more. (system: Debian x64 unstable)


Re: GTK 3.20 Nim wrapper

2016-10-31 Thread vlad1777d
I added gdk3.nim to the folder, where gtk3.nim was, it imported, now same error 
is while importing glib: 
"""/home/vlad/Programs/programming/libraries/Nim/ngtk3/nim-gtk3/src/gdk3.nim(14,
 6) Error: cannot open 'glib' """

Do I need to place them in one directory, or I can make some configure for this?


Re: GTK 3.20 Nim wrapper

2016-10-31 Thread vlad1777d
Thank you, I understood my error. I need links to all those libraries (i placed 
test file with gtk3.nim in one folder).

But I have now such issue: 
"""home/vlad/Programs/programming/libraries/Nim/ngtk3/nim-gtk3/src/gtk3.nim(14, 
6) Error: cannot open 'gdk3'""" with your test file from one of those libraries.

Screenshot: 
[https://pp.vk.me/c638518/v638518447/8369/cWvQeHqwpRA.jpg](https://pp.vk.me/c638518/v638518447/8369/cWvQeHqwpRA.jpg)


Re: GTK 3.20 Nim wrapper

2016-10-30 Thread Stefan_Salewski
You may try first

[https://github.com/ngtk3/nim-chess2](https://github.com/ngtk3/nim-chess2)

The readme contains the instructions, which I tested recently with Nim v 0.15.2 
on Linux.

For Linux you can copy the commands to a file and run the script, bash 
script.sh.

I know that it does not work for OSX, can not help. Of course a nimble install 
would be more nice, but I can not provide that currently, and I think there are 
indeed no users.


Re: GTK 3.20 Nim wrapper

2016-10-30 Thread vlad1777d
How to make it work? (I'm a newbie in this)

test.nim(1, 8) Error: cannot open 'gtk3'

I downloaded from github archive and tried to compile: nim c 
'/home/vlad/Programs/programming/libraries/Nim/nim-gtk3-master/test/test.nim'


Re: GTK 3.20 Nim wrapper

2016-09-25 Thread Simon
http://forum.nim-lang.org/t/2553/1#15830


Re: GTK 3.20 Nim wrapper

2016-09-24 Thread vonH
Hi Simon, can you share how you managed to get GTK3 working on Windows 7?

I am trying to quote from your earlier response but I have finding difficult.


Re: GTK 3.20 Nim wrapper

2016-09-21 Thread Stefan_Salewski
NEd GTK3 Nim editor is available in version 0.4 now.

[https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd)

I have done full code cleanup. We have 1800 lines of code now.

And I fixed the windows dll names for gtk and gdk. as suggested by Simon.

And I removed the proc names like int() from gio and glib which gave some 
trouble.

The editor is not much tested yet -- but I will use it now for Nim coding, 
keeping many backups of my sources... 


Re: GTK 3.20 Nim wrapper

2016-09-13 Thread Stefan_Salewski
Thanks for the hints, I will fix the windows dll names.

I have recently done some cleanup of the NEd editor code. I have discovered 
that the code for startup without file arguments is very wrong, I will fix that 
soon and try to fix the lookup code for gsettings config also. Then it may work 
on windows too. But of course there seem to exist better editors for Nim on 
Windows.

And for the chess -- there should be a version with transposition table 
available soon. And later maybe a version with parallel threading.


Re: GTK 3.20 Nim wrapper

2016-09-10 Thread Simon
About nim-chess. In gtk3.nim and gdk3.nim 


libgtk-win32-3.0-0.dll
libgdk-win32-3.0-0.dll


to replace 


libgtk-3-0.dll
libgdk-3-0.dll

and additionally execute 


ln -s ~/ngtk3/nim-cairo/src/cairo_pragma.nim

and then chess works.


Re: GTK 3.20 Nim wrapper

2016-09-10 Thread Stefan_Salewski
> Yes, a couple of fixes and it worked. If you want I'll write more detailed.

Yes, would be fine.

Araq just told me that he regards proc names like int32 invalid -- they shadow 
type conversions. So I have to filter all the GTK3 related modules for proc 
names which may conflict with type names. Will take some time...

My ned editor -- well there are some bugs still. For example currently it works 
only when started from its directory. Otherwise the gsettings configuration are 
not found. For Linux one solution is this:


#  And for making gsettings available system wide one method is, as root
# https://developer.gnome.org/gio/stable/glib-compile-schemas.html
# echo $XDG_DATA_DIRS
# /usr/share/gnome:/usr/local/share:/usr/share:/usr/share/gdm
# cd /usr/local/share/glib-2.0/schemas
# cp org.gtk.ned.gschema.xml .
# glib-compile-schemas .

I would prefer a solution which needs no root access, and I have no idea how to 
do that on Windows. I will ask at the gtk mailing list, but do not expect to 
get an answer.


Re: GTK 3.20 Nim wrapper

2016-09-10 Thread Simon
First of all thank you for your help. Now to answer your questions.

> I assume that you are using an 32 bit Nim installation?

Yes, but before that I used 64 bit. Differences invisible.

> Is the chess game running for you?

Yes, a couple of fixes and it worked. If you want I'll write more detailed.

> If it really is Windows -- which gtk version, which windows, and how did you 
> install GTK3 itself?

Windows 7 x64, gtk3 (3.20). Installed with Msys2.


 glib except int32

NEd compiled. But is not completely working. I'll try to fix it. Anyway, thank 
you again.


Re: GTK 3.20 Nim wrapper

2016-09-08 Thread Stefan_Salewski
> Now the problem with NEd:

Thanks for testing. For me it compiles fine. I assume that you are using an 32 
bit Nim installation? In this case I am not really surprised, the whole GTK3 is 
untested on 32 bit systems. Is the chess game running for you? That would be 
really great for 32 bit already. I will try to investigate your problem from 
above. Unfortunately the file name at the beginning of your error message seems 
to be missing.


Re: GTK 3.20 Nim wrapper

2016-09-08 Thread Simon
Now the problem with NEd:


.nim(1796, 14) template/generic instantiation from here
c:\nim\lib\system\threads.nim(396, 41) Error: type mismatch: got (int)
but expected one of:
proc int32(value: GVariant): int32



Re: GTK 3.20 Nim wrapper

2016-08-28 Thread Stefan_Salewski
Thanks for reporting.

I guess you are refering to the chess game?

Lets look at line 70:


if p0 != p1: window(widget.toplevel).title= "invalid move, ignored."

As the compiler told us, there is a symbol window defined in module gtk3 as 
well as gdk3. So only two possibilities to try. But of course member field 
"title" told us that this is the gtk window, so fix is


if p0 != p1: gtk3.window(widget.toplevel).title= "invalid move, ignored."

You have to do 3 more similar fixes, sorry.

Another fix would be to modify module import list like


import gdk3 exept window

Will fix file at github tomorrow -- I wonder why this error has not occured 
before...

And yes, for that window() cast a proc would be fine, no template necessary. 
But it is some work to fix all that...

If you are on Linux you may test the editor as well, it is now available in v 
0.3. But you have to install nimsuggest first.


Re: GTK 3.20 Nim wrapper

2016-08-28 Thread Simon
I get an error when trying to compile 


board.nim(70, 26) Error: ambiguous call; both gtk3.window(obj: expr) and 
gdk3.window(object: expr) match for: (Widget)


How to fix it?


Re: GTK 3.20 Nim wrapper

2016-08-06 Thread Stefan_Salewski
The plain Nim GTK3 editor is now available in version 0.2

[https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd)

I have added multiview support, fixed the GTK related modules and added a short 
Asciidoc Readme. Not really tested yet. You should be able to compile it at 
least on 64 bit Linux systems. Nimsuggest is still fragile and can generate 
crashes. Working with multiple files at the same time seems to be a problem. 
Maybe we have indeed to restart mimsuggest when we switch files? And 
suggestions do not work reliable yet. 


Re: GTK 3.20 Nim wrapper

2016-07-27 Thread Stefan_Salewski
In the last days I added multiview support -- looks really not that bad, at 
least on Linux.

Unfortunately I have to clean up the code and do some testing before I can push 
code to github...

[http://ssalewski.de/tmp/NEd.png](http://forum.nim-lang.org///ssalewski.de/tmp/NEd.png)


Re: GTK 3.20 Nim wrapper

2016-07-10 Thread Stefan_Salewski
> Cool, I will try it out! what would it take to merge this project with Aporia?

I am a bit surprised, I know that you have your own editor called NimEdit (and 
you have some hope for NimX and LibUI )

Extending this one with stuff from Aporia should be not too much work. Indeed I 
used Aporia for an early test of my first GTK3 wrapper too years ago, and after 
some minor fixes it was compiling and most stuff was working on Linux. But I do 
not know much about Dom's recent tweaks for Mac OSX or Windows. Generally I 
know that GTK3 is not very popular currently.


Re: GTK 3.20 Nim wrapper

2016-07-10 Thread Araq
Cool, I will try it out! what would it take to merge this project with Aporia?


Re: GTK 3.20 Nim wrapper

2016-07-10 Thread Stefan_Salewski
I have pushed latest Nim GTK3 editor to github:

[http://ssalewski.de/tmp/NEd.png](http://forum.nim-lang.org///ssalewski.de/tmp/NEd.png)

[https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd)

Of course that is more a test and example for GTK3 than a real editor like Vim 
or Emacs :)

But "Check" and "Goto Definition" from nimsuggest is really useful, method 
suggestions may need still some investigation.

No mimble support due to the well known name conflicts, if you really want to 
test it, you may use the instructions from above as for the chess game. Replace

git clone 
[https://github.com/ngtk3/nim-chess](https://github.com/ngtk3/nim-chess)

with

git clone [https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd)

go into NEd directory and execute "bash make_it".

That is a bit ugly and works only for gcc, the reason is that we have to build 
resource files from the XML definitions.

A Nim syntax file and the dark color scheme is included, you have to copy it 
where it may belong.

Not really tested yet, maybe recent cleanup has introduced errors. (It uses 
GSettings for storing user font selection and color scheme, unfortunately I do 
not know how to reset GSettings for a fresh, clean test. So it may occur that 
it will not work really nice for you. And I tested only with 64 bit Linux and 
GTK 3.18) In the next days I will add some docs to github README.

And I do indeed intend to use it for Nim coding!

Ctrl E: Mark errors Ctrl D: Goto definition, for example move text cursor over 
a proc name and try... Ctrl F: Find word under cursor or selected text -- press 
again to toggle. Ctrl Space: Method suggestions, type 1.2. and Ctrl Space when 
cursor is on right side of period. Or type begining of an identifier and then 
Ctrl Space.