Automatic flipping of some icons when system language is right-to-left written.

[GB.FORM.STOCK]
* NEW: Automatic flipping of some icons when system language is right-to-left written.
This commit is contained in:
gambas 2022-03-01 15:46:47 +01:00
parent cdc45fb056
commit 0910d786a3
21 changed files with 134 additions and 7 deletions

View file

@ -6,6 +6,7 @@ Class Image
Class SvgImage
Static Private $cSynonymous As New Collection
Static Private $cRightToLeft As Collection
Static Private $bDebug As Boolean
@ -34,17 +35,45 @@ Static Private Sub Stretch(hImage As Image, iSize As Integer) As Image
End
Static Private Sub LoadIcon(sKey As String, iSize As Integer, sStock As String) As Image
Dim sPath As String
Static Private Sub LoadRightToLeft()
sPath = sStock &/ CStr(iSize) &/ sKey
If System.RightToLeft And If Exist(sPath & "-rtl.png") Then sPath &= "-rtl"
If $bDebug And If iSize = 32 And If Not Exist(sPath & ".png") Then Error "gb.form.stock: unknown icon: " & sKey
Return Image.Load(sPath & ".png")
Dim sKey As String
$cRightToLeft = New Collection
For Each sKey In Split(File.Load("no-reverse"), "\n")
sKey = Trim(sKey)
If Not sKey Then Continue
If sKey Begins ";" Then Continue
$cRightToLeft[sKey] = True
Next
End
Static Private Sub LoadIcon(sKey As String, iSize As Integer, sStock As String) As Image
Dim sPath As String
Dim hImage As Image
Dim bMirror As Boolean
sPath = sStock &/ CStr(iSize) &/ sKey
If $bDebug And If iSize = 32 And If Not Exist(sPath & ".png") Then Error "gb.form.stock: unknown icon: " & sKey
'If System.RightToLeft And If Exist(sPath & "-rtl.png") Then sPath &= "-rtl"
If System.RightToLeft Then
If Not $cRightToLeft Then LoadRightToLeft
If $cRightToLeft.Exist(sKey) Then
If Exist(sPath & "-rtl.png") Then
sPath &= "-rtl"
Else
bMirror = True
Endif
Endif
Endif
hImage = Image.Load(sPath & ".png")
If bMirror Then hImage = hImage.Mirror(True, False)
Return hImage
End
Static Public Sub LoadImage(sKey As String, iSize As Integer, Optional sStock As String) As Image

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

View file

@ -0,0 +1,98 @@
attach
audio
battery
bicycle
bookmark
brush
call
clear
cloud
color-picker
computer
connect
copy
crop
cut
desktop
development
difference
disconnect
download
draw-arrow
draw-line
draw-path
edit
energy
erase
exclusive
fill
find
group
hardware
hatch
highlight
indent
internet
intersection
join-bevel
join-miter
join-round
key
keyboard
language
layout
link
lower
monitor
muted
options
pen
people
pin
plane
plugin
pointer
preview
raise
rename
replace
scanner
science
shopping
sort-ascent
sort-descent
statistics
tablet
template
text-baseline
text-bigger
text-bottom
text-line-spacing
text-list
text-list-order
text-middle
text-smaller
text-top
tools
town
transparency
trash-full
unindent
union
unlock
user-group
view-detail
view-tree
volume-high
volume-low
volume-medium
volume
walk
window
wizard
wrap
zoom-fit
zoom-in
zoom-normal
zoom-out
zoom-width