Initial commit: Complete open-source Decal rebuild
All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
d1442e3747
1382 changed files with 170725 additions and 0 deletions
85
Managed/Decal.DecalControls/EditImpl.cs
Normal file
85
Managed/Decal.DecalControls/EditImpl.cs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Controls;
|
||||
using Decal.Interop.Inject;
|
||||
|
||||
namespace Decal.DecalControls
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("8E8F88D2-AA47-474E-9DB7-912D49C8BE9D")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComSourceInterfaces("Decal.Interop.Controls.IEditEvents\0\0")]
|
||||
[ProgId("DecalControls.Edit")]
|
||||
public class EditImpl : ControlBase, IEdit
|
||||
{
|
||||
public event IEditEvents_DestroyEventHandler Destroy;
|
||||
public event IEditEvents_BeginEventHandler Begin;
|
||||
public event IEditEvents_ChangeEventHandler Change;
|
||||
public event IEditEvents_EndEventHandler End;
|
||||
|
||||
private string _text = "";
|
||||
private int _caret;
|
||||
private int _selStart, _selEnd;
|
||||
private IImageCache _background;
|
||||
private IFontCache _font;
|
||||
private int _textColor;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => _text;
|
||||
set
|
||||
{
|
||||
_text = value ?? "";
|
||||
_caret = _text.Length;
|
||||
Invalidate();
|
||||
Change?.Invoke(ID, _text);
|
||||
}
|
||||
}
|
||||
|
||||
public int Caret { get => _caret; set { _caret = value; Invalidate(); } }
|
||||
|
||||
public void Select(int nStart, int nEnd)
|
||||
{
|
||||
_selStart = nStart;
|
||||
_selEnd = nEnd;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
public string SelectedText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_selStart >= 0 && _selEnd > _selStart && _selEnd <= _text.Length)
|
||||
return _text.Substring(_selStart, _selEnd - _selStart);
|
||||
return "";
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_selStart >= 0 && _selEnd > _selStart && _selEnd <= _text.Length)
|
||||
{
|
||||
_text = _text.Remove(_selStart, _selEnd - _selStart).Insert(_selStart, value ?? "");
|
||||
_caret = _selStart + (value?.Length ?? 0);
|
||||
_selStart = _selEnd = 0;
|
||||
Invalidate();
|
||||
Change?.Invoke(ID, _text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IImageCache Background { get => _background; set { _background = value; Invalidate(); } }
|
||||
public IFontCache Font { get => _font; set { _font = value; Invalidate(); } }
|
||||
public int TextColor { get => _textColor; set { _textColor = value; Invalidate(); } }
|
||||
|
||||
public void SetMargins(int nX, int nY) { }
|
||||
|
||||
public void Capture()
|
||||
{
|
||||
if (_site != null)
|
||||
{
|
||||
((ILayerSite)(object)_site).CaptureKeyboard();
|
||||
Begin?.Invoke(ID);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDestroy() => Destroy?.Invoke(ID);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue