Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update Functions.lua
  • Loading branch information
ViksUI committed Jun 1, 2015
1 parent f741947 commit 1b75fce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ShestakUI/Core/Functions.lua
Expand Up @@ -404,6 +404,14 @@ function T.SkinCloseButton(f, point, text, pixel)
f:HookScript("OnLeave", T.SetOriginalBackdrop)
end

function T:HandleIcon(icon, parent)
parent = parent or icon:GetParent();

icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
parent:CreateBackdrop('Default')
icon:SetParent(parent.backdrop)
end

function T.SkinSlider(f)
f:SetBackdrop(nil)

Expand Down

16 comments on commit 1b75fce

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this function do ?

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using it in the PTR version, as part of skinning in Naval skin. Changed in wrong version here. Will be in use from 6.2

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it T:HandleIcon? or T.HandleIcon?

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be T.HandleIcon, didn't see it when posting. Since i made edit in wrong version, and the edit didn't cause anything im just waiting to merge in rest of 6.2 changes. Using it to skin icons, like in questchoice.
wowscrnshot_060115_192849

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 2, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can i read 6.2 PTR code?

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 2, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, just make pull request in it.

https://github.com/Shestak/ShestakUI/tree/PTR-6.2

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 4, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on fixing the skinning for scrollbars.
Maybe just ask you. Can you see any reason why the top arrow for scrollbar points down?

function T.SkinScrollBar(frame)

    if _G[frame:GetName().."BG"] then
        _G[frame:GetName().."BG"]:SetTexture(nil)
    end
    if _G[frame:GetName().."Track"] then
        _G[frame:GetName().."Track"]:SetTexture(nil)
    end
    if _G[frame:GetName().."Top"] then
        _G[frame:GetName().."Top"]:SetTexture(nil)
    end
    if _G[frame:GetName().."Bottom"] then
        _G[frame:GetName().."Bottom"]:SetTexture(nil)
    end
    if _G[frame:GetName().."Middle"] then
        _G[frame:GetName().."Middle"]:SetTexture(nil)
    end

    if _G[frame:GetName().."ScrollUpButton"] and _G[frame:GetName().."ScrollDownButton"] then
        _G[frame:GetName().."ScrollUpButton"]:StripTextures()
        if not _G[frame:GetName().."ScrollUpButton"].icon then
            T.SkinNextPrevButton(_G[frame:GetName().."ScrollUpButton"], true)
            _G[frame:GetName().."ScrollUpButton"]:SetSize(_G[frame:GetName().."ScrollUpButton"]:GetWidth() + 7, _G[frame:GetName().."ScrollUpButton"]:GetHeight() + 7)
        end

        _G[frame:GetName().."ScrollDownButton"]:StripTextures()
        if not _G[frame:GetName().."ScrollDownButton"].icon then
            T.SkinNextPrevButton(_G[frame:GetName().."ScrollDownButton"], true)
            _G[frame:GetName().."ScrollDownButton"]:SetSize(_G[frame:GetName().."ScrollDownButton"]:GetWidth() + 7, _G[frame:GetName().."ScrollDownButton"]:GetHeight() + 7)
        end

        if not frame.trackbg then
            frame.trackbg = CreateFrame("Frame", nil, frame)
            frame.trackbg:SetPoint("TOPLEFT", _G[frame:GetName().."ScrollUpButton"], "BOTTOMLEFT", 0, -1)
            frame.trackbg:SetPoint("BOTTOMRIGHT", _G[frame:GetName().."ScrollDownButton"], "TOPRIGHT", 0, 1)
            frame.trackbg:SetTemplate("Transparent")
        end

        if frame:GetThumbTexture() then
            if not thumbTrim then thumbTrim = 3 end
            frame:GetThumbTexture():SetTexture(nil)
            if not frame.thumbbg then
                frame.thumbbg = CreateFrame("Frame", nil, frame)
                frame.thumbbg:SetPoint("TOPLEFT", frame:GetThumbTexture(), "TOPLEFT", 2, -thumbTrim)
                frame.thumbbg:SetPoint("BOTTOMRIGHT", frame:GetThumbTexture(), "BOTTOMRIGHT", -2, thumbTrim)
                frame.thumbbg:SetTemplate("Default", true, true)
                if frame.trackbg then
                    frame.thumbbg:SetFrameLevel(frame.trackbg:GetFrameLevel())
                end
            end
        end
    end
end

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't use skin in blizzard frame, What's wrong with scrollbars?
Maybe you can reference AddOnSkins function.

local ScrollBarElements = {
    'BG',
    'Track',
    'Top',
    'Bottom',
    'Middle',
}

function AS:SkinScrollBar(Frame)
    local ScrollUpButton = Frame:GetName() and _G[Frame:GetName().."ScrollUpButton"] or Frame.ScrollUpButton
    local ScrollDownButton = Frame:GetName() and _G[Frame:GetName().."ScrollDownButton"] or Frame.ScrollDownButton

    for _, object in pairs(ScrollBarElements) do
        if Frame:GetName() and _G[Frame:GetName()..object] then
            _G[Frame:GetName()..object]:SetTexture(nil)
        end
    end

    if ScrollUpButton and ScrollDownButton then
        AS:StripTextures(ScrollUpButton)
        AS:SetTemplate(ScrollUpButton, "Default", true)

        AS:StripTextures(ScrollDownButton)
        AS:SetTemplate(ScrollDownButton, "Default", true)

        if not ScrollUpButton.Text then
            ScrollUpButton.Text = ScrollUpButton:CreateFontString(nil, "OVERLAY")
            ScrollUpButton.Text:SetFont([[Fonts\ARIALN.TTF]], 12)
            ScrollUpButton.Text:SetText("▲")
            ScrollUpButton.Text:SetPoint("CENTER", 1, 0)

            ScrollUpButton:HookScript('OnShow', function(self)
                if not self:IsEnabled() then
                    self.Text:SetTextColor(.3, .3, .3)
                end
            end)

            ScrollUpButton:HookScript('OnDisable', function(self)
                self.Text:SetTextColor(.3, .3, .3)
            end)

            ScrollUpButton:HookScript('OnEnable', function(self)
                self.Text:SetTextColor(1, 1, 1)
            end)

            ScrollUpButton:HookScript('OnEnter', function(self)
                self:SetBackdropBorderColor(Color.r, Color.g, Color.b)
                self.Text:SetTextColor(Color.r, Color.g, Color.b)
            end)
            ScrollUpButton:HookScript('OnLeave', function(self)
                self:SetBackdropBorderColor(unpack(AS.BorderColor))
                self.Text:SetTextColor(1, 1, 1)
            end)
        end 

        if not ScrollDownButton.Text then
            ScrollDownButton.Text = ScrollDownButton:CreateFontString(nil, "OVERLAY")
            ScrollDownButton.Text:SetFont([[Fonts\ARIALN.TTF]], 12)
            ScrollDownButton.Text:SetText("▼")
            ScrollDownButton.Text:SetPoint("CENTER", 1, 0)

            ScrollDownButton:HookScript('OnShow', function(self)
                if not self:IsEnabled() then
                    self.Text:SetTextColor(.3, .3, .3)
                end
            end)

            ScrollDownButton:HookScript('OnDisable', function(self)
                self.Text:SetTextColor(.3, .3, .3)
            end)

            ScrollDownButton:HookScript('OnEnable', function(self)
                self.Text:SetTextColor(1, 1, 1)
            end)

            ScrollDownButton:HookScript('OnEnter', function(self)
                self:SetBackdropBorderColor(Color.r, Color.g, Color.b)
                self.Text:SetTextColor(Color.r, Color.g, Color.b)
            end)

            ScrollDownButton:HookScript('OnLeave', function(self)
                self:SetBackdropBorderColor(unpack(AS.BorderColor))
                self.Text:SetTextColor(1, 1, 1)
            end)
        end

        if not Frame.TrackBG then
            Frame.TrackBG = CreateFrame("Frame", nil, Frame)
            Frame.TrackBG:Point("TOPLEFT", ScrollUpButton, "BOTTOMLEFT", 0, -1)
            Frame.TrackBG:Point("BOTTOMRIGHT", ScrollDownButton, "TOPRIGHT", 0, 1)
            AS:SetTemplate(Frame.TrackBG, "Transparent")
        end

        if Frame:GetThumbTexture() then
            Frame:GetThumbTexture():SetTexture(nil)
            if not Frame.ThumbBG then
                Frame.ThumbBG = CreateFrame("Frame", nil, Frame)
                Frame.ThumbBG:Point("TOPLEFT", Frame:GetThumbTexture(), "TOPLEFT", 2, -3)
                Frame.ThumbBG:Point("BOTTOMRIGHT", Frame:GetThumbTexture(), "BOTTOMRIGHT", -2, 3)
                AS:SetTemplate(Frame.ThumbBG, "Default", true)

                if Frame.ThumbBG then
                    Frame.ThumbBG:SetFrameLevel(Frame.TrackBG:GetFrameLevel())
                end
            end
        end
    end
end

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will test this function, afternoon,

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there isn't any skinning of scrollbars and from what i see, not for a long time. The code skins correctly everything, it's only that the top arrow points down. Not sure if it's T.SkinNextPrevButton that messes it up.

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 6, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In function T.SkinNextPrevButton(btn, horizontal, left)

if horizontal then
            btn:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Up")
            btn:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Down")
            btn:SetDisabledTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Disabled")

Three icons are all arrow points down.I don't think that the function(T.SkinNextPrevButton) apply to the ScrollBar.

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 6, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bahh, can't belive i didn't see that. I even checked it.. Eyes stopped at "up" and "down", and brain never kicked in saying it was buttonpressed down/up and not icon. Will start looking into it.

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it could be:

function T.SkinNextPrevButton(btn)
    local normal, pushed, disabled
    local isPrevButton = btn:GetName() and (string.find(btn:GetName(), "Left") or string.find(btn:GetName(), "Prev") or string.find(btn:GetName(), "Decrement") or string.find(btn:GetName(), "Back"))
    local isScrollUpButton = btn:GetName() and string.find(btn:GetName(), "ScrollUp")
    local isScrollDownButton = btn:GetName() and string.find(btn:GetName(), "ScrollDown")

    if btn:GetNormalTexture() then
        normal = btn:GetNormalTexture():GetTexture()
    end

    if btn:GetPushedTexture() then
        pushed = btn:GetPushedTexture():GetTexture()
    end

    if btn:GetDisabledTexture() then
        disabled = btn:GetDisabledTexture():GetTexture()
    end

    btn:StripTextures()

    if not normal then
        if isPrevButton then
            normal = "Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up"
        elseif isScrollUpButton then
            normal = "Interface\\ChatFrame\\UI-ChatIcon-ScrollUp-Up"
        elseif isScrollDownButton then
            normal = "Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Up"
        else
            normal = "Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up"
        end
    end

    if not pushed then
        if isPrevButton then
            pushed = "Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Down"
        elseif isScrollUpButton then
            pushed = "Interface\\ChatFrame\\UI-ChatIcon-ScrollUp-Down"
        elseif isScrollDownButton then
            pushed = "Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Down"
        else
            pushed = "Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down"
        end
    end

    if not disabled then
        if isPrevButton then
            disabled = "Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Disabled"
        elseif isScrollUpButton then
            disabled = "Interface\\ChatFrame\\UI-ChatIcon-ScrollUp-Disabled"
        elseif isScrollDownButton then
            disabled = "Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Disabled"
        else
            disabled = "Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled"
        end
    end

    btn:SetNormalTexture(normal)
    btn:SetPushedTexture(pushed)
    btn:SetDisabledTexture(disabled)

    btn:SetTemplate("Overlay")
    btn:SetSize(btn:GetWidth() - 7, btn:GetHeight() - 7)

    if normal and pushed and disabled then
        btn:GetNormalTexture():SetTexCoord(0.3, 0.29, 0.3, 0.81, 0.65, 0.29, 0.65, 0.81)
        if btn:GetPushedTexture() then
            btn:GetPushedTexture():SetTexCoord(0.3, 0.35, 0.3, 0.81, 0.65, 0.35, 0.65, 0.81)
        end
        if btn:GetDisabledTexture() then
            btn:GetDisabledTexture():SetTexCoord(0.3, 0.29, 0.3, 0.75, 0.65, 0.29, 0.65, 0.75)
        end

        btn:GetNormalTexture():ClearAllPoints()
        btn:GetNormalTexture():SetPoint("TOPLEFT", 2, -2)
        btn:GetNormalTexture():SetPoint("BOTTOMRIGHT", -2, 2)
        if btn:GetDisabledTexture() then
            btn:GetDisabledTexture():SetAllPoints(btn:GetNormalTexture())
        end
        if btn:GetPushedTexture() then
            btn:GetPushedTexture():SetAllPoints(btn:GetNormalTexture())
        end
        btn:GetHighlightTexture():SetTexture(1, 1, 1, 0.3)
        btn:GetHighlightTexture():SetAllPoints(btn:GetNormalTexture())
    end
end

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess that could work. I have a working version on PTR. I'll look into it later to see if it's better solution.

@leg883
Copy link
Contributor

@leg883 leg883 commented on 1b75fce Jun 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have e-mail? I'll send buff/debuff list of HFC RAID to you.

@ViksUI
Copy link
Collaborator Author

@ViksUI ViksUI commented on 1b75fce Jun 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sendt you a PM on forum with email.

Please sign in to comment.