Ejemplo n.º 1
0
        /* D O  V I E W  S A V E */

        /*----------------------------------------------------------------------------
        *       %%Function: DoViewSave
        *       %%Qualified: AzLog.AzLogWindow.DoViewSave
        *       %%Contact: rlittle
        *
        *   Save all the current view settings
        *  ----------------------------------------------------------------------------*/
        private void DoViewSave(object sender, EventArgs e)
        {
            AzLogViewSettings azlvs = (AzLogViewSettings)m_cbView.SelectedItem;

            if (azlvs == null || azlvs.Name == "<New...>")
            {
                CreateNewView();
            }

            Dictionary <string, int> rgColumns = new Dictionary <string, int>();

            for (int i = 0; i < m_lvLog.Columns.Count; i++)
            {
                rgColumns.Add(m_lvLog.Columns[i].Text, i);
            }

            for (int i = 0; i < m_azlvs.ColumnCount(); i++)
            {
                string sName = m_azlvs.Column(i).Name;

                // only sync the width here. all else sync during manipulation
                if (rgColumns.ContainsKey(sName))
                {
                    m_azlvs.Column(i).Width = m_lvLog.Columns[rgColumns[sName]].Width;
                }
            }

            m_azlvs.Save();
            m_ilc.SetDefaultView(m_azlvs.Name);
            DirtyView(false);
        }
Ejemplo n.º 2
0
        /* S E T U P  L I S T  V I E W  F O R  L O G */

        /*----------------------------------------------------------------------------
        *       %%Function: SetupListViewForView
        *       %%Qualified: AzLog.AzLogWindow.SetupListViewForView
        *       %%Contact: rlittle
        *
        *   Initialize the view to match the given view
        *  ----------------------------------------------------------------------------*/
        private void SetupListViewForView(AzLogViewSettings azlvs)
        {
            int i;

            m_lvLog.BeginUpdate();

            m_lvLog.Columns.Clear();

            //for (i = m_lvLog.Columns.Count - 1; i >= 0; --i)
            //m_lvLog.Columns.RemoveAt(i);

            for (i = 0; i < azlvs.ColumnCount(); i++)
            {
                AzLogViewSettings.AzLogViewColumn azlvc = azlvs.Column(i);

                m_lvLog.Columns.Add(new ColumnHeader());
                m_lvLog.Columns[i].Text  = azlvc.Title;
                m_lvLog.Columns[i].Tag   = azlvc.Name;
                m_lvLog.Columns[i].Width = azlvc.Width;
            }

            if (m_azlv != null)
            {
                m_azlv.BumpGeneration();
            }
            m_lvLog.EndUpdate();
            // m_lvLog.VirtualListSize = 0;
        }
Ejemplo n.º 3
0
        /* I  V I E W  F R O M  N A M E */

        /*----------------------------------------------------------------------------
        *       %%Function: IViewFromName
        *       %%Qualified: AzLog.AzLogWindow.IViewFromName
        *       %%Contact: rlittle
        *
        *   Return the indext to the named view (in our combobox of views)
        *  ----------------------------------------------------------------------------*/
        private int IViewFromName(string sName)
        {
            int i;

            for (i = 0; i < m_cbView.Items.Count; i++)
            {
                AzLogViewSettings azlvs = (AzLogViewSettings)m_cbView.Items[i];
                if (String.Compare(azlvs.Name, sName, true) == 0)
                {
                    break;
                }
            }
            return((i >= m_cbView.Items.Count) ? -1 : i);
        }
Ejemplo n.º 4
0
        /* C H A N G E  V I E W  S E L E C T E D */

        /*----------------------------------------------------------------------------
        *       %%Function: ChangeViewSelected
        *       %%Qualified: AzLog.AzLogWindow.ChangeViewSelected
        *       %%Contact: rlittle
        *
        *   Handle a change to the selected view dropdown.
        *  ----------------------------------------------------------------------------*/
        private void ChangeViewSelected(object sender, EventArgs e)
        {
            AzLogViewSettings azlvs = (AzLogViewSettings)m_cbView.SelectedItem;

            if (azlvs.Name == "<New...>")
            {
                CreateNewView();
                DirtyView(true);
            }
            else
            {
                SetView(azlvs.Name);
            }
        }
