├── .gitignore ├── Example Song Archive.zip ├── GlobalAssemblyInfo.cs ├── HelpFile ├── 1_InfoOgolne.html ├── 2_CoNowego.html ├── 5_Hotkeys.html ├── 6_Ustawienia.html ├── Index.hhk ├── Pomoc.chm ├── TOC.hhc └── test.hhp ├── Licence.txt ├── MainApplication ├── Controls │ ├── ComparisonMethod.cs │ ├── FileEditor.Designer.cs │ ├── FileEditor.cs │ ├── FileEditor.pl.resx │ ├── FileEditor.resx │ ├── FileEditorTabs.cs │ ├── FileListView.Designer.cs │ ├── FileListView.cs │ ├── FileListView.pl.resx │ ├── FileListView.resx │ ├── FilePropertiesViewer.Designer.cs │ ├── FilePropertiesViewer.cs │ ├── FilePropertiesViewer.pl.resx │ ├── FilePropertiesViewer.resx │ ├── FilePropertiesViewerEventArgs.cs │ ├── FilterBox.Designer.cs │ ├── FilterBox.cs │ ├── FilterBox.pl.resx │ ├── FilterBox.resx │ ├── MultilineListBox.cs │ ├── OutputAppearanceControls.Designer.cs │ ├── OutputAppearanceControls.cs │ ├── OutputAppearanceControls.pl.resx │ ├── OutputAppearanceControls.resx │ └── Screens │ │ ├── FontSizeExtra.cs │ │ ├── OutputCluster.Designer.cs │ │ ├── OutputCluster.cs │ │ ├── OutputCluster.resx │ │ ├── OutputField.xaml │ │ ├── OutputField.xaml.cs │ │ ├── PreviewField.xaml │ │ ├── PreviewField.xaml.cs │ │ ├── PreviewScreens.Designer.cs │ │ ├── PreviewScreens.cs │ │ ├── PreviewScreens.pl.resx │ │ └── PreviewScreens.resx ├── EntryPoint.cs ├── ImportExport │ ├── FileImporter.cs │ └── FileImporterResult.cs ├── Licence.licenseheader ├── MainApplication.csproj ├── Misc │ ├── CultureConfigurator.cs │ ├── Extensions.cs │ ├── FormsToWpf.cs │ ├── MessageBoxes.cs │ ├── NameChangeResult.cs │ └── StartupAction.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Localisation.Designer.cs │ ├── Localisation.pl.Designer.cs │ ├── Localisation.pl.resx │ ├── Localisation.resx │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Ustawienia.Designer.cs │ ├── Ustawienia.cs │ ├── Ustawienia.settings │ └── app.manifest ├── Resources │ ├── CopyHS.png │ ├── CutHS.png │ ├── DeleteHS.png │ ├── DoubleLeftArrowHS.png │ ├── DoubleRightArrowHS.png │ ├── Edit_RedoHS.png │ ├── Edit_UndoHS.png │ ├── FindHS.png │ ├── Help.png │ ├── IndentHS.png │ ├── ItalicHS.png │ ├── LegendHS.png │ ├── NewDocumentHS.png │ ├── NewFolderHS.png │ ├── PasteHS.png │ ├── Properties.png │ ├── PublishPlanHS.png │ ├── RenameFolderHS.png │ ├── RepeatHS.png │ ├── SaveAllHS.png │ ├── SearchFolderHS.png │ ├── aboutImage.jpg │ ├── boldhs.png │ ├── icon.png │ ├── openfolderHS.png │ └── saveHS.png ├── SongFile │ ├── SongFileArchive.cs │ ├── SongFileCollection.cs │ └── SongFileEntry.cs ├── Windows │ ├── AboutBox.Designer.cs │ ├── AboutBox.cs │ ├── AboutBox.pl.resx │ ├── AboutBox.resx │ ├── DodajPlik.Designer.cs │ ├── DodajPlik.cs │ ├── DodajPlik.pl.resx │ ├── DodajPlik.resx │ ├── DraggableForm.cs │ ├── Eksport.Designer.cs │ ├── Eksport.cs │ ├── Eksport.pl.resx │ ├── Eksport.resx │ ├── ImportArchiwum.Designer.cs │ ├── ImportArchiwum.cs │ ├── ImportArchiwum.pl.resx │ ├── ImportArchiwum.resx │ ├── LanguageChangeWindow.Designer.cs │ ├── LanguageChangeWindow.cs │ ├── LanguageChangeWindow.pl.resx │ ├── LanguageChangeWindow.resx │ ├── MainWindow.Designer.cs │ ├── MainWindow.cs │ ├── MainWindow.pl.resx │ ├── MainWindow.resx │ ├── PropertiesWindow.Designer.cs │ ├── PropertiesWindow.cs │ ├── PropertiesWindow.pl.resx │ ├── PropertiesWindow.resx │ ├── SecondaryWindow.Designer.cs │ ├── SecondaryWindow.cs │ ├── SecondaryWindow.pl.resx │ ├── SecondaryWindow.resx │ ├── SettingsWindow.Designer.cs │ ├── SettingsWindow.cs │ ├── SettingsWindow.pl.resx │ └── SettingsWindow.resx ├── app.config ├── icon.ico └── packages.config ├── PortableSettingsProvider ├── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── PortableSettingsProvider.vb ├── PortableSettingsProvider.vbproj ├── U3SettingsProvider.vb └── app.config ├── README.md ├── ScintillaNET ├── Annotation.cs ├── AutoCSelectionEventArgs.cs ├── AutomaticFold.cs ├── BeforeModificationEventArgs.cs ├── CaretStyle.cs ├── ChangeAnnotationEventArgs.cs ├── CharAddedEventArgs.cs ├── Command.cs ├── CopyFormat.cs ├── Document.cs ├── DoubleClickEventArgs.cs ├── DwellEventArgs.cs ├── EdgeMode.cs ├── Eol.cs ├── FlagsEnumConverter.cs ├── FoldAction.cs ├── FoldFlags.cs ├── FoldLevelFlags.cs ├── FontQuality.cs ├── GapBuffer.cs ├── Helpers.cs ├── HotspotClickEventArgs.cs ├── ILoader.cs ├── IdleStyling.cs ├── IndentView.cs ├── Indicator.cs ├── IndicatorClickEventArgs.cs ├── IndicatorCollection.cs ├── IndicatorFlags.cs ├── IndicatorReleaseEventArgs.cs ├── IndicatorStyle.cs ├── InsertCheckEventArgs.cs ├── Lexer.cs ├── Line.cs ├── LineCollection.cs ├── LineEndType.cs ├── ListCompletionMethod.cs ├── Loader.cs ├── Margin.cs ├── MarginClickEventArgs.cs ├── MarginCollection.cs ├── MarginCursor.cs ├── MarginOptions.cs ├── MarginType.cs ├── Marker.cs ├── MarkerCollection.cs ├── MarkerHandle.cs ├── MarkerSymbol.cs ├── ModificationEventArgs.cs ├── ModificationSource.cs ├── MultiPaste.cs ├── NativeMemoryStream.cs ├── NativeMethods.cs ├── NeedShownEventArgs.cs ├── Order.cs ├── Phases.cs ├── ProjectionEqualityComparer.cs ├── Properties │ └── AssemblyInfo.cs ├── PropertyType.cs ├── SCNotificationEventArgs.cs ├── Scintilla.cs ├── ScintillaNET.csproj ├── ScintillaReader.cs ├── SearchFlags.cs ├── Selection.cs ├── SelectionCollection.cs ├── Status.cs ├── Style.cs ├── StyleCase.cs ├── StyleCollection.cs ├── StyleNeededEventArgs.cs ├── Technology.cs ├── Tuple.cs ├── UpdateChange.cs ├── UpdateUIEventArgs.cs ├── VirtualSpace.cs ├── WhitespaceMode.cs ├── WrapIndentMode.cs ├── WrapMode.cs ├── WrapVisualFlagLocation.cs └── WrapVisualFlags.cs ├── TextToScreen.sln ├── UpdateInfo.xml └── _Installer ├── .gitignore ├── InstallDependancies.iss ├── TtsSetup.iss ├── bigImage.bmp ├── bigImage.pdn ├── logo.ico ├── scripts ├── Ngen.iss ├── PortableIcons.iss ├── PortablePage.iss ├── isxdl │ ├── czech.ini │ ├── english.ini │ ├── french.ini │ ├── french2.ini │ ├── french3.ini │ ├── german.ini │ ├── german2.ini │ ├── german3.ini │ ├── isxdl.dll │ ├── isxdl.iss │ ├── norwegian.ini │ ├── polish.ini │ ├── portugues.ini │ ├── portuguese.ini │ ├── russian.ini │ ├── spanish.ini │ └── swedish.ini ├── products.iss └── products │ ├── dotnetfx11.iss │ ├── dotnetfx11lp.iss │ ├── dotnetfx11sp1.iss │ ├── dotnetfx20.iss │ ├── dotnetfx20lp.iss │ ├── dotnetfx20sp1.iss │ ├── dotnetfx20sp1lp.iss │ ├── dotnetfx20sp2.iss │ ├── dotnetfx20sp2lp.iss │ ├── dotnetfx35.iss │ ├── dotnetfx35lp.iss │ ├── dotnetfx35sp1.iss │ ├── dotnetfx35sp1lp.iss │ ├── dotnetfx40client.iss │ ├── dotnetfx40full.iss │ ├── dotnetfx45.iss │ ├── dotnetfxversion.iss │ ├── fileversion.iss │ ├── ie6.iss │ ├── iis.iss │ ├── jet4sp8.iss │ ├── kb835732.iss │ ├── mdac28.iss │ ├── msi20.iss │ ├── msi31.iss │ ├── msi45.iss │ ├── msiproduct.iss │ ├── sql2005express.iss │ ├── sql2008express.iss │ ├── sqlcompact35sp2.iss │ ├── stringversion.iss │ ├── vcredist2005.iss │ ├── vcredist2008.iss │ ├── vcredist2010.iss │ ├── vcredist2012.iss │ ├── vcredist2013.iss │ ├── wic.iss │ └── winversion.iss └── smallImage.bmp /Example Song Archive.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/Example Song Archive.zip -------------------------------------------------------------------------------- /GlobalAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | // General Information about an assembly is controlled through the following 4 | // set of attributes. Change these attribute values to modify the information 5 | // associated with an assembly. 6 | 7 | [assembly: AssemblyCompany("Marcin Szeniak")] 8 | [assembly: AssemblyCopyright("Copyright © 2017")] 9 | [assembly: AssemblyTrademark("")] 10 | [assembly: AssemblyCulture("")] 11 | 12 | #if DEBUG 13 | 14 | [assembly: AssemblyConfiguration("Debug")] 15 | #else 16 | 17 | [assembly: AssemblyConfiguration("Release")] 18 | #endif 19 | 20 | // Version information for an assembly consists of the following four values: 21 | // 22 | // Major Version 23 | // Minor Version 24 | // Build Number 25 | // Revision 26 | // 27 | // You can specify all the values or you can default the Build and Revision Numbers 28 | // by using the '*' as shown below: 29 | 30 | [assembly: AssemblyVersion("1.10.*")] -------------------------------------------------------------------------------- /HelpFile/6_Ustawienia.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 20 | 21 | 22 |

Ustawienia są zapisywane w folderze ustawień 23 | użytkownika, więc są one inne dla każdego konta 24 | użytkownika.

25 |

Zakładka „Ogólne”

26 |

Opcje „Pozwól innym programom na 27 | dostęp do otwartego archiwum” oraz „Monitoruj zmiany 28 | archiwum przez inne programy” są eksperymentalne. W 29 | większości przypadków będą one działać 30 | poprawnie, ale mogą zachowywać się w „dziwny” 31 | sposób przy niektórych konfiguracjach systemu (mogą 32 | też całkowicie odmówić działania).

33 |

Otwieranie używanego archiwum w zewnętrznym 34 | programie jest bezpieczne, ale jeżeli program ten zablokuje 35 | dostęp do archiwum, nie będzie można go zapisać 36 | pod tą samą nazwą do momentu zamknięcia danego 37 | programu.

38 |

Zakładka „Okno główne”

39 |

Opcja „Rozszerz okno na cały ekran” 40 | nie ukrywa paska zadań, w przeciwieństwie do opcji o tej 41 | samej nazwie dla Okna wyjściowego.

42 |

Zakładka „Okno wyjściowe”

43 |

Opcje z grupy „Właściwości 44 | okna” są dostępne poprzez kliknięcie prawym 45 | przyciskiem na czarną część okna wyjściowego. 46 | Ukrycie kursora nie wyłącza tego menu.

47 |

Szybkość przejścia odnosi się 48 | do czasu od naciśnięcia przycisku „Wyślij” 49 | do zakończenia animacji przejścia.

50 |

Zmiana koloru może mieć nieintuicyjny 51 | efekt na oknie wyjściowym. Zalecane jest przetestowanie tych 52 | opcji przed normalnym użytkowaniem.

53 | 54 | -------------------------------------------------------------------------------- /HelpFile/Index.hhk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 29 | 30 | -------------------------------------------------------------------------------- /HelpFile/Pomoc.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/HelpFile/Pomoc.chm -------------------------------------------------------------------------------- /HelpFile/TOC.hhc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 38 | 39 | -------------------------------------------------------------------------------- /HelpFile/test.hhp: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Compatibility=1.1 or later 3 | Compiled file=Pomoc.chm 4 | Contents file=TOC.hhc 5 | Default topic=1_InfoOgolne.html 6 | Display compile progress=No 7 | Language=0x415 Polish (Poland) 8 | Title=Pomoc programu TextToScreen 9 | 10 | 11 | [FILES] 12 | 1_InfoOgolne.html 13 | 2_CoNowego.html 14 | 5_Hotkeys.html 15 | 6_Ustawienia.html 16 | 17 | [INFOTYPES] 18 | 19 | -------------------------------------------------------------------------------- /MainApplication/Controls/ComparisonMethod.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using Klocman.Localising; 7 | using TextToScreen.Properties; 8 | 9 | namespace TextToScreen.Controls 10 | { 11 | public enum ComparisonMethod 12 | { 13 | [LocalisedName(typeof (Localisation), "FilterComparisonMethod_Contains")] Contains, 14 | [LocalisedName(typeof (Localisation), "FilterComparisonMethod_Equals")] Equals, 15 | [LocalisedName(typeof (Localisation), "FilterComparisonMethod_Any")] Any, 16 | [LocalisedName(typeof (Localisation), "FilterComparisonMethod_StartsWith")] StartsWith, 17 | [LocalisedName(typeof (Localisation), "FilterComparisonMethod_EndsWith")] EndsWith, 18 | [LocalisedName(typeof (Localisation), "FilterComparisonMethod_Regex")] Regex 19 | } 20 | } -------------------------------------------------------------------------------- /MainApplication/Controls/FileEditorTabs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | namespace TextToScreen.Controls 7 | { 8 | public enum FileEditorTabs 9 | { 10 | VerseList = 0, 11 | ContentEditor = 1, 12 | Properties = 2 13 | } 14 | } -------------------------------------------------------------------------------- /MainApplication/Controls/FilePropertiesViewerEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using TextToScreen.SongFile; 8 | 9 | namespace TextToScreen.Controls 10 | { 11 | public sealed class FilePropertiesViewerEventArgs : EventArgs, IDisposable 12 | { 13 | public FilePropertiesViewerEventArgs(SongFileEntry target, string name, string group, string comment) 14 | { 15 | TargetSongFileEntry = target; 16 | NewName = name; 17 | NewGroup = group; 18 | NewComment = comment; 19 | } 20 | 21 | public string NewComment { get; private set; } 22 | public string NewGroup { get; private set; } 23 | public string NewName { get; private set; } 24 | public SongFileEntry TargetSongFileEntry { get; private set; } 25 | 26 | public void Dispose() 27 | { 28 | TargetSongFileEntry = null; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /MainApplication/Controls/Screens/FontSizeExtra.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | namespace TextToScreen.Controls.Screens 7 | { 8 | public class FontSizeExtra 9 | { 10 | public FontSizeExtra(double size, bool flexible) 11 | { 12 | Size = size; 13 | Flexible = flexible; 14 | } 15 | 16 | public double Size { get; set; } 17 | public bool Flexible { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /MainApplication/Controls/Screens/OutputCluster.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TextToScreen.Controls.Screens 2 | { 3 | partial class OutputCluster 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.elementHost2 = new System.Windows.Forms.Integration.ElementHost(); 32 | this.outputField2 = new TextToScreen.Controls.Screens.OutputField(); 33 | this.elementHost1 = new System.Windows.Forms.Integration.ElementHost(); 34 | this.outputField1 = new TextToScreen.Controls.Screens.OutputField(); 35 | this.SuspendLayout(); 36 | // 37 | // elementHost2 38 | // 39 | this.elementHost2.Dock = System.Windows.Forms.DockStyle.Fill; 40 | this.elementHost2.Location = new System.Drawing.Point(0, 0); 41 | this.elementHost2.Name = "elementHost2"; 42 | this.elementHost2.Size = new System.Drawing.Size(150, 150); 43 | this.elementHost2.TabIndex = 1; 44 | this.elementHost2.Text = "elementHost2"; 45 | this.elementHost2.Child = this.outputField2; 46 | // 47 | // elementHost1 48 | // 49 | this.elementHost1.Dock = System.Windows.Forms.DockStyle.Fill; 50 | this.elementHost1.Location = new System.Drawing.Point(0, 0); 51 | this.elementHost1.Name = "elementHost1"; 52 | this.elementHost1.Size = new System.Drawing.Size(150, 150); 53 | this.elementHost1.TabIndex = 0; 54 | this.elementHost1.Text = "elementHost1"; 55 | this.elementHost1.Child = this.outputField1; 56 | // 57 | // OutputCluster 58 | // 59 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 60 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 61 | this.Controls.Add(this.elementHost2); 62 | this.Controls.Add(this.elementHost1); 63 | this.Name = "OutputCluster"; 64 | this.ResumeLayout(false); 65 | 66 | } 67 | 68 | #endregion 69 | 70 | private System.Windows.Forms.Integration.ElementHost elementHost1; 71 | private TextToScreen.Controls.Screens.OutputField outputField1; 72 | private System.Windows.Forms.Integration.ElementHost elementHost2; 73 | private TextToScreen.Controls.Screens.OutputField outputField2; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /MainApplication/Controls/Screens/OutputField.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 14 | 15 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0:0:2 27 | 28 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /MainApplication/Controls/Screens/PreviewField.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /MainApplication/Controls/Screens/PreviewField.xaml.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System.Windows.Controls; 7 | 8 | namespace TextToScreen.Controls.Screens 9 | { 10 | /// 11 | /// Interaction logic for PreviewField.xaml 12 | /// 13 | public partial class PreviewField : UserControl 14 | { 15 | public PreviewField() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | public void SetPreviewTarget(OutputField outputField) 21 | { 22 | DataContext = outputField; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /MainApplication/Controls/Screens/PreviewScreens.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Windows.Forms; 8 | using Klocman.Extensions; 9 | 10 | namespace TextToScreen.Controls.Screens 11 | { 12 | public sealed partial class PreviewScreens : UserControl 13 | { 14 | public PreviewScreens() 15 | { 16 | InitializeComponent(); 17 | 18 | TopDisplayBox = (PreviewField) elementHost1.Child; 19 | BottomDisplayBox = (PreviewField) elementHost2.Child; 20 | } 21 | 22 | public PreviewField BottomDisplayBox { get; } 23 | public PreviewField TopDisplayBox { get; } 24 | 25 | public bool ButtonsEnabled 26 | { 27 | get { return button_send.Enabled; } 28 | set 29 | { 30 | button_send.Enabled = value; 31 | button_clear.Enabled = value; 32 | } 33 | } 34 | 35 | public event Action ButtonClickClear; 36 | public event Action ButtonClickSend; 37 | 38 | /// 39 | /// Range 0-100 (%). Pass value out of range to hide the progressbar. 40 | /// 41 | public void SetProgressBar(int position) 42 | { 43 | this.SafeInvoke(() => 44 | { 45 | if (position >= 100 || position < 0) 46 | { 47 | fadeProgressBar.Visible = false; 48 | fadeProgressBar.Value = 0; 49 | } 50 | else 51 | { 52 | fadeProgressBar.Visible = true; 53 | fadeProgressBar.Value = position; 54 | } 55 | }); 56 | } 57 | 58 | private void button_clear_Click(object sender, EventArgs e) 59 | { 60 | ButtonClickClear?.Invoke(this); 61 | } 62 | 63 | private void button_send_Click(object sender, EventArgs e) 64 | { 65 | ButtonClickSend?.Invoke(this); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /MainApplication/EntryPoint.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | using System.Threading; 10 | using System.Windows.Forms; 11 | using TextToScreen.Misc; 12 | using TextToScreen.Windows; 13 | 14 | namespace TextToScreen 15 | { 16 | internal static class EntryPoint 17 | { 18 | /// 19 | /// The main entry point for the application. 20 | /// 21 | [STAThread] 22 | private static void Main() 23 | { 24 | var assembly = Assembly.GetExecutingAssembly(); 25 | var attribute = (GuidAttribute) assembly.GetCustomAttributes(typeof (GuidAttribute), true)[0]; 26 | var guid = attribute.Value; 27 | 28 | var mutex = new Mutex(true, guid); 29 | 30 | if (mutex.WaitOne(TimeSpan.Zero, true)) 31 | { 32 | CultureConfigurator.SetupCulture(); 33 | Application.EnableVisualStyles(); 34 | Application.SetCompatibleTextRenderingDefault(false); 35 | Application.Run(new MainWindow()); 36 | mutex.ReleaseMutex(); 37 | } 38 | else 39 | { 40 | MessageBoxes.ApplicationAlreadyRunningInfo(); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /MainApplication/ImportExport/FileImporterResult.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | using TextToScreen.SongFile; 9 | 10 | namespace TextToScreen.ImportExport 11 | { 12 | public struct FileImporterResult 13 | { 14 | public readonly IDictionary Errors; 15 | public readonly IEnumerable Results; 16 | 17 | public FileImporterResult(IEnumerable results, IDictionary errors) 18 | { 19 | if (results == null || errors == null) 20 | throw new ArgumentNullException(); 21 | Results = results; 22 | Errors = errors; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /MainApplication/Licence.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: designer.cs generated.cs 2 | extensions: .cs .cpp .h 3 | /* 4 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 5 | Apache License Version 2.0 6 | */ 7 | 8 | extensions: .aspx .ascx 9 | <%-- 10 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 11 | Apache License Version 2.0 12 | --%> 13 | extensions: .xml .config .xsd 14 | -------------------------------------------------------------------------------- /MainApplication/Misc/CultureConfigurator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Globalization; 9 | using System.Linq; 10 | using System.Threading; 11 | using Klocman.Extensions; 12 | using Klocman.Tools; 13 | using TextToScreen.Properties; 14 | 15 | namespace TextToScreen.Misc 16 | { 17 | public static class CultureConfigurator 18 | { 19 | private static IEnumerable _supportedLanguages; 20 | private static CultureInfo _enUsCulture; 21 | private static CultureInfo EnUsCulture => _enUsCulture ?? (_enUsCulture = CultureInfo.GetCultureInfo("en-US")); 22 | 23 | public static IEnumerable SupportedLanguages 24 | { 25 | get 26 | { 27 | return _supportedLanguages ?? (_supportedLanguages = new[] 28 | { 29 | EnUsCulture, 30 | CultureInfo.GetCultureInfo("en-GB"), 31 | CultureInfo.GetCultureInfo("pl-PL") 32 | }.OrderBy(x => x.DisplayName).ToList().AsEnumerable()); 33 | } 34 | } 35 | 36 | public static void SetupCulture() 37 | { 38 | var currentCulture = CultureInfo.CurrentCulture; 39 | 40 | var targetLocale = Ustawienia.Default.LanguageOverride; 41 | if (targetLocale.IsNotEmpty()) 42 | { 43 | try 44 | { 45 | currentCulture = SupportedLanguages.First(x => x.Name.Equals(targetLocale)); 46 | } 47 | catch 48 | { 49 | Ustawienia.Default.LanguageOverride = string.Empty; 50 | } 51 | } 52 | 53 | if (!currentCulture.Name.ContainsAny(SupportedLanguages.Select(x => x.Parent.Name), 54 | StringComparison.OrdinalIgnoreCase)) 55 | currentCulture = EnUsCulture; 56 | 57 | ProcessTools.SetDefaultCulture(currentCulture); 58 | var thread = Thread.CurrentThread; 59 | thread.CurrentCulture = currentCulture; 60 | thread.CurrentUICulture = currentCulture; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /MainApplication/Misc/Extensions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System.Drawing; 7 | 8 | namespace TextToScreen.Misc 9 | { 10 | public static class Extensions 11 | { 12 | public static Color ToDrawingColor(this System.Windows.Media.Color color) 13 | { 14 | return Color.FromArgb(color.A, color.R, color.G, color.B); 15 | } 16 | 17 | public static System.Windows.Media.Color ToMediaColor(this Color color) 18 | { 19 | return System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /MainApplication/Misc/NameChangeResult.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | namespace TextToScreen.Misc 7 | { 8 | public enum NameChangeResult 9 | { 10 | Ok, 11 | InvalidChars, 12 | AlreadyTaken, 13 | Empty 14 | } 15 | } -------------------------------------------------------------------------------- /MainApplication/Misc/StartupAction.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | 8 | namespace TextToScreen.Misc 9 | { 10 | [Serializable] 11 | public enum StartupAction 12 | { 13 | DoNothing = 0, 14 | OpenRecent = 1, 15 | OpenSelected = 2 16 | } 17 | } -------------------------------------------------------------------------------- /MainApplication/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Reflection; 8 | using System.Resources; 9 | using System.Runtime.InteropServices; 10 | 11 | // General Information about an assembly is controlled through the following 12 | // set of attributes. Change these attribute values to modify the information 13 | // associated with an assembly. 14 | 15 | [assembly: AssemblyTitle("Text To Screen")] 16 | [assembly: AssemblyDescription("Application for displaying of lyrics or scripts on an external display.")] 17 | [assembly: AssemblyProduct("TextToScreen")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | 27 | [assembly: Guid("826a6c11-a031-4b91-850c-63cbc2cc9487")] 28 | [assembly: CLSCompliant(false)] 29 | [assembly: NeutralResourcesLanguage("en")] -------------------------------------------------------------------------------- /MainApplication/Properties/Localisation.pl.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Properties/Localisation.pl.Designer.cs -------------------------------------------------------------------------------- /MainApplication/Properties/Ustawienia.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System.IO; 7 | using Klocman.Binding.Settings; 8 | 9 | namespace TextToScreen.Properties 10 | { 11 | internal sealed partial class Ustawienia 12 | { 13 | public Ustawienia() 14 | { 15 | Binder = new SettingBinder(this); 16 | } 17 | 18 | public static Ustawienia DefaultValues { get; } = (Ustawienia) Synchronized(new Ustawienia()); 19 | 20 | public SettingBinder Binder { get; } 21 | 22 | /// 23 | /// Add file to recent items if it exists 24 | /// 25 | public static void AddRecentItem(string path) 26 | { 27 | if (!string.IsNullOrEmpty(path) && File.Exists(path)) 28 | { 29 | if (Default.AutoRecentItems.Contains(path)) 30 | Default.AutoRecentItems.Remove(path); 31 | Default.AutoRecentItems.Add(path); 32 | } 33 | 34 | TrimRecentItems(); 35 | } 36 | 37 | /// 38 | /// Remove recent items that are no longer needed 39 | /// 40 | public static void TrimRecentItems() 41 | { 42 | while (Default.AutoRecentItems.Count > Default.GeneralHistoryPoints && Default.GeneralHistoryPoints > 0) 43 | Default.AutoRecentItems.RemoveAt(0); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /MainApplication/Properties/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /MainApplication/Resources/CopyHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/CopyHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/CutHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/CutHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/DeleteHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/DeleteHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/DoubleLeftArrowHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/DoubleLeftArrowHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/DoubleRightArrowHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/DoubleRightArrowHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/Edit_RedoHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/Edit_RedoHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/Edit_UndoHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/Edit_UndoHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/FindHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/FindHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/Help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/Help.png -------------------------------------------------------------------------------- /MainApplication/Resources/IndentHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/IndentHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/ItalicHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/ItalicHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/LegendHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/LegendHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/NewDocumentHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/NewDocumentHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/NewFolderHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/NewFolderHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/PasteHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/PasteHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/Properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/Properties.png -------------------------------------------------------------------------------- /MainApplication/Resources/PublishPlanHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/PublishPlanHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/RenameFolderHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/RenameFolderHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/RepeatHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/RepeatHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/SaveAllHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/SaveAllHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/SearchFolderHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/SearchFolderHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/aboutImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/aboutImage.jpg -------------------------------------------------------------------------------- /MainApplication/Resources/boldhs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/boldhs.png -------------------------------------------------------------------------------- /MainApplication/Resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/icon.png -------------------------------------------------------------------------------- /MainApplication/Resources/openfolderHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/openfolderHS.png -------------------------------------------------------------------------------- /MainApplication/Resources/saveHS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/Resources/saveHS.png -------------------------------------------------------------------------------- /MainApplication/Windows/DodajPlik.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Windows.Forms; 8 | using TextToScreen.Misc; 9 | using TextToScreen.Properties; 10 | using TextToScreen.SongFile; 11 | 12 | namespace TextToScreen.Windows 13 | { 14 | public sealed partial class DodajPlik : Form 15 | { 16 | private SongFileEntry _target; 17 | 18 | public DodajPlik() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | public DialogResult ShowDialog(IWin32Window owner, SongFileEntry targetEntry, bool creatingNew) 24 | { 25 | if (targetEntry == null || owner == null) 26 | throw new ArgumentNullException(); 27 | 28 | Text = creatingNew ? Localisation.AddFileWindowTitle : Localisation.RenameFileWindowTitle; 29 | filePropertiesViewer1.Populate(targetEntry, true); 30 | _target = targetEntry; 31 | return ShowDialog(owner); 32 | } 33 | 34 | private void button1_Click(object sender, EventArgs e) 35 | { 36 | if (_target.CheckName(filePropertiesViewer1.NewName) != NameChangeResult.Ok) 37 | return; 38 | 39 | _target.Name = filePropertiesViewer1.NewName; 40 | _target.Comment = filePropertiesViewer1.NewComment; 41 | _target.Group = filePropertiesViewer1.NewGroup; 42 | DialogResult = DialogResult.OK; 43 | Close(); 44 | } 45 | 46 | private void button2_Click(object sender, EventArgs e) 47 | { 48 | DialogResult = DialogResult.Cancel; 49 | Close(); 50 | } 51 | 52 | private void DodajPlik_FormClosing(object sender, FormClosingEventArgs e) 53 | { 54 | _target = null; 55 | filePropertiesViewer1.Clear(); 56 | } 57 | 58 | // public int targetScreen = 0; 59 | private void DodajPlik_Shown(object sender, EventArgs e) 60 | { 61 | filePropertiesViewer1.Focus(); 62 | 63 | //var mainPos = Screen.AllScreens[targetScreen].Bounds; 64 | // this.SetDesktopLocation(mainPos.X + 100, mainPos.Y + 100); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /MainApplication/Windows/DraggableForm.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.ComponentModel; 8 | using System.Drawing; 9 | using System.Windows.Forms; 10 | 11 | namespace TextToScreen.Windows 12 | { 13 | public class DraggableForm : Form 14 | { 15 | private readonly IContainer components = null; 16 | 17 | private bool _drag; 18 | private string _excludeList = string.Empty; 19 | private Point _startPoint = new Point(0, 0); 20 | 21 | public DraggableForm() 22 | { 23 | InitializeComponent(); 24 | 25 | MouseDown += Form_MouseDown; 26 | MouseUp += Form_MouseUp; 27 | MouseMove += Form_MouseMove; 28 | } 29 | 30 | public bool Draggable { set; get; } = true; 31 | 32 | public string ExcludeList 33 | { 34 | set { _excludeList = value; } 35 | get { return _excludeList.Trim(); } 36 | } 37 | 38 | protected override void Dispose(bool disposing) 39 | { 40 | if (disposing) 41 | { 42 | components?.Dispose(); 43 | } 44 | base.Dispose(disposing); 45 | } 46 | 47 | private void Form_MouseDown(object sender, MouseEventArgs e) 48 | { 49 | if (e.Button != MouseButtons.Left) 50 | return; 51 | 52 | _drag = true; 53 | 54 | // Correct for the window border and titlebar 55 | var screenRectangle = RectangleToScreen(ClientRectangle); 56 | var borderHeight = screenRectangle.Top - Top; 57 | var borderWidth = screenRectangle.Left - Left; 58 | 59 | _startPoint = new Point(e.X + borderWidth, e.Y + borderHeight); 60 | } 61 | 62 | private void Form_MouseMove(object sender, MouseEventArgs e) 63 | { 64 | if (e.Button == MouseButtons.None) 65 | _drag = false; 66 | else if (_drag) 67 | { 68 | var p1 = new Point(e.X, e.Y); 69 | var p2 = PointToScreen(p1); 70 | var p3 = new Point(p2.X - _startPoint.X, 71 | p2.Y - _startPoint.Y); 72 | Location = p3; 73 | } 74 | } 75 | 76 | private void Form_MouseUp(object sender, MouseEventArgs e) 77 | { 78 | _drag = false; 79 | } 80 | 81 | private void InitializeComponent() 82 | { 83 | AutoScaleBaseSize = new Size(5, 13); 84 | ClientSize = new Size(369, 182); 85 | const string t = "FormBase"; 86 | Name = t; 87 | Text = t; 88 | } 89 | 90 | protected override void OnControlAdded(ControlEventArgs e) 91 | { 92 | if (Draggable && (ExcludeList.IndexOf(e.Control.Name, StringComparison.Ordinal) == -1)) 93 | { 94 | e.Control.MouseDown += Form_MouseDown; 95 | e.Control.MouseUp += Form_MouseUp; 96 | e.Control.MouseMove += Form_MouseMove; 97 | } 98 | base.OnControlAdded(e); 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /MainApplication/Windows/Eksport.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | using System.ComponentModel; 9 | using System.IO; 10 | using System.Linq; 11 | using System.Text; 12 | using System.Windows.Forms; 13 | using TextToScreen.Misc; 14 | using TextToScreen.SongFile; 15 | 16 | namespace TextToScreen.Windows 17 | { 18 | public sealed partial class Eksport : Form 19 | { 20 | private SongFileArchive _tempSource; 21 | 22 | public Eksport() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | public DialogResult ShowDialog(IWin32Window owner, SongFileArchive source) 28 | { 29 | if (owner == null || source == null) 30 | throw new ArgumentNullException(); 31 | 32 | Owner = (Form) owner; 33 | _tempSource = source; 34 | fileListView.PopulateItems(source.LoadedFiles); 35 | return base.ShowDialog(); 36 | } 37 | 38 | private void button1_Click(object sender, EventArgs e) 39 | { 40 | fileListView.SelectAll(); 41 | } 42 | 43 | private void button2_Click(object sender, EventArgs e) 44 | { 45 | fileListView.SelectNone(); 46 | } 47 | 48 | private void eksportbut_Click(object sender, EventArgs e) 49 | { 50 | if (fileListView.SelectedFiles.Any()) 51 | eksportujDialog.ShowDialog(); 52 | else 53 | MessageBoxes.NothingToExportInfo(this); 54 | } 55 | 56 | private void eksportujDialog_FileOk(object sender, CancelEventArgs e) 57 | { 58 | var str = new StringBuilder(); 59 | 60 | str.AppendFormat("Eksport {0} plików z archiwum \"{1}\". Data wykonania eksportu: {2}", 61 | fileListView.SelectedFiles.Count(), _tempSource.FullName, DateTime.Now); 62 | 63 | ExportSongsToString(fileListView.SelectedFiles, str); 64 | 65 | File.WriteAllText(eksportujDialog.FileName, str.ToString()); 66 | 67 | Close(); 68 | } 69 | 70 | public static void ExportSongsToString(IEnumerable items, StringBuilder target) 71 | { 72 | var i = 0; 73 | foreach (var file in items) 74 | { 75 | i++; 76 | target.Append(string.Format("{0}{0}{0}#{1} - ", i == 1 ? string.Empty : Environment.NewLine, i)); 77 | target.Append(file); 78 | } 79 | } 80 | 81 | private void Eksport_FormClosing(object sender, FormClosingEventArgs e) 82 | { 83 | _tempSource = null; 84 | fileListView.ClearAllItems(true); 85 | Owner = null; 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /MainApplication/Windows/LanguageChangeWindow.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Globalization; 8 | using System.Linq; 9 | using System.Windows.Forms; 10 | using Klocman.Extensions; 11 | using Klocman.Forms.Tools; 12 | using TextToScreen.Misc; 13 | using TextToScreen.Properties; 14 | 15 | namespace TextToScreen.Windows 16 | { 17 | public partial class LanguageChangeWindow : Form 18 | { 19 | private LanguageChangeWindow() 20 | { 21 | Opacity = 0; 22 | 23 | InitializeComponent(); 24 | 25 | comboBoxLanguage.Items.Add(Localisation.DefaultLanguage); 26 | foreach (var languageCode in CultureConfigurator.SupportedLanguages.OrderBy(x => x.DisplayName)) 27 | { 28 | comboBoxLanguage.Items.Add(new ComboBoxWrapper(languageCode, x => x.DisplayName)); 29 | } 30 | 31 | var selectedItem = comboBoxLanguage.Items.OfType>() 32 | .FirstOrDefault(x => x.WrappedObject.Name.Equals(Ustawienia.Default.LanguageOverride)); 33 | if (selectedItem != null) 34 | { 35 | comboBoxLanguage.SelectedItem = selectedItem; 36 | } 37 | else 38 | { 39 | comboBoxLanguage.SelectedIndex = 0; 40 | } 41 | } 42 | 43 | public static bool ShowLanguageChangeDialog(Form owner) 44 | { 45 | using (var window = new LanguageChangeWindow()) 46 | { 47 | window.StartPosition = FormStartPosition.CenterParent; 48 | return window.ShowDialog(owner) != DialogResult.Cancel; 49 | } 50 | } 51 | 52 | private void buttonAccept_Click(object sender, EventArgs e) 53 | { 54 | Ustawienia.Default.LanguageOverride = comboBoxLanguage.SelectedIndex == 0 55 | ? string.Empty 56 | : ((ComboBoxWrapper) comboBoxLanguage.SelectedItem).WrappedObject.Name; 57 | 58 | Ustawienia.Default.Save(); 59 | 60 | DialogResult = DialogResult.OK; 61 | } 62 | 63 | private void LanguageChangeWindow_Shown(object sender, EventArgs e) 64 | { 65 | // Autosize the form 66 | Height = this.GetBorderHeight() + panelButtons.Location.Y + panelButtons.Height + Padding.Bottom + 67 | this.GetBorderWidth(); 68 | Opacity = 1; 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /MainApplication/Windows/PropertiesWindow.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/) 3 | Apache License Version 2.0 4 | */ 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Windows.Forms; 10 | using TextToScreen.SongFile; 11 | 12 | namespace TextToScreen.Windows 13 | { 14 | public sealed partial class PropertiesWindow : Form 15 | { 16 | private readonly string _originalTitle; 17 | 18 | public PropertiesWindow() 19 | { 20 | InitializeComponent(); 21 | _originalTitle = Text; 22 | } 23 | 24 | public DialogResult ShowPropertiesDialog(IWin32Window owner, IEnumerable targets, 25 | bool allowEditing) 26 | { 27 | var songFileEntries = targets as IList ?? targets.ToList(); 28 | 29 | filePropertiesViewer1.Populate(songFileEntries, allowEditing); 30 | var count = songFileEntries.Count; 31 | 32 | Text = count > 4 33 | ? $"{_originalTitle} ({count} items)" 34 | : $"{_originalTitle} ({string.Join(", ", songFileEntries.Select(x => x.Name).ToArray())})"; 35 | 36 | return ShowDialog(owner); 37 | } 38 | 39 | private void buttonAccept_Click(object sender, EventArgs e) 40 | { 41 | AcceptChanges(); 42 | filePropertiesViewer1.Repopulate(); 43 | } 44 | 45 | private void AcceptChanges() 46 | { 47 | foreach (var change in filePropertiesViewer1.GetAllChanges()) 48 | { 49 | change.TargetSongFileEntry.Name = change.NewName; 50 | change.TargetSongFileEntry.Group = change.NewGroup; 51 | change.TargetSongFileEntry.Comment = change.NewComment; 52 | } 53 | } 54 | 55 | private void PropertiesWindow_FormClosing(object sender, FormClosingEventArgs e) 56 | { 57 | if (DialogResult != DialogResult.Cancel) 58 | AcceptChanges(); 59 | } 60 | 61 | private void buttonOk_Click(object sender, EventArgs e) 62 | { 63 | DialogResult = DialogResult.OK; 64 | Close(); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /MainApplication/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klocman/Text-To-Screen/83a7f0f10226c4079ed459e867bf03e0a73994f1/MainApplication/icon.ico -------------------------------------------------------------------------------- /MainApplication/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /PortableSettingsProvider/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.0 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /PortableSettingsProvider/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | Form1 5 | false 6 | 0 7 | true 8 | 0 9 | 0 10 | true 11 | 12 | -------------------------------------------------------------------------------- /PortableSettingsProvider/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Reflection 2 | Imports System.Runtime.InteropServices 3 | 4 | ' General Information about an assembly is controlled through the following 5 | ' set of attributes. Change these attribute values to modify the information 6 | ' associated with an assembly. 7 | 8 | ' Review the values of the assembly attributes 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 20 | 21 | 22 | ' Version information for an assembly consists of the following four values: 23 | ' 24 | ' Major Version 25 | ' Minor Version 26 | ' Build Number 27 | ' Revision 28 | ' 29 | ' You can specify all the values or you can default the Build and Revision Numbers 30 | ' by using the '*' as shown below: 31 | ' 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /PortableSettingsProvider/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.0 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | Imports System 15 | 16 | Namespace My.Resources 17 | 18 | 'This class was auto-generated by the StronglyTypedResourceBuilder 19 | 'class via a tool like ResGen or Visual Studio. 20 | 'To add or remove a member, edit your .ResX file then rerun ResGen 21 | 'with the /str option, or rebuild your VS project. 22 | ''' 23 | ''' A strongly-typed resource class, for looking up localized strings, etc. 24 | ''' 25 | _ 29 | Friend Module Resources 30 | 31 | Private resourceMan As Global.System.Resources.ResourceManager 32 | 33 | Private resourceCulture As Global.System.Globalization.CultureInfo 34 | 35 | ''' 36 | ''' Returns the cached ResourceManager instance used by this class. 37 | ''' 38 | _ 39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 40 | Get 41 | If Object.ReferenceEquals(resourceMan, Nothing) Then 42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("PortableSettingsProvider.Resources", GetType(Resources).Assembly) 43 | resourceMan = temp 44 | End If 45 | Return resourceMan 46 | End Get 47 | End Property 48 | 49 | ''' 50 | ''' Overrides the current thread's CurrentUICulture property for all 51 | ''' resource lookups using this strongly typed resource class. 52 | ''' 53 | _ 54 | Friend Property Culture() As Global.System.Globalization.CultureInfo 55 | Get 56 | Return resourceCulture 57 | End Get 58 | Set 59 | resourceCulture = value 60 | End Set 61 | End Property 62 | End Module 63 | End Namespace 64 | -------------------------------------------------------------------------------- /PortableSettingsProvider/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 5 | 6 | 7 | 8 | 100, 100 9 | 10 | 11 | 300, 100 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /PortableSettingsProvider/U3SettingsProvider.vb: -------------------------------------------------------------------------------- 1 | Public Class U3SettingsProvider 2 | Inherits PortableSettingsProvider 3 | 4 | Private Const U3APPDATAPATH As String = "U3_APP_DATA_PATH" 5 | 6 | Overrides Function GetAppSettingsPath() As String 7 | 'Get the environment variable set by the U3 application for a pointer to its data 8 | Try 9 | Return Environment.GetEnvironmentVariable(U3APPDATAPATH) 10 | Catch ex As Exception 11 | 'Not running in a U3 environment, just return the application path 12 | Return MyBase.GetAppSettingsPath 13 | End Try 14 | End Function 15 | End Class 16 | -------------------------------------------------------------------------------- /PortableSettingsProvider/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 7 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 100, 100 38 | 39 | 40 | 300, 100 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | TextToScreen is used to display song lyrics or recital scripts on an external monitor or projector. It has a built in text manager and editor, so it is fully contained. It was initially created for use by church choruses. 3 | 4 | One of the major features of this program is its WYSIWYG interface. You can see how the output will look like before sending it to the external display. 5 | 6 | You can import texts from external sources or write it inside of TTS. You can easily fix mistakes or add verses while displaying the text without any problems. All of the texts are stored as plain .txt files inside of a .zip archive, no proprietary formats! 7 | 8 | ## Examples 9 | ![Example](https://a.fsdn.com/con/app/proj/text-to-screen/screenshots/capture_006_27082015_165413.png) 10 | 11 | ![2-screen example](https://a.fsdn.com/con/app/proj/text-to-screen/screenshots/capture_007_27082015_165703.png) 12 | 13 | ## Download 14 | [SourceForge](https://sourceforge.net/projects/text-to-screen/) 15 | 16 | ## Compiling 17 | Source can be compiled in any modern version of Visual Studio. The KlocTools library is required, it can be downloaded [here](https://sourceforge.net/projects/kloctoolslibrary/). 18 | -------------------------------------------------------------------------------- /ScintillaNET/Annotation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Visibility and location of annotations in a control 10 | /// 11 | public enum Annotation 12 | { 13 | /// 14 | /// Annotations are not displayed. This is the default. 15 | /// 16 | Hidden = NativeMethods.ANNOTATION_HIDDEN, 17 | 18 | /// 19 | /// Annotations are drawn left justified with no adornment. 20 | /// 21 | Standard = NativeMethods.ANNOTATION_STANDARD, 22 | 23 | /// 24 | /// Annotations are indented to match the text and are surrounded by a box. 25 | /// 26 | Boxed = NativeMethods.ANNOTATION_BOXED, 27 | 28 | /// 29 | /// Annotations are indented to match the text. 30 | /// 31 | Indented = NativeMethods.ANNOTATION_INDENTED 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ScintillaNET/AutomaticFold.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Configuration options for automatic code folding. 10 | /// 11 | /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. 12 | [Flags] 13 | public enum AutomaticFold 14 | { 15 | /// 16 | /// Automatic folding is disabled. This is the default. 17 | /// 18 | None = 0, 19 | 20 | /// 21 | /// Automatically show lines as needed. The event is not raised when this value is used. 22 | /// 23 | Show = NativeMethods.SC_AUTOMATICFOLD_SHOW, 24 | 25 | /// 26 | /// Handle clicks in fold margin automatically. The event is not raised for folding margins when this value is used. 27 | /// 28 | Click = NativeMethods.SC_AUTOMATICFOLD_CLICK, 29 | 30 | /// 31 | /// Show lines as needed when the fold structure is changed. 32 | /// 33 | Change = NativeMethods.SC_AUTOMATICFOLD_CHANGE 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ScintillaNET/CaretStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The caret visual style. 10 | /// 11 | public enum CaretStyle 12 | { 13 | /// 14 | /// The caret is not displayed. 15 | /// 16 | Invisible = NativeMethods.CARETSTYLE_INVISIBLE, 17 | 18 | /// 19 | /// The caret is drawn as a vertical line. 20 | /// 21 | Line = NativeMethods.CARETSTYLE_LINE, 22 | 23 | /// 24 | /// The caret is drawn as a block. 25 | /// 26 | Block = NativeMethods.CARETSTYLE_BLOCK 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/ChangeAnnotationEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Provides data for the event. 10 | /// 11 | public class ChangeAnnotationEventArgs : EventArgs 12 | { 13 | /// 14 | /// Gets the line index where the annotation changed. 15 | /// 16 | /// The zero-based line index where the annotation change occurred. 17 | public int Line { get; private set; } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// The zero-based line index of the annotation that changed. 23 | public ChangeAnnotationEventArgs(int line) 24 | { 25 | Line = line; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/CharAddedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Provides data for the event. 10 | /// 11 | public class CharAddedEventArgs : EventArgs 12 | { 13 | /// 14 | /// Gets the text character added to a control. 15 | /// 16 | /// The character added. 17 | public int Char { get; private set; } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// The character added. 23 | public CharAddedEventArgs(int ch) 24 | { 25 | Char = ch; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/CopyFormat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Specifies the clipboard formats to copy. 10 | /// 11 | [Flags] 12 | public enum CopyFormat 13 | { 14 | /// 15 | /// Copies text to the clipboard in Unicode format. 16 | /// 17 | Text = 1 << 0, 18 | 19 | /// 20 | /// Copies text to the clipboard in Rich Text Format (RTF). 21 | /// 22 | Rtf = 1 << 1, 23 | 24 | /// 25 | /// Copies text to the clipboard in HyperText Markup Language (HTML) format. 26 | /// 27 | Html = 1 << 2 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ScintillaNET/Document.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// A document. 10 | /// 11 | /// 12 | /// This is an opaque type, meaning it can be used by a control but 13 | /// otherwise has no public members of its own. 14 | /// 15 | public struct Document 16 | { 17 | internal IntPtr Value; 18 | 19 | /// 20 | /// A read-only field that represents an uninitialized document. 21 | /// 22 | public static readonly Document Empty; 23 | 24 | /// 25 | /// Returns a value indicating whether this instance is equal to a specified object. 26 | /// 27 | /// An object to compare with this instance or null. 28 | /// true if is an instance of and equals the value of this instance; otherwise, false. 29 | public override bool Equals(object obj) 30 | { 31 | return (obj is IntPtr) && Value == ((Document)obj).Value; 32 | } 33 | 34 | /// 35 | /// Returns the hash code for this instance. 36 | /// 37 | /// A 32-bit signed integer hash code. 38 | public override int GetHashCode() 39 | { 40 | return Value.GetHashCode(); 41 | } 42 | 43 | /// 44 | /// Determines whether two specified instances of are equal. 45 | /// 46 | /// The first document to compare. 47 | /// The second document to compare. 48 | /// true if equals ; otherwise, false. 49 | public static bool operator ==(Document a, Document b) 50 | { 51 | return a.Value == b.Value; 52 | } 53 | 54 | /// 55 | /// Determines whether two specified instances of are not equal. 56 | /// 57 | /// The first document to compare. 58 | /// The second document to compare. 59 | /// true if does not equal ; otherwise, false. 60 | public static bool operator !=(Document a, Document b) 61 | { 62 | return a.Value != b.Value; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ScintillaNET/DoubleClickEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// Provides data for the event. 11 | /// 12 | public class DoubleClickEventArgs : EventArgs 13 | { 14 | private readonly Scintilla scintilla; 15 | private readonly int bytePosition; 16 | private int? position; 17 | 18 | /// 19 | /// Gets the line double clicked. 20 | /// 21 | /// The zero-based index of the double clicked line. 22 | public int Line { get; private set; } 23 | 24 | /// 25 | /// Gets the modifier keys (SHIFT, CTRL, ALT) held down when double clicked. 26 | /// 27 | /// A bitwise combination of the Keys enumeration indicating the modifier keys. 28 | public Keys Modifiers { get; private set; } 29 | 30 | /// 31 | /// Gets the zero-based document position of the text double clicked. 32 | /// 33 | /// 34 | /// The zero-based character position within the document of the double clicked text; 35 | /// otherwise, -1 if not a document position. 36 | /// 37 | public int Position 38 | { 39 | get 40 | { 41 | if (position == null) 42 | position = scintilla.Lines.ByteToCharPosition(bytePosition); 43 | 44 | return (int)position; 45 | } 46 | } 47 | 48 | /// 49 | /// Initializes a new instance of the class. 50 | /// 51 | /// The control that generated this event. 52 | /// The modifier keys that where held down at the time of the double click. 53 | /// The zero-based byte position of the double clicked text. 54 | /// The zero-based line index of the double clicked text. 55 | public DoubleClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition, int line) 56 | { 57 | this.scintilla = scintilla; 58 | this.bytePosition = bytePosition; 59 | Modifiers = modifiers; 60 | Line = line; 61 | 62 | if (bytePosition == -1) 63 | position = -1; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /ScintillaNET/DwellEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Provides data for the and events. 10 | /// 11 | public class DwellEventArgs : EventArgs 12 | { 13 | private readonly Scintilla scintilla; 14 | private readonly int bytePosition; 15 | private int? position; 16 | 17 | /// 18 | /// Gets the zero-based document position where the mouse pointer was lingering. 19 | /// 20 | /// The nearest zero-based document position to where the mouse pointer was lingering. 21 | public int Position 22 | { 23 | get 24 | { 25 | if (position == null) 26 | position = scintilla.Lines.ByteToCharPosition(bytePosition); 27 | 28 | return (int)position; 29 | } 30 | } 31 | 32 | /// 33 | /// Gets the x-coordinate of the mouse pointer. 34 | /// 35 | /// The x-coordinate of the mouse pointer relative to the control. 36 | public int X { get; private set; } 37 | 38 | /// 39 | /// Gets the y-coordinate of the mouse pointer. 40 | /// 41 | /// The y-coordinate of the mouse pointer relative to the control. 42 | public int Y { get; private set; } 43 | 44 | /// 45 | /// Initializes a new instance of the class. 46 | /// 47 | /// The control that generated this event. 48 | /// The zero-based byte position within the document where the mouse pointer was lingering. 49 | /// The x-coordinate of the mouse pointer relative to the control. 50 | /// The y-coordinate of the mouse pointer relative to the control. 51 | public DwellEventArgs(Scintilla scintilla, int bytePosition, int x, int y) 52 | { 53 | this.scintilla = scintilla; 54 | this.bytePosition = bytePosition; 55 | X = x; 56 | Y = y; 57 | 58 | // The position is not over text 59 | if (bytePosition < 0) 60 | position = bytePosition; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ScintillaNET/EdgeMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The long line edge display mode. 10 | /// 11 | public enum EdgeMode 12 | { 13 | /// 14 | /// Long lines are not indicated. This is the default. 15 | /// 16 | None = NativeMethods.EDGE_NONE, 17 | 18 | /// 19 | /// Long lines are indicated with a vertical line. 20 | /// 21 | Line = NativeMethods.EDGE_LINE, 22 | 23 | /// 24 | /// Long lines are indicated with a background color. 25 | /// 26 | Background = NativeMethods.EDGE_BACKGROUND 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/Eol.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// End-of-line format. 10 | /// 11 | public enum Eol 12 | { 13 | /// 14 | /// Carriage Return, Line Feed pair "\r\n" (0x0D0A). 15 | /// 16 | CrLf = NativeMethods.SC_EOL_CRLF, 17 | 18 | /// 19 | /// Carriage Return '\r' (0x0D). 20 | /// 21 | Cr = NativeMethods.SC_EOL_CR, 22 | 23 | /// 24 | /// Line Feed '\n' (0x0A). 25 | /// 26 | Lf = NativeMethods.SC_EOL_LF 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/FoldAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Fold actions. 10 | /// 11 | public enum FoldAction 12 | { 13 | /// 14 | /// Contract the fold. 15 | /// 16 | Contract = NativeMethods.SC_FOLDACTION_CONTRACT, 17 | 18 | /// 19 | /// Expand the fold. 20 | /// 21 | Expand = NativeMethods.SC_FOLDACTION_EXPAND, 22 | 23 | /// 24 | /// Toggle between contracted and expanded. 25 | /// 26 | Toggle = NativeMethods.SC_FOLDACTION_TOGGLE 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/FoldFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Additional display options for folds. 10 | /// 11 | [Flags] 12 | public enum FoldFlags 13 | { 14 | /// 15 | /// A line is drawn above if expanded. 16 | /// 17 | LineBeforeExpanded = NativeMethods.SC_FOLDFLAG_LINEBEFORE_EXPANDED, 18 | 19 | /// 20 | /// A line is drawn above if not expanded. 21 | /// 22 | LineBeforeContracted = NativeMethods.SC_FOLDFLAG_LINEBEFORE_CONTRACTED, 23 | 24 | /// 25 | /// A line is drawn below if expanded. 26 | /// 27 | LineAfterExpanded = NativeMethods.SC_FOLDFLAG_LINEAFTER_EXPANDED, 28 | 29 | /// 30 | /// A line is drawn below if not expanded. 31 | /// 32 | LineAfterContracted = NativeMethods.SC_FOLDFLAG_LINEAFTER_CONTRACTED, 33 | 34 | /// 35 | /// Displays the hexadecimal fold levels in the margin to aid with debugging. 36 | /// This feature may change in the future. 37 | /// 38 | LevelNumbers = NativeMethods.SC_FOLDFLAG_LEVELNUMBERS, 39 | 40 | /// 41 | /// Displays the hexadecimal line state in the margin to aid with debugging. This flag 42 | /// cannot be used at the same time as the flag. 43 | /// 44 | LineState = NativeMethods.SC_FOLDFLAG_LINESTATE 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ScintillaNET/FoldLevelFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Flags for additional line fold level behavior. 10 | /// 11 | [Flags] 12 | public enum FoldLevelFlags 13 | { 14 | /// 15 | /// Indicates that the line is blank and should be treated slightly different than its level may indicate; 16 | /// otherwise, blank lines should generally not be fold points. 17 | /// 18 | White = NativeMethods.SC_FOLDLEVELWHITEFLAG, 19 | 20 | /// 21 | /// Indicates that the line is a header (fold point). 22 | /// 23 | Header = NativeMethods.SC_FOLDLEVELHEADERFLAG 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ScintillaNET/FontQuality.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The font quality (antialiasing method) used to render text. 10 | /// 11 | public enum FontQuality 12 | { 13 | /// 14 | /// Specifies that the character quality of the font does not matter; so the lowest quality can be used. 15 | /// This is the default. 16 | /// 17 | Default = NativeMethods.SC_EFF_QUALITY_DEFAULT, 18 | 19 | /// 20 | /// Specifies that anti-aliasing should not be used when rendering text. 21 | /// 22 | NonAntiAliased = NativeMethods.SC_EFF_QUALITY_NON_ANTIALIASED, 23 | 24 | /// 25 | /// Specifies that anti-aliasing should be used when rendering text, if the font supports it. 26 | /// 27 | AntiAliased = NativeMethods.SC_EFF_QUALITY_ANTIALIASED, 28 | 29 | /// 30 | /// Specifies that ClearType anti-aliasing should be used when rendering text, if the font supports it. 31 | /// 32 | LcdOptimized = NativeMethods.SC_EFF_QUALITY_LCD_OPTIMIZED 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ScintillaNET/HotspotClickEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// Provides data for the , , 11 | /// and events. 12 | /// 13 | public class HotspotClickEventArgs : EventArgs 14 | { 15 | private readonly Scintilla scintilla; 16 | private readonly int bytePosition; 17 | private int? position; 18 | 19 | /// 20 | /// Gets the modifier keys (SHIFT, CTRL, ALT) held down when clicked. 21 | /// 22 | /// A bitwise combination of the Keys enumeration indicating the modifier keys. 23 | /// Only the state of the CTRL key is reported in the event. 24 | public Keys Modifiers { get; private set; } 25 | 26 | /// 27 | /// Gets the zero-based document position of the text clicked. 28 | /// 29 | /// The zero-based character position within the document of the clicked text. 30 | public int Position 31 | { 32 | get 33 | { 34 | if (position == null) 35 | position = scintilla.Lines.ByteToCharPosition(bytePosition); 36 | 37 | return (int)position; 38 | } 39 | } 40 | 41 | /// 42 | /// Initializes a new instance of the class. 43 | /// 44 | /// The control that generated this event. 45 | /// The modifier keys that where held down at the time of the click. 46 | /// The zero-based byte position of the clicked text. 47 | public HotspotClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition) 48 | { 49 | this.scintilla = scintilla; 50 | this.bytePosition = bytePosition; 51 | Modifiers = modifiers; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ScintillaNET/ILoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Provides methods for loading and creating a on a background (non-UI) thread. 10 | /// 11 | /// 12 | /// Internally an maintains a instance with a reference count of 1. 13 | /// You are responsible for ensuring the reference count eventually reaches 0 or memory leaks will occur. 14 | /// 15 | public interface ILoader 16 | { 17 | /// 18 | /// Adds the data specified to the internal document. 19 | /// 20 | /// The character buffer to copy to the new document. 21 | /// The number of characters in to copy. 22 | /// 23 | /// true if the data was added successfully; otherwise, false. 24 | /// A return value of false should be followed by a call to . 25 | /// 26 | bool AddData(char[] data, int length); 27 | 28 | /// 29 | /// Returns the internal document. 30 | /// 31 | /// A containing the added text. The document has a reference count of 1. 32 | Document ConvertToDocument(); 33 | 34 | /// 35 | /// Called to release the internal document when an error occurs using or to abandon loading. 36 | /// 37 | /// 38 | /// The internal document reference count. 39 | /// A return value of 0 indicates that the document has been destroyed and all associated memory released. 40 | /// 41 | int Release(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ScintillaNET/IdleStyling.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Possible strategies for styling text using application idle time. 10 | /// 11 | /// 12 | public enum IdleStyling 13 | { 14 | /// 15 | /// Syntax styling is performed for all the currently visible text before displaying it. 16 | /// This is the default. 17 | /// 18 | None = NativeMethods.SC_IDLESTYLING_NONE, 19 | 20 | /// 21 | /// A small amount of styling is performed before display and then further styling is performed incrementally in the background as an idle-time task. 22 | /// This can improve initial display/scroll performance, but may result in the text initially appearing uncolored and then, some time later, it is colored. 23 | /// 24 | ToVisible = NativeMethods.SC_IDLESTYLING_TOVISIBLE, 25 | 26 | /// 27 | /// Text after the currently visible portion may be styled as an idle-time task. 28 | /// This will not improve initial display/scroll performance, but may improve subsequent display/scroll performance. 29 | /// 30 | AfterVisible = NativeMethods.SC_IDLESTYLING_AFTERVISIBLE, 31 | 32 | /// 33 | /// Text before and after the current visible text. 34 | /// This is a combination of and . 35 | /// 36 | All = NativeMethods.SC_IDLESTYLING_ALL 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ScintillaNET/IndentView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Options for displaying indentation guides in a control. 10 | /// 11 | /// Indentation guides can be styled using the style. 12 | public enum IndentView 13 | { 14 | /// 15 | /// No indentation guides are shown. This is the default. 16 | /// 17 | None = NativeMethods.SC_IV_NONE, 18 | 19 | /// 20 | /// Indentation guides are shown inside real indentation whitespace. 21 | /// 22 | Real = NativeMethods.SC_IV_REAL, 23 | 24 | /// 25 | /// Indentation guides are shown beyond the actual indentation up to the level of the next non-empty line. 26 | /// If the previous non-empty line was a fold header then indentation guides are shown for one more level of indent than that line. 27 | /// This setting is good for Python. 28 | /// 29 | LookForward = NativeMethods.SC_IV_LOOKFORWARD, 30 | 31 | /// 32 | /// Indentation guides are shown beyond the actual indentation up to the level of the next non-empty line or previous non-empty line whichever is the greater. 33 | /// This setting is good for most languages. 34 | /// 35 | LookBoth = NativeMethods.SC_IV_LOOKBOTH 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ScintillaNET/IndicatorClickEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// Provides data for the event. 11 | /// 12 | public class IndicatorClickEventArgs : IndicatorReleaseEventArgs 13 | { 14 | /// 15 | /// Gets the modifier keys (SHIFT, CTRL, ALT) held down when clicked. 16 | /// 17 | /// A bitwise combination of the Keys enumeration indicating the modifier keys. 18 | public Keys Modifiers { get; private set; } 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// The control that generated this event. 24 | /// The modifier keys that where held down at the time of the click. 25 | /// The zero-based byte position of the clicked text. 26 | public IndicatorClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition) : base(scintilla, bytePosition) 27 | { 28 | Modifiers = modifiers; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ScintillaNET/IndicatorCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace ScintillaNET 9 | { 10 | /// 11 | /// An immutable collection of indicators in a control. 12 | /// 13 | public class IndicatorCollection : IEnumerable 14 | { 15 | private readonly Scintilla scintilla; 16 | 17 | /// 18 | /// Provides an enumerator that iterates through the collection. 19 | /// 20 | /// An object that contains all objects within the . 21 | public IEnumerator GetEnumerator() 22 | { 23 | int count = Count; 24 | for (int i = 0; i < count; i++) 25 | yield return this[i]; 26 | 27 | yield break; 28 | } 29 | 30 | IEnumerator IEnumerable.GetEnumerator() 31 | { 32 | return this.GetEnumerator(); 33 | } 34 | 35 | /// 36 | /// Gets the number of indicators. 37 | /// 38 | /// The number of indicators in the . 39 | [Browsable(false)] 40 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 41 | public int Count 42 | { 43 | get 44 | { 45 | return (NativeMethods.INDIC_MAX + 1); 46 | } 47 | } 48 | 49 | /// 50 | /// Gets an object at the specified index. 51 | /// 52 | /// The indicator index. 53 | /// An object representing the indicator at the specified . 54 | /// 55 | /// Indicators 0 through 7 are used by lexers. 56 | /// Indicators 32 through 35 are used for IME. 57 | /// 58 | [Browsable(false)] 59 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 60 | public Indicator this[int index] 61 | { 62 | get 63 | { 64 | index = Helpers.Clamp(index, 0, Count - 1); 65 | return new Indicator(scintilla, index); 66 | } 67 | } 68 | 69 | /// 70 | /// Initializes a new instance of the class. 71 | /// 72 | /// The control that created this collection. 73 | public IndicatorCollection(Scintilla scintilla) 74 | { 75 | this.scintilla = scintilla; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ScintillaNET/IndicatorFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Flags associated with a . 10 | /// 11 | /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. 12 | [Flags] 13 | public enum IndicatorFlags 14 | { 15 | /// 16 | /// No flags. This is the default. 17 | /// 18 | None = 0, 19 | 20 | /// 21 | /// When set, will treat an indicator value as a RGB color that has been OR'd with 22 | /// and will use that instead of the value specified in the property. This allows 23 | /// an indicator to display more than one color. 24 | /// 25 | ValueFore = NativeMethods.SC_INDICFLAG_VALUEFORE 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ScintillaNET/IndicatorReleaseEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// Provides data for the event. 11 | /// 12 | public class IndicatorReleaseEventArgs : EventArgs 13 | { 14 | private readonly Scintilla scintilla; 15 | private readonly int bytePosition; 16 | private int? position; 17 | 18 | /// 19 | /// Gets the zero-based document position of the text clicked. 20 | /// 21 | /// The zero-based character position within the document of the clicked text. 22 | public int Position 23 | { 24 | get 25 | { 26 | if (position == null) 27 | position = scintilla.Lines.ByteToCharPosition(bytePosition); 28 | 29 | return (int)position; 30 | } 31 | } 32 | 33 | /// 34 | /// Initializes a new instance of the class. 35 | /// 36 | /// The control that generated this event. 37 | /// The zero-based byte position of the clicked text. 38 | public IndicatorReleaseEventArgs(Scintilla scintilla, int bytePosition) 39 | { 40 | this.scintilla = scintilla; 41 | this.bytePosition = bytePosition; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ScintillaNET/InsertCheckEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Provides data for the event. 10 | /// 11 | public class InsertCheckEventArgs : EventArgs 12 | { 13 | private readonly Scintilla scintilla; 14 | private readonly int bytePosition; 15 | private readonly int byteLength; 16 | private readonly IntPtr textPtr; 17 | 18 | internal int? CachedPosition { get; set; } 19 | internal string CachedText { get; set; } 20 | 21 | /// 22 | /// Gets the zero-based document position where text will be inserted. 23 | /// 24 | /// The zero-based character position within the document where text will be inserted. 25 | public int Position 26 | { 27 | get 28 | { 29 | if (CachedPosition == null) 30 | CachedPosition = scintilla.Lines.ByteToCharPosition(bytePosition); 31 | 32 | return (int)CachedPosition; 33 | } 34 | } 35 | 36 | /// 37 | /// Gets or sets the text being inserted. 38 | /// 39 | /// The text being inserted into the document. 40 | public unsafe string Text 41 | { 42 | get 43 | { 44 | if (CachedText == null) 45 | CachedText = Helpers.GetString(textPtr, byteLength, scintilla.Encoding); 46 | 47 | return CachedText; 48 | } 49 | set 50 | { 51 | CachedText = value ?? string.Empty; 52 | 53 | var bytes = Helpers.GetBytes(CachedText, scintilla.Encoding, zeroTerminated: false); 54 | fixed (byte* bp = bytes) 55 | scintilla.DirectMessage(NativeMethods.SCI_CHANGEINSERTION, new IntPtr(bytes.Length), new IntPtr(bp)); 56 | } 57 | } 58 | 59 | /// 60 | /// Initializes a new instance of the class. 61 | /// 62 | /// The control that generated this event. 63 | /// The zero-based byte position within the document where text is being inserted. 64 | /// The length in bytes of the inserted text. 65 | /// A pointer to the text being inserted. 66 | public InsertCheckEventArgs(Scintilla scintilla, int bytePosition, int byteLength, IntPtr text) 67 | { 68 | this.scintilla = scintilla; 69 | this.bytePosition = bytePosition; 70 | this.byteLength = byteLength; 71 | this.textPtr = text; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /ScintillaNET/LineEndType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Line endings types supported by lexers and allowed by a control. 10 | /// 11 | /// 12 | /// 13 | /// 14 | [Flags] 15 | public enum LineEndType 16 | { 17 | /// 18 | /// ASCII line endings. Carriage Return, Line Feed pair "\r\n" (0x0D0A); Carriage Return '\r' (0x0D); Line Feed '\n' (0x0A). 19 | /// 20 | Default = NativeMethods.SC_LINE_END_TYPE_DEFAULT, 21 | 22 | /// 23 | /// Unicode line endings. Next Line (0x0085); Line Separator (0x2028); Paragraph Separator (0x2029). 24 | /// 25 | Unicode = NativeMethods.SC_LINE_END_TYPE_UNICODE 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ScintillaNET/ListCompletionMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Indicates how an autocompletion occurred. 10 | /// 11 | public enum ListCompletionMethod 12 | { 13 | /// 14 | /// A fillup character (see ) triggered the completion. 15 | /// The character used is indicated by the property. 16 | /// 17 | FillUp = NativeMethods.SC_AC_FILLUP, 18 | 19 | /// 20 | /// A double-click triggered the completion. 21 | /// 22 | DoubleClick = NativeMethods.SC_AC_DOUBLECLICK, 23 | 24 | /// 25 | /// A tab key or the command triggered the completion. 26 | /// 27 | Tab = NativeMethods.SC_AC_TAB, 28 | 29 | /// 30 | /// A new line or command triggered the completion. 31 | /// 32 | NewLine = NativeMethods.SC_AC_NEWLINE, 33 | 34 | /// 35 | /// The method triggered the completion. 36 | /// 37 | Command = NativeMethods.SC_AC_COMMAND 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ScintillaNET/Loader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace ScintillaNET 8 | { 9 | internal sealed class Loader : ILoader 10 | { 11 | private readonly IntPtr self; 12 | private readonly NativeMethods.ILoaderVTable32 loader32; 13 | private readonly NativeMethods.ILoaderVTable64 loader64; 14 | private readonly Encoding encoding; 15 | 16 | public unsafe bool AddData(char[] data, int length) 17 | { 18 | if (data != null) 19 | { 20 | length = Helpers.Clamp(length, 0, data.Length); 21 | var bytes = Helpers.GetBytes(data, length, encoding, zeroTerminated: false); 22 | fixed (byte* bp = bytes) 23 | { 24 | var status = (IntPtr.Size == 4 ? loader32.AddData(self, bp, bytes.Length) : loader64.AddData(self, bp, bytes.Length)); 25 | if (status != NativeMethods.SC_STATUS_OK) 26 | return false; 27 | } 28 | } 29 | 30 | return true; 31 | } 32 | 33 | public Document ConvertToDocument() 34 | { 35 | var ptr = (IntPtr.Size == 4 ? loader32.ConvertToDocument(self) : loader64.ConvertToDocument(self)); 36 | var document = new Document { Value = ptr }; 37 | return document; 38 | } 39 | 40 | public int Release() 41 | { 42 | var count = (IntPtr.Size == 4 ? loader32.Release(self) : loader64.Release(self)); 43 | return count; 44 | } 45 | 46 | public unsafe Loader(IntPtr ptr, Encoding encoding) 47 | { 48 | this.self = ptr; 49 | this.encoding = encoding; 50 | 51 | // http://stackoverflow.com/a/985820/2073621 52 | // http://stackoverflow.com/a/2094715/2073621 53 | // http://en.wikipedia.org/wiki/Virtual_method_table 54 | // http://www.openrce.org/articles/full_view/23 55 | // Because I know that I'm not going to remember all this... In C++, the first 56 | // variable of an object is a pointer (v[f]ptr) to the virtual table (v[f]table) 57 | // containing the addresses of each function. The first call below gets the vtable 58 | // address by following the object ptr to the vptr to the vtable. The second call 59 | // casts the vtable to a structure with the same memory layout so we can easily 60 | // invoke each function without having to do any pointer arithmetic. Depending on the 61 | // architecture, the function calling conventions can be different. 62 | 63 | IntPtr vfptr = *(IntPtr*)ptr; 64 | if(IntPtr.Size == 4) 65 | loader32 = (NativeMethods.ILoaderVTable32)Marshal.PtrToStructure(vfptr, typeof(NativeMethods.ILoaderVTable32)); 66 | else 67 | loader64 = (NativeMethods.ILoaderVTable64)Marshal.PtrToStructure(vfptr, typeof(NativeMethods.ILoaderVTable64)); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ScintillaNET/MarginClickEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// Provides data for the event. 11 | /// 12 | public class MarginClickEventArgs : EventArgs 13 | { 14 | private readonly Scintilla scintilla; 15 | private readonly int bytePosition; 16 | private int? position; 17 | 18 | /// 19 | /// Gets the margin clicked. 20 | /// 21 | /// The zero-based index of the clicked margin. 22 | public int Margin { get; private set; } 23 | 24 | /// 25 | /// Gets the modifier keys (SHIFT, CTRL, ALT) held down when the margin was clicked. 26 | /// 27 | /// A bitwise combination of the Keys enumeration indicating the modifier keys. 28 | public Keys Modifiers { get; private set; } 29 | 30 | /// 31 | /// Gets the zero-based document position where the line ajacent to the clicked margin starts. 32 | /// 33 | /// The zero-based character position within the document of the start of the line adjacent to the margin clicked. 34 | public int Position 35 | { 36 | get 37 | { 38 | if (position == null) 39 | position = scintilla.Lines.ByteToCharPosition(bytePosition); 40 | 41 | return (int)position; 42 | } 43 | } 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// The control that generated this event. 49 | /// The modifier keys that where held down at the time of the margin click. 50 | /// The zero-based byte position within the document where the line adjacent to the clicked margin starts. 51 | /// The zero-based index of the clicked margin. 52 | public MarginClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition, int margin) 53 | { 54 | this.scintilla = scintilla; 55 | this.bytePosition = bytePosition; 56 | Modifiers = modifiers; 57 | Margin = margin; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ScintillaNET/MarginCursor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The display of a cursor when over a margin. 10 | /// 11 | public enum MarginCursor 12 | { 13 | /// 14 | /// A normal arrow. 15 | /// 16 | Arrow = NativeMethods.SC_CURSORARROW, 17 | 18 | /// 19 | /// A reversed arrow. 20 | /// 21 | ReverseArrow = NativeMethods.SC_CURSORREVERSEARROW 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ScintillaNET/MarginOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Flags used to define margin options. 10 | /// 11 | /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. 12 | [Flags] 13 | public enum MarginOptions 14 | { 15 | /// 16 | /// No options. This is the default. 17 | /// 18 | None = NativeMethods.SC_MARGINOPTION_NONE, 19 | 20 | /// 21 | /// Lines selected by clicking on the margin will select only the subline of wrapped text. 22 | /// 23 | SublineSelect = NativeMethods.SC_MARGINOPTION_SUBLINESELECT 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ScintillaNET/MarginType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The behavior and appearance of a margin. 10 | /// 11 | public enum MarginType 12 | { 13 | /// 14 | /// Margin can display symbols. 15 | /// 16 | Symbol = NativeMethods.SC_MARGIN_SYMBOL, 17 | 18 | /// 19 | /// Margin displays line numbers. 20 | /// 21 | Number = NativeMethods.SC_MARGIN_NUMBER, 22 | 23 | /// 24 | /// Margin can display symbols and has a background color equivalent to the default style background color. 25 | /// 26 | BackColor = NativeMethods.SC_MARGIN_BACK, 27 | 28 | /// 29 | /// Margin can display symbols and has a background color equivalent to the default style foreground color. 30 | /// 31 | ForeColor = NativeMethods.SC_MARGIN_FORE, 32 | 33 | /// 34 | /// Margin can display application defined text. 35 | /// 36 | Text = NativeMethods.SC_MARGIN_TEXT, 37 | 38 | /// 39 | /// Margin can display application defined text right-justified. 40 | /// 41 | RightText = NativeMethods.SC_MARGIN_RTEXT 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ScintillaNET/MarkerCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// An immutable collection of markers in a control. 11 | /// 12 | public class MarkerCollection : IEnumerable 13 | { 14 | private readonly Scintilla scintilla; 15 | 16 | /// 17 | /// Provides an enumerator that iterates through the collection. 18 | /// 19 | /// An object for enumerating all objects within the . 20 | public IEnumerator GetEnumerator() 21 | { 22 | int count = Count; 23 | for (int i = 0; i < count; i++) 24 | yield return this[i]; 25 | 26 | yield break; 27 | } 28 | 29 | IEnumerator IEnumerable.GetEnumerator() 30 | { 31 | return this.GetEnumerator(); 32 | } 33 | 34 | /// 35 | /// Gets the number of markers in the . 36 | /// 37 | /// This property always returns 32. 38 | public int Count 39 | { 40 | get 41 | { 42 | return (NativeMethods.MARKER_MAX + 1); 43 | } 44 | } 45 | 46 | /// 47 | /// Gets a object at the specified index. 48 | /// 49 | /// The marker index. 50 | /// An object representing the marker at the specified . 51 | /// Markers 25 through 31 are used by Scintilla for folding. 52 | public Marker this[int index] 53 | { 54 | get 55 | { 56 | index = Helpers.Clamp(index, 0, Count - 1); 57 | return new Marker(scintilla, index); 58 | } 59 | } 60 | 61 | /// 62 | /// Initializes a new instance of the class. 63 | /// 64 | /// The control that created this collection. 65 | public MarkerCollection(Scintilla scintilla) 66 | { 67 | this.scintilla = scintilla; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ScintillaNET/MarkerHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// A handle. 10 | /// 11 | /// 12 | /// This is an opaque type, meaning it can be used by a control but 13 | /// otherwise has no public members of its own. 14 | /// 15 | public struct MarkerHandle 16 | { 17 | internal IntPtr Value; 18 | 19 | /// 20 | /// A read-only field that represents an uninitialized handle. 21 | /// 22 | public static readonly MarkerHandle Zero; 23 | 24 | /// 25 | /// Returns a value indicating whether this instance is equal to a specified object. 26 | /// 27 | /// An object to compare with this instance or null. 28 | /// true if is an instance of and equals the value of this instance; otherwise, false. 29 | public override bool Equals(object obj) 30 | { 31 | return (obj is IntPtr) && Value == ((MarkerHandle)obj).Value; 32 | } 33 | 34 | /// 35 | /// Returns the hash code for this instance. 36 | /// 37 | /// A 32-bit signed integer hash code. 38 | public override int GetHashCode() 39 | { 40 | return Value.GetHashCode(); 41 | } 42 | 43 | /// 44 | /// Determines whether two specified instances of are equal. 45 | /// 46 | /// The first handle to compare. 47 | /// The second handle to compare. 48 | /// true if equals ; otherwise, false. 49 | public static bool operator ==(MarkerHandle a, MarkerHandle b) 50 | { 51 | return a.Value == b.Value; 52 | } 53 | 54 | /// 55 | /// Determines whether two specified instances of are not equal. 56 | /// 57 | /// The first handle to compare. 58 | /// The second handle to compare. 59 | /// true if does not equal ; otherwise, false. 60 | public static bool operator !=(MarkerHandle a, MarkerHandle b) 61 | { 62 | return a.Value != b.Value; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ScintillaNET/ModificationEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Provides data for the and events. 10 | /// 11 | public class ModificationEventArgs : BeforeModificationEventArgs 12 | { 13 | private readonly Scintilla scintilla; 14 | private readonly int bytePosition; 15 | private readonly int byteLength; 16 | private readonly IntPtr textPtr; 17 | 18 | /// 19 | /// Gets the number of lines added or removed. 20 | /// 21 | /// The number of lines added to the document when text is inserted, or the number of lines removed from the document when text is deleted. 22 | /// When lines are deleted the return value will be negative. 23 | public int LinesAdded { get; private set; } 24 | 25 | /// 26 | /// Gets the text that was inserted or deleted. 27 | /// 28 | /// The text inserted or deleted from the document. 29 | public override unsafe string Text 30 | { 31 | get 32 | { 33 | if (CachedText == null) 34 | CachedText = Helpers.GetString(textPtr, byteLength, scintilla.Encoding); 35 | 36 | return CachedText; 37 | } 38 | } 39 | 40 | /// 41 | /// Initializes a new instance of the class. 42 | /// 43 | /// The control that generated this event. 44 | /// The source of the modification. 45 | /// The zero-based byte position within the document where text was modified. 46 | /// The length in bytes of the inserted or deleted text. 47 | /// >A pointer to the text inserted or deleted. 48 | /// The number of lines added or removed (delta). 49 | public ModificationEventArgs(Scintilla scintilla, ModificationSource source, int bytePosition, int byteLength, IntPtr text, int linesAdded) : base(scintilla, source, bytePosition, byteLength, text) 50 | { 51 | this.scintilla = scintilla; 52 | this.bytePosition = bytePosition; 53 | this.byteLength = byteLength; 54 | this.textPtr = text; 55 | 56 | LinesAdded = linesAdded; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ScintillaNET/ModificationSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The source of a modification 10 | /// 11 | public enum ModificationSource 12 | { 13 | /// 14 | /// Modification is the result of a user operation. 15 | /// 16 | User = NativeMethods.SC_PERFORMED_USER, 17 | 18 | /// 19 | /// Modification is the result of an undo operation. 20 | /// 21 | Undo = NativeMethods.SC_PERFORMED_UNDO, 22 | 23 | /// 24 | /// Modification is the result of a redo operation. 25 | /// 26 | Redo = NativeMethods.SC_PERFORMED_REDO 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/MultiPaste.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Specifies the behavior of pasting into multiple selections. 10 | /// 11 | public enum MultiPaste 12 | { 13 | /// 14 | /// Pasting into multiple selections only pastes to the main selection. This is the default. 15 | /// 16 | Once = NativeMethods.SC_MULTIPASTE_ONCE, 17 | 18 | /// 19 | /// Pasting into multiple selections pastes into each selection. 20 | /// 21 | Each = NativeMethods.SC_MULTIPASTE_EACH 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ScintillaNET/NeedShownEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Provides data for the event. 10 | /// 11 | public class NeedShownEventArgs : EventArgs 12 | { 13 | private readonly Scintilla scintilla; 14 | private readonly int bytePosition; 15 | private readonly int byteLength; 16 | private int? position; 17 | private int? length; 18 | 19 | /// 20 | /// Gets the length of the text that needs to be shown. 21 | /// 22 | /// The length of text starting at that needs to be shown. 23 | public int Length 24 | { 25 | get 26 | { 27 | if (length == null) 28 | { 29 | var endBytePosition = (bytePosition + byteLength); 30 | var endPosition = scintilla.Lines.ByteToCharPosition(endBytePosition); 31 | length = (endPosition - Position); 32 | } 33 | 34 | return (int)length; 35 | } 36 | } 37 | 38 | /// 39 | /// Gets the zero-based document position where text needs to be shown. 40 | /// 41 | /// The zero-based document position where the range of text to be shown starts. 42 | public int Position 43 | { 44 | get 45 | { 46 | if (position == null) 47 | position = scintilla.Lines.ByteToCharPosition(bytePosition); 48 | 49 | return (int)position; 50 | } 51 | } 52 | 53 | /// 54 | /// Initializes a new instance of the class. 55 | /// 56 | /// The control that generated this event. 57 | /// The zero-based byte position within the document where text needs to be shown. 58 | /// The length in bytes of the text that needs to be shown. 59 | public NeedShownEventArgs(Scintilla scintilla, int bytePosition, int byteLength) 60 | { 61 | this.scintilla = scintilla; 62 | this.bytePosition = bytePosition; 63 | this.byteLength = byteLength; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /ScintillaNET/Order.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The sorting order for autocompletion lists. 10 | /// 11 | public enum Order 12 | { 13 | /// 14 | /// Requires that an autocompletion lists be sorted in alphabetical order. This is the default. 15 | /// 16 | Presorted = NativeMethods.SC_ORDER_PRESORTED, 17 | 18 | /// 19 | /// Instructs a control to perform an alphabetical sort of autocompletion lists. 20 | /// 21 | PerformSort = NativeMethods.SC_ORDER_PERFORMSORT, 22 | 23 | /// 24 | /// User-defined order. 25 | /// 26 | Custom = NativeMethods.SC_ORDER_CUSTOM 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/Phases.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The number of phases used when drawing. 10 | /// 11 | public enum Phases 12 | { 13 | /// 14 | /// Drawing is done in a single phase. This is the fastest but provides no support for kerning. 15 | /// 16 | One = NativeMethods.SC_PHASES_ONE, 17 | 18 | /// 19 | /// Drawing is done in two phases; the background first and then the text. This is the default. 20 | /// 21 | Two = NativeMethods.SC_PHASES_TWO, 22 | 23 | /// 24 | /// Drawing is done in multiple phases; once for each feature. This is the slowest but allows 25 | /// extreme ascenders and descenders to overflow into adjacent lines. 26 | /// 27 | Multiple = NativeMethods.SC_PHASES_MULTIPLE 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ScintillaNET/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Resources; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("ScintillaNET")] 11 | [assembly: AssemblyDescription("Source Editing Component")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Jacob Slusser")] 14 | [assembly: AssemblyProduct("ScintillaNET")] 15 | [assembly: AssemblyCopyright("Copyright (c) 2016, Jacob Slusser. All rights reserved.")] 16 | [assembly: AssemblyTrademark("The MIT License (MIT)")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | // The following GUID is for the ID of the typelib if this project is exposed to COM 25 | [assembly: Guid("f8ac48e7-9378-482d-8c7f-92c8408dd4f2")] 26 | 27 | // http://stackoverflow.com/a/65062 28 | // Version information for an assembly consists of the following four values: 29 | // 30 | // Major Version 31 | // Minor Version 32 | // Build Number 33 | // Revision 34 | // 35 | // You can specify all the values or you can default the Build and Revision Numbers 36 | // by using the '*' as shown below: 37 | // [assembly: AssemblyVersion("1.0.*")] 38 | [assembly: AssemblyVersion("3.5.10.0")] 39 | [assembly: AssemblyFileVersion("3.5.10.0")] 40 | [assembly: AssemblyInformationalVersion("3.5.10")] 41 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 42 | 43 | #if (DEBUG) 44 | // For my own personal testing of internal members 45 | [assembly: InternalsVisibleToAttribute("ScintillaNET.Test")] 46 | #endif 47 | -------------------------------------------------------------------------------- /ScintillaNET/PropertyType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Lexer property types. 10 | /// 11 | public enum PropertyType 12 | { 13 | /// 14 | /// A Boolean property. This is the default. 15 | /// 16 | Boolean = NativeMethods.SC_TYPE_BOOLEAN, 17 | 18 | /// 19 | /// An integer property. 20 | /// 21 | Integer = NativeMethods.SC_TYPE_INTEGER, 22 | 23 | /// 24 | /// A string property. 25 | /// 26 | String = NativeMethods.SC_TYPE_STRING 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScintillaNET/SCNotificationEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | // For internal use only 9 | internal sealed class SCNotificationEventArgs : EventArgs 10 | { 11 | public NativeMethods.SCNotification SCNotification { get; private set; } 12 | 13 | public SCNotificationEventArgs(NativeMethods.SCNotification scn) 14 | { 15 | this.SCNotification = scn; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ScintillaNET/SearchFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// Specifies the how patterns are matched when performing a search in a control. 11 | /// 12 | /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. 13 | [Flags] 14 | public enum SearchFlags 15 | { 16 | /// 17 | /// Matches every instance of the search string. 18 | /// 19 | None = 0, 20 | 21 | /// 22 | /// A match only occurs with text that matches the case of the search string. 23 | /// 24 | MatchCase = NativeMethods.SCFIND_MATCHCASE, 25 | 26 | /// 27 | /// A match only occurs if the characters before and after are not word characters. 28 | /// 29 | WholeWord = NativeMethods.SCFIND_WHOLEWORD, 30 | 31 | /// 32 | /// A match only occurs if the character before is not a word character. 33 | /// 34 | WordStart = NativeMethods.SCFIND_WORDSTART, 35 | 36 | /// 37 | /// The search string should be interpreted as a regular expression. 38 | /// Regular expressions will only match ranges within a single line, never matching over multiple lines. 39 | /// 40 | Regex = NativeMethods.SCFIND_REGEXP, 41 | 42 | /// 43 | /// Treat regular expression in a more POSIX compatible manner by interpreting bare '(' and ')' for tagged sections rather than "\(" and "\)". 44 | /// 45 | Posix = NativeMethods.SCFIND_POSIX, 46 | 47 | /// 48 | /// The search string should be interpreted as a regular expression and use the C++11 <regex> standard library engine. 49 | /// The property can queried to determine if the regular expression is invalid. 50 | /// The ECMAScript flag is set on the regex object and documents will exhibit Unicode-compliant behaviour. 51 | /// Regular expressions will only match ranges within a single line, never matching over multiple lines. 52 | /// 53 | Cxx11Regex = NativeMethods.SCFIND_CXX11REGEX 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ScintillaNET/SelectionCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// A multiple selection collection. 11 | /// 12 | public class SelectionCollection : IEnumerable 13 | { 14 | private readonly Scintilla scintilla; 15 | 16 | /// 17 | /// Provides an enumerator that iterates through the collection. 18 | /// 19 | /// An object that contains all objects within the . 20 | public IEnumerator GetEnumerator() 21 | { 22 | int count = Count; 23 | for (int i = 0; i < count; i++) 24 | yield return this[i]; 25 | 26 | yield break; 27 | } 28 | 29 | IEnumerator IEnumerable.GetEnumerator() 30 | { 31 | return this.GetEnumerator(); 32 | } 33 | 34 | /// 35 | /// Gets the number of active selections. 36 | /// 37 | /// The number of selections in the . 38 | public int Count 39 | { 40 | get 41 | { 42 | return scintilla.DirectMessage(NativeMethods.SCI_GETSELECTIONS).ToInt32(); 43 | } 44 | } 45 | 46 | /// 47 | /// Gets a value indicating whether all selection ranges are empty. 48 | /// 49 | /// true if all selection ranges are empty; otherwise, false. 50 | public bool IsEmpty 51 | { 52 | get 53 | { 54 | return scintilla.DirectMessage(NativeMethods.SCI_GETSELECTIONEMPTY) != IntPtr.Zero; 55 | } 56 | } 57 | 58 | /// 59 | /// Gets the at the specified zero-based index. 60 | /// 61 | /// The zero-based index of the to get. 62 | /// The at the specified index. 63 | public Selection this[int index] 64 | { 65 | get 66 | { 67 | index = Helpers.Clamp(index, 0, Count - 1); 68 | return new Selection(scintilla, index); 69 | } 70 | } 71 | 72 | /// 73 | /// Initializes a new instance of the class. 74 | /// 75 | /// 76 | public SelectionCollection(Scintilla scintilla) 77 | { 78 | this.scintilla = scintilla; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /ScintillaNET/Status.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// Possible status codes returned by the property. 10 | /// 11 | public enum Status 12 | { 13 | /// 14 | /// No failures. 15 | /// 16 | Ok = NativeMethods.SC_STATUS_OK, 17 | 18 | /// 19 | /// Generic failure. 20 | /// 21 | Failure = NativeMethods.SC_STATUS_FAILURE, 22 | 23 | /// 24 | /// Memory is exhausted. 25 | /// 26 | BadAlloc = NativeMethods.SC_STATUS_BADALLOC, 27 | 28 | /// 29 | /// Regular expression is invalid. 30 | /// 31 | WarnRegex = NativeMethods.SC_STATUS_WARN_REGEX 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ScintillaNET/StyleCase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ScintillaNET 7 | { 8 | /// 9 | /// The possible casing styles of a style. 10 | /// 11 | public enum StyleCase 12 | { 13 | /// 14 | /// Display the text normally. 15 | /// 16 | Mixed = NativeMethods.SC_CASE_MIXED, 17 | 18 | /// 19 | /// Display the text in upper case. 20 | /// 21 | Upper = NativeMethods.SC_CASE_UPPER, 22 | 23 | /// 24 | /// Display the text in lower case. 25 | /// 26 | Lower = NativeMethods.SC_CASE_LOWER, 27 | 28 | /// 29 | /// Display the text in camel case. 30 | /// 31 | Camel = NativeMethods.SC_CASE_CAMEL 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ScintillaNET/StyleCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ScintillaNET 8 | { 9 | /// 10 | /// An immutable collection of style definitions in a control. 11 | /// 12 | public class StyleCollection : IEnumerable