From 398fee93f3713562fa2037998b00351962fdd6d0 Mon Sep 17 00:00:00 2001 From: LilDosto Date: Wed, 28 Oct 2026 18:57:42 +0300 Subject: [PATCH] =?UTF-8?q?feat(v2.5.0):=20Kapsaml=C4=B1=20modern=20UI/UX?= =?UTF-8?q?=20ve=20ak=C4=B1=C5=9Fkanl=C4=B1k=20optimizasyonu,=20arama=20fi?= =?UTF-8?q?ltresi=20ve=20performans=20iyile=C5=9Ftirmeleri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- .../Controls/GraphPlotterControl.cs | 10 +- src/ttCalculator/Controls/OdeSolverControl.cs | 4 +- .../Controls/OdeSystemSolverControl.cs | 4 +- src/ttCalculator/Controls/PdeSolverControl.cs | 7 +- .../Controls/PdeSystemSolverControl.cs | 4 +- .../Controls/RootFinderControl.cs | 8 +- src/ttCalculator/MainForm.Designer.cs | 47 ++++-- src/ttCalculator/MainForm.cs | 146 ++++++++++++++---- src/ttCalculator/ThemeHelper.cs | 103 +++++++++--- src/ttCalculator/ttCalculator.csproj | 2 +- tests/ttCalculator.Tests/Program.cs | 2 +- 12 files changed, 268 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index a14af5f..19f34aa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 📐 ttCalculator v2.4.0 +# 📐 ttCalculator v2.5.0 [![GitHub release](https://img.shields.io/github/v/release/LilDosto/ttCalculator?color=brightgreen&label=S%C3%BCr%C3%BCm)](https://github.com/LilDosto/ttCalculator/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) @@ -15,8 +15,8 @@ Tüm matematiksel çekirdek, otomatik test paketinden **%100 başarıyla (0 hata Uygulamanın hazır derlenmiş Windows sürümünü (`ttCalculator.exe`) hemen çalıştırmak için: -1. **[Releases](https://github.com/LilDosto/ttCalculator/releases/tag/v2.4.0)** sayfasına gidin. -2. **`ttCalculator.exe`** (veya `ttCalculator-v2.4.0-win-x64.zip`) dosyasını indirin. +1. **[Releases](https://github.com/LilDosto/ttCalculator/releases/tag/v2.5.0)** sayfasına gidin. +2. **`ttCalculator.exe`** (veya `ttCalculator-v2.5.0-win-x64.zip`) dosyasını indirin. 3. Çift tıklayarak doğrudan çalıştırın — ek bağımlılık gerektirmez! --- diff --git a/src/ttCalculator/Controls/GraphPlotterControl.cs b/src/ttCalculator/Controls/GraphPlotterControl.cs index 3f89f04..07e52b6 100644 --- a/src/ttCalculator/Controls/GraphPlotterControl.cs +++ b/src/ttCalculator/Controls/GraphPlotterControl.cs @@ -111,6 +111,7 @@ namespace MathApp.Controls new object[] { true }); SetupEvents(); + ThemeHelper.StyleModernTabControl(tabManager); // Default preset AddFunctionCurve("sin(x)", false, -10f, 10f); @@ -896,15 +897,18 @@ namespace MathApp.Controls } } - string coordInfo = $"x = {logX:F3} | f(x) = {logY:F4} ({activeCurve.Equation})"; + decimal dfxDec = EvalDeriv(activeCurve.Compiled, (decimal)logX); + string coordInfo = $"x = {logX:F3} | f(x) = {logY:F4} | f'(x) = {dfxDec:F4} ({activeCurve.Equation})"; using (Font hudFont = new Font("Consolas", 9F, FontStyle.Bold)) using (Brush hudBg = new SolidBrush(Color.FromArgb(220, 15, 23, 42))) + using (Pen hudBorder = new Pen(Color.FromArgb(56, 189, 248), 1.2f)) using (Brush hudFg = new SolidBrush(Color.FromArgb(186, 230, 253))) { SizeF sz = g.MeasureString(coordInfo, hudFont); - RectangleF rect = new RectangleF(16, 12, sz.Width + 12, sz.Height + 8); + RectangleF rect = new RectangleF(16, 12, sz.Width + 14, sz.Height + 8); g.FillRectangle(hudBg, rect); - g.DrawString(coordInfo, hudFont, hudFg, rect.X + 6, rect.Y + 4); + g.DrawRectangle(hudBorder, rect.X, rect.Y, rect.Width, rect.Height); + g.DrawString(coordInfo, hudFont, hudFg, rect.X + 7, rect.Y + 4); } } catch { } diff --git a/src/ttCalculator/Controls/OdeSolverControl.cs b/src/ttCalculator/Controls/OdeSolverControl.cs index 9b64afb..eaf22ac 100644 --- a/src/ttCalculator/Controls/OdeSolverControl.cs +++ b/src/ttCalculator/Controls/OdeSolverControl.cs @@ -85,6 +85,7 @@ namespace MathApp.Controls int steps = (int)numSteps.Value; string method = cmbMethod.SelectedItem?.ToString() ?? "RK4"; + var sw = System.Diagnostics.Stopwatch.StartNew(); var results = await Task.Run(() => { bool prevRad = Function.UseRadians; @@ -98,6 +99,7 @@ namespace MathApp.Controls Function.UseRadians = prevRad; } }); + sw.Stop(); if (results != null && results.Count > 0) { @@ -107,7 +109,7 @@ namespace MathApp.Controls lblFinalValue.Text = $"y({lastXStr}) ≈ {lastYStr}"; lblFinalValue.ForeColor = Color.FromArgb(52, 211, 153); - lblFinalDetails.Text = $"✅ {method} ile {steps} adımda h = {((xEnd - x0) / steps).ToString("0.######", CultureInfo.InvariantCulture)} adım boyutuyla başarıyla çözüldü."; + lblFinalDetails.Text = $"✅ {method} ile {steps} adımda (h = {((xEnd - x0) / steps).ToString("0.######", CultureInfo.InvariantCulture)}) | ⏱️ {sw.ElapsedMilliseconds} ms"; StringBuilder sb = new StringBuilder(); sb.AppendLine("=== DİFERANSİYEL DENKLEM NÜMERİK ÇÖZÜM TABLOSU ==="); diff --git a/src/ttCalculator/Controls/OdeSystemSolverControl.cs b/src/ttCalculator/Controls/OdeSystemSolverControl.cs index a4ebf0a..e101fec 100644 --- a/src/ttCalculator/Controls/OdeSystemSolverControl.cs +++ b/src/ttCalculator/Controls/OdeSystemSolverControl.cs @@ -234,6 +234,7 @@ namespace MathApp.Controls int steps = (int)numSteps.Value; string method = cmbMethod.SelectedItem?.ToString() ?? "RK4"; + var sw = System.Diagnostics.Stopwatch.StartNew(); var results = await Task.Run(() => { return DifferentialEquations.SolveOdeSystem( @@ -247,6 +248,7 @@ namespace MathApp.Controls "t" ); }); + sw.Stop(); if (results.Count == 0) { @@ -268,7 +270,7 @@ namespace MathApp.Controls lblFinalValue.Text = sbFinal.ToString(); decimal dt = (tEnd - t0) / steps; - lblFinalDetails.Text = $"Yöntem: {method} | Adım Aralığı (h): {dt:F6} | Toplam Nokta: {results.Count}"; + lblFinalDetails.Text = $"Yöntem: {method} | Adım Aralığı (h): {dt:F6} | Toplam Nokta: {results.Count} | ⏱️ {sw.ElapsedMilliseconds} ms"; // Build Table StringBuilder sbOut = new StringBuilder(); diff --git a/src/ttCalculator/Controls/PdeSolverControl.cs b/src/ttCalculator/Controls/PdeSolverControl.cs index 3d1a96d..8eb7149 100644 --- a/src/ttCalculator/Controls/PdeSolverControl.cs +++ b/src/ttCalculator/Controls/PdeSolverControl.cs @@ -136,6 +136,7 @@ namespace MathApp.Controls if (!decimal.TryParse(txtBcRight.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal bcRight)) bcRight = 0m; + var sw = System.Diagnostics.Stopwatch.StartNew(); if (sel == 4) { // 2D Laplace @@ -145,9 +146,10 @@ namespace MathApp.Controls { return DifferentialEquations.Solve2DLaplace(nx, nx, bcLeft, bcRight, topBc, bottomBc); }); + sw.Stop(); lblStability.Text = $"2B Laplace Denklemi (SOR): {laplace.Iterations} iterasyonda yakınsadı (Kalıntı: {laplace.FinalResidual:G4})"; - lblDetails.Text = $"Izgara: {nx} × {nx} düğüm | Sınırlar: Sol={bcLeft}, Sağ={bcRight}, Üst={topBc}, Alt={bottomBc}"; + lblDetails.Text = $"Izgara: {nx} × {nx} düğüm | Sınırlar: Sol={bcLeft}, Sağ={bcRight}, Üst={topBc}, Alt={bottomBc} | ⏱️ {sw.ElapsedMilliseconds} ms"; StringBuilder sbL = new StringBuilder(); sbL.AppendLine("=========================================================================================="); @@ -206,11 +208,12 @@ namespace MathApp.Controls initVel ); }); + sw.Stop(); lblStability.Text = grid.StabilityNote; decimal dx = lengthL / (nx - 1); decimal dt = totalTimeT / (nt - 1); - lblDetails.Text = $"Izgara: {nx} mekan × {nt} zaman noktası | Δx = {dx:F4}, Δt = {dt:F6} | x ∈ [0, {lengthL}], t ∈ [0, {totalTimeT}]"; + lblDetails.Text = $"Izgara: {nx} mekan × {nt} zaman noktası | Δx = {dx:F4}, Δt = {dt:F6} | x ∈ [0, {lengthL}], t ∈ [0, {totalTimeT}] | ⏱️ {sw.ElapsedMilliseconds} ms"; // Format Table of Time Slices StringBuilder sb = new StringBuilder(); diff --git a/src/ttCalculator/Controls/PdeSystemSolverControl.cs b/src/ttCalculator/Controls/PdeSystemSolverControl.cs index 50948c1..e31f01c 100644 --- a/src/ttCalculator/Controls/PdeSystemSolverControl.cs +++ b/src/ttCalculator/Controls/PdeSystemSolverControl.cs @@ -114,6 +114,7 @@ namespace MathApp.Controls int nx = (int)numNx.Value; int nt = (int)numNt.Value; + var sw = System.Diagnostics.Stopwatch.StartNew(); var grid = await Task.Run(() => { return DifferentialEquations.SolveCoupledPdeSystem( @@ -129,11 +130,12 @@ namespace MathApp.Controls dv ); }); + sw.Stop(); lblSummary.Text = grid.SystemInfo; decimal dx = lengthL / (nx - 1); decimal dt = totalTimeT / (nt - 1); - lblDetails.Text = $"Izgara: {nx} mekan × {nt} zaman | Boyut: x ∈ [0, {lengthL}], t ∈ [0, {totalTimeT}] | Sıfır-Akı (Neumann) Sınırları"; + lblDetails.Text = $"Izgara: {nx} mekan × {nt} zaman | Boyut: x ∈ [0, {lengthL}], t ∈ [0, {totalTimeT}] | Sıfır-Akı (Neumann) | ⏱️ {sw.ElapsedMilliseconds} ms"; // Format Table StringBuilder sb = new StringBuilder(); diff --git a/src/ttCalculator/Controls/RootFinderControl.cs b/src/ttCalculator/Controls/RootFinderControl.cs index b6e1407..2db6246 100644 --- a/src/ttCalculator/Controls/RootFinderControl.cs +++ b/src/ttCalculator/Controls/RootFinderControl.cs @@ -139,6 +139,7 @@ namespace MathApp.Controls decimal minX = ParseDecimal(minXText, "Arama Alt Sınırı (a)"); decimal maxX = ParseDecimal(maxXText, "Arama Üst Sınırı (b)"); + var sw = System.Diagnostics.Stopwatch.StartNew(); var allRoots = await Task.Run(() => { bool prevRad = Function.UseRadians; @@ -152,13 +153,14 @@ namespace MathApp.Controls Function.UseRadians = prevRad; } }); + sw.Stop(); if (allRoots.Count == 0) { txtResult.Text = $"[{minX}, {maxX}] aralığında kök bulunamadı."; lblRootValue.Text = "Kök Bulunamadı"; lblRootValue.ForeColor = Color.FromArgb(239, 68, 68); - lblRootDetails.Text = $"[{minX}, {maxX}] aralığında f({variable}) = 0 sağlayan kök bulunamadı."; + lblRootDetails.Text = $"[{minX}, {maxX}] aralığında f({variable}) = 0 sağlayan kök bulunamadı. (⏱️ {sw.ElapsedMilliseconds} ms)"; } else { @@ -167,7 +169,7 @@ namespace MathApp.Controls $"=== [{minX}, {maxX}] ARALIĞINDA BULUNAN TÜM KÖKLER ===", $"Denklem : f({variable}) = {eq}", $"Tarama Aralığı : [{minX}, {maxX}]", - $"Bulunan Kök Sayısı: {allRoots.Count} adet", + $"Bulunan Kök Sayısı: {allRoots.Count} adet | ⏱️ {sw.ElapsedMilliseconds} ms", new string('-', 55) }; @@ -185,7 +187,7 @@ namespace MathApp.Controls lblRootValue.Text = heroText; lblRootValue.ForeColor = Color.FromArgb(52, 211, 153); - lblRootDetails.Text = $"🎯 [{minX}, {maxX}] aralığında toplam {allRoots.Count} adet reel kök başarıyla bulundu."; + lblRootDetails.Text = $"🎯 [{minX}, {maxX}] aralığında {allRoots.Count} kök bulundu | ⏱️ {sw.ElapsedMilliseconds} ms"; } return; } diff --git a/src/ttCalculator/MainForm.Designer.cs b/src/ttCalculator/MainForm.Designer.cs index 8e0cbd6..117980a 100644 --- a/src/ttCalculator/MainForm.Designer.cs +++ b/src/ttCalculator/MainForm.Designer.cs @@ -25,6 +25,8 @@ namespace MathApp this.pnlLogo = new Panel(); this.lblLogo = new Label(); this.lblLogoSub = new Label(); + this.pnlSearch = new Panel(); + this.txtSearchNav = new TextBox(); this.lblVersion = new Label(); this.lblCat1 = new Label(); @@ -51,28 +53,29 @@ namespace MathApp this.pnlSidebar.SuspendLayout(); this.pnlNavButtons.SuspendLayout(); this.pnlLogo.SuspendLayout(); + this.pnlSearch.SuspendLayout(); this.SuspendLayout(); // pnlSidebar (Left Navigation Bar) this.pnlSidebar.BackColor = ThemeHelper.SidebarBackground; this.pnlSidebar.Dock = DockStyle.Left; - this.pnlSidebar.Width = 255; + this.pnlSidebar.Width = 265; this.pnlSidebar.Padding = new Padding(8, 0, 8, 8); // pnlLogo this.pnlLogo.Dock = DockStyle.Top; - this.pnlLogo.Height = 80; - this.pnlLogo.Padding = new Padding(10, 12, 10, 6); + this.pnlLogo.Height = 72; + this.pnlLogo.Padding = new Padding(12, 12, 12, 4); this.lblLogo.Dock = DockStyle.Top; this.lblLogo.Height = 32; - this.lblLogo.Font = new Font("Segoe UI Semibold", 16F, FontStyle.Bold); + this.lblLogo.Font = new Font("Segoe UI Semibold", 15.5F, FontStyle.Bold); this.lblLogo.ForeColor = Color.FromArgb(56, 189, 248); this.lblLogo.Text = "ƒ(x) ttCalculator"; this.lblLogo.TextAlign = ContentAlignment.MiddleLeft; this.lblLogoSub.Dock = DockStyle.Top; - this.lblLogoSub.Height = 20; + this.lblLogoSub.Height = 18; this.lblLogoSub.Font = new Font("Segoe UI", 8.5F, FontStyle.Regular); this.lblLogoSub.ForeColor = ThemeHelper.MutedText; this.lblLogoSub.Text = "Nümerik Matematik Stüdyosu"; @@ -81,6 +84,20 @@ namespace MathApp this.pnlLogo.Controls.Add(this.lblLogoSub); this.pnlLogo.Controls.Add(this.lblLogo); + // pnlSearch (Module Quick Filter) + this.pnlSearch.Dock = DockStyle.Top; + this.pnlSearch.Height = 38; + this.pnlSearch.Padding = new Padding(10, 4, 10, 6); + + this.txtSearchNav.Dock = DockStyle.Fill; + this.txtSearchNav.BackColor = Color.FromArgb(20, 28, 45); + this.txtSearchNav.ForeColor = Color.FromArgb(203, 213, 225); + this.txtSearchNav.Font = new Font("Segoe UI", 9F); + this.txtSearchNav.BorderStyle = BorderStyle.FixedSingle; + this.txtSearchNav.Text = "🔍 Modül ara (Ctrl+F)..."; + + this.pnlSearch.Controls.Add(this.txtSearchNav); + // pnlNavButtons container with autoscroll support this.pnlNavButtons.Dock = DockStyle.Fill; this.pnlNavButtons.AutoScroll = true; @@ -90,7 +107,7 @@ namespace MathApp lbl.Dock = DockStyle.Top; lbl.Height = 28; lbl.Text = text; - lbl.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold); + lbl.Font = new Font("Segoe UI Semibold", 7.8F, FontStyle.Bold); lbl.ForeColor = Color.FromArgb(100, 116, 139); lbl.TextAlign = ContentAlignment.BottomLeft; lbl.Padding = new Padding(12, 0, 0, 4); @@ -101,11 +118,11 @@ namespace MathApp btn.Dock = DockStyle.Top; btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderSize = 0; - btn.FlatAppearance.MouseOverBackColor = Color.FromArgb(30, 41, 59); + btn.FlatAppearance.MouseOverBackColor = Color.FromArgb(24, 33, 52); btn.FlatAppearance.MouseDownBackColor = ThemeHelper.AccentBlue; btn.Font = new Font("Segoe UI", 9.2F, FontStyle.Regular); btn.ForeColor = Color.FromArgb(203, 213, 225); - btn.Size = new Size(239, 36); + btn.Size = new Size(249, 36); btn.TabIndex = index + 1; btn.Text = text; btn.TextAlign = ContentAlignment.MiddleLeft; @@ -138,8 +155,8 @@ namespace MathApp // Footer version label this.lblVersion.Dock = DockStyle.Bottom; - this.lblVersion.Height = 26; - this.lblVersion.Text = "v2.4 • 128-bit Decimal Motoru"; + this.lblVersion.Height = 28; + this.lblVersion.Text = "v2.5 • 128-bit Decimal Motoru • 60 FPS"; this.lblVersion.Font = new Font("Segoe UI", 8F); this.lblVersion.ForeColor = Color.FromArgb(100, 116, 139); this.lblVersion.TextAlign = ContentAlignment.MiddleCenter; @@ -172,6 +189,7 @@ namespace MathApp // Assemble pnlSidebar this.pnlSidebar.Controls.Add(this.pnlNavButtons); + this.pnlSidebar.Controls.Add(this.pnlSearch); this.pnlSidebar.Controls.Add(this.pnlLogo); this.pnlSidebar.Controls.Add(this.lblVersion); @@ -182,9 +200,10 @@ namespace MathApp // MainForm this.AutoScaleDimensions = new SizeF(7F, 15F); this.AutoScaleMode = AutoScaleMode.Font; - this.ClientSize = new Size(1220, 750); - this.MinimumSize = new Size(1060, 680); + this.ClientSize = new Size(1260, 780); + this.MinimumSize = new Size(1080, 700); this.StartPosition = FormStartPosition.CenterScreen; + this.KeyPreview = true; this.Controls.Add(this.pnlContent); this.Controls.Add(this.pnlSidebar); this.Name = "MainForm"; @@ -193,6 +212,8 @@ namespace MathApp this.pnlSidebar.ResumeLayout(false); this.pnlNavButtons.ResumeLayout(false); this.pnlLogo.ResumeLayout(false); + this.pnlSearch.ResumeLayout(false); + this.pnlSearch.PerformLayout(); this.ResumeLayout(false); } @@ -202,6 +223,8 @@ namespace MathApp private Panel pnlLogo; private Label lblLogo; private Label lblLogoSub; + private Panel pnlSearch; + private TextBox txtSearchNav; private Label lblVersion; private Label lblCat1; diff --git a/src/ttCalculator/MainForm.cs b/src/ttCalculator/MainForm.cs index 920468f..4dba830 100644 --- a/src/ttCalculator/MainForm.cs +++ b/src/ttCalculator/MainForm.cs @@ -1,6 +1,7 @@ using System; using System.Drawing; using System.IO; +using System.Linq; using System.Windows.Forms; using MathApp.Controls; @@ -23,6 +24,8 @@ namespace MathApp private PdeSystemSolverControl pdeSystemControl; private UserControl[] allControls; + private Button[] allNavButtons; + private Button activeNavButton; protected override CreateParams CreateParams { @@ -30,7 +33,7 @@ namespace MathApp { CreateParams cp = base.CreateParams; // WS_EX_COMPOSITED (0x02000000) paints all descendants in bottom-to-top order using double-buffering. - // Eliminates window tearing and redraw flicker. + // Eliminates window tearing and redraw flicker completely. cp.ExStyle |= 0x02000000; return cp; } @@ -44,6 +47,8 @@ namespace MathApp ThemeHelper.ApplyTheme(this); InitializeControls(); + SetupSearchFilter(); + SetupHotkeys(); // Default View ShowControl(calcControl); @@ -114,8 +119,38 @@ namespace MathApp pdeSystemControl }; + allNavButtons = new Button[] { + btnNavCalc, + btnNavGraph, + btnNavCombinatorics, + btnNavRoot, + btnNavSystem, + btnNavDerivative, + btnNavMatrix, + btnNavTaylor, + btnNavMultiTaylor, + btnNavOde, + btnNavOdeSystem, + btnNavPde, + btnNavPdeSystem + }; + + // Custom paint active indicator bar on navigation buttons + foreach (var btn in allNavButtons) + { + btn.Paint += (s, pe) => + { + if (s == activeNavButton) + { + using (Brush barBrush = new SolidBrush(ThemeHelper.AccentBlue)) + { + pe.Graphics.FillRectangle(barBrush, 0, 4, 4, btn.Height - 8); + } + } + }; + } + pnlContent.SuspendLayout(); - // Pre-add all controls once to avoid Win32 HWND re-creation and flickering on tab switch pnlContent.Controls.AddRange(allControls); foreach (var ctrl in allControls) { @@ -125,6 +160,79 @@ namespace MathApp pnlContent.ResumeLayout(false); } + private void SetupSearchFilter() + { + string placeholder = "🔍 Modül ara (Ctrl+F)..."; + txtSearchNav.GotFocus += (s, e) => + { + if (txtSearchNav.Text == placeholder) + { + txtSearchNav.Text = ""; + txtSearchNav.ForeColor = Color.White; + } + }; + + txtSearchNav.LostFocus += (s, e) => + { + if (string.IsNullOrWhiteSpace(txtSearchNav.Text)) + { + txtSearchNav.Text = placeholder; + txtSearchNav.ForeColor = Color.FromArgb(148, 163, 184); + } + }; + + txtSearchNav.TextChanged += (s, e) => + { + string query = txtSearchNav.Text.Trim(); + if (query == placeholder) return; + + bool empty = string.IsNullOrWhiteSpace(query); + foreach (var btn in allNavButtons) + { + if (empty) + { + btn.Visible = true; + } + else + { + btn.Visible = btn.Text.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0; + } + } + }; + + txtSearchNav.KeyDown += (s, e) => + { + if (e.KeyCode == Keys.Enter) + { + e.SuppressKeyPress = true; + var firstMatch = allNavButtons.FirstOrDefault(b => b.Visible); + firstMatch?.PerformClick(); + } + }; + } + + private void SetupHotkeys() + { + this.KeyDown += (s, e) => + { + if (e.Control && e.KeyCode == Keys.F) + { + txtSearchNav.Focus(); + txtSearchNav.SelectAll(); + e.SuppressKeyPress = true; + } + else if (e.Control && e.KeyCode == Keys.D1) { btnNavCalc.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D2) { btnNavGraph.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D3) { btnNavCombinatorics.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D4) { btnNavRoot.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D5) { btnNavSystem.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D6) { btnNavDerivative.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D7) { btnNavMatrix.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D8) { btnNavTaylor.PerformClick(); e.SuppressKeyPress = true; } + else if (e.Control && e.KeyCode == Keys.D9) { btnNavOde.PerformClick(); e.SuppressKeyPress = true; } + }; + } + private void ShowControl(UserControl control) { if (control == null || allControls == null) return; @@ -148,40 +256,26 @@ namespace MathApp private void HighlightButton(Button activeBtn) { - Color activeColor = ThemeHelper.AccentBlue; - Color idleColor = ThemeHelper.SidebarBackground; + activeNavButton = activeBtn; + Color activeBg = Color.FromArgb(24, 33, 52); + Color idleBg = ThemeHelper.SidebarBackground; - Button[] allButtons = { - btnNavCalc, - btnNavRoot, - btnNavSystem, - btnNavMatrix, - btnNavDerivative, - btnNavTaylor, - btnNavMultiTaylor, - btnNavCombinatorics, - btnNavGraph, - btnNavOde, - btnNavOdeSystem, - btnNavPde, - btnNavPdeSystem - }; - - foreach (var btn in allButtons) + foreach (var btn in allNavButtons) { if (btn == null) continue; if (btn == activeBtn) { - btn.BackColor = activeColor; - btn.ForeColor = Color.White; - btn.Font = new Font(btn.Font, FontStyle.Bold); + btn.BackColor = activeBg; + btn.ForeColor = Color.FromArgb(56, 189, 248); + btn.Font = new Font("Segoe UI Semibold", 9.2F, FontStyle.Bold); } else { - btn.BackColor = idleColor; + btn.BackColor = idleBg; btn.ForeColor = Color.FromArgb(203, 213, 225); - btn.Font = new Font(btn.Font, FontStyle.Regular); + btn.Font = new Font("Segoe UI", 9.2F, FontStyle.Regular); } + btn.Invalidate(); } } } diff --git a/src/ttCalculator/ThemeHelper.cs b/src/ttCalculator/ThemeHelper.cs index 16a206e..9de11cd 100644 --- a/src/ttCalculator/ThemeHelper.cs +++ b/src/ttCalculator/ThemeHelper.cs @@ -1,25 +1,29 @@ using System; using System.Drawing; +using System.Drawing.Drawing2D; using System.Windows.Forms; namespace MathApp { public static class ThemeHelper { - // Modern Dark Slate Color Palette + // Modern Dark Slate / Neon Accent Color Palette public static readonly Color DarkBackground = Color.FromArgb(15, 23, 42); // #0F172A Slate 900 - public static readonly Color SidebarBackground = Color.FromArgb(11, 17, 32); // #0B1120 Deep Slate - public static readonly Color CardBackground = Color.FromArgb(30, 41, 59); // #1E293B Slate 800 - public static readonly Color CardHeader = Color.FromArgb(40, 53, 76); // #28354C + public static readonly Color SidebarBackground = Color.FromArgb(11, 15, 28); // #0B0F1C Deep Void Slate + public static readonly Color CardBackground = Color.FromArgb(24, 33, 52); // #182134 Modern Card Slate + public static readonly Color CardBackgroundHover = Color.FromArgb(30, 41, 64);// #1E2940 Hover Card + public static readonly Color CardHeader = Color.FromArgb(33, 44, 70); // #212C46 Card Header public static readonly Color InputBackground = Color.FromArgb(15, 23, 42); // #0F172A Slate 900 - public static readonly Color ButtonSecondary = Color.FromArgb(51, 65, 85); // #334155 Slate 700 - public static readonly Color ButtonHover = Color.FromArgb(71, 85, 105); // #475569 Slate 600 + public static readonly Color ButtonSecondary = Color.FromArgb(47, 59, 82); // #2F3B52 Slate 700 + public static readonly Color ButtonHover = Color.FromArgb(64, 78, 107); // #404E6B Slate 600 public static readonly Color AccentBlue = Color.FromArgb(14, 165, 233); // #0EA5E9 Sky 500 public static readonly Color AccentBlueHover = Color.FromArgb(56, 189, 248); // #38BDF8 Sky 400 public static readonly Color AccentIndigo = Color.FromArgb(99, 102, 241); // #6366F1 Indigo 500 + public static readonly Color AccentPurple = Color.FromArgb(168, 85, 247); // #A855F7 Purple 500 public static readonly Color LightText = Color.FromArgb(248, 250, 252); // #F8FAFC Slate 50 public static readonly Color MutedText = Color.FromArgb(148, 163, 184); // #94A3B8 Slate 400 public static readonly Color BorderColor = Color.FromArgb(51, 65, 85); // #334155 Slate 700 + public static readonly Color BorderLight = Color.FromArgb(71, 85, 105); // #475569 Slate 600 public static readonly Color DangerRed = Color.FromArgb(239, 68, 68); // #EF4444 Red 500 public static readonly Color SuccessGreen = Color.FromArgb(16, 185, 129); // #10B981 Emerald 500 public static readonly Color AmberWarning = Color.FromArgb(245, 158, 11); // #F59E0B Amber 500 @@ -30,7 +34,7 @@ namespace MathApp form.ForeColor = LightText; } - public static Button CreateActionButton(string text, int width = 160, int height = 38, bool isPrimary = true) + public static Button CreateActionButton(string text, int width = 160, int height = 36, bool isPrimary = true) { Button btn = new Button { @@ -39,12 +43,13 @@ namespace MathApp FlatStyle = FlatStyle.Flat, BackColor = isPrimary ? AccentBlue : ButtonSecondary, ForeColor = Color.White, - Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold), + Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold), Cursor = Cursors.Hand, UseVisualStyleBackColor = false }; btn.FlatAppearance.BorderSize = 0; btn.FlatAppearance.MouseOverBackColor = isPrimary ? AccentBlueHover : ButtonHover; + btn.FlatAppearance.MouseDownBackColor = isPrimary ? Color.FromArgb(2, 132, 199) : Color.FromArgb(30, 41, 59); return btn; } @@ -55,9 +60,9 @@ namespace MathApp Text = text, AutoSize = true, MinimumSize = new Size(80, 28), - Padding = new Padding(8, 2, 8, 2), + Padding = new Padding(10, 2, 10, 2), FlatStyle = FlatStyle.Flat, - BackColor = Color.FromArgb(30, 41, 59), + BackColor = Color.FromArgb(20, 29, 47), ForeColor = Color.FromArgb(186, 230, 253), Font = new Font("Segoe UI", 9F, FontStyle.Regular), Cursor = Cursors.Hand, @@ -65,8 +70,8 @@ namespace MathApp UseVisualStyleBackColor = false }; btn.FlatAppearance.BorderSize = 1; - btn.FlatAppearance.BorderColor = Color.FromArgb(56, 189, 248); - btn.FlatAppearance.MouseOverBackColor = Color.FromArgb(51, 65, 85); + btn.FlatAppearance.BorderColor = Color.FromArgb(14, 165, 233); + btn.FlatAppearance.MouseOverBackColor = Color.FromArgb(30, 58, 138); return btn; } @@ -75,18 +80,26 @@ namespace MathApp Panel pnlHeader = new Panel { Dock = DockStyle.Top, - Height = 72, - BackColor = Color.FromArgb(15, 23, 42), + Height = 74, + BackColor = Color.FromArgb(13, 20, 36), Padding = new Padding(24, 12, 24, 8) }; + // Vibrant left accent indicator pill + Panel accentPill = new Panel + { + Location = new Point(12, 16), + Size = new Size(4, 38), + BackColor = AccentBlue + }; + Label lblTitle = new Label { Text = title, - Dock = DockStyle.Top, + Location = new Point(24, 12), AutoSize = false, - Height = 30, - Font = new Font("Segoe UI Semibold", 16F, FontStyle.Bold), + Size = new Size(900, 28), + Font = new Font("Segoe UI Semibold", 15F, FontStyle.Bold), ForeColor = LightText, TextAlign = ContentAlignment.MiddleLeft }; @@ -94,10 +107,10 @@ namespace MathApp Label lblSub = new Label { Text = subtitle, - Dock = DockStyle.Bottom, + Location = new Point(24, 40), AutoSize = false, - Height = 22, - Font = new Font("Segoe UI", 9F, FontStyle.Regular), + Size = new Size(900, 22), + Font = new Font("Segoe UI", 8.8F, FontStyle.Regular), ForeColor = MutedText, TextAlign = ContentAlignment.MiddleLeft }; @@ -109,6 +122,7 @@ namespace MathApp BackColor = BorderColor }; + pnlHeader.Controls.Add(accentPill); pnlHeader.Controls.Add(lblSub); pnlHeader.Controls.Add(lblTitle); pnlHeader.Controls.Add(divider); @@ -142,13 +156,60 @@ namespace MathApp ForeColor = Color.FromArgb(226, 232, 240), Font = new Font("Segoe UI", 8.5F), Cursor = Cursors.Hand, - Padding = new Padding(8, 2, 8, 2) + Padding = new Padding(10, 2, 10, 2) }; btn.FlatAppearance.BorderSize = 0; btn.FlatAppearance.MouseOverBackColor = ButtonHover; return btn; } + public static void StyleModernTabControl(TabControl tabControl) + { + if (tabControl == null) return; + + tabControl.DrawMode = TabDrawMode.OwnerDrawFixed; + tabControl.SizeMode = TabSizeMode.Fixed; + tabControl.ItemSize = new Size(Math.Max(70, tabControl.Width / Math.Max(1, tabControl.TabCount) - 4), 32); + + tabControl.DrawItem += (s, e) => + { + Graphics g = e.Graphics; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; + + TabPage page = tabControl.TabPages[e.Index]; + Rectangle tabRect = tabControl.GetTabRect(e.Index); + bool isSelected = (tabControl.SelectedIndex == e.Index); + + Color bg = isSelected ? CardBackground : Color.FromArgb(13, 20, 36); + using (Brush b = new SolidBrush(bg)) + { + g.FillRectangle(b, tabRect); + } + + if (isSelected) + { + // Active accent underline + using (Brush barBrush = new SolidBrush(AccentBlue)) + { + g.FillRectangle(barBrush, tabRect.X + 6, tabRect.Bottom - 3, tabRect.Width - 12, 3); + } + } + + Color textColor = isSelected ? Color.FromArgb(56, 189, 248) : MutedText; + using (Font font = new Font("Segoe UI Semibold", 9F, isSelected ? FontStyle.Bold : FontStyle.Regular)) + using (Brush textBrush = new SolidBrush(textColor)) + { + StringFormat sf = new StringFormat + { + Alignment = StringAlignment.Center, + LineAlignment = StringAlignment.Center + }; + g.DrawString(page.Text, font, textBrush, tabRect, sf); + } + }; + } + public static void EnableDoubleBuffering(Control control) { if (control == null) return; diff --git a/src/ttCalculator/ttCalculator.csproj b/src/ttCalculator/ttCalculator.csproj index 4381af7..b043cdf 100644 --- a/src/ttCalculator/ttCalculator.csproj +++ b/src/ttCalculator/ttCalculator.csproj @@ -9,7 +9,7 @@ logo.ico ttCalculator ttCalculator - Gelişmiş Matematik & Nümerik Analiz Stüdyosu - 2.4.0 + 2.5.0 ttCalculator diff --git a/tests/ttCalculator.Tests/Program.cs b/tests/ttCalculator.Tests/Program.cs index 65e6f7d..eb29271 100644 --- a/tests/ttCalculator.Tests/Program.cs +++ b/tests/ttCalculator.Tests/Program.cs @@ -10,7 +10,7 @@ namespace MathApp.Tests static void Main(string[] args) { Console.WriteLine("========================================"); - Console.WriteLine("ttCalculator v2.4 Algorithm Verification"); + Console.WriteLine("ttCalculator v2.5 Algorithm Verification"); Console.WriteLine("========================================"); int passed = 0;