Exemplo n.º 1
0
        public EditForm(String title, DatParser d)
        {
            InitializeComponent();
            _parser = d;

            _listView.BackColor             = ConvertUtilities.HtmlColorToColor(RConfig.Instance.EditorBackColor);
            _listView.ColumnWidthChanged   += _listView_ColumnWidthChanged;
            _listView.RetrieveVirtualItem  += _listView_RetrieveVirtualItem;
            _listView.ItemSelectionChanged += _listView_ItemSelectionChanged;
            _listView.ColumnClick          += _listView_ColumnClick;

            _propertyGid.PropertyValueChanged += _propertyGid_PropertyValueChanged;
            searchColumn.SelectedIndexChanged += _searchColumn_SelectedIndexChanged;
            searchText.KeyUp += _seatchText_KeyUp;
            KeyUp            += EditForm_KeyUp;

            Text = Localizate.getMessage(Word.EDITOR) + ": " + title;

            Definition info = d.getDefinition();

            PropertyInfo[] parray = info.GetType().GetProperties();

            foreach (PropertyInfo property in parray)
            {
                if (property.CanWrite)
                {
                    addHeader(property.Name);

                    searchColumn.Items.Add(property.Name);
                }
            }
        }
Exemplo n.º 2
0
        public bool load()
        {
            RegistryKey registryKey = Registry.CurrentUser;

            registryKey = registryKey.OpenSubKey(RConfig.KEY + "\\Profiles\\" + Name);

            if (registryKey == null)
            {
                return(false);
            }

            try
            {
                TextEncoding     = (String)registryKey.GetValue("TextEncoding", "UTF-8");
                DatVersionAsEnum = (DatVersion)Enum.Parse(typeof(DatVersion), (String)registryKey.GetValue("DatVersion", "Interlude"));
                LineageDirectory = (String)registryKey.GetValue("LineageDirectory", "");
                LineageFile      = (String)registryKey.GetValue("LineageFile", "");
                EditorColor      = ConvertUtilities.HtmlColorToColor((String)registryKey.GetValue("EditorColor", "646464"));

                registryKey = registryKey.OpenSubKey(RConfig.KEY + "\\Profiles\\" + Name + "\\Columns");

                if (registryKey == null)
                {
                    return(true);
                }

                String[] subKeys = registryKey.GetSubKeyNames();

                foreach (String subkey in subKeys)
                {
                    RegistryKey sub = Registry.CurrentUser;
                    sub = sub.OpenSubKey(RConfig.KEY + "\\Profiles\\" + Name + "\\Columns\\" + subkey);

                    if (sub != null)
                    {
                        if (!_columnSize.ContainsKey(subkey))
                        {
                            _columnSize[subkey] = new Dictionary <string, int>();
                        }

                        foreach (String value in sub.GetValueNames())
                        {
                            _columnSize[subkey].Add(value, (int)sub.GetValue(value, 0));
                        }
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                //DEBUG
                LogManager.GetLogger(typeof(Profile)).Info(e.StackTrace, e);

                return(false);
            }
        }
Exemplo n.º 3
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            //MainForm.Instance.ColorDialog.Color = (Color)value;
            Color co = ConvertUtilities.HtmlColorToColor(value.ToString());

            MainForm.Instance.ColorDialog.Color = co;

            if (MainForm.Instance.ColorDialog.ShowDialog() == DialogResult.OK)
            {
                return(ConvertUtilities.ColorToHtmlColor(MainForm.Instance.ColorDialog.Color));
            }

            return(value);
        }
Exemplo n.º 4
0
        public void writeSubItems(ListViewItem item, Definition value)
        {
            Definition info = value;

            bool first = true;

            item.SubItems.Clear();

            item.Text = info.ToString();
            item.Tag  = info;

            Color color = Color.White;

            foreach (PropertyInfo prop in info.GetType().GetProperties())
            {
                if (first)
                {
                    first = false;
                    continue;
                }

                foreach (Attribute at in prop.GetCustomAttributes(true))
                {
                    if (at is ListColor)
                    {
                        var co = at as ListColor;
                        color = ConvertUtilities.HtmlColorToColor((String)prop.GetValue(value, null));
                    }
                }

                var sub = new ListViewItem.ListViewSubItem();
                sub.Text = prop.GetValue(value, null).ToString();
                item.SubItems.Add(sub);
            }

            item.ForeColor = color;
        }
Exemplo n.º 5
0
 public void parse(String value, String[] tokens, int index, out int outindex)
 {
     outindex = index;
     Value    = ConvertUtilities.HtmlColorToColor(value.Trim());
 }