1. eGui idea: Iup Pre-Installed with Euphoria

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

new topic     » topic index » view message » categorize

2. Re: eGui idea: Iup Pre-Installed with Euphoria

_tom said...

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.

new topic     » goto parent     » topic index » view message » categorize

3. Re: eGui idea: Iup Pre-Installed with Euphoria

andi49 said...

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.

_tom said...

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: eGui idea: Iup Pre-Installed with Euphoria

ghaberek said...

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: eGui idea: Iup Pre-Installed with Euphoria

_tom said...

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.

_tom said...

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.

_tom said...

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: eGui idea: Iup Pre-Installed with Euphoria

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

new topic     » goto parent     » topic index » view message » categorize

7. Re: eGui idea: Iup Pre-Installed with Euphoria

_tom said...

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: eGui idea: Iup Pre-Installed with Euphoria

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 
new topic     » goto parent     » topic index » view message » categorize

9. Re: eGui idea: Iup Pre-Installed with Euphoria

jmduro said...

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu