Recent

Author Topic: LCL-CustomDrawn substitutes LCL-Android  (Read 83542 times)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
LCL-CustomDrawn substitutes LCL-Android
« on: November 30, 2011, 10:03:23 pm »
Hello,

Porting the LCL for Android has been a quite hard task, so I started with an architecture which proved itself a bad choice and now I changed it radically to a much better solution. So LCL-CustomDrawn-Android is the new architecture which is here to stay for porting the LCL to Android and other smartphones and the old LCL-Android is obsolete and will be removed.

The new architecture has the following features:
*Backends for X11, Android and Windows and a partially working one for Cocoa, more can be added in the future
*Painting is done completely inside Lazarus without any interference from the native libraries except for text drawing. This assures a complete perfection of the executed drawings in all platforms and a uniform level of supported features
*Only 1 native window is utilized for each form, in the Android backend at the moment this is 1 native window for the entire application
*Utilizes the Lazarus Custom Drawn Controls for implementing the LCL standard controls
*Utilizes as it's painting engine the lcl parts: TLazIntfImage, TRawImage, lazcanvas and lazregions

For more details about LCL-CustomDrawn-Android see:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android
« Last Edit: December 01, 2011, 07:20:38 am by felipemdc »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #1 on: December 01, 2011, 03:05:50 am »
Nice idea, Felipe. I also agree with this. Android seems has different point of view regarding GUI architecture (activity vs form, etc.) and that's contradictive with current LCL approach. I'll try as soon as possible.

herux

  • Full Member
  • ***
  • Posts: 102
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #2 on: December 01, 2011, 06:38:55 am »
Cool  8), I will try it soon

mschnell

  • Full Member
  • ***
  • Posts: 131
    • http://www.lumino.de
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #3 on: December 01, 2011, 02:04:47 pm »
*Backends for X11, Android and Windows and a partially working one for Cocoa, more can be added in the future
*Painting is done completely inside Lazarus without any interference from the native libraries except for text drawing. This assures a complete perfection of the executed drawings in all platforms and a uniform level of supported features

This sounds a lot like the fpGUI LCLWidgetType. How is same related ?

-Michael

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #5 on: December 01, 2011, 03:42:28 pm »
Nice idea, Felipe. I also agree with this. Android seems has different point of view regarding GUI architecture (activity vs form, etc.) and that's contradictive with current LCL approach.

Except for the need to save the application state when going to background, I don't see any incompatibility. I still have to verify what exactly that will mean for us and what will need to be done / extended to support this.

About Activity, the vast majority of Android applications have only 1 activity and the second activity is usually a crash logger.

herux

  • Full Member
  • ***
  • Posts: 102
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #6 on: December 01, 2011, 04:45:56 pm »
hello felipe, my library can not loaded, as shown in the logs below
Code: [Select]
12-01 15:28:34.208: I/lclproject(433): Trying to load liblclapp.so
12-01 15:28:34.248: D/dalvikvm(433): Trying to load lib /data/data/com.pascal.lcltest/lib/liblclapp.so 0x405154d8
12-01 15:28:34.298: E/lclproject(433): WARNING: Could not load liblclapp.so
12-01 15:28:34.328: W/System.err(433): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]:    33 cannot locate 'iconv_open'...
12-01 15:28:34.328: W/System.err(433): at java.lang.Runtime.loadLibrary(Runtime.java:434)
12-01 15:28:34.348: W/System.err(433): at java.lang.System.loadLibrary(System.java:554)
12-01 15:28:34.348: W/System.err(433): at com.pascal.lcltest.LCLActivity.<clinit>(LCLActivity.java:73)
12-01 15:28:34.348: W/System.err(433): at java.lang.Class.newInstanceImpl(Native Method)
12-01 15:28:34.348: W/System.err(433): at java.lang.Class.newInstance(Class.java:1409)
12-01 15:28:34.348: W/System.err(433): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-01 15:28:34.398: W/System.err(433): at android.os.Handler.dispatchMessage(Handler.java:99)
12-01 15:28:34.398: W/System.err(433): at android.os.Looper.loop(Looper.java:123)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-01 15:28:34.408: W/System.err(433): at java.lang.reflect.Method.invokeNative(Native Method)
12-01 15:28:34.408: W/System.err(433): at java.lang.reflect.Method.invoke(Method.java:507)
12-01 15:28:34.408: W/System.err(433): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-01 15:28:34.431: W/System.err(433): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-01 15:28:34.431: W/System.err(433): at dalvik.system.NativeStart.main(Native Method)

