コード例 #1
0
        /// <summary>
        /// ファイルを読み込み画面状態を初期化する
        /// </summary>
        public void loadOption()
        {
            if (m_krkrType == FileType.KrkrType.Kag)
            {
                //カラー設定
                KagColorType          type = new KagColorType();
                IHighlightingStrategy hs   = HighlightingManager.Manager.FindHighlighter("KAG");
                loadBaseTypeColor(type, hs);
                loadKagTypeColor(type, (DefaultHighlightingStrategy)hs);
                colorPropertyGrid.SelectedObject = type;

                //タブ表示切り替え
                optionTabControl.TabPages.Clear();
                optionTabControl.TabPages.Add(colorTabPage);
                optionTabControl.TabPages.Add(fontTabPage);
                optionTabControl.TabPages.Add(showTabPage);
                optionTabControl.TabPages.Add(actionTabPage);
                optionTabControl.TabPages.Add(completeTabPage);
                optionTabControl.TabPages.Add(kag1TabPage);
                optionTabControl.TabPages.Add(kag2TabPage);
                optionTabControl.TabPages.Add(kagex1TabPage);
            }
            else if (m_krkrType == FileType.KrkrType.Tjs)
            {
                TjsColorType          type = new TjsColorType();
                IHighlightingStrategy hs   = HighlightingManager.Manager.FindHighlighter("TJS2");
                loadBaseTypeColor(type, hs);
                loadTjsTypeColor(type, (DefaultHighlightingStrategy)hs);
                colorPropertyGrid.SelectedObject = type;

                //タブ表示切り替え
                optionTabControl.TabPages.Clear();
                optionTabControl.TabPages.Add(colorTabPage);
                optionTabControl.TabPages.Add(fontTabPage);
                optionTabControl.TabPages.Add(showTabPage);
                optionTabControl.TabPages.Add(actionTabPage);
                //optionTabControl.TabPages.Add(completeTabPage);
            }
            else
            {
                BaseColorType         type = new BaseColorType();
                IHighlightingStrategy hs   = HighlightingManager.Manager.FindHighlighter("Default");
                loadBaseTypeColor(type, hs);
                colorPropertyGrid.SelectedObject = type;

                //タブ表示切り替え
                optionTabControl.TabPages.Clear();
                optionTabControl.TabPages.Add(colorTabPage);
                optionTabControl.TabPages.Add(fontTabPage);
                optionTabControl.TabPages.Add(showTabPage);
                optionTabControl.TabPages.Add(actionTabPage);
            }

            //エディタ設定
            EditorOption editorOption = GlobalStatus.EditorManager.GetEditorOption(m_krkrType);

            loadEditorOption(editorOption);
        }
コード例 #2
0
        /// <summary>
        /// TJSファイルのデフォルトカラーオブジェクトを取得する
        /// </summary>
        /// <param name="deftype">ベースとなるカラータイプ</param>
        /// <returns>カラーオブジェクト</returns>
        private static TjsColorType getDefaultTjsColor(DefaultColorType deftype)
        {
            BaseColorType baseType = (BaseColorType)getDefaultColor(deftype);
            TjsColorType  type     = new TjsColorType();

            type.WindowFront         = baseType.WindowFront;
            type.WindowBack          = baseType.WindowBack;
            type.SelectTextFront     = baseType.SelectTextFront;
            type.SelectTextBack      = baseType.SelectTextBack;
            type.VRuler              = baseType.VRuler;
            type.InvalidLines        = baseType.InvalidLines;
            type.CaretMarker         = baseType.CaretMarker;
            type.LineNumbersFront    = baseType.LineNumbersFront;
            type.LineNumbersBack     = baseType.LineNumbersBack;
            type.FoldLineFront       = baseType.FoldLineFront;
            type.FoldLineBack        = baseType.FoldLineBack;
            type.FoldMarkerFront     = baseType.FoldMarkerFront;
            type.FoldMarkerBack      = baseType.FoldMarkerBack;
            type.SelectFoldLineFront = baseType.SelectFoldLineFront;
            type.SelectFoldLineBack  = baseType.SelectFoldLineBack;
            type.EolMarkers          = baseType.EolMarkers;
            type.SpaceMakers         = baseType.SpaceMakers;
            type.TabMarkers          = baseType.TabMarkers;
            type.Digits              = baseType.Digits;


            switch (deftype)
            {
            case DefaultColorType.Black:
                type.Comment             = Color.FromArgb(0x00, 0xC0, 0xFF);
                type.String              = Color.FromArgb(0x80, 0xFF, 0x80);
                type.Regexp              = Color.FromArgb(0x80, 0xFF, 0x80);
                type.Octet               = Color.FromArgb(0x80, 0xFF, 0x80);
                type.PreProcessorKeyWord = Color.FromArgb(0xFF, 0xFF, 0x80);
                type.KeyWord             = Color.FromArgb(0xFF, 0x80, 0x80);
                break;

            case DefaultColorType.White:
            default:
                type.Comment             = Color.DarkCyan;
                type.String              = Color.Green;
                type.Regexp              = Color.Green;
                type.Octet               = Color.Green;
                type.PreProcessorKeyWord = Color.Blue;
                type.KeyWord             = Color.Red;
                break;
            }

            return(type);
        }