Ejemplo n.º 5
0
        /* C R E A T E  N E W  V I E W */

        /*----------------------------------------------------------------------------
        *       %%Function: CreateNewView
        *       %%Qualified: AzLog.AzLogWindow.CreateNewView
        *       %%Contact: rlittle
        *
        *   Create a new view copied from the current view. Ask the user to give us
        *   a name for the new view
        *  ----------------------------------------------------------------------------*/
        private void CreateNewView()
        {
            string sName;

            if (TCore.UI.InputBox.ShowInputBox("New view name", "View name", "", out sName))
            {
                // create a new view based on the current view

                AzLogViewSettings azlvs = m_azlvs.Clone();
                azlvs.SetName(sName);
                m_cbView.Items.Insert(m_cbView.Items.Count - 1, azlvs);
                m_cbView.SelectedIndex = m_cbView.Items.Count - 2;
                //m_azlvs = azlvs;
            }
        }
Ejemplo n.º 6
0
        /* P O P U L A T E  V I E W  L I S T */

        /*----------------------------------------------------------------------------
        *       %%Function: PopulateViewList
        *       %%Qualified: AzLog.AzLogWindow.PopulateViewList
        *       %%Contact: rlittle
        *
        *  ----------------------------------------------------------------------------*/
        public void PopulateViewList()
        {
            RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software\\Thetasoft\\AzLog\\Views");

            if (rk != null)
            {
                string[] rgs = rk.GetSubKeyNames();

                foreach (string s in rgs)
                {
                    AzLogViewSettings azlvs = new AzLogViewSettings(s);
                    m_cbView.Items.Add(azlvs);
                }
                rk.Close();
            }
            m_cbView.Items.Add(new AzLogViewSettings("<New...>"));
        }
Ejemplo n.º 7
0
        /* S E T  V I E W */

        /*----------------------------------------------------------------------------
        *       %%Function: SetView
        *       %%Qualified: AzLog.AzLogWindow.SetView
        *       %%Contact: rlittle
        *
        *   Set the current view to the given name. This will handle loading the
        *   view settings from the registry and setting up the current view to match
        *   the selected view.
        *  ----------------------------------------------------------------------------*/
        public void SetView(string sViewName)
        {
            int iView = IViewFromName(sViewName);

            if (iView != -1)
            {
                m_cbView.SelectedIndex = iView;
                m_azlvs = (AzLogViewSettings)m_cbView.Items[iView];
            }
            else
            {
                AzLogViewSettings azlvs = new AzLogViewSettings(sViewName);
                m_azlvs = azlvs;
                m_cbView.SelectedIndex = -1;
            }

            SetupListViewForView(m_azlvs);
            SetupContextMenu();
            DirtyView(true);
        }
Ejemplo n.º 8
0
            /* S  D E S C R I B E */

            /*----------------------------------------------------------------------------
            *   %%Function: SDescribe
            *   %%Qualified: AzLog.AzLogFilter.AzLogFilterValue.SDescribe
            *   %%Contact: rlittle
            *
            *   return a string describing this value
            *  ----------------------------------------------------------------------------*/
            public string SDescribe()
            {
                if (m_ds == DataSource.DttmRow)
                {
                    return("Item[Date/Time]");
                }

                if (m_ds == DataSource.Static)
                {
                    if (m_vt == ValueType.DateTime)
                    {
                        return(string.Format("Date({0})", ((DateTime)m_oValue).ToString("MM/dd/yy HH:mm")));
                    }
                    else
                    {
                        return(string.Format("String(\"{0}\")", (String)m_oValue));
                    }
                }

                return(string.Format("Item[{0}]", AzLogViewSettings.GetColumnName(m_lc)));
            }
Ejemplo n.º 9
0
        public AzLogViewSettings Clone()
        {
            AzLogViewSettings azlvs = new AzLogViewSettings(m_sName);

            azlvs.Dirty = true;
            azlvs.m_plazlvc.Clear();
            azlvs.m_pliazlvc.Clear();

            int i;

            for (i = 0; i < ColumnCount(); i++)
            {
                // BE CAREFUL! we want the new clone to have its columns in the order of
                // the tab order, NOT in the list order. we do this because the new view
                // is likely to be used to recreate a listview whereas the current view
                // reflects the loaded view PLUS any manipulation done by the current
                // window that the view is attached to
                azlvs.AddColumn(m_plazlvc[m_pliazlvc[i]].Clone());
            }
            return(azlvs);
        }
Ejemplo n.º 10
0
        public AzLogViewSettings Clone()
        {
            AzLogViewSettings azlvs = new AzLogViewSettings(m_sName);

            azlvs.Dirty = true;
            azlvs.m_plazlvc.Clear();
            azlvs.m_pliazlvc.Clear();

            int i;
            for (i = 0; i < ColumnCount(); i++)
                {
                // BE CAREFUL! we want the new clone to have its columns in the order of
                // the tab order, NOT in the list order. we do this because the new view
                // is likely to be used to recreate a listview whereas the current view
                // reflects the loaded view PLUS any manipulation done by the current
                // window that the view is attached to
                azlvs.AddColumn(m_plazlvc[m_pliazlvc[i]].Clone());
                }
            return azlvs;
        }