I have checked the file
Code: [Select]
$ file liblclapp.so
liblclapp.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped

I use this fpc version, does it cause?
Code: [Select]
Free Pascal Compiler version 2.6.0rc1 [2011/11/11] for arm
Copyright (c) 1993-2011 by Florian Klaempfl and others
/home/herux/Documents/fpcsvn/tags/release2_6_0/compiler/ppcrossarm [options] <inputfile> [options]
Put + after a boolean switch option to enable it, - to disable it
  -a     The compiler doesn't delete the generated assembler file
      -al        List sourcecode lines in assembler file
      -an        List node info in assembler file
      -ap        Use pipes instead of creating temporary assembler files
      -ar        List register allocation/release info in assembler file
      -at        List temp allocation/release info in assembler file



LA.Center

  • Full Member
  • ***
  • Posts: 244
    • LA.Center
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #8 on: December 03, 2011, 11:50:12 pm »
felipemdc, does this mean that we can now paint on the form? Which controls are supported? please forgive if maybe a dumb question.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #9 on: December 04, 2011, 09:55:39 am »
felipemdc, does this mean that we can now paint on the form?

Yes. TForm.OnPaint is supported. TCustomControl descendents which draw themselves are also supported. Multiple levels of controls inside controls are also supported, and also OnMouseDown, OnMouseUp, OnMouseMove

Quote
Which controls are supported? please forgive if maybe a dumb question.

Only TButton (without text), TCheckBox (without text), TArrow, TProgressBar and TTrackBar

http://wiki.lazarus.freepascal.org/Roadmap#Status_of_native_controls_on_each_widgetset

Adding controls is very simple and easy, but the major problem is that we lack text support, so for many controls it gets pointeless to add them before text support is finished.

If you need any particular control just say and I can add it before other ones, but keep in mind that I estimate that it might take some months to get text rendering to work properly.

Jonathan

  • New Member
  • *
  • Posts: 40
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #10 on: December 05, 2011, 09:28:19 am »
Hi ,felipemdc ! I build the project meeting an error:
Code: [Select]
Options changed, recompiling clean with -B
Hint: Start of reading config file /home/hyy/.fpc.cfg
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Hint: End of reading config file /home/hyy/.fpc.cfg
Error: Illegal parameter: -WR

Thank you!
« Last Edit: December 05, 2011, 09:42:56 am by Jonathan »

LA.Center

  • Full Member
  • ***
  • Posts: 244
    • LA.Center
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #11 on: December 05, 2011, 09:40:50 am »
Could I use small text images, on the button, or as label for example. I only need about 10 basic controls (Label, Button, TextEdit, Memo, Listbox, checkbox, trackbar, progressbar, panel, image) and something I can paint on.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #12 on: December 05, 2011, 09:55:00 am »
Hi ,felipemdc ! I build the project meeting an error:

Which compiler are you using? Which lpi file are you building? Which Lazarus version do you have?

Jonathan

  • New Member
  • *
  • Posts: 40
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #13 on: December 05, 2011, 10:07:53 am »
I build the cross_compiler as http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM. This Cross_Compileer works in Your Prev Project : New OpenGL Android Example . FPC:2.6.0; lpi file:androidlcltest.lpi .;lazarus revesion:33966.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #14 on: December 05, 2011, 10:11:57 am »
I build the cross_compiler as http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM. This Cross_Compileer works in Your Prev Project : New OpenGL Android Example . FPC:2.6.0; lpi file:androidlcltest.lpi .;lazarus revesion:33966.

Strange, you can try to simply remove -WR from the "Project Options", it is there in one of the pages.

But in general I recommend using a compiler from aprox. 19th January 2011 FPC 2.5.1 trunk as explained here: http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Free_Pascal_Bugs_on_Android_Support
« Last Edit: December 05, 2011, 10:16:40 am by felipemdc »

 

TinyPortal © 2005-2018