コード例 #3
0
        /// <summary>
        /// TJS独自のカラーを読み込む
        /// </summary>
        /// <param name="type">セットするカラータイプ</param>
        /// <param name="hs">情報を読み取るカラー情報</param>
        private void loadTjsTypeColor(TjsColorType type, DefaultHighlightingStrategy hs)
        {
            HighlightRuleSet rule;
            ArrayList        spanList;
            HighlightColor   color;

            //デフォルトルールセットから取得する
            rule     = hs.GetRuleSet(null);
            spanList = rule.Spans;
            foreach (Span span in spanList)
            {
                switch (span.Name)
                {
                case "LineComment":
                    type.Comment = span.Color.Color;
                    break;

                case "String":
                    type.String = span.Color.Color;
                    break;

                case "Regexp":
                    type.Regexp = span.Color.Color;
                    break;

                case "Octet":
                    type.Octet = span.Color.Color;
                    break;
                }
            }

            //キーワードの色を取得する
            Dictionary <string, HighlightColor> keywordsList = rule.KeyWordsList;

            color = keywordsList["TJSPreProcessorWords"];
            if (color != null)
            {
                type.PreProcessorKeyWord = color.Color;
            }
            color = keywordsList["TJSKeyWords"];
            if (color != null)
            {
                type.KeyWord = color.Color;
            }
        }
