Recent

Author Topic: Let's make LCL Toolbar Fly!  (Read 13618 times)

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Let's make LCL Toolbar Fly!
« on: November 26, 2014, 10:48:35 am »

Hi guys...I have a good news, but I will tell you a little story, first.It was long time I thought that Lazarus does not have any toolbar that can float.Instead, Lazarus-toolbar even could not be shifted (up / down, left / right).For this reason, I insist on bringing TToolbar2000 (by Jordan Russell) to be run in Lazarus, while in the same time contributing to this: http://wiki.freepascal.org/Current_conversion_projects#Toolbar_2000


But, due the conversion progress of TB2000 package doesn't satisfied me, quickly I switched trying with TToolbar97; Another reason, the Toolbar97 not require the GPL license, so it is compatible with LCL.and I was more excited LGPL project than GPL.
Now I'm in the middle process of that toolbar which I named ToolbarX2. it seems have a bright future, as I can see : LGPL + no competitor in fpc area.  (TB2000&TB07 is only for Delphi).I also planned to add several unique features that were found in TB2000, such as  virtual-control (feature that is the separation between the "container" and "TItem").(source code = http://forum.lazarus.freepascal.org/index.php/topic,21988.msg163344.html#msg163344)

But, then there are things that worries me with ToolbarX2, like:
  • [size=78%] [/size] It is not derived from TToolbar of LCL.  %) It will look ugly in some cases because it does not lets take utilize Theme features from OS. Gradient on the toolbar QT will not appear. Inner-shadow effects / sink on the button (for example,). Also, it will not sync with other widget colors when mixed with such tab,panel,button according to the OS theme. Quickly, my toolbar will appear strange and visually tacky if not a derivative of the toolbar LCL.

  •    I think people would not like For replacing their yet available toolbar (LCL) which has existed in their application with another toolbar that I make, if there is no guarantee that it can reverse back (to LCL). I have had this experience while transforming TToolbar to TToolbar200, it hard to reverse back.

  •    Development would take too much effort for too few achievement.  When you want satay (grilled meat), why should buy a goat?
    = If the target is a detachable toolbar, why should remodel a lot of things?
    Earlier Lazarus's docking was in trouble, but nowadays it is okay.
  • I dont really need to recreate the whole docking/floating mechanism. Using LCL would be enough.

  •   It turn to be more fun when can immediately see an improvisation than wait longer of uncertain result, isn't it?.     
    So its a good time/opportunity to create that component together with the community.
    How funny?





You might guess, that reusing the LCL's toolbar is the solution.And if it's later works, we do not need to tired to reinvent-the-wheel. Your existed Toolbar can be reused, do not need to recreate. Well, yesterday, I do little experiment with TToolbar LCL, in order to float!.I did it because I could not find any Example in Lazarus that allows this to happen.The result is surprising: My LCL Toolbar was flying !  and it can be re-docked to the form.
It done, even with few line of code. and no package installation required.
Isn't it that we expected? of course.

That is the good news.

------------------------------
Well, LCL toolbar can fly nicely.  But I am not satisfied with toolbars arrangement (multiple toolbars allowed in one line) when they are docked in a container. It is not yet finished today.


For summary/conclusion:
At least, we passed the first step:
1.  It can fly.


Finally, if later we know that this floating toolbar to run normally (without crashes, and a great visual appearance), we can proceed to the next stage:2. Re-implement custom DockTree / DockManager, DockZone so that the toolbar can be shifted in the dockbar.(later)
Then I beg you to help me doing a little task:* Help me to know whether the docking/undocking were going well in various OS, Widgetset, Themes?* Please attach screenshot of program that you can download here. It doesn't requires any package, but LCL.   attach 2 screenshot: with undocked toolbars, and the docked ones.   tell whic OS,Widgetset,theme you're using for that screenshot.
Thanks you.
I hope you'll like it.




x2nie
-----------------



