private void ApplyToUI(FleetImageArgument args) { int[] fleetIDs = args.FleetIDs ?? new int[0]; TargetFleet1.Checked = fleetIDs.Contains(1); TargetFleet2.Checked = fleetIDs.Contains(2); TargetFleet3.Checked = fleetIDs.Contains(3); TargetFleet4.Checked = fleetIDs.Contains(4); if (!SyncronizeTitleAndFileName.Checked) { Title.Text = args.Title; } Comment.Text = string.IsNullOrWhiteSpace(args.Comment) ? "" : LFtoCRLF.Replace(args.Comment, "\r\n"); // 保存データからのロード時に \n に変換されてしまっているため HorizontalFleetCount.Value = args.HorizontalFleetCount; HorizontalShipCount.Value = args.HorizontalShipCount; ReflectDamageGraphic.Checked = args.ReflectDamageGraphic; AvoidTwitterDeterioration.Checked = args.AvoidTwitterDeterioration; BackgroundImagePath.Text = args.BackgroundImagePath; for (int i = 0; i < TextFontList.Length; i++) { TextFontList[i].Text = SerializableFont.FontToString(args.Fonts[i], true); } }
private void EditCommandButton_Load(object sender, EventArgs e) { foreach (var c in MainForm.RemoteCommands.Where(p => !p.inwindow)) { var n = c.name; if (n.StartsWith("cmd_")) { n = LocRm.GetString(n); } ddlCommand.Items.Add(new MainForm.ListItem2(n, c.id)); } if (ddlCommand.Items.Count == 0) { MessageBox.Show(this, "No commands available. See remote commands in iSpy"); Close(); } if (location != Point.Empty) { locX.Value = location.X; locY.Value = location.Y; } color = Color.Black; backColor = Color.White; CustomFont = MainForm.Drawfont; ddlCommand.SelectedIndex = 0; }
public ConfigUI() { //*/ MainFont = new Font("Meiryo UI", 12, FontStyle.Regular, GraphicsUnit.Pixel); SubFont = new Font("Meiryo UI", 10, FontStyle.Regular, GraphicsUnit.Pixel); //*/ }
private void SelectFont_Click(object sender, EventArgs e, int index) { fontDialog1.Font = SerializableFont.StringToFont(TextFontList[index].Text, true); if (fontDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TextFontList[index].Text = SerializableFont.FontToString(fontDialog1.Font, true); } }
private void SelectGeneralFont_Click(object sender, EventArgs e) { fontDialog1.Font = GeneralFont; if (fontDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { GeneralFont = fontDialog1.Font; TextGeneralFont.Text = SerializableFont.FontToString(GeneralFont, true); } }
private void button4_Click(object sender, EventArgs e) { var fd = new FontDialog { ShowColor = false, Font = CustomFont.FontValue, Color = color, ShowEffects = true }; if (fd.ShowDialog() != DialogResult.Cancel) { CustomFont = new SerializableFont(fd.Font); color = fd.Color; } }
private void UI_SubFontSelect_Click(object sender, EventArgs e) { FontSelector.Font = UI_SubFont.Font; if (FontSelector.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { SerializableFont font = new SerializableFont(FontSelector.Font); UI_SubFont.Text = font.SerializeFontAttribute; UI_SubFont.Font = font.FontData; } }
private ColoredFont(SerializationInfo info, StreamingContext context) { Color = (Color)info.GetValue("Color", typeof(Color)); try { SerializableFont = (SerializableFont)info.GetValue("SerializableFont", typeof(SerializableFont)); } catch (SerializationException serEx) { Font f = (Font)info.GetValue("Font", typeof(Font)); // do something to initialize SerializedFont from 'f' } }
private void UI_SubFont_Validating(object sender, CancelEventArgs e) { var newfont = SerializableFont.StringToFont(UI_SubFont.Text, true); if (newfont != null) { UI_RenderingTest.SubFont = newfont; UI_SubFont.BackColor = SystemColors.Window; } else { UI_SubFont.BackColor = Color.MistyRose; } }
private void EditCommandButton_Load(object sender, EventArgs e) { CustomFont = FontXmlConverter.ConvertToFont(CMD.font); color = CMD.color.ToColor(); backColor = CMD.backcolor.ToColor(); var s = CMD.size.Split('x'); numW.Value = Convert.ToInt32(s[0]); numH.Value = Convert.ToInt32(s[1]); var l = CMD.location.Split(','); locX.Value = Convert.ToInt32(l[0]); locY.Value = Convert.ToInt32(l[1]); var n = CMD.name; if (n.StartsWith("cmd_")) n = LocRm.GetString(n); lblCommand.Text = n; }
private void ButtonClearFont_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to reset font\r\nsettings to the default values?", "Clear Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { if (GeneralFont != null) { GeneralFont.Dispose(); } GeneralFont = null; TextGeneralFont.Text = ""; var defaultFonts = FleetImageArgument.GetDefaultFonts(); for (int i = 0; i < TextFontList.Length; i++) { TextFontList[i].Text = SerializableFont.FontToString(defaultFonts[i]); defaultFonts[i].Dispose(); } } }
private void ButtonClearFont_Click(object sender, EventArgs e) { if (MessageBox.Show("フォントをデフォルト設定に戻します。\r\nよろしいですか?", "クリア確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { if (GeneralFont != null) { GeneralFont.Dispose(); } GeneralFont = null; TextGeneralFont.Text = ""; var defaultFonts = FleetImageArgument.GetDefaultFonts(); for (int i = 0; i < TextFontList.Length; i++) { TextFontList[i].Text = SerializableFont.FontToString(defaultFonts[i]); defaultFonts[i].Dispose(); } } }
private void EditCommandButton_Load(object sender, EventArgs e) { CustomFont = FontXmlConverter.ConvertToFont(CMD.font); color = CMD.color.ToColor(); backColor = CMD.backcolor.ToColor(); var s = CMD.size.Split('x'); numW.Value = Convert.ToInt32(s[0]); numH.Value = Convert.ToInt32(s[1]); var l = CMD.location.Split(','); locX.Value = Convert.ToInt32(l[0]); locY.Value = Convert.ToInt32(l[1]); var n = CMD.name; if (n.StartsWith("cmd_")) { n = LocRm.GetString(n); } lblCommand.Text = n; }
private void ApplyGeneralFont_Click(object sender, EventArgs e) { if (GeneralFont != null) { GeneralFont.Dispose(); } GeneralFont = SerializableFont.StringToFont(TextGeneralFont.Text, true); if (GeneralFont == null) { MessageBox.Show("フォント名が正しくありません。", "フォント変換失敗", MessageBoxButtons.OK, MessageBoxIcon.Error); TextGeneralFont.Text = ""; return; } for (int i = 0; i < TextFontList.Length; i++) { float size = FleetImageArgument.DefaultFontPixels[i]; var unit = GraphicsUnit.Pixel; var style = FontStyle.Regular; var font = SerializableFont.StringToFont(TextFontList[i].Text, true); if (font != null) { size = font.Size; unit = font.Unit; style = font.Style; font.Dispose(); } font = new Font(GeneralFont.FontFamily, size, style, unit); TextFontList[i].Text = SerializableFont.FontToString(font); font.Dispose(); } }
private FleetImageArgument ApplyToArgument(FleetImageArgument defaultValue = null) { var ret = defaultValue == null ? new FleetImageArgument() : defaultValue.Clone(); ret.FleetIDs = new[] { TargetFleet1.Checked ? 1 : 0, TargetFleet2.Checked ? 2 : 0, TargetFleet3.Checked ? 3 : 0, TargetFleet4.Checked ? 4 : 0 }.Where(i => i > 0).ToArray(); ret.HorizontalFleetCount = (int)HorizontalFleetCount.Value; ret.HorizontalShipCount = (int)HorizontalShipCount.Value; ret.ReflectDamageGraphic = ReflectDamageGraphic.Checked; ret.AvoidTwitterDeterioration = AvoidTwitterDeterioration.Checked; var fonts = ret.Fonts; for (int i = 0; i < fonts.Length; i++) { if (fonts[i] != null) { fonts[i].Dispose(); } fonts[i] = SerializableFont.StringToFont(TextFontList[i].Text, true); } ret.Fonts = fonts; ret.BackgroundImagePath = BackgroundImagePath.Text; ret.Title = Title.Text; ret.Comment = Comment.Text; return(ret); }
private void UI_SubFontApply_Click(object sender, EventArgs e) { UI_SubFont.Font = SerializableFont.StringToFont(UI_SubFont.Text) ?? UI_SubFont.Font; }
/// <summary> /// UIをもとに設定を適用します。 /// </summary> public void ToConfiguration(Configuration.ConfigurationData config) { //[通信] { bool changed = false; changed |= config.Connection.Port != (ushort)Connection_Port.Value; config.Connection.Port = (ushort)Connection_Port.Value; config.Connection.SaveReceivedData = Connection_SaveReceivedData.Checked; config.Connection.SaveDataPath = Connection_SaveDataPath.Text.Trim(@"\ """.ToCharArray()); config.Connection.SaveRequest = Connection_SaveRequest.Checked; config.Connection.SaveResponse = Connection_SaveResponse.Checked; config.Connection.SaveOtherFile = Connection_SaveOtherFile.Checked; config.Connection.ApplyVersion = Connection_ApplyVersion.Checked; changed |= config.Connection.RegisterAsSystemProxy != Connection_RegisterAsSystemProxy.Checked; config.Connection.RegisterAsSystemProxy = Connection_RegisterAsSystemProxy.Checked; changed |= config.Connection.UseUpstreamProxy != Connection_UseUpstreamProxy.Checked; config.Connection.UseUpstreamProxy = Connection_UseUpstreamProxy.Checked; changed |= config.Connection.UpstreamProxyPort != (ushort)Connection_UpstreamProxyPort.Value; config.Connection.UpstreamProxyPort = (ushort)Connection_UpstreamProxyPort.Value; changed |= config.Connection.UpstreamProxyAddress != Connection_UpstreamProxyAddress.Text; config.Connection.UpstreamProxyAddress = Connection_UpstreamProxyAddress.Text; changed |= config.Connection.UseSystemProxy != Connection_UseSystemProxy.Checked; config.Connection.UseSystemProxy = Connection_UseSystemProxy.Checked; changed |= config.Connection.DownstreamProxy != Connection_DownstreamProxy.Text; config.Connection.DownstreamProxy = Connection_DownstreamProxy.Text; if (changed) { APIObserver.Instance.Start(config.Connection.Port, _UIControl); } } //[UI] { var newfont = SerializableFont.StringToFont(UI_MainFont.Text, true); if (newfont != null) { config.UI.MainFont = newfont; } } { var newfont = SerializableFont.StringToFont(UI_SubFont.Text, true); if (newfont != null) { config.UI.SubFont = newfont; } } config.UI.BarColorMorphing = UI_BarColorMorphing.Checked; config.UI.IsLayoutFixed = UI_IsLayoutFixed.Checked; //[ログ] config.Log.LogLevel = (int)Log_LogLevel.Value; config.Log.SaveLogFlag = Log_SaveLogFlag.Checked; config.Log.SaveErrorReport = Log_SaveErrorReport.Checked; config.Log.FileEncodingID = Log_FileEncodingID.SelectedIndex; config.Log.ShowSpoiler = Log_ShowSpoiler.Checked; config.Log.SaveBattleLog = Log_SaveBattleLog.Checked; config.Log.SaveLogImmediately = Log_SaveLogImmediately.Checked; //[動作] config.Control.ConditionBorder = (int)Control_ConditionBorder.Value; config.Control.RecordAutoSaving = Control_RecordAutoSaving.SelectedIndex; config.Control.UseSystemVolume = Control_UseSystemVolume.Checked; config.Control.PowerEngagementForm = Control_PowerEngagementForm.SelectedIndex + 1; config.Control.ShowSallyAreaAlertDialog = Control_ShowSallyAreaAlertDialog.Checked; config.Control.ShowExpeditionAlertDialog = Control_ShowExpeditionAlertDialog.Checked; //[デバッグ] config.Debug.EnableDebugMenu = Debug_EnableDebugMenu.Checked; config.Debug.LoadAPIListOnLoad = Debug_LoadAPIListOnLoad.Checked; config.Debug.APIListPath = Debug_APIListPath.Text; config.Debug.AlertOnError = Debug_AlertOnError.Checked; //[起動と終了] config.Life.ConfirmOnClosing = Life_ConfirmOnClosing.Checked; config.Life.TopMost = Life_TopMost.Checked; config.Life.LayoutFilePath = Life_LayoutFilePath.Text; config.Life.CheckUpdateInformation = Life_CheckUpdateInformation.Checked; config.Life.ShowStatusBar = Life_ShowStatusBar.Checked; config.Life.ClockFormat = Life_ClockFormat.SelectedIndex; config.Life.LockLayout = Life_LockLayout.Checked; config.Life.CanCloseFloatWindowInLock = Life_CanCloseFloatWindowInLock.Checked; //[サブウィンドウ] config.FormArsenal.ShowShipName = FormArsenal_ShowShipName.Checked; config.FormArsenal.BlinkAtCompletion = FormArsenal_BlinkAtCompletion.Checked; config.FormArsenal.MaxShipNameWidth = (int)FormArsenal_MaxShipNameWidth.Value; config.FormDock.BlinkAtCompletion = FormDock_BlinkAtCompletion.Checked; config.FormDock.MaxShipNameWidth = (int)FormDock_MaxShipNameWidth.Value; config.FormFleet.ShowAircraft = FormFleet_ShowAircraft.Checked; config.FormFleet.SearchingAbilityMethod = FormFleet_SearchingAbilityMethod.SelectedIndex; config.FormFleet.IsScrollable = FormFleet_IsScrollable.Checked; config.FormFleet.FixShipNameWidth = FormFleet_FixShipNameWidth.Checked; config.FormFleet.ShortenHPBar = FormFleet_ShortenHPBar.Checked; config.FormFleet.ShowNextExp = FormFleet_ShowNextExp.Checked; config.FormFleet.EquipmentLevelVisibility = (Window.Control.ShipStatusEquipment.LevelVisibilityFlag)FormFleet_EquipmentLevelVisibility.SelectedIndex; config.FormFleet.ShowAircraftLevelByNumber = FormFleet_ShowAircraftLevelByNumber.Checked; config.FormFleet.AirSuperiorityMethod = FormFleet_AirSuperiorityMethod.SelectedIndex; config.FormFleet.ShowAnchorageRepairingTimer = FormFleet_ShowAnchorageRepairingTimer.Checked; config.FormFleet.BlinkAtCompletion = FormFleet_BlinkAtCompletion.Checked; config.FormFleet.ShowConditionIcon = FormFleet_ShowConditionIcon.Checked; config.FormFleet.FixedShipNameWidth = (int)FormFleet_FixedShipNameWidth.Value; config.FormFleet.ShowAirSuperiorityRange = FormFleet_ShowAirSuperiorityRange.Checked; config.FormFleet.ReflectAnchorageRepairHealing = FormFleet_ReflectAnchorageRepairHealing.Checked; config.FormFleet.BlinkAtDamaged = FormFleet_BlinkAtDamaged.Checked; config.FormFleet.EmphasizesSubFleetInPort = FormFleet_EmphasizesSubFleetInPort.Checked; config.FormFleet.FleetStateDisplayMode = FormFleet_FleetStateDisplayMode.SelectedIndex; config.FormFleet.AppliesSallyAreaColor = FormFleet_AppliesSallyAreaColor.Checked; config.FormHeadquarters.BlinkAtMaximum = FormHeadquarters_BlinkAtMaximum.Checked; { var list = new List <bool>(); for (int i = 0; i < FormHeadquarters_Visibility.Items.Count; i++) { list.Add(FormHeadquarters_Visibility.GetItemChecked(i)); } config.FormHeadquarters.Visibility.List = list; } { string name = FormHeadquarters_DisplayUseItemID.Text; if (string.IsNullOrEmpty(name)) { config.FormHeadquarters.DisplayUseItemID = -1; } else { var item = ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems.Values.FirstOrDefault(p => p.Name == name); if (item != null) { config.FormHeadquarters.DisplayUseItemID = item.ItemID; } else { if (int.TryParse(name, out int val)) { config.FormHeadquarters.DisplayUseItemID = val; } else { config.FormHeadquarters.DisplayUseItemID = -1; } } } } config.FormQuest.ShowRunningOnly = FormQuest_ShowRunningOnly.Checked; config.FormQuest.ShowOnce = FormQuest_ShowOnce.Checked; config.FormQuest.ShowDaily = FormQuest_ShowDaily.Checked; config.FormQuest.ShowWeekly = FormQuest_ShowWeekly.Checked; config.FormQuest.ShowMonthly = FormQuest_ShowMonthly.Checked; config.FormQuest.ShowOther = FormQuest_ShowOther.Checked; config.FormQuest.ProgressAutoSaving = FormQuest_ProgressAutoSaving.SelectedIndex; config.FormQuest.AllowUserToSortRows = FormQuest_AllowUserToSortRows.Checked; config.FormShipGroup.AutoUpdate = FormShipGroup_AutoUpdate.Checked; config.FormShipGroup.ShowStatusBar = FormShipGroup_ShowStatusBar.Checked; config.FormShipGroup.ShipNameSortMethod = FormShipGroup_ShipNameSortMethod.SelectedIndex; config.FormBattle.IsScrollable = FormBattle_IsScrollable.Checked; config.FormBattle.HideDuringBattle = FormBattle_HideDuringBattle.Checked; config.FormBattle.ShowHPBar = FormBattle_ShowHPBar.Checked; config.FormBattle.ShowShipTypeInHPBar = FormBattle_ShowShipTypeInHPBar.Checked; config.FormBattle.Display7thAsSingleLine = FormBattle_Display7thAsSingleLine.Checked; config.FormBrowser.IsEnabled = FormBrowser_IsEnabled.Checked; config.FormBrowser.ZoomRate = (double)FormBrowser_ZoomRate.Value / 100; config.FormBrowser.ZoomFit = FormBrowser_ZoomFit.Checked; config.FormBrowser.LogInPageURL = FormBrowser_LogInPageURL.Text; if (FormBrowser_ScreenShotFormat_JPEG.Checked) { config.FormBrowser.ScreenShotFormat = 1; } else { config.FormBrowser.ScreenShotFormat = 2; } config.FormBrowser.ScreenShotPath = FormBrowser_ScreenShotPath.Text; config.FormBrowser.ConfirmAtRefresh = FormBrowser_ConfirmAtRefresh.Checked; config.FormBrowser.AppliesStyleSheet = FormBrowser_AppliesStyleSheet.Checked; config.FormBrowser.IsDMMreloadDialogDestroyable = FormBrowser_IsDMMreloadDialogDestroyable.Checked; config.FormBrowser.AvoidTwitterDeterioration = FormBrowser_ScreenShotFormat_AvoidTwitterDeterioration.Checked; config.FormBrowser.HardwareAccelerationEnabled = FormBrowser_HardwareAccelerationEnabled.Checked; config.FormBrowser.PreserveDrawingBuffer = FormBrowser_PreserveDrawingBuffer.Checked; config.FormBrowser.ForceColorProfile = FormBrowser_ForceColorProfile.Checked; if (FormBrowser_ToolMenuDockStyle.SelectedIndex == 4) { config.FormBrowser.IsToolMenuVisible = false; } else { config.FormBrowser.IsToolMenuVisible = true; config.FormBrowser.ToolMenuDockStyle = (DockStyle)(FormBrowser_ToolMenuDockStyle.SelectedIndex + 1); } config.FormBrowser.ScreenShotSaveMode = FormBrowser_ScreenShotSaveMode.SelectedIndex + 1; config.FormCompass.CandidateDisplayCount = (int)FormCompass_CandidateDisplayCount.Value; config.FormCompass.IsScrollable = FormCompass_IsScrollable.Checked; config.FormCompass.MaxShipNameWidth = (int)FormCompass_MaxShipNameWidth.Value; config.FormJson.AutoUpdate = FormJson_AutoUpdate.Checked; config.FormJson.UpdatesTree = FormJson_UpdatesTree.Checked; config.FormJson.AutoUpdateFilter = FormJson_AutoUpdateFilter.Text; config.FormBaseAirCorps.ShowEventMapOnly = FormBaseAirCorps_ShowEventMapOnly.Checked; //[通知] setSilencioConfig(Notification_Silencio.Checked); //[BGM] config.BGMPlayer.Enabled = BGMPlayer_Enabled.Checked; for (int i = 0; i < BGMPlayer_ControlGrid.Rows.Count; i++) { BGMHandles[(SyncBGMPlayer.SoundHandleID)BGMPlayer_ControlGrid[BGMPlayer_ColumnContent.Index, i].Value].Enabled = (bool)BGMPlayer_ControlGrid[BGMPlayer_ColumnEnabled.Index, i].Value; } config.BGMPlayer.Handles = new List <SyncBGMPlayer.SoundHandle>(BGMHandles.Values.ToList()); config.BGMPlayer.SyncBrowserMute = BGMPlayer_SyncBrowserMute.Checked; }
private void EditCommandButton_Load(object sender, EventArgs e) { foreach (var c in MainForm.RemoteCommands.Where(p=>!p.inwindow)) { var n = c.name; if (n.StartsWith("cmd_")) n = LocRm.GetString(n); ddlCommand.Items.Add(new MainForm.ListItem2(n, c.id)); } if (ddlCommand.Items.Count == 0) { MessageBox.Show(this, "No commands available. See remote commands in iSpy"); Close(); } if (location != Point.Empty) { locX.Value = location.X; locY.Value = location.Y; } color = Color.Black; backColor = Color.White; CustomFont = MainForm.Drawfont; ddlCommand.SelectedIndex = 0; }