// Event handler for a change in character set selection.  <Horizontal, vertical Bargraphs and custom chars>
        private void CharacterSetSelection_Changed(object sender, EventArgs e)
        {
            RadioButton selectedButton = (RadioButton)sender;

            switch (selectedButton.Name)
            {
                case "noneRadioButton":
                    ShowCharacters(m_noneCharacters);
                    CustomCharactersOff();
                    HideCharacterEditor();
                    m_characterSet = CyCustomCharacterSetTypes.NONE;
                    currentEditableCharacter.Visible = false;
                    CharacterSetPostProcess();
                    break;
                case "vbgRadioButton":
                    ShowCharacters(m_vbgCharacters);
                    CustomCharactersOn();
                    HideCharacterEditor();
                    m_characterSet = CyCustomCharacterSetTypes.VERTICAL;
                    currentEditableCharacter.Visible = false;
                    CharacterSetPostProcess();
                    break;
                case "hbgRadioButton":
                    ShowCharacters(m_hbgCharacters);
                    CustomCharactersOn();
                    HideCharacterEditor();
                    m_characterSet = CyCustomCharacterSetTypes.HORIZONTAL;
                    currentEditableCharacter.Visible = false;
                    CharacterSetPostProcess();
                    break;
                case "udRadioButton":
                    CustomCharactersOn();
                    ShowCharacters(m_userDefinedCharacters);
                    m_characterSet = CyCustomCharacterSetTypes.USERDEFINED;
                    ShowCharacterEditor();
                    currentEditableCharacter.Text = m_highlighted.DisplayName;
                    currentEditableCharacter.Visible = true;
                    CharacterSetPostProcess();
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 2
0
        public IEnumerable <CyAPICustomizer> CustomizeAPIs(
            ICyInstQuery_v1 query,
            ICyTerminalQuery_v1 termQuery,
            IEnumerable <CyAPICustomizer> apis)
        {
            List <CyAPICustomizer>      customizers = new List <CyAPICustomizer>(apis);
            Dictionary <string, string> paramDict   = new Dictionary <string, string>();
            string instanceName = "";

            // Get the parameters from the characterLCD.c file customizer
            for (int i = 0; i < customizers.Count; i++)
            {
                CyAPICustomizer api = customizers[i];

                // Get dict from main file.
                if (api.OriginalName.EndsWith(LCD_CFILE_NAME))
                {
                    paramDict = api.MacroDictionary;
                    paramDict.TryGetValue(INSTANCE_NAME_PARAM, out instanceName);
                }
                else if (api.OriginalName.EndsWith(CUST_CHARS_CFILE_NAME))
                {
                    m_custChar_CFile = api;
                }
                else if (api.OriginalName.EndsWith(BARGRAPH_CFILE_NAME))
                {
                    m_barGraph_CFile = api;
                }
            }

            // Determine Custom Character Set
            string value;

            paramDict.TryGetValue(CUSTOM_CHARACTER_SET_PARAM, out value);
            m_customCharacterSet = (CyCustomCharacterSetTypes)(int.Parse(value));

            // Determine existence of ASCII Routines
            paramDict.TryGetValue(CONVERSION_ROUTINE_PARAM, out value);
            m_conversionRoutines = (value == "1");

            #region New Code Substitution Values
            const string CUSTOM_CHAR_DEFINES_MACRO = "CustomCharDefines_API_GEN";
            const string CONVERSION_ROUTINE_MACRO  = "ConversionRoutines_DEF";

            string customCharDeleted = "0";
            string customCharDefined = ((byte)m_customCharacterSet).ToString();



            #region Literal String Code for Conversion Routines
            string conversionRoutineDeleted = "0";

            string conversionRoutineDefined = "1";
            #endregion
            #endregion

            // If a character set is selected, build c file with data in it.
            switch (m_customCharacterSet)
            {
            case CyCustomCharacterSetTypes.USERDEFINED:
                ConvertCharacters(LoadUserDefinedCharacters(paramDict), paramDict);
                paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDefined);
                customizers.Remove(m_barGraph_CFile);
                break;

            case CyCustomCharacterSetTypes.VERTICAL:
                GenerateVerticalBargraph(paramDict);
                paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDefined);
                customizers.Remove(m_custChar_CFile);
                break;

            case CyCustomCharacterSetTypes.HORIZONTAL:
                GenerateHorizontalBargraph(paramDict);
                paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDefined);
                customizers.Remove(m_custChar_CFile);
                break;

            default:
                paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDeleted);
                customizers.Remove(m_barGraph_CFile);
                customizers.Remove(m_custChar_CFile);
                break;
            }

            // If conversion routines are selected, import them
            if (m_conversionRoutines)
            {
                paramDict.Add(CONVERSION_ROUTINE_MACRO, conversionRoutineDefined);
            }
            else
            {
                paramDict.Add(CONVERSION_ROUTINE_MACRO, conversionRoutineDeleted);
            }
            // Replace macro dictionaries with paramDict
            for (int i = 0; i < customizers.Count; i++)
            {
                CyAPICustomizer api = customizers[i];
                api.MacroDictionary = paramDict;
            }

            return(customizers);
        }
