Recent

Author Topic: TCoolBar  (Read 52010 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCoolBar
« Reply #45 on: March 02, 2013, 12:07:07 am »
I just checked with Delphi 6.  What Blaazen said seems to be true.  When Break:= False, Bands are continued on the same line.  When Break:= True, the following band is on a new line.
Lazarus Trunk / fpc 2.6.2 / Win32

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: TCoolBar
« Reply #46 on: March 02, 2013, 05:06:53 am »
Oh you mean something like this?

The previous icons show a single band of a coolbar, I chose the folder icon because is most used an easily recognized to be the button on the band.
« Last Edit: March 02, 2013, 06:04:16 am by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: TCoolBar
« Reply #47 on: March 02, 2013, 07:33:11 am »
The last one. I'm out of ideas at this point.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4596
  • I like bugs.
Re: TCoolBar
« Reply #48 on: March 02, 2013, 11:11:31 am »
Thanks taazz!

I used your icon numbers 3 and 7 for TCoolBar and TControlBar. Committed in r40458.
First they looked a little foggy, maybe because of the amount of details, but in the component bar they look very good. Please check and see yourself.

How much time you spend for such pic?

Other improvements for these components are welcome, too. For example CoolBar has a bitmap property but it does not do anything yet.
I must look at the layout algorithm some time.

Regards,
Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: TCoolBar
« Reply #49 on: March 02, 2013, 11:25:56 am »
I'm not an artist so it took me overall 2 hours for all the icons you see here. I have an extensive library of svg files that can be used as icons and a couple icons ready which I combined. The fogginess is a result of the resizing in the icon editor it can be removed but it needs pixel by pixel corrections at that small sizes and I am a bit overwhelmed with my tasks so I opted not to spend more time on them I'll try to clean them up when time permits.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4596
  • I like bugs.
Re: TCoolBar
« Reply #50 on: March 02, 2013, 12:06:21 pm »
The fogginess is a result of the resizing in the icon editor it can be removed but it needs pixel by pixel corrections at that small sizes and I am a bit overwhelmed with my tasks so I opted not to spend more time on them I'll try to clean them up when time permits.

It is not really a problem because the component toolbar shows only small icons. If they could be scaled then it would become a problem.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCoolBar
« Reply #51 on: March 02, 2013, 12:20:51 pm »
I just updated Lazarus and the BiDiMode properties are there as you said.  However, setting BiDiMode:= bdRightToLeft does not mirror the TCoolBar.  Child controls do pick it up as ParentBidiMode, but it looks very strange when part is RightToLeft and part is LeftToRight.
Lazarus Trunk / fpc 2.6.2 / Win32

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: TCoolBar
« Reply #52 on: March 02, 2013, 12:29:08 pm »
For my own app., I designed icons using Inkscape (vectors, *.svg). I convert them to *.png with a command line utility "rsvg" using bash script:
Code: [Select]
#!/bin/bash

for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 64 -h 64 -o ../default64normal/`echo $i | sed -e 's/svg$/png/'`; done

for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 48 -h 48 -o ../default48normal/`echo $i | sed -e 's/svg$/png/'`; done

for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 32 -h 32 -o ../default32normal/`echo $i | sed -e 's/svg$/png/'`; done

for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 24 -h 24 -o ../default24normal/`echo $i | sed -e 's/svg$/png/'`; done

for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 16 -h 16 -o ../default16normal/`echo $i | sed -e 's/svg$/png/'`; done     
I'm pretty sure it come useful when Retina displays will come.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4596
  • I like bugs.
Re: TCoolBar
« Reply #53 on: March 02, 2013, 12:49:57 pm »
I just updated Lazarus and the BiDiMode properties are there as you said.  However, setting BiDiMode:= bdRightToLeft does not mirror the TCoolBar.  Child controls do pick it up as ParentBidiMode, but it looks very strange when part is RightToLeft and part is LeftToRight.

The bands and their associated controls are now top aligned.
The only thing that should be affected is the optional Text in a band. It is now left-aligned and the control is aligned to its right edge.
It should be reversed when BiDiMode <> bdLeftToRight. Is this correct?

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCoolBar
« Reply #54 on: March 02, 2013, 01:18:25 pm »
This is an Image of a RightToLeft TCoolBar.  You will see that everything is Mirrored.  Because it is MSWindows I am using RightToLeftLayout and not BiDiMode.  Under MSWindows, BiDiMode has been obsolete for a long time.
Lazarus Trunk / fpc 2.6.2 / Win32

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCoolBar
« Reply #55 on: March 02, 2013, 01:32:29 pm »
RightToLeftLayout mirrors the Canvas making to origin (0,0) on the Right and increases to the Left.  It also takes care of RightToLeft Text.
Lazarus Trunk / fpc 2.6.2 / Win32

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4596
  • I like bugs.
Re: TCoolBar
« Reply #56 on: March 02, 2013, 02:18:15 pm »
This is an Image of a RightToLeft TCoolBar.  You will see that everything is Mirrored.  Because it is MSWindows I am using RightToLeftLayout and not BiDiMode.  Under MSWindows, BiDiMode has been obsolete for a long time.

Ok, but BiDiMode must be used for this component because it is essentially custom drawn.
Delphi's CoolBar is only a wrapper for the Windows COM component. It desperately tries to communicate with the actual component using messages. If you look at its source code, it is quite a mess. It never worked properly. For example at design-time you can move the associated controls away from their bands which is quite fundamental flaw.
In my custom drawn solution an overridden AlignControls relocates the controls. It prevents them moving, no other logic is needed for that. Clean, right?

I guess Borland realized how problematic this Windows COM component was. That's why they made (or bought) ControlBar which solves similar problems than CoolBar but is pure Pascal.
I wanted to understand how the the layout algorithm in ControlBar works. For some reason its code is also a big mess. For example it uses nested "with" statements, both of them referring to variables of same type but different instance. Uhhh!
I used a feature found in Cody package to explode those "with" statements, then I refactored the code to split the nearly 1000 line functions into smaller pieces. Still, even after debugging the code I did not understand how it worked!
My diagnosis is that it has a big amount of useless code, originally made for some other purpose.
Maybe they bought it from some hacker who then disappeared, and then nobody dared to touch the code. It has bugs that still have not been fixed in the 10+ years.

Delphi has lots of good design and code, but it also has some horribly low quality code.
That is why it bothers me sometimes that everything in LCL must be compatible with VCL, including bugs. No, we can do better.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCoolBar
« Reply #57 on: March 02, 2013, 02:42:51 pm »
<quote>
Delphi has lots of good design and code, but it also has some horribly low quality code.
</quote>

Haha! Yes, I couldn't agree more :)  It seems that at some point Delphi stopped improving existing code and concentrated on adding huge amounts of new business related capabilities.  The problem being that if the core foundation doesn't work, the new capabilities can't work either.

I understand that BiDiMode must remain a part of Lazarus.  Partly for Delphi comparability and I'm guessing that it may be a requirement for non-MSWindows OS's as well.  But RightToLeftLayout needs to be part of Lazarus for MSWindows.  It solves far more problems than it creates and BiDiMode simply is not adequate. 

Just an example:  TPageControl can not be mirrored with BiDiMode so you end up with a mix of RightToLeft and LeftToRight controls and that is not acceptable. But RightToLeftLayout works perfectly.
« Last Edit: March 02, 2013, 02:53:21 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: TCoolBar
« Reply #58 on: March 02, 2013, 03:42:05 pm »
Actually tcontrolbar was in delphi long before the TCoolbar component was introduced and I think they were forced in to TCoolBar because the look and feel wasn't as hip and trendy as the latest and greatest from MS at that time when IE5 became the standard in 90% of windows installation some one implemented TCoolBar.

In any case LCL has its own little quirks take for instance the resize mess and the endless loops you end up with, the moment you try to re size your own internal components. I still haven't rapt my head around that piece of code.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCoolBar
« Reply #59 on: March 02, 2013, 04:08:05 pm »
This has nothing to do with RightToLeft.  I just tried TCoolBar.AutoSize = True with a TEdit in Band 0.  I got the following Error:

TControl.ChangeBounds loop detected Edit1:TEdit Left=53, Top=3, Widrh=409, Height=24 NewLeft=53, NewTop=-2, NewWidth=409, NewHeight=24
« Last Edit: March 02, 2013, 04:27:13 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

 

TinyPortal © 2005-2018