private void FillDetailsListView(IHDU hdu) { headerListView.Items.Clear(); headerListView.Font = new Font(headerListView.Font.FontFamily, 11F); for (uint i = 0; i < hdu.Header.CardImages.Length; i++) { ICardImage ci = hdu.Header.CardImages[i]; if (!ci.IsEmpty) { ListViewItem item = new ListViewItem(new string[] { ci.Key, ci.Value, ci.Comment }); item.UseItemStyleForSubItems = false; if (ci.IsComment) { item.SubItems[0].ForeColor = Color.DarkGreen; } else if (ci.IsHistory) { item.SubItems[0].ForeColor = Color.SaddleBrown; } else if (ci.IsWCS) { item.SubItems[0].ForeColor = Color.Blue; } else if (ci.IsTable) { item.SubItems[0].ForeColor = Color.FromArgb(255, 64, 128, 128); } Color c = ((i & 1) != 0) ? Color.FromArgb(255, 240, 240, 240) : item.BackColor; item.SubItems[0].BackColor = item.SubItems[1].BackColor = item.SubItems[2].BackColor = c; item.SubItems[0].Font = new Font(item.SubItems[0].Font, FontStyle.Bold); headerListView.Items.Add(item); } } }
internal SliceInfo(IHDU hdu) { _hdu = hdu; _hdu.DataMngr.CurrentSlice = 0; _modelState = ModelState.Default; _modelState.PixelMinimum = _hdu.DataMngr.Minimum; _modelState.PixelMaximum = _hdu.DataMngr.Maximum; _modelState.Histogram = new Histogram(_hdu.DataMngr.Data, 500, _hdu.DataMngr.Minimum, _hdu.DataMngr.Maximum, _hdu.DataMngr.BlankValue); }
void FillWCS(IHDU hdu) { string rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Microsoft Sans Serif;}}" + "\n" + @"{\*\generator Najm 1.0 beta;}\viewkind4\uc1\pard\f0\fs22" + "\n"; rtf += hdu.Header.WCSInfo.ToString(); wcsRichTextBox.Rtf = rtf; }
private IHDU GetSelectedHDU() { IHDU hdu = null; TreeNode n = (structureTreeView).SelectedNode; if (n != null && n.Tag != null && n.Tag is IHDU) { hdu = ((IHDU)n.Tag); } return(hdu); }
private void PassToDefaultHandler(KeyValuePair <IHDU, int> pair) { IHDU hdu = pair.Key; int sessionID = pair.Value; if (sessionID == -1) // we don't have opened session { IHDU[] hdus = new IHDU[1] { hdu }; sessionID = _handlersManager.OpenSession(_handlersManager.DefaultHandler.ID, hdus); } _handlersManager.ActivateSession(_handlersManager.DefaultHandler.ID, sessionID); }
private void FillSummary(IHDU hdu) { richTextBox.Clear(); Font oldFont = richTextBox.SelectionFont; Font boldFont = new Font(richTextBox.SelectionFont, FontStyle.Bold | FontStyle.Underline); richTextBox.SelectionFont = boldFont; richTextBox.AppendText("Summary:\n"); richTextBox.SelectionFont = oldFont; richTextBox.AppendText(hdu.Header.SummaryText + "\n"); richTextBox.SelectionFont = oldFont; // well, sometimes the scroll is far down for some reason ans sometimes is up as expected. // So, I'm scrolling all the way up now. richTextBox.SelectionStart = 0; richTextBox.ScrollToCaret(); }
internal void HandlerButton_Click(object sender, EventArgs e) { int session = -1; Guid guidHandler = Guid.Empty; #if !DEBUG try { #endif StartWaitCursor(); ToolStripButton b = (ToolStripButton)sender; IHDU hdu = GetSelectedHDU(); if (hdu != null) { IHDU[] hdus = new IHDU[1] { hdu }; guidHandler = (Guid)b.Tag; session = _handlersManager.OpenSession(guidHandler, hdus); _handlersManager.ActivateSession(guidHandler, session); } #if !DEBUG } #endif #if !DEBUG catch (System.Exception ex) { // close session on exception to avoid any leftover UI elemts...etc if (session != -1 && guidHandler != Guid.Empty) { _handlersManager.CloseSession(guidHandler, session); } MessageBox.Show(ex.Message); } finally { #endif EndWaitCursor(); #if !DEBUG } #endif }
internal void DisplayHDUHeader(IHDU hdu) { FillSummary(hdu); FillDetailsListView(hdu); FillWCS(hdu); }