Ejemplo n.º 11
0
        /* S E T U P  L I S T  V I E W  F O R  L O G */
        /*----------------------------------------------------------------------------
            %%Function: SetupListViewForView
            %%Qualified: AzLog.AzLogWindow.SetupListViewForView
            %%Contact: rlittle

            Initialize the view to match the given view
        ----------------------------------------------------------------------------*/
        private void SetupListViewForView(AzLogViewSettings azlvs)
        {
            int i;

            m_lvLog.BeginUpdate();

            m_lvLog.Columns.Clear();

            //for (i = m_lvLog.Columns.Count - 1; i >= 0; --i)
            //m_lvLog.Columns.RemoveAt(i);

            for (i = 0; i < azlvs.ColumnCount(); i++)
                {
                AzLogViewSettings.AzLogViewColumn azlvc = azlvs.Column(i);

                m_lvLog.Columns.Add(new ColumnHeader());
                m_lvLog.Columns[i].Text = azlvc.Title;
                m_lvLog.Columns[i].Tag = azlvc.Name;
                m_lvLog.Columns[i].Width = azlvc.Width;
                }

            if (m_azlv != null)
                m_azlv.BumpGeneration();
            m_lvLog.EndUpdate();
            // m_lvLog.VirtualListSize = 0;
        }
Ejemplo n.º 12
0
        /* A D D  H E A D E R */
        /*----------------------------------------------------------------------------
            %%Function: AddHeader
            %%Qualified: AzLog.AzLogWindow.AddHeader
            %%Contact: rlittle

            Add the named header to the view. This handles adding the column
            and invalidating the current view so it will get rebuild with the
            correct list view items.
        ----------------------------------------------------------------------------*/
        private void AddHeader(AzLogViewSettings.DefaultColumnDef dcd, string sColumnInsertBefore)
        {
            lock (SyncLock)
                {
                int iazlvcInsert = m_azlvs.IazlvcFind(sColumnInsertBefore);
                int iazlvc = m_azlvs.IazlvcFind(dcd.sName);

                if (iazlvc == -1)
                    {
                    // we are adding this column
                    m_azlvs.AddLogViewColumn(dcd.sName, dcd.sName, dcd.nWidthDefault, dcd.lc, true);
                    iazlvc = m_azlvs.IazlvcFind(dcd.sName);
                    }
                else
                    {
                    m_azlvs.ShowHideColumn(dcd.sName, true);
                    }

                m_azlvs.MoveColumn(iazlvc, iazlvcInsert);

                int c = m_lvLog.VirtualListSize;

                SetupListViewForView(m_azlvs);
                m_azlv.BumpGeneration();
                m_lvLog.VirtualListSize = c;
                }
            DirtyView(true);
        }
Ejemplo n.º 13
0
        /* S E T  V I E W */
        /*----------------------------------------------------------------------------
            %%Function: SetView
            %%Qualified: AzLog.AzLogWindow.SetView
            %%Contact: rlittle

            Set the current view to the given name. This will handle loading the
            view settings from the registry and setting up the current view to match
            the selected view.
        ----------------------------------------------------------------------------*/
        public void SetView(string sViewName)
        {
            int iView = IViewFromName(sViewName);

            if (iView != -1)
                {
                m_cbView.SelectedIndex = iView;
                m_azlvs = (AzLogViewSettings) m_cbView.Items[iView];
                }
            else
                {
                AzLogViewSettings azlvs = new AzLogViewSettings(sViewName);
                m_azlvs = azlvs;
                m_cbView.SelectedIndex = -1;
                }

            SetupListViewForView(m_azlvs);
            SetupContextMenu();
            DirtyView(m_azlvs.Dirty);
        }
Ejemplo n.º 14
0
        /* P O P U L A T E  V I E W  L I S T */
        /*----------------------------------------------------------------------------
            %%Function: PopulateViewList
            %%Qualified: AzLog.AzLogWindow.PopulateViewList
            %%Contact: rlittle

        ----------------------------------------------------------------------------*/
        public void PopulateViewList()
        {
            RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software\\Thetasoft\\AzLog\\Views");
            if (rk != null)
                {
                string[] rgs = rk.GetSubKeyNames();

                foreach (string s in rgs)
                    {
                    AzLogViewSettings azlvs = new AzLogViewSettings(s);
                    m_cbView.Items.Add(azlvs);
                    }
                rk.Close();
                }
            m_cbView.Items.Add(new AzLogViewSettings("<New...>"));
        }