lotrointerface.com
Search Downloads

LoTROInterface SVN SequenceBars

[/] [trunk/] [Thurallor/] [SequenceBars/] [GlobalOptionsTab.lua] - Rev 170

Compare with Previous | Blame | View Log

GlobalOptionsTab = class(Thurallor.UI.TabCard);

function GlobalOptionsTab:Constructor(manager, optionsPanel)
    Thurallor.UI.TabCard.Constructor(self);
    self.manager = manager;
    self.optionsPanel = optionsPanel;
    
    self:SetTabLeft(0);
    self.inside = Turbine.UI.Control();
    self:SetInteriorControl(self.inside);
    self:SetInteriorAlignment(Turbine.UI.ContentAlignment.TopLeft);

    local left, top, width = 10, 10, 350;
    
    self.language = Turbine.UI.Label();
    self.language:SetParent(self.inside);
    self.language:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    self.language:SetPosition(left, top);
    self.language:SetSize(width, 16);
    top = top + 16;

    local languages = { "English", "German", "French", "Portuguese", "Russian" };
    local peers = {};
    self.languageButtons = {};
    for l = 1, #languages do
        language = languages[l];
        local radioButton = Thurallor.UI.RadioButton(self.inside);
        radioButton.language = languages[l];
        radioButton:SetFont((l == 5) and Turbine.UI.Lotro.Font.Verdana14 or Turbine.UI.Lotro.Font.TrajanPro14);
        radioButton:SetSize(width, 16);
        radioButton:SetPosition(left, top);
        radioButton.Clicked = function(sender)
            self.manager:SetLanguage(Turbine.Language[sender.language]);
        end
        self.languageButtons[radioButton.language] = radioButton;
        table.insert(peers, radioButton);
        top = top + 16;
    end
    Thurallor.UI.RadioButton.LinkPeers(peers);

    top = top + 16;
    self.snapToGrid = Turbine.UI.Lotro.CheckBox();
    self.snapToGrid:SetParent(self.inside);
    self.snapToGrid:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    self.snapToGrid:SetPosition(left, top);
    self.snapToGrid:SetSize(width, 16);
    self.snapToGrid.CheckedChanged = function(sender)
        self.manager:SetSnapToGrid(sender:IsChecked());
    end
    
    self.showGrid = Thurallor.UI.EyeButton(self.inside, false, true);
    self.showGrid:SetPosition(left + 186, top);
    self.showGrid.CheckedChanged = function(sender)
        self.manager:SetGridDisplayEnable(sender:IsChecked());
    end

    top = top + 32;
    self.uiScaleLabel = Turbine.UI.Label();
    self.uiScaleLabel:SetParent(self.inside);
    self.uiScaleLabel:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    self.uiScaleLabel:SetPosition(left, top);
    self.uiScaleLabel:SetSize(width, 16);

    top = top + 16;
    self.uiScale = Turbine.UI.Lotro.ScrollBar();
    self.uiScale:SetParent(self.inside);
    self.uiScale:SetPosition(left, top);
    self.uiScale:SetSize(200, 10);
    self.uiScale:SetMinimum(13);
    self.uiScale:SetMaximum(96);
    self.uiScale:SetSmallChange(1);
    self.uiScale:SetLargeChange(10);
    self.uiScale.ValueChanged = function(sb)
        local scale = sb:GetValue();
        self.manager:SetUIScale(scale);
        sb:UpdateLabel();
    end
    self.uiScale.UpdateLabel = function(sb)
        local scale = sb:GetValue();
        self.uiScaleLabel:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/UiScale") .. ": " .. string.format("%d", scale * 100 / 32) .. "%");
    end
    
    top = top + 26;
    self.uiOpacityLabel = Turbine.UI.Label();
    self.uiOpacityLabel:SetParent(self.inside);
    self.uiOpacityLabel:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    self.uiOpacityLabel:SetPosition(left, top);
    self.uiOpacityLabel:SetSize(width, 16);

    top = top + 16;
    self.uiOpacity = Turbine.UI.Lotro.ScrollBar();
    self.uiOpacity:SetParent(self.inside);
    self.uiOpacity:SetPosition(left, top);
    self.uiOpacity:SetSize(200, 10);
    self.uiOpacity:SetMinimum(0);
    self.uiOpacity:SetMaximum(100);
    self.uiOpacity:SetSmallChange(1);
    self.uiOpacity:SetLargeChange(10);
    self.uiOpacity.ValueChanged = function(sb)
        local opacity = sb:GetValue();
        self.manager:SetUIOpacity(opacity / 100);
        sb:UpdateLabel();
    end
    self.uiOpacity.UpdateLabel = function(sb)
        local opacity = sb:GetValue();
        self.uiOpacityLabel:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/UiOpacity") .. ": " .. opacity .. "%");    
    end
    
    top = top + 26;
    self.rightClickAction = Turbine.UI.Label();
    self.rightClickAction:SetParent(self.inside);
    self.rightClickAction:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    self.rightClickAction:SetPosition(left, top);
    self.rightClickAction:SetSize(width, 16);
    top = top + 16;
    self.rightClickActionShowMenu = Thurallor.UI.RadioButton(self.inside, "");
    self.rightClickActionShowMenu:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    self.rightClickActionShowMenu:SetPosition(left, top);
    self.rightClickActionShowMenu:SetSize(width, 16);
    self.rightClickActionShowMenu.Clicked = function(sender)
        self.manager:SetUseOnRightClick(false);
    end
    top = top + 16;
    self.rightClickActionExecute = Thurallor.UI.RadioButton(self.inside, "");
    self.rightClickActionExecute:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    self.rightClickActionExecute:SetPosition(left, top);
    self.rightClickActionExecute:SetSize(width, 16);
    self.rightClickActionExecute.Clicked = function(sender)
        self.manager:SetUseOnRightClick(true);
    end
    Thurallor.UI.RadioButton.LinkPeers({self.rightClickActionShowMenu, self.rightClickActionExecute});
    top = top + 16;

    local height = top + 10;
    self.inside:SetSize(width, height);
end

function GlobalOptionsTab:Refresh()
    for language in keys(self.languageButtons) do
        self.languageButtons[language]:SetChecked(self.manager.settings.language == Turbine.Language[language]);
    end
    self.snapToGrid:SetChecked(self.manager.settings.snapToGrid);
    self.showGrid:SetChecked(false);
    self.uiScale:SetValue(self.manager.settings.uiScale);
    self.uiOpacity:SetValue(self.manager.settings.uiOpacity * 100);
    self.rightClickActionExecute:SetChecked(self.manager.settings.useOnRightClick);
    self.rightClickActionShowMenu:SetChecked(not self.manager.settings.useOnRightClick);
end        

function GlobalOptionsTab:Localize()
    self:SetTabText(L:GetText("/PluginManager/OptionsTab/GlobalSettings"));
    self.language:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/Language"));
    for language in keys(self.languageButtons) do
        self.languageButtons[language]:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/LanguageMenu/" .. language));
    end
    self.snapToGrid:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/SnapToGrid"));
    self.uiScale:UpdateLabel();
    self.uiOpacity:UpdateLabel();
    self.rightClickAction:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/RightClickAction"));
    self.rightClickActionExecute:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/RightClickActionExecute"));
    self.rightClickActionShowMenu:SetText(L:GetText("/PluginManager/OptionsTab/GlobalSettingsTab/RightClickActionShowMenu"));
end

Compare with Previous | Blame


All times are GMT -5. The time now is 05:00 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui