Author Topic: IUP Linux and Windows  (Read 106432 times)

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #30 on: January 14, 2012, 02:17:50 PM »
Here is the tabs.c IUP C example converted to ScriptBasic. I think Gtk (Linux) does a better job of vertical tabs.

C Version

Code: [Select]
' Iup::Tabs: Example in ScriptBasic
' Creates a Iup::Tabs control.

IMPORT iup.bas

GLOBAL CONST IUP_CENTER = 0xFFFF

Iup::Open()

vbox1 = Iup::Vbox(Iup::Label("Inside Tab A"), Iup::Button("Button A", ""))
vbox2 = Iup::Vbox(Iup::Label("Inside Tab B"), Iup::Button("Button B", ""))

Iup::SetAttribute(vbox1, "TABTITLE", "Tab A")
Iup::SetAttribute(vbox2, "TABTITLE", "Tab B")

tabs1 = Iup::Tabs(vbox1, vbox2)

vbox1 = Iup::Vbox(Iup::Label("Inside Tab C"), Iup::Button("Button C", ""))
vbox2 = Iup::Vbox(Iup::Label("Inside Tab D"), Iup::Button("Button D", ""))

Iup::SetAttribute(vbox1, "TABTITLE", "Tab C")
Iup::SetAttribute(vbox2, "TABTITLE", "Tab D")

tabs2 = Iup::Tabs(vbox1, vbox2)
Iup::SetAttribute(tabs2, "TABTYPE", "LEFT")

box = Iup::Hbox(tabs1, tabs2)
Iup::SetAttribute(box, "MARGIN", "10x10")
Iup::SetAttribute(box, "GAP", "10")

dlg = Iup::Dialog(box)
Iup::SetAttribute(dlg, "TITLE", "IupTabs")
Iup::SetAttribute(dlg, "SIZE", "200x80")

Iup::ShowXY (dlg, IUP_CENTER, IUP_CENTER)
Iup::MainLoop ()
Iup::Close ()

END




Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #31 on: January 17, 2012, 03:18:07 PM »
I have been working on adding the additional controls and the CD (canvas draw library) to the ScriptBasic IUP binding. This should add some interesting features to the SciptBasic language offering.






Dials





« Last Edit: January 17, 2012, 04:46:57 PM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #32 on: January 17, 2012, 05:43:30 PM »
Here is the matrix.c example converted to ScriptBasic.

C Version

Code: [Select]
IMPORT iup.bas

GLOBAL CONST IUP_CENTER = 0xFFFF

FUNCTION create_mat
  mat = Iup::Matrix()
 
  Iup::SetAttribute(mat,"NUMCOL","20")
  Iup::SetAttribute(mat,"NUMLIN","30")
 
  Iup::SetAttribute(mat,"NUMCOL_VISIBLE","2")
  Iup::SetAttribute(mat,"NUMLIN_VISIBLE","3")
 
  Iup::SetAttribute(mat,"0:0","Inflation")
  Iup::SetAttribute(mat,"1:0","Medicine")
  Iup::SetAttribute(mat,"2:0","Food")
  Iup::SetAttribute(mat,"3:0","Energy")
  Iup::SetAttribute(mat,"0:1","January 2000")
  Iup::SetAttribute(mat,"0:2","February 2000")
  Iup::SetAttribute(mat,"1:1","5.6")
  Iup::SetAttribute(mat,"2:1","2.2")
  Iup::SetAttribute(mat,"3:1","7.2")
  Iup::SetAttribute(mat,"1:2","4.5")
  Iup::SetAttribute(mat,"2:2","8.1")
  Iup::SetAttribute(mat,"3:2","3.4")
  Iup::SetAttribute(mat,"RESIZEMATRIX","YES")
  Iup::SetAttribute(mat,"MARKMODE","LINCOL")
  Iup::SetAttribute(mat,"MULTIPLE","YES")
  Iup::SetAttribute(mat,"AREA","NOT_CONTINUOUS")

  create_mat = mat
END FUNCTION


' Main program

  Iup::Open()       
  Iup::ControlsOpen()

  dlg = Iup::Dialog(create_mat())
  Iup::SetAttribute(dlg, "TITLE", "IupMatrix")
  Iup::ShowXY(dlg,IUP_CENTER,IUP_CENTER)
  Iup::MainLoop ()
  Iup::Close () 
END



Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
IUP Linux and Windows - Build 10
« Reply #33 on: January 18, 2012, 07:43:49 PM »
BUILD 10

This release includes the additional IUP controls, cd (canvas draw) with OpenGL support. I will be exposing the cd functions in the next release under its own module cd:: in the iup.bas import file.

Quote
CD is a platform-independent graphics library. Its drivers are implemented in several platforms, some use portable code, others use native graphics libraries, such as Microsoft Windows (GDI and GDI+) and X-Windows (XLIB).

The library contains functions to support both vector and image applications, and the visualization surface can be either a canvas or a more abstract surface, such as Clipboard, Metafile, PS, and so on.

Furthermore, the list of parameters of the CD primitive functions contains only the geometrical descriptions of the objects (line, circle, text, etc.). Where these objects should appear and what is the their color, thickness, etc. are defined as current state variables stored in the visualization surfaces. That is, the library is visualization-surface oriented, meaning that all attributes are stored in each visualization surface.

 I setup a Ubuntu 11.10 32 bit instance on Amazon and compiled a SB IUP extension module for 32 bit Linux. I haven't tested it yet but it compiled fine. I have to setup a vnc remote desktop with my EC2 instance and haven't had time to do that yet. If someone running a 32 version of Ubuntu can give this a quick try, it would be appreciated. If you need a 32 bit Linux runtime version of ScriptBasic, you can get it HERE.

