Пример #1
0
        public frmSettings(RadegastInstance instance)
            : base(instance)
        {
            if (settingInitialized)
            {
                frmSettings.InitSettigs(instance.GlobalSettings, instance.MonoRuntime);
            }

            InitializeComponent();
            AutoSavePosition = true;

            s = instance.GlobalSettings;
            tbpGraphics.Controls.Add(new Radegast.Rendering.GraphicsPreferences(instance));
            cbChatTimestamps.Checked = s["chat_timestamps"].AsBoolean();

            cbIMTimeStamps.Checked = s["im_timestamps"].AsBoolean();

            cbChatTimestamps.CheckedChanged += new EventHandler(cbChatTimestamps_CheckedChanged);
            cbIMTimeStamps.CheckedChanged += new EventHandler(cbIMTimeStamps_CheckedChanged);

            cbTrasactDialog.Checked = s["transaction_notification_dialog"].AsBoolean();
            cbTrasactChat.Checked = s["transaction_notification_chat"].AsBoolean();

            cbFriendsNotifications.Checked = s["show_friends_online_notifications"].AsBoolean();
            cbFriendsNotifications.CheckedChanged += new EventHandler(cbFriendsNotifications_CheckedChanged);

            cbAutoReconnect.Checked = s["auto_reconnect"].AsBoolean();
            cbAutoReconnect.CheckedChanged += new EventHandler(cbAutoReconnect_CheckedChanged);

            cbResolveURIs.Checked = s["resolve_uris"].AsBoolean();
            cbResolveURIs.CheckedChanged += new EventHandler(cbResolveURIs_CheckedChanged); ;

            cbHideLoginGraphics.Checked = s["hide_login_graphics"].AsBoolean();
            cbHideLoginGraphics.CheckedChanged += new EventHandler(cbHideLoginGraphics_CheckedChanged);

            cbRLV.Checked = s["rlv_enabled"].AsBoolean();
            cbRLV.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["rlv_enabled"] = new OSDBoolean(cbRLV.Checked);
            };

            cbRLVDebug.Checked = s["rlv_debugcommands"].AsBoolean();
            cbRLVDebug.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["rlv_debugcommands"] = new OSDBoolean(cbRLVDebug.Checked);
            };

            cbMUEmotes.Checked = s["mu_emotes"].AsBoolean();
            cbMUEmotes.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["mu_emotes"] = new OSDBoolean(cbMUEmotes.Checked);
            };

            if (s["chat_font_size"].Type != OSDType.Real)
            {
                s["chat_font_size"] = OSD.FromReal(((ChatConsole)instance.TabConsole.Tabs["chat"].Control).cbxInput.Font.Size);
            }

            cbFontSize.Text = s["chat_font_size"].AsReal().ToString(System.Globalization.CultureInfo.InvariantCulture);

            if (!s.ContainsKey("minimize_to_tray")) s["minimize_to_tray"] = OSD.FromBoolean(false);
            cbMinToTrey.Checked = s["minimize_to_tray"].AsBoolean();
            cbMinToTrey.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["minimize_to_tray"] = OSD.FromBoolean(cbMinToTrey.Checked);
            };

            cbNoTyping.Checked = s["no_typing_anim"].AsBoolean();
            cbNoTyping.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["no_typing_anim"] = OSD.FromBoolean(cbNoTyping.Checked);
            };

            txtAutoResponse.Text = s["auto_response_text"];
            txtAutoResponse.TextChanged += (object sender, EventArgs e) =>
            {
                s["auto_response_text"] = txtAutoResponse.Text;
            };
            AutoResponseType art = (AutoResponseType)s["auto_response_type"].AsInteger();
            switch (art)
            {
                case AutoResponseType.WhenBusy: rbAutobusy.Checked = true; break;
                case AutoResponseType.WhenFromNonFriend: rbAutoNonFriend.Checked = true; break;
                case AutoResponseType.Always: rbAutoAlways.Checked = true; break;
            }

            cbSyntaxHighlight.Checked = s["script_syntax_highlight"].AsBoolean();
            cbSyntaxHighlight.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["script_syntax_highlight"] = OSD.FromBoolean(cbSyntaxHighlight.Checked);
            };

            switch ((NameMode)s["display_name_mode"].AsInteger())
            {
                case NameMode.Standard: rbDNOff.Checked = true; break;
                case NameMode.Smart: rbDNSmart.Checked = true; break;
                case NameMode.DisplayNameAndUserName: rbDNDandUsernme.Checked = true; break;
                case NameMode.OnlyDisplayName: rbDNOnlyDN.Checked = true; break;
            }

            txtReconnectTime.Text = s["reconnect_time"].AsInteger().ToString();

            txtResolveURITime.Text = s["resolve_uri_time"].AsInteger().ToString();

            cbRadegastClientTag.Checked = s["send_rad_client_tag"];
            cbRadegastClientTag.CheckedChanged += (sender, e) =>
            {
                s["send_rad_client_tag"] = cbRadegastClientTag.Checked;
                instance.SetClientTag();
            };

            cbOnInvOffer.SelectedIndex = s["inv_auto_accept_mode"].AsInteger();
            cbOnInvOffer.SelectedIndexChanged += (sender, e) =>
            {
                s["inv_auto_accept_mode"] = cbOnInvOffer.SelectedIndex;
            };

            cbRadegastLogToFile.Checked = s["log_to_file"];

            cbDisableChatIMLog.Checked = s["disable_chat_im_log"];
            cbDisableChatIMLog.CheckedChanged += (sender, e) =>
            {
                s["disable_chat_im_log"] = cbDisableChatIMLog.Checked;
            };

            cbDisableLookAt.Checked = s["disable_look_at"];
            cbDisableLookAt.CheckedChanged += (sender, e) =>
            {
                s["disable_look_at"] = cbDisableLookAt.Checked;
            };

            cbConfirmExit.Checked = s["confirm_exit"];
            cbConfirmExit.CheckedChanged += (sender, e) =>
            {
                s["confirm_exit"] = cbConfirmExit.Checked;
            };

            cbTaskBarHighLight.Checked = s["taskbar_highlight"];
            cbTaskBarHighLight.CheckedChanged += (sender, e) =>
            {
                s["taskbar_highlight"] = cbTaskBarHighLight.Checked;
                UpdateEnabled();
            };

            cbFriendsHighlight.Checked = s["friends_notification_highlight"].AsBoolean();
            cbFriendsHighlight.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["friends_notification_highlight"] = new OSDBoolean(cbFriendsHighlight.Checked);
            };

            cbHighlightChat.Checked = s["highlight_on_chat"];
            cbHighlightChat.CheckedChanged += (sender, e) =>
            {
                s["highlight_on_chat"] = cbHighlightChat.Checked;
            };

            cbHighlightIM.Checked = s["highlight_on_im"];
            cbHighlightIM.CheckedChanged += (sender, e) =>
            {
                s["highlight_on_im"] = cbHighlightIM.Checked;
            };

            cbHighlightGroupIM.Checked = s["highlight_on_group_im"];
            cbHighlightGroupIM.CheckedChanged += (sender, e) =>
            {
                s["highlight_on_group_im"] = cbHighlightGroupIM.Checked;
            };

            // disable_av_name_link
            if (instance.MonoRuntime)
            {
                cbNameLinks.Visible = false;
            }
            else
            {
                cbNameLinks.Checked = s["av_name_link"];
                cbNameLinks.CheckedChanged += (sender, e) =>
                {
                    s["av_name_link"] = cbNameLinks.Checked;
                };
            }

            cbDisableHTTPInventory.Checked = s["disable_http_inventory"];
            cbDisableHTTPInventory.CheckedChanged += (sender, e) =>
            {
                s["disable_http_inventory"] = cbDisableHTTPInventory.Checked;
            };

            cbShowScriptErrors.Checked = s["show_script_errors"];
            cbShowScriptErrors.CheckedChanged += (sender, e) =>
            {
                s["show_script_errors"] = cbShowScriptErrors.Checked;
            };

            autoSitPrefsUpdate();
            pseudoHomePrefsUpdated();
            LSLHelperPrefsUpdate();

            cbAutoScriptPermission.Text = s["on_script_question"];

            UpdateEnabled();
        }
Пример #2
0
        public static void InitSettigs(Settings s, bool mono)
        {
            if (s["im_timestamps"].Type == OSDType.Unknown)
            {
                s["im_timestamps"] = OSD.FromBoolean(true);
            }

            if (s["rlv_enabled"].Type == OSDType.Unknown)
            {
                s["rlv_enabled"] = new OSDBoolean(false);
            }

            if (s["rlv_debugcommands"].Type == OSDType.Unknown)
            {
                s["rlv_debugcommands"] = new OSDBoolean(false);
            }

            if (s["mu_emotes"].Type == OSDType.Unknown)
            {
                s["mu_emotes"] = new OSDBoolean(false);
            }

            if (s["friends_notification_highlight"].Type == OSDType.Unknown)
            {
                s["friends_notification_highlight"] = new OSDBoolean(true);
            }

            if (!s.ContainsKey("no_typing_anim")) s["no_typing_anim"] = OSD.FromBoolean(false);

            if (!s.ContainsKey("auto_response_type"))
            {
                s["auto_response_type"] = (int)AutoResponseType.WhenBusy;
                s["auto_response_text"] = "The Resident you messaged is in 'busy mode' which means they have requested not to be disturbed.  Your message will still be shown in their IM panel for later viewing.";
            }

            if (!s.ContainsKey("script_syntax_highlight")) s["script_syntax_highlight"] = OSD.FromBoolean(true);

            if (!s.ContainsKey("display_name_mode")) s["display_name_mode"] = (int)NameMode.Smart;

            // Convert legacy settings from first last name to username
            if (!s.ContainsKey("username") && (s.ContainsKey("first_name") && s.ContainsKey("last_name")))
            {
                s["username"] = s["first_name"] + " " + s["last_name"];
                s.Remove("first_name");
                s.Remove("last_name");
            }

            if (!s.ContainsKey("reconnect_time")) s["reconnect_time"] = 120;

            if (!s.ContainsKey("resolve_uri_time")) s["resolve_uri_time"] = 100;

            if (!s.ContainsKey("resolve_uris")) s["resolve_uris"] = true;

            if (!s.ContainsKey("transaction_notification_chat")) s["transaction_notification_chat"] = true;

            if (!s.ContainsKey("transaction_notification_dialog")) s["transaction_notification_dialog"] = true;

            if (!s.ContainsKey("minimize_to_tray")) s["minimize_to_tray"] = false;

            if (!s.ContainsKey("scene_window_docked")) s["scene_window_docked"] = true;

            if (!s.ContainsKey("taskbar_highlight")) s["taskbar_highlight"] = true;

            if (!s.ContainsKey("rendering_occlusion_culling_enabled2")) s["rendering_occlusion_culling_enabled2"] = false;

            if (!s.ContainsKey("rendering_use_vbo")) s["rendering_use_vbo"] = true;

            if (!s.ContainsKey("send_rad_client_tag")) s["send_rad_client_tag"] = true;

            if (!s.ContainsKey("log_to_file")) s["log_to_file"] = true;

            if (!s.ContainsKey("disable_chat_im_log")) s["disable_chat_im_log"] = false;

            if (!s.ContainsKey("disable_look_at")) s["disable_look_at"] = false;

            if (!s.ContainsKey("confirm_exit")) s["confirm_exit"] = false;

            if (!s.ContainsKey("highlight_on_chat")) s["highlight_on_chat"] = true;

            if (!s.ContainsKey("highlight_on_im")) s["highlight_on_im"] = true;

            if (!s.ContainsKey("highlight_on_group_im")) s["highlight_on_group_im"] = true;

            if (!s.ContainsKey("av_name_link")) s["av_name_link"] = false;

            if (!s.ContainsKey("disable_http_inventory"))
            {
                s["disable_http_inventory"] = mono;
            }

            if (!s.ContainsKey("on_script_question"))
            {
                s["on_script_question"] = "Ask";
            }
        }