View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006756 | MMW v4 | Framework: Scripts/Extensions | public | 2010-11-27 19:50 | 2011-04-11 18:45 |
Reporter | zvezdan | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | assigned | Resolution | open | ||
Summary | 0006756: A way to get binary data for icons of current skin needed | ||||
Description | Simplest solution would be to add ISDBTreeNode::Image and ISDBMenuItem::Image properties to API which would contain pointer to binary data of an icon. | ||||
Additional Information | I have several scripts which allow users to choose which icon would want to assign to some tree node or toolbar button. Those icons are represented in script's UI with their icon index, i.e. in form of plain number. It would be nicer if I could display all available built-in tree/menu icons inside of some Web browser ActiveX control. I could include related .ico files from MM site within my add-on packages, but there is only one available icon set for Glided skin. It would be much better if script could display icons from the current skin using API. If you add suggested ISDBTreeNode::Image, then we could use following code for one menu icon: Dim oMenuItem Sub OnStartup() Set oMenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0) oMenuItem.Visible = False End Sub Sub SaveIconData(nIconIndex) Dim oIconFile oMenuItem.IconIndex = nIconIndex Set oIconFile = SDB.Tools.FileSystem.CreateTextFile("C:\SomeFileName.ico", True) oIconFile.WriteData oMenuItem.Image.ImageData, oMenuItem.Image.ImageDataLen oIconFile.Close End Sub and latter in html of ActiveX control: <img src="C:\SomeFileName.ico"> Even better, with IE 8+ images could be Base64 encoded and stored inline in Web pages, so we don't need to save them temporary to hard disk, for example: <img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> | ||||
Tags | No tags attached. | ||||
Fixed in build | |||||
|
I'm guessing that scripter can use this: ----- Function Base64Encode(inData) 'rfc1521 '2001 Antonin Foller, Motobit Software, http://Motobit.cz Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" Dim cOut, sOut, I 'For each group of 3 bytes For I = 1 To Len(inData) Step 3 Dim nGroup, pOut, sGroup 'Create one long from this 3 bytes. nGroup = &H10000 * Asc(Mid(inData, I, 1)) + _ &H100 * MyASC(Mid(inData, I + 1, 1)) + MyASC(Mid(inData, I + 2, 1)) 'Oct splits the long To 8 groups with 3 bits nGroup = Oct(nGroup) 'Add leading zeros nGroup = String(8 - Len(nGroup), "0") & nGroup 'Convert To base64 pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _ Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _ Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _ Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1) 'Add the part To OutPut string sOut = sOut + pOut 'Add a new line For Each 76 chars In dest (76*3/4 = 57) 'If (I + 2) Mod 57 = 0 Then sOut = sOut + vbCrLf Next Select Case Len(inData) Mod 3 Case 1: '8 bit final sOut = Left(sOut, Len(sOut) - 2) + "==" Case 2: '16 bit final sOut = Left(sOut, Len(sOut) - 1) + "=" End Select Base64Encode = sOut End Function Function MyASC(OneChar) If OneChar = "" Then MyASC = 0 Else MyASC = Asc(OneChar) End Function --------- You can use INI file structure as Skin file for your scripts that will directly generate Valid HTML Let me know if you need example. |
|
It seems that you are missing a point. I don't have a problem converting binary data to Base64, I already have the source code for such thing. I have a problem with argument to that function - it is a pointer to some binary data representing MM image/icon which we don't have in API. |