I've used this macro before to display a tooltip message display the base on the current word at the cursor position. The tooltip is dismissed by any key or mouse event once it is displayed. I used on a key binding rather than trying to implement it through the mouse handler. To use as a hover over, it would required modifiying the global _mouse_move() (macros/mouse.e) handler. It could be done, there would be additional work to implement it using just the mouse.
Just bind all_your_base to a key to use.
#include 'slick.sh'
#pragma option(strict,on)
static boolean ishexnum(_str num)
{
boolean out = false;
int start = length(num);
int i = start;
for (i = start; i > 0; --i) {
if (out) {
return false;
}
_str ch = lowcase(substr(num,i,1));
if (! (isdigit(ch) || ch == 'a' || ch == 'b' || ch == 'c' || ch == 'd' || ch == 'e' || ch == 'f')) {
out = true;
}
if (ch == 'x' || ch == 'X') {
if (i == 1 || (substr(num, i-1, 1) == 0 && i - 1 == 1)) {
return true;
}
}
}
return true;
}
_command void all_your_base() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
int old_col = p_col;
int start_col = 0;
_str word = cur_word(start_col);
if (word == "") {
message("No word at cursor");
return;
}
int number;
if (isnumber(word)) {
number = (int)word;
} else if (ishexnum(word)) {
number = (int)hex2dec(word);
} else {
message("Not a number");
return;
}
_str msg = number :+ " : " :+
dec2hex(number) :+ " : " :+
dec2hex(number, 8) :+ " : " :+
dec2hex(number, 2);
p_col = start_col;
int x = p_cursor_x;
int y = p_cursor_y + p_font_height;
_map_xy(p_window_id, 0, x, y);
_bbhelp('M', p_window_id, x, y, msg);
p_col = old_col;
for(;;) {
typeless event = get_event();
if (event != "") {
break;
}
}
_bbhelp('C');
}
You could alternatively just use the message() instead of _bbhelp() function to display the text on the status line rather than using a tooltip message.
Tested in 11.0.2 version.