コード例 #4
0
        /// <summary>
        /// TJS強調定義ファイルを作成する
        /// </summary>
        /// <param name="fileName">作成するファイル名</param>
        private static string createTjsXshd(TjsColorType colorType)
        {
            string text = "";

            text += String.Format("<?xml version=\"1.0\"?>\n");
            text += String.Format("\n");
            text += String.Format("<!-- syntaxdefinition for TJS2 by PORING SOFT -->\n");
            text += String.Format("<SyntaxDefinition name=\"TJS2\" extensions=\".tjs\">\n");

            //共通部の色設定
            text += String.Format("    <Environment>\n");
            text += String.Format("        <Default      color=\"{0}\" bgcolor=\"{1}\" />\n", getColorName(colorType.WindowFront), getColorName(colorType.WindowBack));
            text += String.Format("        <Selection    color=\"{0}\" bgcolor=\"{1}\" />\n", getColorName(colorType.SelectTextFront), getColorName(colorType.SelectTextBack));
            text += String.Format("        <VRuler       color=\"{0}\" />\n", getColorName(colorType.VRuler));
            text += String.Format("        <InvalidLines color=\"{0}\" />\n", getColorName(colorType.InvalidLines));
            text += String.Format("        <CaretMarker  color=\"{0}\" />\n", getColorName(colorType.CaretMarker));
            text += String.Format("        \n");
            text += String.Format("        <LineNumbers  color=\"{0}\" bgcolor=\"{1}\" />\n", getColorName(colorType.LineNumbersFront), getColorName(colorType.LineNumbersBack));
            text += String.Format("        \n");
            text += String.Format("        <FoldLine     color=\"{0}\" bgcolor=\"{1}\" />\n", getColorName(colorType.FoldLineFront), getColorName(colorType.FoldLineBack));
            text += String.Format("        <FoldMarker   color=\"{0}\" bgcolor=\"{1}\" />\n", getColorName(colorType.FoldMarkerFront), getColorName(colorType.FoldMarkerBack));
            text += String.Format("        <SelectedFoldLine color=\"{0}\" bgcolor=\"{1}\" />\n", getColorName(colorType.SelectFoldLineFront), getColorName(colorType.SelectFoldLineBack));
            text += String.Format("        \n");
            text += String.Format("        <EOLMarkers   color=\"{0}\" />\n", getColorName(colorType.EolMarkers));
            text += String.Format("        <SpaceMarkers color=\"{0}\" />\n", getColorName(colorType.SpaceMakers));
            text += String.Format("        <TabMarkers   color=\"{0}\" />\n", getColorName(colorType.TabMarkers));
            text += String.Format("    </Environment>\n");
            text += String.Format("    \n");

            //プロパティの設定
            text += String.Format("    <Properties>\n");
            text += String.Format("        <Property name=\"LineComment\" value=\"//\"/>\n");
            text += String.Format("    </Properties>\n");
            text += String.Format("    \n");

            //数値の色設定
            text += String.Format("    <Digits name=\"Digits\" bold=\"false\" italic=\"false\" color=\"{0}\" />\n", getColorName(colorType.Digits));
            text += String.Format("    \n");

            //TJSの設定
            text += String.Format("    <RuleSets>\n");
            text += String.Format("        <RuleSet ignorecase=\"false\">\n");
            text += "            <Delimiters>=!&gt;&lt;+-/*%&amp;|^~.}{,;][?:()</Delimiters>\n";
            text += String.Format("            \n");
            text += String.Format("            <Span name=\"LineComment\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"true\">\n", getColorName(colorType.Comment));
            text += String.Format("                <Begin>//</Begin>\n");
            text += String.Format("            </Span>\n");
            text += String.Format("            \n");
            text += String.Format("            <Span name=\"BlockComment\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"false\">\n", getColorName(colorType.Comment));
            text += String.Format("                <Begin>/*</Begin>\n");
            text += String.Format("                <End>*/</End>\n");
            text += String.Format("            </Span>\n");
            text += String.Format("            \n");
            text += String.Format("            <Span name=\"String\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"false\" escapecharacter=\"\\\">\n", getColorName(colorType.String));
            text += String.Format("                <Begin>&quot;</Begin>\n");
            text += String.Format("                <End>&quot;</End>\n");
            text += String.Format("            </Span>\n");
            text += String.Format("            <Span name =\"AtString\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"false\">\n", getColorName(colorType.String));
            text += String.Format("                <Begin>@@&quot;</Begin>\n");
            text += String.Format("                <End>&quot;</End>\n");
            text += String.Format("            </Span>\n");
            text += String.Format("            \n");
            text += String.Format("            <Span name=\"Character\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"true\" escapecharacter=\"\\\">\n", getColorName(colorType.String));
            text += String.Format("                <Begin>&apos;</Begin>\n");
            text += String.Format("                <End>&apos;</End>\n");
            text += String.Format("            </Span>\n");
            text += String.Format("            <Span name=\"AtCharacter\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"false\">\n", getColorName(colorType.String));
            text += String.Format("                <Begin>@@&apos;</Begin>\n");
            text += String.Format("                <End>&apos;</End>\n");
            text += String.Format("            </Span>\n");
            text += String.Format("            \n");
            //正規表現は削除
            //text += String.Format("            <Span name=\"Regexp\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"true\">\n", getColorName(colorType.Regexp));
            //text += String.Format("                <Begin>/</Begin>\n");
            //text += String.Format("                <End>/</End>\n");
            //text += String.Format("            </Span>\n");
            //text += String.Format("            \n");
            text += String.Format("            <Span name=\"Octet\" bold=\"false\" italic=\"false\" color=\"{0}\" stopateol=\"true\">\n", getColorName(colorType.Octet));
            text += String.Format("                <Begin>&lt;%</Begin>\n");
            text += String.Format("                <End>%&gt;</End>\n");
            text += String.Format("            </Span>\n");
            text += String.Format("            \n");
            text += String.Format("            <KeyWords name=\"TJSPreProcessorWords\" bold=\"false\" italic=\"false\" color=\"{0}\">\n", getColorName(colorType.PreProcessorKeyWord));
            text += String.Format("                <Key word=\"@set\" />\n");
            text += String.Format("                <Key word=\"@if\" />\n");
            text += String.Format("                <Key word=\"@endif\" />\n");
            text += String.Format("            </KeyWords>\n");
            text += String.Format("            \n");
            text += String.Format("            <KeyWords name=\"TJSKeyWords\" bold=\"false\" italic=\"false\" color=\"{0}\">\n", getColorName(colorType.KeyWord));
            text += String.Format("                <Key word=\"break\" />\n");
            text += String.Format("                <Key word=\"continue\" />\n");
            text += String.Format("                <Key word=\"const\" />\n");
            text += String.Format("                <Key word=\"catch\" />\n");
            text += String.Format("                <Key word=\"class\" />\n");
            text += String.Format("                <Key word=\"case\" />\n");
            text += String.Format("                <Key word=\"debugger\" />\n");
            text += String.Format("                <Key word=\"default\" />\n");
            text += String.Format("                <Key word=\"delete\" />\n");
            text += String.Format("                <Key word=\"do\" />\n");
            text += String.Format("                <Key word=\"extends\" />\n");
            text += String.Format("                <Key word=\"export\" />\n");
            text += String.Format("                <Key word=\"enum\" />\n");
            text += String.Format("                <Key word=\"else\" />\n");
            text += String.Format("                <Key word=\"function\" />\n");
            text += String.Format("                <Key word=\"finally\" />\n");
            text += String.Format("                <Key word=\"false\" />\n");
            text += String.Format("                <Key word=\"for\" />\n");
            text += String.Format("                <Key word=\"global\" />\n");
            text += String.Format("                <Key word=\"getter\" />\n");
            text += String.Format("                <Key word=\"goto\" />\n");
            text += String.Format("                <Key word=\"incontextof\" />\n");
            text += String.Format("                <Key word=\"Infinity\" />\n");
            text += String.Format("                <Key word=\"invalidate\" />\n");
            text += String.Format("                <Key word=\"instanceof\" />\n");
            text += String.Format("                <Key word=\"isvalid\" />\n");
            text += String.Format("                <Key word=\"import\" />\n");
            text += String.Format("                <Key word=\"int\" />\n");
            text += String.Format("                <Key word=\"in\" />\n");
            text += String.Format("                <Key word=\"if\" />\n");
            text += String.Format("                <Key word=\"NaN\" />\n");
            text += String.Format("                <Key word=\"null\" />\n");
            text += String.Format("                <Key word=\"new\" />\n");
            text += String.Format("                <Key word=\"octet\" />\n");
            text += String.Format("                <Key word=\"protected\" />\n");
            text += String.Format("                <Key word=\"property\" />\n");
            text += String.Format("                <Key word=\"private\" />\n");
            text += String.Format("                <Key word=\"public\" />\n");
            text += String.Format("                <Key word=\"return\" />\n");
            text += String.Format("                <Key word=\"real\" />\n");
            text += String.Format("                <Key word=\"synchronized\" />\n");
            text += String.Format("                <Key word=\"switch\" />\n");
            text += String.Format("                <Key word=\"static\" />\n");
            text += String.Format("                <Key word=\"setter\" />\n");
            text += String.Format("                <Key word=\"string\" />\n");
            text += String.Format("                <Key word=\"super\" />\n");
            text += String.Format("                <Key word=\"typeof\" />\n");
            text += String.Format("                <Key word=\"throw\" />\n");
            text += String.Format("                <Key word=\"this\" />\n");
            text += String.Format("                <Key word=\"true\" />\n");
            text += String.Format("                <Key word=\"try\" />\n");
            text += String.Format("                <Key word=\"void\" />\n");
            text += String.Format("                <Key word=\"var\" />\n");
            text += String.Format("                <Key word=\"while\" />\n");
            text += String.Format("                <Key word=\"with\" />\n");
            text += String.Format("            </KeyWords>\n");
            text += String.Format("        </RuleSet>\n");
            text += String.Format("    </RuleSets>\n");

            text += String.Format("</SyntaxDefinition>\n");
            text += String.Format("\n");

            return(text);
        }