[GB.FORM]
* NEW: Support for Breeze and Breeze-dark icon themes. git-svn-id: svn://localhost/gambas/trunk@7070 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
145f4c1442
commit
5439c54a58
4 changed files with 103 additions and 65 deletions
|
@ -1,7 +1,7 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.7.90
|
||||
Title=More controls for graphical components
|
||||
Startup=FSpinBar
|
||||
Startup=Main
|
||||
Version=3.7.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
|
|
|
@ -195,6 +195,8 @@ Public Sub Main()
|
|||
' Print hTask.Value
|
||||
Dim hPict As Picture
|
||||
|
||||
hPict = Picture["icon:/48/development"]
|
||||
'Application.Theme = "kde5"
|
||||
|
||||
hPict = Picture["icon:/48/recent"]
|
||||
|
||||
End
|
||||
|
|
|
@ -109,13 +109,18 @@ Static Private Sub AddPath(sMap As String, sPath As String, Optional sPattern As
|
|||
If Not Exist(sPath) Then Return
|
||||
|
||||
If Not sPattern Then
|
||||
aDir = Dir(sPath, "[1-9]*", gb.Directory)
|
||||
If aDir.Count > 0 And If aDir[0] Like "*[1-9]x[1-9]*" Then
|
||||
sPattern = "&1x&1!&2"
|
||||
Else If Exist(sPath &/ "scalable") Then
|
||||
sPattern = "&1x&1!&2"
|
||||
|
||||
If File.Name(sPath) Begins "breeze" Then
|
||||
sPattern = "*"
|
||||
Else
|
||||
sPattern = "&2!&1"
|
||||
aDir = Dir(sPath, "[1-9]*", gb.Directory)
|
||||
If aDir.Count > 0 And If aDir[0] Like "*[1-9]x[1-9]*" Then
|
||||
sPattern = "&1x&1!&2"
|
||||
Else If Exist(sPath &/ "scalable") Then
|
||||
sPattern = "&1x&1!&2"
|
||||
Else
|
||||
sPattern = "&2!&1"
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
|
||||
|
@ -366,31 +371,81 @@ Static Private Sub GetScalablePath(sPath As String) As String
|
|||
|
||||
End
|
||||
|
||||
Static Private Sub DoLoadIcon(sPath As String, iSize As Integer, iRealSize As Integer) As Picture
|
||||
|
||||
Dim sName As String
|
||||
Dim sDir As String
|
||||
Dim hPict As Picture
|
||||
Dim hImage As Image
|
||||
|
||||
sName = File.Name(sPath)
|
||||
sDir = File.Dir(sPath)
|
||||
|
||||
'If $bDebugLoad Then Error "-> "; sDir &/ sName
|
||||
|
||||
If iRealSize Then
|
||||
|
||||
sName = sName & ".svg" 'File.SetExt(sName, "svg") 'Warning this change is for files than have a point in the name
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iRealSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
sName = File.SetExt(sName, "svgz")
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iRealSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
sName = File.SetExt(sName, "png")
|
||||
Try hImage = Image.Load(sDir &/ sName)
|
||||
If Not Error Then Return hImage.Stretch(iRealSize, iRealSize).Picture
|
||||
|
||||
Else
|
||||
|
||||
sName = sName & ".png" 'File.SetExt(sName, "png") 'Warning this change is for files than have a point in the name
|
||||
Try hImage = Image.Load(sDir &/ sName)
|
||||
If Not Error Then Return hImage.Picture
|
||||
|
||||
sName = File.SetExt(sName, "svg")
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
sName = File.SetExt(sName, "svgz")
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
|
||||
Static Private Sub LoadIcon(sTemplate As String, sFile As String, iSize As Integer, Optional iRealSize As Integer) As Picture
|
||||
|
||||
Dim hImage As Image
|
||||
Dim hPict As Picture
|
||||
Dim sDir As String
|
||||
Dim sName As String
|
||||
Dim sPath As String
|
||||
Dim sTest As String
|
||||
Dim bFound As Boolean
|
||||
Dim iPos As Integer
|
||||
Dim sTheme As String
|
||||
Dim sDir As String
|
||||
Dim sSubDir As String
|
||||
|
||||
If sFile Begins "$(mime)/" Then
|
||||
|
||||
'Debug sTemplate;; sFile;; iSize;; iRealSize
|
||||
|
||||
For Each sTest In ["mimetypes", "mimes"]
|
||||
sPath = Subst(sTemplate, CStr(iSize), sTest)
|
||||
If Exist(sPath) Then
|
||||
sFile = Replace(sFile, "$(mime)", sTest)
|
||||
'Debug "FOUND "; sFile
|
||||
bFound = True
|
||||
Break
|
||||
Endif
|
||||
Next
|
||||
If sTemplate Ends "/*" Then
|
||||
sPath = File.Dir(sTemplate) &/ "mimetypes/file-types-small"
|
||||
sFile = Replace(sFile, "$(mime)", "mimetypes/file-types-small")
|
||||
bFound = IsDir(sPath)
|
||||
Else
|
||||
For Each sTest In ["mimetypes", "mimes"]
|
||||
sPath = Subst(sTemplate, CStr(iSize), sTest)
|
||||
If Exist(sPath) Then
|
||||
sFile = Replace(sFile, "$(mime)", sTest)
|
||||
'Debug "FOUND "; sFile
|
||||
bFound = True
|
||||
Break
|
||||
Endif
|
||||
Next
|
||||
Endif
|
||||
|
||||
If Not bFound Then
|
||||
'Debug "NOT FOUND"
|
||||
|
@ -404,8 +459,8 @@ Static Private Sub LoadIcon(sTemplate As String, sFile As String, iSize As Integ
|
|||
If Left(sFile) = "[" Then
|
||||
iPos = InStr(sFile, "]")
|
||||
If iPos Then
|
||||
sTheme = Mid$(sFile, 2, iPos - 2)
|
||||
If LCase(sTheme) <> LCase(Application.Theme) Then Continue
|
||||
sTheme = LCase(Mid$(sFile, 2, iPos - 2))
|
||||
If File.Name(File.Dir(sTemplate)) Not Like sTheme Then Continue
|
||||
sFile = Mid$(sFile, iPos + 1)
|
||||
Endif
|
||||
Endif
|
||||
|
@ -417,42 +472,23 @@ Static Private Sub LoadIcon(sTemplate As String, sFile As String, iSize As Integ
|
|||
sFile = Left(sFile, -4) & "-ltr"
|
||||
Endif
|
||||
Endif
|
||||
|
||||
sPath = Subst(sTemplate, CStr(iSize), File.Dir(sFile)) &/ File.Name(sFile)
|
||||
|
||||
sName = File.Name(sPath)
|
||||
sDir = File.Dir(sPath)
|
||||
|
||||
'If $bDebugLoad Then Error "-> "; sDir &/ sName
|
||||
|
||||
If iRealSize Then
|
||||
|
||||
sName = sName & ".svg" 'File.SetExt(sName, "svg") 'Warning this change is for files than have a point in the name
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iRealSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
sName = File.SetExt(sName, "svgz")
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iRealSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
sName = File.SetExt(sName, "png")
|
||||
Try hImage = Image.Load(sDir &/ sName)
|
||||
If Not Error Then Return hImage.Stretch(iRealSize, iRealSize).Picture
|
||||
|
||||
If sTemplate Ends "/*" Then
|
||||
sDir = File.Dir(sTemplate) &/ File.Dir(sFile)
|
||||
If IsDir(sDir) Then
|
||||
For Each sSubDir In Dir(sDir, "*", gb.Directory)
|
||||
sPath = sDir &/ sSubDir &/ File.Name(sFile)
|
||||
hPict = DoLoadIcon(sPath, iSize, iRealSize)
|
||||
If hPict Then Return hPict
|
||||
Next
|
||||
sPath = sDir &/ File.Name(sFile)
|
||||
hPict = DoLoadIcon(sPath, iSize, iRealSize)
|
||||
If hPict Then Return hPict
|
||||
Endif
|
||||
Else
|
||||
|
||||
sName = sName & ".png" 'File.SetExt(sName, "png") 'Warning this change is for files than have a point in the name
|
||||
Try hImage = Image.Load(sDir &/ sName)
|
||||
If Not Error Then Return hImage.Picture
|
||||
|
||||
sName = File.SetExt(sName, "svg")
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
sName = File.SetExt(sName, "svgz")
|
||||
Try hPict = PictureFromSvg(SvgImage.Load(sDir &/ sName), iSize)
|
||||
If Not Error Then Return hPict
|
||||
|
||||
sPath = Subst(sTemplate, CStr(iSize), File.Dir(sFile)) &/ File.Name(sFile)
|
||||
hPict = DoLoadIcon(sPath, iSize, iRealSize)
|
||||
If hPict Then Return hPict
|
||||
Endif
|
||||
|
||||
Next
|
||||
|
|
|
@ -2,7 +2,7 @@ access apps/preferences-desktop-accessibility
|
|||
add actions/list-add
|
||||
apply actions/dialog-apply;actions/dialog-ok-apply
|
||||
archive $(mime)/package-x-generic;apps/utilities-file-archiver
|
||||
attach status/mail-attachment
|
||||
attach status/mail-attachment;actions/mail-attachment
|
||||
audio mimetypes/audio-x-generic;mimes/audio-x-generic
|
||||
battery devices/battery
|
||||
book apps/accessories-dictionary
|
||||
|
@ -30,13 +30,13 @@ directory places/folder
|
|||
disconnect actions/network-disconnect
|
||||
down actions/go-down
|
||||
download [elementary]actions/media-import-audio-cd;emblems/emblem-downloads;actions/download
|
||||
edit apps/accessories-text-editor;actions/document-edit
|
||||
edit actions/document-edit;apps/accessories-text-editor
|
||||
eject actions/media-eject
|
||||
end actions/media-skip-forward
|
||||
erase actions/draw-eraser
|
||||
error status/dialog-error
|
||||
exec actions/system-run
|
||||
file mimetypes/empty;mimes/empty;mimetypes/application-x-zerosize;mimes/application-x-zerosize
|
||||
file $(mime)/empty;$(mime)/application-x-zerosize
|
||||
file-manager apps/system-file-manager
|
||||
fill actions/fill-color
|
||||
filter actions/view-filter
|
||||
|
@ -52,7 +52,7 @@ fullscreen actions/view-fullscreen
|
|||
gambas #
|
||||
game categories/applications-games;apps/preferences-desktop-gaming
|
||||
gnu #
|
||||
grid actions/view-grid
|
||||
grid actions/view-grid;actions/games-config-board
|
||||
halt actions/process-stop
|
||||
harddisk devices/drive-harddisk
|
||||
hardware devices/audio-card
|
||||
|
@ -76,18 +76,18 @@ last actions/go-last
|
|||
left actions/go-previous
|
||||
link emblems/emblem-symbolic-link
|
||||
linux #
|
||||
lock status/object-locked
|
||||
lock actions/object-locked;status/object-locked
|
||||
mail apps/evolution-mail;actions/mail-mark-unread
|
||||
make actions/arrow-down
|
||||
make-all actions/arrow-down-double
|
||||
media-player devices/multimedia-player
|
||||
menu apps/alacarte;apps/kmenuedit
|
||||
menu apps/alacarte;apps/kmenuedit;actions/application-menu
|
||||
microphone devices/audio-input-microphone
|
||||
monitor apps/utilities-system-monitor
|
||||
mouse devices/input-mouse
|
||||
multimedia categories/applications-multimedia
|
||||
muted status/audio-volume-muted
|
||||
network places/network-workgroup
|
||||
network status/network-connect;places/network-workgroup
|
||||
new actions/document-new
|
||||
new-dir actions/folder-new
|
||||
new-window actions/window-new
|
||||
|
@ -95,7 +95,7 @@ next actions/go-next;actions/go-next-view
|
|||
office [elementary]categories/applications-other;categories/applications-office
|
||||
ok actions/dialog-ok
|
||||
open actions/document-open
|
||||
open-recent actions/document-open-recent
|
||||
open-recent [breeze*]actions/toolbar/document-open-recent;actions/document-open-recent
|
||||
options categories/preferences-system;actions/configure
|
||||
package apps/system-software-install;apps/preferences-desktop-default-applications
|
||||
paste actions/edit-paste
|
||||
|
@ -152,7 +152,7 @@ text-left actions/format-justify-left
|
|||
text-right actions/format-justify-right
|
||||
text-strike actions/format-text-strikethrough
|
||||
text-underline actions/format-text-underline
|
||||
tools [elementary]categories/applications-developmenent;categories/preferences-system
|
||||
tools [elementary]categories/applications-developmenent;actions/applications-system;categories/applications-system
|
||||
top actions/go-top
|
||||
trash places/user-trash
|
||||
undo actions/edit-undo
|
||||
|
|
Loading…
Reference in a new issue