Recent

Author Topic: Ribbon-like control for Lazarus  (Read 84565 times)

spook

  • New Member
  • *
  • Posts: 18
Re: Ribbon-like control for Lazarus
« Reply #45 on: June 19, 2011, 04:15:11 pm »
I had a hard time deciding, whether repaint whole toolbar or not. I tested the idea by filling whole toolbar (1440px) with small buttons and the component refreshed itself fast enough (AFAIR it was an 2.3 Ghz Intel with Windows Vista onboard). If it does not, one shall implement a mechanism, which would repaint only changed areas. I thought also about doublebuffering, but the component is being drawn on bitmap rather than on canvas, so it would consume a noticable amount of memory.

I'm on a vacation right now, so I may respond with a delay and I have no PC here, so I'll not be able to look into the sources. However, I'll keep track of this thread for sure.

I also want to thank all of you, who participate in developing this control further. It's good to see the control alive again :) I hope, that it'll eventually became useful for the Lazarus community. Keep up the good work, folks :)

Best regards -- Spook.

JD

  • Hero Member
  • *****
  • Posts: 1907
Re: Ribbon-like control for Lazarus
« Reply #46 on: June 20, 2011, 12:14:14 am »
To show the demo app in the IDE apply the attached patch to Lazarus (svn version)
How do I do this?
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Re: Ribbon-like control for Lazarus
« Reply #47 on: June 20, 2011, 04:09:23 am »
Quote
How do I do this?

Nevermind. I updated the design time editor in svn

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Re: Ribbon-like control for Lazarus
« Reply #48 on: June 20, 2011, 10:52:49 pm »
With the last version of svn i fixed the know bugs and is now perfect pixel with the Delphi version (the lack of transparency in some icons is not related to the control). Warning: tested only in Windows

As pointed previously the control is pretty heavy when compared to Delphi. This is because Lazarus does not has Scanline so is necessary to copy the bitmap buffer to a TLazIntfImg, manipulate the pixels and them copy back to the bitmap. This ocurs several times at each redraw.

There's a lot of room to optimization but for now i don't have time necessary to improve the performance. I plan only do some cleanup i have in mind. Anyway i think i did what promised. Enjoy.

JD

  • Hero Member
  • *****
  • Posts: 1907
Re: Ribbon-like control for Lazarus
« Reply #49 on: June 21, 2011, 12:02:09 am »
There's a lot of room to optimization but for now i don't have time necessary to improve the performance. I plan only do some cleanup i have in mind. Anyway i think i did what promised. Enjoy.

Thanks for the time & effort you put into this.  :D
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

lainz

  • Guest
Re: Ribbon-like control for Lazarus
« Reply #50 on: June 21, 2011, 01:56:44 am »
With the last version of svn i fixed the know bugs and is now perfect pixel with the Delphi version (the lack of transparency in some icons is not related to the control). Warning: tested only in Windows

As pointed previously the control is pretty heavy when compared to Delphi. This is because Lazarus does not has Scanline so is necessary to copy the bitmap buffer to a TLazIntfImg, manipulate the pixels and them copy back to the bitmap. This ocurs several times at each redraw.

There's a lot of room to optimization but for now i don't have time necessary to improve the performance. I plan only do some cleanup i have in mind. Anyway i think i did what promised. Enjoy.

And what using BGRABitmap library?

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Re: Ribbon-like control for Lazarus
« Reply #51 on: June 21, 2011, 03:41:31 am »
Quote
And what using BGRABitmap library?

It's one option but changing to it will not automatically improve performance. It's necessary to change the paint strategy (avoid copying bitmap buffer data in each low level operation)

Anyway you can try yourself and show us what you get

Shebuka

  • Sr. Member
  • ****
  • Posts: 429
Re: Ribbon-like control for Lazarus
« Reply #52 on: June 21, 2011, 03:58:18 pm »
Hi, have you see that Office 2011 for Mac has also it's ribbon toolbar, and it's look exactly as yours!

