diff --git a/WinCCFlexArchViewer/About.Designer.cs b/WinCCFlexArchViewer/About.Designer.cs index b91c6b7..08170cf 100644 --- a/WinCCFlexArchViewer/About.Designer.cs +++ b/WinCCFlexArchViewer/About.Designer.cs @@ -40,9 +40,9 @@ private void InitializeComponent() this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.label1.Location = new System.Drawing.Point(158, 8); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(268, 16); + this.label1.Size = new System.Drawing.Size(225, 16); this.label1.TabIndex = 1; - this.label1.Text = "WinCC flexible Log Viewer 1.9.0 beta3"; + this.label1.Text = "WinCC flexible Log Viewer 1.9.0"; // // label3 // diff --git a/WinCCFlexArchViewer/Main.Designer.cs b/WinCCFlexArchViewer/Main.Designer.cs index 7069703..dab3104 100644 --- a/WinCCFlexArchViewer/Main.Designer.cs +++ b/WinCCFlexArchViewer/Main.Designer.cs @@ -91,8 +91,8 @@ private void InitializeComponent() // this.togleTableToolStripMenuItem.Image = global::WinCCFlexLogViewer.Properties.Resources.glyphicons_120_table; this.togleTableToolStripMenuItem.Name = "togleTableToolStripMenuItem"; - this.togleTableToolStripMenuItem.Size = new System.Drawing.Size(98, 20); - this.togleTableToolStripMenuItem.Text = "toggle table"; + this.togleTableToolStripMenuItem.Size = new System.Drawing.Size(64, 20); + this.togleTableToolStripMenuItem.Text = "Table"; this.togleTableToolStripMenuItem.ToolTipText = "Toggle table view"; this.togleTableToolStripMenuItem.Click += new System.EventHandler(this.togleTableToolStripMenuItem_Click); // @@ -100,15 +100,15 @@ private void InitializeComponent() // this.hideshowcurveMenuItem.Image = global::WinCCFlexLogViewer.Properties.Resources.glyphicons_115_list; this.hideshowcurveMenuItem.Name = "hideshowcurveMenuItem"; - this.hideshowcurveMenuItem.Size = new System.Drawing.Size(123, 20); - this.hideshowcurveMenuItem.Text = "show/hide curve"; + this.hideshowcurveMenuItem.Size = new System.Drawing.Size(71, 20); + this.hideshowcurveMenuItem.Text = "Curves"; // // printMenuItem // this.printMenuItem.Image = global::WinCCFlexLogViewer.Properties.Resources.glyphicons_16_print; this.printMenuItem.Name = "printMenuItem"; this.printMenuItem.Size = new System.Drawing.Size(60, 20); - this.printMenuItem.Text = "print"; + this.printMenuItem.Text = "Print"; this.printMenuItem.ToolTipText = "Print Graph"; this.printMenuItem.Click += new System.EventHandler(this.printMenuItem_Click); // @@ -117,8 +117,8 @@ private void InitializeComponent() this.lockunlockvzoomMenuItem.CheckOnClick = true; this.lockunlockvzoomMenuItem.Image = global::WinCCFlexLogViewer.Properties.Resources.glyphicons_242_flash; this.lockunlockvzoomMenuItem.Name = "lockunlockvzoomMenuItem"; - this.lockunlockvzoomMenuItem.Size = new System.Drawing.Size(131, 20); - this.lockunlockvzoomMenuItem.Text = "lock vertical zoom"; + this.lockunlockvzoomMenuItem.Size = new System.Drawing.Size(134, 20); + this.lockunlockvzoomMenuItem.Text = "Lock vertical zoom"; this.lockunlockvzoomMenuItem.ToolTipText = "Toggle Y-axis zoom lock"; this.lockunlockvzoomMenuItem.Click += new System.EventHandler(this.lockunlockvzoomMenuItem_Click); // @@ -146,8 +146,8 @@ private void InitializeComponent() // this.ControlsStripMenuItem.Image = global::WinCCFlexLogViewer.Properties.Resources.glyphicons_589_remote_control_tv; this.ControlsStripMenuItem.Name = "ControlsStripMenuItem"; - this.ControlsStripMenuItem.Size = new System.Drawing.Size(78, 20); - this.ControlsStripMenuItem.Text = "controls"; + this.ControlsStripMenuItem.Size = new System.Drawing.Size(80, 20); + this.ControlsStripMenuItem.Text = "Controls"; this.ControlsStripMenuItem.ToolTipText = "Toggle Control pad"; this.ControlsStripMenuItem.Click += new System.EventHandler(this.ControlsStripMenuItem_Click); // @@ -155,8 +155,8 @@ private void InitializeComponent() // this.fullscreenToolStripMenuItem.Image = global::WinCCFlexLogViewer.Properties.Resources.fullscreen2; this.fullscreenToolStripMenuItem.Name = "fullscreenToolStripMenuItem"; - this.fullscreenToolStripMenuItem.Size = new System.Drawing.Size(86, 20); - this.fullscreenToolStripMenuItem.Text = "fullscreen"; + this.fullscreenToolStripMenuItem.Size = new System.Drawing.Size(88, 20); + this.fullscreenToolStripMenuItem.Text = "Fullscreen"; this.fullscreenToolStripMenuItem.ToolTipText = "Toggle fullscreen mode"; this.fullscreenToolStripMenuItem.Click += new System.EventHandler(this.fullscreenToolStripMenuItem_Click); // @@ -343,7 +343,6 @@ private void InitializeComponent() this.loadingpanel.Size = new System.Drawing.Size(846, 454); this.loadingpanel.TabIndex = 1; this.loadingpanel.Visible = false; - this.loadingpanel.Paint += new System.Windows.Forms.PaintEventHandler(this.loadingpanel_Paint); // // progress_counter_textlabel // @@ -366,6 +365,7 @@ private void InitializeComponent() // DTrend // this.DTrend.Dock = System.Windows.Forms.DockStyle.Fill; + this.DTrend.IsEnableSelection = true; this.DTrend.Location = new System.Drawing.Point(0, 0); this.DTrend.Margin = new System.Windows.Forms.Padding(0); this.DTrend.Name = "DTrend"; diff --git a/WinCCFlexArchViewer/Main.cs b/WinCCFlexArchViewer/Main.cs index 911dd2b..d7d8b85 100644 --- a/WinCCFlexArchViewer/Main.cs +++ b/WinCCFlexArchViewer/Main.cs @@ -55,6 +55,7 @@ public Main() DTrend.GraphPane.Y2Axis.MinorTic.IsOpposite = false; DTrend.GraphPane.Y2Axis.IsVisible = false; DTrend.GraphPane.X2Axis.IsVisible = false; + DTrend.Selection.SelectionChangedEvent += new EventHandler(Selection_SelectionChangedEvent); DTrend.GraphPane.AxisChange(); DTrend.Refresh(); string[] commandLineArgs = Environment.GetCommandLineArgs(); @@ -72,7 +73,7 @@ public Main() if (File.Exists(path)) { loadingpanel.Visible = true; - csv_file = path; + log_file = path; startparsing(); } } @@ -100,7 +101,7 @@ private void fileToolStripMenuItem_Click(object sender, EventArgs e) if (openFileDialog1.ShowDialog() == DialogResult.OK) { loadingpanel.Visible = true; - csv_file = openFileDialog1.FileName; + log_file = openFileDialog1.FileName; startparsing(); } } @@ -115,7 +116,7 @@ private void startparsing() centerLoadingAnnimation(); BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerSupportsCancellation = true; - if (Path.GetExtension(csv_file) != ".rdb") + if (Path.GetExtension(log_file) != ".rdb") backgroundWorker.DoWork += parse_data; else backgroundWorker.DoWork += startparsingSQL; @@ -133,7 +134,7 @@ private void startparsingSQL(object sender, DoWorkEventArgs e) dataColumn.ColumnName = "Date Time"; table.Columns.Add(dataColumn); //добавляем столбец Дата-Время - SQLiteConnection m_dbConn = new SQLiteConnection("Data Source=" + csv_file + ";Version=3;"); + SQLiteConnection m_dbConn = new SQLiteConnection("Data Source=" + log_file + ";Version=3;"); try { m_dbConn.Open(); @@ -190,7 +191,7 @@ private void parse_data(object sender, DoWorkEventArgs e) List list = new List(); try { // Чтение файла построчно в список - StreamReader streamReader = new StreamReader(new FileStream(csv_file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.Default); + StreamReader streamReader = new StreamReader(new FileStream(log_file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.Default); string item; while ( (item = streamReader.ReadLine()) != null ) { @@ -280,10 +281,9 @@ private void parse_data(object sender, DoWorkEventArgs e) flag = 0; foreach (string text5 in list) // { - if (flag == 0) flag++; // сделано для пропуска первой строки в списке - Заголовок лога + if (flag == 0) flag++; // else { - // flag++; //Скорее всего это не нужно string[] array2 = text5.Split( new char[]{c} ); // Получаем массив элементов из строки списка лога if (array2.Length == 5 && array2[0].IndexOf("\"\"") == -1) { @@ -325,7 +325,14 @@ private void parse_data(object sender, DoWorkEventArgs e) // private void dataparsing_complete(object sender, RunWorkerCompletedEventArgs e) - { if(goodRecCounter==0) { MessageBox.Show("File contains no data"); panel1.Hide(); progress_timer.Enabled = false; return; } + { + if (goodRecCounter==0) + { + MessageBox.Show("File contains no data"); + panel1.Hide(); + progress_timer.Enabled = false; + return; + } dataGridView_data.DataSource = table; dataGridView_data.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; int numColor = 0; @@ -398,7 +405,7 @@ private void dataparsing_complete(object sender, RunWorkerCompletedEventArgs e) int num3 = 0; foreach (DateTime dateTime in timeList) { - array[num3] = dateTime.ToString(); + array[num3] = dateTime.ToString().Replace(" ", "\n"); num3++; } DTrend.GraphPane.XAxis.Scale.Max = (double)num3; @@ -422,8 +429,8 @@ private void setYminMax(object sender, EventArgs e) if (yaxis.Title.Text.IndexOf(((ToolStripMenuItem)sender).OwnerItem.Text) != -1) { YScaleSettings yscaleSettings = new YScaleSettings(yaxis.Scale.Min, yaxis.Scale.Max, ((ToolStripMenuItem)sender).OwnerItem.Text); - yscaleSettings.ShowDialog(); - if (yscaleSettings.set) + yscaleSettings.ShowDialog(); + if (yscaleSettings.set) { yaxis.Scale.MaxAuto = false; yaxis.Scale.MinAuto = false; @@ -507,35 +514,18 @@ private void lockunlockvzoomMenuItem_Click(object sender, EventArgs e) lockunlockvzoomMenuItem.BackColor = SystemColors.Control; } - // Print proc + // Toolbar Print button click private void printMenuItem_Click(object sender, EventArgs e) { - using (PrintDocument printDocument = new PrintDocument()) - { - printDlg.Document = printDocument; //yur - printDlg.AllowSelection = true; //yur - printDlg.AllowSomePages = true; //yur - // - printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); - printDocument.OriginAtMargins = false; - printDocument.DefaultPageSettings.Landscape = true; - printDocument.PrintPage += delegate(object _, PrintPageEventArgs o) - { - double num = 39.370078740157481; - Image image = DTrend.MasterPane.GetImage(); - o.Graphics.DrawImage(image, (float)(1.0 * num), (float)(1.0 * num), (float)(27.0 * num), (float)(18.0 * num)); - o.HasMorePages = false; - }; - if (printDlg.ShowDialog() == DialogResult.OK) //yur - printDocument.Print(); - } - } + DoPrint(); + } // private void aboutMenuItem_Click(object sender, EventArgs e) { About about = new About(); about.ShowDialog(); + about.Dispose(); } // @@ -544,7 +534,7 @@ private void ExitStripMenuItem_Click(object sender, EventArgs e) Application.Exit(); } - // ToggleFullScreenButton Click + // Toolbar ToggleFullScreen Button Click private void fullscreenToolStripMenuItem_Click(object sender, EventArgs e) { if (FormBorderStyle == FormBorderStyle.Sizable) @@ -636,27 +626,14 @@ private void button_panbottom_Click(object sender, EventArgs e) DTrend.Refresh(); } - // + // ControlPad print button click private void button_print_Click(object sender, EventArgs e) { - using (PrintDocument printDocument = new PrintDocument()) - { - printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); - printDocument.OriginAtMargins = false; - printDocument.DefaultPageSettings.Landscape = true; - printDocument.PrintPage += delegate(object _, PrintPageEventArgs o) - { - double num = 39.370078740157481; - Image image = DTrend.MasterPane.GetImage(); - o.Graphics.DrawImage(image, (float)(1.0 * num), (float)(1.0 * num), (float)(27.0 * num), (float)(18.0 * num)); - o.HasMorePages = false; - }; - printDocument.Print(); - } - } + DoPrint(); + } - // - private void DTrend_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState) + // + private void DTrend_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState) { griddatascroll(); } @@ -707,13 +684,50 @@ private void progress_timer_Tick(object sender, EventArgs e) centerLoadingAnnimation(); } - // - private void loadingpanel_Paint(object sender, PaintEventArgs e) - { - } + // + private void SaveCSVMenuItem_Click(object sender, EventArgs e) + { + if (dataGridView_data.RowCount <= 0) //test to see if the DataGridView has any rows + { + MessageBox.Show("DataGrid contains no data\nNothing to save :)"); + return; + } + var sfd = new SaveFileDialog(); + sfd.Filter = "CSV files (*.csv)|*.csv"; + sfd.FileName = "table.csv"; + if (sfd.ShowDialog() != DialogResult.OK) return; + + string value = String.Empty; + StreamWriter swOut = new StreamWriter(sfd.FileName, false); - // Массив цветов для графиков - public string[] colors = new string[] + foreach (DataGridViewColumn dc in dataGridView_data.Columns) + { + value += dc.Name + ";"; + } + value = value.Substring(0, value.Length - 1) + Environment.NewLine; + swOut.Write(value); + value = String.Empty; + + foreach (DataGridViewRow ddr in dataGridView_data.Rows) + { + if (ddr.IsNewRow) + continue; + foreach (DataGridViewCell dc in ddr.Cells) + { + if (dc.Value != null) + { + value += dc.Value.ToString() + ";"; + } + } + value = value.Substring(0, value.Length - 1) + Environment.NewLine; + swOut.Write(value); + value = ""; + } + swOut.Close(); + } + + // Массив цветов для графиков + public string[] colors = new string[] { "#00FF00", // Lime ярко желто-зеленый "#0000FF", // Blue ярко синий @@ -775,7 +789,7 @@ private void loadingpanel_Paint(object sender, PaintEventArgs e) }; // Имя открытого файла лога - private string csv_file = ""; + private string log_file = ""; // private SortedList data_graph = new SortedList(); // @@ -791,45 +805,40 @@ private void loadingpanel_Paint(object sender, PaintEventArgs e) // Количество "полезных" записей (равно общее кол-во строк минус заголовок минус записи служебных тегов Скады) private int goodRecCounter; - private void SaveCSVMenuItem_Click(object sender, EventArgs e) + + private void DoPrint() { - if (dataGridView_data.RowCount <= 0) //test to see if the DataGridView has any rows + using (PrintDocument printDocument = new PrintDocument()) { - MessageBox.Show("DataGrid contains no data\nNothing to save :)"); - return; - } - var sfd = new SaveFileDialog(); - sfd.Filter = "CSV files (*.csv)|*.csv"; - sfd.FileName = "table.csv"; - if (sfd.ShowDialog() != DialogResult.OK) return; + printDlg.Document = printDocument; + printDlg.AllowSelection = true; + printDlg.AllowSomePages = true; - string value = String.Empty; - StreamWriter swOut = new StreamWriter(sfd.FileName, false); - - foreach (DataGridViewColumn dc in dataGridView_data.Columns) - { - value += dc.Name + ";"; + printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); + printDocument.OriginAtMargins = false; + printDocument.DefaultPageSettings.Landscape = true; + printDocument.PrintPage += delegate (object _, PrintPageEventArgs o) + { + double num = 39.370078740157481; + Image image = DTrend.MasterPane.GetImage(); + o.Graphics.DrawImage(image, (float)(1.0 * num), (float)(1.0 * num), (float)(27.0 * num), (float)(18.0 * num)); + o.HasMorePages = false; + }; + if (printDlg.ShowDialog() == DialogResult.OK) + printDocument.Print(); } - value = value.Substring(0, value.Length - 1) + Environment.NewLine; - swOut.Write(value); - value = String.Empty; + } - foreach (DataGridViewRow ddr in dataGridView_data.Rows) + private void Selection_SelectionChangedEvent(object sender, EventArgs e) + {//zedGraph.Selection + foreach (var curve in DTrend.GraphPane.CurveList) { - if (ddr.IsNewRow) - continue; - foreach (DataGridViewCell dc in ddr.Cells) + if (curve.IsSelected) { - if (dc.Value != null) - { - value += dc.Value.ToString() + ";"; - } + curve.IsSelected = false; } - value = value.Substring(0, value.Length - 1) + Environment.NewLine; - swOut.Write(value); - value = ""; } - swOut.Close(); + } } } diff --git a/WinCCFlexArchViewer/NumTextBox.cs b/WinCCFlexArchViewer/NumTextBox.cs index e9fd369..b02409c 100644 --- a/WinCCFlexArchViewer/NumTextBox.cs +++ b/WinCCFlexArchViewer/NumTextBox.cs @@ -19,7 +19,7 @@ protected override void OnKeyPress(KeyPressEventArgs e) } if (e.KeyChar != 22) - e.Handled = !Char.IsDigit(e.KeyChar) && (e.KeyChar != ',' || (this.Text.Contains(",") && !this.SelectedText.Contains(","))) && e.KeyChar != (char)Keys.Back && (e.KeyChar != '-' || this.SelectionStart != 0 || (this.Text.Contains("-") && !this.SelectedText.Contains("-"))); + e.Handled = !char.IsDigit(e.KeyChar) && (e.KeyChar != ',' || (Text.Contains(",") && !SelectedText.Contains(","))) && e.KeyChar != (char)Keys.Back && (e.KeyChar != '-' || SelectionStart != 0 || (Text.Contains("-") && !SelectedText.Contains("-"))); } protected override void WndProc(ref Message m) diff --git a/WinCCFlexArchViewer/Properties/AssemblyInfo.cs b/WinCCFlexArchViewer/Properties/AssemblyInfo.cs index 7fdc1e8..c47790e 100644 --- a/WinCCFlexArchViewer/Properties/AssemblyInfo.cs +++ b/WinCCFlexArchViewer/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyVersion("1.9.0.3")] +[assembly: AssemblyVersion("1.9")] [assembly: AssemblyDescription("")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyConfiguration("")] @@ -15,6 +15,6 @@ [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyProduct("WinCCFlexLogViewer")] [assembly: ComVisible(false)] -[assembly: AssemblyFileVersion("1.9.0.3")] +[assembly: AssemblyFileVersion("1.9")] [assembly: AssemblyTitle("WinCCFlexLogViewer")] [assembly: Guid("6a71dd27-4f68-47f0-8074-655f5ca0c788")] diff --git a/WinCCFlexArchViewer/bin/Release/WinCCFlexLogViewer.exe b/WinCCFlexArchViewer/bin/Release/WinCCFlexLogViewer.exe index 7f1a563..5ae2739 100644 Binary files a/WinCCFlexArchViewer/bin/Release/WinCCFlexLogViewer.exe and b/WinCCFlexArchViewer/bin/Release/WinCCFlexLogViewer.exe differ diff --git a/changelog.txt b/changelog.txt index 9ad7a5f..0e77094 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +1.9 +XAxis labels are now showing in 2 lines. +Other UI fixes. + 1.9.0 beta 3 Added Tooltips for menu buttons. Minor code improvements.