edit: I replace with english one.
« Last Edit: November 28, 2014, 08:35:10 am by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Let's make LCL Toolbar Fly!
« Reply #1 on: November 26, 2014, 11:01:49 am »
somebody can translate to english? Thanks you!
Sadly Leledumbo (who could) was seem offline. He was here at few minute ago.



Okay, here the task:


1. It is not perfect, but I hope you will like it.
Then I ask you to help me doing a little task:
* Help me to know whether the docking/undocking were going well in various OS, Widgetset, Themes?
* Please attach screenshot of program that you can download here. It doesn't requires any package, but LCL.
   attach 2 screenshot: with undocked toolbars, and the docked ones.
   tell whic OS,Widgetset,theme you're using for that screenshot.


Later, once we know that this flying toolbar running well (no crash, & good visually), we can step to the next plan:
2. Reimplement custom TDockManager, TDockZone making toolbar movable inside their container.


----------------------------


Okay, my turn first.
Below is appearance of:
Flying toolbar in WinXP, GDI widgetset, Luna Theme
« Last Edit: November 26, 2014, 11:56:56 am by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Let's make LCL Toolbar Fly!
« Reply #2 on: November 26, 2014, 12:11:40 pm »
Quote
somebody can translate to english? Thanks you!

Hi fellows ...
I have good news, but first I want to tell us a bit.


From the beginning I thought that Lazarus' s component does not have a toolbar that can float.
Instead of drifting, Lazarus-toolbar could not even shifted (up / down, left / right).
For this reason, I insist on bringing TToolbar2000 (by Jordan Russell) to be run in Lazarus.
For all contribute to this: http://wiki.freepascal.org/Current_conversion_projects#Toolbar_2000


Well, while the conversion test results are not encouraging TB2000 package, I switched doing TToolbar97;
Another reason is Toolbar97 not require the GPL license, so it is compatible with LCL.
and I was more excited than GPL LGPL project.
Now I'm in the process of the process that I named ToolbarX2,
Rencanya, virtual-control feature that is the separation between the "container" and "TItem" of TB2000 I enter in ToolbarX2.
in this way seems component I will have a bright future in the future,
(source code = http://forum.lazarus.freepascal.org/index.php/topic,21988.msg163344.html#msg163344)


By the way,
Thing that worries me with ToolbarX2 is:

     It is not derived from TToolbar of LCL. It will look ugly in some cases because it does not lets take utilize Theme features of the OS. Gradient on the toolbar QT will not appear. Effects bayang2 / sink on the button (for example,) also will not sync with the theme of the OS. In essence, my toolbar will appear strange and visually tacky if not a derivative of the toolbar LCL.
     I think people would not like For replacing the toolbar (LCL) which has existed in their application with a toolbar that I make if there is no guarantee that it can reverse back (to LCL). The same case with transform TToolbar to TToolbar200, it hard to reverse.
     When you want satay (grilled meat), why should buy a goat? = If the goal is to create a toolbar that has been there before you can float, why should remodel a lot of things? Lazarus first docking in trouble, now is okay.
     It would be more fun like when can immediately see an improvisation than wait longer and the outcome uncertain, khan.
     For this is a good opportunity to create a component-do with the community, from scratch. How funny?

Maybe you can already guess, that wears Directly LCL's toolbar will be a solution.
And if it's later works, we do not need to tired to reinvent-the-wheel. Toolbar you can be reused, do not need to recreate. 8-)

Well, yesterday my little experiment with TToolbar LCL, in order to float!.
This I did because I did not find an example in the Lazarus or topic that allows this to happen.
The result is surprising: It does not take a lot of code. With slight modifications, LCL Toolbar can float and can be re-docked to the form. Had not this which we expect? of course.

1. It's not perfect, but I think it would be what you prefer.
Then I beg you to help me with a small task:
Help me to know that the docking / undock it runs smoothly on various OS, widgetset, theme.
Attach a screenshot of the application that I attach here. It does not need an external package, pure LCL. Attach a screenshot when the toolbar is floating (undocked) and toolbars docked; and say the OS, widgetset, the theme that you're using dlm screenshots page.
Finally, if later we know that this floating toolbar to run normally (without crashes, and a great visual appearance), we can proceed to the next stage:

2. Re-implement custom DockTree / DockManager, DockZone so that the toolbar can be shifted in the dockbar.
(later)

Thank you.
Mudah2an You Like.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Let's make LCL Toolbar Fly!
« Reply #3 on: November 26, 2014, 12:24:38 pm »
@Fred, thank you! It helps.

---------------

I forgot to notice about the importance of visual aspect that you must be noticed too:


1. OS's window title bar vs. emulation one.
1.a)  The technique used in this application is using true window' s appearance.
1.b)  Alternative technique used by non-LCL flying toolbar is emulating window' s titlebar.
        (non-LCL flying toolbar = Toolbar200 & TBX, Toolbar97 / ToolbarEx as well as my ToolbarX2)
1.c)  Their emulation of form's titlebar  seem worse, expecially in Windows7 with Aero Theme activated.
1.d  I hope our LCL flying toolbar would have good appearance when undocked in Aero Theme, as it doesn't emulate titlebar. But I don't know for sure for now.


2. Draggable handle painter.
2.a)   is draggable handle (double vertical bar) painted nicely in various widgetset?
2.b)   I am worry if it not drawn properly such in QT's LCL toolbar.


3. Floating toolbar form.
3.a) due we are using LCL, undocked toolbar's form seem as shown perfectly: toolbar's form always on top mainform.
3.b) the non-LCL flying toolbar (let say my ToolbarX2) has shown as wrong : the toolbar's form may shown below the mainform when compiled in Lazarus, which is not as expected.
Though they are shown perfectly when compiled using Delphi, as they are designed for.


=================

Below is how it running in XP, GDI/Win32 widgetset, Classic Theme.
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Let's make LCL Toolbar Fly!
« Reply #4 on: November 26, 2014, 04:38:03 pm »
1.a)  The technique used in this application is using true window' s appearance.
1.b)  Alternative technique used by non-LCL flying toolbar is emulating window' s titlebar.
        (non-LCL flying toolbar = Toolbar200 & TBX, Toolbar97 / ToolbarEx as well as my ToolbarX2)
1.c)  Their emulation of form's titlebar  seem worse, expecially in Windows7 with Aero Theme activated.
1.d  I hope our LCL flying toolbar would have good appearance when undocked in Aero Theme, as it doesn't emulate titlebar. But I don't know for sure for now.


Yes!! as I guessed. our LCL flying toolbar would have good appearance when undocked in Aero Theme, as it doesn't emulate titlebar. Its proofen by screenshot below.


And for comparison, paired picture shows how the titile bar emulation looked ugly in Aero (and perhaps  in Win8 default theme) which has thick window frame.


see?  :o


So, is here somebody can show me how it looked like in QT (or winkywonka themes) ?
please.  ;D  I am seriously curious.
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Let's make LCL Toolbar Fly!
« Reply #5 on: November 27, 2014, 06:08:46 am »
So, is here somebody can show me how it looked like in QT (or winkywonka themes) ?
please.  ;D  I am seriously curious.
Linux KDE Qt

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Let's make LCL Toolbar Fly!
« Reply #6 on: November 27, 2014, 06:29:31 am »
So, is here somebody can show me how it looked like in QT (or winkywonka themes) ?
please.  ;D  I am seriously curious.
Linux KDE Qt


Wow! the draggable handle (additional custom paint) shown perfectly.
Thanks,
Can you show us the undocked toolbars please? and with the "coloring toolbar" checkbox = unchecked.


