Skip to content

Commit

Permalink
Merge branch 'development' into MUSHclient
Browse files Browse the repository at this point in the history
  • Loading branch information
fiendish committed Apr 7, 2018
2 parents 6a37129 + 568bf98 commit 524a58e
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 15 deletions.
9 changes: 8 additions & 1 deletion MUSHclient/lua/mw_themes/Charcoal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,12 @@ return {
VERTICAL_TRACK_BRUSH = miniwin.brush_hatch_forwards_diagonal,

DYNAMIC_BUTTON_PADDING = 20,
RESIZER_SIZE = 16
RESIZER_SIZE = 16,

-- bg_texture_function is optional to override the default behavior.
-- See Pink_Neon.lua for a "glitter on black" variant.
-- Just make sure to return the path to a valid png file.
bg_texture_function = function()
return GetInfo(66).."worlds/plugins/images/bg1.png"
end
}
27 changes: 26 additions & 1 deletion MUSHclient/lua/mw_themes/Pink_Neon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,30 @@ return {
VERTICAL_TRACK_BRUSH = miniwin.brush_hatch_forwards_diagonal,

DYNAMIC_BUTTON_PADDING = 20,
RESIZER_SIZE = 16
RESIZER_SIZE = 16,

-- bg_texture_function is optional to override the default behavior.
-- See Charcoal.lua for a "do nothing" variant.
-- Just make sure to return the path to a valid png file.
bg_texture_function = function()
imgpath = GetInfo(66).."worlds/plugins/images/bg1.png"

WindowCreate("WiLl_It_BlEnD", 0, 0, 0, 0, 0, 0, theme.THREE_D_HIGHLIGHT)
WindowLoadImage("WiLl_It_BlEnD", "tExTuRe", imgpath)
local tw = WindowImageInfo("WiLl_It_BlEnD", "tExTuRe", 2)
local th = WindowImageInfo("WiLl_It_BlEnD", "tExTuRe", 3)
WindowResize("WiLl_It_BlEnD", tw, th, theme.THREE_D_HIGHLIGHT)
WindowImageFromWindow("WiLl_It_BlEnD", "cOlOr", "WiLl_It_BlEnD")

WindowDrawImage("WiLl_It_BlEnD", "tExTuRe", 0, 0, 0, 0, 1)
WindowFilter("WiLl_It_BlEnD", 0, 0, 0, 0, 7, 50)
WindowFilter("WiLl_It_BlEnD", 0, 0, 0, 0, 8, 30)
WindowFilter("WiLl_It_BlEnD", 0, 0, 0, 0, 7, -120)
WindowBlendImage("WiLl_It_BlEnD", "cOlOr", 0, 0, 0, 0, 5, 0.9)

imgpath = GetInfo(66).."worlds/plugins/images/temp_theme_blend.png"
WindowWrite("WiLl_It_BlEnD", imgpath)

return imgpath
end
}
39 changes: 32 additions & 7 deletions MUSHclient/lua/text_rect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,12 @@ function TextRect:clear()
end

function TextRect:reWrapLines()
if self.num_wrapped_lines == 0 then
return
end

local raw_index = 0
local start_line = self.display_start_line or 1

raw_index = self.wrapped_lines[start_line][4]
if self.num_wrapped_lines ~= 0 then
raw_index = self.wrapped_lines[start_line][4]
end

self.wrapped_lines = {}
self.num_wrapped_lines = 0
Expand Down Expand Up @@ -418,6 +416,10 @@ function TextRect:setRect(left, top, right, bottom)
self.rect_lines = math.floor(self.padded_height / self.line_height)
end

function TextRect:getScroll()
return self.start_line
end

function TextRect:setScroll(new_pos)
self.start_line = math.max(1, math.min(new_pos, self.num_wrapped_lines - self.rect_lines + 1))
self.end_line = math.min(self.start_line + self.rect_lines - 1, self.num_wrapped_lines)
Expand Down Expand Up @@ -749,8 +751,31 @@ function TextRect:clickUrl(hotspot_id)
end
end

function TextRect:getAllText()
return copytable.deep(self.raw_lines)
function TextRect:serializeContents()
require "serialize"
local keys = {
raw_lines = {},
start_line = 1,
}

local contents = {}
for k,v in pairs(keys) do
contents[k] = self[k]
end

return serialize.save_simple(contents)
end

function TextRect:deserializeContents(contents)
if (type(contents) == "string") and (contents ~= "") then
local contents = loadstring("return "..contents)()
if (type(contents) == "table") and contents.raw_lines and contents.start_line then
self.raw_lines = contents.raw_lines
self.num_raw_lines = #self.raw_lines
self:reWrapLines()
self:setScroll(contents.start_line)
end
end
end