JD

  • Hero Member
  • *****
  • Posts: 1907
Re: Ribbon-like control for Lazarus
« Reply #53 on: June 21, 2011, 04:02:09 pm »
Hi, have you see that Office 2011 for Mac has also it's ribbon toolbar, and it's look exactly as yours!

Good news...!?  :-X
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

lainz

  • Guest
Re: Ribbon-like control for Lazarus
« Reply #54 on: June 21, 2011, 05:54:31 pm »
Quote
And what using BGRABitmap library?

It's one option but changing to it will not automatically improve performance. It's necessary to change the paint strategy (avoid copying bitmap buffer data in each low level operation)

Anyway you can try yourself and show us what you get

http://wiki.lazarus.freepascal.org/BGRAControls#TBGRAVirtualScreen

"The principle is to draw on a memory bitmap.
The component has a specific event, OnRedraw, which is called when the whole bitmap needs to be redrawn. It happens at the beginning, when resizing and when the Redraw method is called.
Otherwise, it is possible to modify the Bitmap property and call Invalidate or Repaint, to avoid erasing the whole bitmap content."

So you can draw the background only when really needed and draw the mouse over, clicked states in Bitmap without full repaint.
« Last Edit: June 21, 2011, 05:56:11 pm by lainz »

spook

  • New Member
  • *
  • Posts: 18
Re: Ribbon-like control for Lazarus
« Reply #55 on: June 24, 2011, 10:48:10 pm »
This is because Lazarus does not has Scanline(...)

Wow, that's a shock for me. Why is it so? I believe, that the WinAPI itself contains a few functions designed to allow the developer access to the raw bitmap data.

Best regards -- Spook.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Ribbon-like control for Lazarus
« Reply #56 on: June 24, 2011, 11:41:38 pm »
AFAIK there's no Scanline because it is windows only.

TBGRABitmap have something similar, and I've read good comments about it.

wcleyton

  • Jr. Member
  • **
  • Posts: 80
Re: Ribbon-like control for Lazarus
« Reply #57 on: June 30, 2011, 03:31:58 pm »
Tradução do português para inglês
Good morning,

Spktoolbar installed the package and when I include a button through design, with the error: "Access Violation".

Menu -> Add item -> spkLargeButton
Menu -> Add item -> spkSmallButton

 I am using Win XP and Lazarus-0.9.31-31448-fpc-2.5.1-20110629-win32.exe

 This is a problem only in Win XP?

jezko

  • Newbie
  • Posts: 1
Re: Ribbon-like control for Lazarus
« Reply #58 on: November 11, 2011, 10:14:35 am »
Good Morning,

I installed Spook-Toolbar and was quite happy how good the components in design mode are working. But when starting my app, I got in deep performance problems with my SQL (ZEOSLIB 7.0 latest brunch) and screen functions. I'm using Lazarus-0.9.31-33448-fpc-2.4.4-20111110-win32 and as said ZEOSLIB for database-operation.

So I deleted the Spook-Toolbar from my forms and the performance is as fast as I knew it before using the toolbar.

I'm not sure why this happens but I think there are a lot refresh options when using the toolbar.

Sincerly
  Jürgen


Mando

  • Full Member
  • ***
  • Posts: 181
Re: Ribbon-like control for Lazarus
« Reply #59 on: November 11, 2011, 10:50:52 am »
I had a similar problem with one of my compents. It put code to repaint It in the resize event. This event is executed every time the  the form is refreshed, and other componet is drawn, and of course when the form is resized. That make the form very slow. The solution: remove repaint from the resize event.

Perhaps this is the solution of this component. I have not checked the code, is a suggestion
Is this behavior a Lazarus' bug? !!!!!.

Regards.
« Last Edit: November 11, 2011, 10:53:43 am by Mando »

 

TinyPortal © 2005-2018