You may have noticed there is no Windows version of Build 10. I have to rebuild my Windows IUP setup and with the little interest on that platform, Windows can wait until I get around to it. There are so many versions of Basic for Windows, it's hard for me to justify investing much time to that platform.
« Last Edit: January 18, 2012, 09:00:03 PM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #34 on: January 19, 2012, 11:08:53 AM »
It may seem slow going with getting the ScriptBasic IUP binding done but I'm taking my time to make sure the interface remains a natural extension to the language keeping it's typeless high level functionality intact. The cd graphics side of this is going to be a lot of fun based on what I have read so far in the IUP CD documentation. The IM (Image Representation, Storage, Capture and Processing) part of the IUP binding is the last installment to complete.

I hope the OS X native driver is released soon. Gtk on the Mac is a temporary solution IMO.

 

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #35 on: January 26, 2012, 10:19:38 PM »
ScriptBasic does graphics! Here is a quick test of the CD (Canvas Draw) API in action.

Code: [Select]
IMPORT iup.bas

Iup::Open()

ican = Iup::Canvas()
Iup::SetAttribute(ican, "RASTERSIZE", "800x600")
Iup::SetAttribute(ican, "BORDER", "NO")

dlg = Iup::Dialog(Iup::Vbox(ican))
Iup::SetAttribute(dlg, "TITLE", "Mandelbrot Set")

Iup::Map(dlg)

ccan = CD::CreateCanvas(CD::ContextIup(), ican)

Iup::Show(dlg)

przelx = 3 / 800
przely = 2 / 600

FOR x = 1 TO 800
  FOR y = 1 TO 600
    a = 0
    b = 0
    c = 0
    x2 = (przelx * x) - 2
    y2 = (przely * y) - 1
    petla:
    a2 = a * a - b * b
    b2 = 2 * a * b
    a = a2 + x2
    b = b2 + y2
    z = a * a + b * b
    IF z < 4 AND c < 255 THEN
      c = c + 1
      GOTO petla
    END IF
    IF c = 255 THEN
      pixclr = CD::EncodeColor(0, 0, 0)
    ELSE
      g = 255 - c
      pixclr = CD::EncodeColor(g, g, g)
      ' Color version
      ' pixclr = (g+64) * g * (g+16)
    END IF
    CD::CanvasPixel(ccan, x, y, pixclr)
  NEXT y
NEXT x

Iup::MainLoop()
Iup::Close()
END

« Last Edit: February 01, 2012, 02:50:56 PM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #36 on: January 27, 2012, 10:45:57 AM »
I hope to get BUILD 11 out this weekend for Linux (32/64) and Windows 32.

You could create a VirtualBox on your Windows PC and run Ubuntu 32 in it for testing and experimentation. Ubuntu has a dual boot option that uses a portion of your NTFS Windows file system so you don't need to partition your disk. If your PC is new enough and can boot off a USB drive, that is another great way to run Linux as a secondary OS.


Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #37 on: January 29, 2012, 09:07:13 AM »
The graphics will be available in build 11. The build 10 release just enabled additional controls. (matrix, dial, color select, ...)

It won't be long. The CD API is pretty extensive and wrapping / testing it takes time.

To find out what IUP functions are enabled in the SB IUP extension module, look at the iup.bas include file.

I hope to get a SB version of the IUP docs on the SB wiki when I finish the interface code.
« Last Edit: January 29, 2012, 04:59:23 PM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #38 on: February 21, 2012, 07:50:38 AM »
Sorry Ron for the delay with BUILD 11. No snags with IUP/CD, only with real life commitments.

I will try to have something up this week.


Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #39 on: October 18, 2012, 06:47:14 PM »
I now have Windows 7 64 bit installed and will be picking back up with the IUP project on both Windows and Linux platforms in 64 bit only.

Stay Tuned!

Kirkkaf

  • Guest
Re: IUP Linux and Windows
« Reply #40 on: November 22, 2012, 08:35:21 AM »
I am happy to see ScriptBasic supports Canvas Draw.

Kirk
« Last Edit: November 22, 2012, 08:45:14 AM by Kirkkaf »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #41 on: November 22, 2012, 10:13:36 AM »
I have very little of the IUP CD API wrapped at the moment for the SB extension module. The CD (Canvas Draw) API is HUGE and is going to take some time to add it's features to the SB IUP extension module. I need to finish the core IUP callback interface first.


Kirkkaf

  • Guest
Re: IUP Linux and Windows
« Reply #42 on: November 22, 2012, 10:24:07 AM »
I am looking for a GUI with graphical functionality for a project I have been planning, so I will keep a look out on this thread. 

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: IUP Linux and Windows
« Reply #43 on: November 22, 2012, 11:44:02 AM »
If you have a C background, I would be happy to turn over the CD part of the extension module for you to wrap. I have a lot going with little help from the community.

Kirkkaf

  • Guest
Re: IUP Linux and Windows
« Reply #44 on: November 23, 2012, 04:33:04 AM »
Unfortunately my C skills are lacking, my background is from Python, so I may not be of any use for the time being.