Exemplo n.º 3
0
        public IEnumerable<CyAPICustomizer> CustomizeAPIs(
            ICyInstQuery_v1 query,
            ICyTerminalQuery_v1 termQuery,
            IEnumerable<CyAPICustomizer> apis)
        {
            List<CyAPICustomizer> customizers = new List<CyAPICustomizer>(apis);
            Dictionary<string, string> paramDict = new Dictionary<string, string>();
            string instanceName = "";

            // Get the parameters from the characterLCD.c file customizer
            for (int i = 0; i < customizers.Count; i++)
            {
                CyAPICustomizer api = customizers[i];

                // Get dict from main file.
                if (api.OriginalName.EndsWith(LCD_CFILE_NAME))
                {
                    paramDict = api.MacroDictionary;
                    paramDict.TryGetValue(INSTANCE_NAME_PARAM, out instanceName);
                }
                else if (api.OriginalName.EndsWith(CUST_CHARS_CFILE_NAME))
                {
                    m_custChar_CFile = api;
                }
                else if (api.OriginalName.EndsWith(BARGRAPH_CFILE_NAME))
                {
                    m_barGraph_CFile = api;
                }
            }

            // Determine Custom Character Set
            string value;
            paramDict.TryGetValue(CUSTOM_CHARACTER_SET_PARAM, out value);
            m_customCharacterSet = (CyCustomCharacterSetTypes)(int.Parse(value));

            // Determine existence of ASCII Routines
            paramDict.TryGetValue(CONVERSION_ROUTINE_PARAM, out value);
            m_conversionRoutines = (value == "1");

            #region New Code Substitution Values
            const string CUSTOM_CHAR_DEFINES_MACRO = "CustomCharDefines_API_GEN";
            const string CONVERSION_ROUTINE_MACRO = "ConversionRoutines_DEF";

            string customCharDeleted = "0";
            string customCharDefined = ((byte)m_customCharacterSet).ToString();

            #region Literal String Code for Conversion Routines
            string conversionRoutineDeleted = "0";

            string conversionRoutineDefined = "1";
            #endregion
            #endregion

            // If a character set is selected, build c file with data in it.
            switch (m_customCharacterSet)
            {
                case CyCustomCharacterSetTypes.USERDEFINED:
                    ConvertCharacters(LoadUserDefinedCharacters(paramDict), paramDict);
                    paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDefined);
                    customizers.Remove(m_barGraph_CFile);
                    break;
                case CyCustomCharacterSetTypes.VERTICAL:
                    GenerateVerticalBargraph(paramDict);
                    paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDefined);
                    customizers.Remove(m_custChar_CFile);
                    break;
                case CyCustomCharacterSetTypes.HORIZONTAL:
                    GenerateHorizontalBargraph(paramDict);
                    paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDefined);
                    customizers.Remove(m_custChar_CFile);
                    break;
                default:
                    paramDict.Add(CUSTOM_CHAR_DEFINES_MACRO, customCharDeleted);
                    customizers.Remove(m_barGraph_CFile);
                    customizers.Remove(m_custChar_CFile);
                    break;
            }

            // If conversion routines are selected, import them
            if (m_conversionRoutines)
            {
                paramDict.Add(CONVERSION_ROUTINE_MACRO, conversionRoutineDefined);
            }
            else
            {
                paramDict.Add(CONVERSION_ROUTINE_MACRO, conversionRoutineDeleted);
            }
            // Replace macro dictionaries with paramDict
            for (int i = 0; i < customizers.Count; i++)
            {
                CyAPICustomizer api = customizers[i];
                api.MacroDictionary = paramDict;
            }

            return customizers;
        }