All my code is crap!!! Even I say so. It might work but it's uglier than Idles's shamefully abused sheep collection!!What about code, while it works it's probably not a total crap^^
Lobsterclock
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Lobsterclock
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: Lobsterclock
I've moved on to boats for old goats, she's on the hard and just had the last licks of anti foul added todayFangbeast wrote:All my code is crap!!! Even I say so. It might work but it's uglier than Idles's shamefully abused sheep collection!!What about code, while it works it's probably not a total crap^^
1st race next Saturday, 12 hours on the water, hopeful for 30kt winds, so we can ride the beast hard and fast
and beat her home to finish as well shagged old goats.
.
Windows 11, Manjaro, Raspberry Pi OS


- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Lobsterclock
LOLOLOLO!!idle wrote:I've moved on to boats for old goats, she's on the hard and just had the last licks of anti foul added todayFangbeast wrote:All my code is crap!!! Even I say so. It might work but it's uglier than Idles's shamefully abused sheep collection!!What about code, while it works it's probably not a total crap^^
1st race next Saturday, 12 hours on the water, hopeful for 30kt winds, so we can ride the beast hard and fast
and beat her home to finish as well shagged old goats.
.
Hope we get some pictures??? (I was hoping you were reading, haven't heard from you in ages and I need more humour)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: Lobsterclock
There'll be pictures and video of the race online but hopefully non of us wiping out, forecast is looking like it'll be prime weather for a few hairy incidentsFangbeast wrote:LOLOLOLO!!idle wrote:I've moved on to boats for old goats, she's on the hard and just had the last licks of anti foul added todayFangbeast wrote:All my code is crap!!! Even I say so. It might work but it's uglier than Idles's shamefully abused sheep collection!!What about code, while it works it's probably not a total crap^^
1st race next Saturday, 12 hours on the water, hopeful for 30kt winds, so we can ride the beast hard and fast
and beat her home to finish as well shagged old goats.
.
Hope we get some pictures??? (I was hoping you were reading, haven't heard from you in ages and I need more humour)
and some wipe outs or the forecast could be completely wrong and it'll be like a high tea and biscuits cruise with rum.
Still have lots to do to the boat before splash down wednesday and a bloody rat ate holes in the *FRO Bro. (*fractional code zero)
I'll take a look at your code to get back to topic!
Windows 11, Manjaro, Raspberry Pi OS


- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Lobsterclock
Oh noes!! Don't look at this lot. It was just simple stuff to try to get me into doing some serious stuff. It did get me going and I will try to make it better but I am working on something more serious until I get bored again.I'll take a look at your code to get back to topic!
And when the new kitten stops trying to eat me.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Lobsterclock
It was just a quick attempt to make a big clock for my bad eyes. Nothing special.RSBasic wrote:Your clock is nice.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Lobsterclock (and Huawei phone themes)
Don't know how far I am going with this (or even if I have the skill) but....I need a little manager for my Huawei theme files and doing Lobsterclock inspired me to get all my many Mate 9 themes under control.
Still tons to do but the code should give you all a basic idea. Don't bitch at me about the lack of supplied graphics, the program isn't finished and you can find your own.
At the moment, the program is just a glorified viewer of the details of the currently highlighted thmes and the first two images if available).
Renaming is coming next to a button near you.
Still tons to do but the code should give you all a basic idea. Don't bitch at me about the lack of supplied graphics, the program isn't finished and you can find your own.
At the moment, the program is just a glorified viewer of the details of the currently highlighted thmes and the first two images if available).
Renaming is coming next to a button near you.
Code: Select all
UseJPEGImageDecoder()
UsePNGImageDecoder()
Define EventID, MenuID, GadgetID, WindowID
Enumeration 1
#Window_Themecat
EndEnumeration
#WindowIndex = #PB_Compiler_EnumerationValue
Enumeration 1
#MenuBar_Themecat_Files
#Gadget_Themecat_Directories
#Gadget_Themecat_Themes
#Gadget_Themecat_Previews
#Gadget_Themecat_Image1
#Gadget_Themecat_Image2
#Gadget_Themecat_cControl
#Gadget_Themecat_cStatusbar
#Gadget_Themecat_iHeading
#Gadget_Themecat_Heading
#Gadget_Themecat_iMessages
#Gadget_Themecat_Messages
#Gadget_Themecat_iCurrent
#Gadget_Themecat_Current
#Gadget_Themecat_iRecords
#Gadget_Themecat_Records
#Gadget_Themecat_Edit
#Gadget_Themecat_Delete
#Gadget_Themecat_Print
#Gadget_Themecat_Preview
#Gadget_Themecat_Send
#Gadget_Themecat_Image24_28_29
#Gadget_Themecat_Image24_28_30
#Gadget_Themecat_Image24_28_31
#Gadget_Themecat_Image24_28_32
#Gadget_Themecat_Image24_28_33
#Gadget_Themecat_Exit
#Gadget_Themecat_lNormaltitle
#Gadget_Themecat_Normaltitle
#Gadget_Themecat_lChinesetitle
#Gadget_Themecat_Chinesetitle
#Gadget_Themecat_lAuthor
#Gadget_Themecat_Author
#Gadget_Themecat_lDesigner
#Gadget_Themecat_Designer
#Gadget_Themecat_lScreenaspect
#Gadget_Themecat_Screenaspect
#Gadget_Themecat_lVersion
#Gadget_Themecat_Version
#Gadget_Themecat_lFont
#Gadget_Themecat_Font
#Gadget_Themecat_lChinesefont
#Gadget_Themecat_Chinesefont
#Gadget_Themecat_lBriefinfo
#Gadget_Themecat_Briefinfo
EndEnumeration
#GadgetIndex = #PB_Compiler_EnumerationValue
Enumeration 1
#MenuBar_Themecat
EndEnumeration
#MenuBarIndex = #PB_Compiler_EnumerationValue
Enumeration 1
#Image_Themecat_Image1
#Image_Themecat_Image2
#Image_Themecat_iHeading
#Image_Themecat_iMessages
#Image_Themecat_iCurrent
#Image_Themecat_iRecords
#Image_Themecat_Edit
#Image_Themecat_Delete
#Image_Themecat_Print
#Image_Themecat_Preview
#Image_Themecat_Send
#Image_Themecat_Image24_28_29
#Image_Themecat_Image24_28_30
#Image_Themecat_Image24_28_31
#Image_Themecat_Image24_28_32
#Image_Themecat_Image24_28_33
#Image_Themecat_Exit
EndEnumeration
#ImageIndex = #PB_Compiler_EnumerationValue
CatchImage(#Image_Themecat_Image1,?_OPT_Themecat_Image1)
CatchImage(#Image_Themecat_Image2,?_OPT_Themecat_Image1)
CatchImage(#Image_Themecat_iHeading,?_OPT_Themecat_iHeading)
CatchImage(#Image_Themecat_iMessages,?_OPT_Themecat_iMessages)
CatchImage(#Image_Themecat_iCurrent,?_OPT_Themecat_iCurrent)
CatchImage(#Image_Themecat_iRecords,?_OPT_Themecat_iRecords)
CatchImage(#Image_Themecat_Edit,?_OPT_Themecat_Edit)
CatchImage(#Image_Themecat_Delete,?_OPT_Themecat_Delete)
CatchImage(#Image_Themecat_Print,?_OPT_Themecat_Print)
CatchImage(#Image_Themecat_Preview,?_OPT_Themecat_Preview)
CatchImage(#Image_Themecat_Send,?_OPT_Themecat_Send)
CatchImage(#Image_Themecat_Image24_28_29,?_OPT_Themecat_Edit)
CatchImage(#Image_Themecat_Image24_28_30,?_OPT_Themecat_Edit)
CatchImage(#Image_Themecat_Image24_28_31,?_OPT_Themecat_Edit)
CatchImage(#Image_Themecat_Image24_28_32,?_OPT_Themecat_Edit)
CatchImage(#Image_Themecat_Image24_28_33,?_OPT_Themecat_Edit)
CatchImage(#Image_Themecat_Exit,?_OPT_Themecat_Exit)
DataSection
_OPT_Themecat_Image1:
IncludeBinary "Images\_Other\NoPicture.jpg"
_OPT_Themecat_iHeading:
IncludeBinary "Images\_16x16\Status.ico"
_OPT_Themecat_iMessages:
IncludeBinary "Images\_16x16\Messages.ico"
_OPT_Themecat_iCurrent:
IncludeBinary "Images\_16x16\Current.ico"
_OPT_Themecat_iRecords:
IncludeBinary "Images\_16x16\Records.ico"
_OPT_Themecat_Edit:
IncludeBinary "Images\_54x54\Edit.png"
_OPT_Themecat_Delete:
IncludeBinary "Images\_54x54\Delete.png"
_OPT_Themecat_Print:
IncludeBinary "Images\_54x54\Print.png"
_OPT_Themecat_Preview:
IncludeBinary "Images\_54x54\Preview.png"
_OPT_Themecat_Send:
IncludeBinary "Images\_54x54\Send.png"
_OPT_Themecat_Exit:
IncludeBinary "Images\_54x54\Exit.png"
EndDataSection
Procedure.i Window_Themecat()
If OpenWindow(#Window_Themecat, 29, 54, 1220, 805, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible)
CreateImageMenu(#MenuBar_Themecat, WindowID(#Window_Themecat))
MenuTitle("Files")
ExplorerTreeGadget(#Gadget_Themecat_Directories, 5, 5, 230, 670, "*.hwt", #PB_Explorer_BorderLess|#PB_Explorer_AlwaysShowSelection|#PB_Explorer_NoFiles|#PB_Explorer_NoDriveRequester|#PB_Explorer_NoMyDocuments|#PB_Explorer_AutoSort)
SetGadgetFont(#Gadget_Themecat_Directories, LoadFont(#Gadget_Themecat_Directories, "Segoe Print", 10, 0))
ExplorerListGadget(#Gadget_Themecat_Themes, 240, 5, 530, 670, "", #PB_Explorer_BorderLess|#PB_Explorer_AlwaysShowSelection|#PB_Explorer_FullRowSelect|#PB_Explorer_NoFolders|#PB_Explorer_NoParentFolder|#PB_Explorer_NoDirectoryChange|#PB_Explorer_NoDriveRequester|#PB_Explorer_NoMyDocuments|#PB_Explorer_AutoSort)
SetGadgetFont(#Gadget_Themecat_Themes, LoadFont(#Gadget_Themecat_Themes, "Segoe Print", 10, 0))
ContainerGadget(#Gadget_Themecat_Previews, 775, 5, 440, 670, #PB_Container_BorderLess)
ImageGadget(#Gadget_Themecat_Image1, 0, 0, 215, 330, ImageID(#Image_Themecat_Image1))
ResizeGadget(#Gadget_Themecat_Image1, 0, 0, 215, 330)
ResizeImage(#Image_Themecat_Image1, 215, 330)
SetGadgetState(#Gadget_Themecat_Image1, ImageID(#Image_Themecat_Image1))
ImageGadget(#Gadget_Themecat_Image2, 220, 0, 215, 330, ImageID(#Image_Themecat_Image2))
ResizeGadget(#Gadget_Themecat_Image2, 220, 0, 215, 330)
ResizeImage(#Image_Themecat_Image2, 215, 330)
SetGadgetState(#Gadget_Themecat_Image2, ImageID(#Image_Themecat_Image2))
TextGadget(#Gadget_Themecat_lNormaltitle, 0, 345, 95, 20, "Normal title", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lNormaltitle, LoadFont(#Gadget_Themecat_lNormaltitle, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Normaltitle, 100, 345, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Normaltitle, LoadFont(#Gadget_Themecat_Normaltitle, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lChinesetitle, 0, 375, 95, 20, "Chinese title", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lChinesetitle, LoadFont(#Gadget_Themecat_lChinesetitle, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Chinesetitle, 100, 375, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Chinesetitle, LoadFont(#Gadget_Themecat_Chinesetitle, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lAuthor, 0, 405, 95, 20, "Author", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lAuthor, LoadFont(#Gadget_Themecat_lAuthor, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Author, 100, 405, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Author, LoadFont(#Gadget_Themecat_Author, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lDesigner, 0, 435, 95, 20, "Designer", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lDesigner, LoadFont(#Gadget_Themecat_lDesigner, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Designer, 100, 435, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Designer, LoadFont(#Gadget_Themecat_Designer, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lScreenaspect, 0, 465, 95, 20, "Screen aspect", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lScreenaspect, LoadFont(#Gadget_Themecat_lScreenaspect, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Screenaspect, 100, 465, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Screenaspect, LoadFont(#Gadget_Themecat_Screenaspect, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lVersion, 0, 495, 95, 20, "Version", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lVersion, LoadFont(#Gadget_Themecat_lVersion, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Version, 100, 495, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Version, LoadFont(#Gadget_Themecat_Version, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lFont, 0, 525, 95, 20, "Font", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lFont, LoadFont(#Gadget_Themecat_lFont, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Font, 100, 525, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Font, LoadFont(#Gadget_Themecat_Font, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lChinesefont, 0, 555, 95, 20, "Chinese font", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lChinesefont, LoadFont(#Gadget_Themecat_lChinesefont, "Segoe Print", 8, 0))
StringGadget(#Gadget_Themecat_Chinesefont, 100, 555, 335, 20, "", #PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetFont(#Gadget_Themecat_Chinesefont, LoadFont(#Gadget_Themecat_Chinesefont, "Segoe Print", 8, 0))
TextGadget(#Gadget_Themecat_lBriefinfo, 0, 585, 95, 20, "Brief info", #PB_Text_Center)
SetGadgetFont(#Gadget_Themecat_lBriefinfo, LoadFont(#Gadget_Themecat_lBriefinfo, "Segoe Print", 8, 0))
EditorGadget(#Gadget_Themecat_Briefinfo, 100, 585, 335, 80, #PB_Editor_ReadOnly|#PB_Editor_WordWrap)
SetGadgetFont(#Gadget_Themecat_Briefinfo, LoadFont(#Gadget_Themecat_Briefinfo, "Segoe Print", 8, 0))
CloseGadgetList()
ContainerGadget(#Gadget_Themecat_cControl, 5, 680, 1210, 70, #PB_Container_BorderLess)
ImageGadget(#Gadget_Themecat_Edit, 5, 5, 54, 54, ImageID(#Image_Themecat_Edit))
ImageGadget(#Gadget_Themecat_Delete, 65, 5, 54, 54, ImageID(#Image_Themecat_Delete))
ImageGadget(#Gadget_Themecat_Print, 125, 5, 54, 54, ImageID(#Image_Themecat_Print))
ImageGadget(#Gadget_Themecat_Preview, 185, 5, 54, 54, ImageID(#Image_Themecat_Preview))
ImageGadget(#Gadget_Themecat_Send, 245, 5, 54, 54, ImageID(#Image_Themecat_Send))
ImageGadget(#Gadget_Themecat_Image24_28_29, 305, 5, 54, 54, ImageID(#Image_Themecat_Image24_28_29))
ImageGadget(#Gadget_Themecat_Image24_28_30, 365, 5, 54, 54, ImageID(#Image_Themecat_Image24_28_30))
ImageGadget(#Gadget_Themecat_Image24_28_31, 425, 5, 54, 54, ImageID(#Image_Themecat_Image24_28_31))
ImageGadget(#Gadget_Themecat_Image24_28_32, 485, 5, 54, 54, ImageID(#Image_Themecat_Image24_28_32))
ImageGadget(#Gadget_Themecat_Image24_28_33, 545, 5, 54, 54, ImageID(#Image_Themecat_Image24_28_33))
ImageGadget(#Gadget_Themecat_Exit, 1145, 5, 54, 54, ImageID(#Image_Themecat_Exit))
CloseGadgetList()
ContainerGadget(#Gadget_Themecat_cStatusbar, 5, 755, 1210, 25, #PB_Container_BorderLess)
ImageGadget(#Gadget_Themecat_iHeading, 0, 5, 16, 16, ImageID(#Image_Themecat_iHeading))
TextGadget(#Gadget_Themecat_Heading, 20, 0, 85, 20, "")
SetGadgetFont(#Gadget_Themecat_Heading, LoadFont(#Gadget_Themecat_Heading, "Segoe Print", 9, 0))
ImageGadget(#Gadget_Themecat_iMessages, 110, 5, 16, 16, ImageID(#Image_Themecat_iMessages))
TextGadget(#Gadget_Themecat_Messages, 130, 0, 815, 20, "")
SetGadgetFont(#Gadget_Themecat_Messages, LoadFont(#Gadget_Themecat_Messages, "Segoe Print", 9, 0))
ImageGadget(#Gadget_Themecat_iCurrent, 950, 5, 16, 16, ImageID(#Image_Themecat_iCurrent))
TextGadget(#Gadget_Themecat_Current, 970, 0, 105, 20, "")
SetGadgetFont(#Gadget_Themecat_Current, LoadFont(#Gadget_Themecat_Current, "Segoe Print", 9, 0))
ImageGadget(#Gadget_Themecat_iRecords, 1080, 5, 16, 16, ImageID(#Image_Themecat_iRecords))
TextGadget(#Gadget_Themecat_Records, 1100, 0, 105, 20, "")
SetGadgetFont(#Gadget_Themecat_Records, LoadFont(#Gadget_Themecat_Records, "Segoe Print", 9, 0))
CloseGadgetList()
HideWindow(#Window_Themecat, 0)
ProcedureReturn WindowID(#Window_Themecat)
EndIf
EndProcedure
; My personal constants
#Author = "Miklos G Bolvary" ; Author's name
#CopyRight = "MGB Technical Services 2017 " ; Copyright holder
#Basename = "Themecat " ; Base name for initialisation file and database
#Version = "v1." ; Program version
#Program = #Basename + #Version ; Copyright string
#Fish = "<°)))o><²³ " ; Beware the fish!!
;
#NoFileHandle = #False ;
#DirectoryNotCreated = #False ;
#FileNotDecompressed = #False ;
#FileIsDirectory = -2 ;
#NoListItems = 0 ;
#FirstItemInList = 0 ;
#EmptyString = "" ;
;
Structure ProgramData ;
QuitValue.i ;
Currentdirectory.s ; GetCurrentDirectory()
Themedirectory.s ; Currentdirectory.s + "Themes\"
Temporarydirectory.s ; Currentdirectory.s + "Temporary\"
Mate7.s ; Currentdirectory.s + Themedirectory.s + "Mate 7\"
Mate8.s ; Currentdirectory.s + Themedirectory.s + "Mate 8\"
Mate9.s ; Currentdirectory.s + Themedirectory.s + "Mate 9\"
EndStructure ;
;
Structure TrackingData ;
CurrentThemeDirectory.s ;
CurrentThemeItems.i ;
CurrentThemeLine.i ;
CurrentThemeName.s ;
EndStructure ;
;
Structure HwTheme ;
title.s ;
titlecn.s ;
author.s ;
designer.s ;
screen.s ;
version.s ;
font.s ;
fontcn.s ;
briefinfo.s ;
EndStructure ;
;
Global Program.ProgramData ;
Global Tracking.TrackingData ;
Global Themes.HwTheme ;
;
Program\Currentdirectory.s = GetCurrentDirectory() ;
Program\Themedirectory.s = Program\Currentdirectory.s + "Themes\" ;
Program\Temporarydirectory.s = Program\Currentdirectory.s + "Temporary\" ;
Program\Mate7.s = Program\Themedirectory.s + "Mate 7\" ;
Program\Mate8.s = Program\Themedirectory.s + "Mate 8\" ;
Program\Mate9.s = Program\Themedirectory.s + "Mate 9\" ;
;
CreateDirectory(Program\Temporarydirectory.s) ;
;
UseZipPacker() ;
Declare ChangeThemeDirectory() ;
Declare ExpandTheme(Filename.s) ;
Declare GetCurrentThemeInfo() ;
Declare ProcessDirectory(Directory.s) ;
Declare ReadThemeXml(XmlFilename.s, Filename.s) ;
Declare SetInfoBarArea(FieldName.s, FieldStatus.s, MessageContent.s = "0", ModuleName.s = "") ;
;
Procedure ChangeThemeDirectory()
;
Tracking\CurrentThemeDirectory.s = GetGadgetText(#Gadget_Themecat_Directories)
;
SetGadgetText(#Gadget_Themecat_Themes, Tracking\CurrentThemeDirectory)
;
Tracking\CurrentThemeItems.i = CountGadgetItems(#Gadget_Themecat_Themes)
;
If Tracking\CurrentThemeItems.i <> #NoListItems
SetGadgetState(#Gadget_Themecat_Themes, #FirstItemInList)
SetInfoBarArea("Current", #EmptyString, "0", #PB_Compiler_Procedure)
SetInfoBarArea("Themes", #EmptyString, Str(Tracking\CurrentThemeItems.i), #PB_Compiler_Procedure)
Else
SetInfoBarArea("Current", #EmptyString, "?", #PB_Compiler_Procedure)
SetInfoBarArea("Themes", #EmptyString, "0", #PB_Compiler_Procedure)
EndIf
;
EndProcedure
;
Procedure.i ExpandTheme(Filename.s)
;
Protected ResultFlag.i, PackHandle.i, Currentfile.s
;
PackHandle.i = OpenPack(#PB_Any, Filename.s, #PB_PackerPlugin_Zip)
Currentfile.s = GetFilePart(Filename.s)
;
CreateDirectory(Program\Temporarydirectory.s)
;
If PackHandle.i <> #NoFileHandle
;
If ExaminePack(PackHandle.i)
;
;ResultFlag.i = #True
;
While NextPackEntry(PackHandle.i); And ResultFlag.i
; If entry is a directory, create it
If PackEntryType(PackHandle.i) = #PB_Packer_Directory
;
CurrentPackEntryName.s = ReplaceString(PackEntryName(PackHandle.i), "/", "\", #PB_String_NoCase, 1)
;Debug "Current entry directory is: " + CurrentPackEntryName.s
If CreateDirectory(Program\Temporarydirectory.s + CurrentPackEntryName.s) = #DirectoryNotCreated
SetInfoBarArea("Headings", "Error", "Could not create: " + Program\Temporarydirectory.s + CurrentPackEntryName.s, #PB_Compiler_Procedure)
EndIf
; If entry is a file, extract it
ElseIf PackEntryType(PackHandle.i) = #PB_Packer_File
;
; Debug "Current entry name is: " + PackEntryName(PackHandle.i)
;
; Debug Program\Temporarydirectory.s + CurrentPackEntryName.s + "\" + PackEntryName(PackHandle.i)
;
; Debug "------------------------------------------------------------"
If UncompressPackFile(PackHandle.i, Program\Temporarydirectory.s + PackEntryName(PackHandle.i)) = #FileNotDecompressed
SetInfoBarArea("Headings", "Error", "Could not extract: " + Program\Temporarydirectory.s + CurrentPackEntryName.s, #PB_Compiler_Procedure)
EndIf
;
EndIf
;
Wend
;
Else
SetInfoBarArea("Headings", "Error", GetFilePart(Filename.s) + " could not be examined", #PB_Compiler_Procedure)
EndIf
;
ClosePack(PackHandle.i)
;
If FileSize(Program\Temporarydirectory.s + "description.xml") > 0
ReadThemeXml(Program\Temporarydirectory.s + "description.xml", Filename.s)
Else
SetInfoBarArea("Headings", "Error", Currentfile.s + " is missing a description.xml??", #PB_Compiler_Procedure)
EndIf
;
Else
SetInfoBarArea("Headings", "Error", GetFilePart(Currentfile.s) + " could not be opened", #PB_Compiler_Procedure)
EndIf
;
If DeleteDirectory(Program\Temporarydirectory.s, "*.*", #PB_FileSystem_Recursive | #PB_FileSystem_Force) = 0
SetInfoBarArea("Headings", "Error", "Could not delete: " + Program\Temporarydirectory.s, #PB_Compiler_Procedure)
EndIf
;
ProcedureReturn ResultFlag.i
;
EndProcedure
;
Procedure GetCurrentThemeInfo()
;
Tracking\CurrentThemeLine.i = GetGadgetState(#Gadget_Themecat_Themes)
Tracking\CurrentThemeName.s = GetGadgetItemText(#Gadget_Themecat_Themes, Tracking\CurrentThemeLine.i, 0)
;
SetInfoBarArea("Headings", "Info", "Expanding and reading: " + Tracking\CurrentThemeName.s, #PB_Compiler_Procedure)
SetInfoBarArea("Current", #EmptyString, Str(Tracking\CurrentThemeLine.i), #PB_Compiler_Procedure)
;
ExpandTheme(Tracking\CurrentThemeDirectory + Tracking\CurrentThemeName.s)
;
SetGadgetText(#Gadget_Themecat_Normaltitle, Themes\title.s)
SetGadgetText(#Gadget_Themecat_Chinesetitle, Themes\titlecn.s)
SetGadgetText(#Gadget_Themecat_Author, Themes\author.s)
SetGadgetText(#Gadget_Themecat_Designer, Themes\designer.s)
SetGadgetText(#Gadget_Themecat_Screenaspect, Themes\screen.s)
SetGadgetText(#Gadget_Themecat_Version, Themes\version.s)
SetGadgetText(#Gadget_Themecat_Font, Themes\font.s)
SetGadgetText(#Gadget_Themecat_Chinesefont, Themes\fontcn.s)
SetGadgetText(#Gadget_Themecat_Briefinfo, Themes\briefinfo.s)
;
EndProcedure
; Process a directory full of Huawei theme files
Procedure ProcessDirectory(Directory.s)
;
Protected DirectoryId.i, TypeOfFile.i, Filename.s
;
DirectoryId.i = ExamineDirectory(#PB_Any, Directory.s, "*.hwt")
;
If DirectoryId.i
Repeat
TypeOfFile.i = NextDirectoryEntry(DirectoryId.i)
Filename.s = DirectoryEntryName(DirectoryId.i)
If TypeOfFile.i = #True
ExpandTheme(Directory.s + DirectoryEntryName(DirectoryId.i))
EndIf
Until TypeOfFile.i = #False
EndIf
;
EndProcedure
;
Procedure ReadThemeXml(XmlFilename.s, Filename.s)
;
Xmlloaded.i = LoadXML(#PB_Any, Xmlfilename.s)
;
If XmlLoaded.i
;
CurrentPath.s = GetPathPart(Filename.s)
CurrentFile.s = GetFilePart(Filename.s)
Xmlokay.i = XMLStatus(Xmlloaded.i)
;
If Xmlokay.i <> #PB_XML_Success
;
Messagestring.s = "Error in the XML file:" + #CR$ +
"File: " + XmlFilename.s + #CR$ +
"Message: " + XMLError(Xmlokay.i) + #CR$ +
"Line: " + Str(XMLErrorLine(Xmlokay.i)) +
" Character: " + Str(XMLErrorPosition(Xmlokay.i))
MessageRequester("Error", Messagestring.s)
Else
;
Xmlstring.s = ComposeXML(XmlLoaded.i)
;
If Xmlstring.s
;
Newtree.i = ParseXML(#PB_Any, Xmlstring.s)
;
If Newtree.i And XMLStatus(Newtree.i) = #PB_XML_Success
;
ExtractXMLStructure(MainXMLNode(Newtree.i), @Themes, HwTheme)
;
CoverImage.i = LoadImage(#PB_Any, Program\Temporarydirectory.s + "preview\cover.jpg")
If CoverImage.i
NewCoverImageHandle.i = ResizeImage(CoverImage.i, 215, 330, #PB_Image_Smooth)
If NewCoverImageHandle.i
SetGadgetState(#Gadget_Themecat_Image1, NewCoverImageHandle.i)
Else
SetInfoBarArea("Headings", "Error", "Could not resize the cover image and refit it to the display", #PB_Compiler_Procedure)
EndIf
Else
SetInfoBarArea("Headings", "Error", "There is no cover image or it could not be loaded", #PB_Compiler_Procedure)
EndIf
PreviewImage.i = LoadImage(#PB_Any, Program\Temporarydirectory.s + "preview\preview_icons_0.jpg")
If PreviewImage.i
NewPreviewImageHandle.i = ResizeImage(PreviewImage.i, 215, 330, #PB_Image_Smooth)
If NewPreviewImageHandle.i
SetGadgetState(#Gadget_Themecat_Image2, NewPreviewImageHandle.i)
Else
SetInfoBarArea("Headings", "Error", "Could not resize the preview image and refit it to the display", #PB_Compiler_Procedure)
EndIf
Else
SetInfoBarArea("Headings", "Error", "There is no preview image or it could not be loaded", #PB_Compiler_Procedure)
EndIf
;
; If RenameFile(Filename.s, CurrentPath.s + Themes\title.s)
;
; SetInfoBarArea("Headings", "Info", "Renamed: " + CurrentFile.s + " to: " + Themes\title.s + ".Hwt", #PB_Compiler_Procedure)
;
; Debug "------------------------------"
;
; Debug "Filename: " + CurrentFile.s
;
; Debug "Normal title: " + Themes\title.s
;
; Debug "Chinese title: " + Themes\titlecn.s
;
; Debug "Author: " + Themes\author.s
;
; Debug "Designer: " + Themes\designer.s
;
; Debug "Screen aspect: " + Themes\screen.s
;
; Debug "Version: " + Themes\version.s
;
; Debug "Font: " + Themes\font.s
;
; Debug "Chinese font: " + Themes\fontcn.s
;
; Debug "Brief info: " + Themes\briefinfo.s
;
; Else
;
; SetInfoBarArea("Headings", "Error", "Could not rename: " + CurrentFile.s + " to: " + Themes\title.s + ".Hwt", #PB_Compiler_Procedure)
;
; EndIf
;
Else
SetInfoBarArea("Headings", "Error", "Could not parse the xml string from " + XmlFilename.s + ", error: " + XMLError(Newtree.i), #PB_Compiler_Procedure)
EndIf
;
Else
SetInfoBarArea("Headings", "Error", Xmlstring.s + " not extracted from " + XmlFilename.s, #PB_Compiler_Procedure)
EndIf
;
EndIf
;
FreeXML(Xmlloaded.i)
;
Else
SetInfoBarArea("Headings", "Error", XmlFilename.s + " could not be loaded", #PB_Compiler_Procedure)
EndIf
;
EndProcedure
; Send messages and error reports to the fake status bar area
Procedure SetInfoBarArea(FieldName.s, FieldStatus.s, MessageContent.s = "0", ModuleName.s = "")
; Select the name of the field to put our heading string
Select FieldName.s
; Select the correct heading by the status field
Case "Headings"
; This is the field status heading and message
Select FieldStatus.s
Case "Welcome"
MessageHeader.s = "Welcome"
Colour.i = $DB3D24
Case "Button"
MessageHeader.s = "Button tool tip"
Colour.i = $00008B
Case "Info"
MessageHeader.s = "Information"
Colour.i = $DB3D24
Case "Warn"
MessageHeader.s = "Warning"
Colour.i = $7D1F82
Case "Error"
MessageHeader.s = "Error"
Colour.i = $0402FB
EndSelect
; Send all the strings to the fake status bar area
SetGadgetText(#Gadget_Themecat_Heading, MessageHeader.s + ">>")
SetGadgetText(#Gadget_Themecat_Messages, MessageContent.s)
SetGadgetColor(#Gadget_Themecat_Messages, #PB_Gadget_FrontColor, Colour.i)
; This is the current record number field
Case "Current"
;
SetGadgetText(#Gadget_Themecat_Current, "Theme " + MessageContent.s)
; This is the number of displayed records field
Case "Themes"
; Figure out the correct spelling for the record field for singles or multiples
If Val(MessageContent.s) = 0
RecordHeader.s = "Themes"
ElseIf Val(MessageContent.s) = 1
RecordHeader.s = "Theme"
ElseIf Val(MessageContent.s) > = 2
RecordHeader.s = "Themes"
EndIf
; Set the record number details in the fake status bar area
SetGadgetText(#Gadget_Themecat_Records, MessageContent.s + " " + RecordHeader.s)
;
EndSelect
;
EndProcedure
;
If Window_Themecat()
;
RemoveGadgetColumn(#Gadget_Themecat_Themes, 3)
RemoveGadgetColumn(#Gadget_Themecat_Themes, 2)
RemoveGadgetColumn(#Gadget_Themecat_Themes, 1)
;
SetGadgetItemAttribute(#Gadget_Themecat_Themes, 0, #PB_Explorer_ColumnWidth, 512, 0)
;
SetGadgetText(#Gadget_Themecat_Directories, Program\Mate9.s)
SetGadgetText(#Gadget_Themecat_Themes, "*.hwt")
; Set the fake statusbar heading appropriate for the run time of the program
SetInfoBarArea("Headings", "Welcome", "Welcome to " + #Program, "MainModule")
;
PostEvent(#PB_Event_Gadget, #Window_Themecat, #Gadget_Themecat_Directories, #PB_EventType_Change)
;
Repeat
EventID = WaitWindowEvent()
MenuID = EventMenu()
GadgetID = EventGadget()
WindowID = EventWindow()
Select EventID
Case #PB_Event_CloseWindow
Select WindowID
Case #Window_Themecat : Program\QuitValue = #True
EndSelect
Case #PB_Event_Menu
Select MenuID
EndSelect
Case #PB_Event_Gadget
Select GadgetID
Case #Gadget_Themecat_Directories
Select EventType()
Case #PB_EventType_Change : ChangeThemeDirectory()
EndSelect
Case #Gadget_Themecat_Themes
Select EventType()
Case #PB_EventType_Change : GetCurrentThemeInfo()
EndSelect
Case #Gadget_Themecat_Edit
Case #Gadget_Themecat_Delete
Case #Gadget_Themecat_Print
Case #Gadget_Themecat_Preview
Case #Gadget_Themecat_Send
Case #Gadget_Themecat_Exit
EndSelect
EndSelect
Until Program\QuitValue
CloseWindow(#Window_Themecat)
EndIf
End
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet