Miniwindows Suck.

Contrast_Picker
Arcidayne 9 years ago
parent 92fb7b6d97
commit 523c23392b

@ -15,7 +15,7 @@
save_state="y"
date_written="2016-03-29 14:40:46"
requires="4.80"
version="2.51"
version="2.52"
>
<description trim="y">
<![CDATA[
@ -327,6 +327,90 @@ function OnPluginInstall()
posy = ""
hotspot_id = ""
page_built = false
--- Pull some state variables.
title_colour = tonumber (GetVariable ("title_colour")) or title_colour
height = tonumber (GetVariable ("height")) or default_height
width = tonumber (GetVariable ("width")) or default_width
also_echo_lbid = tonumber (GetVariable("also_echo_lbid")) or 0
-- make window so I can grab the font info
WindowCreate (win, 1, 1, width, height, 0, 0, background_colour or 0)
font_id = "lbid_font"
font_id_bold = "lbid_bold"
local fonts = utils.getfontfamilies ()
-- if not there already, add it
if not fonts.Dina then
AddFont (GetInfo (66) .. "\\Dina.fon")
fonts = utils.getfontfamilies ()
end -- if Dina not installed
if fonts ["Dina"] then
default_font_size = 8
default_font_name = "Dina" -- the actual font
elseif fonts["Courier New"] then
default_font_size = 9
default_font_name = "Courier New"
else
default_font_size = 9
default_font_name = "Lucida Console"
end -- if
font_name = GetVariable("font_name") or default_font_name
font_size = tonumber(GetVariable("font_size")) or default_font_size
--- Load the fonts into the temp window.
WindowFont (win, font_id, font_name, font_size, false, false, false, false) -- normal font
WindowFont (win, font_id_bold, font_name, font_size+1, false, false, false, false) -- bold font
--- Grab font size settings.
font_height = WindowFontInfo (win, font_id, 1) - WindowFontInfo (win, font_id, 4) + 1 -- height
font_width = WindowFontInfo (win, font_id, 6) -- avg width
line_height = font_height + 1
--- install the window movement handler, get back the window position.
windowinfo = movewindow.install (win, miniwin.pos_top_right, miniwin.create_absolute_location, false, nil, {mouseup=MouseUp, mousedown=LeftClickOnly, dragmove=LeftClickOnly, dragrelease=LeftClickOnly},{x=default_x, y=default_y})
-- Draw the initial lbid window
SetUpHotspotsAndDraw(true)
-- Info (Legend) window
-- our window frame/background colours
border_colour = ColourNameToRGB "dimgray"
-- a unique ID
infowin = "~~~~~~"..GetPluginID () .. ":info" -- name hack to make the popup go on top of everything
-- font IDs
popup_font_id = "popup_font"
heading_font_id = "popup_heading_font"
-- load fonts - mouseover window
WindowCreate (infowin, 0, 0, 1, 1, 0, 0, 0) -- make 1-pixel wide window
WindowSetZOrder(infowin, 99999)
-- install the fonts (49 is modern / fixed pitch)
WindowFont (infowin, popup_font_id, font_name, font_size, false, false, false, false, 0, 49)
WindowFont (infowin, heading_font_id, font_name, font_size + 2, false, false, false, false, 0, 49)
-- update on reload
if IsConnected() then
OnPluginConnect()
end
-- if disabled last time, stay disabled
if GetVariable ("enabled") == "false" then
ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
check (EnablePlugin(GetPluginID (), false))
return
end -- they didn't enable us last time
end
end
function lbid_redirect(name, line, wildcards, styles)
@ -584,91 +668,6 @@ function OnPluginListChanged ()
do_plugin_check_now ("462b665ecb569efbf261422f", "aard_miniwindow_z_order_monitor") -- check we have z order plugin
end -- OnPluginListChanged
function OnPluginInstall()
--- Pull some state variables.
title_colour = tonumber (GetVariable ("title_colour")) or title_colour
height = tonumber (GetVariable ("height")) or default_height
width = tonumber (GetVariable ("width")) or default_width
also_echo_lbid = tonumber (GetVariable("also_echo_lbid")) or 0
-- make window so I can grab the font info
WindowCreate (win, 1, 1, width, height, 0, 0, background_colour or 0)
font_id = "lbid_font"
font_id_bold = "lbid_bold"
local fonts = utils.getfontfamilies ()
-- if not there already, add it
if not fonts.Dina then
AddFont (GetInfo (66) .. "\\Dina.fon")
fonts = utils.getfontfamilies ()
end -- if Dina not installed
if fonts ["Dina"] then
default_font_size = 8
default_font_name = "Dina" -- the actual font
elseif fonts["Courier New"] then
default_font_size = 9
default_font_name = "Courier New"
else
default_font_size = 9
default_font_name = "Lucida Console"
end -- if
font_name = GetVariable("font_name") or default_font_name
font_size = tonumber(GetVariable("font_size")) or default_font_size
--- Load the fonts into the temp window.
WindowFont (win, font_id, font_name, font_size, false, false, false, false) -- normal font
WindowFont (win, font_id_bold, font_name, font_size+1, false, false, false, false) -- bold font
--- Grab font size settings.
font_height = WindowFontInfo (win, font_id, 1) - WindowFontInfo (win, font_id, 4) + 1 -- height
font_width = WindowFontInfo (win, font_id, 6) -- avg width
line_height = font_height + 1
--- install the window movement handler, get back the window position.
windowinfo = movewindow.install (win, miniwin.pos_top_right, miniwin.create_absolute_location, false, nil, {mouseup=MouseUp, mousedown=LeftClickOnly, dragmove=LeftClickOnly, dragrelease=LeftClickOnly},{x=default_x, y=default_y})
-- Draw the initial lbid window
SetUpHotspotsAndDraw(true)
-- Info (Legend) window
-- our window frame/background colours
border_colour = ColourNameToRGB "dimgray"
-- a unique ID
infowin = "~~~~~~"..GetPluginID () .. ":info" -- name hack to make the popup go on top of everything
-- font IDs
popup_font_id = "popup_font"
heading_font_id = "popup_heading_font"
-- load fonts - mouseover window
WindowCreate (infowin, 0, 0, 1, 1, 0, 0, 0) -- make 1-pixel wide window
WindowSetZOrder(infowin, 99999)
-- install the fonts (49 is modern / fixed pitch)
WindowFont (infowin, popup_font_id, font_name, font_size, false, false, false, false, 0, 49)
WindowFont (infowin, heading_font_id, font_name, font_size + 2, false, false, false, false, 0, 49)
-- update on reload
if IsConnected() then
OnPluginConnect()
end
-- if disabled last time, stay disabled
if GetVariable ("enabled") == "false" then
ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
check (EnablePlugin(GetPluginID (), false))
return
end -- they didn't enable us last time
end
-- End Windows Creation
function update_plugin()

Loading…
Cancel
Save