function TextRect:copyAndNotify(text)
Expand Down
26 changes: 22 additions & 4 deletions MUSHclient/worlds/plugins/aard_channels_fiendish.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ log_timestamps = tonumber(GetVariable("log_timestamps")) or 1
local init_nonchannel_keys = {"info", "raidinfo", "claninfo", "clan_donations", "global_quest", "warfare", "remort_auction", "remote_socials"}
local init_nonchannel_pairs = {["warfare"]="WARFARE:", ["info"]="INFO:", ["raidinfo"]="RAIDINFO:", ["claninfo"]="CLANINFO:", ["global_quest"]="Global Quest:", ["remort_auction"]="Remort Auction:", ["clan_donations"]="Clan Donations", ["remote_socials"]="Remote Socials"}
local init_channel_keys = {"answer","auction","barter","cant","chant","claninfo","clantalk","commune","curse","dtell","ftalk","gametalk","gclan","gossip","grapevine","gratz","gtell","helper","immtalk","inform","lasertag","ltalk","mafiainfo","market","mobsay","music","newbie","pchat","pokerinfo","ptell","question","racetalk","rauction","restores","rp","say","snewbie","spouse","tech","telepathy","tell","tiertalk","trivia","wangrp","wardrums","yell"}
local init_channel_keys = {"answer","auction","barter","cant","chant","claninfo","clantalk","commune","curse","dtell","ftalk","gametalk","gclan","gossip","grapevine","gratz","gtell","helper","immtalk","inform","lasertag","ltalk","mafiainfo","market","mchat","mobsay","music","newbie","pchat","pokerinfo","ptell","question","racetalk","rauction","restores","rp","say","snewbie","spouse","tech","telepathy","tell","tiertalk","trivia","wangrp","wardrums","yell"}
channels_table = {}
loadstring(GetVariable("channels_table") or "")()
Expand Down Expand Up @@ -252,6 +252,12 @@ function makeRect(i)
bump_top_for_tabs()
tabs_rects[i]:setRect(tr_left, tr_top, tr_right, tr_bottom)
tabs_scrollbars[i]:setRect(tr_right, tr_top, draw_right, tr_bottom-theme.RESIZER_SIZE)
if temp_tabs_data and temp_tabs_data[i] then
tabs_rects[i]:deserializeContents(temp_tabs_data[i].contents)
tabs_activity[i] = temp_tabs_data[i].activity
temp_tabs_data[i] = nil -- cleanup
end
end
function findTab(name)
Expand Down Expand Up @@ -439,6 +445,9 @@ function init ()
tabs_rects = {}
tabs_scrollbars = {}
loadstring("temp_tabs_data =" .. (GetVariable("temp_tabs_data") or "nil"))()
DeleteVariable("temp_tabs_data")
end
function drawTabs (mouseover)
Expand Down Expand Up @@ -594,6 +603,7 @@ function setupDisplay ()
makeRect(i)
end
end
temp_tabs_data = nil
drawTabs()
end
Expand All @@ -615,18 +625,15 @@ function OnPluginEnable ()
if IsConnected() then
OnPluginConnect()
end -- if already connected
SaveState()
end -- OnPluginEnable
function OnPluginDisable()
WindowShow( win, false )
SaveState()
end -- OnPluginDisable
require "serialize"
function OnPluginSaveState()
-- save window current location for next time
SetVariable("enabled", tostring (GetPluginInfo (GetPluginID(), 17)))
movewindow.save_state(win)
SetVariable("font_name", font_name)
Expand All @@ -650,6 +657,17 @@ function OnPluginSaveState()
SetVariable("tabs_names", serialize.save("tabs_names"))
SetVariable("tabs_channel_captures", serialize.save("tabs_channel_captures"))
SetVariable("tabs_nonchannel_captures", serialize.save("tabs_nonchannel_captures"))
if GetVariable("just_reloading") then
local temp_tabs_data = {}
for i,v in ipairs(tabs_rects) do
temp_tabs_data[i] = {
["contents"] = v:serializeContents(),
["activity"] = tabs_activity[i]
}
end
SetVariable("temp_tabs_data", serialize.save_simple(temp_tabs_data))
end
end
function sanitize_filename(str)
Expand Down
25 changes: 23 additions & 2 deletions MUSHclient/worlds/plugins/aard_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,29 @@ function OnPluginInstall()
bgoffscreen = win.."text_background_offscreen"
local dir = GetInfo(66)
local imgpath = dir .. "worlds\\plugins\\images\\bg1.png"
if 0 ~= SetBackgroundImage(imgpath,13) then
local imgpath = "-"
if type(theme.bg_texture_function) == "function" then
imgpath = theme.bg_texture_function()
end
if 0 ~= SetBackgroundImage(imgpath, 13) then
imgpath = dir.."worlds\\plugins\\images\\bg1.png"
-- add some theme coloring to the background
WindowCreate("WiLl_It_BlEnD", 0, 0, 0, 0, 0, 0, theme.SECONDARY_BODY)
WindowLoadImage("WiLl_It_BlEnD", "tExTuRe", imgpath)
local tw = WindowImageInfo("WiLl_It_BlEnD", "tExTuRe", 2)
local th = WindowImageInfo("WiLl_It_BlEnD", "tExTuRe", 3)
WindowResize("WiLl_It_BlEnD", tw, th, theme.SECONDARY_BODY)
WindowImageFromWindow("WiLl_It_BlEnD", "cOlOr", "WiLl_It_BlEnD")
WindowDrawImage("WiLl_It_BlEnD", "tExTuRe", 0, 0, 0, 0, 1)
WindowBlendImage("WiLl_It_BlEnD", "cOlOr", 0, 0, 0, 0, 12, 0.3)
imgpath = dir.."worlds\\plugins\\images\\temp_theme_blend.png"
WindowWrite("WiLl_It_BlEnD", imgpath)
end
if 0 ~= SetBackgroundImage(imgpath, 13) then
ColourNote("yellow","red","Error loading background image.")
end
Expand Down
Binary file modified MUSHclient/worlds/plugins/images/bg1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 524a58e

Please sign in to comment.