From c42163accdc65a03d891e78c5c853b6ca95c2322 Mon Sep 17 00:00:00 2001 From: Arcidayne <9382522b@opayq.com> Date: Mon, 11 Apr 2016 14:11:14 -0400 Subject: [PATCH] Work in progress --- Auction_Utilities/Auction_Utilities.xml | 416 +----------------------- 1 file changed, 1 insertion(+), 415 deletions(-) diff --git a/Auction_Utilities/Auction_Utilities.xml b/Auction_Utilities/Auction_Utilities.xml index c82e11c..c8d254b 100644 --- a/Auction_Utilities/Auction_Utilities.xml +++ b/Auction_Utilities/Auction_Utilities.xml @@ -15,7 +15,7 @@ save_state="y" date_written="2016-03-29 14:40:46" requires="4.80" - version="2.47" + version="2.48" > GetInfo(281)) then - width = GetInfo(281)-windowinfo.window_left - startx = GetInfo(281) - end - - height = height + posy - starty - starty = posy - if (height < MIN_SIZE) then - height = MIN_SIZE - starty = windowinfo.window_top+height - elseif (windowinfo.window_top+height > GetInfo(280)) then - height = GetInfo(280)-windowinfo.window_top - starty = GetInfo(280) - end - if (utils.timer() - lastRefresh > 0.0333) then - SetUpHotspotsAndDraw(false) - lastRefresh = utils.timer() - end -end - -lastRefresh = 0 - ---------------------------------------------------------------------------------- --- Called after the resize widget is released. ---------------------------------------------------------------------------------- -function ResizeReleaseCallback() - SetUpHotspotsAndDraw(true) -end - ---------------------------------------------------------------------------------- --- Called when mouse button is pressed on hotspot. ---------------------------------------------------------------------------------- -function MouseDown(flags, hotspot_id) - if (hotspot_id == "resize") then - startx, starty = WindowInfo (win, 17), WindowInfo (win, 18) - end -end - ---------------------------------------------------------------------------------- --- Called when mouse moved away from hotspot. Doesn't really apply for draggables. ---------------------------------------------------------------------------------- -function CancelMouseDown(flags, hotspot_id) -end - ---------------------------------------------------------------------------------- --- Called when mouse button released on hotspot. ---------------------------------------------------------------------------------- -function MouseUp(flags, hotspot_id, win) - if bit.band (flags, miniwin.hotspot_got_rh_mouse) ~= 0 then - right_click_menu() - end - return true -end - -function LeftClickOnly(flags, hotspot_id, win) - if bit.band (flags, miniwin.hotspot_got_rh_mouse) ~= 0 then - return true - end - return false -end - -function OnPluginConnect() - Send_GMCP_Packet("request char") -end - ---------------------------------------------------------------------------------- --- Called when plugin is saved - store our variables for next time. ---------------------------------------------------------------------------------- -function OnPluginSaveState () - movewindow.save_state (win) -- save window current location for next time - SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17))) - SetVariable ("title_colour", title_colour) - SetVariable ("width", width) - SetVariable ("height", height) - SetVariable ("font_name", font_name) - SetVariable ("font_size", font_size) - SetVariable ("also_echo_lbid", also_echo_lbid) - -end -- OnPluginSaveState - -function OnPluginClose () - OnPluginDisable() - WindowDelete(win) -end - -function OnPluginDisable () - WindowShow( win, false ) - OnPluginSaveState() -end -- OnPluginDisable - -function OnPluginEnable () - WindowShow (win, true) - if IsConnected() then - OnPluginConnect() - end - OnPluginSaveState() -end -- OnPluginEnable - -win = GetPluginID() -require "checkplugin" -function OnPluginListChanged () - do_plugin_check_now ("abc1a0944ae4af7586ce88dc", "aard_repaint_buffer") -- check we have the repaint buffer plugin - do_plugin_check_now ("3e7dedbe37e44942dd46d264", "aard_GMCP_handler") -- check we have GMCP plugin - do_plugin_check_now ("462b665ecb569efbf261422f", "aard_miniwindow_z_order_monitor") -- check we have z order plugin -end -- OnPluginListChanged - function OnPluginInstall() - --- Pull some state variables. - - require "movewindow" - require "mw" - require "gmcphelper" - - background_colour = GetNormalColour(1) or 0 - title_colour = 0x292929 - border_colour = 0xdddddd - title_gradient_col1 = GetNormalColour(1) or 0 - title_gradient_col1 = 0x444444 - default_width = 500 - default_height = 250 - default_x = 658 - default_y = 100 - lbid_lines = {} - - RESIZE_TAG_SIZE = 10 - MIN_SIZE = 100 - TITLE_HEIGHT = 11 - - startx = "" - starty = "" - posx = "" - posy = "" - hotspot_id = "" - page_built = false - - 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 PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19) PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1) BUYOUT_OPTION = 1 - - - -- make window so I can grab the font info - WindowCreate (win, 1, 1, width, height, 0, 0, background_colour) - - 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 Window Creation - - - ---[[function OnPluginInstall() - PLUGIN_VERSION = GetPluginInfo(GetPluginID(), 19) - PLUGIN_NAME = GetPluginInfo(GetPluginID(), 1) - BUYOUT_OPTION = 1 -end]]-- - function update_plugin() raw = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Auction_Utilities/Auction_Utilities.xml"