1. eGui idea: Iup Pre-Installed with Euphoria
- Posted by _tom (admin) Nov 20, 2015
- 1755 views
G Haberek created "Iup for Euphoria" which wraps the IUP graphical toolkit. He has also written a code editor using this toolkit.
I have ten demo programs, converted from the IUP examples, working nicely. My conclusion: we have a working, multi-platform, gui toolkit that could be bundled with the next Euphoria release.
It is time to discuss this option.
_tom
2. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by andi49 Nov 20, 2015
- 1727 views
G Haberek created "Iup for Euphoria" which wraps the IUP graphical toolkit. He has also written a code editor using this toolkit.
I have ten demo programs, converted from the IUP examples, working nicely. My conclusion: we have a working, multi-platform, gui toolkit that could be bundled with the next Euphoria release.
It is time to discuss this option.
_tom
Hi
okay, let the code talk. Where is is the downloadlink for the demo's and the toolkit.
Andreas
Edit: Or even better, you proved it to work (on multiple platforms). And just do it, without discussion.
3. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by ghaberek (admin) Nov 20, 2015
- 1753 views
Hi
okay, let the code talk. Where is is the downloadlink for the demo's and the toolkit.
Andreas
Edit: Or even better, you proved it to work (on multiple platforms). And just do it, without discussion.
Read this: The Euphoria Editor
It does indeed run on Windows and Linux, both 32-bit and 64-bit. You can download it here: Downloads or read Running from Source.
G Haberek created "Iup for Euphoria" which wraps the IUP graphical toolkit. He has also written a code editor using this toolkit.
I have ten demo programs, converted from the IUP examples, working nicely. My conclusion: we have a working, multi-platform, gui toolkit that could be bundled with the next Euphoria release.
It is time to discuss this option.
_tom
Tom,
I sent you an invitation to join the repository. Please add your examples to the iup/samples directory when you have time.
-Greg
4. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by _tom (admin) Nov 21, 2015
- 1710 views
Please add your examples to the iup/samples directory when you have time.
-Greg
I have uploaded twelve demo programs. These are IUP examples, originally written in C that come with the IUP source-code, converted to Euphoria. (oE4.1 required.)
I hacked a setup that places the include files in include/iup and I have the IUP binaries in /usr/local. However, we need to agree on a standard installation. I am using the Duro version of 4.1 to run the examples.
But, I don't understand how to use pixmap graphics (graphical buttons) with your wrapper. Can you try converting button.c to Euphoria?
_tom
5. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by ghaberek (admin) Nov 23, 2015
- 1617 views
I have uploaded twelve demo programs. These are IUP examples, originally written in C that come with the IUP source-code, converted to Euphoria. (oE4.1 required.)
Neat, thanks! Curious, what code are you using that requires Euphoria 4.1? I want to catch all of the 4.1-isms and account for them with ifdefs if we can.
I hacked a setup that places the include files in include/iup and I have the IUP binaries in /usr/local. However, we need to agree on a standard installation. I am using the Duro version of 4.1 to run the examples.
I was originally putting the includes into include/std but I have moved them to include/iup. I think we discussed this and it makes more sense this way.
But, I don't understand how to use pixmap graphics (graphical buttons) with your wrapper. Can you try converting button.c to Euphoria?
A pixmap in IUP is just an array of bytes (unsigned char[] in C). You just need to allocate() the size of the array and then poke() it into memory. I've already added a handy-dandy function to my IUP wrapper that does this for you. It is conveniently named allocate_image(). I will work on changing the IupImage functions to accept a sequence of bytes for the pixels parameter as well. That will make it more intuitive. Now that I've shown you this, can you proceed with converting button.c to Euphoria?
constant pixmap_release = allocate_image({ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,4,4,3,3,3,3,2,2, 1,1,3,3,3,3,3,4,4,4,4,3,3,3,2,2, 1,1,3,3,3,3,3,4,4,4,4,3,3,3,2,2, 1,1,3,3,3,3,3,3,4,4,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,1,3,3,3,3,3,3,3,3,3,3,3,3,2,2, 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 }) atom img_release = IupImage( 16, 16, pixmap_release ) IupHandle( "img_release", img_release )
I also noticed in your samples that you are declaring a new type for Ihandle. I know it makes the code look more like the C samples, but I think it's unnecessary and I was trying to avoid this. You can declare all controls as an atom since they are just pointers. This is the same way other Euphoria toolkits work and personally I think it's a lot cleaner looking. I can't find much sense in declaring a new type that doesn't really do anything special.
-Greg
6. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by _tom (admin) Nov 23, 2015
- 1628 views
Your allocate_image function solves the problem for pixmaps.
I'm converting the examples with just cut and paste, as a result ihandle and a few other artifacts exist because of my simplistic conversions. Once all examples work I will add proper documentation and a Euphoric layout.
thanks,
_tom
7. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by jmduro Dec 02, 2015
- 1526 views
I have uploaded twelve demo programs. These are IUP examples, originally written in C that come with the IUP source-code, converted to Euphoria. (oE4.1 required.)
Here is another example converted from one of Jeremy Cowgar's EuIUP examples.
-- -- Copyright (C) 2008-2010 by Jeremy Cowgar <jeremy@cowgar.com> -- -- This file is part of EuIup. -- -- EuIup is free software: you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as -- published by the Free Software Foundation, either version 3 of -- the License, or (at your option) any later version. -- -- EuIup is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with EuIup. If not, see <http://www.gnu.org/licenses/>. -- include std/sequence.e include std/iup.e procedure main( sequence cmd = command_line() ) sequence argv = cmd[3..$] integer argc = length( argv ) IupOpen( argc, argv ) sequence greetings = { "Hello", "Goodbye", "What's Up?", "Cya" } -- an empty string to pad memory sequence empty = repeat( 0, 255 ) sequence fields = { "Greeting: %o|Hello|Goodbye|What's Up?|Cya|", "Name: %s", "Times: %i" } sequence params = { allocate_data( 4, 1 ), allocate_string( empty, 1 ), allocate_data( 4, 1 ) } sequence text = "World" poke4( params[1], 0 ) poke( params[2], text ) poke4( params[3], 5 ) atom result = IupGetParam( "Say Hello", NULL, NULL, stdseq:join(fields, "\n"), length(fields), 0, params ) if result = 0 then -- user cancelled return end if atom num, nb num = peek4u( params[1] ) text = peek_string( params[2] ) nb = peek4u( params[3] ) for i = 1 to nb do printf(1, "%s, %s!\n", { greetings[num + 1], text }) end for IupClose() end procedure main()
Jean-Marc
8. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by jmduro Dec 03, 2015
- 1645 views
if IupGetParam was redesigned as here, it would be more accessible to beginners.
public function IupGetParam(object title = NULL, atom action, atom user_data, sequence fields, sequence default, atom param_extra=0) sequence params = {} sequence empty = repeat( 0, 255 ) -- an empty string to pad memory if sequence(title) then title = allocate_string(title) end if if not length(fields) then return 0 end if atom format = allocate_string(stdseq:join(fields, "\n")) atom param_count = length(fields) sequence param_data = {} for i = 1 to param_count do if match("%s", fields[i]) then param_data = append(param_data, allocate_string( empty, 1 )) poke( param_data[$], default[i] ) elsif match("%o", fields[i]) then param_data = append(param_data, allocate_data( 4, 1 )) poke4( param_data[$], default[i] ) elsif match("%i", fields[i]) then param_data = append(param_data, allocate_data( 4, 1 )) poke4( param_data[$], default[i] ) end if end for atom p_param_data = allocate_pointer_array(param_data) atom result = c_func( xIupGetParam, {title,action,user_data,format,param_count,param_extra,p_param_data} ) free(p_param_data) if result = 0 then return 0 end if for i = 1 to param_count do if match("%s", fields[i]) then params = append(params, peek_string( param_data[i] )) elsif match("%o", fields[i]) then params = append(params, peek4u( param_data[i] )) elsif match("%i", fields[i]) then params = append(params, peek4u( param_data[i] )) end if end for return params end function
Example of use (tested)
sequence greetings = { "Hello", "Goodbye", "What's Up?", "Cya" } object result = IupGetParam( "Say Hello", NULL, NULL, { "Greeting: %o|Hello|Goodbye|What's Up?|Cya|", "Name: %s", "Times: %i" }, {0, "Text", 5} ) if sequence(result) then atom num = result[1] sequence text = result[2] atom nb = result[3] for i = 1 to nb do printf(1, "%s, %s!\n", { greetings[num + 1], text }) end for end if
9. Re: eGui idea: Iup Pre-Installed with Euphoria
- Posted by ghaberek (admin) Dec 03, 2015
- 1434 views
if IupGetParam was redesigned as here, it would be more accessible to beginners.
Thanks! I will work on implementing this into my IUP wrapper code.
-Greg