edit: hmmmm... No, the draggable handle (vertical) doesn't seem as it was designed.
the hightlight color not drawn, only the shadows/dark one were drawn.
« Last Edit: November 27, 2014, 06:32:40 am by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Let's make LCL Toolbar Fly!
« Reply #7 on: November 27, 2014, 06:55:57 am »
Can you show us the undocked toolbars please? and with the "coloring toolbar" checkbox = unchecked.

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Let's make LCL Toolbar Fly!
« Reply #8 on: November 27, 2014, 09:40:58 pm »
@ x2nie => EXCELLENT:  ;D

I vote for LiteZarus (https://github.com/x2nie/LiteZarus) using code tools + flying lcl widget-Toolbar (and designer included).
« Last Edit: November 27, 2014, 09:53:35 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Let's make LCL Toolbar Fly!
« Reply #9 on: November 28, 2014, 09:43:39 am »
@ x2nie => EXCELLENT:  ;D
Thanks, but it didn't yet complete.
Can you give us screenshot of our LCL flying toolbar in GTK? OSX ?
I vote for LiteZarus (https://github.com/x2nie/LiteZarus) using code tools + flying lcl widget-Toolbar (and designer included).
Talking about LCL, the handle-grip of this toolbar would be nice if is given to widgetset themes to make this "native" per widgetset.
It was already supported by QT[1] and GTK[2]
Unfornatelly, the of handle-grip part aren't supported by current version of LCL, even in particular theme. ( I hope I were wrong)


Here is how toolbar drawn by LCL\QT :
Code: [Select]
// QtThemes.pas
function TQtThemeServices.GetDrawElement(Details: TThemedElementDetails): TQtDrawElement;
...
begin
  Result.DrawVariant := qdvNone;
  case Details.Element of
    ...
    teToolBar:
      begin
        case Details.Part of
          TP_BUTTON,
          TP_DROPDOWNBUTTON,
          TP_SPLITBUTTON: // there is another positibility to draw TP_SPLITBUTTON by CC_ToolButton
            begin
              Result.DrawVariant := qdvPrimitive;
              Result.PrimitiveElement := QStylePE_PanelButtonTool;
            end;
          TP_SPLITBUTTONDROPDOWN:
            begin
              Result.DrawVariant := qdvComplexControl;
              Result.ComplexControl := QStyleCC_ToolButton;
              Result.SubControls := QStyleSC_None;
              Result.Features := QStyleOptionToolButtonMenuButtonPopup;
            end;
          TP_SEPARATOR,
          TP_SEPARATORVERT:
            begin
              Result.DrawVariant := qdvPrimitive;
              Result.PrimitiveElement := QStylePE_IndicatorToolBarSeparator;
            end;
        end;
      end;

There is no line yet in above code, that pointed to QStylePE_IndicatorToolBarHandle (qt45.pas)
which is should be used to draw the drag-handle grip for QT toolbar.
Digging more deep, we found : There is no declaration in LCL theme that can be used by widgetset to do that.


I mean the TOOLBARPARTS (in LCL) should be expanded with such additional TP_DRAGHANDLE thing, before widgetset (such QT) can let theme utilize
Here is the LCL part:

Code: [Select]
// TmSchema.pas

// TOOLBARSTYLE class parts and states


  VSCLASS_TOOLBARSTYLE = 'TOOLBARSTYLE';
  VSCLASS_TOOLBAR      = 'TOOLBAR';


type
  TOOLBARPARTS = longint;


const
  TP_BUTTON      = 1;
  TP_DROPDOWNBUTTON = 2;
  TP_SPLITBUTTON = 3;
  TP_SPLITBUTTONDROPDOWN = 4;
  TP_SEPARATOR   = 5;
  TP_SEPARATORVERT = 6;
  TP_DROPDOWNBUTTONGLYPH = 7;


type
  TOOLBARSTYLEPARTS = TOOLBARPARTS;


type
  TOOLBARSTYLESTATES = longint;


const
  TS_NORMAL   = 1;
  TS_HOT      = 2;
  TS_PRESSED  = 3;
  TS_DISABLED = 4;
  TS_CHECKED  = 5;
  TS_HOTCHECKED = 6;
  TS_NEARHOT  = 7;
  TS_OTHERSIDEHOT = 8;




// TOOLTIPSTYLE class parts and states


  VSCLASS_TOOLTIPSTYLE = 'TOOLTIPSTYLE';
  VSCLASS_TOOLTIP      = 'TOOLTIP';     


Hey, I didn't say that LCL goes wrong, I think LCL does that by design: in case of keep compatibility with Delphi; and there was nothing in Delphi's TToolbar properties that can take advantage of drawing & operate with toolbar's handle-grip (meaning original Delphi toolbar never can fly).
So, I assumed that LCL toolbar will never has a handle-grip nor can fly, while in the same time kept that for compatibility reason.


In other hand, if we need an LCL toolbar that can fly, we should do that in other class name (and let current toolbar compatible).
This new class may :
  • is inherited from TToolbar with additional properties (such Draggable, CanFloat, GripCount, CloseButton, etc.)
  • or just a container for current LCL TToolbar, like GTK2 does [2]
What do you think ?
[1] http://blog.qt.digia.com/wp-content/uploads/2013/04/vertical1.png
[2] http://gtk2-perl.sourceforge.net/doc/gtk2-perl-study-guide/c4832.html

When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Let's make LCL Toolbar Fly!
« Reply #10 on: November 28, 2014, 05:14:00 pm »
Quote
Can you give us screenshot of our LCL flying toolbar in GTK?

=>In attachement => Mint 64 bit.
« Last Edit: November 28, 2014, 05:16:08 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Let's make LCL Toolbar Fly!
« Reply #11 on: October 27, 2015, 10:34:36 am »
Hi gurus !


My LCL component "flying toolbar" is continuing, but no further progress currently.
for month I was stuck on 2 aspect, but with last progress of Lazarus I think today is good day to try again.


So I have 2 question:
1) How to create flying "custom/rich tooltip" which is used in Lazarus editor? Wich unit introduce the form class?
It seem its not common tooltip, because it also has another tooltip. (see attachment)
It is an important part (which is missing) of creating custom "pop-menu", so I will able to imitatate Toolbar2000 custom-made popup-menu & their floating-toolbar.


2) How Doc Manager work? You know, TLazDockingManager and unit LDockCtrl are obsolete and now deprecated. http://wiki.freepascal.org/Anchor_Docking
I want to create a custom-made of DockMaster. But I don't understand how a form will be integrate with dockMaster.


