public TimelineAutoLoader(TimelineController _controller) { controller = _controller; timer = new Timer(); timer.Interval = 5000; timer.Tick += timer_CheckCurrentZone; }
public TimelineView(TimelineController controller_) { controller = controller_; controller.TimelineUpdate += controller_TimelineUpdate; controller.CurrentTimeUpdate += controller_CurrentTimeUpdate; textWidth = 100; barWidth = 100; SetupUI(); this.MouseDown += TimelineView_MouseDown; this.VisibleChanged += TimelineView_VisibleChanged; this.Move += TimelineView_Move; this.FormClosing += TimelineView_FormClosing; typeof(DataGridView). GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic). SetValue(dataGridView, true, null); dataGridView.SelectionChanged += (object sender, EventArgs args) => dataGridView.ClearSelection(); dataGridView.AutoGenerateColumns = false; dataGridView.Columns.Add(textColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Name", AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill }); dataGridView.Columns.Add(timeLeftColumn = new TimeLeftColumn { Controller = controller_ }); MyOpacity = 0.8; NumberOfRowsToDisplay = 3; MoveByDrag = true; ShowOverlayButtons = true; UpdateLayout(); soundplayer = new CachedSoundPlayer(); TimelineFont = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold); }
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, "", "", errorText, cellStyle, advancedBorderStyle, paintParts); TimelineActivity activity = (TimelineActivity)value; TimelineController controller = ((TimeLeftColumn)OwningColumn).Controller; { double timeTillStart = activity.TimeFromStart - controller.CurrentTime; float timeTillStartF = (float)timeTillStart; float durationF = (float)activity.Duration; if (durationF < 0.1F) { durationF = 0.1F; } PaintBar(graphics, cellBounds, timeTillStartF, durationF); } { double timeTillEnd = activity.EndTime - controller.CurrentTime; string text = timeTillEnd > 0 ? timeTillEnd.ToString("0") : "ACTION!"; PaintText(graphics, cellBounds, text); } }
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { try { // DI log writer Globals.WriteLogImpl = (str) => { ActGlobals.oFormActMain.WriteInfoLog(String.Format("act_timeline: {0}", str)); }; ScreenSpace = pluginScreenSpace; StatusText = pluginStatusText; StatusText.Text = "Loading Sprache.dll"; #if DEBUG // Sprache.dll is already injected by libZ in Release builds. Assembly.LoadFrom("Sprache.dll"); #endif StatusText.Text = "Sprache.dll Load Success!"; #if DEBUG // See Issue #1 // Control.CheckForIllegalCrossThreadCalls = true; #endif Controller = new TimelineController(); TimelineView = new TimelineView(Controller); TimelineView.Show(); TimelineView.DoubleClick += TimelineView_DoubleClick; TimelineAutoLoader = new TimelineAutoLoader(this); TimelineAutoLoader.Start(); Settings = new PluginSettings(this); Settings.AddStringSetting("TimelineTxtFilePath"); Settings.AddStringSetting("FontString"); Settings.AddIntSetting("TextWidth"); Settings.AddIntSetting("BarWidth"); Settings.AddIntSetting("OpacityPercentage"); ActGlobals.oFormActMain.OnCombatEnd += CombatEnd; SetupTab(); InjectButton(); Settings.Load(); SetupUpdateChecker(); StatusText.Text = "Plugin Started (^^)!"; } catch (Exception e) { if (StatusText != null) { StatusText.Text = "Plugin Init Failed: " + e.Message; } } }
public OverlayButtonsForm(TimelineController controller_) { controller = controller_; InitializeComponent(); this.ShowInTaskbar = false; // Force set small window size below OS minimum. Win32APIUtils.SetWindowSize(Handle, 55, 20); Win32APIUtils.SetWS_EX_NOACTIVATE(Handle, true); controller.PausedUpdate += controller_PausedUpdate; controller_PausedUpdate(null, EventArgs.Empty); }
public TimelineView(TimelineController controller_) { controller = controller_; controller.TimelineUpdate += controller_TimelineUpdate; controller.CurrentTimeUpdate += controller_CurrentTimeUpdate; barHeight = 25; barWidth = 200; ShowIcon = false; ShowInTaskbar = false; SetupUI(); MouseDown += TimelineView_MouseDown; VisibleChanged += TimelineView_VisibleChanged; Move += TimelineView_Move; FormClosing += TimelineView_FormClosing; typeof(DataGridView). GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic). SetValue(dataGridView, true, null); dataGridView.SelectionChanged += (object sender, EventArgs args) => dataGridView.ClearSelection(); dataGridView.AutoGenerateColumns = false; dataGridView.Columns.Add(timeLeftColumn = new TimeLeftColumn { Controller = controller_ }); MyOpacity = 0.8; NumberOfRowsToDisplay = 3; MoveByDrag = true; ShowOverlayButtons = true; Over10 = true; Under10 = true; ShowCasting = true; PopupMode = false; UpdateLayout(); soundplayer = new CachedSoundPlayer(); TimelineFont = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold); }
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { try { // DI log writer Globals.WriteLogImpl = (str) => { ActGlobals.oFormActMain.WriteInfoLog(String.Format("act_timeline: {0}", str)); }; ScreenSpace = pluginScreenSpace; StatusText = pluginStatusText; StatusText.Text = "Loading Sprache.dll"; #if DEBUG // Sprache.dll is already injected by libZ in Release builds. Assembly.LoadFrom("Sprache.dll"); #endif StatusText.Text = "Sprache.dll Load Success!"; #if DEBUG // See Issue #1 // Control.CheckForIllegalCrossThreadCalls = true; #endif Controller = new TimelineController(); TimelineView = new TimelineView(Controller); TimelineView.Show(); TimelineView.DoubleClick += TimelineView_DoubleClick; Settings = new PluginSettings(this); Settings.AddStringSetting("TimelineTxtFilePath"); Settings.AddStringSetting("FontString"); Settings.AddIntSetting("TextWidth"); Settings.AddIntSetting("BarWidth"); Settings.AddIntSetting("OpacityPercentage"); SetupTab(); InjectButton(); Settings.Load(); SetupUpdateChecker(); StatusText.Text = "Plugin Started (^^)!"; } catch(Exception e) { if (StatusText != null) StatusText.Text = "Plugin Init Failed: "+e.Message; } }
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { try { AppDomain.CurrentDomain.AssemblyResolve += delegate(object sender, ResolveEventArgs args) { string asmFile = (args.Name.Contains(",") ? args.Name.Substring(0, args.Name.IndexOf(",")) : args.Name); if (!ASMCHK.Contains(asmFile)) { return(null); } try { return(Assembly.LoadFile(Path.Combine(GetPluginDirectory(), asmFile + ".dll"))); } catch { return(null); } }; // DI log writer Globals.WriteLogImpl = (str) => { ActGlobals.oFormActMain.WriteInfoLog(String.Format("act_timeline: {0}", str)); }; ScreenSpace = pluginScreenSpace; StatusText = pluginStatusText; StatusText.Text = "Loading Sprache.dll"; #if DEBUG // Sprache.dll is already injected by libZ in Release builds. Assembly.LoadFrom("Sprache.dll"); #endif StatusText.Text = "Sprache.dll Load Success!"; #if DEBUG // See Issue #1 // Control.CheckForIllegalCrossThreadCalls = true; #endif Controller = new TimelineController(); TimelineView = new TimelineView(Controller); TimelineView.DoubleClick += TimelineView_DoubleClick; visibilityControl = new VisibilityControl(TimelineView); visibilityControl.Visible = true; TimelineAutoLoader = new TimelineAutoLoader(Controller); TimelineAutoLoader.Start(); Settings = new PluginSettings(this); Settings.AddStringSetting("TimelineTxtFilePath"); Settings.AddStringSetting("FontString"); Settings.AddIntSetting("TextWidth"); Settings.AddIntSetting("BarWidth"); Settings.AddIntSetting("OpacityPercentage"); SetupTab(); InjectButton(); Settings.Load(); SetupUpdateChecker(); StatusText.Text = Translator.Get("_LN_PluginStarted"); xivWindowTimer = new System.Threading.Timer(e => { try { if (this.AutoHide) { uint pid; var hWndFg = NativeMethods.GetForegroundWindow(); if (hWndFg == IntPtr.Zero) { return; } NativeMethods.GetWindowThreadProcessId(hWndFg, out pid); var exePath = Process.GetProcessById((int)pid).MainModule.FileName; if (Path.GetFileName(exePath) == "ffxiv.exe" || Path.GetFileName(exePath) == "ffxiv_dx11.exe") { this.TimelineView.Invoke(new Action(() => this.TimelineView.Visible = true)); } else { this.TimelineView.Invoke(new Action(() => this.TimelineView.Visible = false)); } } } catch { } }); } catch (Exception e) { if (StatusText != null) { StatusText.Text = "Plugin Init Failed: " + e.Message; } } }