editor:RegisterImage() usage?

71 views
Skip to first unread message

zetah

unread,
Feb 3, 2013, 1:52:44 PM2/3/13
to scite-i...@googlegroups.com
I was trying to display little 16x8 XPM image in autocompletion dropdown list, by following this: http://www.scintilla.org/ScintillaDoc.html#SCI_REGISTERRGBAIMAGE

So in my Lua startup script I registered sample image:

    function OnOpen()

        int_bmp = [[/* XPM */
    static char *int_bmp[] = {
    /* columns rows colors chars-per-pixel */
    "16 8 128 2 ",
    "   c #9999FF",
    ".  c #9999FF",
    ...]]

        editor:RegisterImage(1, int_bmp)
        ...
    end



And in my api file I added string:

    int(x, base=10)?1 Convert a number or string x to an integer, or return 0 if no arguments are given.

And I noticed this:

1. Autocomplete list shows some padding for image but it does not display the image
2. The calltip window includes "?1", while I expected it to be ignored

Any help with this?

Neil Hodgson

unread,
Feb 3, 2013, 5:56:37 PM2/3/13
to scite-i...@googlegroups.com

zetah:

> 2. The calltip window includes "?1", while I expected it to be ignored

You have recently been using code, like the command lister, which sets AutoCTypeSeparator so that '?' is visible instead of interpreted as an icon.

Neil

zetah

unread,
Feb 3, 2013, 7:03:16 PM2/3/13
to scite-i...@googlegroups.com, nyama...@me.com
On Sunday, February 3, 2013 11:56:37 PM UTC+1, Neil Hodgson wrote:
   You have recently been using code, like the command lister, which sets AutoCTypeSeparator so that '?' is visible instead of interpreted as an icon.

I thought output prefix is valid only for the output pane? But even if not, commenting it from recentCommands() function, lists it again in calltip window.

About image not showing, I further read (http://www.scintilla.org/ScintillaDoc.html#XPM):

    "Scintilla is only able to handle XPM pixmaps that use one character per pixel with no named colours."

I made XPM by converting BMP with imagemagick, which uses 2 characters per pixel and uses named colors, and repeats each pixel value with new character even color value is same :) Then I made XPM by hand with single character per pixel and no named colors, then confirmed validity with IrfanView, but SciTE still doesn't show the image. Perhaps there is more into it then I assumed?

zetah

unread,
Feb 3, 2013, 7:17:33 PM2/3/13
to scite-i...@googlegroups.com, nyama...@me.com
Here is whole example. Image is made inside editor:

local i = [[/* XPM */
static char *i[] = {/* columns rows colors chars-per-pixel */
"16 8 2 1 ",
"  c #9999FF",
". c #FFFFFF",
/* pixels */
"                ",
"  .        .    ",
"  .      ....   ",
"  .   ...  .    ",
"  .  .  .  .    ",
"  .  .  .  .    ",
"  .  .  .  .    ",
"                "
};]]

editor:RegisterImage(1, i)

Neil Hodgson

unread,
Feb 4, 2013, 5:22:37 AM2/4/13
to scite-i...@googlegroups.com
zetah:

"  c #9999FF",
". c #FFFFFF",

   You haven't defined a transparent colour so ' ' is transparent and '.' is white.

   Neil

zetah

unread,
Feb 4, 2013, 10:13:00 AM2/4/13
to scite-i...@googlegroups.com, nyama...@me.com
Thanks Neil, but unfortunately it does not change state here. I changed to this:


local i = [[/* XPM */
static char *i[] = {/* columns rows colors chars-per-pixel */
"16 8 2 1 ",
"  c none",
". c #000000",

/* pixels */
"                ",
"  .        .    ",
"  .      ....   ",
"  .   ...  .    ",
"  .  .  .  .    ",
"  .  .  .  .    ",
"  .  .  .  .    ",
"                "
};]]

And it must be that image is not recognized for some reason, as padding is added to autocomplete list proportional to image dimensions.
Reply all
Reply to author
Forward
0 new messages