Any suggestion, advice, clue or URL would be very welcome.  8-)

When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Let's make LCL Toolbar Fly!
« Reply #12 on: October 27, 2015, 11:50:18 am »
So I have 2 question:
1) How to create flying "custom/rich tooltip" which is used in Lazarus editor? Wich unit introduce the form class?
It seem its not common tooltip, because it also has another tooltip. (see attachment)
It is an important part (which is missing) of creating custom "pop-menu", so I will able to imitatate Toolbar2000 custom-made popup-menu & their floating-toolbar.

See THintWindowManager in unit IDEHelpIntf in package IdeIntf. It must be in IdeIntf because Object Inspector uses it, too.
Earlier code for help windows was messy and spread around. It was refactored into this class and then bug #20202 was finally fixed.
In the picture you saw a child control + HTML renderer provided by IPro package. Without IPro there is only a text hint.
If you want extensions to THintWindowManager, please upload a patch to bug tracker.

Quote
2) How Doc Manager work? You know, TLazDockingManager and unit LDockCtrl are obsolete and now deprecated. http://wiki.freepascal.org/Anchor_Docking
I want to create a custom-made of DockMaster. But I don't understand how a form will be integrate with dockMaster.

May be tricky. I don't know AnchorDocking well but the CodeTyphon's fork GlassDocking has added some kind of dock master there. I don't know exactly why is it needed.
I compared GlassDocking with AnchorDocking using an advanced diff tool. This was the only substantial difference. Other differences were mostly formatting.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018