コード例 #1
0
 private void SetKeyBinding(ScintillaNET.BindableCommand Command, AcceleratorKey Key)
 {
     if ((Key == null) ||
         (Key.Key == System.Windows.Forms.Keys.None))
     {
         // nothing defined, leave default key
         return;
     }
     RemoveCommandBinding(Command);
     editSource.Commands.AddBinding(Key.Key & System.Windows.Forms.Keys.KeyCode, Key.Key & System.Windows.Forms.Keys.Modifiers, Command);
     //dh.Log( "Set Binding " + Key.Key );
 }
コード例 #2
0
ファイル: StudioSettings.cs プロジェクト: wowjinxy/C64Studio
        private void SetKeyBindingKey(C64Studio.Types.Function Function, Keys Key)
        {
            foreach (var accPair in Accelerators)
            {
                if (accPair.Value.Function == Function)
                {
                    Accelerators.Remove(accPair.Key, accPair.Value);
                    break;
                }
            }

            if (Key != Keys.None)
            {
                AcceleratorKey key = new AcceleratorKey(Key, Function);
                key.Key = Key;
                Accelerators.Add(key.Key, key);
            }
        }
コード例 #3
0
ファイル: StudioSettings.cs プロジェクト: wowjinxy/C64Studio
        public bool ReadFromBuffer(GR.Memory.ByteBuffer SettingsData)
        {
            IgnoredWarnings.Clear();

            GR.IO.BinaryReader binReader = new GR.IO.BinaryReader(SettingsData.MemoryStream());

            GR.IO.FileChunk chunkData = new GR.IO.FileChunk();

            while (chunkData.ReadFromStream(binReader))
            {
                switch (chunkData.Type)
                {
                case Types.FileChunk.SETTINGS_TOOL:
                {
                    ToolInfo tool = new ToolInfo();

                    tool.FromChunk(chunkData);

                    // sanitize args
                    tool.CartArguments = tool.CartArguments.Replace("$(BuildTargetFilename)", "$(RunFilename)");
                    tool.PRGArguments  = tool.PRGArguments.Replace("$(BuildTargetFilename)", "$(RunFilename)");
                    tool.WorkPath      = tool.WorkPath.Replace("$(FilePath)", "$(RunPath)");

                    if (string.IsNullOrEmpty(tool.TrueDriveOnArguments))
                    {
                        tool.TrueDriveOnArguments  = "-truedrive +virtualdev";
                        tool.TrueDriveOffArguments = "+truedrive -virtualdev";
                    }
                    if (tool.PRGArguments.Contains("-truedrive "))
                    {
                        tool.PRGArguments = tool.PRGArguments.Replace("-truedrive ", "");
                    }
                    if (tool.PRGArguments.Contains(" -truedrive"))
                    {
                        tool.PRGArguments = tool.PRGArguments.Replace(" -truedrive", "");
                    }
                    ToolInfos.AddLast(tool);
                }
                break;

                case Types.FileChunk.SETTINGS_ACCELERATOR:
                {
                    AcceleratorKey key = new AcceleratorKey();

                    key.FromChunk(chunkData);

                    Accelerators.Add(key.Key, key);
                }
                break;

                case Types.FileChunk.SETTINGS_DPS_LAYOUT:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    uint size = binIn.ReadUInt32();
                    GR.Memory.ByteBuffer tempData = new GR.Memory.ByteBuffer();
                    binIn.ReadBlock(tempData, size);
                    SetLayoutFromData(tempData);
                }
                break;

                case Types.FileChunk.SETTINGS_SOUND:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    PlaySoundOnSuccessfulBuild   = (binIn.ReadUInt8() != 0);
                    PlaySoundOnBuildFailure      = (binIn.ReadUInt8() != 0);
                    PlaySoundOnSearchFoundNoItem = (binIn.ReadUInt8() != 0);
                }
                break;

                case Types.FileChunk.SETTINGS_WINDOW:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    MainWindowPlacement = binIn.ReadString();
                }
                break;

                case Types.FileChunk.SETTINGS_TABS:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    TabSize = binIn.ReadInt32();
                    if ((TabSize <= 0) ||
                        (TabSize >= 100))
                    {
                        TabSize = 2;
                    }
                    AllowTabs          = (binIn.ReadUInt8() != 0);
                    TabConvertToSpaces = (binIn.ReadUInt8() != 0);
                }
                break;

                case Types.FileChunk.SETTINGS_FONT:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    SourceFontFamily = binIn.ReadString();
                    SourceFontSize   = (float)binIn.ReadInt32();

                    BASICUseNonC64Font    = (binIn.ReadUInt8() != 0);
                    BASICSourceFontFamily = binIn.ReadString();
                    BASICSourceFontSize   = (float)binIn.ReadInt32();
                    if (BASICSourceFontSize <= 0)
                    {
                        BASICSourceFontSize = 9.0f;
                    }
                }
                break;

                case Types.FileChunk.SETTINGS_SYNTAX_COLORING:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    Types.SyntaxElement element = (C64Studio.Types.SyntaxElement)binIn.ReadUInt32();

                    Types.SyntaxColor color = new C64Studio.Types.SyntaxColor(GR.EnumHelper.GetDescription(element));
                    color.FGColor     = binIn.ReadUInt32();
                    color.BGColor     = binIn.ReadUInt32();
                    color.BGColorAuto = (binIn.ReadUInt32() != 0);

                    SyntaxColoring.Add(element, color);
                }
                break;

                case Types.FileChunk.SETTINGS_UI:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    ToolbarActiveMain     = (binIn.ReadUInt8() == 1);
                    ToolbarActiveDebugger = (binIn.ReadUInt8() == 1);
                }
                break;

                case Types.FileChunk.SETTINGS_RUN_EMULATOR:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    TrueDriveEnabled = (binIn.ReadUInt8() != 0);
                }
                break;

                case Types.FileChunk.SETTINGS_DEFAULTS:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    DefaultProjectBasePath = binIn.ReadString();
                }
                break;

                case Types.FileChunk.SETTINGS_FIND_REPLACE:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    LastFindIgnoreCase = (binIn.ReadUInt8() == 1);
                    LastFindWholeWord  = (binIn.ReadUInt8() == 1);
                    LastFindRegexp     = (binIn.ReadUInt8() == 1);
                    LastFindWrap       = (binIn.ReadUInt8() == 1);
                    LastFindTarget     = binIn.ReadUInt8();

                    int numFindArguments = binIn.ReadInt32();
                    for (int i = 0; i < numFindArguments; ++i)
                    {
                        FindArguments.Add(binIn.ReadString());
                    }
                    int numReplaceArguments = binIn.ReadInt32();
                    for (int i = 0; i < numReplaceArguments; ++i)
                    {
                        ReplaceArguments.Add(binIn.ReadString());
                    }
                }
                break;

                case Types.FileChunk.SETTINGS_IGNORED_WARNINGS:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    int numIgnoredWarnings = binIn.ReadInt32();

                    for (int i = 0; i < numIgnoredWarnings; ++i)
                    {
                        IgnoredWarnings.Add((C64Studio.Types.ErrorCode)binIn.ReadInt32());
                    }
                }
                break;

                case Types.FileChunk.SETTINGS_PANEL_DISPLAY_DETAILS:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    string toolName = binIn.ReadString();

                    if (GenericTools.ContainsKey(toolName))
                    {
                        uint length = binIn.ReadUInt32();
                        GR.Memory.ByteBuffer data = new GR.Memory.ByteBuffer();

                        binIn.ReadBlock(data, length);
                        GenericTools[toolName].ApplyDisplayDetails(data);
                    }
                }
                break;

                case Types.FileChunk.SETTINGS_BASIC_KEYMAP:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    int numEntries = binIn.ReadInt32();

                    uint neutralLang = (uint)(System.Globalization.CultureInfo.CurrentCulture.KeyboardLayoutId & 0xff);

                    if ((neutralLang != 7) &&
                        (neutralLang != 9))
                    {
                        neutralLang = 9;
                    }

                    for (int i = 0; i < numEntries; ++i)
                    {
                        Keys key = (Keys)binIn.ReadUInt32();
                        Types.KeyboardKey cmdKey = (C64Studio.Types.KeyboardKey)binIn.ReadInt32();

                        var keyMapEntry = new KeymapEntry();

                        foreach (var entry in BASICKeyMap.DefaultKeymaps[neutralLang])
                        {
                            if (entry.Value.KeyboardKey == cmdKey)
                            {
                                BASICKeyMap.Keymap[key] = entry.Value;
                                break;
                            }
                        }
                    }
                }
                break;

                case Types.FileChunk.SETTINGS_ASSEMBLER_EDITOR:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    ASMHideLineNumbers = (binIn.ReadUInt8() != 0);
                }
                break;

                case Types.FileChunk.SETTINGS_BASIC_PARSER:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    BASICStripSpaces = (binIn.ReadUInt8() != 0);
                }
                break;

                case Types.FileChunk.SETTINGS_ENVIRONMENT:
                {
                    GR.IO.IReader binIn = chunkData.MemoryReader();

                    AutoOpenLastSolution = (binIn.ReadUInt8() != 0);
                }
                break;
                }
            }
            return(true);
        }
コード例 #4
0
ファイル: StudioSettings.cs プロジェクト: wowjinxy/C64Studio
 public void AddAccelerator(AcceleratorKey Accelerator)
 {
     Accelerators.Add(Accelerator.Key, Accelerator);
 }