diff --git a/.gitignore b/.gitignore
index a1ed38d..40da635 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,398 @@
-################################################################################
-# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
-################################################################################
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
-/bin
-/lsl-editor-doc.xml
-/trunk/.vs/lsleditor/v15
-/trunk/obj/Debug
-/trunk/obj/Release/Default/Project
-/trunk/obj/Release
-/trunk/lsleditor.csproj.user
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
diff --git a/Settings.StyleCop b/Settings.StyleCop
deleted file mode 100644
index 3b4d8a9..0000000
--- a/Settings.StyleCop
+++ /dev/null
@@ -1,184 +0,0 @@
-
-
- en-GB
-
-
-
-
- False
-
-
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- True
-
-
-
-
- True
-
-
-
-
- False
-
-
-
-
- True
-
-
-
-
- True
-
-
-
-
- True
-
-
-
-
- False
-
-
-
-
- True
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/_ReSharper.lsleditor/BuildScriptCache/.crc b/_ReSharper.lsleditor/BuildScriptCache/.crc
deleted file mode 100644
index 27c8f6d..0000000
--- a/_ReSharper.lsleditor/BuildScriptCache/.crc
+++ /dev/null
@@ -1 +0,0 @@
-ó¨û
\ No newline at end of file
diff --git a/_ReSharper.lsleditor/BuildScriptCache/.version b/_ReSharper.lsleditor/BuildScriptCache/.version
deleted file mode 100644
index 2cf9f20..0000000
Binary files a/_ReSharper.lsleditor/BuildScriptCache/.version and /dev/null differ
diff --git a/_ReSharper.lsleditor/BuildScriptCache/5/4680b305.dat b/_ReSharper.lsleditor/BuildScriptCache/5/4680b305.dat
deleted file mode 100644
index 3d5acdd..0000000
Binary files a/_ReSharper.lsleditor/BuildScriptCache/5/4680b305.dat and /dev/null differ
diff --git a/_ReSharper.lsleditor/ModuleIds.xml b/_ReSharper.lsleditor/ModuleIds.xml
deleted file mode 100644
index c4076ec..0000000
--- a/_ReSharper.lsleditor/ModuleIds.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/_ReSharper.lsleditor/NamedArguments/.crc b/_ReSharper.lsleditor/NamedArguments/.crc
deleted file mode 100644
index bfb7e15..0000000
--- a/_ReSharper.lsleditor/NamedArguments/.crc
+++ /dev/null
@@ -1 +0,0 @@
-ÌÏbÙ
\ No newline at end of file
diff --git a/_ReSharper.lsleditor/NamedArguments/.version b/_ReSharper.lsleditor/NamedArguments/.version
deleted file mode 100644
index f66c9cf..0000000
Binary files a/_ReSharper.lsleditor/NamedArguments/.version and /dev/null differ
diff --git a/_ReSharper.lsleditor/NamedArguments/5/4680b305.dat b/_ReSharper.lsleditor/NamedArguments/5/4680b305.dat
deleted file mode 100644
index 7326acf..0000000
Binary files a/_ReSharper.lsleditor/NamedArguments/5/4680b305.dat and /dev/null differ
diff --git a/_ReSharper.lsleditor/ProjectModel/ProjectModel.dat b/_ReSharper.lsleditor/ProjectModel/ProjectModel.dat
deleted file mode 100644
index 01fa1e0..0000000
Binary files a/_ReSharper.lsleditor/ProjectModel/ProjectModel.dat and /dev/null differ
diff --git a/_ReSharper.lsleditor/Resources/.crc b/_ReSharper.lsleditor/Resources/.crc
deleted file mode 100644
index ca596c6..0000000
--- a/_ReSharper.lsleditor/Resources/.crc
+++ /dev/null
@@ -1 +0,0 @@
-s[/
\ No newline at end of file
diff --git a/_ReSharper.lsleditor/Resources/.version b/_ReSharper.lsleditor/Resources/.version
deleted file mode 100644
index 38424fc..0000000
Binary files a/_ReSharper.lsleditor/Resources/.version and /dev/null differ
diff --git a/_ReSharper.lsleditor/Resources/5/626cc1d.dat b/_ReSharper.lsleditor/Resources/5/626cc1d.dat
deleted file mode 100644
index 211a06a..0000000
Binary files a/_ReSharper.lsleditor/Resources/5/626cc1d.dat and /dev/null differ
diff --git a/_ReSharper.lsleditor/SymbolCache.bin b/_ReSharper.lsleditor/SymbolCache.bin
deleted file mode 100644
index 8071ba1..0000000
Binary files a/_ReSharper.lsleditor/SymbolCache.bin and /dev/null differ
diff --git a/_ReSharper.lsleditor/TagPrefixes/.crc b/_ReSharper.lsleditor/TagPrefixes/.crc
deleted file mode 100644
index 593f470..0000000
Binary files a/_ReSharper.lsleditor/TagPrefixes/.crc and /dev/null differ
diff --git a/_ReSharper.lsleditor/TagPrefixes/.version b/_ReSharper.lsleditor/TagPrefixes/.version
deleted file mode 100644
index f66c9cf..0000000
Binary files a/_ReSharper.lsleditor/TagPrefixes/.version and /dev/null differ
diff --git a/_ReSharper.lsleditor/TodoCache/.crc b/_ReSharper.lsleditor/TodoCache/.crc
deleted file mode 100644
index aaa223d..0000000
--- a/_ReSharper.lsleditor/TodoCache/.crc
+++ /dev/null
@@ -1 +0,0 @@
-ÜÁëN
\ No newline at end of file
diff --git a/_ReSharper.lsleditor/TodoCache/.version b/_ReSharper.lsleditor/TodoCache/.version
deleted file mode 100644
index 2eedfde..0000000
Binary files a/_ReSharper.lsleditor/TodoCache/.version and /dev/null differ
diff --git a/_ReSharper.lsleditor/TodoCache/3/79ddd176.dat b/_ReSharper.lsleditor/TodoCache/3/79ddd176.dat
deleted file mode 100644
index ee97687..0000000
Binary files a/_ReSharper.lsleditor/TodoCache/3/79ddd176.dat and /dev/null differ
diff --git a/_ReSharper.lsleditor/WebsiteFileReferences/.crc b/_ReSharper.lsleditor/WebsiteFileReferences/.crc
deleted file mode 100644
index 593f470..0000000
Binary files a/_ReSharper.lsleditor/WebsiteFileReferences/.crc and /dev/null differ
diff --git a/_ReSharper.lsleditor/WebsiteFileReferences/.version b/_ReSharper.lsleditor/WebsiteFileReferences/.version
deleted file mode 100644
index 59c36c6..0000000
Binary files a/_ReSharper.lsleditor/WebsiteFileReferences/.version and /dev/null differ
diff --git a/_ReSharper.lsleditor/WordIndex/.crc b/_ReSharper.lsleditor/WordIndex/.crc
deleted file mode 100644
index 99db6de..0000000
--- a/_ReSharper.lsleditor/WordIndex/.crc
+++ /dev/null
@@ -1 +0,0 @@
-B•ae
\ No newline at end of file
diff --git a/_ReSharper.lsleditor/WordIndex/.version b/_ReSharper.lsleditor/WordIndex/.version
deleted file mode 100644
index 2cf9f20..0000000
Binary files a/_ReSharper.lsleditor/WordIndex/.version and /dev/null differ
diff --git a/_ReSharper.lsleditor/WordIndex/2/7003905d.dat b/_ReSharper.lsleditor/WordIndex/2/7003905d.dat
deleted file mode 100644
index bc422e5..0000000
Binary files a/_ReSharper.lsleditor/WordIndex/2/7003905d.dat and /dev/null differ
diff --git a/_ReSharper.lsleditor/WordIndex/5/4680b305.dat b/_ReSharper.lsleditor/WordIndex/5/4680b305.dat
deleted file mode 100644
index e0e3460..0000000
Binary files a/_ReSharper.lsleditor/WordIndex/5/4680b305.dat and /dev/null differ
diff --git a/_ReSharper.lsleditor/WordIndex/6/bf11a17.dat b/_ReSharper.lsleditor/WordIndex/6/bf11a17.dat
deleted file mode 100644
index 74fc66a..0000000
Binary files a/_ReSharper.lsleditor/WordIndex/6/bf11a17.dat and /dev/null differ
diff --git a/build/AssemblyRevisionIncrementer.exe b/build/AssemblyRevisionIncrementer.exe
deleted file mode 100644
index 7e2ef2e..0000000
Binary files a/build/AssemblyRevisionIncrementer.exe and /dev/null differ
diff --git a/lsl-editor-doc.xml b/lsl-editor-doc.xml
deleted file mode 100644
index a106182..0000000
--- a/lsl-editor-doc.xml
+++ /dev/null
@@ -1,3272 +0,0 @@
-
-
-
- LSLEditor
-
-
-
-
- About dialogue box form.
-
-
- About dialogue box form.
-
-
-
-
- Initialises a new instance of the class.
-
- The parent form.
-
-
-
- OK/Close button.
-
-
-
-
-
-
- Link to SourceForge page.
-
-
-
-
-
-
- Loads the page.
-
-
-
-
-
-
- Required designer variable.
-
-
-
-
- Container for LSLife picture.
-
-
-
-
- Container to hold all the elements.
-
-
-
-
- OK Button.
-
-
-
-
- Web Browser.
-
-
-
-
- Link label.
-
-
-
-
- Version label.
-
-
-
-
- LSL Editor label.
-
-
-
-
- Clean up any resources being used.
-
- True if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Defines internal values for both compression and decompression
-
-
-
-
- Random numbers used to randomise repetitive blocks
-
-
-
-
- When multiplied by compression parameter (1-9) gives the block size for compression
- 9 gives the best compresssion but uses the most memory.
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- Backend constant
-
-
-
-
- An input stream that decompresses files in the BZip2 format
-
-
-
-
- Construct instance for reading from stream
-
- Data source
-
-
-
- Get/set flag indicating ownership of underlying stream.
- When the flag is true will close the underlying stream also.
-
-
-
-
- Gets a value indicating if the stream supports reading
-
-
-
-
- Gets a value indicating whether the current stream supports seeking.
-
-
-
-
- Gets a value indicating whether the current stream supports writing.
- This property always returns false
-
-
-
-
- Gets the length in bytes of the stream.
-
-
-
-
- Gets or sets the streams position.
- Setting the position is not supported and will throw a NotSupportException
-
- Any attempt to set the position
-
-
-
- Flushes the stream.
-
-
-
-
- Set the streams position. This operation is not supported and will throw a NotSupportedException
-
- Any access
-
-
-
- Sets the length of this stream to the given value.
- This operation is not supported and will throw a NotSupportedExceptionortedException
-
- Any access
-
-
-
- Writes a block of bytes to this stream using data from a buffer.
- This operation is not supported and will throw a NotSupportedException
-
- Any access
-
-
-
- Writes a byte to the current position in the file stream.
- This operation is not supported and will throw a NotSupportedException
-
- The value to write.
- Any access
-
-
-
- Read a sequence of bytes and advances the read position by one byte.
-
- Array of bytes to store values in
- Offset in array to begin storing data
- The maximum number of bytes to read
- The total number of bytes read into the buffer. This might be less
- than the number of bytes requested if that number of bytes are not
- currently available or zero if the end of the stream is reached.
-
-
-
-
- Closes the stream, releasing any associated resources.
-
-
-
-
- Read a byte from stream advancing position
-
- byte read or -1 on end of stream
-
-
-
- Interface to compute a data checksum used by checked input/output streams.
- A data checksum can be updated by one byte or with a byte array. After each
- update the value of the current checksum can be returned by calling
- getValue
. The complete checksum object can also be reset
- so it can be used again with new data.
-
-
-
-
- Returns the data checksum computed so far.
-
-
-
-
- Resets the data checksum as if no update was ever called.
-
-
-
-
- Adds one byte to the data checksum.
-
-
- the data value to add. The high byte of the int is ignored.
-
-
-
-
- Updates the data checksum with the bytes taken from the array.
-
-
- buffer an array of bytes
-
-
-
-
- Adds the byte array to the data checksum.
-
-
- The buffer which contains the data
-
-
- The offset in the buffer where the data starts
-
-
- the number of data bytes to add.
-
-
-
-
- Bzip2 checksum algorithm
-
-
-
-
- Initialise a default instance of
-
-
-
-
- Reset the state of Crc.
-
-
-
-
- Get the current Crc value.
-
-
-
-
- Update the Crc value.
-
- data update is based on
-
-
-
- Update Crc based on a block of data
-
-
-
-
- Update Crc based on a portion of a block of data
-
- block of data
- index of first byte to use
- number of bytes to use
-
-
-
- Determines whether the close button is visible on the content
-
-
-
-
- Determines the color with which the client rectangle will be drawn.
- If you take this property instead of the BackColor it will not have any influence on the borders to the surrounding controls (DockPane).
- If you use BackColor the borders to the surrounding controls (DockPane) will also change there colors.
- Alternatively you can use both of them (BackColor to draw the define the color of the borders and DockBackColor to define the color of the client rectangle).
- For Backgroundimages: Set your prefered Image, then set the DockBackColor and the BackColor to the same Color (Control)
-
-
-
-
- DragHandlerBase is the base class for drag handlers. The derived class should:
- 1. Define its public method BeginDrag. From within this public BeginDrag method,
- DragHandlerBase.BeginDrag should be called to initialize the mouse capture
- and message filtering.
- 2. Override the OnDragging and OnEndDrag methods.
-
-
-
-
- The skin to use when displaying the DockPanel.
- The skin allows custom gradient color schemes to be used when drawing the
- DockStrips and Tabs.
-
-
-
-
- The skin used to display the auto hide strips and tabs.
-
-
-
-
- The skin used to display the Document and ToolWindow style DockStrips and Tabs.
-
-
-
-
- The skin used to display the auto hide strip and tabs.
-
-
-
-
- The gradient color skin for the DockStrips.
-
-
-
-
- The gradient color skin for the Tabs.
-
-
-
-
- The skin used to display the document and tool strips and tabs.
-
-
-
-
- The skin used to display the Document style DockPane strip and tab.
-
-
-
-
- The skin used to display the ToolWindow style DockPane strip and tab.
-
-
-
-
- The skin used to display the DockPane ToolWindow strip and tab.
-
-
-
-
- The skin used to display the active ToolWindow caption.
-
-
-
-
- The skin used to display the inactive ToolWindow caption.
-
-
-
-
- The skin used to display the DockPane strip and tab.
-
-
-
-
- The gradient color skin for the DockStrip.
-
-
-
-
- The skin used to display the active DockPane tabs.
-
-
-
-
- The skin used to display the inactive DockPane tabs.
-
-
-
-
- The skin used to display the dock pane tab
-
-
-
-
- The text color.
-
-
-
-
- The gradient color skin.
-
-
-
-
- The beginning gradient color.
-
-
-
-
- The ending gradient color.
-
-
-
-
- The gradient mode to display the colors.
-
-
-
-
- The location to draw the DockPaneStrip for Document style windows.
-
-
-
-
- A strongly-typed resource class, for looking up localized strings, etc.
-
-
-
-
- Returns the cached ResourceManager instance used by this class.
-
-
-
-
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-
-
-
-
- A strongly-typed resource class, for looking up localized strings, etc.
-
-
-
-
- Returns the cached ResourceManager instance used by this class.
-
-
-
-
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-
-
-
-
- Looks up a localized string similar to Docking.
-
-
-
-
- Looks up a localized string similar to Docking Notification.
-
-
-
-
- Looks up a localized string similar to Property Changed.
-
-
-
-
- Looks up a localized string similar to (Float).
-
-
-
-
- Looks up a localized string similar to Determines if end user drag and drop docking is allowed..
-
-
-
-
- Looks up a localized string similar to The size to display the content in auto hide mode. Value < 1 to specify the size in portion; value >= 1 to specify the size in pixel..
-
-
-
-
- Looks up a localized string similar to Enable/Disable the close button of the content..
-
-
-
-
- Looks up a localized string similar to Shows or hides the close button of the content. This property does not function with System MDI Document Style..
-
-
-
-
- Looks up a localized string similar to The form must be of type IDockContent..
-
-
-
-
- Looks up a localized string similar to Gets or sets a value indicating in which area of the DockPanel the content allowed to show..
-
-
-
-
- Looks up a localized string similar to Occurs when the value of DockState property changed..
-
-
-
-
- Looks up a localized string similar to Indicates the content will be hidden instead of being closed..
-
-
-
-
- Looks up a localized string similar to The desired docking state when first showing..
-
-
-
-
- Looks up a localized string similar to Context menu displayed for the dock pane tab strip..
-
-
-
-
- Looks up a localized string similar to The tab text displayed in the dock pane. If not set, the Text property will be used..
-
-
-
-
- Looks up a localized string similar to The text displayed when mouse hovers over the tab..
-
-
-
-
- Looks up a localized string similar to The provided value is out of range..
-
-
-
-
- Looks up a localized string similar to Invalid Value: The value of DockAreas conflicts with current DockState..
-
-
-
-
- Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane..
-
-
-
-
- Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane..
-
-
-
-
- Looks up a localized string similar to Invalid value, conflicts with DockableAreas property..
-
-
-
-
- Looks up a localized string similar to The dock state is invalid..
-
-
-
-
- Looks up a localized string similar to The dock panel is null..
-
-
-
-
- Looks up a localized string similar to Invalid beforeContent, it must be contained by the pane..
-
-
-
-
- Looks up a localized string similar to Invalid DockState: Content can not be showed as "Unknown" or "Hidden"..
-
-
-
-
- Looks up a localized string similar to The previous pane is invalid. It can not be null, and its docking state must not be auto-hide..
-
-
-
-
- Looks up a localized string similar to DockPanel can not be null..
-
-
-
-
- Looks up a localized string similar to The Pane can not be null..
-
-
-
-
- Looks up a localized string similar to Invalid value, check DockableAreas property..
-
-
-
-
- Looks up a localized string similar to Context menu displayed for the dock pane tab strip..
-
-
-
-
- Looks up a localized string similar to Press SHIFT for docking to full side..
-
-
-
-
- Looks up a localized string similar to Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content..
-
-
-
-
- Looks up a localized string similar to Invalid argument: Content can not be "null"..
-
-
-
-
- Looks up a localized string similar to Invalid argument: The content's DockPanel can not be "null"..
-
-
-
-
- Looks up a localized string similar to The specified container conflicts with the IsFloat property..
-
-
-
-
- Looks up a localized string similar to The previous pane does not exist in the nested docking pane collection..
-
-
-
-
- Looks up a localized string similar to The container can not be null..
-
-
-
-
- Looks up a localized string similar to The previous pane can not be null when the nested docking pane collection is not empty..
-
-
-
-
- Looks up a localized string similar to The previous pane can not be itself..
-
-
-
-
- Looks up a localized string similar to FloatWindow property can not be set to "null" when DockState is DockState.Float..
-
-
-
-
- Looks up a localized string similar to Invalid Content: Content not within the collection..
-
-
-
-
- Looks up a localized string similar to Invalid Index: The index is out of range..
-
-
-
-
- Looks up a localized string similar to The state for the dock pane is invalid..
-
-
-
-
- Looks up a localized string similar to Auto Hide.
-
-
-
-
- Looks up a localized string similar to Close.
-
-
-
-
- Looks up a localized string similar to Options.
-
-
-
-
- Looks up a localized string similar to Invalid Content: The content must be auto-hide state and associates with this DockPanel..
-
-
-
-
- Looks up a localized string similar to Occurs when the value of ActiveContentProperty changed..
-
-
-
-
- Looks up a localized string similar to Occurs when the value of ActiveDocument property changed..
-
-
-
-
- Looks up a localized string similar to Occurs when the value of ActivePane property changed..
-
-
-
-
- Looks up a localized string similar to Determines if the drag and drop docking is allowed..
-
-
-
-
- Looks up a localized string similar to Determines if the drag and drop nested docking is allowed..
-
-
-
-
- Looks up a localized string similar to Occurs when a content added to the DockPanel..
-
-
-
-
- Looks up a localized string similar to Occurs when a content removed from the DockPanel..
-
-
-
-
- Looks up a localized string similar to The default size of float window..
-
-
-
-
- Looks up a localized string similar to Provides Visual Studio .Net style docking..
-
-
-
-
- Looks up a localized string similar to Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
-
-
-
-
- Looks up a localized string similar to Size of the left docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
-
-
-
-
- Looks up a localized string similar to The visual skin to use when displaying the docked windows..
-
-
-
-
- Looks up a localized string similar to Size of the right docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
-
-
-
-
- Looks up a localized string similar to Size of the top docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
-
-
-
-
- Looks up a localized string similar to The style of the document window..
-
-
-
-
- Looks up a localized string similar to Determines where the tab strip for Document style content is drawn..
-
-
-
-
- Looks up a localized string similar to The DockPanel has already been initialized..
-
-
-
-
- Looks up a localized string similar to The configuration file's version is invalid..
-
-
-
-
- Looks up a localized string similar to The XML file format is invalid..
-
-
-
-
- Looks up a localized string similar to Invalid parent form. When using DockingMdi or SystemMdi document style, the DockPanel control must be the child control of the main MDI container form..
-
-
-
-
- Looks up a localized string similar to DockPanel configuration file. Author: Weifen Luo, all rights reserved..
-
-
-
-
- Looks up a localized string similar to !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!!.
-
-
-
-
- Looks up a localized string similar to Indicates whether the control layout is right-to-left when the RightToLeft property is set to Yes..
-
-
-
-
- Looks up a localized string similar to Invalid Index: The index is out of range..
-
-
-
-
- Looks up a localized string similar to Invalid Pane: DockPane not within the collection..
-
-
-
-
- Looks up a localized string similar to Determines if the document icon will be displayed in the tab strip..
-
-
-
-
- Looks up a localized string similar to Close.
-
-
-
-
- Looks up a localized string similar to Window List.
-
-
-
-
- Looks up a localized string similar to Invalid argument: DockPanel can not be "null"..
-
-
-
-
- Looks up a localized string similar to Invalid Index: The index is out of range..
-
-
-
-
- Looks up a localized string similar to Invalid Pane: DockPane not within the collection..
-
-
-
-
- Looks up a localized string similar to Invalid DockPanel..
-
-
-
-
- Determines whether the close button is visible on the content
-
-
-
-
- Calculate which tabs are displayed and in what order.
-
-
-
-
- Data Grid View Printer. Print functions for a datagridview, since MS
- didn't see fit to do it.
-
-
-
-
- Title for this report. Default is empty.
-
-
-
-
- Font for the title. Default is Tahoma, 18pt.
-
-
-
-
- Foreground color for the title. Default is Black
-
-
-
-
- Allow the user to override the title string alignment. Default value is
- Alignment - Near;
-
-
-
-
- Allow the user to override the title string format flags. Default values
- are: FormatFlags - NoWrap, LineLimit, NoClip
-
-
-
-
- SubTitle for this report. Default is empty.
-
-
-
-
- Font for the subtitle. Default is Tahoma, 12pt.
-
-
-
-
- Foreground color for the subtitle. Default is Black
-
-
-
-
- Allow the user to override the subtitle string alignment. Default value is
- Alignment - Near;
-
-
-
-
- Allow the user to override the subtitle string format flags. Default values
- are: FormatFlags - NoWrap, LineLimit, NoClip
-
-
-
-
- footer for this report. Default is empty.
-
-
-
-
- Font for the footer. Default is Tahoma, 10pt.
-
-
-
-
- Foreground color for the footer. Default is Black
-
-
-
-
- Allow the user to override the footer string alignment. Default value is
- Alignment - Center;
-
-
-
-
- Allow the user to override the footer string format flags. Default values
- are: FormatFlags - NoWrap, LineLimit, NoClip
-
-
-
-
- Include page number in the printout. Default is true.
-
-
-
-
- Font for the page number, Default is Tahoma, 8pt.
-
-
-
-
- Text color (foreground) for the page number. Default is Black
-
-
-
-
- Allow the user to override the page number string alignment. Default value is
- Alignment - Near;
-
-
-
-
- Allow the user to override the pagenumber string format flags. Default values
- are: FormatFlags - NoWrap, LineLimit, NoClip
-
-
-
-
- Allow the user to select whether to have the page number at the top or bottom
- of the page. Default is false: page numbers on the bottom of the page
-
-
-
-
- Should the page number be printed on a separate line, or printed on the
- same line as the header / footer? Default is false;
-
-
-
-
- Page margins override. Default is (60, 60, 60, 60)
-
-
-
-
- Constructor for PrinterHelper
-
-
-
-
- Start the printing process, print to a printer.
-
- The EditForm to print
- NOTE: Any changes to this method also need to be done in PrintPreviewEditForm
-
-
-
- Start the printing process, print to a print preview dialog
-
- The EditForm to print
- NOTE: Any changes to this method also need to be done in PrintDataGridView
-
-
-
- Set up the print job. Save information from print dialog
- and print document for easy access. Also sets up the rows
- and columns that will be printed.
-
- The print dialog the user just filled out
-
-
-
- Centralize the string format settings. Does the work of checking for user
- overrides, and if they're not present, setting the cell alignment to match
- (somewhat) the source control's string alignment.
-
- String alignment
- String format flags
- DataGridView style to apply (if available)
- True if user overrode alignment or flags
-
-
-
-
- PrintPage event handler. This routine prints one page. It will
- skip non-printable pages if the user selected the "some pages" option
- on the print dialog.
-
- default object from windows
- Event info from Windows about the printing
-
-
-
- Print a header or footer section. Used for page numbers and titles
-
- Graphic context to print in
- Track vertical space used; 'y' location
- String to print
- Font to use for printing
- Color to print in
- Alignment - print to left, center or right
- String format flags
- True if the user overrode the alignment or flags
-
-
-
- Print the footer. This handles the footer spacing, and printing the page number
- at the bottom of the page (if the page number is not in the header).
-
- Graphic context to print in
- Track vertical space used; 'y' location
-
-
-
- Represents an object that performs a certain action asynchronously, by using an internal buffer queue
- and one internal thread.
-
-
-
- Reference to the thread used to empty the queue
-
-
- Internal queue that serves as buffer for required actions
-
-
- Used to signal the thread when a new object is added to the queue
-
-
- Flag that notifies that the object should be disposed
-
-
- Creates a new buffered object
-
-
- Method executed by the internal thread to empty the queue
-
-
- The tasks being saved in the queue
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- This part of the SecondLife class initialises the constants for LSL.
-
-
- This part of the SecondLife class contains the Event definitions.
-
-
- This part of the SecondLife class contains the LSL function definitions.
-
-
- This part of the SecondLife class contains the OSSL function definitions.
-
-
- This part of the SecondLife class defines the Float struct.
-
-
- Partial definition of SecondLife class to handle running scripts.
-
-
-
-
- A struct for Float objects.
-
-
-
-
- Stores the Float value.
-
-
-
-
- Gets or sets the value of the Float.
-
- Gets or sets the objValue data member.
-
-
-
- Initialises a new instance of the struct.
-
-
-
-
-
- Initialises a new instance of the struct.
-
-
-
-
-
- No idea of the intention here ;-).
-
- The Float value as a 32 bit number.
-
-
-
- Converts the Float to a string representation.
-
- String representation of the Float.
-
-
-
- Converts the Float to a string representation.
-
-
- String representation of the Float.
-
-
-
- Converts the Float to a string representation.
-
-
- String representation of the Float.
-
-
-
- Creates a new instance of a Float from a string.
-
-
- A new Float instance.
-
-
-
- Creates a new instance of a Float from a String.
-
-
- A new Float instance.
-
-
-
- Creates a new instance of a Float from an Int32 .
-
-
- A new Float instance.
-
-
-
- Creates a new instance of a Float from a long.
-
-
- A new Float instance.
-
-
-
- Creates a new instance of a Float from a Double.
-
-
- A new Float instance.
-
-
-
- Creates a new instance of a Float from an integer type.
-
-
- A new Float instance.
-
-
-
- Calculates the result of multiplying a and b.
-
-
-
- The product of a and b.
-
-
-
- Calculates the result of dividing a by b.
-
-
-
- The result of dividing a by b.
-
-
-
- Calculates the result of incrementing the Float's value.
-
-
- The result of incrementing the Float's value.
-
-
-
- Calculates the result of decrementing the Float's value.
-
-
- The result of decrementing the Float's value.
-
-
-
- Calculates the result of adding a to b.
-
-
-
- The result of adding a to b.
-
-
-
- Calculates the result of subtracting a from b.
-
-
-
- The result of subtracting a from b.
-
-
-
- Casts the Float to a boolean.
-
-
- A boolean value.
-
-
-
- Defines a boolean true value.
-
-
- A boolean indicating whether the value is considered true.
-
-
-
- Defines a boolean false value.
-
-
- A boolean indicating whether the value is considered false.
-
-
-
- Defines the equality operator.
-
- First operand.
- Second operand.
- A boolean value indicating equality.
-
-
-
- Defines the inequality operator.
-
- First operand.
- Second operand.
- A boolean value indicating inequality.
-
-
-
- Compares two Floats.
-
- First operand.
- Second operand.
- An integer (-1, 0, or 1), indicating whether the first item is less than, same as, or greater than the second.
-
-
-
- Defines the Equals operator.
-
-
- A boolean value indicating equality.
-
-
-
- Holds the host object.
-
-
-
-
- Random generator.
-
-
-
-
- Holds the time of the script starting execution.
-
-
-
-
- Contains a boolean value indicating whether this object accepts other items to be dropped into it.
-
-
-
-
- Contains a list of keys of avatars that may enter a parcel.
-
-
-
-
- Contains a list of keys of avatars that may NOT enter a parcel.
-
-
-
-
- Volume of sound played by this prim.
-
-
-
-
- Name of the object/prim.
-
-
-
-
- URL for parcel's music stream.
-
-
-
-
- Position of object/prim placement in a simulator.
-
-
-
-
- Rotation of the object/prim's placement in the simulator.
-
-
-
-
- Local rotation of the prim with respect to the object root.
-
-
-
-
- Scale of the object/prim.
-
-
-
-
- Text for the "Sit" entry on object menu.
-
-
-
-
- Radius that sound may be heard around the object/prim.
-
-
-
-
- Region Coordinates of the simulator's bottom-left corner.
-
-
-
-
- Parameter passed to the script on start up.
-
-
-
-
- Initialises a new instance of the class.
-
-
-
-
- Gets the position of the object within the simulator.
-
- Gets the vPosition data member.
-
-
-
- Gets or sets the SecondLifeHost object.
-
- The host property gets/sets the slhHost data member.
-
-
-
- Outputs messages during execution of the script.
-
- The text (with possible placeholders) to be output.
- Values to be put into corresponding placeholders.
-
-
-
- Wrapper to call the SecondLifeHost.Chat method.
-
- Channel for message to be sent on.
- Text of message to send.
- Type of communication (from CommunicationType enumerator).
-
-
-
- Method to trigger change in script state.
-
- Name of state to switch to.
-
-
-
- Takes the possibly negative value list indexes and corrects them to be absolute indexes.
-
- Length of list.
- Start index.
- End index.
- True, unless an error occurred, then false.
-
-
-
- Randomly rearranges the list of items.
-
- List to shuffle.
- The reordered list.
-
-
-
- Convert a list into an array of buckets containing Stride elements.
-
- List of items.
- Number of element for each bucket.
- The list separated into elements of Stride length.
-
-
-
- Converts buckets back into a list.
-
- Array of buckets.
- Stride value.
- The items recombined into a simple list.
-
-
-
- Implements the Comparer Interface for our custom types (Float, Integer, and String).
-
-
-
-
- True/false parameter indicating whether the comparison should be done in ascending or descending order.
-
-
-
-
- Initialises a new instance of the class.
-
-
-
-
-
- Perform the comparison between two objects.
-
- First object.
- Second object.
- An integer (-1, 0, or 1), indicating whether the first item is less than, same as, or greater than the second.
-
-
-
- Takes a string and splits it into a list based upon separators (which are not kept) and spacers (which are).
-
- The source text.
- Separators to split on.
- Spacers to split on.
- True/false indicating whether nulls are kept in the resulting list.
- A new list of the split string.
-
-
-
- Convert string to Base64 representation.
-
- Source string.
- Base64 encoding of the source string.
-
-
-
- Converts Base64 encoded string back to UTF-8.
-
- Base64 encoded string.
- UTF-8 string.
-
-
-
- Performs the lookup.
-
- String source.
- Byte within string.
- The Base64 value of the element.
-
-
-
- Pre-generated matrix for quicker lookup.
-
-
-
-
- Performs (iA ** iB) % iC.
-
- Base value.
- Exponent value .
- Modulus value.
- The calculated result.
-
-
-
- Performs the llModPow2() function.
-
- Value one.
- Value two.
- The modulus value.
- The calculated result.
-
-
-
- Used by llListStatistics in generating the statistics.
-
- List of numbers (mixed types possible) to use.
- The numbers added together as a Float type.
-
-
-
- Calculates the mean of the supplied numbers.
-
- Array of numbers.
- The mean of the supplied numbers as a double type.
-
-
-
- Calculates standard deviation.
-
- Array of numbers to work with.
- The standard deviation of the supplied numbers as a double type.
-
-
-
- Performs division, only if both values are non-zero.
-
- First number.
- Second number.
- The result of the division, or zero if not performed.
-
-
-
- Takes a hexadecimal representation of a number and coverts it to an integer.
-
- Byte to convert.
- Integer value of the supplied byte.
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- The main entry point for the application.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- A strongly-typed resource class, for looking up localized strings, etc.
-
-
-
-
- Returns the cached ResourceManager instance used by this class.
-
-
-
-
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-
-
-
-
- Summary description for GroupboxTextbox.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- This Class translates LSL script into CSharp code
-
- LSL scripting code
- CSHarp code
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Represents an event with a single string argument.
-
-
-
-
- Stores the text of the message.
-
-
-
-
- Initialises a new instance of the class.
-
- String Text.
-
-
-
- Represents a linked message event.
-
-
-
-
- Stores the index of the sending link.
-
-
-
-
- Stores a 32 bit numerical value.
-
-
-
-
- Stores a text string.
-
-
-
-
- Stores a key.
-
-
-
-
- Initialises a new instance of the class.
-
-
-
-
-
-
-
-
- Represents a chat event.
-
-
-
-
- Stores the 32-bit number of the channel.
-
-
-
-
- Stores the name of the object/avatar.
-
-
-
-
- Stores the key of the objewct/avatar.
-
-
-
-
- Stores the text of the message.
-
-
-
-
- Stores the type of communication the event represents.
-
-
-
-
- Initialises a new instance of the class.
-
- Channel to communicate on. Some communication types have channel limitations.
- Name of object/avatar.
- UUID of object/avatar.
- Text of message.
- Type of communication (CommunicationType enum).
-
-
-
- SecondLifeHost class.
-
-
-
-
- Stores a list of ListenFilters
-
-
-
-
- Stores a list of the links in an object.
-
-
-
-
- Stores the SecondLife object representing the script.
-
-
-
-
- not sure?
-
-
-
-
- Flag indicating an event has occurred.
-
-
-
-
- Stores and controls a thread?.
-
-
-
-
- An editor form?
-
-
-
-
- A compiled assembly of the LSL script.
-
-
-
-
- Stores the path to the script (including script name).
-
-
-
-
- Stores globally unique ID.
-
-
-
-
- Stores SecondLifeHostMessageHandler function.
-
- Sender of message.
- SecondLifeHostEventArgs object.
-
-
-
- OnVerboseMessage event handler.
-
-
-
-
- OnStateChange event handler.
-
-
-
-
- Stores SecondLifeHostChatHandler function.
-
- The sender.
- SecondLifeHostChatEventArgs object.
-
-
-
- OnChat event handler.
-
-
-
-
- Stores SecondLifeHostMessageLinkedHandler function.
-
- The caller.
- SecondLifeHostMessageLinkedEventArgs object.
-
-
-
- OnMessageLinked event handler.
-
-
-
-
- OnDie event handler.
-
-
-
-
- OnReset event handler.
-
-
-
-
- OnListenChannelsChanged event handler.
-
-
-
-
- Stores a timer.
-
-
-
-
- Stores the timer for a Sensor event.
-
-
-
-
- Name of currently active state.
-
-
-
-
- Name of state to switch to.
-
-
-
-
- Name of the containing object/prim.
-
-
-
-
- Description of the containing object/prim.
-
-
-
-
- Initialises a new instance of the class.
-
- Editor form this host is atached to.
- Assembly of the compiled script.
- Full path (including file name) to the script.
- UUID of the containing object?
-
-
-
- Performs the timer event?
-
- The caller.
- ElapsedEventArgs object.
-
-
-
- Watches for the flag to switch state, and enacts the change when needed.
-
-
-
-
- Raises the flag for switching state. If the Force argument is true it ensures a state change.
-
-
-
-
-
-
- Initialises a new state.
-
-
-
-
- Gets a methods arguments using reflection.
-
-
-
-
-
-
- Runtime output of LSL event info.
-
-
-
-
-
-
- Queue the method for execution.
-
- Some method (is it event or state?).
- Array of arguments for the method.
-
-
-
- Fetches the names of all events (limited to current state?) in the script.
-
- List of events.
-
-
-
- Reset the script?
-
-
-
-
- Stop executing the script. Resets the queue, timer etc. first.
-
-
-
-
- Disposal method. Resets the Queue, Sensor, Timer, XMLRPC, etc.
-
-
-
-
- The Link structure holds data used in Link Messaging.
-
-
-
-
- Data - 32 bit integer.
-
-
-
-
- Data - string.
-
-
-
-
- Data - SL key.
-
-
-
-
- Destination for the data.
-
-
-
-
- Initialises a new instance of the type.
-
- 32 bit integer data.
- string data.
- SL key data.
- Destination for the message.
-
-
-
- Resets the link list, "breaking" them.
-
-
-
-
- Removes the specified Link from the list.
-
- The index number of the link to remove.
-
-
-
- Fetches the names of the ListenFilters.
-
- Array of ListenFilter names.
-
-
-
- ListenFilter type structure.
-
-
-
-
- Channel to listen on.
-
-
-
-
- Name of object/avatar to listen for.
-
-
-
-
- Key of object/avatar to listen for.
-
-
-
-
- Text from object/avatar to listen for.
-
-
-
-
- Flag indicating whether this filter is enabled or not.
-
-
-
-
- Initialises a new instance of the type.
-
- Channel to listen to (required).
- Name to listen for (can be empty).
- UUID to listen for (can be empty/null).
- Text to listen for (can be empty).
-
-
-
- Control for a ListenFilter
-
- 32 bit integer handle of the ListenFilter.
- Flag indicating whether to enable or disable.
-
-
-
- Removes a ListenFilter from the list.
-
- 32 bit integer handle of the ListenFilter.
-
-
-
- Creates a ListenFilter from the llListen paramters.
-
- Channel to listen ot.
- Name of object/avatar to listen for.
- Key of object/avatar to listen for.
- Text from object/avatar to listen for.
- 32 bit integer handle.
-
-
-
- Determines whether paremeters have a matching ListenFilter entry.
-
-
-
-
-
- True if a matche is found, otherwise false.
-
-
-
- // sink listen
-
- SecondLifeHostChatEventArgs object.
-
-
-
- Raise a chat event.
-
-
- Channel to send message on.
- Name of sender.
- Key of sender.
- Message to send.
- CommunicatioType enumerator value.
-
-
-
- Raise a linked message event.
-
-
-
-
-
-
-
-
- // sink
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- // Wiki sais this is not working in InWorld
-
-
-
-
-
-
-
-
-
- // Wiki sais currently disabled
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- provides methods to send email via smtp direct to mail server
- http://www.ietf.org/rfc/rfc0821.txt
-
-
-
-
- Get / Set the name of the SMTP mail server
-
-
-
-
- OnTextChanged
-
-
-
-
- Color a line
-
-
-
-
- Enumeration of Communication Types that the host understands.
-
-
-
-
- Indicates the message can be heard only within 5m.
-
-
-
-
- Indicates the message can be heard only within 20m.
-
-
-
-
- Indicates the message can be heard only within 100m.
-
-
-
-
- Indicates the message can be only heard by the owner any where within the same simulator.
-
-
-
-
- Indicates the message can be heard any where within the same simulator.
-
-
-
-
- Indicates the message can be heard any where within the same simulator, by a specific object.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Required designer variable.
-
-
-
-
- Clean up any resources being used.
-
- true if managed resources should be disposed; otherwise, false.
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
- Required designer variable.
-
-
-
-
- Required method for Designer support - do not modify
- the contents of this method with the code editor.
-
-
-
-
diff --git a/trunk/About.Designer.cs b/source/About.Designer.cs
similarity index 96%
rename from trunk/About.Designer.cs
rename to source/About.Designer.cs
index 180ba9a..1737cf1 100644
--- a/trunk/About.Designer.cs
+++ b/source/About.Designer.cs
@@ -1,175 +1,175 @@
-namespace LSLEditor
-{
- ///
- /// About dialogue box form.
- ///
- public partial class About
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Container for LSLife picture.
- ///
- private System.Windows.Forms.PictureBox pictureBox1;
-
- ///
- /// Container to hold all the elements.
- ///
- private System.Windows.Forms.GroupBox groupBox1;
-
- ///
- /// OK Button.
- ///
- private System.Windows.Forms.Button button1;
-
- ///
- /// Web Browser.
- ///
- private System.Windows.Forms.WebBrowser webBrowser1;
-
- ///
- /// Link label.
- ///
- private System.Windows.Forms.LinkLabel linkLabel1;
-
- ///
- /// Version label.
- ///
- private System.Windows.Forms.Label label1;
-
- ///
- /// LSL Editor label.
- ///
- private System.Windows.Forms.Label label2;
-
- ///
- /// Clean up any resources being used.
- ///
- /// True if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (this.components != null)) {
- this.components.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.webBrowser1 = new System.Windows.Forms.WebBrowser();
- this.linkLabel1 = new System.Windows.Forms.LinkLabel();
- this.button1 = new System.Windows.Forms.Button();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.groupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // pictureBox1
- //
- this.pictureBox1.Image = global::LSLEditor.Properties.Resources.logo;
- this.pictureBox1.Location = new System.Drawing.Point(16, 16);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(184, 80);
- this.pictureBox1.TabIndex = 0;
- this.pictureBox1.TabStop = false;
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.label2);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.webBrowser1);
- this.groupBox1.Controls.Add(this.linkLabel1);
- this.groupBox1.Controls.Add(this.pictureBox1);
- this.groupBox1.Location = new System.Drawing.Point(16, 8);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(320, 360);
- this.groupBox1.TabIndex = 1;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "LSL-Editor";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(72, 112);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(16, 13);
- this.label2.TabIndex = 4;
- this.label2.Text = "...";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(16, 112);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(45, 13);
- this.label1.TabIndex = 3;
- this.label1.Text = "Version:";
- //
- // webBrowser1
- //
- this.webBrowser1.Location = new System.Drawing.Point(8, 128);
- this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
- this.webBrowser1.Name = "webBrowser1";
- this.webBrowser1.Size = new System.Drawing.Size(304, 224);
- this.webBrowser1.TabIndex = 2;
- //
- // linkLabel1
- //
- this.linkLabel1.AutoSize = true;
- this.linkLabel1.Location = new System.Drawing.Point(16, 96);
- this.linkLabel1.Name = "linkLabel1";
- this.linkLabel1.Size = new System.Drawing.Size(79, 13);
- this.linkLabel1.TabIndex = 1;
- this.linkLabel1.TabStop = true;
- this.linkLabel1.Text = "© 2006 — 2012";
- this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(240, 376);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 2;
- this.button1.Text = "Ok";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // About
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.White;
- this.ClientSize = new System.Drawing.Size(352, 410);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "About";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "About";
- this.Load += new System.EventHandler(this.About_Load);
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
- }
-}
+namespace LSLEditor
+{
+ ///
+ /// About dialogue box form.
+ ///
+ public partial class About
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Container for LSLife picture.
+ ///
+ private System.Windows.Forms.PictureBox pictureBox1;
+
+ ///
+ /// Container to hold all the elements.
+ ///
+ private System.Windows.Forms.GroupBox groupBox1;
+
+ ///
+ /// OK Button.
+ ///
+ private System.Windows.Forms.Button button1;
+
+ ///
+ /// Web Browser.
+ ///
+ private System.Windows.Forms.WebBrowser webBrowser1;
+
+ ///
+ /// Link label.
+ ///
+ private System.Windows.Forms.LinkLabel linkLabel1;
+
+ ///
+ /// Version label.
+ ///
+ private System.Windows.Forms.Label label1;
+
+ ///
+ /// LSL Editor label.
+ ///
+ private System.Windows.Forms.Label label2;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// True if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (this.components != null)) {
+ this.components.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.webBrowser1 = new System.Windows.Forms.WebBrowser();
+ this.linkLabel1 = new System.Windows.Forms.LinkLabel();
+ this.button1 = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Image = global::LSLEditor.Properties.Resources.logo;
+ this.pictureBox1.Location = new System.Drawing.Point(16, 16);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(184, 80);
+ this.pictureBox1.TabIndex = 0;
+ this.pictureBox1.TabStop = false;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.webBrowser1);
+ this.groupBox1.Controls.Add(this.linkLabel1);
+ this.groupBox1.Controls.Add(this.pictureBox1);
+ this.groupBox1.Location = new System.Drawing.Point(16, 8);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(320, 360);
+ this.groupBox1.TabIndex = 1;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "LSL-Editor";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(72, 112);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(16, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "...";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(16, 112);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(45, 13);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Version:";
+ //
+ // webBrowser1
+ //
+ this.webBrowser1.Location = new System.Drawing.Point(8, 128);
+ this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
+ this.webBrowser1.Name = "webBrowser1";
+ this.webBrowser1.Size = new System.Drawing.Size(304, 224);
+ this.webBrowser1.TabIndex = 2;
+ //
+ // linkLabel1
+ //
+ this.linkLabel1.AutoSize = true;
+ this.linkLabel1.Location = new System.Drawing.Point(16, 96);
+ this.linkLabel1.Name = "linkLabel1";
+ this.linkLabel1.Size = new System.Drawing.Size(79, 13);
+ this.linkLabel1.TabIndex = 1;
+ this.linkLabel1.TabStop = true;
+ this.linkLabel1.Text = "© 2006 — 2012";
+ this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(240, 376);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 2;
+ this.button1.Text = "Ok";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // About
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.White;
+ this.ClientSize = new System.Drawing.Size(352, 410);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.groupBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "About";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "About";
+ this.Load += new System.EventHandler(this.About_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/About.cs b/source/About.cs
similarity index 97%
rename from trunk/About.cs
rename to source/About.cs
index bd69ff2..f4cfea7 100644
--- a/trunk/About.cs
+++ b/source/About.cs
@@ -1,100 +1,100 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-// About.cs
-// Provides the code for the About dialogue
-//
-
-using System;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using System.IO;
-using System.Reflection;
-using System.Windows.Forms;
-
-namespace LSLEditor
-{
- ///
- /// About dialogue box form.
- ///
- public partial class About : Form
- {
- ///
- /// Initialises a new instance of the class.
- ///
- /// The parent form.
- [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1642:ConstructorSummaryDocumentationMustBeginWithStandardText", Justification = "Reviewed.")]
- public About(LSLEditorForm parent)
- {
- this.InitializeComponent();
-
- this.Icon = parent.Icon;
-
- string strVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
- this.label2.Text = strVersion;
- }
-
- ///
- /// OK/Close button.
- ///
- ///
- ///
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- ///
- /// Link to SourceForge page.
- ///
- ///
- ///
- private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- System.Diagnostics.Process.Start(Properties.Settings.Default.ContactUrl);
- }
-
- ///
- /// Loads the page.
- ///
- ///
- ///
- private void About_Load(object sender, EventArgs e)
- {
- string strExeFileName = Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase);
- this.webBrowser1.Navigate("res://" + strExeFileName + "/" + Properties.Settings.Default.About);
- }
- }
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+// About.cs
+// Provides the code for the About dialogue
+//
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+using System.IO;
+using System.Reflection;
+using System.Windows.Forms;
+
+namespace LSLEditor
+{
+ ///
+ /// About dialogue box form.
+ ///
+ public partial class About : Form
+ {
+ ///
+ /// Initialises a new instance of the class.
+ ///
+ /// The parent form.
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1642:ConstructorSummaryDocumentationMustBeginWithStandardText", Justification = "Reviewed.")]
+ public About(LSLEditorForm parent)
+ {
+ this.InitializeComponent();
+
+ this.Icon = parent.Icon;
+
+ string strVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ this.label2.Text = strVersion;
+ }
+
+ ///
+ /// OK/Close button.
+ ///
+ ///
+ ///
+ private void button1_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ ///
+ /// Link to SourceForge page.
+ ///
+ ///
+ ///
+ private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+ {
+ System.Diagnostics.Process.Start(Properties.Settings.Default.ContactUrl);
+ }
+
+ ///
+ /// Loads the page.
+ ///
+ ///
+ ///
+ private void About_Load(object sender, EventArgs e)
+ {
+ string strExeFileName = Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase);
+ this.webBrowser1.Navigate("res://" + strExeFileName + "/" + Properties.Settings.Default.About);
+ }
+ }
}
\ No newline at end of file
diff --git a/trunk/About.resx b/source/About.resx
similarity index 97%
rename from trunk/About.resx
rename to source/About.resx
index ff31a6d..19dc0dd 100644
--- a/trunk/About.resx
+++ b/source/About.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/trunk/App.ico b/source/App.ico
similarity index 100%
rename from trunk/App.ico
rename to source/App.ico
diff --git a/trunk/BZip2Decompress/BZip2.cs b/source/BZip2Decompress/BZip2.cs
similarity index 97%
rename from trunk/BZip2Decompress/BZip2.cs
rename to source/BZip2Decompress/BZip2.cs
index ceb6cc7..9adad89 100644
--- a/trunk/BZip2Decompress/BZip2.cs
+++ b/source/BZip2Decompress/BZip2.cs
@@ -1,63 +1,63 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-
-// BZip2.Decompress(File.OpenRead("in"), File.Create("out"));
-
-
-namespace LSLEditor.Decompressor
-{
- public sealed class BZip2
- {
- public static void Decompress(Stream inStream, Stream outStream)
- {
- using ( outStream ) {
- using ( BZip2InputStream bzis = new BZip2InputStream(inStream) ) {
- int ch = bzis.ReadByte();
- while (ch != -1) {
- outStream.WriteByte((byte)ch);
- ch = bzis.ReadByte();
- }
- }
- }
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+
+// BZip2.Decompress(File.OpenRead("in"), File.Create("out"));
+
+
+namespace LSLEditor.Decompressor
+{
+ public sealed class BZip2
+ {
+ public static void Decompress(Stream inStream, Stream outStream)
+ {
+ using ( outStream ) {
+ using ( BZip2InputStream bzis = new BZip2InputStream(inStream) ) {
+ int ch = bzis.ReadByte();
+ while (ch != -1) {
+ outStream.WriteByte((byte)ch);
+ ch = bzis.ReadByte();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/trunk/BZip2Decompress/BZip2Constants.cs b/source/BZip2Decompress/BZip2Constants.cs
similarity index 97%
rename from trunk/BZip2Decompress/BZip2Constants.cs
rename to source/BZip2Decompress/BZip2Constants.cs
index 618c2cd..a936abe 100644
--- a/trunk/BZip2Decompress/BZip2Constants.cs
+++ b/source/BZip2Decompress/BZip2Constants.cs
@@ -1,161 +1,161 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-namespace LSLEditor.Decompressor
-{
-
- ///
- /// Defines internal values for both compression and decompression
- ///
- public sealed class BZip2Constants
- {
- ///
- /// Random numbers used to randomise repetitive blocks
- ///
- public readonly static int[] rNums = {
- 619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
- 985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
- 733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
- 419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
- 878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
- 862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
- 150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
- 170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
- 73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
- 909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
- 641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
- 161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
- 382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
- 98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
- 227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
- 469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
- 184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
- 715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
- 951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
- 652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
- 645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
- 609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
- 653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
- 411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
- 170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
- 857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
- 669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
- 944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
- 344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
- 897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
- 433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
- 686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
- 946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
- 978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
- 680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
- 707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
- 297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
- 134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
- 343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
- 140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
- 170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
- 369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
- 804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
- 896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
- 661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
- 768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
- 61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
- 372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
- 780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
- 920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
- 645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
- 936, 638
- };
-
- ///
- /// When multiplied by compression parameter (1-9) gives the block size for compression
- /// 9 gives the best compresssion but uses the most memory.
- ///
- public const int baseBlockSize = 100000;
-
- ///
- /// Backend constant
- ///
- public const int MAX_ALPHA_SIZE = 258;
-
- ///
- /// Backend constant
- ///
- public const int MAX_CODE_LEN = 23;
-
- ///
- /// Backend constant
- ///
- public const int RUNA = 0;
-
- ///
- /// Backend constant
- ///
- public const int RUNB = 1;
-
- ///
- /// Backend constant
- ///
- public const int N_GROUPS = 6;
-
- ///
- /// Backend constant
- ///
- public const int G_SIZE = 50;
-
- ///
- /// Backend constant
- ///
- public const int N_ITERS = 4;
-
- ///
- /// Backend constant
- ///
- public const int MAX_SELECTORS = (2 + (900000 / G_SIZE));
-
- ///
- /// Backend constant
- ///
- public const int NUM_OVERSHOOT_BYTES = 20;
-
- private BZip2Constants()
- {
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+namespace LSLEditor.Decompressor
+{
+
+ ///
+ /// Defines internal values for both compression and decompression
+ ///
+ public sealed class BZip2Constants
+ {
+ ///
+ /// Random numbers used to randomise repetitive blocks
+ ///
+ public readonly static int[] rNums = {
+ 619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
+ 985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
+ 733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
+ 419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
+ 878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
+ 862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
+ 150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
+ 170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
+ 73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
+ 909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
+ 641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
+ 161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
+ 382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
+ 98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
+ 227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
+ 469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
+ 184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
+ 715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
+ 951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
+ 652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
+ 645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
+ 609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
+ 653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
+ 411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
+ 170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
+ 857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
+ 669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
+ 944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
+ 344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
+ 897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
+ 433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
+ 686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
+ 946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
+ 978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
+ 680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
+ 707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
+ 297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
+ 134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
+ 343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
+ 140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
+ 170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
+ 369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
+ 804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
+ 896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
+ 661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
+ 768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
+ 61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
+ 372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
+ 780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
+ 920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
+ 645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
+ 936, 638
+ };
+
+ ///
+ /// When multiplied by compression parameter (1-9) gives the block size for compression
+ /// 9 gives the best compresssion but uses the most memory.
+ ///
+ public const int baseBlockSize = 100000;
+
+ ///
+ /// Backend constant
+ ///
+ public const int MAX_ALPHA_SIZE = 258;
+
+ ///
+ /// Backend constant
+ ///
+ public const int MAX_CODE_LEN = 23;
+
+ ///
+ /// Backend constant
+ ///
+ public const int RUNA = 0;
+
+ ///
+ /// Backend constant
+ ///
+ public const int RUNB = 1;
+
+ ///
+ /// Backend constant
+ ///
+ public const int N_GROUPS = 6;
+
+ ///
+ /// Backend constant
+ ///
+ public const int G_SIZE = 50;
+
+ ///
+ /// Backend constant
+ ///
+ public const int N_ITERS = 4;
+
+ ///
+ /// Backend constant
+ ///
+ public const int MAX_SELECTORS = (2 + (900000 / G_SIZE));
+
+ ///
+ /// Backend constant
+ ///
+ public const int NUM_OVERSHOOT_BYTES = 20;
+
+ private BZip2Constants()
+ {
+ }
+ }
+}
diff --git a/trunk/BZip2Decompress/BZip2InputStream.cs b/source/BZip2Decompress/BZip2InputStream.cs
similarity index 95%
rename from trunk/BZip2Decompress/BZip2InputStream.cs
rename to source/BZip2Decompress/BZip2InputStream.cs
index c10b3e3..1f2123d 100644
--- a/trunk/BZip2Decompress/BZip2InputStream.cs
+++ b/source/BZip2Decompress/BZip2InputStream.cs
@@ -1,963 +1,963 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-
-namespace LSLEditor.Decompressor
-{
-
- ///
- /// An input stream that decompresses files in the BZip2 format
- ///
- public class BZip2InputStream : Stream
- {
- #region Constants
- const int START_BLOCK_STATE = 1;
- const int RAND_PART_A_STATE = 2;
- const int RAND_PART_B_STATE = 3;
- const int RAND_PART_C_STATE = 4;
- const int NO_RAND_PART_A_STATE = 5;
- const int NO_RAND_PART_B_STATE = 6;
- const int NO_RAND_PART_C_STATE = 7;
- #endregion
- #region Constructors
- ///
- /// Construct instance for reading from stream
- ///
- /// Data source
- public BZip2InputStream(Stream stream)
- {
- // init arrays
- for (int i = 0; i < BZip2Constants.N_GROUPS; ++i)
- {
- limit[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
- baseArray[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
- perm[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
- }
-
- BsSetStream(stream);
- Initialize();
- InitBlock();
- SetupBlock();
- }
-
- #endregion
-
- ///
- /// Get/set flag indicating ownership of underlying stream.
- /// When the flag is true will close the underlying stream also.
- ///
- public bool IsStreamOwner
- {
- get { return isStreamOwner; }
- set { isStreamOwner = value; }
- }
-
-
- #region Stream Overrides
- ///
- /// Gets a value indicating if the stream supports reading
- ///
- public override bool CanRead
- {
- get {
- return baseStream.CanRead;
- }
- }
-
- ///
- /// Gets a value indicating whether the current stream supports seeking.
- ///
- public override bool CanSeek {
- get {
- return baseStream.CanSeek;
- }
- }
-
- ///
- /// Gets a value indicating whether the current stream supports writing.
- /// This property always returns false
- ///
- public override bool CanWrite {
- get {
- return false;
- }
- }
-
- ///
- /// Gets the length in bytes of the stream.
- ///
- public override long Length {
- get {
- return baseStream.Length;
- }
- }
-
- ///
- /// Gets or sets the streams position.
- /// Setting the position is not supported and will throw a NotSupportException
- ///
- /// Any attempt to set the position
- public override long Position {
- get {
- return baseStream.Position;
- }
- set {
- throw new NotSupportedException("BZip2InputStream position cannot be set");
- }
- }
-
- ///
- /// Flushes the stream.
- ///
- public override void Flush()
- {
- if (baseStream != null) {
- baseStream.Flush();
- }
- }
-
- ///
- /// Set the streams position. This operation is not supported and will throw a NotSupportedException
- ///
- /// Any access
- public override long Seek(long offset, SeekOrigin origin)
- {
- throw new NotSupportedException("BZip2InputStream Seek not supported");
- }
-
- ///
- /// Sets the length of this stream to the given value.
- /// This operation is not supported and will throw a NotSupportedExceptionortedException
- ///
- /// Any access
- public override void SetLength(long value)
- {
- throw new NotSupportedException("BZip2InputStream SetLength not supported");
- }
-
- ///
- /// Writes a block of bytes to this stream using data from a buffer.
- /// This operation is not supported and will throw a NotSupportedException
- ///
- /// Any access
- public override void Write(byte[] buffer, int offset, int count)
- {
- throw new NotSupportedException("BZip2InputStream Write not supported");
- }
-
- ///
- /// Writes a byte to the current position in the file stream.
- /// This operation is not supported and will throw a NotSupportedException
- ///
- /// The value to write.
- /// Any access
- public override void WriteByte(byte value)
- {
- throw new NotSupportedException("BZip2InputStream WriteByte not supported");
- }
-
- ///
- /// Read a sequence of bytes and advances the read position by one byte.
- ///
- /// Array of bytes to store values in
- /// Offset in array to begin storing data
- /// The maximum number of bytes to read
- /// The total number of bytes read into the buffer. This might be less
- /// than the number of bytes requested if that number of bytes are not
- /// currently available or zero if the end of the stream is reached.
- ///
- public override int Read(byte[] buffer, int offset, int count)
- {
- if ( buffer == null )
- {
- throw new ArgumentNullException("buffer");
- }
-
- for (int i = 0; i < count; ++i) {
- int rb = ReadByte();
- if (rb == -1) {
- return i;
- }
- buffer[offset + i] = (byte)rb;
- }
- return count;
- }
-
- ///
- /// Closes the stream, releasing any associated resources.
- ///
- public override void Close()
- {
- if ( IsStreamOwner && (baseStream != null) ) {
- baseStream.Close();
- }
- }
- ///
- /// Read a byte from stream advancing position
- ///
- /// byte read or -1 on end of stream
- public override int ReadByte()
- {
- if (streamEnd)
- {
- return -1; // ok
- }
-
- int retChar = currentChar;
- switch (currentState)
- {
- case RAND_PART_B_STATE:
- SetupRandPartB();
- break;
- case RAND_PART_C_STATE:
- SetupRandPartC();
- break;
- case NO_RAND_PART_B_STATE:
- SetupNoRandPartB();
- break;
- case NO_RAND_PART_C_STATE:
- SetupNoRandPartC();
- break;
- case START_BLOCK_STATE:
- case NO_RAND_PART_A_STATE:
- case RAND_PART_A_STATE:
- break;
- default:
- break;
- }
- return retChar;
- }
-
- #endregion
-
- void MakeMaps()
- {
- nInUse = 0;
- for (int i = 0; i < 256; ++i) {
- if (inUse[i]) {
- seqToUnseq[nInUse] = (byte)i;
- unseqToSeq[i] = (byte)nInUse;
- nInUse++;
- }
- }
- }
-
- void Initialize()
- {
- char magic1 = BsGetUChar();
- char magic2 = BsGetUChar();
-
- char magic3 = BsGetUChar();
- char magic4 = BsGetUChar();
-
- if (magic1 != 'B' || magic2 != 'Z' || magic3 != 'h' || magic4 < '1' || magic4 > '9') {
- streamEnd = true;
- return;
- }
-
- SetDecompressStructureSizes(magic4 - '0');
- computedCombinedCRC = 0;
- }
-
- void InitBlock()
- {
- char magic1 = BsGetUChar();
- char magic2 = BsGetUChar();
- char magic3 = BsGetUChar();
- char magic4 = BsGetUChar();
- char magic5 = BsGetUChar();
- char magic6 = BsGetUChar();
-
- if (magic1 == 0x17 && magic2 == 0x72 && magic3 == 0x45 && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90) {
- Complete();
- return;
- }
-
- if (magic1 != 0x31 || magic2 != 0x41 || magic3 != 0x59 || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59) {
- BadBlockHeader();
- streamEnd = true;
- return;
- }
-
- storedBlockCRC = BsGetInt32();
-
- blockRandomised = (BsR(1) == 1);
-
- GetAndMoveToFrontDecode();
-
- mCrc.Reset();
- currentState = START_BLOCK_STATE;
- }
-
- void EndBlock()
- {
- computedBlockCRC = (int)mCrc.Value;
-
- // -- A bad CRC is considered a fatal error. --
- if (storedBlockCRC != computedBlockCRC) {
- CrcError();
- }
-
- // 1528150659
- computedCombinedCRC = ((computedCombinedCRC << 1) & 0xFFFFFFFF) | (computedCombinedCRC >> 31);
- computedCombinedCRC = computedCombinedCRC ^ (uint)computedBlockCRC;
- }
-
- void Complete()
- {
- storedCombinedCRC = BsGetInt32();
- if (storedCombinedCRC != (int)computedCombinedCRC) {
- CrcError();
- }
-
- streamEnd = true;
- }
-
- void BsSetStream(Stream stream)
- {
- baseStream = stream;
- bsLive = 0;
- bsBuff = 0;
- }
-
- void FillBuffer()
- {
- int thech = 0;
-
- try {
- thech = baseStream.ReadByte();
- } catch (Exception) {
- CompressedStreamEOF();
- }
-
- if (thech == -1) {
- CompressedStreamEOF();
- }
-
- bsBuff = (bsBuff << 8) | (thech & 0xFF);
- bsLive += 8;
- }
-
- int BsR(int n)
- {
- while (bsLive < n) {
- FillBuffer();
- }
-
- int v = (bsBuff >> (bsLive - n)) & ((1 << n) - 1);
- bsLive -= n;
- return v;
- }
-
- char BsGetUChar()
- {
- return (char)BsR(8);
- }
-
- int BsGetint()
- {
- int u = BsR(8);
- u = (u << 8) | BsR(8);
- u = (u << 8) | BsR(8);
- u = (u << 8) | BsR(8);
- return u;
- }
-
- int BsGetIntVS(int numBits)
- {
- return BsR(numBits);
- }
-
- int BsGetInt32()
- {
- return BsGetint();
- }
-
- void RecvDecodingTables()
- {
- char[][] len = new char[BZip2Constants.N_GROUPS][];
- for (int i = 0; i < BZip2Constants.N_GROUPS; ++i) {
- len[i] = new char[BZip2Constants.MAX_ALPHA_SIZE];
- }
-
- bool[] inUse16 = new bool[16];
-
- //--- Receive the mapping table ---
- for (int i = 0; i < 16; i++) {
- inUse16[i] = (BsR(1) == 1);
- }
-
- for (int i = 0; i < 16; i++) {
- if (inUse16[i]) {
- for (int j = 0; j < 16; j++) {
- inUse[i * 16 + j] = (BsR(1) == 1);
- }
- } else {
- for (int j = 0; j < 16; j++) {
- inUse[i * 16 + j] = false;
- }
- }
- }
-
- MakeMaps();
- int alphaSize = nInUse + 2;
-
- //--- Now the selectors ---
- int nGroups = BsR(3);
- int nSelectors = BsR(15);
-
- for (int i = 0; i < nSelectors; i++) {
- int j = 0;
- while (BsR(1) == 1) {
- j++;
- }
- selectorMtf[i] = (byte)j;
- }
-
- //--- Undo the MTF values for the selectors. ---
- byte[] pos = new byte[BZip2Constants.N_GROUPS];
- for (int v = 0; v < nGroups; v++) {
- pos[v] = (byte)v;
- }
-
- for (int i = 0; i < nSelectors; i++) {
- int v = selectorMtf[i];
- byte tmp = pos[v];
- while (v > 0) {
- pos[v] = pos[v - 1];
- v--;
- }
- pos[0] = tmp;
- selector[i] = tmp;
- }
-
- //--- Now the coding tables ---
- for (int t = 0; t < nGroups; t++) {
- int curr = BsR(5);
- for (int i = 0; i < alphaSize; i++) {
- while (BsR(1) == 1) {
- if (BsR(1) == 0) {
- curr++;
- } else {
- curr--;
- }
- }
- len[t][i] = (char)curr;
- }
- }
-
- //--- Create the Huffman decoding tables ---
- for (int t = 0; t < nGroups; t++) {
- int minLen = 32;
- int maxLen = 0;
- for (int i = 0; i < alphaSize; i++) {
- maxLen = Math.Max(maxLen, len[t][i]);
- minLen = Math.Min(minLen, len[t][i]);
- }
- HbCreateDecodeTables(limit[t], baseArray[t], perm[t], len[t], minLen, maxLen, alphaSize);
- minLens[t] = minLen;
- }
- }
-
- void GetAndMoveToFrontDecode()
- {
- byte[] yy = new byte[256];
- int nextSym;
-
- int limitLast = BZip2Constants.baseBlockSize * blockSize100k;
- origPtr = BsGetIntVS(24);
-
- RecvDecodingTables();
- int EOB = nInUse+1;
- int groupNo = -1;
- int groupPos = 0;
-
- /*--
- Setting up the unzftab entries here is not strictly
- necessary, but it does save having to do it later
- in a separate pass, and so saves a block's worth of
- cache misses.
- --*/
- for (int i = 0; i <= 255; i++) {
- unzftab[i] = 0;
- }
-
- for (int i = 0; i <= 255; i++) {
- yy[i] = (byte)i;
- }
-
- last = -1;
-
- if (groupPos == 0) {
- groupNo++;
- groupPos = BZip2Constants.G_SIZE;
- }
-
- groupPos--;
- int zt = selector[groupNo];
- int zn = minLens[zt];
- int zvec = BsR(zn);
- int zj;
-
- while (zvec > limit[zt][zn]) {
- if (zn > 20) { // the longest code
- throw new Exception("Bzip data error");
- }
- zn++;
- while (bsLive < 1) {
- FillBuffer();
- }
- zj = (bsBuff >> (bsLive-1)) & 1;
- bsLive--;
- zvec = (zvec << 1) | zj;
- }
- if (zvec - baseArray[zt][zn] < 0 || zvec - baseArray[zt][zn] >= BZip2Constants.MAX_ALPHA_SIZE) {
- throw new Exception("Bzip data error");
- }
- nextSym = perm[zt][zvec - baseArray[zt][zn]];
-
- while (true) {
- if (nextSym == EOB) {
- break;
- }
-
- if (nextSym == BZip2Constants.RUNA || nextSym == BZip2Constants.RUNB) {
- int s = -1;
- int n = 1;
- do {
- if (nextSym == BZip2Constants.RUNA) {
- s += (0 + 1) * n;
- } else if (nextSym == BZip2Constants.RUNB) {
- s += (1 + 1) * n;
- }
-
- n <<= 1;
-
- if (groupPos == 0) {
- groupNo++;
- groupPos = BZip2Constants.G_SIZE;
- }
-
- groupPos--;
-
- zt = selector[groupNo];
- zn = minLens[zt];
- zvec = BsR(zn);
-
- while (zvec > limit[zt][zn]) {
- zn++;
- while (bsLive < 1) {
- FillBuffer();
- }
- zj = (bsBuff >> (bsLive - 1)) & 1;
- bsLive--;
- zvec = (zvec << 1) | zj;
- }
- nextSym = perm[zt][zvec - baseArray[zt][zn]];
- } while (nextSym == BZip2Constants.RUNA || nextSym == BZip2Constants.RUNB);
-
- s++;
- byte ch = seqToUnseq[yy[0]];
- unzftab[ch] += s;
-
- while (s > 0) {
- last++;
- ll8[last] = ch;
- s--;
- }
-
- if (last >= limitLast) {
- BlockOverrun();
- }
- continue;
- } else {
- last++;
- if (last >= limitLast) {
- BlockOverrun();
- }
-
- byte tmp = yy[nextSym - 1];
- unzftab[seqToUnseq[tmp]]++;
- ll8[last] = seqToUnseq[tmp];
-
- for (int j = nextSym-1; j > 0; --j) {
- yy[j] = yy[j - 1];
- }
- yy[0] = tmp;
-
- if (groupPos == 0) {
- groupNo++;
- groupPos = BZip2Constants.G_SIZE;
- }
-
- groupPos--;
- zt = selector[groupNo];
- zn = minLens[zt];
- zvec = BsR(zn);
- while (zvec > limit[zt][zn]) {
- zn++;
- while (bsLive < 1) {
- FillBuffer();
- }
- zj = (bsBuff >> (bsLive-1)) & 1;
- bsLive--;
- zvec = (zvec << 1) | zj;
- }
- nextSym = perm[zt][zvec - baseArray[zt][zn]];
- continue;
- }
- }
- }
-
- void SetupBlock()
- {
- int[] cftab = new int[257];
-
- cftab[0] = 0;
- Array.Copy(unzftab, 0, cftab, 1, 256);
-
- for (int i = 1; i <= 256; i++) {
- cftab[i] += cftab[i - 1];
- }
-
- for (int i = 0; i <= last; i++) {
- byte ch = ll8[i];
- tt[cftab[ch]] = i;
- cftab[ch]++;
- }
-
- cftab = null;
-
- tPos = tt[origPtr];
-
- count = 0;
- i2 = 0;
- ch2 = 256; /*-- not a char and not EOF --*/
-
- if (blockRandomised) {
- rNToGo = 0;
- rTPos = 0;
- SetupRandPartA();
- } else {
- SetupNoRandPartA();
- }
- }
-
- void SetupRandPartA()
- {
- if (i2 <= last) {
- chPrev = ch2;
- ch2 = ll8[tPos];
- tPos = tt[tPos];
- if (rNToGo == 0) {
- rNToGo = BZip2Constants.rNums[rTPos];
- rTPos++;
- if (rTPos == 512) {
- rTPos = 0;
- }
- }
- rNToGo--;
- ch2 ^= (int)((rNToGo == 1) ? 1 : 0);
- i2++;
-
- currentChar = ch2;
- currentState = RAND_PART_B_STATE;
- mCrc.Update(ch2);
- } else {
- EndBlock();
- InitBlock();
- SetupBlock();
- }
- }
-
- void SetupNoRandPartA()
- {
- if (i2 <= last) {
- chPrev = ch2;
- ch2 = ll8[tPos];
- tPos = tt[tPos];
- i2++;
-
- currentChar = ch2;
- currentState = NO_RAND_PART_B_STATE;
- mCrc.Update(ch2);
- } else {
- EndBlock();
- InitBlock();
- SetupBlock();
- }
- }
-
- void SetupRandPartB()
- {
- if (ch2 != chPrev) {
- currentState = RAND_PART_A_STATE;
- count = 1;
- SetupRandPartA();
- } else {
- count++;
- if (count >= 4) {
- z = ll8[tPos];
- tPos = tt[tPos];
- if (rNToGo == 0) {
- rNToGo = BZip2Constants.rNums[rTPos];
- rTPos++;
- if (rTPos == 512) {
- rTPos = 0;
- }
- }
- rNToGo--;
- z ^= (byte)((rNToGo == 1) ? 1 : 0);
- j2 = 0;
- currentState = RAND_PART_C_STATE;
- SetupRandPartC();
- } else {
- currentState = RAND_PART_A_STATE;
- SetupRandPartA();
- }
- }
- }
-
- void SetupRandPartC()
- {
- if (j2 < (int)z) {
- currentChar = ch2;
- mCrc.Update(ch2);
- j2++;
- } else {
- currentState = RAND_PART_A_STATE;
- i2++;
- count = 0;
- SetupRandPartA();
- }
- }
-
- void SetupNoRandPartB()
- {
- if (ch2 != chPrev) {
- currentState = NO_RAND_PART_A_STATE;
- count = 1;
- SetupNoRandPartA();
- } else {
- count++;
- if (count >= 4) {
- z = ll8[tPos];
- tPos = tt[tPos];
- currentState = NO_RAND_PART_C_STATE;
- j2 = 0;
- SetupNoRandPartC();
- } else {
- currentState = NO_RAND_PART_A_STATE;
- SetupNoRandPartA();
- }
- }
- }
-
- void SetupNoRandPartC()
- {
- if (j2 < (int)z) {
- currentChar = ch2;
- mCrc.Update(ch2);
- j2++;
- } else {
- currentState = NO_RAND_PART_A_STATE;
- i2++;
- count = 0;
- SetupNoRandPartA();
- }
- }
-
- void SetDecompressStructureSizes(int newSize100k)
- {
- if (!(0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k && blockSize100k <= 9)) {
- throw new Exception("Invalid block size");
- }
-
- blockSize100k = newSize100k;
-
- if (newSize100k == 0) {
- return;
- }
-
- int n = BZip2Constants.baseBlockSize * newSize100k;
- ll8 = new byte[n];
- tt = new int[n];
- }
-
- static void CompressedStreamEOF()
- {
- throw new Exception("BZip2 input stream end of compressed stream");
- }
-
- static void BlockOverrun()
- {
- throw new Exception("BZip2 input stream block overrun");
- }
-
- static void BadBlockHeader()
- {
- throw new Exception("BZip2 input stream bad block header");
- }
-
- static void CrcError()
- {
- throw new Exception("BZip2 input stream crc error");
- }
-
- static void HbCreateDecodeTables(int[] limit, int[] baseArray, int[] perm, char[] length, int minLen, int maxLen, int alphaSize)
- {
- int pp = 0;
-
- for (int i = minLen; i <= maxLen; ++i)
- {
- for (int j = 0; j < alphaSize; ++j)
- {
- if (length[j] == i)
- {
- perm[pp] = j;
- ++pp;
- }
- }
- }
-
- for (int i = 0; i < BZip2Constants.MAX_CODE_LEN; i++)
- {
- baseArray[i] = 0;
- }
-
- for (int i = 0; i < alphaSize; i++)
- {
- ++baseArray[length[i] + 1];
- }
-
- for (int i = 1; i < BZip2Constants.MAX_CODE_LEN; i++)
- {
- baseArray[i] += baseArray[i - 1];
- }
-
- for (int i = 0; i < BZip2Constants.MAX_CODE_LEN; i++)
- {
- limit[i] = 0;
- }
-
- int vec = 0;
-
- for (int i = minLen; i <= maxLen; i++)
- {
- vec += (baseArray[i + 1] - baseArray[i]);
- limit[i] = vec - 1;
- vec <<= 1;
- }
-
- for (int i = minLen + 1; i <= maxLen; i++)
- {
- baseArray[i] = ((limit[i - 1] + 1) << 1) - baseArray[i];
- }
- }
-
- #region Instance Fields
- /*--
- index of the last char in the block, so
- the block size == last + 1.
- --*/
- int last;
-
- /*--
- index in zptr[] of original string after sorting.
- --*/
- int origPtr;
-
- /*--
- always: in the range 0 .. 9.
- The current block size is 100000 * this number.
- --*/
- int blockSize100k;
-
- bool blockRandomised;
-
- int bsBuff;
- int bsLive;
- IChecksum mCrc = new StrangeCRC();
-
- bool[] inUse = new bool[256];
- int nInUse;
-
- byte[] seqToUnseq = new byte[256];
- byte[] unseqToSeq = new byte[256];
-
- byte[] selector = new byte[BZip2Constants.MAX_SELECTORS];
- byte[] selectorMtf = new byte[BZip2Constants.MAX_SELECTORS];
-
- int[] tt;
- byte[] ll8;
-
- /*--
- freq table collected to save a pass over the data
- during decompression.
- --*/
- int[] unzftab = new int[256];
-
- int[][] limit = new int[BZip2Constants.N_GROUPS][];
- int[][] baseArray = new int[BZip2Constants.N_GROUPS][];
- int[][] perm = new int[BZip2Constants.N_GROUPS][];
- int[] minLens = new int[BZip2Constants.N_GROUPS];
-
- Stream baseStream;
- bool streamEnd;
-
- int currentChar = -1;
-
- int currentState = START_BLOCK_STATE;
-
- int storedBlockCRC, storedCombinedCRC;
- int computedBlockCRC;
- uint computedCombinedCRC;
-
- int count, chPrev, ch2;
- int tPos;
- int rNToGo;
- int rTPos;
- int i2, j2;
- byte z;
- bool isStreamOwner = true;
- #endregion
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+
+namespace LSLEditor.Decompressor
+{
+
+ ///
+ /// An input stream that decompresses files in the BZip2 format
+ ///
+ public class BZip2InputStream : Stream
+ {
+ #region Constants
+ const int START_BLOCK_STATE = 1;
+ const int RAND_PART_A_STATE = 2;
+ const int RAND_PART_B_STATE = 3;
+ const int RAND_PART_C_STATE = 4;
+ const int NO_RAND_PART_A_STATE = 5;
+ const int NO_RAND_PART_B_STATE = 6;
+ const int NO_RAND_PART_C_STATE = 7;
+ #endregion
+ #region Constructors
+ ///
+ /// Construct instance for reading from stream
+ ///
+ /// Data source
+ public BZip2InputStream(Stream stream)
+ {
+ // init arrays
+ for (int i = 0; i < BZip2Constants.N_GROUPS; ++i)
+ {
+ limit[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
+ baseArray[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
+ perm[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
+ }
+
+ BsSetStream(stream);
+ Initialize();
+ InitBlock();
+ SetupBlock();
+ }
+
+ #endregion
+
+ ///
+ /// Get/set flag indicating ownership of underlying stream.
+ /// When the flag is true will close the underlying stream also.
+ ///
+ public bool IsStreamOwner
+ {
+ get { return isStreamOwner; }
+ set { isStreamOwner = value; }
+ }
+
+
+ #region Stream Overrides
+ ///
+ /// Gets a value indicating if the stream supports reading
+ ///
+ public override bool CanRead
+ {
+ get {
+ return baseStream.CanRead;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether the current stream supports seeking.
+ ///
+ public override bool CanSeek {
+ get {
+ return baseStream.CanSeek;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether the current stream supports writing.
+ /// This property always returns false
+ ///
+ public override bool CanWrite {
+ get {
+ return false;
+ }
+ }
+
+ ///
+ /// Gets the length in bytes of the stream.
+ ///
+ public override long Length {
+ get {
+ return baseStream.Length;
+ }
+ }
+
+ ///
+ /// Gets or sets the streams position.
+ /// Setting the position is not supported and will throw a NotSupportException
+ ///
+ /// Any attempt to set the position
+ public override long Position {
+ get {
+ return baseStream.Position;
+ }
+ set {
+ throw new NotSupportedException("BZip2InputStream position cannot be set");
+ }
+ }
+
+ ///
+ /// Flushes the stream.
+ ///
+ public override void Flush()
+ {
+ if (baseStream != null) {
+ baseStream.Flush();
+ }
+ }
+
+ ///
+ /// Set the streams position. This operation is not supported and will throw a NotSupportedException
+ ///
+ /// Any access
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ throw new NotSupportedException("BZip2InputStream Seek not supported");
+ }
+
+ ///
+ /// Sets the length of this stream to the given value.
+ /// This operation is not supported and will throw a NotSupportedExceptionortedException
+ ///
+ /// Any access
+ public override void SetLength(long value)
+ {
+ throw new NotSupportedException("BZip2InputStream SetLength not supported");
+ }
+
+ ///
+ /// Writes a block of bytes to this stream using data from a buffer.
+ /// This operation is not supported and will throw a NotSupportedException
+ ///
+ /// Any access
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ throw new NotSupportedException("BZip2InputStream Write not supported");
+ }
+
+ ///
+ /// Writes a byte to the current position in the file stream.
+ /// This operation is not supported and will throw a NotSupportedException
+ ///
+ /// The value to write.
+ /// Any access
+ public override void WriteByte(byte value)
+ {
+ throw new NotSupportedException("BZip2InputStream WriteByte not supported");
+ }
+
+ ///
+ /// Read a sequence of bytes and advances the read position by one byte.
+ ///
+ /// Array of bytes to store values in
+ /// Offset in array to begin storing data
+ /// The maximum number of bytes to read
+ /// The total number of bytes read into the buffer. This might be less
+ /// than the number of bytes requested if that number of bytes are not
+ /// currently available or zero if the end of the stream is reached.
+ ///
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ if ( buffer == null )
+ {
+ throw new ArgumentNullException("buffer");
+ }
+
+ for (int i = 0; i < count; ++i) {
+ int rb = ReadByte();
+ if (rb == -1) {
+ return i;
+ }
+ buffer[offset + i] = (byte)rb;
+ }
+ return count;
+ }
+
+ ///
+ /// Closes the stream, releasing any associated resources.
+ ///
+ public override void Close()
+ {
+ if ( IsStreamOwner && (baseStream != null) ) {
+ baseStream.Close();
+ }
+ }
+ ///
+ /// Read a byte from stream advancing position
+ ///
+ /// byte read or -1 on end of stream
+ public override int ReadByte()
+ {
+ if (streamEnd)
+ {
+ return -1; // ok
+ }
+
+ int retChar = currentChar;
+ switch (currentState)
+ {
+ case RAND_PART_B_STATE:
+ SetupRandPartB();
+ break;
+ case RAND_PART_C_STATE:
+ SetupRandPartC();
+ break;
+ case NO_RAND_PART_B_STATE:
+ SetupNoRandPartB();
+ break;
+ case NO_RAND_PART_C_STATE:
+ SetupNoRandPartC();
+ break;
+ case START_BLOCK_STATE:
+ case NO_RAND_PART_A_STATE:
+ case RAND_PART_A_STATE:
+ break;
+ default:
+ break;
+ }
+ return retChar;
+ }
+
+ #endregion
+
+ void MakeMaps()
+ {
+ nInUse = 0;
+ for (int i = 0; i < 256; ++i) {
+ if (inUse[i]) {
+ seqToUnseq[nInUse] = (byte)i;
+ unseqToSeq[i] = (byte)nInUse;
+ nInUse++;
+ }
+ }
+ }
+
+ void Initialize()
+ {
+ char magic1 = BsGetUChar();
+ char magic2 = BsGetUChar();
+
+ char magic3 = BsGetUChar();
+ char magic4 = BsGetUChar();
+
+ if (magic1 != 'B' || magic2 != 'Z' || magic3 != 'h' || magic4 < '1' || magic4 > '9') {
+ streamEnd = true;
+ return;
+ }
+
+ SetDecompressStructureSizes(magic4 - '0');
+ computedCombinedCRC = 0;
+ }
+
+ void InitBlock()
+ {
+ char magic1 = BsGetUChar();
+ char magic2 = BsGetUChar();
+ char magic3 = BsGetUChar();
+ char magic4 = BsGetUChar();
+ char magic5 = BsGetUChar();
+ char magic6 = BsGetUChar();
+
+ if (magic1 == 0x17 && magic2 == 0x72 && magic3 == 0x45 && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90) {
+ Complete();
+ return;
+ }
+
+ if (magic1 != 0x31 || magic2 != 0x41 || magic3 != 0x59 || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59) {
+ BadBlockHeader();
+ streamEnd = true;
+ return;
+ }
+
+ storedBlockCRC = BsGetInt32();
+
+ blockRandomised = (BsR(1) == 1);
+
+ GetAndMoveToFrontDecode();
+
+ mCrc.Reset();
+ currentState = START_BLOCK_STATE;
+ }
+
+ void EndBlock()
+ {
+ computedBlockCRC = (int)mCrc.Value;
+
+ // -- A bad CRC is considered a fatal error. --
+ if (storedBlockCRC != computedBlockCRC) {
+ CrcError();
+ }
+
+ // 1528150659
+ computedCombinedCRC = ((computedCombinedCRC << 1) & 0xFFFFFFFF) | (computedCombinedCRC >> 31);
+ computedCombinedCRC = computedCombinedCRC ^ (uint)computedBlockCRC;
+ }
+
+ void Complete()
+ {
+ storedCombinedCRC = BsGetInt32();
+ if (storedCombinedCRC != (int)computedCombinedCRC) {
+ CrcError();
+ }
+
+ streamEnd = true;
+ }
+
+ void BsSetStream(Stream stream)
+ {
+ baseStream = stream;
+ bsLive = 0;
+ bsBuff = 0;
+ }
+
+ void FillBuffer()
+ {
+ int thech = 0;
+
+ try {
+ thech = baseStream.ReadByte();
+ } catch (Exception) {
+ CompressedStreamEOF();
+ }
+
+ if (thech == -1) {
+ CompressedStreamEOF();
+ }
+
+ bsBuff = (bsBuff << 8) | (thech & 0xFF);
+ bsLive += 8;
+ }
+
+ int BsR(int n)
+ {
+ while (bsLive < n) {
+ FillBuffer();
+ }
+
+ int v = (bsBuff >> (bsLive - n)) & ((1 << n) - 1);
+ bsLive -= n;
+ return v;
+ }
+
+ char BsGetUChar()
+ {
+ return (char)BsR(8);
+ }
+
+ int BsGetint()
+ {
+ int u = BsR(8);
+ u = (u << 8) | BsR(8);
+ u = (u << 8) | BsR(8);
+ u = (u << 8) | BsR(8);
+ return u;
+ }
+
+ int BsGetIntVS(int numBits)
+ {
+ return BsR(numBits);
+ }
+
+ int BsGetInt32()
+ {
+ return BsGetint();
+ }
+
+ void RecvDecodingTables()
+ {
+ char[][] len = new char[BZip2Constants.N_GROUPS][];
+ for (int i = 0; i < BZip2Constants.N_GROUPS; ++i) {
+ len[i] = new char[BZip2Constants.MAX_ALPHA_SIZE];
+ }
+
+ bool[] inUse16 = new bool[16];
+
+ //--- Receive the mapping table ---
+ for (int i = 0; i < 16; i++) {
+ inUse16[i] = (BsR(1) == 1);
+ }
+
+ for (int i = 0; i < 16; i++) {
+ if (inUse16[i]) {
+ for (int j = 0; j < 16; j++) {
+ inUse[i * 16 + j] = (BsR(1) == 1);
+ }
+ } else {
+ for (int j = 0; j < 16; j++) {
+ inUse[i * 16 + j] = false;
+ }
+ }
+ }
+
+ MakeMaps();
+ int alphaSize = nInUse + 2;
+
+ //--- Now the selectors ---
+ int nGroups = BsR(3);
+ int nSelectors = BsR(15);
+
+ for (int i = 0; i < nSelectors; i++) {
+ int j = 0;
+ while (BsR(1) == 1) {
+ j++;
+ }
+ selectorMtf[i] = (byte)j;
+ }
+
+ //--- Undo the MTF values for the selectors. ---
+ byte[] pos = new byte[BZip2Constants.N_GROUPS];
+ for (int v = 0; v < nGroups; v++) {
+ pos[v] = (byte)v;
+ }
+
+ for (int i = 0; i < nSelectors; i++) {
+ int v = selectorMtf[i];
+ byte tmp = pos[v];
+ while (v > 0) {
+ pos[v] = pos[v - 1];
+ v--;
+ }
+ pos[0] = tmp;
+ selector[i] = tmp;
+ }
+
+ //--- Now the coding tables ---
+ for (int t = 0; t < nGroups; t++) {
+ int curr = BsR(5);
+ for (int i = 0; i < alphaSize; i++) {
+ while (BsR(1) == 1) {
+ if (BsR(1) == 0) {
+ curr++;
+ } else {
+ curr--;
+ }
+ }
+ len[t][i] = (char)curr;
+ }
+ }
+
+ //--- Create the Huffman decoding tables ---
+ for (int t = 0; t < nGroups; t++) {
+ int minLen = 32;
+ int maxLen = 0;
+ for (int i = 0; i < alphaSize; i++) {
+ maxLen = Math.Max(maxLen, len[t][i]);
+ minLen = Math.Min(minLen, len[t][i]);
+ }
+ HbCreateDecodeTables(limit[t], baseArray[t], perm[t], len[t], minLen, maxLen, alphaSize);
+ minLens[t] = minLen;
+ }
+ }
+
+ void GetAndMoveToFrontDecode()
+ {
+ byte[] yy = new byte[256];
+ int nextSym;
+
+ int limitLast = BZip2Constants.baseBlockSize * blockSize100k;
+ origPtr = BsGetIntVS(24);
+
+ RecvDecodingTables();
+ int EOB = nInUse+1;
+ int groupNo = -1;
+ int groupPos = 0;
+
+ /*--
+ Setting up the unzftab entries here is not strictly
+ necessary, but it does save having to do it later
+ in a separate pass, and so saves a block's worth of
+ cache misses.
+ --*/
+ for (int i = 0; i <= 255; i++) {
+ unzftab[i] = 0;
+ }
+
+ for (int i = 0; i <= 255; i++) {
+ yy[i] = (byte)i;
+ }
+
+ last = -1;
+
+ if (groupPos == 0) {
+ groupNo++;
+ groupPos = BZip2Constants.G_SIZE;
+ }
+
+ groupPos--;
+ int zt = selector[groupNo];
+ int zn = minLens[zt];
+ int zvec = BsR(zn);
+ int zj;
+
+ while (zvec > limit[zt][zn]) {
+ if (zn > 20) { // the longest code
+ throw new Exception("Bzip data error");
+ }
+ zn++;
+ while (bsLive < 1) {
+ FillBuffer();
+ }
+ zj = (bsBuff >> (bsLive-1)) & 1;
+ bsLive--;
+ zvec = (zvec << 1) | zj;
+ }
+ if (zvec - baseArray[zt][zn] < 0 || zvec - baseArray[zt][zn] >= BZip2Constants.MAX_ALPHA_SIZE) {
+ throw new Exception("Bzip data error");
+ }
+ nextSym = perm[zt][zvec - baseArray[zt][zn]];
+
+ while (true) {
+ if (nextSym == EOB) {
+ break;
+ }
+
+ if (nextSym == BZip2Constants.RUNA || nextSym == BZip2Constants.RUNB) {
+ int s = -1;
+ int n = 1;
+ do {
+ if (nextSym == BZip2Constants.RUNA) {
+ s += (0 + 1) * n;
+ } else if (nextSym == BZip2Constants.RUNB) {
+ s += (1 + 1) * n;
+ }
+
+ n <<= 1;
+
+ if (groupPos == 0) {
+ groupNo++;
+ groupPos = BZip2Constants.G_SIZE;
+ }
+
+ groupPos--;
+
+ zt = selector[groupNo];
+ zn = minLens[zt];
+ zvec = BsR(zn);
+
+ while (zvec > limit[zt][zn]) {
+ zn++;
+ while (bsLive < 1) {
+ FillBuffer();
+ }
+ zj = (bsBuff >> (bsLive - 1)) & 1;
+ bsLive--;
+ zvec = (zvec << 1) | zj;
+ }
+ nextSym = perm[zt][zvec - baseArray[zt][zn]];
+ } while (nextSym == BZip2Constants.RUNA || nextSym == BZip2Constants.RUNB);
+
+ s++;
+ byte ch = seqToUnseq[yy[0]];
+ unzftab[ch] += s;
+
+ while (s > 0) {
+ last++;
+ ll8[last] = ch;
+ s--;
+ }
+
+ if (last >= limitLast) {
+ BlockOverrun();
+ }
+ continue;
+ } else {
+ last++;
+ if (last >= limitLast) {
+ BlockOverrun();
+ }
+
+ byte tmp = yy[nextSym - 1];
+ unzftab[seqToUnseq[tmp]]++;
+ ll8[last] = seqToUnseq[tmp];
+
+ for (int j = nextSym-1; j > 0; --j) {
+ yy[j] = yy[j - 1];
+ }
+ yy[0] = tmp;
+
+ if (groupPos == 0) {
+ groupNo++;
+ groupPos = BZip2Constants.G_SIZE;
+ }
+
+ groupPos--;
+ zt = selector[groupNo];
+ zn = minLens[zt];
+ zvec = BsR(zn);
+ while (zvec > limit[zt][zn]) {
+ zn++;
+ while (bsLive < 1) {
+ FillBuffer();
+ }
+ zj = (bsBuff >> (bsLive-1)) & 1;
+ bsLive--;
+ zvec = (zvec << 1) | zj;
+ }
+ nextSym = perm[zt][zvec - baseArray[zt][zn]];
+ continue;
+ }
+ }
+ }
+
+ void SetupBlock()
+ {
+ int[] cftab = new int[257];
+
+ cftab[0] = 0;
+ Array.Copy(unzftab, 0, cftab, 1, 256);
+
+ for (int i = 1; i <= 256; i++) {
+ cftab[i] += cftab[i - 1];
+ }
+
+ for (int i = 0; i <= last; i++) {
+ byte ch = ll8[i];
+ tt[cftab[ch]] = i;
+ cftab[ch]++;
+ }
+
+ cftab = null;
+
+ tPos = tt[origPtr];
+
+ count = 0;
+ i2 = 0;
+ ch2 = 256; /*-- not a char and not EOF --*/
+
+ if (blockRandomised) {
+ rNToGo = 0;
+ rTPos = 0;
+ SetupRandPartA();
+ } else {
+ SetupNoRandPartA();
+ }
+ }
+
+ void SetupRandPartA()
+ {
+ if (i2 <= last) {
+ chPrev = ch2;
+ ch2 = ll8[tPos];
+ tPos = tt[tPos];
+ if (rNToGo == 0) {
+ rNToGo = BZip2Constants.rNums[rTPos];
+ rTPos++;
+ if (rTPos == 512) {
+ rTPos = 0;
+ }
+ }
+ rNToGo--;
+ ch2 ^= (int)((rNToGo == 1) ? 1 : 0);
+ i2++;
+
+ currentChar = ch2;
+ currentState = RAND_PART_B_STATE;
+ mCrc.Update(ch2);
+ } else {
+ EndBlock();
+ InitBlock();
+ SetupBlock();
+ }
+ }
+
+ void SetupNoRandPartA()
+ {
+ if (i2 <= last) {
+ chPrev = ch2;
+ ch2 = ll8[tPos];
+ tPos = tt[tPos];
+ i2++;
+
+ currentChar = ch2;
+ currentState = NO_RAND_PART_B_STATE;
+ mCrc.Update(ch2);
+ } else {
+ EndBlock();
+ InitBlock();
+ SetupBlock();
+ }
+ }
+
+ void SetupRandPartB()
+ {
+ if (ch2 != chPrev) {
+ currentState = RAND_PART_A_STATE;
+ count = 1;
+ SetupRandPartA();
+ } else {
+ count++;
+ if (count >= 4) {
+ z = ll8[tPos];
+ tPos = tt[tPos];
+ if (rNToGo == 0) {
+ rNToGo = BZip2Constants.rNums[rTPos];
+ rTPos++;
+ if (rTPos == 512) {
+ rTPos = 0;
+ }
+ }
+ rNToGo--;
+ z ^= (byte)((rNToGo == 1) ? 1 : 0);
+ j2 = 0;
+ currentState = RAND_PART_C_STATE;
+ SetupRandPartC();
+ } else {
+ currentState = RAND_PART_A_STATE;
+ SetupRandPartA();
+ }
+ }
+ }
+
+ void SetupRandPartC()
+ {
+ if (j2 < (int)z) {
+ currentChar = ch2;
+ mCrc.Update(ch2);
+ j2++;
+ } else {
+ currentState = RAND_PART_A_STATE;
+ i2++;
+ count = 0;
+ SetupRandPartA();
+ }
+ }
+
+ void SetupNoRandPartB()
+ {
+ if (ch2 != chPrev) {
+ currentState = NO_RAND_PART_A_STATE;
+ count = 1;
+ SetupNoRandPartA();
+ } else {
+ count++;
+ if (count >= 4) {
+ z = ll8[tPos];
+ tPos = tt[tPos];
+ currentState = NO_RAND_PART_C_STATE;
+ j2 = 0;
+ SetupNoRandPartC();
+ } else {
+ currentState = NO_RAND_PART_A_STATE;
+ SetupNoRandPartA();
+ }
+ }
+ }
+
+ void SetupNoRandPartC()
+ {
+ if (j2 < (int)z) {
+ currentChar = ch2;
+ mCrc.Update(ch2);
+ j2++;
+ } else {
+ currentState = NO_RAND_PART_A_STATE;
+ i2++;
+ count = 0;
+ SetupNoRandPartA();
+ }
+ }
+
+ void SetDecompressStructureSizes(int newSize100k)
+ {
+ if (!(0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k && blockSize100k <= 9)) {
+ throw new Exception("Invalid block size");
+ }
+
+ blockSize100k = newSize100k;
+
+ if (newSize100k == 0) {
+ return;
+ }
+
+ int n = BZip2Constants.baseBlockSize * newSize100k;
+ ll8 = new byte[n];
+ tt = new int[n];
+ }
+
+ static void CompressedStreamEOF()
+ {
+ throw new Exception("BZip2 input stream end of compressed stream");
+ }
+
+ static void BlockOverrun()
+ {
+ throw new Exception("BZip2 input stream block overrun");
+ }
+
+ static void BadBlockHeader()
+ {
+ throw new Exception("BZip2 input stream bad block header");
+ }
+
+ static void CrcError()
+ {
+ throw new Exception("BZip2 input stream crc error");
+ }
+
+ static void HbCreateDecodeTables(int[] limit, int[] baseArray, int[] perm, char[] length, int minLen, int maxLen, int alphaSize)
+ {
+ int pp = 0;
+
+ for (int i = minLen; i <= maxLen; ++i)
+ {
+ for (int j = 0; j < alphaSize; ++j)
+ {
+ if (length[j] == i)
+ {
+ perm[pp] = j;
+ ++pp;
+ }
+ }
+ }
+
+ for (int i = 0; i < BZip2Constants.MAX_CODE_LEN; i++)
+ {
+ baseArray[i] = 0;
+ }
+
+ for (int i = 0; i < alphaSize; i++)
+ {
+ ++baseArray[length[i] + 1];
+ }
+
+ for (int i = 1; i < BZip2Constants.MAX_CODE_LEN; i++)
+ {
+ baseArray[i] += baseArray[i - 1];
+ }
+
+ for (int i = 0; i < BZip2Constants.MAX_CODE_LEN; i++)
+ {
+ limit[i] = 0;
+ }
+
+ int vec = 0;
+
+ for (int i = minLen; i <= maxLen; i++)
+ {
+ vec += (baseArray[i + 1] - baseArray[i]);
+ limit[i] = vec - 1;
+ vec <<= 1;
+ }
+
+ for (int i = minLen + 1; i <= maxLen; i++)
+ {
+ baseArray[i] = ((limit[i - 1] + 1) << 1) - baseArray[i];
+ }
+ }
+
+ #region Instance Fields
+ /*--
+ index of the last char in the block, so
+ the block size == last + 1.
+ --*/
+ int last;
+
+ /*--
+ index in zptr[] of original string after sorting.
+ --*/
+ int origPtr;
+
+ /*--
+ always: in the range 0 .. 9.
+ The current block size is 100000 * this number.
+ --*/
+ int blockSize100k;
+
+ bool blockRandomised;
+
+ int bsBuff;
+ int bsLive;
+ IChecksum mCrc = new StrangeCRC();
+
+ bool[] inUse = new bool[256];
+ int nInUse;
+
+ byte[] seqToUnseq = new byte[256];
+ byte[] unseqToSeq = new byte[256];
+
+ byte[] selector = new byte[BZip2Constants.MAX_SELECTORS];
+ byte[] selectorMtf = new byte[BZip2Constants.MAX_SELECTORS];
+
+ int[] tt;
+ byte[] ll8;
+
+ /*--
+ freq table collected to save a pass over the data
+ during decompression.
+ --*/
+ int[] unzftab = new int[256];
+
+ int[][] limit = new int[BZip2Constants.N_GROUPS][];
+ int[][] baseArray = new int[BZip2Constants.N_GROUPS][];
+ int[][] perm = new int[BZip2Constants.N_GROUPS][];
+ int[] minLens = new int[BZip2Constants.N_GROUPS];
+
+ Stream baseStream;
+ bool streamEnd;
+
+ int currentChar = -1;
+
+ int currentState = START_BLOCK_STATE;
+
+ int storedBlockCRC, storedCombinedCRC;
+ int computedBlockCRC;
+ uint computedCombinedCRC;
+
+ int count, chPrev, ch2;
+ int tPos;
+ int rNToGo;
+ int rTPos;
+ int i2, j2;
+ byte z;
+ bool isStreamOwner = true;
+ #endregion
+ }
+}
diff --git a/trunk/BZip2Decompress/IChecksum.cs b/source/BZip2Decompress/IChecksum.cs
similarity index 97%
rename from trunk/BZip2Decompress/IChecksum.cs
rename to source/BZip2Decompress/IChecksum.cs
index 87213f8..4a82d7b 100644
--- a/trunk/BZip2Decompress/IChecksum.cs
+++ b/source/BZip2Decompress/IChecksum.cs
@@ -1,93 +1,93 @@
-// IChecksum.cs - Interface to compute a data checksum
-// Copyright (C) 2001 Mike Krueger
-//
-// This file was translated from java, it was part of the GNU Classpath
-// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// Linking this library statically or dynamically with other modules is
-// making a combined work based on this library. Thus, the terms and
-// conditions of the GNU General Public License cover the whole
-// combination.
-//
-// As a special exception, the copyright holders of this library give you
-// permission to link this library with independent modules to produce an
-// executable, regardless of the license terms of these independent
-// modules, and to copy and distribute the resulting executable under
-// terms of your choice, provided that you also meet, for each linked
-// independent module, the terms and conditions of the license of that
-// module. An independent module is a module which is not derived from
-// or based on this library. If you modify this library, you may extend
-// this exception to your version of the library, but you are not
-// obligated to do so. If you do not wish to do so, delete this
-// exception statement from your version.
-
-namespace LSLEditor.Decompressor
-{
-
- ///
- /// Interface to compute a data checksum used by checked input/output streams.
- /// A data checksum can be updated by one byte or with a byte array. After each
- /// update the value of the current checksum can be returned by calling
- /// getValue
. The complete checksum object can also be reset
- /// so it can be used again with new data.
- ///
- public interface IChecksum
- {
- ///
- /// Returns the data checksum computed so far.
- ///
- long Value
- {
- get;
- }
-
- ///
- /// Resets the data checksum as if no update was ever called.
- ///
- void Reset();
-
- ///
- /// Adds one byte to the data checksum.
- ///
- ///
- /// the data value to add. The high byte of the int is ignored.
- ///
- void Update(int value);
-
- ///
- /// Updates the data checksum with the bytes taken from the array.
- ///
- ///
- /// buffer an array of bytes
- ///
- void Update(byte[] buffer);
-
- ///
- /// Adds the byte array to the data checksum.
- ///
- ///
- /// The buffer which contains the data
- ///
- ///
- /// The offset in the buffer where the data starts
- ///
- ///
- /// the number of data bytes to add.
- ///
- void Update(byte[] buffer, int offset, int count);
- }
-}
+// IChecksum.cs - Interface to compute a data checksum
+// Copyright (C) 2001 Mike Krueger
+//
+// This file was translated from java, it was part of the GNU Classpath
+// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// Linking this library statically or dynamically with other modules is
+// making a combined work based on this library. Thus, the terms and
+// conditions of the GNU General Public License cover the whole
+// combination.
+//
+// As a special exception, the copyright holders of this library give you
+// permission to link this library with independent modules to produce an
+// executable, regardless of the license terms of these independent
+// modules, and to copy and distribute the resulting executable under
+// terms of your choice, provided that you also meet, for each linked
+// independent module, the terms and conditions of the license of that
+// module. An independent module is a module which is not derived from
+// or based on this library. If you modify this library, you may extend
+// this exception to your version of the library, but you are not
+// obligated to do so. If you do not wish to do so, delete this
+// exception statement from your version.
+
+namespace LSLEditor.Decompressor
+{
+
+ ///
+ /// Interface to compute a data checksum used by checked input/output streams.
+ /// A data checksum can be updated by one byte or with a byte array. After each
+ /// update the value of the current checksum can be returned by calling
+ /// getValue
. The complete checksum object can also be reset
+ /// so it can be used again with new data.
+ ///
+ public interface IChecksum
+ {
+ ///
+ /// Returns the data checksum computed so far.
+ ///
+ long Value
+ {
+ get;
+ }
+
+ ///
+ /// Resets the data checksum as if no update was ever called.
+ ///
+ void Reset();
+
+ ///
+ /// Adds one byte to the data checksum.
+ ///
+ ///
+ /// the data value to add. The high byte of the int is ignored.
+ ///
+ void Update(int value);
+
+ ///
+ /// Updates the data checksum with the bytes taken from the array.
+ ///
+ ///
+ /// buffer an array of bytes
+ ///
+ void Update(byte[] buffer);
+
+ ///
+ /// Adds the byte array to the data checksum.
+ ///
+ ///
+ /// The buffer which contains the data
+ ///
+ ///
+ /// The offset in the buffer where the data starts
+ ///
+ ///
+ /// the number of data bytes to add.
+ ///
+ void Update(byte[] buffer, int offset, int count);
+ }
+}
diff --git a/trunk/BZip2Decompress/StrangeCrc.cs b/source/BZip2Decompress/StrangeCrc.cs
similarity index 97%
rename from trunk/BZip2Decompress/StrangeCrc.cs
rename to source/BZip2Decompress/StrangeCrc.cs
index a1cfc9e..f6309f7 100644
--- a/trunk/BZip2Decompress/StrangeCrc.cs
+++ b/source/BZip2Decompress/StrangeCrc.cs
@@ -1,207 +1,207 @@
-// StrangeCRC.cs - computes a crc used in the bziplib
-//
-// Copyright (C) 2001 Mike Krueger
-//
-// This file was translated from java, it was part of the GNU Classpath
-// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// Linking this library statically or dynamically with other modules is
-// making a combined work based on this library. Thus, the terms and
-// conditions of the GNU General Public License cover the whole
-// combination.
-//
-// As a special exception, the copyright holders of this library give you
-// permission to link this library with independent modules to produce an
-// executable, regardless of the license terms of these independent
-// modules, and to copy and distribute the resulting executable under
-// terms of your choice, provided that you also meet, for each linked
-// independent module, the terms and conditions of the license of that
-// module. An independent module is a module which is not derived from
-// or based on this library. If you modify this library, you may extend
-// this exception to your version of the library, but you are not
-// obligated to do so. If you do not wish to do so, delete this
-// exception statement from your version.
-
-using System;
-
-namespace LSLEditor.Decompressor
-{
- ///
- /// Bzip2 checksum algorithm
- ///
- public class StrangeCRC : IChecksum
- {
- readonly static uint[] crc32Table = {
- 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
- 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
- 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
- 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
- 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,
- 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
- 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,
- 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,
- 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
- 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,
- 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,
- 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
- 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,
- 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
- 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
- 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,
- 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,
- 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
- 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
- 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,
- 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
- 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,
- 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,
- 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
- 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,
- 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,
- 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
- 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,
- 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
- 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
- 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,
- 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,
- 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
- 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
- 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,
- 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
- 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,
- 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,
- 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
- 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,
- 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,
- 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
- 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,
- 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
- 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
- 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,
- 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,
- 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
- 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
- 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,
- 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
- 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,
- 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,
- 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
- 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,
- 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,
- 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
- 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,
- 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
- 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
- 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,
- 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,
- 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
- 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
- };
-
- int globalCrc;
-
- ///
- /// Initialise a default instance of
- ///
- public StrangeCRC()
- {
- Reset();
- }
-
- ///
- /// Reset the state of Crc.
- ///
- public void Reset()
- {
- globalCrc = -1;
- }
-
- ///
- /// Get the current Crc value.
- ///
- public long Value {
- get {
- return ~globalCrc;
- }
- }
-
- ///
- /// Update the Crc value.
- ///
- /// data update is based on
- public void Update(int value)
- {
- int temp = (globalCrc >> 24) ^ value;
- if (temp < 0) {
- temp = 256 + temp;
- }
- globalCrc = unchecked((int)((globalCrc << 8) ^ crc32Table[temp]));
- }
-
- ///
- /// Update Crc based on a block of data
- ///
- public void Update(byte[] buffer)
- {
- if (buffer == null) {
- throw new ArgumentNullException("buffer");
- }
-
- Update(buffer, 0, buffer.Length);
- }
-
- ///
- /// Update Crc based on a portion of a block of data
- ///
- /// block of data
- /// index of first byte to use
- /// number of bytes to use
- public void Update(byte[] buffer, int offset, int count)
- {
- if (buffer == null) {
- throw new ArgumentNullException("buffer");
- }
-
- if ( offset < 0 )
- {
-#if COMPACT_FRAMEWORK_V10
- throw new ArgumentOutOfRangeException("offset");
-#else
- throw new ArgumentOutOfRangeException("offset", "cannot be less than zero");
-#endif
- }
-
- if ( count < 0 )
- {
-#if COMPACT_FRAMEWORK_V10
- throw new ArgumentOutOfRangeException("count");
-#else
- throw new ArgumentOutOfRangeException("count", "cannot be less than zero");
-#endif
- }
-
- if ( offset + count > buffer.Length )
- {
- throw new ArgumentOutOfRangeException("count");
- }
-
- for (int i = 0; i < count; ++i) {
- Update(buffer[offset++]);
- }
- }
- }
-}
+// StrangeCRC.cs - computes a crc used in the bziplib
+//
+// Copyright (C) 2001 Mike Krueger
+//
+// This file was translated from java, it was part of the GNU Classpath
+// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// Linking this library statically or dynamically with other modules is
+// making a combined work based on this library. Thus, the terms and
+// conditions of the GNU General Public License cover the whole
+// combination.
+//
+// As a special exception, the copyright holders of this library give you
+// permission to link this library with independent modules to produce an
+// executable, regardless of the license terms of these independent
+// modules, and to copy and distribute the resulting executable under
+// terms of your choice, provided that you also meet, for each linked
+// independent module, the terms and conditions of the license of that
+// module. An independent module is a module which is not derived from
+// or based on this library. If you modify this library, you may extend
+// this exception to your version of the library, but you are not
+// obligated to do so. If you do not wish to do so, delete this
+// exception statement from your version.
+
+using System;
+
+namespace LSLEditor.Decompressor
+{
+ ///
+ /// Bzip2 checksum algorithm
+ ///
+ public class StrangeCRC : IChecksum
+ {
+ readonly static uint[] crc32Table = {
+ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
+ 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
+ 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
+ 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
+ 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,
+ 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
+ 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,
+ 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,
+ 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
+ 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,
+ 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,
+ 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
+ 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,
+ 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
+ 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
+ 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,
+ 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,
+ 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
+ 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
+ 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,
+ 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
+ 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,
+ 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,
+ 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
+ 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,
+ 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,
+ 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
+ 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,
+ 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
+ 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
+ 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,
+ 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,
+ 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
+ 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
+ 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,
+ 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
+ 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,
+ 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,
+ 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
+ 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,
+ 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,
+ 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
+ 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,
+ 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
+ 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
+ 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,
+ 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,
+ 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
+ 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
+ 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,
+ 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
+ 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,
+ 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,
+ 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
+ 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,
+ 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,
+ 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
+ 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,
+ 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
+ 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
+ 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,
+ 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,
+ 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
+ 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
+ };
+
+ int globalCrc;
+
+ ///
+ /// Initialise a default instance of
+ ///
+ public StrangeCRC()
+ {
+ Reset();
+ }
+
+ ///
+ /// Reset the state of Crc.
+ ///
+ public void Reset()
+ {
+ globalCrc = -1;
+ }
+
+ ///
+ /// Get the current Crc value.
+ ///
+ public long Value {
+ get {
+ return ~globalCrc;
+ }
+ }
+
+ ///
+ /// Update the Crc value.
+ ///
+ /// data update is based on
+ public void Update(int value)
+ {
+ int temp = (globalCrc >> 24) ^ value;
+ if (temp < 0) {
+ temp = 256 + temp;
+ }
+ globalCrc = unchecked((int)((globalCrc << 8) ^ crc32Table[temp]));
+ }
+
+ ///
+ /// Update Crc based on a block of data
+ ///
+ public void Update(byte[] buffer)
+ {
+ if (buffer == null) {
+ throw new ArgumentNullException("buffer");
+ }
+
+ Update(buffer, 0, buffer.Length);
+ }
+
+ ///
+ /// Update Crc based on a portion of a block of data
+ ///
+ /// block of data
+ /// index of first byte to use
+ /// number of bytes to use
+ public void Update(byte[] buffer, int offset, int count)
+ {
+ if (buffer == null) {
+ throw new ArgumentNullException("buffer");
+ }
+
+ if ( offset < 0 )
+ {
+#if COMPACT_FRAMEWORK_V10
+ throw new ArgumentOutOfRangeException("offset");
+#else
+ throw new ArgumentOutOfRangeException("offset", "cannot be less than zero");
+#endif
+ }
+
+ if ( count < 0 )
+ {
+#if COMPACT_FRAMEWORK_V10
+ throw new ArgumentOutOfRangeException("count");
+#else
+ throw new ArgumentOutOfRangeException("count", "cannot be less than zero");
+#endif
+ }
+
+ if ( offset + count > buffer.Length )
+ {
+ throw new ArgumentOutOfRangeException("count");
+ }
+
+ for (int i = 0; i < count; ++i) {
+ Update(buffer[offset++]);
+ }
+ }
+ }
+}
diff --git a/trunk/Browser.Designer.cs b/source/Browser.Designer.cs
similarity index 97%
rename from trunk/Browser.Designer.cs
rename to source/Browser.Designer.cs
index 2bf08cb..37cd816 100644
--- a/trunk/Browser.Designer.cs
+++ b/source/Browser.Designer.cs
@@ -1,81 +1,81 @@
-namespace LSLEditor
-{
- partial class Browser
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.tabControl1 = new System.Windows.Forms.TabControlExtended(this.components);
- this.contextMenuStrip1.SuspendLayout();
- this.SuspendLayout();
- //
- // contextMenuStrip1
- //
- this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.closeToolStripMenuItem});
- this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(112, 26);
- //
- // closeToolStripMenuItem
- //
- this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
- this.closeToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
- this.closeToolStripMenuItem.Text = "Close";
- this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
- //
- // tabControl1
- //
- this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl1.Location = new System.Drawing.Point(0, 0);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(592, 366);
- this.tabControl1.TabIndex = 1;
- this.tabControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseDown);
- //
- // Browser
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 366);
- this.Controls.Add(this.tabControl1);
- this.Name = "Browser";
- this.Text = "Browser";
- this.contextMenuStrip1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.TabControlExtended tabControl1;
- private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
- private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
- }
+namespace LSLEditor
+{
+ partial class Browser
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.tabControl1 = new System.Windows.Forms.TabControlExtended(this.components);
+ this.contextMenuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.closeToolStripMenuItem});
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(112, 26);
+ //
+ // closeToolStripMenuItem
+ //
+ this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
+ this.closeToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
+ this.closeToolStripMenuItem.Text = "Close";
+ this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
+ //
+ // tabControl1
+ //
+ this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tabControl1.Location = new System.Drawing.Point(0, 0);
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new System.Drawing.Size(592, 366);
+ this.tabControl1.TabIndex = 1;
+ this.tabControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseDown);
+ //
+ // Browser
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(592, 366);
+ this.Controls.Add(this.tabControl1);
+ this.Name = "Browser";
+ this.Text = "Browser";
+ this.contextMenuStrip1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TabControlExtended tabControl1;
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
+ }
}
\ No newline at end of file
diff --git a/trunk/Browser.cs b/source/Browser.cs
similarity index 97%
rename from trunk/Browser.cs
rename to source/Browser.cs
index 061eba3..b92472f 100644
--- a/trunk/Browser.cs
+++ b/source/Browser.cs
@@ -1,160 +1,160 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-// Browser.cs
-//
-//
-
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.Windows.Forms;
-using LSLEditor.Docking;
-
-namespace LSLEditor
-{
- public partial class Browser : DockContent
- {
- private LSLEditorForm lslEditorForm;
-
- public Browser(LSLEditorForm lslEditorForm)
- {
- InitializeComponent();
-
- this.Icon = lslEditorForm.Icon;
- this.lslEditorForm = lslEditorForm;
-
- // enables close buttons on tabs
- this.tabControl1.SetDrawMode();
- }
-
- private void axWebBrowser1_StatusTextChanged(object sender, EventArgs e)
- {
- WebBrowser axWebBrowser1 = sender as WebBrowser;
- ToolStripStatusLabel status = axWebBrowser1.Tag as ToolStripStatusLabel;
- if (status != null) {
- status.Text = axWebBrowser1.StatusText;
- }
- }
-
- private void axWebBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
- {
- string strUrl = e.Url.ToString();
- if (strUrl.EndsWith(".lsl")) {
- e.Cancel = true;
- if (MessageBox.Show("Import LSL script?", "Import script", MessageBoxButtons.OKCancel) != DialogResult.Cancel) {
- WebBrowser axWebBrowser1 = sender as WebBrowser;
- axWebBrowser1.Stop();
-
- this.lslEditorForm.OpenFile(strUrl, Guid.NewGuid());
- }
- }
- }
-
- public void ShowWebBrowser(string strTabName, string strUrl)
- {
- WebBrowser axWebBrowser1 = null;
- try {
- if (!Properties.Settings.Default.HelpNewTab) {
- TabPage tabPage = this.tabControl1.TabPages[0];
- tabPage.Text = strTabName + " ";
- axWebBrowser1 = tabPage.Controls[0] as WebBrowser;
- }
- } catch { }
-
- if (axWebBrowser1 == null) {
- TabPage tabPage = new TabPage(strTabName + " ");
- tabPage.BackColor = Color.White;
-
- axWebBrowser1 = new WebBrowser();
-
- ToolStripStatusLabel toolStripStatusLabel1 = new ToolStripStatusLabel();
- StatusStrip statusStrip1 = new StatusStrip();
-
- statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripStatusLabel1 });
- statusStrip1.Location = new System.Drawing.Point(0, 318);
- statusStrip1.Name = "statusStrip1";
- statusStrip1.Size = new System.Drawing.Size(584, 22);
- statusStrip1.TabIndex = 0;
- statusStrip1.Text = "statusStrip1";
-
- toolStripStatusLabel1.Name = "toolStripStatusLabel1";
- toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17);
- toolStripStatusLabel1.Text = "toolStripStatusLabel1";
-
- tabPage.Controls.Add(axWebBrowser1);
-
- tabPage.Controls.Add(statusStrip1);
-
- this.tabControl1.TabPages.Add(tabPage);
- this.tabControl1.SelectedIndex = this.tabControl1.TabCount - 1;
-
- // reference
- axWebBrowser1.Tag = toolStripStatusLabel1;
-
- axWebBrowser1.Dock = DockStyle.Fill;
- axWebBrowser1.StatusTextChanged += new EventHandler(axWebBrowser1_StatusTextChanged);
- axWebBrowser1.Navigating += new WebBrowserNavigatingEventHandler(axWebBrowser1_Navigating);
- }
- axWebBrowser1.Navigate(strUrl);
- }
-
- private void closeToolStripMenuItem_Click(object sender, EventArgs e)
- {
- int intTabToClose = (int)this.contextMenuStrip1.Tag;
- if (intTabToClose < this.tabControl1.TabCount) {
- this.tabControl1.TabPages.RemoveAt(intTabToClose);
- }
- }
-
- private void tabControl1_MouseDown(object sender, MouseEventArgs e)
- {
- TabControl tabControl = sender as TabControl;
- if (tabControl != null) {
- if (e.Button == MouseButtons.Right) {
- for (int intI = 0; intI < tabControl.TabCount; intI++) {
- Rectangle rt = tabControl.GetTabRect(intI);
- if (e.X > rt.Left && e.X < rt.Right
- && e.Y > rt.Top && e.Y < rt.Bottom) {
- this.contextMenuStrip1.Tag = intI;
- this.contextMenuStrip1.Show(this.tabControl1, new Point(e.X, e.Y));
- }
- }
- }
- }
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+// Browser.cs
+//
+//
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Windows.Forms;
+using LSLEditor.Docking;
+
+namespace LSLEditor
+{
+ public partial class Browser : DockContent
+ {
+ private LSLEditorForm lslEditorForm;
+
+ public Browser(LSLEditorForm lslEditorForm)
+ {
+ InitializeComponent();
+
+ this.Icon = lslEditorForm.Icon;
+ this.lslEditorForm = lslEditorForm;
+
+ // enables close buttons on tabs
+ this.tabControl1.SetDrawMode();
+ }
+
+ private void axWebBrowser1_StatusTextChanged(object sender, EventArgs e)
+ {
+ WebBrowser axWebBrowser1 = sender as WebBrowser;
+ ToolStripStatusLabel status = axWebBrowser1.Tag as ToolStripStatusLabel;
+ if (status != null) {
+ status.Text = axWebBrowser1.StatusText;
+ }
+ }
+
+ private void axWebBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
+ {
+ string strUrl = e.Url.ToString();
+ if (strUrl.EndsWith(".lsl")) {
+ e.Cancel = true;
+ if (MessageBox.Show("Import LSL script?", "Import script", MessageBoxButtons.OKCancel) != DialogResult.Cancel) {
+ WebBrowser axWebBrowser1 = sender as WebBrowser;
+ axWebBrowser1.Stop();
+
+ this.lslEditorForm.OpenFile(strUrl, Guid.NewGuid());
+ }
+ }
+ }
+
+ public void ShowWebBrowser(string strTabName, string strUrl)
+ {
+ WebBrowser axWebBrowser1 = null;
+ try {
+ if (!Properties.Settings.Default.HelpNewTab) {
+ TabPage tabPage = this.tabControl1.TabPages[0];
+ tabPage.Text = strTabName + " ";
+ axWebBrowser1 = tabPage.Controls[0] as WebBrowser;
+ }
+ } catch { }
+
+ if (axWebBrowser1 == null) {
+ TabPage tabPage = new TabPage(strTabName + " ");
+ tabPage.BackColor = Color.White;
+
+ axWebBrowser1 = new WebBrowser();
+
+ ToolStripStatusLabel toolStripStatusLabel1 = new ToolStripStatusLabel();
+ StatusStrip statusStrip1 = new StatusStrip();
+
+ statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripStatusLabel1 });
+ statusStrip1.Location = new System.Drawing.Point(0, 318);
+ statusStrip1.Name = "statusStrip1";
+ statusStrip1.Size = new System.Drawing.Size(584, 22);
+ statusStrip1.TabIndex = 0;
+ statusStrip1.Text = "statusStrip1";
+
+ toolStripStatusLabel1.Name = "toolStripStatusLabel1";
+ toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17);
+ toolStripStatusLabel1.Text = "toolStripStatusLabel1";
+
+ tabPage.Controls.Add(axWebBrowser1);
+
+ tabPage.Controls.Add(statusStrip1);
+
+ this.tabControl1.TabPages.Add(tabPage);
+ this.tabControl1.SelectedIndex = this.tabControl1.TabCount - 1;
+
+ // reference
+ axWebBrowser1.Tag = toolStripStatusLabel1;
+
+ axWebBrowser1.Dock = DockStyle.Fill;
+ axWebBrowser1.StatusTextChanged += new EventHandler(axWebBrowser1_StatusTextChanged);
+ axWebBrowser1.Navigating += new WebBrowserNavigatingEventHandler(axWebBrowser1_Navigating);
+ }
+ axWebBrowser1.Navigate(strUrl);
+ }
+
+ private void closeToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ int intTabToClose = (int)this.contextMenuStrip1.Tag;
+ if (intTabToClose < this.tabControl1.TabCount) {
+ this.tabControl1.TabPages.RemoveAt(intTabToClose);
+ }
+ }
+
+ private void tabControl1_MouseDown(object sender, MouseEventArgs e)
+ {
+ TabControl tabControl = sender as TabControl;
+ if (tabControl != null) {
+ if (e.Button == MouseButtons.Right) {
+ for (int intI = 0; intI < tabControl.TabCount; intI++) {
+ Rectangle rt = tabControl.GetTabRect(intI);
+ if (e.X > rt.Left && e.X < rt.Right
+ && e.Y > rt.Top && e.Y < rt.Bottom) {
+ this.contextMenuStrip1.Tag = intI;
+ this.contextMenuStrip1.Show(this.tabControl1, new Point(e.X, e.Y));
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/trunk/Browser.resx b/source/Browser.resx
similarity index 97%
rename from trunk/Browser.resx
rename to source/Browser.resx
index 174d5e9..6fa74a8 100644
--- a/trunk/Browser.resx
+++ b/source/Browser.resx
@@ -1,123 +1,123 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 127, 17
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 127, 17
+
\ No newline at end of file
diff --git a/trunk/BugReport/BugReportForm.Designer.cs b/source/BugReport/BugReportForm.Designer.cs
similarity index 97%
rename from trunk/BugReport/BugReportForm.Designer.cs
rename to source/BugReport/BugReportForm.Designer.cs
index 54ad41c..14ae3f5 100644
--- a/trunk/BugReport/BugReportForm.Designer.cs
+++ b/source/BugReport/BugReportForm.Designer.cs
@@ -1,437 +1,437 @@
-namespace LSLEditor.BugReport
-{
- partial class BugReportForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.textBox3 = new System.Windows.Forms.TextBox();
- this.panel2 = new System.Windows.Forms.Panel();
- this.button4 = new System.Windows.Forms.Button();
- this.label6 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.listView1 = new System.Windows.Forms.ListView();
- this.textBox2 = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.panel1 = new System.Windows.Forms.Panel();
- this.button3 = new System.Windows.Forms.Button();
- this.progressBar1 = new System.Windows.Forms.ProgressBar();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.textBox5 = new System.Windows.Forms.TextBox();
- this.splitter2 = new System.Windows.Forms.Splitter();
- this.textBox4 = new System.Windows.Forms.TextBox();
- this.splitter1 = new System.Windows.Forms.Splitter();
- this.listView2 = new System.Windows.Forms.ListView();
- this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
- this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.timer1 = new System.Windows.Forms.Timer(this.components);
- this.groupBox1.SuspendLayout();
- this.panel2.SuspendLayout();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.panel1.SuspendLayout();
- this.tabPage2.SuspendLayout();
- this.contextMenuStrip1.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.textBox3);
- this.groupBox1.Controls.Add(this.panel2);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(3, 3);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Padding = new System.Windows.Forms.Padding(8);
- this.groupBox1.Size = new System.Drawing.Size(712, 330);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "report";
- //
- // textBox3
- //
- this.textBox3.AcceptsReturn = true;
- this.textBox3.AcceptsTab = true;
- this.textBox3.Dock = System.Windows.Forms.DockStyle.Fill;
- this.textBox3.Location = new System.Drawing.Point(8, 160);
- this.textBox3.Multiline = true;
- this.textBox3.Name = "textBox3";
- this.textBox3.ScrollBars = System.Windows.Forms.ScrollBars.Both;
- this.textBox3.Size = new System.Drawing.Size(696, 162);
- this.textBox3.TabIndex = 4;
- //
- // panel2
- //
- this.panel2.Controls.Add(this.button4);
- this.panel2.Controls.Add(this.label6);
- this.panel2.Controls.Add(this.label5);
- this.panel2.Controls.Add(this.label4);
- this.panel2.Controls.Add(this.label3);
- this.panel2.Controls.Add(this.label1);
- this.panel2.Controls.Add(this.textBox1);
- this.panel2.Controls.Add(this.listView1);
- this.panel2.Controls.Add(this.textBox2);
- this.panel2.Controls.Add(this.label2);
- this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
- this.panel2.Location = new System.Drawing.Point(8, 21);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(696, 139);
- this.panel2.TabIndex = 6;
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(312, 112);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 24);
- this.button4.TabIndex = 9;
- this.button4.Text = "check all";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(0, 80);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(191, 13);
- this.label6.TabIndex = 8;
- this.label6.Text = "and will not be made public in any way!";
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(0, 64);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(217, 13);
- this.label5.TabIndex = 7;
- this.label5.Text = "Uploaded files will only be used for bugfixing,";
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(208, 8);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(98, 13);
- this.label4.TabIndex = 6;
- this.label4.Text = "Files to be included";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(0, 104);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(130, 13);
- this.label3.TabIndex = 5;
- this.label3.Text = "Description of the problem";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(0, 8);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(35, 13);
- this.label1.TabIndex = 2;
- this.label1.Text = "Name";
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(40, 8);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(168, 20);
- this.textBox1.TabIndex = 1;
- //
- // listView1
- //
- this.listView1.CheckBoxes = true;
- this.listView1.Location = new System.Drawing.Point(312, 8);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(248, 104);
- this.listView1.TabIndex = 3;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.View = System.Windows.Forms.View.Details;
- //
- // textBox2
- //
- this.textBox2.Location = new System.Drawing.Point(40, 40);
- this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(168, 20);
- this.textBox2.TabIndex = 2;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(0, 40);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(32, 13);
- this.label2.TabIndex = 3;
- this.label2.Text = "Email";
- //
- // tabControl1
- //
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Controls.Add(this.tabPage2);
- this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl1.Location = new System.Drawing.Point(8, 8);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(726, 402);
- this.tabControl1.TabIndex = 0;
- //
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.groupBox1);
- this.tabPage1.Controls.Add(this.panel1);
- this.tabPage1.Location = new System.Drawing.Point(4, 22);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(718, 376);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "New bug report";
- this.tabPage1.UseVisualStyleBackColor = true;
- //
- // panel1
- //
- this.panel1.Controls.Add(this.button3);
- this.panel1.Controls.Add(this.progressBar1);
- this.panel1.Controls.Add(this.button2);
- this.panel1.Controls.Add(this.button1);
- this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.panel1.Location = new System.Drawing.Point(3, 333);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(712, 40);
- this.panel1.TabIndex = 0;
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(504, 8);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 7;
- this.button3.Text = "Close";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // progressBar1
- //
- this.progressBar1.Location = new System.Drawing.Point(8, 8);
- this.progressBar1.Name = "progressBar1";
- this.progressBar1.Size = new System.Drawing.Size(280, 23);
- this.progressBar1.TabIndex = 0;
- //
- // button2
- //
- this.button2.Enabled = false;
- this.button2.Location = new System.Drawing.Point(416, 8);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 6;
- this.button2.Text = "Cancel";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(296, 8);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(112, 23);
- this.button1.TabIndex = 5;
- this.button1.Text = "Send bug report";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // tabPage2
- //
- this.tabPage2.Controls.Add(this.textBox5);
- this.tabPage2.Controls.Add(this.splitter2);
- this.tabPage2.Controls.Add(this.textBox4);
- this.tabPage2.Controls.Add(this.splitter1);
- this.tabPage2.Controls.Add(this.listView2);
- this.tabPage2.Location = new System.Drawing.Point(4, 22);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(718, 376);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "Bug tracker";
- this.tabPage2.UseVisualStyleBackColor = true;
- //
- // textBox5
- //
- this.textBox5.AcceptsReturn = true;
- this.textBox5.AcceptsTab = true;
- this.textBox5.Dock = System.Windows.Forms.DockStyle.Fill;
- this.textBox5.Location = new System.Drawing.Point(267, 131);
- this.textBox5.Multiline = true;
- this.textBox5.Name = "textBox5";
- this.textBox5.ReadOnly = true;
- this.textBox5.ScrollBars = System.Windows.Forms.ScrollBars.Both;
- this.textBox5.Size = new System.Drawing.Size(448, 242);
- this.textBox5.TabIndex = 10;
- //
- // splitter2
- //
- this.splitter2.Dock = System.Windows.Forms.DockStyle.Top;
- this.splitter2.Location = new System.Drawing.Point(267, 128);
- this.splitter2.Name = "splitter2";
- this.splitter2.Size = new System.Drawing.Size(448, 3);
- this.splitter2.TabIndex = 3;
- this.splitter2.TabStop = false;
- //
- // textBox4
- //
- this.textBox4.AcceptsReturn = true;
- this.textBox4.AcceptsTab = true;
- this.textBox4.Dock = System.Windows.Forms.DockStyle.Top;
- this.textBox4.Location = new System.Drawing.Point(267, 3);
- this.textBox4.Multiline = true;
- this.textBox4.Name = "textBox4";
- this.textBox4.ReadOnly = true;
- this.textBox4.ScrollBars = System.Windows.Forms.ScrollBars.Both;
- this.textBox4.Size = new System.Drawing.Size(448, 125);
- this.textBox4.TabIndex = 9;
- //
- // splitter1
- //
- this.splitter1.Location = new System.Drawing.Point(264, 3);
- this.splitter1.Name = "splitter1";
- this.splitter1.Size = new System.Drawing.Size(3, 370);
- this.splitter1.TabIndex = 1;
- this.splitter1.TabStop = false;
- //
- // listView2
- //
- this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnHeader1,
- this.columnHeader2});
- this.listView2.ContextMenuStrip = this.contextMenuStrip1;
- this.listView2.Dock = System.Windows.Forms.DockStyle.Left;
- this.listView2.FullRowSelect = true;
- this.listView2.HideSelection = false;
- this.listView2.Location = new System.Drawing.Point(3, 3);
- this.listView2.Name = "listView2";
- this.listView2.Size = new System.Drawing.Size(261, 370);
- this.listView2.TabIndex = 8;
- this.listView2.UseCompatibleStateImageBehavior = false;
- this.listView2.View = System.Windows.Forms.View.Details;
- this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
- //
- // columnHeader1
- //
- this.columnHeader1.Text = "Number";
- this.columnHeader1.Width = 85;
- //
- // columnHeader2
- //
- this.columnHeader2.Text = "Date/Time";
- this.columnHeader2.Width = 145;
- //
- // contextMenuStrip1
- //
- this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.deleteToolStripMenuItem});
- this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(117, 26);
- //
- // deleteToolStripMenuItem
- //
- this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
- this.deleteToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
- this.deleteToolStripMenuItem.Text = "Delete";
- this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
- //
- // timer1
- //
- this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
- //
- // BugReportForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(742, 418);
- this.Controls.Add(this.tabControl1);
- this.Name = "BugReportForm";
- this.Padding = new System.Windows.Forms.Padding(8);
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "LSLEditor bug report";
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.panel2.ResumeLayout(false);
- this.panel2.PerformLayout();
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.panel1.ResumeLayout(false);
- this.tabPage2.ResumeLayout(false);
- this.tabPage2.PerformLayout();
- this.contextMenuStrip1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.ListView listView1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox textBox2;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.TextBox textBox3;
- private System.Windows.Forms.Panel panel2;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.TabControl tabControl1;
- private System.Windows.Forms.TabPage tabPage1;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.ProgressBar progressBar1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.TabPage tabPage2;
- private System.Windows.Forms.TextBox textBox5;
- private System.Windows.Forms.Splitter splitter2;
- private System.Windows.Forms.TextBox textBox4;
- private System.Windows.Forms.Splitter splitter1;
- private System.Windows.Forms.ListView listView2;
- private System.Windows.Forms.ColumnHeader columnHeader1;
- private System.Windows.Forms.Timer timer1;
- private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
- private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.Button button4;
- private System.Windows.Forms.ColumnHeader columnHeader2;
- }
+namespace LSLEditor.BugReport
+{
+ partial class BugReportForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.textBox3 = new System.Windows.Forms.TextBox();
+ this.panel2 = new System.Windows.Forms.Panel();
+ this.button4 = new System.Windows.Forms.Button();
+ this.label6 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.listView1 = new System.Windows.Forms.ListView();
+ this.textBox2 = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.tabControl1 = new System.Windows.Forms.TabControl();
+ this.tabPage1 = new System.Windows.Forms.TabPage();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.button3 = new System.Windows.Forms.Button();
+ this.progressBar1 = new System.Windows.Forms.ProgressBar();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button1 = new System.Windows.Forms.Button();
+ this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.textBox5 = new System.Windows.Forms.TextBox();
+ this.splitter2 = new System.Windows.Forms.Splitter();
+ this.textBox4 = new System.Windows.Forms.TextBox();
+ this.splitter1 = new System.Windows.Forms.Splitter();
+ this.listView2 = new System.Windows.Forms.ListView();
+ this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
+ this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
+ this.groupBox1.SuspendLayout();
+ this.panel2.SuspendLayout();
+ this.tabControl1.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.panel1.SuspendLayout();
+ this.tabPage2.SuspendLayout();
+ this.contextMenuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.textBox3);
+ this.groupBox1.Controls.Add(this.panel2);
+ this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupBox1.Location = new System.Drawing.Point(3, 3);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Padding = new System.Windows.Forms.Padding(8);
+ this.groupBox1.Size = new System.Drawing.Size(712, 330);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "report";
+ //
+ // textBox3
+ //
+ this.textBox3.AcceptsReturn = true;
+ this.textBox3.AcceptsTab = true;
+ this.textBox3.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.textBox3.Location = new System.Drawing.Point(8, 160);
+ this.textBox3.Multiline = true;
+ this.textBox3.Name = "textBox3";
+ this.textBox3.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.textBox3.Size = new System.Drawing.Size(696, 162);
+ this.textBox3.TabIndex = 4;
+ //
+ // panel2
+ //
+ this.panel2.Controls.Add(this.button4);
+ this.panel2.Controls.Add(this.label6);
+ this.panel2.Controls.Add(this.label5);
+ this.panel2.Controls.Add(this.label4);
+ this.panel2.Controls.Add(this.label3);
+ this.panel2.Controls.Add(this.label1);
+ this.panel2.Controls.Add(this.textBox1);
+ this.panel2.Controls.Add(this.listView1);
+ this.panel2.Controls.Add(this.textBox2);
+ this.panel2.Controls.Add(this.label2);
+ this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel2.Location = new System.Drawing.Point(8, 21);
+ this.panel2.Name = "panel2";
+ this.panel2.Size = new System.Drawing.Size(696, 139);
+ this.panel2.TabIndex = 6;
+ //
+ // button4
+ //
+ this.button4.Location = new System.Drawing.Point(312, 112);
+ this.button4.Name = "button4";
+ this.button4.Size = new System.Drawing.Size(75, 24);
+ this.button4.TabIndex = 9;
+ this.button4.Text = "check all";
+ this.button4.UseVisualStyleBackColor = true;
+ this.button4.Click += new System.EventHandler(this.button4_Click);
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(0, 80);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(191, 13);
+ this.label6.TabIndex = 8;
+ this.label6.Text = "and will not be made public in any way!";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(0, 64);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(217, 13);
+ this.label5.TabIndex = 7;
+ this.label5.Text = "Uploaded files will only be used for bugfixing,";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(208, 8);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(98, 13);
+ this.label4.TabIndex = 6;
+ this.label4.Text = "Files to be included";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(0, 104);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(130, 13);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "Description of the problem";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(0, 8);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(35, 13);
+ this.label1.TabIndex = 2;
+ this.label1.Text = "Name";
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(40, 8);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(168, 20);
+ this.textBox1.TabIndex = 1;
+ //
+ // listView1
+ //
+ this.listView1.CheckBoxes = true;
+ this.listView1.Location = new System.Drawing.Point(312, 8);
+ this.listView1.Name = "listView1";
+ this.listView1.Size = new System.Drawing.Size(248, 104);
+ this.listView1.TabIndex = 3;
+ this.listView1.UseCompatibleStateImageBehavior = false;
+ this.listView1.View = System.Windows.Forms.View.Details;
+ //
+ // textBox2
+ //
+ this.textBox2.Location = new System.Drawing.Point(40, 40);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.Size = new System.Drawing.Size(168, 20);
+ this.textBox2.TabIndex = 2;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(0, 40);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(32, 13);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "Email";
+ //
+ // tabControl1
+ //
+ this.tabControl1.Controls.Add(this.tabPage1);
+ this.tabControl1.Controls.Add(this.tabPage2);
+ this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tabControl1.Location = new System.Drawing.Point(8, 8);
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new System.Drawing.Size(726, 402);
+ this.tabControl1.TabIndex = 0;
+ //
+ // tabPage1
+ //
+ this.tabPage1.Controls.Add(this.groupBox1);
+ this.tabPage1.Controls.Add(this.panel1);
+ this.tabPage1.Location = new System.Drawing.Point(4, 22);
+ this.tabPage1.Name = "tabPage1";
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage1.Size = new System.Drawing.Size(718, 376);
+ this.tabPage1.TabIndex = 0;
+ this.tabPage1.Text = "New bug report";
+ this.tabPage1.UseVisualStyleBackColor = true;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.button3);
+ this.panel1.Controls.Add(this.progressBar1);
+ this.panel1.Controls.Add(this.button2);
+ this.panel1.Controls.Add(this.button1);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.panel1.Location = new System.Drawing.Point(3, 333);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(712, 40);
+ this.panel1.TabIndex = 0;
+ //
+ // button3
+ //
+ this.button3.Location = new System.Drawing.Point(504, 8);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(75, 23);
+ this.button3.TabIndex = 7;
+ this.button3.Text = "Close";
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
+ //
+ // progressBar1
+ //
+ this.progressBar1.Location = new System.Drawing.Point(8, 8);
+ this.progressBar1.Name = "progressBar1";
+ this.progressBar1.Size = new System.Drawing.Size(280, 23);
+ this.progressBar1.TabIndex = 0;
+ //
+ // button2
+ //
+ this.button2.Enabled = false;
+ this.button2.Location = new System.Drawing.Point(416, 8);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(75, 23);
+ this.button2.TabIndex = 6;
+ this.button2.Text = "Cancel";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.button2_Click);
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(296, 8);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(112, 23);
+ this.button1.TabIndex = 5;
+ this.button1.Text = "Send bug report";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // tabPage2
+ //
+ this.tabPage2.Controls.Add(this.textBox5);
+ this.tabPage2.Controls.Add(this.splitter2);
+ this.tabPage2.Controls.Add(this.textBox4);
+ this.tabPage2.Controls.Add(this.splitter1);
+ this.tabPage2.Controls.Add(this.listView2);
+ this.tabPage2.Location = new System.Drawing.Point(4, 22);
+ this.tabPage2.Name = "tabPage2";
+ this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage2.Size = new System.Drawing.Size(718, 376);
+ this.tabPage2.TabIndex = 1;
+ this.tabPage2.Text = "Bug tracker";
+ this.tabPage2.UseVisualStyleBackColor = true;
+ //
+ // textBox5
+ //
+ this.textBox5.AcceptsReturn = true;
+ this.textBox5.AcceptsTab = true;
+ this.textBox5.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.textBox5.Location = new System.Drawing.Point(267, 131);
+ this.textBox5.Multiline = true;
+ this.textBox5.Name = "textBox5";
+ this.textBox5.ReadOnly = true;
+ this.textBox5.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.textBox5.Size = new System.Drawing.Size(448, 242);
+ this.textBox5.TabIndex = 10;
+ //
+ // splitter2
+ //
+ this.splitter2.Dock = System.Windows.Forms.DockStyle.Top;
+ this.splitter2.Location = new System.Drawing.Point(267, 128);
+ this.splitter2.Name = "splitter2";
+ this.splitter2.Size = new System.Drawing.Size(448, 3);
+ this.splitter2.TabIndex = 3;
+ this.splitter2.TabStop = false;
+ //
+ // textBox4
+ //
+ this.textBox4.AcceptsReturn = true;
+ this.textBox4.AcceptsTab = true;
+ this.textBox4.Dock = System.Windows.Forms.DockStyle.Top;
+ this.textBox4.Location = new System.Drawing.Point(267, 3);
+ this.textBox4.Multiline = true;
+ this.textBox4.Name = "textBox4";
+ this.textBox4.ReadOnly = true;
+ this.textBox4.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.textBox4.Size = new System.Drawing.Size(448, 125);
+ this.textBox4.TabIndex = 9;
+ //
+ // splitter1
+ //
+ this.splitter1.Location = new System.Drawing.Point(264, 3);
+ this.splitter1.Name = "splitter1";
+ this.splitter1.Size = new System.Drawing.Size(3, 370);
+ this.splitter1.TabIndex = 1;
+ this.splitter1.TabStop = false;
+ //
+ // listView2
+ //
+ this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader1,
+ this.columnHeader2});
+ this.listView2.ContextMenuStrip = this.contextMenuStrip1;
+ this.listView2.Dock = System.Windows.Forms.DockStyle.Left;
+ this.listView2.FullRowSelect = true;
+ this.listView2.HideSelection = false;
+ this.listView2.Location = new System.Drawing.Point(3, 3);
+ this.listView2.Name = "listView2";
+ this.listView2.Size = new System.Drawing.Size(261, 370);
+ this.listView2.TabIndex = 8;
+ this.listView2.UseCompatibleStateImageBehavior = false;
+ this.listView2.View = System.Windows.Forms.View.Details;
+ this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
+ //
+ // columnHeader1
+ //
+ this.columnHeader1.Text = "Number";
+ this.columnHeader1.Width = 85;
+ //
+ // columnHeader2
+ //
+ this.columnHeader2.Text = "Date/Time";
+ this.columnHeader2.Width = 145;
+ //
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.deleteToolStripMenuItem});
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(117, 26);
+ //
+ // deleteToolStripMenuItem
+ //
+ this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
+ this.deleteToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
+ this.deleteToolStripMenuItem.Text = "Delete";
+ this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
+ //
+ // timer1
+ //
+ this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+ //
+ // BugReportForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(742, 418);
+ this.Controls.Add(this.tabControl1);
+ this.Name = "BugReportForm";
+ this.Padding = new System.Windows.Forms.Padding(8);
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "LSLEditor bug report";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.panel2.ResumeLayout(false);
+ this.panel2.PerformLayout();
+ this.tabControl1.ResumeLayout(false);
+ this.tabPage1.ResumeLayout(false);
+ this.panel1.ResumeLayout(false);
+ this.tabPage2.ResumeLayout(false);
+ this.tabPage2.PerformLayout();
+ this.contextMenuStrip1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.ListView listView1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.TextBox textBox3;
+ private System.Windows.Forms.Panel panel2;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.TabControl tabControl1;
+ private System.Windows.Forms.TabPage tabPage1;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.ProgressBar progressBar1;
+ private System.Windows.Forms.Button button2;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.TabPage tabPage2;
+ private System.Windows.Forms.TextBox textBox5;
+ private System.Windows.Forms.Splitter splitter2;
+ private System.Windows.Forms.TextBox textBox4;
+ private System.Windows.Forms.Splitter splitter1;
+ private System.Windows.Forms.ListView listView2;
+ private System.Windows.Forms.ColumnHeader columnHeader1;
+ private System.Windows.Forms.Timer timer1;
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
+ private System.Windows.Forms.Button button3;
+ private System.Windows.Forms.Button button4;
+ private System.Windows.Forms.ColumnHeader columnHeader2;
+ }
}
\ No newline at end of file
diff --git a/trunk/BugReport/BugReportForm.cs b/source/BugReport/BugReportForm.cs
similarity index 96%
rename from trunk/BugReport/BugReportForm.cs
rename to source/BugReport/BugReportForm.cs
index de64197..5088f31 100644
--- a/trunk/BugReport/BugReportForm.cs
+++ b/source/BugReport/BugReportForm.cs
@@ -1,294 +1,294 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-// BugReportForm.cs
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Text;
-using System.Windows.Forms;
-using System.Reflection;
-
-using LSLEditor.org.lsleditor.www;
-
-
-namespace LSLEditor.BugReport
-{
- public partial class BugReportForm : Form
- {
- private bool blnComplete;
- private UploadBugReport ubr;
-
- private LSLEditorForm parent;
-
- public BugReportForm(LSLEditorForm parent)
- {
- InitializeComponent();
- this.parent = parent;
- this.Icon = parent.Icon;
- this.textBox1.Text = Properties.Settings.Default.AvatarName;
- this.textBox2.Text = Properties.Settings.Default.EmailAddress;
- this.listView1.Columns.Add("ScriptName",this.listView1.Width-30);
- foreach (Form form in parent.Children)
- {
- EditForm editForm = form as EditForm;
- if (editForm == null || editForm.IsDisposed)
- continue;
- ListViewItem lvi = new ListViewItem(editForm.ScriptName);
- lvi.Checked = false;
- this.listView1.Items.Add(lvi);
- }
- ShowBugReportsList();
- }
-
- private void ShowBugReportsList()
- {
- if (Properties.Settings.Default.Bugreports == null)
- return;
- this.listView2.Items.Clear();
- foreach (string Handle in Properties.Settings.Default.Bugreports)
- {
- long result;
- if (!long.TryParse(Handle, out result))
- continue;
- result *= (long)1e7;
- DateTime dateTime = new DateTime(result);
- ListViewItem lvi = new ListViewItem(Handle);
- lvi.SubItems.Add(dateTime.ToString());
- lvi.Tag = Handle;
- this.listView2.Items.Add(lvi);
- }
- }
-
- //close
- private void button3_Click(object sender, EventArgs e)
- {
- this.timer1.Stop();
- if (ubr != null)
- ubr.Stop();
- this.Close();
- }
-
- // cancel
- private void button2_Click(object sender, EventArgs e)
- {
- this.button2.Enabled = false;
- this.timer1.Stop();
- this.progressBar1.Value = 0;
- if (ubr != null)
- ubr.Stop();
- this.button1.Enabled = true;
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- string strMessage = this.textBox3.Text.Trim();
- if (strMessage == "")
- {
- MessageBox.Show("The bug report is empty(?!), it is not send!", "Bug report", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- ubr = new UploadBugReport();
- this.button1.Enabled = false;
- this.button2.Enabled = true;
- this.blnComplete = false;
- this.timer1.Start();
- ubr.OnComplete += new UploadBugReport.UploadCompleteHandler(ubr_OnComplete);
- List list = new List();
- StringBuilder sb = new StringBuilder();
-
- Properties.Settings.Default.AvatarName = this.textBox1.Text;
- Properties.Settings.Default.EmailAddress = this.textBox2.Text;
-
- sb.AppendFormat("Version: {0} {1}\r\n",
- this.parent.Text,
- Assembly.GetExecutingAssembly().GetName().Version.ToString());
- sb.AppendFormat("Name: {0}\r\n", this.textBox1.Text);
- sb.AppendFormat("Email: {0}\r\n\r\n", this.textBox2.Text);
- sb.Append(this.textBox3.Text);
- list.Add(new UploadBugReport.FileToUpload("bugreport.txt", sb.ToString()));
- foreach (ListViewItem lvi in this.listView1.Items)
- {
- if (!lvi.Checked)
- continue;
- string strScriptName = lvi.Text;
- string strBody = null;
- foreach (Form form in parent.Children)
- {
- EditForm editForm = form as EditForm;
- if (editForm == null || editForm.IsDisposed)
- continue;
- if (editForm.ScriptName == strScriptName)
- strBody = editForm.SourceCode;
- }
- if(strBody != null)
- list.Add(new UploadBugReport.FileToUpload(strScriptName, strBody));
- }
- ubr.UploadAsync(list, this.progressBar1);
- }
-
- void ubr_OnComplete(object sender, UploadBugReport.UploadCompleteEventArgs e)
- {
- if(e.TotalBytes == -1)
- MessageBox.Show("There is something wrong. Your bug report has not been sent!!", "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- else
- MessageBox.Show("Your bug report has been sent (" + e.TotalBytes + " bytes)", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.blnComplete = true;
- }
-
- private void timer1_Tick(object sender, EventArgs e)
- {
- if (this.blnComplete)
- {
- this.timer1.Stop();
-
- this.button1.Enabled = true;
- this.button2.Enabled = false;
-
- this.progressBar1.Value = 0;
- this.textBox3.Clear();
- ShowBugReportsList();
- this.tabControl1.SelectedIndex = 1;
- }
-
- if (ubr != null)
- {
- if (!ubr.blnRunning)
- {
- this.button1.Enabled = true;
- this.timer1.Stop();
- }
- }
-
- }
-
- private void listView2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView2.SelectedItems.Count == 0)
- return;
- ListViewItem lvi = this.listView2.SelectedItems[0];
- string Handle = lvi.Tag.ToString();
-
- Service1 service1 = new Service1();
- service1.GetStatusCompleted += new GetStatusCompletedEventHandler(service1_GetStatusCompleted);
- service1.GetStatusAsync(Handle, Handle);
- }
-
- void service1_GetStatusCompleted(object sender, GetStatusCompletedEventArgs e)
- {
- this.textBox5.Clear();
- string Handle = e.UserState.ToString();
- if (e.Error != null)
- {
- this.textBox4.Text = "Bug report [" + Handle + "] not available (at this time)";
- return;
- }
-
- string strResult = e.Result;
- if (strResult == null)
- {
- this.textBox5.Text = "Bug report [" + Handle + "] does not exist (anymore)";
- return;
- }
-
- this.textBox5.Text = strResult.Replace("\n", "\r\n");
-
- Service1 service1 = new Service1();
- service1.GetBugReportCompleted += new GetBugReportCompletedEventHandler(service1_GetBugReportCompleted);
- service1.GetBugReportAsync(Handle, Handle);
- }
-
- void service1_GetBugReportCompleted(object sender, GetBugReportCompletedEventArgs e)
- {
- this.textBox4.Clear();
- string Handle = e.UserState.ToString();
-
- if (e.Error != null)
- {
- this.textBox4.Text = "Bug report [" + Handle + "] not available (at this time)";
- return;
- }
-
- string strResult = e.Result;
- if (strResult == null)
- {
- this.textBox4.Text = "Bug report [" + Handle + "] does not extist (anymore)";
- return;
- }
-
- this.textBox4.Text = strResult.Replace("\n", "\r\n");
- }
-
- private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (this.listView2.SelectedItems.Count == 0)
- return;
-
- if (MessageBox.Show("Delete " + this.listView2.SelectedItems.Count + " bugreports?", "Delete Bugreports", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
- {
- for(int intI=0; intI
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+// BugReportForm.cs
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.Reflection;
+
+using LSLEditor.org.lsleditor.www;
+
+
+namespace LSLEditor.BugReport
+{
+ public partial class BugReportForm : Form
+ {
+ private bool blnComplete;
+ private UploadBugReport ubr;
+
+ private LSLEditorForm parent;
+
+ public BugReportForm(LSLEditorForm parent)
+ {
+ InitializeComponent();
+ this.parent = parent;
+ this.Icon = parent.Icon;
+ this.textBox1.Text = Properties.Settings.Default.AvatarName;
+ this.textBox2.Text = Properties.Settings.Default.EmailAddress;
+ this.listView1.Columns.Add("ScriptName",this.listView1.Width-30);
+ foreach (Form form in parent.Children)
+ {
+ EditForm editForm = form as EditForm;
+ if (editForm == null || editForm.IsDisposed)
+ continue;
+ ListViewItem lvi = new ListViewItem(editForm.ScriptName);
+ lvi.Checked = false;
+ this.listView1.Items.Add(lvi);
+ }
+ ShowBugReportsList();
+ }
+
+ private void ShowBugReportsList()
+ {
+ if (Properties.Settings.Default.Bugreports == null)
+ return;
+ this.listView2.Items.Clear();
+ foreach (string Handle in Properties.Settings.Default.Bugreports)
+ {
+ long result;
+ if (!long.TryParse(Handle, out result))
+ continue;
+ result *= (long)1e7;
+ DateTime dateTime = new DateTime(result);
+ ListViewItem lvi = new ListViewItem(Handle);
+ lvi.SubItems.Add(dateTime.ToString());
+ lvi.Tag = Handle;
+ this.listView2.Items.Add(lvi);
+ }
+ }
+
+ //close
+ private void button3_Click(object sender, EventArgs e)
+ {
+ this.timer1.Stop();
+ if (ubr != null)
+ ubr.Stop();
+ this.Close();
+ }
+
+ // cancel
+ private void button2_Click(object sender, EventArgs e)
+ {
+ this.button2.Enabled = false;
+ this.timer1.Stop();
+ this.progressBar1.Value = 0;
+ if (ubr != null)
+ ubr.Stop();
+ this.button1.Enabled = true;
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ string strMessage = this.textBox3.Text.Trim();
+ if (strMessage == "")
+ {
+ MessageBox.Show("The bug report is empty(?!), it is not send!", "Bug report", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ return;
+ }
+ ubr = new UploadBugReport();
+ this.button1.Enabled = false;
+ this.button2.Enabled = true;
+ this.blnComplete = false;
+ this.timer1.Start();
+ ubr.OnComplete += new UploadBugReport.UploadCompleteHandler(ubr_OnComplete);
+ List list = new List();
+ StringBuilder sb = new StringBuilder();
+
+ Properties.Settings.Default.AvatarName = this.textBox1.Text;
+ Properties.Settings.Default.EmailAddress = this.textBox2.Text;
+
+ sb.AppendFormat("Version: {0} {1}\r\n",
+ this.parent.Text,
+ Assembly.GetExecutingAssembly().GetName().Version.ToString());
+ sb.AppendFormat("Name: {0}\r\n", this.textBox1.Text);
+ sb.AppendFormat("Email: {0}\r\n\r\n", this.textBox2.Text);
+ sb.Append(this.textBox3.Text);
+ list.Add(new UploadBugReport.FileToUpload("bugreport.txt", sb.ToString()));
+ foreach (ListViewItem lvi in this.listView1.Items)
+ {
+ if (!lvi.Checked)
+ continue;
+ string strScriptName = lvi.Text;
+ string strBody = null;
+ foreach (Form form in parent.Children)
+ {
+ EditForm editForm = form as EditForm;
+ if (editForm == null || editForm.IsDisposed)
+ continue;
+ if (editForm.ScriptName == strScriptName)
+ strBody = editForm.SourceCode;
+ }
+ if(strBody != null)
+ list.Add(new UploadBugReport.FileToUpload(strScriptName, strBody));
+ }
+ ubr.UploadAsync(list, this.progressBar1);
+ }
+
+ void ubr_OnComplete(object sender, UploadBugReport.UploadCompleteEventArgs e)
+ {
+ if(e.TotalBytes == -1)
+ MessageBox.Show("There is something wrong. Your bug report has not been sent!!", "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ else
+ MessageBox.Show("Your bug report has been sent (" + e.TotalBytes + " bytes)", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ this.blnComplete = true;
+ }
+
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ if (this.blnComplete)
+ {
+ this.timer1.Stop();
+
+ this.button1.Enabled = true;
+ this.button2.Enabled = false;
+
+ this.progressBar1.Value = 0;
+ this.textBox3.Clear();
+ ShowBugReportsList();
+ this.tabControl1.SelectedIndex = 1;
+ }
+
+ if (ubr != null)
+ {
+ if (!ubr.blnRunning)
+ {
+ this.button1.Enabled = true;
+ this.timer1.Stop();
+ }
+ }
+
+ }
+
+ private void listView2_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (this.listView2.SelectedItems.Count == 0)
+ return;
+ ListViewItem lvi = this.listView2.SelectedItems[0];
+ string Handle = lvi.Tag.ToString();
+
+ Service1 service1 = new Service1();
+ service1.GetStatusCompleted += new GetStatusCompletedEventHandler(service1_GetStatusCompleted);
+ service1.GetStatusAsync(Handle, Handle);
+ }
+
+ void service1_GetStatusCompleted(object sender, GetStatusCompletedEventArgs e)
+ {
+ this.textBox5.Clear();
+ string Handle = e.UserState.ToString();
+ if (e.Error != null)
+ {
+ this.textBox4.Text = "Bug report [" + Handle + "] not available (at this time)";
+ return;
+ }
+
+ string strResult = e.Result;
+ if (strResult == null)
+ {
+ this.textBox5.Text = "Bug report [" + Handle + "] does not exist (anymore)";
+ return;
+ }
+
+ this.textBox5.Text = strResult.Replace("\n", "\r\n");
+
+ Service1 service1 = new Service1();
+ service1.GetBugReportCompleted += new GetBugReportCompletedEventHandler(service1_GetBugReportCompleted);
+ service1.GetBugReportAsync(Handle, Handle);
+ }
+
+ void service1_GetBugReportCompleted(object sender, GetBugReportCompletedEventArgs e)
+ {
+ this.textBox4.Clear();
+ string Handle = e.UserState.ToString();
+
+ if (e.Error != null)
+ {
+ this.textBox4.Text = "Bug report [" + Handle + "] not available (at this time)";
+ return;
+ }
+
+ string strResult = e.Result;
+ if (strResult == null)
+ {
+ this.textBox4.Text = "Bug report [" + Handle + "] does not extist (anymore)";
+ return;
+ }
+
+ this.textBox4.Text = strResult.Replace("\n", "\r\n");
+ }
+
+ private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (this.listView2.SelectedItems.Count == 0)
+ return;
+
+ if (MessageBox.Show("Delete " + this.listView2.SelectedItems.Count + " bugreports?", "Delete Bugreports", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
+ {
+ for(int intI=0; intI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 100, 17
-
-
- 17, 17
-
-
- 42
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 100, 17
+
+
+ 17, 17
+
+
+ 42
+
\ No newline at end of file
diff --git a/trunk/BugReport/UploadBugReport.cs b/source/BugReport/UploadBugReport.cs
similarity index 96%
rename from trunk/BugReport/UploadBugReport.cs
rename to source/BugReport/UploadBugReport.cs
index 4ab277e..092769d 100644
--- a/trunk/BugReport/UploadBugReport.cs
+++ b/source/BugReport/UploadBugReport.cs
@@ -1,218 +1,218 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.Text;
-using System.Drawing;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Collections;
-using System.Collections.Specialized;
-using System.Collections.Generic;
-using System.Windows.Forms;
-
-namespace LSLEditor.BugReport
-{
- class UploadBugReport
- {
- public struct FileToUpload
- {
- public string FileName;
- public string Body;
- public string Path;
- public FileToUpload(string FileName, string Body)
- {
- this.FileName = FileName;
- this.Body = Body;
- this.Path = null;
- }
- }
-
- public class UploadCompleteEventArgs : EventArgs
- {
- public int TotalBytes;
- public UploadCompleteEventArgs(int intTotal)
- {
- this.TotalBytes = intTotal;
- }
- }
-
- public bool blnRunning;
-
- public delegate void UploadCompleteHandler(object sender, UploadCompleteEventArgs e);
- public event UploadCompleteHandler OnComplete;
-
- private Thread thread;
- private ProgressBar progressbar;
- private List list;
-
- public void UploadAsync(List list, ProgressBar progressbar)
- {
- this.list = list;
- this.progressbar = progressbar;
-
- this.blnRunning = true;
-
- thread = new Thread(new ThreadStart(Worker));
- thread.IsBackground = true;
- thread.Name = "Worker";
- thread.Start();
- }
-
- public void Stop()
- {
- this.blnRunning = false;
- if (thread != null)
- {
- thread.Join(1000);
- thread = null;
- }
- }
-
- private void Worker()
- {
- int intTotal = 0;
- try
- {
- org.lsleditor.www.Service1 webservice = new org.lsleditor.www.Service1();
-
- string Handle = webservice.Open();
- if (Handle == null)
- {
- MessageBox.Show("Can't get an upload handle", "Oops...");
- this.blnRunning = false;
- return;
- }
-
- if (Properties.Settings.Default.Bugreports == null)
- Properties.Settings.Default.Bugreports = new StringCollection();
- Properties.Settings.Default.Bugreports.Add(Handle);
-
- // Properties.Settings.Default.Save();
-
- int intNumber = 0;
- foreach (FileToUpload file in this.list)
- {
- string strFileName = string.Format("{0}-{1}", intNumber, file.FileName);
- if (file.Path == null)
- {
- intTotal += Upload(Handle, strFileName, Encoding.ASCII.GetBytes(file.Body));
- }
- else
- {
- intTotal += Upload(Handle, strFileName, file.Path);
- }
- intNumber++;
- }
- }
- catch
- {
- intTotal = -1;
- }
- if (this.blnRunning)
- if (OnComplete != null)
- OnComplete(this, new UploadCompleteEventArgs(intTotal));
- this.blnRunning = false;
- }
-
- private delegate void SetValueDelegate(int intValue);
-
- private void SetMaximum(int intMaximum)
- {
- if (this.progressbar.InvokeRequired)
- {
- this.progressbar.Invoke(new SetValueDelegate(SetMaximum), new object[] { intMaximum });
- }
- else
- {
- this.progressbar.Maximum = intMaximum;
- }
- }
-
- private void SetValue(int intValue)
- {
- if (this.progressbar.InvokeRequired)
- {
- this.progressbar.Invoke(new SetValueDelegate(SetValue), new object[] { intValue });
- }
- else
- {
- this.progressbar.Value = intValue;
- }
- }
- private int Upload(string Handle, string FileName, byte[] buffer)
- {
- org.lsleditor.www.Service1 webservice = new org.lsleditor.www.Service1();
- if (Handle == null)
- return 0;
-
- SetMaximum(buffer.Length);
- int intOffset = 0;
- int intTotal = 0;
- byte[] smallbuffer = new byte[1024];
- while (this.blnRunning)
- {
- int intLength = Math.Min(smallbuffer.Length, buffer.Length - intOffset);
- if (intLength <= 0)
- break;
- Array.Copy(buffer, intOffset, smallbuffer, 0, intLength);
- intOffset += intLength;
- string strError = webservice.Write(Handle, FileName, smallbuffer, intLength);
- if (strError != null)
- {
- MessageBox.Show("Error:" + strError, "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- break;
- }
- intTotal += intLength;
- SetValue(intTotal);
- }
- return intTotal;
- }
-
- private int Upload(string Handle, string FileName, string strPath)
- {
- FileStream fs = new FileStream(strPath, FileMode.Open, FileAccess.Read);
- byte[] buffer = new byte[fs.Length];
- fs.Read(buffer, 0, (int)fs.Length);
- fs.Close();
- return Upload(Handle, FileName, buffer);
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Drawing;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace LSLEditor.BugReport
+{
+ class UploadBugReport
+ {
+ public struct FileToUpload
+ {
+ public string FileName;
+ public string Body;
+ public string Path;
+ public FileToUpload(string FileName, string Body)
+ {
+ this.FileName = FileName;
+ this.Body = Body;
+ this.Path = null;
+ }
+ }
+
+ public class UploadCompleteEventArgs : EventArgs
+ {
+ public int TotalBytes;
+ public UploadCompleteEventArgs(int intTotal)
+ {
+ this.TotalBytes = intTotal;
+ }
+ }
+
+ public bool blnRunning;
+
+ public delegate void UploadCompleteHandler(object sender, UploadCompleteEventArgs e);
+ public event UploadCompleteHandler OnComplete;
+
+ private Thread thread;
+ private ProgressBar progressbar;
+ private List list;
+
+ public void UploadAsync(List list, ProgressBar progressbar)
+ {
+ this.list = list;
+ this.progressbar = progressbar;
+
+ this.blnRunning = true;
+
+ thread = new Thread(new ThreadStart(Worker));
+ thread.IsBackground = true;
+ thread.Name = "Worker";
+ thread.Start();
+ }
+
+ public void Stop()
+ {
+ this.blnRunning = false;
+ if (thread != null)
+ {
+ thread.Join(1000);
+ thread = null;
+ }
+ }
+
+ private void Worker()
+ {
+ int intTotal = 0;
+ try
+ {
+ org.lsleditor.www.Service1 webservice = new org.lsleditor.www.Service1();
+
+ string Handle = webservice.Open();
+ if (Handle == null)
+ {
+ MessageBox.Show("Can't get an upload handle", "Oops...");
+ this.blnRunning = false;
+ return;
+ }
+
+ if (Properties.Settings.Default.Bugreports == null)
+ Properties.Settings.Default.Bugreports = new StringCollection();
+ Properties.Settings.Default.Bugreports.Add(Handle);
+
+ // Properties.Settings.Default.Save();
+
+ int intNumber = 0;
+ foreach (FileToUpload file in this.list)
+ {
+ string strFileName = string.Format("{0}-{1}", intNumber, file.FileName);
+ if (file.Path == null)
+ {
+ intTotal += Upload(Handle, strFileName, Encoding.ASCII.GetBytes(file.Body));
+ }
+ else
+ {
+ intTotal += Upload(Handle, strFileName, file.Path);
+ }
+ intNumber++;
+ }
+ }
+ catch
+ {
+ intTotal = -1;
+ }
+ if (this.blnRunning)
+ if (OnComplete != null)
+ OnComplete(this, new UploadCompleteEventArgs(intTotal));
+ this.blnRunning = false;
+ }
+
+ private delegate void SetValueDelegate(int intValue);
+
+ private void SetMaximum(int intMaximum)
+ {
+ if (this.progressbar.InvokeRequired)
+ {
+ this.progressbar.Invoke(new SetValueDelegate(SetMaximum), new object[] { intMaximum });
+ }
+ else
+ {
+ this.progressbar.Maximum = intMaximum;
+ }
+ }
+
+ private void SetValue(int intValue)
+ {
+ if (this.progressbar.InvokeRequired)
+ {
+ this.progressbar.Invoke(new SetValueDelegate(SetValue), new object[] { intValue });
+ }
+ else
+ {
+ this.progressbar.Value = intValue;
+ }
+ }
+ private int Upload(string Handle, string FileName, byte[] buffer)
+ {
+ org.lsleditor.www.Service1 webservice = new org.lsleditor.www.Service1();
+ if (Handle == null)
+ return 0;
+
+ SetMaximum(buffer.Length);
+ int intOffset = 0;
+ int intTotal = 0;
+ byte[] smallbuffer = new byte[1024];
+ while (this.blnRunning)
+ {
+ int intLength = Math.Min(smallbuffer.Length, buffer.Length - intOffset);
+ if (intLength <= 0)
+ break;
+ Array.Copy(buffer, intOffset, smallbuffer, 0, intLength);
+ intOffset += intLength;
+ string strError = webservice.Write(Handle, FileName, smallbuffer, intLength);
+ if (strError != null)
+ {
+ MessageBox.Show("Error:" + strError, "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ break;
+ }
+ intTotal += intLength;
+ SetValue(intTotal);
+ }
+ return intTotal;
+ }
+
+ private int Upload(string Handle, string FileName, string strPath)
+ {
+ FileStream fs = new FileStream(strPath, FileMode.Open, FileAccess.Read);
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, (int)fs.Length);
+ fs.Close();
+ return Upload(Handle, FileName, buffer);
+ }
+ }
+}
diff --git a/trunk/Decompressor/Decompress.cs b/source/Decompressor/Decompress.cs
similarity index 97%
rename from trunk/Decompressor/Decompress.cs
rename to source/Decompressor/Decompress.cs
index 504e110..30703ae 100644
--- a/trunk/Decompressor/Decompress.cs
+++ b/source/Decompressor/Decompress.cs
@@ -1,93 +1,93 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System; // bitconvertor
-using System.IO;
-using System.IO.Compression;
-
-using System.Security.Cryptography;
-
-
-namespace LSLEditor.Decompressor
-{
- public class MD5Verify
- {
- public static string ComputeHash(string strFile)
- {
- MD5CryptoServiceProvider csp = new MD5CryptoServiceProvider();
- FileStream stream = File.OpenRead(strFile);
- byte[] hash = csp.ComputeHash(stream);
- stream.Close();
- return BitConverter.ToString(hash).Replace("-", "").ToLower();
- }
- }
-
- public sealed class Gzip
- {
- public static void Decompress(Stream inStream, Stream outStream)
- {
- using (outStream)
- {
- using (GZipStream zipStream = new GZipStream(inStream, CompressionMode.Decompress))
- {
- int ch = zipStream.ReadByte();
- while (ch != -1)
- {
- outStream.WriteByte((byte)ch);
- ch = zipStream.ReadByte();
- }
- }
- }
- }
- }
-
-
- public sealed class Zip
- {
- public static void Decompress(Stream inStream, Stream outStream)
- {
- ZipEntry zipEntry = ZipEntry.Read(inStream);
- inStream.Close();
- using (outStream)
- {
- zipEntry.Extract(outStream);
- }
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System; // bitconvertor
+using System.IO;
+using System.IO.Compression;
+
+using System.Security.Cryptography;
+
+
+namespace LSLEditor.Decompressor
+{
+ public class MD5Verify
+ {
+ public static string ComputeHash(string strFile)
+ {
+ MD5CryptoServiceProvider csp = new MD5CryptoServiceProvider();
+ FileStream stream = File.OpenRead(strFile);
+ byte[] hash = csp.ComputeHash(stream);
+ stream.Close();
+ return BitConverter.ToString(hash).Replace("-", "").ToLower();
+ }
+ }
+
+ public sealed class Gzip
+ {
+ public static void Decompress(Stream inStream, Stream outStream)
+ {
+ using (outStream)
+ {
+ using (GZipStream zipStream = new GZipStream(inStream, CompressionMode.Decompress))
+ {
+ int ch = zipStream.ReadByte();
+ while (ch != -1)
+ {
+ outStream.WriteByte((byte)ch);
+ ch = zipStream.ReadByte();
+ }
+ }
+ }
+ }
+ }
+
+
+ public sealed class Zip
+ {
+ public static void Decompress(Stream inStream, Stream outStream)
+ {
+ ZipEntry zipEntry = ZipEntry.Read(inStream);
+ inStream.Close();
+ using (outStream)
+ {
+ zipEntry.Extract(outStream);
+ }
+ }
+ }
+}
diff --git a/trunk/Decompressor/ZipEntry.cs b/source/Decompressor/ZipEntry.cs
similarity index 96%
rename from trunk/Decompressor/ZipEntry.cs
rename to source/Decompressor/ZipEntry.cs
index 35f1aaa..d8437bd 100644
--- a/trunk/Decompressor/ZipEntry.cs
+++ b/source/Decompressor/ZipEntry.cs
@@ -1,367 +1,367 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-
-namespace LSLEditor.Decompressor
-{
-
- public class ZipEntry
- {
-
- private const int ZipEntrySignature = 0x04034b50;
- private const int ZipEntryDataDescriptorSignature = 0x08074b50;
-
- private DateTime _LastModified;
-
- private string _FileName;
-
- private Int16 _VersionNeeded;
-
- private Int16 _BitField;
-
- private Int16 _CompressionMethod;
-
- private Int32 _CompressedSize;
-
- private Int32 _UncompressedSize;
-
- private Int32 _LastModDateTime;
- private Int32 _Crc32;
- private byte[] _Extra;
-
- private byte[] __filedata;
- private byte[] _FileData
- {
- get
- {
- if (__filedata == null)
- {
- }
- return __filedata;
- }
- }
-
- private System.IO.MemoryStream _UnderlyingMemoryStream;
- private System.IO.Compression.DeflateStream _CompressedStream;
- private System.IO.Compression.DeflateStream CompressedStream
- {
- get
- {
- if (_CompressedStream == null)
- {
- _UnderlyingMemoryStream = new System.IO.MemoryStream();
- bool LeaveUnderlyingStreamOpen = true;
- _CompressedStream = new System.IO.Compression.DeflateStream(_UnderlyingMemoryStream,
- System.IO.Compression.CompressionMode.Compress,
- LeaveUnderlyingStreamOpen);
- }
- return _CompressedStream;
- }
- }
-
- private static bool ReadHeader(System.IO.Stream s, ZipEntry ze)
- {
- int signature = Shared.ReadSignature(s);
-
- // return null if this is not a local file header signature
- if (SignatureIsNotValid(signature))
- {
- s.Seek(-4, System.IO.SeekOrigin.Current);
- return false;
- }
-
- byte[] block = new byte[26];
- int n = s.Read(block, 0, block.Length);
- if (n != block.Length) return false;
-
- int i = 0;
- ze._VersionNeeded = (short)(block[i++] + block[i++] * 256);
- ze._BitField = (short)(block[i++] + block[i++] * 256);
- ze._CompressionMethod = (short)(block[i++] + block[i++] * 256);
- ze._LastModDateTime = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
-
- // the PKZIP spec says that if bit 3 is set (0x0008), then the CRC, Compressed size, and uncompressed size
- // come directly after the file data. The only way to find it is to scan the zip archive for the signature of
- // the Data Descriptor, and presume that that signature does not appear in the (compressed) data of the compressed file.
-
- if ((ze._BitField & 0x0008) != 0x0008)
- {
- ze._Crc32 = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
- ze._CompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
- ze._UncompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
- }
- else
- {
- // the CRC, compressed size, and uncompressed size are stored later in the stream.
- // here, we advance the pointer.
- i += 12;
- }
-
- Int16 filenameLength = (short)(block[i++] + block[i++] * 256);
- Int16 extraFieldLength = (short)(block[i++] + block[i++] * 256);
-
- block = new byte[filenameLength];
- n = s.Read(block, 0, block.Length);
- ze._FileName = Shared.StringFromBuffer(block, 0, block.Length);
-
- ze._Extra = new byte[extraFieldLength];
- n = s.Read(ze._Extra, 0, ze._Extra.Length);
-
- // transform the time data into something usable
- ze._LastModified = Shared.PackedToDateTime(ze._LastModDateTime);
-
- // actually get the compressed size and CRC if necessary
- if ((ze._BitField & 0x0008) == 0x0008)
- {
- long posn = s.Position;
- long SizeOfDataRead = Shared.FindSignature(s, ZipEntryDataDescriptorSignature);
- if (SizeOfDataRead == -1) return false;
-
- // read 3x 4-byte fields (CRC, Compressed Size, Uncompressed Size)
- block = new byte[12];
- n = s.Read(block, 0, block.Length);
- if (n != 12) return false;
- i = 0;
- ze._Crc32 = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
- ze._CompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
- ze._UncompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
-
- if (SizeOfDataRead != ze._CompressedSize)
- throw new Exception("Data format error (bit 3 is set)");
-
- // seek back to previous position, to read file data
- s.Seek(posn, System.IO.SeekOrigin.Begin);
- }
-
- return true;
- }
-
-
- private static bool SignatureIsNotValid(int signature)
- {
- return (signature != ZipEntrySignature);
- }
-
- public static ZipEntry Read(System.IO.Stream s)
- {
- ZipEntry entry = new ZipEntry();
- if (!ReadHeader(s, entry)) return null;
-
- entry.__filedata = new byte[entry._CompressedSize];
- int n = s.Read(entry._FileData, 0, entry._FileData.Length);
- if (n != entry._FileData.Length)
- {
- throw new Exception("badly formatted zip file.");
- }
- // finally, seek past the (already read) Data descriptor if necessary
- if ((entry._BitField & 0x0008) == 0x0008)
- {
- s.Seek(16, System.IO.SeekOrigin.Current);
- }
- return entry;
- }
-
-
- public void Extract(System.IO.Stream s)
- {
- using (System.IO.MemoryStream memstream = new System.IO.MemoryStream(_FileData))
- {
- System.IO.Stream input = null;
- try
- {
- if (this._CompressedSize == this._UncompressedSize)
- {
- input = memstream;
- }
- else
- {
- input = new System.IO.Compression.DeflateStream(memstream, System.IO.Compression.CompressionMode.Decompress);
- }
-
- System.IO.Stream output = null;
- try
- {
- output = s;
-
-
- byte[] bytes = new byte[4096];
- int n;
-
- n = 1; // anything non-zero
- while (n != 0)
- {
- n = input.Read(bytes, 0, bytes.Length);
- if (n > 0)
- {
- output.Write(bytes, 0, n);
- }
- }
- }
- finally
- {
- // we only close the output stream if we opened it.
- if (output != null)
- {
- output.Close();
- output.Dispose();
- }
- }
- }
- finally
- {
- // we only close the output stream if we opened it.
- // we cannot use using() here because in some cases we do not want to Dispose the stream!
- if ((input != null) && (input != memstream))
- {
- input.Close();
- input.Dispose();
- }
- }
- }
- }
-
- }
-
- class Shared
- {
- protected internal static string StringFromBuffer(byte[] buf, int start, int maxlength)
- {
- int i;
- char[] c = new char[maxlength];
- for (i = 0; (i < maxlength) && (i < buf.Length) && (buf[i] != 0); i++)
- {
- c[i] = (char)buf[i]; // System.BitConverter.ToChar(buf, start+i*2);
- }
- string s = new System.String(c, 0, i);
- return s;
- }
-
- protected internal static int ReadSignature(System.IO.Stream s)
- {
- int n = 0;
- byte[] sig = new byte[4];
- n = s.Read(sig, 0, sig.Length);
- if (n != sig.Length) throw new Exception("Could not read signature - no data!");
- int signature = (((sig[3] * 256 + sig[2]) * 256) + sig[1]) * 256 + sig[0];
- return signature;
- }
-
- protected internal static long FindSignature(System.IO.Stream s, int SignatureToFind)
- {
- long startingPosition = s.Position;
-
- int BATCH_SIZE = 1024;
- byte[] targetBytes = new byte[4];
- targetBytes[0] = (byte)(SignatureToFind >> 24);
- targetBytes[1] = (byte)((SignatureToFind & 0x00FF0000) >> 16);
- targetBytes[2] = (byte)((SignatureToFind & 0x0000FF00) >> 8);
- targetBytes[3] = (byte)(SignatureToFind & 0x000000FF);
- byte[] batch = new byte[BATCH_SIZE];
- int n = 0;
- bool success = false;
- do
- {
- n = s.Read(batch, 0, batch.Length);
- if (n != 0)
- {
- for (int i = 0; i < n; i++)
- {
- if (batch[i] == targetBytes[3])
- {
- s.Seek(i - n, System.IO.SeekOrigin.Current);
- int sig = ReadSignature(s);
- success = (sig == SignatureToFind);
- if (!success) s.Seek(-3, System.IO.SeekOrigin.Current);
- break; // out of for loop
- }
- }
- }
- else break;
- if (success) break;
- } while (true);
- if (!success)
- {
- s.Seek(startingPosition, System.IO.SeekOrigin.Begin);
- return -1; // or throw?
- }
-
- // subtract 4 for the signature.
- long bytesRead = (s.Position - startingPosition) - 4;
- // number of bytes read, should be the same as compressed size of file
- return bytesRead;
- }
- protected internal static DateTime PackedToDateTime(Int32 packedDateTime)
- {
- Int16 packedTime = (Int16)(packedDateTime & 0x0000ffff);
- Int16 packedDate = (Int16)((packedDateTime & 0xffff0000) >> 16);
-
- int year = 1980 + ((packedDate & 0xFE00) >> 9);
- int month = (packedDate & 0x01E0) >> 5;
- int day = packedDate & 0x001F;
-
-
- int hour = (packedTime & 0xF800) >> 11;
- int minute = (packedTime & 0x07E0) >> 5;
- int second = packedTime & 0x001F;
-
- DateTime d = System.DateTime.Now;
- try { d = new System.DateTime(year, month, day, hour, minute, second, 0); }
- catch
- {
- Console.Write("\nInvalid date/time?:\nyear: {0} ", year);
- Console.Write("month: {0} ", month);
- Console.WriteLine("day: {0} ", day);
- Console.WriteLine("HH:MM:SS= {0}:{1}:{2}", hour, minute, second);
- }
-
- return d;
- }
-
-
- protected internal static Int32 DateTimeToPacked(DateTime time)
- {
- UInt16 packedDate = (UInt16)((time.Day & 0x0000001F) | ((time.Month << 5) & 0x000001E0) | (((time.Year - 1980) << 9) & 0x0000FE00));
- UInt16 packedTime = (UInt16)((time.Second & 0x0000001F) | ((time.Minute << 5) & 0x000007E0) | ((time.Hour << 11) & 0x0000F800));
- return (Int32)(((UInt32)(packedDate << 16)) | packedTime);
- }
- }
-
-}
-
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+
+namespace LSLEditor.Decompressor
+{
+
+ public class ZipEntry
+ {
+
+ private const int ZipEntrySignature = 0x04034b50;
+ private const int ZipEntryDataDescriptorSignature = 0x08074b50;
+
+ private DateTime _LastModified;
+
+ private string _FileName;
+
+ private Int16 _VersionNeeded;
+
+ private Int16 _BitField;
+
+ private Int16 _CompressionMethod;
+
+ private Int32 _CompressedSize;
+
+ private Int32 _UncompressedSize;
+
+ private Int32 _LastModDateTime;
+ private Int32 _Crc32;
+ private byte[] _Extra;
+
+ private byte[] __filedata;
+ private byte[] _FileData
+ {
+ get
+ {
+ if (__filedata == null)
+ {
+ }
+ return __filedata;
+ }
+ }
+
+ private System.IO.MemoryStream _UnderlyingMemoryStream;
+ private System.IO.Compression.DeflateStream _CompressedStream;
+ private System.IO.Compression.DeflateStream CompressedStream
+ {
+ get
+ {
+ if (_CompressedStream == null)
+ {
+ _UnderlyingMemoryStream = new System.IO.MemoryStream();
+ bool LeaveUnderlyingStreamOpen = true;
+ _CompressedStream = new System.IO.Compression.DeflateStream(_UnderlyingMemoryStream,
+ System.IO.Compression.CompressionMode.Compress,
+ LeaveUnderlyingStreamOpen);
+ }
+ return _CompressedStream;
+ }
+ }
+
+ private static bool ReadHeader(System.IO.Stream s, ZipEntry ze)
+ {
+ int signature = Shared.ReadSignature(s);
+
+ // return null if this is not a local file header signature
+ if (SignatureIsNotValid(signature))
+ {
+ s.Seek(-4, System.IO.SeekOrigin.Current);
+ return false;
+ }
+
+ byte[] block = new byte[26];
+ int n = s.Read(block, 0, block.Length);
+ if (n != block.Length) return false;
+
+ int i = 0;
+ ze._VersionNeeded = (short)(block[i++] + block[i++] * 256);
+ ze._BitField = (short)(block[i++] + block[i++] * 256);
+ ze._CompressionMethod = (short)(block[i++] + block[i++] * 256);
+ ze._LastModDateTime = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+
+ // the PKZIP spec says that if bit 3 is set (0x0008), then the CRC, Compressed size, and uncompressed size
+ // come directly after the file data. The only way to find it is to scan the zip archive for the signature of
+ // the Data Descriptor, and presume that that signature does not appear in the (compressed) data of the compressed file.
+
+ if ((ze._BitField & 0x0008) != 0x0008)
+ {
+ ze._Crc32 = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+ ze._CompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+ ze._UncompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+ }
+ else
+ {
+ // the CRC, compressed size, and uncompressed size are stored later in the stream.
+ // here, we advance the pointer.
+ i += 12;
+ }
+
+ Int16 filenameLength = (short)(block[i++] + block[i++] * 256);
+ Int16 extraFieldLength = (short)(block[i++] + block[i++] * 256);
+
+ block = new byte[filenameLength];
+ n = s.Read(block, 0, block.Length);
+ ze._FileName = Shared.StringFromBuffer(block, 0, block.Length);
+
+ ze._Extra = new byte[extraFieldLength];
+ n = s.Read(ze._Extra, 0, ze._Extra.Length);
+
+ // transform the time data into something usable
+ ze._LastModified = Shared.PackedToDateTime(ze._LastModDateTime);
+
+ // actually get the compressed size and CRC if necessary
+ if ((ze._BitField & 0x0008) == 0x0008)
+ {
+ long posn = s.Position;
+ long SizeOfDataRead = Shared.FindSignature(s, ZipEntryDataDescriptorSignature);
+ if (SizeOfDataRead == -1) return false;
+
+ // read 3x 4-byte fields (CRC, Compressed Size, Uncompressed Size)
+ block = new byte[12];
+ n = s.Read(block, 0, block.Length);
+ if (n != 12) return false;
+ i = 0;
+ ze._Crc32 = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+ ze._CompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+ ze._UncompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+
+ if (SizeOfDataRead != ze._CompressedSize)
+ throw new Exception("Data format error (bit 3 is set)");
+
+ // seek back to previous position, to read file data
+ s.Seek(posn, System.IO.SeekOrigin.Begin);
+ }
+
+ return true;
+ }
+
+
+ private static bool SignatureIsNotValid(int signature)
+ {
+ return (signature != ZipEntrySignature);
+ }
+
+ public static ZipEntry Read(System.IO.Stream s)
+ {
+ ZipEntry entry = new ZipEntry();
+ if (!ReadHeader(s, entry)) return null;
+
+ entry.__filedata = new byte[entry._CompressedSize];
+ int n = s.Read(entry._FileData, 0, entry._FileData.Length);
+ if (n != entry._FileData.Length)
+ {
+ throw new Exception("badly formatted zip file.");
+ }
+ // finally, seek past the (already read) Data descriptor if necessary
+ if ((entry._BitField & 0x0008) == 0x0008)
+ {
+ s.Seek(16, System.IO.SeekOrigin.Current);
+ }
+ return entry;
+ }
+
+
+ public void Extract(System.IO.Stream s)
+ {
+ using (System.IO.MemoryStream memstream = new System.IO.MemoryStream(_FileData))
+ {
+ System.IO.Stream input = null;
+ try
+ {
+ if (this._CompressedSize == this._UncompressedSize)
+ {
+ input = memstream;
+ }
+ else
+ {
+ input = new System.IO.Compression.DeflateStream(memstream, System.IO.Compression.CompressionMode.Decompress);
+ }
+
+ System.IO.Stream output = null;
+ try
+ {
+ output = s;
+
+
+ byte[] bytes = new byte[4096];
+ int n;
+
+ n = 1; // anything non-zero
+ while (n != 0)
+ {
+ n = input.Read(bytes, 0, bytes.Length);
+ if (n > 0)
+ {
+ output.Write(bytes, 0, n);
+ }
+ }
+ }
+ finally
+ {
+ // we only close the output stream if we opened it.
+ if (output != null)
+ {
+ output.Close();
+ output.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ // we only close the output stream if we opened it.
+ // we cannot use using() here because in some cases we do not want to Dispose the stream!
+ if ((input != null) && (input != memstream))
+ {
+ input.Close();
+ input.Dispose();
+ }
+ }
+ }
+ }
+
+ }
+
+ class Shared
+ {
+ protected internal static string StringFromBuffer(byte[] buf, int start, int maxlength)
+ {
+ int i;
+ char[] c = new char[maxlength];
+ for (i = 0; (i < maxlength) && (i < buf.Length) && (buf[i] != 0); i++)
+ {
+ c[i] = (char)buf[i]; // System.BitConverter.ToChar(buf, start+i*2);
+ }
+ string s = new System.String(c, 0, i);
+ return s;
+ }
+
+ protected internal static int ReadSignature(System.IO.Stream s)
+ {
+ int n = 0;
+ byte[] sig = new byte[4];
+ n = s.Read(sig, 0, sig.Length);
+ if (n != sig.Length) throw new Exception("Could not read signature - no data!");
+ int signature = (((sig[3] * 256 + sig[2]) * 256) + sig[1]) * 256 + sig[0];
+ return signature;
+ }
+
+ protected internal static long FindSignature(System.IO.Stream s, int SignatureToFind)
+ {
+ long startingPosition = s.Position;
+
+ int BATCH_SIZE = 1024;
+ byte[] targetBytes = new byte[4];
+ targetBytes[0] = (byte)(SignatureToFind >> 24);
+ targetBytes[1] = (byte)((SignatureToFind & 0x00FF0000) >> 16);
+ targetBytes[2] = (byte)((SignatureToFind & 0x0000FF00) >> 8);
+ targetBytes[3] = (byte)(SignatureToFind & 0x000000FF);
+ byte[] batch = new byte[BATCH_SIZE];
+ int n = 0;
+ bool success = false;
+ do
+ {
+ n = s.Read(batch, 0, batch.Length);
+ if (n != 0)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ if (batch[i] == targetBytes[3])
+ {
+ s.Seek(i - n, System.IO.SeekOrigin.Current);
+ int sig = ReadSignature(s);
+ success = (sig == SignatureToFind);
+ if (!success) s.Seek(-3, System.IO.SeekOrigin.Current);
+ break; // out of for loop
+ }
+ }
+ }
+ else break;
+ if (success) break;
+ } while (true);
+ if (!success)
+ {
+ s.Seek(startingPosition, System.IO.SeekOrigin.Begin);
+ return -1; // or throw?
+ }
+
+ // subtract 4 for the signature.
+ long bytesRead = (s.Position - startingPosition) - 4;
+ // number of bytes read, should be the same as compressed size of file
+ return bytesRead;
+ }
+ protected internal static DateTime PackedToDateTime(Int32 packedDateTime)
+ {
+ Int16 packedTime = (Int16)(packedDateTime & 0x0000ffff);
+ Int16 packedDate = (Int16)((packedDateTime & 0xffff0000) >> 16);
+
+ int year = 1980 + ((packedDate & 0xFE00) >> 9);
+ int month = (packedDate & 0x01E0) >> 5;
+ int day = packedDate & 0x001F;
+
+
+ int hour = (packedTime & 0xF800) >> 11;
+ int minute = (packedTime & 0x07E0) >> 5;
+ int second = packedTime & 0x001F;
+
+ DateTime d = System.DateTime.Now;
+ try { d = new System.DateTime(year, month, day, hour, minute, second, 0); }
+ catch
+ {
+ Console.Write("\nInvalid date/time?:\nyear: {0} ", year);
+ Console.Write("month: {0} ", month);
+ Console.WriteLine("day: {0} ", day);
+ Console.WriteLine("HH:MM:SS= {0}:{1}:{2}", hour, minute, second);
+ }
+
+ return d;
+ }
+
+
+ protected internal static Int32 DateTimeToPacked(DateTime time)
+ {
+ UInt16 packedDate = (UInt16)((time.Day & 0x0000001F) | ((time.Month << 5) & 0x000001E0) | (((time.Year - 1980) << 9) & 0x0000FE00));
+ UInt16 packedTime = (UInt16)((time.Second & 0x0000001F) | ((time.Minute << 5) & 0x000007E0) | ((time.Hour << 11) & 0x0000F800));
+ return (Int32)(((UInt32)(packedDate << 16)) | packedTime);
+ }
+ }
+
+}
+
diff --git a/trunk/Docking/AutoHideStripBase.cs b/source/Docking/AutoHideStripBase.cs
similarity index 96%
rename from trunk/Docking/AutoHideStripBase.cs
rename to source/Docking/AutoHideStripBase.cs
index 5889641..6f56b38 100644
--- a/trunk/Docking/AutoHideStripBase.cs
+++ b/source/Docking/AutoHideStripBase.cs
@@ -1,530 +1,530 @@
-using System;
-using System.Collections;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- public abstract partial class AutoHideStripBase : Control
- {
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- protected class Tab : IDisposable
- {
- private IDockContent m_content;
-
- protected internal Tab(IDockContent content)
- {
- m_content = content;
- }
-
- ~Tab()
- {
- Dispose(false);
- }
-
- public IDockContent Content
- {
- get { return m_content; }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- }
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- protected sealed class TabCollection : IEnumerable
- {
- #region IEnumerable Members
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (int i = 0; i < Count; i++)
- yield return this[i];
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (int i = 0; i < Count; i++)
- yield return this[i];
- }
- #endregion
-
- internal TabCollection(DockPane pane)
- {
- m_dockPane = pane;
- }
-
- private DockPane m_dockPane = null;
- public DockPane DockPane
- {
- get { return m_dockPane; }
- }
-
- public DockPanel DockPanel
- {
- get { return DockPane.DockPanel; }
- }
-
- public int Count
- {
- get { return DockPane.DisplayingContents.Count; }
- }
-
- public Tab this[int index]
- {
- get
- {
- IDockContent content = DockPane.DisplayingContents[index];
- if (content == null)
- throw (new ArgumentOutOfRangeException("index"));
- if (content.DockHandler.AutoHideTab == null)
- content.DockHandler.AutoHideTab = (DockPanel.AutoHideStripControl.CreateTab(content));
- return content.DockHandler.AutoHideTab as Tab;
- }
- }
-
- public bool Contains(Tab tab)
- {
- return (IndexOf(tab) != -1);
- }
-
- public bool Contains(IDockContent content)
- {
- return (IndexOf(content) != -1);
- }
-
- public int IndexOf(Tab tab)
- {
- if (tab == null)
- return -1;
-
- return IndexOf(tab.Content);
- }
-
- public int IndexOf(IDockContent content)
- {
- return DockPane.DisplayingContents.IndexOf(content);
- }
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- protected class Pane : IDisposable
- {
- private DockPane m_dockPane;
-
- protected internal Pane(DockPane dockPane)
- {
- m_dockPane = dockPane;
- }
-
- ~Pane()
- {
- Dispose(false);
- }
-
- public DockPane DockPane
- {
- get { return m_dockPane; }
- }
-
- public TabCollection AutoHideTabs
- {
- get
- {
- if (DockPane.AutoHideTabs == null)
- DockPane.AutoHideTabs = new TabCollection(DockPane);
- return DockPane.AutoHideTabs as TabCollection;
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- }
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- protected sealed class PaneCollection : IEnumerable
- {
- private class AutoHideState
- {
- public DockState m_dockState;
- public bool m_selected = false;
-
- public AutoHideState(DockState dockState)
- {
- m_dockState = dockState;
- }
-
- public DockState DockState
- {
- get { return m_dockState; }
- }
-
- public bool Selected
- {
- get { return m_selected; }
- set { m_selected = value; }
- }
- }
-
- private class AutoHideStateCollection
- {
- private AutoHideState[] m_states;
-
- public AutoHideStateCollection()
- {
- m_states = new AutoHideState[] {
- new AutoHideState(DockState.DockTopAutoHide),
- new AutoHideState(DockState.DockBottomAutoHide),
- new AutoHideState(DockState.DockLeftAutoHide),
- new AutoHideState(DockState.DockRightAutoHide)
- };
- }
-
- public AutoHideState this[DockState dockState]
- {
- get
- {
- for (int i = 0; i < m_states.Length; i++)
- {
- if (m_states[i].DockState == dockState)
- return m_states[i];
- }
- throw new ArgumentOutOfRangeException("dockState");
- }
- }
-
- public bool ContainsPane(DockPane pane)
- {
- if (pane.IsHidden)
- return false;
-
- for (int i = 0; i < m_states.Length; i++)
- {
- if (m_states[i].DockState == pane.DockState && m_states[i].Selected)
- return true;
- }
- return false;
- }
- }
-
- internal PaneCollection(DockPanel panel, DockState dockState)
- {
- m_dockPanel = panel;
- m_states = new AutoHideStateCollection();
- States[DockState.DockTopAutoHide].Selected = (dockState == DockState.DockTopAutoHide);
- States[DockState.DockBottomAutoHide].Selected = (dockState == DockState.DockBottomAutoHide);
- States[DockState.DockLeftAutoHide].Selected = (dockState == DockState.DockLeftAutoHide);
- States[DockState.DockRightAutoHide].Selected = (dockState == DockState.DockRightAutoHide);
- }
-
- private DockPanel m_dockPanel;
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- private AutoHideStateCollection m_states;
- private AutoHideStateCollection States
- {
- get { return m_states; }
- }
-
- public int Count
- {
- get
- {
- int count = 0;
- foreach (DockPane pane in DockPanel.Panes)
- {
- if (States.ContainsPane(pane))
- count++;
- }
-
- return count;
- }
- }
-
- public Pane this[int index]
- {
- get
- {
- int count = 0;
- foreach (DockPane pane in DockPanel.Panes)
- {
- if (!States.ContainsPane(pane))
- continue;
-
- if (count == index)
- {
- if (pane.AutoHidePane == null)
- pane.AutoHidePane = DockPanel.AutoHideStripControl.CreatePane(pane);
- return pane.AutoHidePane as Pane;
- }
-
- count++;
- }
- throw new ArgumentOutOfRangeException("index");
- }
- }
-
- public bool Contains(Pane pane)
- {
- return (IndexOf(pane) != -1);
- }
-
- public int IndexOf(Pane pane)
- {
- if (pane == null)
- return -1;
-
- int index = 0;
- foreach (DockPane dockPane in DockPanel.Panes)
- {
- if (!States.ContainsPane(pane.DockPane))
- continue;
-
- if (pane == dockPane.AutoHidePane)
- return index;
-
- index++;
- }
- return -1;
- }
-
- #region IEnumerable Members
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (int i = 0; i < Count; i++)
- yield return this[i];
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (int i = 0; i < Count; i++)
- yield return this[i];
- }
-
- #endregion
- }
-
- protected AutoHideStripBase(DockPanel panel)
- {
- m_dockPanel = panel;
- m_panesTop = new PaneCollection(panel, DockState.DockTopAutoHide);
- m_panesBottom = new PaneCollection(panel, DockState.DockBottomAutoHide);
- m_panesLeft = new PaneCollection(panel, DockState.DockLeftAutoHide);
- m_panesRight = new PaneCollection(panel, DockState.DockRightAutoHide);
-
- SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- SetStyle(ControlStyles.Selectable, false);
- }
-
- private DockPanel m_dockPanel;
- protected DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- private PaneCollection m_panesTop;
- protected PaneCollection PanesTop
- {
- get { return m_panesTop; }
- }
-
- private PaneCollection m_panesBottom;
- protected PaneCollection PanesBottom
- {
- get { return m_panesBottom; }
- }
-
- private PaneCollection m_panesLeft;
- protected PaneCollection PanesLeft
- {
- get { return m_panesLeft; }
- }
-
- private PaneCollection m_panesRight;
- protected PaneCollection PanesRight
- {
- get { return m_panesRight; }
- }
-
- protected PaneCollection GetPanes(DockState dockState)
- {
- if (dockState == DockState.DockTopAutoHide)
- return PanesTop;
- else if (dockState == DockState.DockBottomAutoHide)
- return PanesBottom;
- else if (dockState == DockState.DockLeftAutoHide)
- return PanesLeft;
- else if (dockState == DockState.DockRightAutoHide)
- return PanesRight;
- else
- throw new ArgumentOutOfRangeException("dockState");
- }
-
- internal int GetNumberOfPanes(DockState dockState)
- {
- return GetPanes(dockState).Count;
- }
-
- protected Rectangle RectangleTopLeft
- {
- get
- {
- int height = MeasureHeight();
- return PanesTop.Count > 0 && PanesLeft.Count > 0 ? new Rectangle(0, 0, height, height) : Rectangle.Empty;
- }
- }
-
- protected Rectangle RectangleTopRight
- {
- get
- {
- int height = MeasureHeight();
- return PanesTop.Count > 0 && PanesRight.Count > 0 ? new Rectangle(Width - height, 0, height, height) : Rectangle.Empty;
- }
- }
-
- protected Rectangle RectangleBottomLeft
- {
- get
- {
- int height = MeasureHeight();
- return PanesBottom.Count > 0 && PanesLeft.Count > 0 ? new Rectangle(0, Height - height, height, height) : Rectangle.Empty;
- }
- }
-
- protected Rectangle RectangleBottomRight
- {
- get
- {
- int height = MeasureHeight();
- return PanesBottom.Count > 0 && PanesRight.Count > 0 ? new Rectangle(Width - height, Height - height, height, height) : Rectangle.Empty;
- }
- }
-
- protected internal Rectangle GetTabStripRectangle(DockState dockState)
- {
- int height = MeasureHeight();
- if (dockState == DockState.DockTopAutoHide && PanesTop.Count > 0)
- return new Rectangle(RectangleTopLeft.Width, 0, Width - RectangleTopLeft.Width - RectangleTopRight.Width, height);
- else if (dockState == DockState.DockBottomAutoHide && PanesBottom.Count > 0)
- return new Rectangle(RectangleBottomLeft.Width, Height - height, Width - RectangleBottomLeft.Width - RectangleBottomRight.Width, height);
- else if (dockState == DockState.DockLeftAutoHide && PanesLeft.Count > 0)
- return new Rectangle(0, RectangleTopLeft.Width, height, Height - RectangleTopLeft.Height - RectangleBottomLeft.Height);
- else if (dockState == DockState.DockRightAutoHide && PanesRight.Count > 0)
- return new Rectangle(Width - height, RectangleTopRight.Width, height, Height - RectangleTopRight.Height - RectangleBottomRight.Height);
- else
- return Rectangle.Empty;
- }
-
- private GraphicsPath m_displayingArea = null;
- private GraphicsPath DisplayingArea
- {
- get
- {
- if (m_displayingArea == null)
- m_displayingArea = new GraphicsPath();
-
- return m_displayingArea;
- }
- }
-
- private void SetRegion()
- {
- DisplayingArea.Reset();
- DisplayingArea.AddRectangle(RectangleTopLeft);
- DisplayingArea.AddRectangle(RectangleTopRight);
- DisplayingArea.AddRectangle(RectangleBottomLeft);
- DisplayingArea.AddRectangle(RectangleBottomRight);
- DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockTopAutoHide));
- DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockBottomAutoHide));
- DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockLeftAutoHide));
- DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockRightAutoHide));
- Region = new Region(DisplayingArea);
- }
-
- protected override void OnMouseDown(MouseEventArgs e)
- {
- base.OnMouseDown(e);
-
- if (e.Button != MouseButtons.Left)
- return;
-
- IDockContent content = HitTest();
- if (content == null)
- return;
-
- content.DockHandler.Activate();
- }
-
- protected override void OnMouseHover(EventArgs e)
- {
- base.OnMouseHover(e);
-
- IDockContent content = HitTest();
- if (content != null && DockPanel.ActiveAutoHideContent != content)
- DockPanel.ActiveAutoHideContent = content;
-
- // requires further tracking of mouse hover behavior,
- ResetMouseEventArgs();
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- RefreshChanges();
- base.OnLayout (levent);
- }
-
- internal void RefreshChanges()
- {
- if (IsDisposed)
- return;
-
- SetRegion();
- OnRefreshChanges();
- }
-
- protected virtual void OnRefreshChanges()
- {
- }
-
- protected internal abstract int MeasureHeight();
-
- private IDockContent HitTest()
- {
- Point ptMouse = PointToClient(Control.MousePosition);
- return HitTest(ptMouse);
- }
-
- protected virtual Tab CreateTab(IDockContent content)
- {
- return new Tab(content);
- }
-
- protected virtual Pane CreatePane(DockPane dockPane)
- {
- return new Pane(dockPane);
- }
-
- protected abstract IDockContent HitTest(Point point);
- }
-}
+using System;
+using System.Collections;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ public abstract partial class AutoHideStripBase : Control
+ {
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ protected class Tab : IDisposable
+ {
+ private IDockContent m_content;
+
+ protected internal Tab(IDockContent content)
+ {
+ m_content = content;
+ }
+
+ ~Tab()
+ {
+ Dispose(false);
+ }
+
+ public IDockContent Content
+ {
+ get { return m_content; }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ }
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ protected sealed class TabCollection : IEnumerable
+ {
+ #region IEnumerable Members
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (int i = 0; i < Count; i++)
+ yield return this[i];
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (int i = 0; i < Count; i++)
+ yield return this[i];
+ }
+ #endregion
+
+ internal TabCollection(DockPane pane)
+ {
+ m_dockPane = pane;
+ }
+
+ private DockPane m_dockPane = null;
+ public DockPane DockPane
+ {
+ get { return m_dockPane; }
+ }
+
+ public DockPanel DockPanel
+ {
+ get { return DockPane.DockPanel; }
+ }
+
+ public int Count
+ {
+ get { return DockPane.DisplayingContents.Count; }
+ }
+
+ public Tab this[int index]
+ {
+ get
+ {
+ IDockContent content = DockPane.DisplayingContents[index];
+ if (content == null)
+ throw (new ArgumentOutOfRangeException("index"));
+ if (content.DockHandler.AutoHideTab == null)
+ content.DockHandler.AutoHideTab = (DockPanel.AutoHideStripControl.CreateTab(content));
+ return content.DockHandler.AutoHideTab as Tab;
+ }
+ }
+
+ public bool Contains(Tab tab)
+ {
+ return (IndexOf(tab) != -1);
+ }
+
+ public bool Contains(IDockContent content)
+ {
+ return (IndexOf(content) != -1);
+ }
+
+ public int IndexOf(Tab tab)
+ {
+ if (tab == null)
+ return -1;
+
+ return IndexOf(tab.Content);
+ }
+
+ public int IndexOf(IDockContent content)
+ {
+ return DockPane.DisplayingContents.IndexOf(content);
+ }
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ protected class Pane : IDisposable
+ {
+ private DockPane m_dockPane;
+
+ protected internal Pane(DockPane dockPane)
+ {
+ m_dockPane = dockPane;
+ }
+
+ ~Pane()
+ {
+ Dispose(false);
+ }
+
+ public DockPane DockPane
+ {
+ get { return m_dockPane; }
+ }
+
+ public TabCollection AutoHideTabs
+ {
+ get
+ {
+ if (DockPane.AutoHideTabs == null)
+ DockPane.AutoHideTabs = new TabCollection(DockPane);
+ return DockPane.AutoHideTabs as TabCollection;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ }
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ protected sealed class PaneCollection : IEnumerable
+ {
+ private class AutoHideState
+ {
+ public DockState m_dockState;
+ public bool m_selected = false;
+
+ public AutoHideState(DockState dockState)
+ {
+ m_dockState = dockState;
+ }
+
+ public DockState DockState
+ {
+ get { return m_dockState; }
+ }
+
+ public bool Selected
+ {
+ get { return m_selected; }
+ set { m_selected = value; }
+ }
+ }
+
+ private class AutoHideStateCollection
+ {
+ private AutoHideState[] m_states;
+
+ public AutoHideStateCollection()
+ {
+ m_states = new AutoHideState[] {
+ new AutoHideState(DockState.DockTopAutoHide),
+ new AutoHideState(DockState.DockBottomAutoHide),
+ new AutoHideState(DockState.DockLeftAutoHide),
+ new AutoHideState(DockState.DockRightAutoHide)
+ };
+ }
+
+ public AutoHideState this[DockState dockState]
+ {
+ get
+ {
+ for (int i = 0; i < m_states.Length; i++)
+ {
+ if (m_states[i].DockState == dockState)
+ return m_states[i];
+ }
+ throw new ArgumentOutOfRangeException("dockState");
+ }
+ }
+
+ public bool ContainsPane(DockPane pane)
+ {
+ if (pane.IsHidden)
+ return false;
+
+ for (int i = 0; i < m_states.Length; i++)
+ {
+ if (m_states[i].DockState == pane.DockState && m_states[i].Selected)
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal PaneCollection(DockPanel panel, DockState dockState)
+ {
+ m_dockPanel = panel;
+ m_states = new AutoHideStateCollection();
+ States[DockState.DockTopAutoHide].Selected = (dockState == DockState.DockTopAutoHide);
+ States[DockState.DockBottomAutoHide].Selected = (dockState == DockState.DockBottomAutoHide);
+ States[DockState.DockLeftAutoHide].Selected = (dockState == DockState.DockLeftAutoHide);
+ States[DockState.DockRightAutoHide].Selected = (dockState == DockState.DockRightAutoHide);
+ }
+
+ private DockPanel m_dockPanel;
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ private AutoHideStateCollection m_states;
+ private AutoHideStateCollection States
+ {
+ get { return m_states; }
+ }
+
+ public int Count
+ {
+ get
+ {
+ int count = 0;
+ foreach (DockPane pane in DockPanel.Panes)
+ {
+ if (States.ContainsPane(pane))
+ count++;
+ }
+
+ return count;
+ }
+ }
+
+ public Pane this[int index]
+ {
+ get
+ {
+ int count = 0;
+ foreach (DockPane pane in DockPanel.Panes)
+ {
+ if (!States.ContainsPane(pane))
+ continue;
+
+ if (count == index)
+ {
+ if (pane.AutoHidePane == null)
+ pane.AutoHidePane = DockPanel.AutoHideStripControl.CreatePane(pane);
+ return pane.AutoHidePane as Pane;
+ }
+
+ count++;
+ }
+ throw new ArgumentOutOfRangeException("index");
+ }
+ }
+
+ public bool Contains(Pane pane)
+ {
+ return (IndexOf(pane) != -1);
+ }
+
+ public int IndexOf(Pane pane)
+ {
+ if (pane == null)
+ return -1;
+
+ int index = 0;
+ foreach (DockPane dockPane in DockPanel.Panes)
+ {
+ if (!States.ContainsPane(pane.DockPane))
+ continue;
+
+ if (pane == dockPane.AutoHidePane)
+ return index;
+
+ index++;
+ }
+ return -1;
+ }
+
+ #region IEnumerable Members
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (int i = 0; i < Count; i++)
+ yield return this[i];
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (int i = 0; i < Count; i++)
+ yield return this[i];
+ }
+
+ #endregion
+ }
+
+ protected AutoHideStripBase(DockPanel panel)
+ {
+ m_dockPanel = panel;
+ m_panesTop = new PaneCollection(panel, DockState.DockTopAutoHide);
+ m_panesBottom = new PaneCollection(panel, DockState.DockBottomAutoHide);
+ m_panesLeft = new PaneCollection(panel, DockState.DockLeftAutoHide);
+ m_panesRight = new PaneCollection(panel, DockState.DockRightAutoHide);
+
+ SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
+ SetStyle(ControlStyles.Selectable, false);
+ }
+
+ private DockPanel m_dockPanel;
+ protected DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ private PaneCollection m_panesTop;
+ protected PaneCollection PanesTop
+ {
+ get { return m_panesTop; }
+ }
+
+ private PaneCollection m_panesBottom;
+ protected PaneCollection PanesBottom
+ {
+ get { return m_panesBottom; }
+ }
+
+ private PaneCollection m_panesLeft;
+ protected PaneCollection PanesLeft
+ {
+ get { return m_panesLeft; }
+ }
+
+ private PaneCollection m_panesRight;
+ protected PaneCollection PanesRight
+ {
+ get { return m_panesRight; }
+ }
+
+ protected PaneCollection GetPanes(DockState dockState)
+ {
+ if (dockState == DockState.DockTopAutoHide)
+ return PanesTop;
+ else if (dockState == DockState.DockBottomAutoHide)
+ return PanesBottom;
+ else if (dockState == DockState.DockLeftAutoHide)
+ return PanesLeft;
+ else if (dockState == DockState.DockRightAutoHide)
+ return PanesRight;
+ else
+ throw new ArgumentOutOfRangeException("dockState");
+ }
+
+ internal int GetNumberOfPanes(DockState dockState)
+ {
+ return GetPanes(dockState).Count;
+ }
+
+ protected Rectangle RectangleTopLeft
+ {
+ get
+ {
+ int height = MeasureHeight();
+ return PanesTop.Count > 0 && PanesLeft.Count > 0 ? new Rectangle(0, 0, height, height) : Rectangle.Empty;
+ }
+ }
+
+ protected Rectangle RectangleTopRight
+ {
+ get
+ {
+ int height = MeasureHeight();
+ return PanesTop.Count > 0 && PanesRight.Count > 0 ? new Rectangle(Width - height, 0, height, height) : Rectangle.Empty;
+ }
+ }
+
+ protected Rectangle RectangleBottomLeft
+ {
+ get
+ {
+ int height = MeasureHeight();
+ return PanesBottom.Count > 0 && PanesLeft.Count > 0 ? new Rectangle(0, Height - height, height, height) : Rectangle.Empty;
+ }
+ }
+
+ protected Rectangle RectangleBottomRight
+ {
+ get
+ {
+ int height = MeasureHeight();
+ return PanesBottom.Count > 0 && PanesRight.Count > 0 ? new Rectangle(Width - height, Height - height, height, height) : Rectangle.Empty;
+ }
+ }
+
+ protected internal Rectangle GetTabStripRectangle(DockState dockState)
+ {
+ int height = MeasureHeight();
+ if (dockState == DockState.DockTopAutoHide && PanesTop.Count > 0)
+ return new Rectangle(RectangleTopLeft.Width, 0, Width - RectangleTopLeft.Width - RectangleTopRight.Width, height);
+ else if (dockState == DockState.DockBottomAutoHide && PanesBottom.Count > 0)
+ return new Rectangle(RectangleBottomLeft.Width, Height - height, Width - RectangleBottomLeft.Width - RectangleBottomRight.Width, height);
+ else if (dockState == DockState.DockLeftAutoHide && PanesLeft.Count > 0)
+ return new Rectangle(0, RectangleTopLeft.Width, height, Height - RectangleTopLeft.Height - RectangleBottomLeft.Height);
+ else if (dockState == DockState.DockRightAutoHide && PanesRight.Count > 0)
+ return new Rectangle(Width - height, RectangleTopRight.Width, height, Height - RectangleTopRight.Height - RectangleBottomRight.Height);
+ else
+ return Rectangle.Empty;
+ }
+
+ private GraphicsPath m_displayingArea = null;
+ private GraphicsPath DisplayingArea
+ {
+ get
+ {
+ if (m_displayingArea == null)
+ m_displayingArea = new GraphicsPath();
+
+ return m_displayingArea;
+ }
+ }
+
+ private void SetRegion()
+ {
+ DisplayingArea.Reset();
+ DisplayingArea.AddRectangle(RectangleTopLeft);
+ DisplayingArea.AddRectangle(RectangleTopRight);
+ DisplayingArea.AddRectangle(RectangleBottomLeft);
+ DisplayingArea.AddRectangle(RectangleBottomRight);
+ DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockTopAutoHide));
+ DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockBottomAutoHide));
+ DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockLeftAutoHide));
+ DisplayingArea.AddRectangle(GetTabStripRectangle(DockState.DockRightAutoHide));
+ Region = new Region(DisplayingArea);
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ base.OnMouseDown(e);
+
+ if (e.Button != MouseButtons.Left)
+ return;
+
+ IDockContent content = HitTest();
+ if (content == null)
+ return;
+
+ content.DockHandler.Activate();
+ }
+
+ protected override void OnMouseHover(EventArgs e)
+ {
+ base.OnMouseHover(e);
+
+ IDockContent content = HitTest();
+ if (content != null && DockPanel.ActiveAutoHideContent != content)
+ DockPanel.ActiveAutoHideContent = content;
+
+ // requires further tracking of mouse hover behavior,
+ ResetMouseEventArgs();
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ RefreshChanges();
+ base.OnLayout (levent);
+ }
+
+ internal void RefreshChanges()
+ {
+ if (IsDisposed)
+ return;
+
+ SetRegion();
+ OnRefreshChanges();
+ }
+
+ protected virtual void OnRefreshChanges()
+ {
+ }
+
+ protected internal abstract int MeasureHeight();
+
+ private IDockContent HitTest()
+ {
+ Point ptMouse = PointToClient(Control.MousePosition);
+ return HitTest(ptMouse);
+ }
+
+ protected virtual Tab CreateTab(IDockContent content)
+ {
+ return new Tab(content);
+ }
+
+ protected virtual Pane CreatePane(DockPane dockPane)
+ {
+ return new Pane(dockPane);
+ }
+
+ protected abstract IDockContent HitTest(Point point);
+ }
+}
diff --git a/trunk/Docking/DockAreasEditor.cs b/source/Docking/DockAreasEditor.cs
similarity index 96%
rename from trunk/Docking/DockAreasEditor.cs
rename to source/Docking/DockAreasEditor.cs
index f7e5531..4aebf03 100644
--- a/trunk/Docking/DockAreasEditor.cs
+++ b/source/Docking/DockAreasEditor.cs
@@ -1,142 +1,142 @@
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Drawing.Design;
-using System.Windows.Forms;
-using System.Windows.Forms.Design;
-
-namespace LSLEditor.Docking
-{
- internal class DockAreasEditor : UITypeEditor
- {
- private class DockAreasEditorControl : System.Windows.Forms.UserControl
- {
- private CheckBox checkBoxFloat;
- private CheckBox checkBoxDockLeft;
- private CheckBox checkBoxDockRight;
- private CheckBox checkBoxDockTop;
- private CheckBox checkBoxDockBottom;
- private CheckBox checkBoxDockFill;
- private DockAreas m_oldDockAreas;
-
- public DockAreas DockAreas
- {
- get
- {
- DockAreas dockAreas = 0;
- if (checkBoxFloat.Checked)
- dockAreas |= DockAreas.Float;
- if (checkBoxDockLeft.Checked)
- dockAreas |= DockAreas.DockLeft;
- if (checkBoxDockRight.Checked)
- dockAreas |= DockAreas.DockRight;
- if (checkBoxDockTop.Checked)
- dockAreas |= DockAreas.DockTop;
- if (checkBoxDockBottom.Checked)
- dockAreas |= DockAreas.DockBottom;
- if (checkBoxDockFill.Checked)
- dockAreas |= DockAreas.Document;
-
- if (dockAreas == 0)
- return m_oldDockAreas;
- else
- return dockAreas;
- }
- }
-
- public DockAreasEditorControl()
- {
- checkBoxFloat = new CheckBox();
- checkBoxDockLeft = new CheckBox();
- checkBoxDockRight = new CheckBox();
- checkBoxDockTop = new CheckBox();
- checkBoxDockBottom = new CheckBox();
- checkBoxDockFill = new CheckBox();
-
- SuspendLayout();
-
- checkBoxFloat.Appearance = Appearance.Button;
- checkBoxFloat.Dock = DockStyle.Top;
- checkBoxFloat.Height = 24;
- checkBoxFloat.Text = Strings.DockAreaEditor_FloatCheckBoxText;
- checkBoxFloat.TextAlign = ContentAlignment.MiddleCenter;
- checkBoxFloat.FlatStyle = FlatStyle.System;
-
- checkBoxDockLeft.Appearance = System.Windows.Forms.Appearance.Button;
- checkBoxDockLeft.Dock = System.Windows.Forms.DockStyle.Left;
- checkBoxDockLeft.Width = 24;
- checkBoxDockLeft.FlatStyle = FlatStyle.System;
-
- checkBoxDockRight.Appearance = System.Windows.Forms.Appearance.Button;
- checkBoxDockRight.Dock = System.Windows.Forms.DockStyle.Right;
- checkBoxDockRight.Width = 24;
- checkBoxDockRight.FlatStyle = FlatStyle.System;
-
- checkBoxDockTop.Appearance = System.Windows.Forms.Appearance.Button;
- checkBoxDockTop.Dock = System.Windows.Forms.DockStyle.Top;
- checkBoxDockTop.Height = 24;
- checkBoxDockTop.FlatStyle = FlatStyle.System;
-
- checkBoxDockBottom.Appearance = System.Windows.Forms.Appearance.Button;
- checkBoxDockBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
- checkBoxDockBottom.Height = 24;
- checkBoxDockBottom.FlatStyle = FlatStyle.System;
-
- checkBoxDockFill.Appearance = System.Windows.Forms.Appearance.Button;
- checkBoxDockFill.Dock = System.Windows.Forms.DockStyle.Fill;
- checkBoxDockFill.FlatStyle = FlatStyle.System;
-
- this.Controls.AddRange(new Control[] {
- checkBoxDockFill,
- checkBoxDockBottom,
- checkBoxDockTop,
- checkBoxDockRight,
- checkBoxDockLeft,
- checkBoxFloat});
-
- Size = new System.Drawing.Size(160, 144);
- BackColor = SystemColors.Control;
- ResumeLayout();
- }
-
- public void SetStates(DockAreas dockAreas)
- {
- m_oldDockAreas = dockAreas;
- if ((dockAreas & DockAreas.DockLeft) != 0)
- checkBoxDockLeft.Checked = true;
- if ((dockAreas & DockAreas.DockRight) != 0)
- checkBoxDockRight.Checked = true;
- if ((dockAreas & DockAreas.DockTop) != 0)
- checkBoxDockTop.Checked = true;
- if ((dockAreas & DockAreas.DockTop) != 0)
- checkBoxDockTop.Checked = true;
- if ((dockAreas & DockAreas.DockBottom) != 0)
- checkBoxDockBottom.Checked = true;
- if ((dockAreas & DockAreas.Document) != 0)
- checkBoxDockFill.Checked = true;
- if ((dockAreas & DockAreas.Float) != 0)
- checkBoxFloat.Checked = true;
- }
- }
-
- private DockAreasEditor.DockAreasEditorControl m_ui = null;
-
- public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
- {
- return UITypeEditorEditStyle.DropDown;
- }
-
- public override object EditValue(ITypeDescriptorContext context, IServiceProvider sp, object value)
- {
- if (m_ui == null)
- m_ui = new DockAreasEditor.DockAreasEditorControl();
-
- m_ui.SetStates((DockAreas)value);
-
- IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)sp.GetService(typeof(IWindowsFormsEditorService));
- edSvc.DropDownControl(m_ui);
-
- return m_ui.DockAreas;
- }
- }
-}
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Design;
+using System.Windows.Forms;
+using System.Windows.Forms.Design;
+
+namespace LSLEditor.Docking
+{
+ internal class DockAreasEditor : UITypeEditor
+ {
+ private class DockAreasEditorControl : System.Windows.Forms.UserControl
+ {
+ private CheckBox checkBoxFloat;
+ private CheckBox checkBoxDockLeft;
+ private CheckBox checkBoxDockRight;
+ private CheckBox checkBoxDockTop;
+ private CheckBox checkBoxDockBottom;
+ private CheckBox checkBoxDockFill;
+ private DockAreas m_oldDockAreas;
+
+ public DockAreas DockAreas
+ {
+ get
+ {
+ DockAreas dockAreas = 0;
+ if (checkBoxFloat.Checked)
+ dockAreas |= DockAreas.Float;
+ if (checkBoxDockLeft.Checked)
+ dockAreas |= DockAreas.DockLeft;
+ if (checkBoxDockRight.Checked)
+ dockAreas |= DockAreas.DockRight;
+ if (checkBoxDockTop.Checked)
+ dockAreas |= DockAreas.DockTop;
+ if (checkBoxDockBottom.Checked)
+ dockAreas |= DockAreas.DockBottom;
+ if (checkBoxDockFill.Checked)
+ dockAreas |= DockAreas.Document;
+
+ if (dockAreas == 0)
+ return m_oldDockAreas;
+ else
+ return dockAreas;
+ }
+ }
+
+ public DockAreasEditorControl()
+ {
+ checkBoxFloat = new CheckBox();
+ checkBoxDockLeft = new CheckBox();
+ checkBoxDockRight = new CheckBox();
+ checkBoxDockTop = new CheckBox();
+ checkBoxDockBottom = new CheckBox();
+ checkBoxDockFill = new CheckBox();
+
+ SuspendLayout();
+
+ checkBoxFloat.Appearance = Appearance.Button;
+ checkBoxFloat.Dock = DockStyle.Top;
+ checkBoxFloat.Height = 24;
+ checkBoxFloat.Text = Strings.DockAreaEditor_FloatCheckBoxText;
+ checkBoxFloat.TextAlign = ContentAlignment.MiddleCenter;
+ checkBoxFloat.FlatStyle = FlatStyle.System;
+
+ checkBoxDockLeft.Appearance = System.Windows.Forms.Appearance.Button;
+ checkBoxDockLeft.Dock = System.Windows.Forms.DockStyle.Left;
+ checkBoxDockLeft.Width = 24;
+ checkBoxDockLeft.FlatStyle = FlatStyle.System;
+
+ checkBoxDockRight.Appearance = System.Windows.Forms.Appearance.Button;
+ checkBoxDockRight.Dock = System.Windows.Forms.DockStyle.Right;
+ checkBoxDockRight.Width = 24;
+ checkBoxDockRight.FlatStyle = FlatStyle.System;
+
+ checkBoxDockTop.Appearance = System.Windows.Forms.Appearance.Button;
+ checkBoxDockTop.Dock = System.Windows.Forms.DockStyle.Top;
+ checkBoxDockTop.Height = 24;
+ checkBoxDockTop.FlatStyle = FlatStyle.System;
+
+ checkBoxDockBottom.Appearance = System.Windows.Forms.Appearance.Button;
+ checkBoxDockBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
+ checkBoxDockBottom.Height = 24;
+ checkBoxDockBottom.FlatStyle = FlatStyle.System;
+
+ checkBoxDockFill.Appearance = System.Windows.Forms.Appearance.Button;
+ checkBoxDockFill.Dock = System.Windows.Forms.DockStyle.Fill;
+ checkBoxDockFill.FlatStyle = FlatStyle.System;
+
+ this.Controls.AddRange(new Control[] {
+ checkBoxDockFill,
+ checkBoxDockBottom,
+ checkBoxDockTop,
+ checkBoxDockRight,
+ checkBoxDockLeft,
+ checkBoxFloat});
+
+ Size = new System.Drawing.Size(160, 144);
+ BackColor = SystemColors.Control;
+ ResumeLayout();
+ }
+
+ public void SetStates(DockAreas dockAreas)
+ {
+ m_oldDockAreas = dockAreas;
+ if ((dockAreas & DockAreas.DockLeft) != 0)
+ checkBoxDockLeft.Checked = true;
+ if ((dockAreas & DockAreas.DockRight) != 0)
+ checkBoxDockRight.Checked = true;
+ if ((dockAreas & DockAreas.DockTop) != 0)
+ checkBoxDockTop.Checked = true;
+ if ((dockAreas & DockAreas.DockTop) != 0)
+ checkBoxDockTop.Checked = true;
+ if ((dockAreas & DockAreas.DockBottom) != 0)
+ checkBoxDockBottom.Checked = true;
+ if ((dockAreas & DockAreas.Document) != 0)
+ checkBoxDockFill.Checked = true;
+ if ((dockAreas & DockAreas.Float) != 0)
+ checkBoxFloat.Checked = true;
+ }
+ }
+
+ private DockAreasEditor.DockAreasEditorControl m_ui = null;
+
+ public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
+ {
+ return UITypeEditorEditStyle.DropDown;
+ }
+
+ public override object EditValue(ITypeDescriptorContext context, IServiceProvider sp, object value)
+ {
+ if (m_ui == null)
+ m_ui = new DockAreasEditor.DockAreasEditorControl();
+
+ m_ui.SetStates((DockAreas)value);
+
+ IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)sp.GetService(typeof(IWindowsFormsEditorService));
+ edSvc.DropDownControl(m_ui);
+
+ return m_ui.DockAreas;
+ }
+ }
+}
diff --git a/trunk/Docking/DockContent.cs b/source/Docking/DockContent.cs
similarity index 96%
rename from trunk/Docking/DockContent.cs
rename to source/Docking/DockContent.cs
index 3f109e9..20b8702 100644
--- a/trunk/Docking/DockContent.cs
+++ b/source/Docking/DockContent.cs
@@ -1,304 +1,304 @@
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-using System.Runtime.InteropServices;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- public class DockContent : Form, IDockContent
- {
- public DockContent()
- {
- m_dockHandler = new DockContentHandler(this, new GetPersistStringCallback(GetPersistString));
- m_dockHandler.DockStateChanged += new EventHandler(DockHandler_DockStateChanged);
- //Suggested as a fix by bensty regarding form resize
- this.ParentChanged += new EventHandler(DockContent_ParentChanged);
- }
-
- //Suggested as a fix by bensty regarding form resize
- private void DockContent_ParentChanged(object Sender, EventArgs e)
- {
- if (this.Parent != null)
- this.Font = this.Parent.Font;
- }
-
- private DockContentHandler m_dockHandler = null;
- [Browsable(false)]
- public DockContentHandler DockHandler
- {
- get { return m_dockHandler; }
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_AllowEndUserDocking_Description")]
- [DefaultValue(true)]
- public bool AllowEndUserDocking
- {
- get { return DockHandler.AllowEndUserDocking; }
- set { DockHandler.AllowEndUserDocking = value; }
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_DockAreas_Description")]
- [DefaultValue(DockAreas.DockLeft|DockAreas.DockRight|DockAreas.DockTop|DockAreas.DockBottom|DockAreas.Document|DockAreas.Float)]
- public DockAreas DockAreas
- {
- get { return DockHandler.DockAreas; }
- set { DockHandler.DockAreas = value; }
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_AutoHidePortion_Description")]
- [DefaultValue(0.25)]
- public double AutoHidePortion
- {
- get { return DockHandler.AutoHidePortion; }
- set { DockHandler.AutoHidePortion = value; }
- }
-
- [Localizable(true)]
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_TabText_Description")]
- [DefaultValue(null)]
- private string m_tabText = null;
- public string TabText
- {
- get { return m_tabText; }
- set { DockHandler.TabText = m_tabText = value; }
- }
- private bool ShouldSerializeTabText()
- {
- return (m_tabText != null);
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_CloseButton_Description")]
- [DefaultValue(true)]
- public bool CloseButton
- {
- get { return DockHandler.CloseButton; }
- set { DockHandler.CloseButton = value; }
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_CloseButtonVisible_Description")]
- [DefaultValue(true)]
- public bool CloseButtonVisible
- {
- get { return DockHandler.CloseButtonVisible; }
- set { DockHandler.CloseButtonVisible = value; }
- }
-
- [Browsable(false)]
- public DockPanel DockPanel
- {
- get { return DockHandler.DockPanel; }
- set { DockHandler.DockPanel = value; }
- }
-
- [Browsable(false)]
- public DockState DockState
- {
- get { return DockHandler.DockState; }
- set { DockHandler.DockState = value; }
- }
-
- [Browsable(false)]
- public DockPane Pane
- {
- get { return DockHandler.Pane; }
- set { DockHandler.Pane = value; }
- }
-
- [Browsable(false)]
- public bool IsHidden
- {
- get { return DockHandler.IsHidden; }
- set { DockHandler.IsHidden = value; }
- }
-
- [Browsable(false)]
- public DockState VisibleState
- {
- get { return DockHandler.VisibleState; }
- set { DockHandler.VisibleState = value; }
- }
-
- [Browsable(false)]
- public bool IsFloat
- {
- get { return DockHandler.IsFloat; }
- set { DockHandler.IsFloat = value; }
- }
-
- [Browsable(false)]
- public DockPane PanelPane
- {
- get { return DockHandler.PanelPane; }
- set { DockHandler.PanelPane = value; }
- }
-
- [Browsable(false)]
- public DockPane FloatPane
- {
- get { return DockHandler.FloatPane; }
- set { DockHandler.FloatPane = value; }
- }
-
- [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
- protected virtual string GetPersistString()
- {
- return GetType().ToString();
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_HideOnClose_Description")]
- [DefaultValue(false)]
- public bool HideOnClose
- {
- get { return DockHandler.HideOnClose; }
- set { DockHandler.HideOnClose = value; }
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_ShowHint_Description")]
- [DefaultValue(DockState.Unknown)]
- public DockState ShowHint
- {
- get { return DockHandler.ShowHint; }
- set { DockHandler.ShowHint = value; }
- }
-
- [Browsable(false)]
- public bool IsActivated
- {
- get { return DockHandler.IsActivated; }
- }
-
- public bool IsDockStateValid(DockState dockState)
- {
- return DockHandler.IsDockStateValid(dockState);
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_TabPageContextMenu_Description")]
- [DefaultValue(null)]
- public ContextMenu TabPageContextMenu
- {
- get { return DockHandler.TabPageContextMenu; }
- set { DockHandler.TabPageContextMenu = value; }
- }
-
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockContent_TabPageContextMenuStrip_Description")]
- [DefaultValue(null)]
- public ContextMenuStrip TabPageContextMenuStrip
- {
- get { return DockHandler.TabPageContextMenuStrip; }
- set { DockHandler.TabPageContextMenuStrip = value; }
- }
-
- [Localizable(true)]
- [Category("Appearance")]
- [LocalizedDescription("DockContent_ToolTipText_Description")]
- [DefaultValue(null)]
- public string ToolTipText
- {
- get { return DockHandler.ToolTipText; }
- set { DockHandler.ToolTipText = value; }
- }
-
- public new void Activate()
- {
- DockHandler.Activate();
- }
-
- public new void Hide()
- {
- DockHandler.Hide();
- }
-
- public new void Show()
- {
- DockHandler.Show();
- }
-
- public void Show(DockPanel dockPanel)
- {
- DockHandler.Show(dockPanel);
- }
-
- public void Show(DockPanel dockPanel, DockState dockState)
- {
- DockHandler.Show(dockPanel, dockState);
- }
-
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
- public void Show(DockPanel dockPanel, Rectangle floatWindowBounds)
- {
- DockHandler.Show(dockPanel, floatWindowBounds);
- }
-
- public void Show(DockPane pane, IDockContent beforeContent)
- {
- DockHandler.Show(pane, beforeContent);
- }
-
- public void Show(DockPane previousPane, DockAlignment alignment, double proportion)
- {
- DockHandler.Show(previousPane, alignment, proportion);
- }
-
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
- public void FloatAt(Rectangle floatWindowBounds)
- {
- DockHandler.FloatAt(floatWindowBounds);
- }
-
- public void DockTo(DockPane paneTo, DockStyle dockStyle, int contentIndex)
- {
- DockHandler.DockTo(paneTo, dockStyle, contentIndex);
- }
-
- public void DockTo(DockPanel panel, DockStyle dockStyle)
- {
- DockHandler.DockTo(panel, dockStyle);
- }
-
- #region IDockContent Members
- void IDockContent.OnActivated(EventArgs e)
- {
- this.OnActivated(e);
- }
-
- void IDockContent.OnDeactivate(EventArgs e)
- {
- this.OnDeactivate(e);
- }
- #endregion
-
- #region Events
- private void DockHandler_DockStateChanged(object sender, EventArgs e)
- {
- OnDockStateChanged(e);
- }
-
- private static readonly object DockStateChangedEvent = new object();
- [LocalizedCategory("Category_PropertyChanged")]
- [LocalizedDescription("Pane_DockStateChanged_Description")]
- public event EventHandler DockStateChanged
- {
- add { Events.AddHandler(DockStateChangedEvent, value); }
- remove { Events.RemoveHandler(DockStateChangedEvent, value); }
- }
- protected virtual void OnDockStateChanged(EventArgs e)
- {
- EventHandler handler = (EventHandler)Events[DockStateChangedEvent];
- if (handler != null)
- handler(this, e);
- }
- #endregion
- }
-}
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ public class DockContent : Form, IDockContent
+ {
+ public DockContent()
+ {
+ m_dockHandler = new DockContentHandler(this, new GetPersistStringCallback(GetPersistString));
+ m_dockHandler.DockStateChanged += new EventHandler(DockHandler_DockStateChanged);
+ //Suggested as a fix by bensty regarding form resize
+ this.ParentChanged += new EventHandler(DockContent_ParentChanged);
+ }
+
+ //Suggested as a fix by bensty regarding form resize
+ private void DockContent_ParentChanged(object Sender, EventArgs e)
+ {
+ if (this.Parent != null)
+ this.Font = this.Parent.Font;
+ }
+
+ private DockContentHandler m_dockHandler = null;
+ [Browsable(false)]
+ public DockContentHandler DockHandler
+ {
+ get { return m_dockHandler; }
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_AllowEndUserDocking_Description")]
+ [DefaultValue(true)]
+ public bool AllowEndUserDocking
+ {
+ get { return DockHandler.AllowEndUserDocking; }
+ set { DockHandler.AllowEndUserDocking = value; }
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_DockAreas_Description")]
+ [DefaultValue(DockAreas.DockLeft|DockAreas.DockRight|DockAreas.DockTop|DockAreas.DockBottom|DockAreas.Document|DockAreas.Float)]
+ public DockAreas DockAreas
+ {
+ get { return DockHandler.DockAreas; }
+ set { DockHandler.DockAreas = value; }
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_AutoHidePortion_Description")]
+ [DefaultValue(0.25)]
+ public double AutoHidePortion
+ {
+ get { return DockHandler.AutoHidePortion; }
+ set { DockHandler.AutoHidePortion = value; }
+ }
+
+ [Localizable(true)]
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_TabText_Description")]
+ [DefaultValue(null)]
+ private string m_tabText = null;
+ public string TabText
+ {
+ get { return m_tabText; }
+ set { DockHandler.TabText = m_tabText = value; }
+ }
+ private bool ShouldSerializeTabText()
+ {
+ return (m_tabText != null);
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_CloseButton_Description")]
+ [DefaultValue(true)]
+ public bool CloseButton
+ {
+ get { return DockHandler.CloseButton; }
+ set { DockHandler.CloseButton = value; }
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_CloseButtonVisible_Description")]
+ [DefaultValue(true)]
+ public bool CloseButtonVisible
+ {
+ get { return DockHandler.CloseButtonVisible; }
+ set { DockHandler.CloseButtonVisible = value; }
+ }
+
+ [Browsable(false)]
+ public DockPanel DockPanel
+ {
+ get { return DockHandler.DockPanel; }
+ set { DockHandler.DockPanel = value; }
+ }
+
+ [Browsable(false)]
+ public DockState DockState
+ {
+ get { return DockHandler.DockState; }
+ set { DockHandler.DockState = value; }
+ }
+
+ [Browsable(false)]
+ public DockPane Pane
+ {
+ get { return DockHandler.Pane; }
+ set { DockHandler.Pane = value; }
+ }
+
+ [Browsable(false)]
+ public bool IsHidden
+ {
+ get { return DockHandler.IsHidden; }
+ set { DockHandler.IsHidden = value; }
+ }
+
+ [Browsable(false)]
+ public DockState VisibleState
+ {
+ get { return DockHandler.VisibleState; }
+ set { DockHandler.VisibleState = value; }
+ }
+
+ [Browsable(false)]
+ public bool IsFloat
+ {
+ get { return DockHandler.IsFloat; }
+ set { DockHandler.IsFloat = value; }
+ }
+
+ [Browsable(false)]
+ public DockPane PanelPane
+ {
+ get { return DockHandler.PanelPane; }
+ set { DockHandler.PanelPane = value; }
+ }
+
+ [Browsable(false)]
+ public DockPane FloatPane
+ {
+ get { return DockHandler.FloatPane; }
+ set { DockHandler.FloatPane = value; }
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ protected virtual string GetPersistString()
+ {
+ return GetType().ToString();
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_HideOnClose_Description")]
+ [DefaultValue(false)]
+ public bool HideOnClose
+ {
+ get { return DockHandler.HideOnClose; }
+ set { DockHandler.HideOnClose = value; }
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_ShowHint_Description")]
+ [DefaultValue(DockState.Unknown)]
+ public DockState ShowHint
+ {
+ get { return DockHandler.ShowHint; }
+ set { DockHandler.ShowHint = value; }
+ }
+
+ [Browsable(false)]
+ public bool IsActivated
+ {
+ get { return DockHandler.IsActivated; }
+ }
+
+ public bool IsDockStateValid(DockState dockState)
+ {
+ return DockHandler.IsDockStateValid(dockState);
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_TabPageContextMenu_Description")]
+ [DefaultValue(null)]
+ public ContextMenu TabPageContextMenu
+ {
+ get { return DockHandler.TabPageContextMenu; }
+ set { DockHandler.TabPageContextMenu = value; }
+ }
+
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockContent_TabPageContextMenuStrip_Description")]
+ [DefaultValue(null)]
+ public ContextMenuStrip TabPageContextMenuStrip
+ {
+ get { return DockHandler.TabPageContextMenuStrip; }
+ set { DockHandler.TabPageContextMenuStrip = value; }
+ }
+
+ [Localizable(true)]
+ [Category("Appearance")]
+ [LocalizedDescription("DockContent_ToolTipText_Description")]
+ [DefaultValue(null)]
+ public string ToolTipText
+ {
+ get { return DockHandler.ToolTipText; }
+ set { DockHandler.ToolTipText = value; }
+ }
+
+ public new void Activate()
+ {
+ DockHandler.Activate();
+ }
+
+ public new void Hide()
+ {
+ DockHandler.Hide();
+ }
+
+ public new void Show()
+ {
+ DockHandler.Show();
+ }
+
+ public void Show(DockPanel dockPanel)
+ {
+ DockHandler.Show(dockPanel);
+ }
+
+ public void Show(DockPanel dockPanel, DockState dockState)
+ {
+ DockHandler.Show(dockPanel, dockState);
+ }
+
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
+ public void Show(DockPanel dockPanel, Rectangle floatWindowBounds)
+ {
+ DockHandler.Show(dockPanel, floatWindowBounds);
+ }
+
+ public void Show(DockPane pane, IDockContent beforeContent)
+ {
+ DockHandler.Show(pane, beforeContent);
+ }
+
+ public void Show(DockPane previousPane, DockAlignment alignment, double proportion)
+ {
+ DockHandler.Show(previousPane, alignment, proportion);
+ }
+
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
+ public void FloatAt(Rectangle floatWindowBounds)
+ {
+ DockHandler.FloatAt(floatWindowBounds);
+ }
+
+ public void DockTo(DockPane paneTo, DockStyle dockStyle, int contentIndex)
+ {
+ DockHandler.DockTo(paneTo, dockStyle, contentIndex);
+ }
+
+ public void DockTo(DockPanel panel, DockStyle dockStyle)
+ {
+ DockHandler.DockTo(panel, dockStyle);
+ }
+
+ #region IDockContent Members
+ void IDockContent.OnActivated(EventArgs e)
+ {
+ this.OnActivated(e);
+ }
+
+ void IDockContent.OnDeactivate(EventArgs e)
+ {
+ this.OnDeactivate(e);
+ }
+ #endregion
+
+ #region Events
+ private void DockHandler_DockStateChanged(object sender, EventArgs e)
+ {
+ OnDockStateChanged(e);
+ }
+
+ private static readonly object DockStateChangedEvent = new object();
+ [LocalizedCategory("Category_PropertyChanged")]
+ [LocalizedDescription("Pane_DockStateChanged_Description")]
+ public event EventHandler DockStateChanged
+ {
+ add { Events.AddHandler(DockStateChangedEvent, value); }
+ remove { Events.RemoveHandler(DockStateChangedEvent, value); }
+ }
+ protected virtual void OnDockStateChanged(EventArgs e)
+ {
+ EventHandler handler = (EventHandler)Events[DockStateChangedEvent];
+ if (handler != null)
+ handler(this, e);
+ }
+ #endregion
+ }
+}
diff --git a/trunk/Docking/DockContentCollection.cs b/source/Docking/DockContentCollection.cs
similarity index 96%
rename from trunk/Docking/DockContentCollection.cs
rename to source/Docking/DockContentCollection.cs
index 5ff390f..f9d1d08 100644
--- a/trunk/Docking/DockContentCollection.cs
+++ b/source/Docking/DockContentCollection.cs
@@ -1,175 +1,175 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace LSLEditor.Docking
-{
- public class DockContentCollection : ReadOnlyCollection
- {
- private static List _emptyList = new List(0);
-
- internal DockContentCollection()
- : base(new List())
- {
- }
-
- internal DockContentCollection(DockPane pane)
- : base(_emptyList)
- {
- m_dockPane = pane;
- }
-
- private DockPane m_dockPane = null;
- private DockPane DockPane
- {
- get { return m_dockPane; }
- }
-
- public new IDockContent this[int index]
- {
- get
- {
- if (DockPane == null)
- return Items[index] as IDockContent;
- else
- return GetVisibleContent(index);
- }
- }
-
- internal int Add(IDockContent content)
- {
-#if DEBUG
- if (DockPane != null)
- throw new InvalidOperationException();
-#endif
-
- if (Contains(content))
- return IndexOf(content);
-
- Items.Add(content);
- return Count - 1;
- }
-
- internal void AddAt(IDockContent content, int index)
- {
-#if DEBUG
- if (DockPane != null)
- throw new InvalidOperationException();
-#endif
-
- if (index < 0 || index > Items.Count - 1)
- return;
-
- if (Contains(content))
- return;
-
- Items.Insert(index, content);
- }
-
- public new bool Contains(IDockContent content)
- {
- if (DockPane == null)
- return Items.Contains(content);
- else
- return (GetIndexOfVisibleContents(content) != -1);
- }
-
- public new int Count
- {
- get
- {
- if (DockPane == null)
- return base.Count;
- else
- return CountOfVisibleContents;
- }
- }
-
- public new int IndexOf(IDockContent content)
- {
- if (DockPane == null)
- {
- if (!Contains(content))
- return -1;
- else
- return Items.IndexOf(content);
- }
- else
- return GetIndexOfVisibleContents(content);
- }
-
- internal void Remove(IDockContent content)
- {
- if (DockPane != null)
- throw new InvalidOperationException();
-
- if (!Contains(content))
- return;
-
- Items.Remove(content);
- }
-
- private int CountOfVisibleContents
- {
- get
- {
-#if DEBUG
- if (DockPane == null)
- throw new InvalidOperationException();
-#endif
-
- int count = 0;
- foreach (IDockContent content in DockPane.Contents)
- {
- if (content.DockHandler.DockState == DockPane.DockState)
- count++;
- }
- return count;
- }
- }
-
- private IDockContent GetVisibleContent(int index)
- {
-#if DEBUG
- if (DockPane == null)
- throw new InvalidOperationException();
-#endif
-
- int currentIndex = -1;
- foreach (IDockContent content in DockPane.Contents)
- {
- if (content.DockHandler.DockState == DockPane.DockState)
- currentIndex++;
-
- if (currentIndex == index)
- return content;
- }
- throw (new ArgumentOutOfRangeException());
- }
-
- private int GetIndexOfVisibleContents(IDockContent content)
- {
-#if DEBUG
- if (DockPane == null)
- throw new InvalidOperationException();
-#endif
-
- if (content == null)
- return -1;
-
- int index = -1;
- foreach (IDockContent c in DockPane.Contents)
- {
- if (c.DockHandler.DockState == DockPane.DockState)
- {
- index++;
-
- if (c == content)
- return index;
- }
- }
- return -1;
- }
- }
-}
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace LSLEditor.Docking
+{
+ public class DockContentCollection : ReadOnlyCollection
+ {
+ private static List _emptyList = new List(0);
+
+ internal DockContentCollection()
+ : base(new List())
+ {
+ }
+
+ internal DockContentCollection(DockPane pane)
+ : base(_emptyList)
+ {
+ m_dockPane = pane;
+ }
+
+ private DockPane m_dockPane = null;
+ private DockPane DockPane
+ {
+ get { return m_dockPane; }
+ }
+
+ public new IDockContent this[int index]
+ {
+ get
+ {
+ if (DockPane == null)
+ return Items[index] as IDockContent;
+ else
+ return GetVisibleContent(index);
+ }
+ }
+
+ internal int Add(IDockContent content)
+ {
+#if DEBUG
+ if (DockPane != null)
+ throw new InvalidOperationException();
+#endif
+
+ if (Contains(content))
+ return IndexOf(content);
+
+ Items.Add(content);
+ return Count - 1;
+ }
+
+ internal void AddAt(IDockContent content, int index)
+ {
+#if DEBUG
+ if (DockPane != null)
+ throw new InvalidOperationException();
+#endif
+
+ if (index < 0 || index > Items.Count - 1)
+ return;
+
+ if (Contains(content))
+ return;
+
+ Items.Insert(index, content);
+ }
+
+ public new bool Contains(IDockContent content)
+ {
+ if (DockPane == null)
+ return Items.Contains(content);
+ else
+ return (GetIndexOfVisibleContents(content) != -1);
+ }
+
+ public new int Count
+ {
+ get
+ {
+ if (DockPane == null)
+ return base.Count;
+ else
+ return CountOfVisibleContents;
+ }
+ }
+
+ public new int IndexOf(IDockContent content)
+ {
+ if (DockPane == null)
+ {
+ if (!Contains(content))
+ return -1;
+ else
+ return Items.IndexOf(content);
+ }
+ else
+ return GetIndexOfVisibleContents(content);
+ }
+
+ internal void Remove(IDockContent content)
+ {
+ if (DockPane != null)
+ throw new InvalidOperationException();
+
+ if (!Contains(content))
+ return;
+
+ Items.Remove(content);
+ }
+
+ private int CountOfVisibleContents
+ {
+ get
+ {
+#if DEBUG
+ if (DockPane == null)
+ throw new InvalidOperationException();
+#endif
+
+ int count = 0;
+ foreach (IDockContent content in DockPane.Contents)
+ {
+ if (content.DockHandler.DockState == DockPane.DockState)
+ count++;
+ }
+ return count;
+ }
+ }
+
+ private IDockContent GetVisibleContent(int index)
+ {
+#if DEBUG
+ if (DockPane == null)
+ throw new InvalidOperationException();
+#endif
+
+ int currentIndex = -1;
+ foreach (IDockContent content in DockPane.Contents)
+ {
+ if (content.DockHandler.DockState == DockPane.DockState)
+ currentIndex++;
+
+ if (currentIndex == index)
+ return content;
+ }
+ throw (new ArgumentOutOfRangeException());
+ }
+
+ private int GetIndexOfVisibleContents(IDockContent content)
+ {
+#if DEBUG
+ if (DockPane == null)
+ throw new InvalidOperationException();
+#endif
+
+ if (content == null)
+ return -1;
+
+ int index = -1;
+ foreach (IDockContent c in DockPane.Contents)
+ {
+ if (c.DockHandler.DockState == DockPane.DockState)
+ {
+ index++;
+
+ if (c == content)
+ return index;
+ }
+ }
+ return -1;
+ }
+ }
+}
diff --git a/trunk/Docking/DockContentEventArgs.cs b/source/Docking/DockContentEventArgs.cs
similarity index 93%
rename from trunk/Docking/DockContentEventArgs.cs
rename to source/Docking/DockContentEventArgs.cs
index 4dc9e92..0f7f52e 100644
--- a/trunk/Docking/DockContentEventArgs.cs
+++ b/source/Docking/DockContentEventArgs.cs
@@ -1,19 +1,19 @@
-using System;
-
-namespace LSLEditor.Docking
-{
- public class DockContentEventArgs : EventArgs
- {
- private IDockContent m_content;
-
- public DockContentEventArgs(IDockContent content)
- {
- m_content = content;
- }
-
- public IDockContent Content
- {
- get { return m_content; }
- }
- }
-}
+using System;
+
+namespace LSLEditor.Docking
+{
+ public class DockContentEventArgs : EventArgs
+ {
+ private IDockContent m_content;
+
+ public DockContentEventArgs(IDockContent content)
+ {
+ m_content = content;
+ }
+
+ public IDockContent Content
+ {
+ get { return m_content; }
+ }
+ }
+}
diff --git a/trunk/Docking/DockContentHandler.cs b/source/Docking/DockContentHandler.cs
similarity index 96%
rename from trunk/Docking/DockContentHandler.cs
rename to source/Docking/DockContentHandler.cs
index 3076a9c..5e79579 100644
--- a/trunk/Docking/DockContentHandler.cs
+++ b/source/Docking/DockContentHandler.cs
@@ -1,1063 +1,1063 @@
-using System;
-using System.Windows.Forms;
-using System.Drawing;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- public delegate string GetPersistStringCallback();
-
- public class DockContentHandler : IDisposable, IDockDragSource
- {
- public DockContentHandler(Form form) : this(form, null)
- {
- }
-
- public DockContentHandler(Form form, GetPersistStringCallback getPersistStringCallback)
- {
- if (!(form is IDockContent))
- throw new ArgumentException(Strings.DockContent_Constructor_InvalidForm, "form");
-
- m_form = form;
- m_getPersistStringCallback = getPersistStringCallback;
-
- m_events = new EventHandlerList();
- Form.Disposed +=new EventHandler(Form_Disposed);
- Form.TextChanged += new EventHandler(Form_TextChanged);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if(disposing)
- {
- lock(this)
- {
- DockPanel = null;
- if (m_autoHideTab != null)
- m_autoHideTab.Dispose();
- if (m_tab != null)
- m_tab.Dispose();
-
- Form.Disposed -= new EventHandler(Form_Disposed);
- Form.TextChanged -= new EventHandler(Form_TextChanged);
- m_events.Dispose();
- }
- }
- }
-
- private Form m_form;
- public Form Form
- {
- get { return m_form; }
- }
-
- public IDockContent Content
- {
- get { return Form as IDockContent; }
- }
-
- private IDockContent m_previousActive = null;
- public IDockContent PreviousActive
- {
- get { return m_previousActive; }
- internal set { m_previousActive = value; }
- }
-
- private IDockContent m_nextActive = null;
- public IDockContent NextActive
- {
- get { return m_nextActive; }
- internal set { m_nextActive = value; }
- }
-
- private EventHandlerList m_events;
- private EventHandlerList Events
- {
- get { return m_events; }
- }
-
- private bool m_allowEndUserDocking = true;
- public bool AllowEndUserDocking
- {
- get { return m_allowEndUserDocking; }
- set { m_allowEndUserDocking = value; }
- }
-
- private double m_autoHidePortion = 0.25;
- public double AutoHidePortion
- {
- get { return m_autoHidePortion; }
- set
- {
- if (value <= 0)
- throw(new ArgumentOutOfRangeException(Strings.DockContentHandler_AutoHidePortion_OutOfRange));
-
- if (m_autoHidePortion == value)
- return;
-
- m_autoHidePortion = value;
-
- if (DockPanel == null)
- return;
-
- if (DockPanel.ActiveAutoHideContent == Content)
- DockPanel.PerformLayout();
- }
- }
-
- private bool m_closeButton = true;
- public bool CloseButton
- {
- get { return m_closeButton; }
- set
- {
- if (m_closeButton == value)
- return;
-
- m_closeButton = value;
- if (Pane != null)
- if (Pane.ActiveContent.DockHandler == this)
- Pane.RefreshChanges();
- }
- }
-
- private bool m_closeButtonVisible = true;
- ///
- /// Determines whether the close button is visible on the content
- ///
- public bool CloseButtonVisible
- {
- get { return m_closeButtonVisible; }
- set { m_closeButtonVisible = value; }
- }
-
- private DockState DefaultDockState
- {
- get
- {
- if (ShowHint != DockState.Unknown && ShowHint != DockState.Hidden)
- return ShowHint;
-
- if ((DockAreas & DockAreas.Document) != 0)
- return DockState.Document;
- if ((DockAreas & DockAreas.DockRight) != 0)
- return DockState.DockRight;
- if ((DockAreas & DockAreas.DockLeft) != 0)
- return DockState.DockLeft;
- if ((DockAreas & DockAreas.DockBottom) != 0)
- return DockState.DockBottom;
- if ((DockAreas & DockAreas.DockTop) != 0)
- return DockState.DockTop;
-
- return DockState.Unknown;
- }
- }
-
- private DockState DefaultShowState
- {
- get
- {
- if (ShowHint != DockState.Unknown)
- return ShowHint;
-
- if ((DockAreas & DockAreas.Document) != 0)
- return DockState.Document;
- if ((DockAreas & DockAreas.DockRight) != 0)
- return DockState.DockRight;
- if ((DockAreas & DockAreas.DockLeft) != 0)
- return DockState.DockLeft;
- if ((DockAreas & DockAreas.DockBottom) != 0)
- return DockState.DockBottom;
- if ((DockAreas & DockAreas.DockTop) != 0)
- return DockState.DockTop;
- if ((DockAreas & DockAreas.Float) != 0)
- return DockState.Float;
-
- return DockState.Unknown;
- }
- }
-
- private DockAreas m_allowedAreas = DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.DockBottom | DockAreas.Document | DockAreas.Float;
- public DockAreas DockAreas
- {
- get { return m_allowedAreas; }
- set
- {
- if (m_allowedAreas == value)
- return;
-
- if (!DockHelper.IsDockStateValid(DockState, value))
- throw(new InvalidOperationException(Strings.DockContentHandler_DockAreas_InvalidValue));
-
- m_allowedAreas = value;
-
- if (!DockHelper.IsDockStateValid(ShowHint, m_allowedAreas))
- ShowHint = DockState.Unknown;
- }
- }
-
- private DockState m_dockState = DockState.Unknown;
- public DockState DockState
- {
- get { return m_dockState; }
- set
- {
- if (m_dockState == value)
- return;
-
- DockPanel.SuspendLayout(true);
-
- if (value == DockState.Hidden)
- IsHidden = true;
- else
- SetDockState(false, value, Pane);
-
- DockPanel.ResumeLayout(true, true);
- }
- }
-
- private DockPanel m_dockPanel = null;
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- set
- {
- if (m_dockPanel == value)
- return;
-
- Pane = null;
-
- if (m_dockPanel != null)
- m_dockPanel.RemoveContent(Content);
-
- if (m_tab != null)
- {
- m_tab.Dispose();
- m_tab = null;
- }
-
- if (m_autoHideTab != null)
- {
- m_autoHideTab.Dispose();
- m_autoHideTab = null;
- }
-
- m_dockPanel = value;
-
- if (m_dockPanel != null)
- {
- m_dockPanel.AddContent(Content);
- Form.TopLevel = false;
- Form.FormBorderStyle = FormBorderStyle.None;
- Form.ShowInTaskbar = false;
- Form.WindowState = FormWindowState.Normal;
- NativeMethods.SetWindowPos(Form.Handle, IntPtr.Zero, 0, 0, 0, 0,
- Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
- Win32.FlagsSetWindowPos.SWP_NOMOVE |
- Win32.FlagsSetWindowPos.SWP_NOSIZE |
- Win32.FlagsSetWindowPos.SWP_NOZORDER |
- Win32.FlagsSetWindowPos.SWP_NOOWNERZORDER |
- Win32.FlagsSetWindowPos.SWP_FRAMECHANGED);
- }
- }
- }
-
- public Icon Icon
- {
- get { return Form.Icon; }
- }
-
- public DockPane Pane
- {
- get { return IsFloat ? FloatPane : PanelPane; }
- set
- {
- if (Pane == value)
- return;
-
- DockPanel.SuspendLayout(true);
-
- DockPane oldPane = Pane;
-
- SuspendSetDockState();
- FloatPane = (value == null ? null : (value.IsFloat ? value : FloatPane));
- PanelPane = (value == null ? null : (value.IsFloat ? PanelPane : value));
- ResumeSetDockState(IsHidden, value != null ? value.DockState : DockState.Unknown, oldPane);
-
- DockPanel.ResumeLayout(true, true);
- }
- }
-
- private bool m_isHidden = true;
- public bool IsHidden
- {
- get { return m_isHidden; }
- set
- {
- if (m_isHidden == value)
- return;
-
- SetDockState(value, VisibleState, Pane);
- }
- }
-
- private string m_tabText = null;
- public string TabText
- {
- get { return m_tabText == null || m_tabText == "" ? Form.Text : m_tabText; }
- set
- {
- if (m_tabText == value)
- return;
-
- m_tabText = value;
- if (Pane != null)
- Pane.RefreshChanges();
- }
- }
-
- private DockState m_visibleState = DockState.Unknown;
- public DockState VisibleState
- {
- get { return m_visibleState; }
- set
- {
- if (m_visibleState == value)
- return;
-
- SetDockState(IsHidden, value, Pane);
- }
- }
-
- private bool m_isFloat = false;
- public bool IsFloat
- {
- get { return m_isFloat; }
- set
- {
- if (m_isFloat == value)
- return;
-
- DockState visibleState = CheckDockState(value);
-
- if (visibleState == DockState.Unknown)
- throw new InvalidOperationException(Strings.DockContentHandler_IsFloat_InvalidValue);
-
- SetDockState(IsHidden, visibleState, Pane);
- }
- }
-
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
- public DockState CheckDockState(bool isFloat)
- {
- DockState dockState;
-
- if (isFloat)
- {
- if (!IsDockStateValid(DockState.Float))
- dockState = DockState.Unknown;
- else
- dockState = DockState.Float;
- }
- else
- {
- dockState = (PanelPane != null) ? PanelPane.DockState : DefaultDockState;
- if (dockState != DockState.Unknown && !IsDockStateValid(dockState))
- dockState = DockState.Unknown;
- }
-
- return dockState;
- }
-
- private DockPane m_panelPane = null;
- public DockPane PanelPane
- {
- get { return m_panelPane; }
- set
- {
- if (m_panelPane == value)
- return;
-
- if (value != null)
- {
- if (value.IsFloat || value.DockPanel != DockPanel)
- throw new InvalidOperationException(Strings.DockContentHandler_DockPane_InvalidValue);
- }
-
- DockPane oldPane = Pane;
-
- if (m_panelPane != null)
- RemoveFromPane(m_panelPane);
- m_panelPane = value;
- if (m_panelPane != null)
- {
- m_panelPane.AddContent(Content);
- SetDockState(IsHidden, IsFloat ? DockState.Float : m_panelPane.DockState, oldPane);
- }
- else
- SetDockState(IsHidden, DockState.Unknown, oldPane);
- }
- }
-
- private void RemoveFromPane(DockPane pane)
- {
- pane.RemoveContent(Content);
- SetPane(null);
- if (pane.Contents.Count == 0)
- pane.Dispose();
- }
-
- private DockPane m_floatPane = null;
- public DockPane FloatPane
- {
- get { return m_floatPane; }
- set
- {
- if (m_floatPane == value)
- return;
-
- if (value != null)
- {
- if (!value.IsFloat || value.DockPanel != DockPanel)
- throw new InvalidOperationException(Strings.DockContentHandler_FloatPane_InvalidValue);
- }
-
- DockPane oldPane = Pane;
-
- if (m_floatPane != null)
- RemoveFromPane(m_floatPane);
- m_floatPane = value;
- if (m_floatPane != null)
- {
- m_floatPane.AddContent(Content);
- SetDockState(IsHidden, IsFloat ? DockState.Float : VisibleState, oldPane);
- }
- else
- SetDockState(IsHidden, DockState.Unknown, oldPane);
- }
- }
-
- private int m_countSetDockState = 0;
- private void SuspendSetDockState()
- {
- m_countSetDockState ++;
- }
-
- private void ResumeSetDockState()
- {
- m_countSetDockState --;
- if (m_countSetDockState < 0)
- m_countSetDockState = 0;
- }
-
- internal bool IsSuspendSetDockState
- {
- get { return m_countSetDockState != 0; }
- }
-
- private void ResumeSetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
- {
- ResumeSetDockState();
- SetDockState(isHidden, visibleState, oldPane);
- }
-
- internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
- {
- if (IsSuspendSetDockState)
- return;
-
- if (DockPanel == null && visibleState != DockState.Unknown)
- throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel);
-
- if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !IsDockStateValid(visibleState)))
- throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState);
-
- DockPanel dockPanel = DockPanel;
- if (dockPanel != null)
- dockPanel.SuspendLayout(true);
-
- SuspendSetDockState();
-
- DockState oldDockState = DockState;
-
- if (m_isHidden != isHidden || oldDockState == DockState.Unknown)
- {
- m_isHidden = isHidden;
- }
- m_visibleState = visibleState;
- m_dockState = isHidden ? DockState.Hidden : visibleState;
-
- if (visibleState == DockState.Unknown)
- Pane = null;
- else
- {
- m_isFloat = (m_visibleState == DockState.Float);
-
- if (Pane == null)
- Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
- else if (Pane.DockState != visibleState)
- {
- if (Pane.Contents.Count == 1)
- Pane.SetDockState(visibleState);
- else
- Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
- }
- }
-
- if (Form.ContainsFocus)
- if (DockState == DockState.Hidden || DockState == DockState.Unknown)
- DockPanel.ContentFocusManager.GiveUpFocus(Content);
-
- SetPaneAndVisible(Pane);
-
- if (oldPane != null && !oldPane.IsDisposed && oldDockState == oldPane.DockState)
- RefreshDockPane(oldPane);
-
- if (Pane != null && DockState == Pane.DockState)
- {
- if ((Pane != oldPane) ||
- (Pane == oldPane && oldDockState != oldPane.DockState))
- // Avoid early refresh of hidden AutoHide panes
- if ((Pane.DockWindow == null || Pane.DockWindow.Visible || Pane.IsHidden) && !Pane.IsAutoHide)
- RefreshDockPane(Pane);
- }
-
- if (oldDockState != DockState)
- {
- if (DockState == DockState.Hidden || DockState == DockState.Unknown ||
- DockHelper.IsDockStateAutoHide(DockState))
- DockPanel.ContentFocusManager.RemoveFromList(Content);
- else
- DockPanel.ContentFocusManager.AddToList(Content);
-
- OnDockStateChanged(EventArgs.Empty);
- }
- ResumeSetDockState();
-
- if (dockPanel != null)
- dockPanel.ResumeLayout(true, true);
- }
-
- private static void RefreshDockPane(DockPane pane)
- {
- pane.RefreshChanges();
- pane.ValidateActiveContent();
- }
-
- internal string PersistString
- {
- get { return GetPersistStringCallback == null ? Form.GetType().ToString() : GetPersistStringCallback(); }
- }
-
- private GetPersistStringCallback m_getPersistStringCallback = null;
- public GetPersistStringCallback GetPersistStringCallback
- {
- get { return m_getPersistStringCallback; }
- set { m_getPersistStringCallback = value; }
- }
-
-
- private bool m_hideOnClose = false;
- public bool HideOnClose
- {
- get { return m_hideOnClose; }
- set { m_hideOnClose = value; }
- }
-
- private DockState m_showHint = DockState.Unknown;
- public DockState ShowHint
- {
- get { return m_showHint; }
- set
- {
- if (!DockHelper.IsDockStateValid(value, DockAreas))
- throw (new InvalidOperationException(Strings.DockContentHandler_ShowHint_InvalidValue));
-
- if (m_showHint == value)
- return;
-
- m_showHint = value;
- }
- }
-
- private bool m_isActivated = false;
- public bool IsActivated
- {
- get { return m_isActivated; }
- internal set
- {
- if (m_isActivated == value)
- return;
-
- m_isActivated = value;
- }
- }
-
- public bool IsDockStateValid(DockState dockState)
- {
- if (DockPanel != null && dockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
- return false;
- else
- return DockHelper.IsDockStateValid(dockState, DockAreas);
- }
-
- private ContextMenu m_tabPageContextMenu = null;
- public ContextMenu TabPageContextMenu
- {
- get { return m_tabPageContextMenu; }
- set { m_tabPageContextMenu = value; }
- }
-
- private string m_toolTipText = null;
- public string ToolTipText
- {
- get { return m_toolTipText; }
- set { m_toolTipText = value; }
- }
-
- public void Activate()
- {
- if (DockPanel == null)
- Form.Activate();
- else if (Pane == null)
- Show(DockPanel);
- else
- {
- IsHidden = false;
- Pane.ActiveContent = Content;
- if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
- {
- Form.Activate();
- return;
- }
- else if (DockHelper.IsDockStateAutoHide(DockState))
- DockPanel.ActiveAutoHideContent = Content;
-
- if (!Form.ContainsFocus)
- DockPanel.ContentFocusManager.Activate(Content);
- }
- }
-
- public void GiveUpFocus()
- {
- DockPanel.ContentFocusManager.GiveUpFocus(Content);
- }
-
- private IntPtr m_activeWindowHandle = IntPtr.Zero;
- internal IntPtr ActiveWindowHandle
- {
- get { return m_activeWindowHandle; }
- set { m_activeWindowHandle = value; }
- }
-
- public void Hide()
- {
- IsHidden = true;
- }
-
- internal void SetPaneAndVisible(DockPane pane)
- {
- SetPane(pane);
- SetVisible();
- }
-
- private void SetPane(DockPane pane)
- {
- if (pane != null && pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi)
- {
- if (Form.Parent is DockPane)
- SetParent(null);
- if (Form.MdiParent != DockPanel.ParentForm)
- {
- FlagClipWindow = true;
- Form.MdiParent = DockPanel.ParentForm;
- }
- }
- else
- {
- FlagClipWindow = true;
- if (Form.MdiParent != null)
- Form.MdiParent = null;
- if (Form.TopLevel)
- Form.TopLevel = false;
- SetParent(pane);
- }
- }
-
- internal void SetVisible()
- {
- bool visible;
-
- if (IsHidden)
- visible = false;
- else if (Pane != null && Pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi)
- visible = true;
- else if (Pane != null && Pane.ActiveContent == Content)
- visible = true;
- else if (Pane != null && Pane.ActiveContent != Content)
- visible = false;
- else
- visible = Form.Visible;
-
- if (Form.Visible != visible)
- Form.Visible = visible;
- }
-
- private void SetParent(Control value)
- {
- if (Form.Parent == value)
- return;
-
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // Workaround of .Net Framework bug:
- // Change the parent of a control with focus may result in the first
- // MDI child form get activated.
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- bool bRestoreFocus = false;
- if (Form.ContainsFocus)
- {
- //Suggested as a fix for a memory leak by bugreports
- if (value == null && !IsFloat)
- DockPanel.ContentFocusManager.GiveUpFocus(this.Content);
- else
- {
- DockPanel.SaveFocus();
- bRestoreFocus = true;
- }
- }
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- Form.Parent = value;
-
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // Workaround of .Net Framework bug:
- // Change the parent of a control with focus may result in the first
- // MDI child form get activated.
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if (bRestoreFocus)
- Activate();
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
-
- public void Show()
- {
- if (DockPanel == null)
- Form.Show();
- else
- Show(DockPanel);
- }
-
- public void Show(DockPanel dockPanel)
- {
- if (dockPanel == null)
- throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
-
- if (DockState == DockState.Unknown)
- Show(dockPanel, DefaultShowState);
- else
- Activate();
- }
-
- public void Show(DockPanel dockPanel, DockState dockState)
- {
- if (dockPanel == null)
- throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
-
- if (dockState == DockState.Unknown || dockState == DockState.Hidden)
- throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidDockState));
-
- dockPanel.SuspendLayout(true);
-
- DockPanel = dockPanel;
-
- if (dockState == DockState.Float && FloatPane == null)
- Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, true);
- else if (PanelPane == null)
- {
- DockPane paneExisting = null;
- foreach (DockPane pane in DockPanel.Panes)
- if (pane.DockState == dockState)
- {
- paneExisting = pane;
- break;
- }
-
- if (paneExisting == null)
- Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true);
- else
- Pane = paneExisting;
- }
-
- DockState = dockState;
- dockPanel.ResumeLayout(true, true); //we'll resume the layout before activating to ensure that the position
- Activate(); //and size of the form are finally processed before the form is shown
- }
-
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
- public void Show(DockPanel dockPanel, Rectangle floatWindowBounds)
- {
- if (dockPanel == null)
- throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
-
- dockPanel.SuspendLayout(true);
-
- DockPanel = dockPanel;
- if (FloatPane == null)
- {
- IsHidden = true; // to reduce the screen flicker
- FloatPane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, false);
- FloatPane.FloatWindow.StartPosition = FormStartPosition.Manual;
- }
-
- FloatPane.FloatWindow.Bounds = floatWindowBounds;
-
- Show(dockPanel, DockState.Float);
- Activate();
-
- dockPanel.ResumeLayout(true, true);
- }
-
- public void Show(DockPane pane, IDockContent beforeContent)
- {
- if (pane == null)
- throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullPane));
-
- if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1)
- throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidBeforeContent));
-
- pane.DockPanel.SuspendLayout(true);
-
- DockPanel = pane.DockPanel;
- Pane = pane;
- pane.SetContentIndex(Content, pane.Contents.IndexOf(beforeContent));
- Show();
-
- pane.DockPanel.ResumeLayout(true, true);
- }
-
- public void Show(DockPane previousPane, DockAlignment alignment, double proportion)
- {
- if (previousPane == null)
- throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane));
-
- if (DockHelper.IsDockStateAutoHide(previousPane.DockState))
- throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane));
-
- previousPane.DockPanel.SuspendLayout(true);
-
- DockPanel = previousPane.DockPanel;
- DockPanel.DockPaneFactory.CreateDockPane(Content, previousPane, alignment, proportion, true);
- Show();
-
- previousPane.DockPanel.ResumeLayout(true, true);
- }
-
- public void Close()
- {
- DockPanel dockPanel = DockPanel;
- if (dockPanel != null)
- dockPanel.SuspendLayout(true);
- Form.Close();
- if (dockPanel != null)
- dockPanel.ResumeLayout(true, true);
-
- }
-
- private DockPaneStripBase.Tab m_tab = null;
- internal DockPaneStripBase.Tab GetTab(DockPaneStripBase dockPaneStrip)
- {
- if (m_tab == null)
- m_tab = dockPaneStrip.CreateTab(Content);
-
- return m_tab;
- }
-
- private IDisposable m_autoHideTab = null;
- internal IDisposable AutoHideTab
- {
- get { return m_autoHideTab; }
- set { m_autoHideTab = value; }
- }
-
- #region Events
- private static readonly object DockStateChangedEvent = new object();
- public event EventHandler DockStateChanged
- {
- add { Events.AddHandler(DockStateChangedEvent, value); }
- remove { Events.RemoveHandler(DockStateChangedEvent, value); }
- }
- protected virtual void OnDockStateChanged(EventArgs e)
- {
- EventHandler handler = (EventHandler)Events[DockStateChangedEvent];
- if (handler != null)
- handler(this, e);
- }
- #endregion
-
- private void Form_Disposed(object sender, EventArgs e)
- {
- Dispose();
- }
-
- private void Form_TextChanged(object sender, EventArgs e)
- {
- if (DockHelper.IsDockStateAutoHide(DockState))
- DockPanel.RefreshAutoHideStrip();
- else if (Pane != null)
- {
- if (Pane.FloatWindow != null)
- Pane.FloatWindow.SetText();
- Pane.RefreshChanges();
- }
- }
-
- private bool m_flagClipWindow = false;
- internal bool FlagClipWindow
- {
- get { return m_flagClipWindow; }
- set
- {
- if (m_flagClipWindow == value)
- return;
-
- m_flagClipWindow = value;
- if (m_flagClipWindow)
- Form.Region = new Region(Rectangle.Empty);
- else
- Form.Region = null;
- }
- }
-
- private ContextMenuStrip m_tabPageContextMenuStrip = null;
- public ContextMenuStrip TabPageContextMenuStrip
- {
- get { return m_tabPageContextMenuStrip; }
- set { m_tabPageContextMenuStrip = value; }
- }
-
- #region IDockDragSource Members
-
- Control IDragSource.DragControl
- {
- get { return Form; }
- }
-
- bool IDockDragSource.CanDockTo(DockPane pane)
- {
- if (!IsDockStateValid(pane.DockState))
- return false;
-
- if (Pane == pane && pane.DisplayingContents.Count == 1)
- return false;
-
- return true;
- }
-
- Rectangle IDockDragSource.BeginDrag(Point ptMouse)
- {
- Size size;
- DockPane floatPane = this.FloatPane;
- if (DockState == DockState.Float || floatPane == null || floatPane.FloatWindow.NestedPanes.Count != 1)
- size = DockPanel.DefaultFloatWindowSize;
- else
- size = floatPane.FloatWindow.Size;
-
- Point location;
- Rectangle rectPane = Pane.ClientRectangle;
- if (DockState == DockState.Document)
- {
- if (Pane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
- location = new Point(rectPane.Left, rectPane.Bottom - size.Height);
- else
- location = new Point(rectPane.Left, rectPane.Top);
- }
- else
- {
- location = new Point(rectPane.Left, rectPane.Bottom);
- location.Y -= size.Height;
- }
- location = Pane.PointToScreen(location);
-
- if (ptMouse.X > location.X + size.Width)
- location.X += ptMouse.X - (location.X + size.Width) + Measures.SplitterSize;
-
- return new Rectangle(location, size);
- }
-
- public void FloatAt(Rectangle floatWindowBounds)
- {
- DockPane pane = DockPanel.DockPaneFactory.CreateDockPane(Content, floatWindowBounds, true);
- }
-
- public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
- {
- if (dockStyle == DockStyle.Fill)
- {
- bool samePane = (Pane == pane);
- if (!samePane)
- Pane = pane;
-
- if (contentIndex == -1 || !samePane)
- pane.SetContentIndex(Content, contentIndex);
- else
- {
- DockContentCollection contents = pane.Contents;
- int oldIndex = contents.IndexOf(Content);
- int newIndex = contentIndex;
- if (oldIndex < newIndex)
- {
- newIndex += 1;
- if (newIndex > contents.Count -1)
- newIndex = -1;
- }
- pane.SetContentIndex(Content, newIndex);
- }
- }
- else
- {
- DockPane paneFrom = DockPanel.DockPaneFactory.CreateDockPane(Content, pane.DockState, true);
- INestedPanesContainer container = pane.NestedPanesContainer;
- if (dockStyle == DockStyle.Left)
- paneFrom.DockTo(container, pane, DockAlignment.Left, 0.5);
- else if (dockStyle == DockStyle.Right)
- paneFrom.DockTo(container, pane, DockAlignment.Right, 0.5);
- else if (dockStyle == DockStyle.Top)
- paneFrom.DockTo(container, pane, DockAlignment.Top, 0.5);
- else if (dockStyle == DockStyle.Bottom)
- paneFrom.DockTo(container, pane, DockAlignment.Bottom, 0.5);
-
- paneFrom.DockState = pane.DockState;
- }
- }
-
- public void DockTo(DockPanel panel, DockStyle dockStyle)
- {
- if (panel != DockPanel)
- throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
-
- DockPane pane;
-
- if (dockStyle == DockStyle.Top)
- pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockTop, true);
- else if (dockStyle == DockStyle.Bottom)
- pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockBottom, true);
- else if (dockStyle == DockStyle.Left)
- pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockLeft, true);
- else if (dockStyle == DockStyle.Right)
- pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockRight, true);
- else if (dockStyle == DockStyle.Fill)
- pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Document, true);
- else
- return;
- }
-
- #endregion
- }
-}
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ public delegate string GetPersistStringCallback();
+
+ public class DockContentHandler : IDisposable, IDockDragSource
+ {
+ public DockContentHandler(Form form) : this(form, null)
+ {
+ }
+
+ public DockContentHandler(Form form, GetPersistStringCallback getPersistStringCallback)
+ {
+ if (!(form is IDockContent))
+ throw new ArgumentException(Strings.DockContent_Constructor_InvalidForm, "form");
+
+ m_form = form;
+ m_getPersistStringCallback = getPersistStringCallback;
+
+ m_events = new EventHandlerList();
+ Form.Disposed +=new EventHandler(Form_Disposed);
+ Form.TextChanged += new EventHandler(Form_TextChanged);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if(disposing)
+ {
+ lock(this)
+ {
+ DockPanel = null;
+ if (m_autoHideTab != null)
+ m_autoHideTab.Dispose();
+ if (m_tab != null)
+ m_tab.Dispose();
+
+ Form.Disposed -= new EventHandler(Form_Disposed);
+ Form.TextChanged -= new EventHandler(Form_TextChanged);
+ m_events.Dispose();
+ }
+ }
+ }
+
+ private Form m_form;
+ public Form Form
+ {
+ get { return m_form; }
+ }
+
+ public IDockContent Content
+ {
+ get { return Form as IDockContent; }
+ }
+
+ private IDockContent m_previousActive = null;
+ public IDockContent PreviousActive
+ {
+ get { return m_previousActive; }
+ internal set { m_previousActive = value; }
+ }
+
+ private IDockContent m_nextActive = null;
+ public IDockContent NextActive
+ {
+ get { return m_nextActive; }
+ internal set { m_nextActive = value; }
+ }
+
+ private EventHandlerList m_events;
+ private EventHandlerList Events
+ {
+ get { return m_events; }
+ }
+
+ private bool m_allowEndUserDocking = true;
+ public bool AllowEndUserDocking
+ {
+ get { return m_allowEndUserDocking; }
+ set { m_allowEndUserDocking = value; }
+ }
+
+ private double m_autoHidePortion = 0.25;
+ public double AutoHidePortion
+ {
+ get { return m_autoHidePortion; }
+ set
+ {
+ if (value <= 0)
+ throw(new ArgumentOutOfRangeException(Strings.DockContentHandler_AutoHidePortion_OutOfRange));
+
+ if (m_autoHidePortion == value)
+ return;
+
+ m_autoHidePortion = value;
+
+ if (DockPanel == null)
+ return;
+
+ if (DockPanel.ActiveAutoHideContent == Content)
+ DockPanel.PerformLayout();
+ }
+ }
+
+ private bool m_closeButton = true;
+ public bool CloseButton
+ {
+ get { return m_closeButton; }
+ set
+ {
+ if (m_closeButton == value)
+ return;
+
+ m_closeButton = value;
+ if (Pane != null)
+ if (Pane.ActiveContent.DockHandler == this)
+ Pane.RefreshChanges();
+ }
+ }
+
+ private bool m_closeButtonVisible = true;
+ ///
+ /// Determines whether the close button is visible on the content
+ ///
+ public bool CloseButtonVisible
+ {
+ get { return m_closeButtonVisible; }
+ set { m_closeButtonVisible = value; }
+ }
+
+ private DockState DefaultDockState
+ {
+ get
+ {
+ if (ShowHint != DockState.Unknown && ShowHint != DockState.Hidden)
+ return ShowHint;
+
+ if ((DockAreas & DockAreas.Document) != 0)
+ return DockState.Document;
+ if ((DockAreas & DockAreas.DockRight) != 0)
+ return DockState.DockRight;
+ if ((DockAreas & DockAreas.DockLeft) != 0)
+ return DockState.DockLeft;
+ if ((DockAreas & DockAreas.DockBottom) != 0)
+ return DockState.DockBottom;
+ if ((DockAreas & DockAreas.DockTop) != 0)
+ return DockState.DockTop;
+
+ return DockState.Unknown;
+ }
+ }
+
+ private DockState DefaultShowState
+ {
+ get
+ {
+ if (ShowHint != DockState.Unknown)
+ return ShowHint;
+
+ if ((DockAreas & DockAreas.Document) != 0)
+ return DockState.Document;
+ if ((DockAreas & DockAreas.DockRight) != 0)
+ return DockState.DockRight;
+ if ((DockAreas & DockAreas.DockLeft) != 0)
+ return DockState.DockLeft;
+ if ((DockAreas & DockAreas.DockBottom) != 0)
+ return DockState.DockBottom;
+ if ((DockAreas & DockAreas.DockTop) != 0)
+ return DockState.DockTop;
+ if ((DockAreas & DockAreas.Float) != 0)
+ return DockState.Float;
+
+ return DockState.Unknown;
+ }
+ }
+
+ private DockAreas m_allowedAreas = DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.DockBottom | DockAreas.Document | DockAreas.Float;
+ public DockAreas DockAreas
+ {
+ get { return m_allowedAreas; }
+ set
+ {
+ if (m_allowedAreas == value)
+ return;
+
+ if (!DockHelper.IsDockStateValid(DockState, value))
+ throw(new InvalidOperationException(Strings.DockContentHandler_DockAreas_InvalidValue));
+
+ m_allowedAreas = value;
+
+ if (!DockHelper.IsDockStateValid(ShowHint, m_allowedAreas))
+ ShowHint = DockState.Unknown;
+ }
+ }
+
+ private DockState m_dockState = DockState.Unknown;
+ public DockState DockState
+ {
+ get { return m_dockState; }
+ set
+ {
+ if (m_dockState == value)
+ return;
+
+ DockPanel.SuspendLayout(true);
+
+ if (value == DockState.Hidden)
+ IsHidden = true;
+ else
+ SetDockState(false, value, Pane);
+
+ DockPanel.ResumeLayout(true, true);
+ }
+ }
+
+ private DockPanel m_dockPanel = null;
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ set
+ {
+ if (m_dockPanel == value)
+ return;
+
+ Pane = null;
+
+ if (m_dockPanel != null)
+ m_dockPanel.RemoveContent(Content);
+
+ if (m_tab != null)
+ {
+ m_tab.Dispose();
+ m_tab = null;
+ }
+
+ if (m_autoHideTab != null)
+ {
+ m_autoHideTab.Dispose();
+ m_autoHideTab = null;
+ }
+
+ m_dockPanel = value;
+
+ if (m_dockPanel != null)
+ {
+ m_dockPanel.AddContent(Content);
+ Form.TopLevel = false;
+ Form.FormBorderStyle = FormBorderStyle.None;
+ Form.ShowInTaskbar = false;
+ Form.WindowState = FormWindowState.Normal;
+ NativeMethods.SetWindowPos(Form.Handle, IntPtr.Zero, 0, 0, 0, 0,
+ Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
+ Win32.FlagsSetWindowPos.SWP_NOMOVE |
+ Win32.FlagsSetWindowPos.SWP_NOSIZE |
+ Win32.FlagsSetWindowPos.SWP_NOZORDER |
+ Win32.FlagsSetWindowPos.SWP_NOOWNERZORDER |
+ Win32.FlagsSetWindowPos.SWP_FRAMECHANGED);
+ }
+ }
+ }
+
+ public Icon Icon
+ {
+ get { return Form.Icon; }
+ }
+
+ public DockPane Pane
+ {
+ get { return IsFloat ? FloatPane : PanelPane; }
+ set
+ {
+ if (Pane == value)
+ return;
+
+ DockPanel.SuspendLayout(true);
+
+ DockPane oldPane = Pane;
+
+ SuspendSetDockState();
+ FloatPane = (value == null ? null : (value.IsFloat ? value : FloatPane));
+ PanelPane = (value == null ? null : (value.IsFloat ? PanelPane : value));
+ ResumeSetDockState(IsHidden, value != null ? value.DockState : DockState.Unknown, oldPane);
+
+ DockPanel.ResumeLayout(true, true);
+ }
+ }
+
+ private bool m_isHidden = true;
+ public bool IsHidden
+ {
+ get { return m_isHidden; }
+ set
+ {
+ if (m_isHidden == value)
+ return;
+
+ SetDockState(value, VisibleState, Pane);
+ }
+ }
+
+ private string m_tabText = null;
+ public string TabText
+ {
+ get { return m_tabText == null || m_tabText == "" ? Form.Text : m_tabText; }
+ set
+ {
+ if (m_tabText == value)
+ return;
+
+ m_tabText = value;
+ if (Pane != null)
+ Pane.RefreshChanges();
+ }
+ }
+
+ private DockState m_visibleState = DockState.Unknown;
+ public DockState VisibleState
+ {
+ get { return m_visibleState; }
+ set
+ {
+ if (m_visibleState == value)
+ return;
+
+ SetDockState(IsHidden, value, Pane);
+ }
+ }
+
+ private bool m_isFloat = false;
+ public bool IsFloat
+ {
+ get { return m_isFloat; }
+ set
+ {
+ if (m_isFloat == value)
+ return;
+
+ DockState visibleState = CheckDockState(value);
+
+ if (visibleState == DockState.Unknown)
+ throw new InvalidOperationException(Strings.DockContentHandler_IsFloat_InvalidValue);
+
+ SetDockState(IsHidden, visibleState, Pane);
+ }
+ }
+
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
+ public DockState CheckDockState(bool isFloat)
+ {
+ DockState dockState;
+
+ if (isFloat)
+ {
+ if (!IsDockStateValid(DockState.Float))
+ dockState = DockState.Unknown;
+ else
+ dockState = DockState.Float;
+ }
+ else
+ {
+ dockState = (PanelPane != null) ? PanelPane.DockState : DefaultDockState;
+ if (dockState != DockState.Unknown && !IsDockStateValid(dockState))
+ dockState = DockState.Unknown;
+ }
+
+ return dockState;
+ }
+
+ private DockPane m_panelPane = null;
+ public DockPane PanelPane
+ {
+ get { return m_panelPane; }
+ set
+ {
+ if (m_panelPane == value)
+ return;
+
+ if (value != null)
+ {
+ if (value.IsFloat || value.DockPanel != DockPanel)
+ throw new InvalidOperationException(Strings.DockContentHandler_DockPane_InvalidValue);
+ }
+
+ DockPane oldPane = Pane;
+
+ if (m_panelPane != null)
+ RemoveFromPane(m_panelPane);
+ m_panelPane = value;
+ if (m_panelPane != null)
+ {
+ m_panelPane.AddContent(Content);
+ SetDockState(IsHidden, IsFloat ? DockState.Float : m_panelPane.DockState, oldPane);
+ }
+ else
+ SetDockState(IsHidden, DockState.Unknown, oldPane);
+ }
+ }
+
+ private void RemoveFromPane(DockPane pane)
+ {
+ pane.RemoveContent(Content);
+ SetPane(null);
+ if (pane.Contents.Count == 0)
+ pane.Dispose();
+ }
+
+ private DockPane m_floatPane = null;
+ public DockPane FloatPane
+ {
+ get { return m_floatPane; }
+ set
+ {
+ if (m_floatPane == value)
+ return;
+
+ if (value != null)
+ {
+ if (!value.IsFloat || value.DockPanel != DockPanel)
+ throw new InvalidOperationException(Strings.DockContentHandler_FloatPane_InvalidValue);
+ }
+
+ DockPane oldPane = Pane;
+
+ if (m_floatPane != null)
+ RemoveFromPane(m_floatPane);
+ m_floatPane = value;
+ if (m_floatPane != null)
+ {
+ m_floatPane.AddContent(Content);
+ SetDockState(IsHidden, IsFloat ? DockState.Float : VisibleState, oldPane);
+ }
+ else
+ SetDockState(IsHidden, DockState.Unknown, oldPane);
+ }
+ }
+
+ private int m_countSetDockState = 0;
+ private void SuspendSetDockState()
+ {
+ m_countSetDockState ++;
+ }
+
+ private void ResumeSetDockState()
+ {
+ m_countSetDockState --;
+ if (m_countSetDockState < 0)
+ m_countSetDockState = 0;
+ }
+
+ internal bool IsSuspendSetDockState
+ {
+ get { return m_countSetDockState != 0; }
+ }
+
+ private void ResumeSetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
+ {
+ ResumeSetDockState();
+ SetDockState(isHidden, visibleState, oldPane);
+ }
+
+ internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
+ {
+ if (IsSuspendSetDockState)
+ return;
+
+ if (DockPanel == null && visibleState != DockState.Unknown)
+ throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel);
+
+ if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !IsDockStateValid(visibleState)))
+ throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState);
+
+ DockPanel dockPanel = DockPanel;
+ if (dockPanel != null)
+ dockPanel.SuspendLayout(true);
+
+ SuspendSetDockState();
+
+ DockState oldDockState = DockState;
+
+ if (m_isHidden != isHidden || oldDockState == DockState.Unknown)
+ {
+ m_isHidden = isHidden;
+ }
+ m_visibleState = visibleState;
+ m_dockState = isHidden ? DockState.Hidden : visibleState;
+
+ if (visibleState == DockState.Unknown)
+ Pane = null;
+ else
+ {
+ m_isFloat = (m_visibleState == DockState.Float);
+
+ if (Pane == null)
+ Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
+ else if (Pane.DockState != visibleState)
+ {
+ if (Pane.Contents.Count == 1)
+ Pane.SetDockState(visibleState);
+ else
+ Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
+ }
+ }
+
+ if (Form.ContainsFocus)
+ if (DockState == DockState.Hidden || DockState == DockState.Unknown)
+ DockPanel.ContentFocusManager.GiveUpFocus(Content);
+
+ SetPaneAndVisible(Pane);
+
+ if (oldPane != null && !oldPane.IsDisposed && oldDockState == oldPane.DockState)
+ RefreshDockPane(oldPane);
+
+ if (Pane != null && DockState == Pane.DockState)
+ {
+ if ((Pane != oldPane) ||
+ (Pane == oldPane && oldDockState != oldPane.DockState))
+ // Avoid early refresh of hidden AutoHide panes
+ if ((Pane.DockWindow == null || Pane.DockWindow.Visible || Pane.IsHidden) && !Pane.IsAutoHide)
+ RefreshDockPane(Pane);
+ }
+
+ if (oldDockState != DockState)
+ {
+ if (DockState == DockState.Hidden || DockState == DockState.Unknown ||
+ DockHelper.IsDockStateAutoHide(DockState))
+ DockPanel.ContentFocusManager.RemoveFromList(Content);
+ else
+ DockPanel.ContentFocusManager.AddToList(Content);
+
+ OnDockStateChanged(EventArgs.Empty);
+ }
+ ResumeSetDockState();
+
+ if (dockPanel != null)
+ dockPanel.ResumeLayout(true, true);
+ }
+
+ private static void RefreshDockPane(DockPane pane)
+ {
+ pane.RefreshChanges();
+ pane.ValidateActiveContent();
+ }
+
+ internal string PersistString
+ {
+ get { return GetPersistStringCallback == null ? Form.GetType().ToString() : GetPersistStringCallback(); }
+ }
+
+ private GetPersistStringCallback m_getPersistStringCallback = null;
+ public GetPersistStringCallback GetPersistStringCallback
+ {
+ get { return m_getPersistStringCallback; }
+ set { m_getPersistStringCallback = value; }
+ }
+
+
+ private bool m_hideOnClose = false;
+ public bool HideOnClose
+ {
+ get { return m_hideOnClose; }
+ set { m_hideOnClose = value; }
+ }
+
+ private DockState m_showHint = DockState.Unknown;
+ public DockState ShowHint
+ {
+ get { return m_showHint; }
+ set
+ {
+ if (!DockHelper.IsDockStateValid(value, DockAreas))
+ throw (new InvalidOperationException(Strings.DockContentHandler_ShowHint_InvalidValue));
+
+ if (m_showHint == value)
+ return;
+
+ m_showHint = value;
+ }
+ }
+
+ private bool m_isActivated = false;
+ public bool IsActivated
+ {
+ get { return m_isActivated; }
+ internal set
+ {
+ if (m_isActivated == value)
+ return;
+
+ m_isActivated = value;
+ }
+ }
+
+ public bool IsDockStateValid(DockState dockState)
+ {
+ if (DockPanel != null && dockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
+ return false;
+ else
+ return DockHelper.IsDockStateValid(dockState, DockAreas);
+ }
+
+ private ContextMenu m_tabPageContextMenu = null;
+ public ContextMenu TabPageContextMenu
+ {
+ get { return m_tabPageContextMenu; }
+ set { m_tabPageContextMenu = value; }
+ }
+
+ private string m_toolTipText = null;
+ public string ToolTipText
+ {
+ get { return m_toolTipText; }
+ set { m_toolTipText = value; }
+ }
+
+ public void Activate()
+ {
+ if (DockPanel == null)
+ Form.Activate();
+ else if (Pane == null)
+ Show(DockPanel);
+ else
+ {
+ IsHidden = false;
+ Pane.ActiveContent = Content;
+ if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
+ {
+ Form.Activate();
+ return;
+ }
+ else if (DockHelper.IsDockStateAutoHide(DockState))
+ DockPanel.ActiveAutoHideContent = Content;
+
+ if (!Form.ContainsFocus)
+ DockPanel.ContentFocusManager.Activate(Content);
+ }
+ }
+
+ public void GiveUpFocus()
+ {
+ DockPanel.ContentFocusManager.GiveUpFocus(Content);
+ }
+
+ private IntPtr m_activeWindowHandle = IntPtr.Zero;
+ internal IntPtr ActiveWindowHandle
+ {
+ get { return m_activeWindowHandle; }
+ set { m_activeWindowHandle = value; }
+ }
+
+ public void Hide()
+ {
+ IsHidden = true;
+ }
+
+ internal void SetPaneAndVisible(DockPane pane)
+ {
+ SetPane(pane);
+ SetVisible();
+ }
+
+ private void SetPane(DockPane pane)
+ {
+ if (pane != null && pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi)
+ {
+ if (Form.Parent is DockPane)
+ SetParent(null);
+ if (Form.MdiParent != DockPanel.ParentForm)
+ {
+ FlagClipWindow = true;
+ Form.MdiParent = DockPanel.ParentForm;
+ }
+ }
+ else
+ {
+ FlagClipWindow = true;
+ if (Form.MdiParent != null)
+ Form.MdiParent = null;
+ if (Form.TopLevel)
+ Form.TopLevel = false;
+ SetParent(pane);
+ }
+ }
+
+ internal void SetVisible()
+ {
+ bool visible;
+
+ if (IsHidden)
+ visible = false;
+ else if (Pane != null && Pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi)
+ visible = true;
+ else if (Pane != null && Pane.ActiveContent == Content)
+ visible = true;
+ else if (Pane != null && Pane.ActiveContent != Content)
+ visible = false;
+ else
+ visible = Form.Visible;
+
+ if (Form.Visible != visible)
+ Form.Visible = visible;
+ }
+
+ private void SetParent(Control value)
+ {
+ if (Form.Parent == value)
+ return;
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // Workaround of .Net Framework bug:
+ // Change the parent of a control with focus may result in the first
+ // MDI child form get activated.
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ bool bRestoreFocus = false;
+ if (Form.ContainsFocus)
+ {
+ //Suggested as a fix for a memory leak by bugreports
+ if (value == null && !IsFloat)
+ DockPanel.ContentFocusManager.GiveUpFocus(this.Content);
+ else
+ {
+ DockPanel.SaveFocus();
+ bRestoreFocus = true;
+ }
+ }
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ Form.Parent = value;
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // Workaround of .Net Framework bug:
+ // Change the parent of a control with focus may result in the first
+ // MDI child form get activated.
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ if (bRestoreFocus)
+ Activate();
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ }
+
+ public void Show()
+ {
+ if (DockPanel == null)
+ Form.Show();
+ else
+ Show(DockPanel);
+ }
+
+ public void Show(DockPanel dockPanel)
+ {
+ if (dockPanel == null)
+ throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
+
+ if (DockState == DockState.Unknown)
+ Show(dockPanel, DefaultShowState);
+ else
+ Activate();
+ }
+
+ public void Show(DockPanel dockPanel, DockState dockState)
+ {
+ if (dockPanel == null)
+ throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
+
+ if (dockState == DockState.Unknown || dockState == DockState.Hidden)
+ throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidDockState));
+
+ dockPanel.SuspendLayout(true);
+
+ DockPanel = dockPanel;
+
+ if (dockState == DockState.Float && FloatPane == null)
+ Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, true);
+ else if (PanelPane == null)
+ {
+ DockPane paneExisting = null;
+ foreach (DockPane pane in DockPanel.Panes)
+ if (pane.DockState == dockState)
+ {
+ paneExisting = pane;
+ break;
+ }
+
+ if (paneExisting == null)
+ Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true);
+ else
+ Pane = paneExisting;
+ }
+
+ DockState = dockState;
+ dockPanel.ResumeLayout(true, true); //we'll resume the layout before activating to ensure that the position
+ Activate(); //and size of the form are finally processed before the form is shown
+ }
+
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]
+ public void Show(DockPanel dockPanel, Rectangle floatWindowBounds)
+ {
+ if (dockPanel == null)
+ throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
+
+ dockPanel.SuspendLayout(true);
+
+ DockPanel = dockPanel;
+ if (FloatPane == null)
+ {
+ IsHidden = true; // to reduce the screen flicker
+ FloatPane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, false);
+ FloatPane.FloatWindow.StartPosition = FormStartPosition.Manual;
+ }
+
+ FloatPane.FloatWindow.Bounds = floatWindowBounds;
+
+ Show(dockPanel, DockState.Float);
+ Activate();
+
+ dockPanel.ResumeLayout(true, true);
+ }
+
+ public void Show(DockPane pane, IDockContent beforeContent)
+ {
+ if (pane == null)
+ throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullPane));
+
+ if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1)
+ throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidBeforeContent));
+
+ pane.DockPanel.SuspendLayout(true);
+
+ DockPanel = pane.DockPanel;
+ Pane = pane;
+ pane.SetContentIndex(Content, pane.Contents.IndexOf(beforeContent));
+ Show();
+
+ pane.DockPanel.ResumeLayout(true, true);
+ }
+
+ public void Show(DockPane previousPane, DockAlignment alignment, double proportion)
+ {
+ if (previousPane == null)
+ throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane));
+
+ if (DockHelper.IsDockStateAutoHide(previousPane.DockState))
+ throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane));
+
+ previousPane.DockPanel.SuspendLayout(true);
+
+ DockPanel = previousPane.DockPanel;
+ DockPanel.DockPaneFactory.CreateDockPane(Content, previousPane, alignment, proportion, true);
+ Show();
+
+ previousPane.DockPanel.ResumeLayout(true, true);
+ }
+
+ public void Close()
+ {
+ DockPanel dockPanel = DockPanel;
+ if (dockPanel != null)
+ dockPanel.SuspendLayout(true);
+ Form.Close();
+ if (dockPanel != null)
+ dockPanel.ResumeLayout(true, true);
+
+ }
+
+ private DockPaneStripBase.Tab m_tab = null;
+ internal DockPaneStripBase.Tab GetTab(DockPaneStripBase dockPaneStrip)
+ {
+ if (m_tab == null)
+ m_tab = dockPaneStrip.CreateTab(Content);
+
+ return m_tab;
+ }
+
+ private IDisposable m_autoHideTab = null;
+ internal IDisposable AutoHideTab
+ {
+ get { return m_autoHideTab; }
+ set { m_autoHideTab = value; }
+ }
+
+ #region Events
+ private static readonly object DockStateChangedEvent = new object();
+ public event EventHandler DockStateChanged
+ {
+ add { Events.AddHandler(DockStateChangedEvent, value); }
+ remove { Events.RemoveHandler(DockStateChangedEvent, value); }
+ }
+ protected virtual void OnDockStateChanged(EventArgs e)
+ {
+ EventHandler handler = (EventHandler)Events[DockStateChangedEvent];
+ if (handler != null)
+ handler(this, e);
+ }
+ #endregion
+
+ private void Form_Disposed(object sender, EventArgs e)
+ {
+ Dispose();
+ }
+
+ private void Form_TextChanged(object sender, EventArgs e)
+ {
+ if (DockHelper.IsDockStateAutoHide(DockState))
+ DockPanel.RefreshAutoHideStrip();
+ else if (Pane != null)
+ {
+ if (Pane.FloatWindow != null)
+ Pane.FloatWindow.SetText();
+ Pane.RefreshChanges();
+ }
+ }
+
+ private bool m_flagClipWindow = false;
+ internal bool FlagClipWindow
+ {
+ get { return m_flagClipWindow; }
+ set
+ {
+ if (m_flagClipWindow == value)
+ return;
+
+ m_flagClipWindow = value;
+ if (m_flagClipWindow)
+ Form.Region = new Region(Rectangle.Empty);
+ else
+ Form.Region = null;
+ }
+ }
+
+ private ContextMenuStrip m_tabPageContextMenuStrip = null;
+ public ContextMenuStrip TabPageContextMenuStrip
+ {
+ get { return m_tabPageContextMenuStrip; }
+ set { m_tabPageContextMenuStrip = value; }
+ }
+
+ #region IDockDragSource Members
+
+ Control IDragSource.DragControl
+ {
+ get { return Form; }
+ }
+
+ bool IDockDragSource.CanDockTo(DockPane pane)
+ {
+ if (!IsDockStateValid(pane.DockState))
+ return false;
+
+ if (Pane == pane && pane.DisplayingContents.Count == 1)
+ return false;
+
+ return true;
+ }
+
+ Rectangle IDockDragSource.BeginDrag(Point ptMouse)
+ {
+ Size size;
+ DockPane floatPane = this.FloatPane;
+ if (DockState == DockState.Float || floatPane == null || floatPane.FloatWindow.NestedPanes.Count != 1)
+ size = DockPanel.DefaultFloatWindowSize;
+ else
+ size = floatPane.FloatWindow.Size;
+
+ Point location;
+ Rectangle rectPane = Pane.ClientRectangle;
+ if (DockState == DockState.Document)
+ {
+ if (Pane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
+ location = new Point(rectPane.Left, rectPane.Bottom - size.Height);
+ else
+ location = new Point(rectPane.Left, rectPane.Top);
+ }
+ else
+ {
+ location = new Point(rectPane.Left, rectPane.Bottom);
+ location.Y -= size.Height;
+ }
+ location = Pane.PointToScreen(location);
+
+ if (ptMouse.X > location.X + size.Width)
+ location.X += ptMouse.X - (location.X + size.Width) + Measures.SplitterSize;
+
+ return new Rectangle(location, size);
+ }
+
+ public void FloatAt(Rectangle floatWindowBounds)
+ {
+ DockPane pane = DockPanel.DockPaneFactory.CreateDockPane(Content, floatWindowBounds, true);
+ }
+
+ public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
+ {
+ if (dockStyle == DockStyle.Fill)
+ {
+ bool samePane = (Pane == pane);
+ if (!samePane)
+ Pane = pane;
+
+ if (contentIndex == -1 || !samePane)
+ pane.SetContentIndex(Content, contentIndex);
+ else
+ {
+ DockContentCollection contents = pane.Contents;
+ int oldIndex = contents.IndexOf(Content);
+ int newIndex = contentIndex;
+ if (oldIndex < newIndex)
+ {
+ newIndex += 1;
+ if (newIndex > contents.Count -1)
+ newIndex = -1;
+ }
+ pane.SetContentIndex(Content, newIndex);
+ }
+ }
+ else
+ {
+ DockPane paneFrom = DockPanel.DockPaneFactory.CreateDockPane(Content, pane.DockState, true);
+ INestedPanesContainer container = pane.NestedPanesContainer;
+ if (dockStyle == DockStyle.Left)
+ paneFrom.DockTo(container, pane, DockAlignment.Left, 0.5);
+ else if (dockStyle == DockStyle.Right)
+ paneFrom.DockTo(container, pane, DockAlignment.Right, 0.5);
+ else if (dockStyle == DockStyle.Top)
+ paneFrom.DockTo(container, pane, DockAlignment.Top, 0.5);
+ else if (dockStyle == DockStyle.Bottom)
+ paneFrom.DockTo(container, pane, DockAlignment.Bottom, 0.5);
+
+ paneFrom.DockState = pane.DockState;
+ }
+ }
+
+ public void DockTo(DockPanel panel, DockStyle dockStyle)
+ {
+ if (panel != DockPanel)
+ throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
+
+ DockPane pane;
+
+ if (dockStyle == DockStyle.Top)
+ pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockTop, true);
+ else if (dockStyle == DockStyle.Bottom)
+ pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockBottom, true);
+ else if (dockStyle == DockStyle.Left)
+ pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockLeft, true);
+ else if (dockStyle == DockStyle.Right)
+ pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.DockRight, true);
+ else if (dockStyle == DockStyle.Fill)
+ pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Document, true);
+ else
+ return;
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/Docking/DockOutlineBase.cs b/source/Docking/DockOutlineBase.cs
similarity index 96%
rename from trunk/Docking/DockOutlineBase.cs
rename to source/Docking/DockOutlineBase.cs
index 9e56645..4f799bf 100644
--- a/trunk/Docking/DockOutlineBase.cs
+++ b/source/Docking/DockOutlineBase.cs
@@ -1,161 +1,161 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- internal abstract class DockOutlineBase
- {
- public DockOutlineBase()
- {
- Init();
- }
-
- private void Init()
- {
- SetValues(Rectangle.Empty, null, DockStyle.None, -1);
- SaveOldValues();
- }
-
- private Rectangle m_oldFloatWindowBounds;
- protected Rectangle OldFloatWindowBounds
- {
- get { return m_oldFloatWindowBounds; }
- }
-
- private Control m_oldDockTo;
- protected Control OldDockTo
- {
- get { return m_oldDockTo; }
- }
-
- private DockStyle m_oldDock;
- protected DockStyle OldDock
- {
- get { return m_oldDock; }
- }
-
- private int m_oldContentIndex;
- protected int OldContentIndex
- {
- get { return m_oldContentIndex; }
- }
-
- protected bool SameAsOldValue
- {
- get
- {
- return FloatWindowBounds == OldFloatWindowBounds &&
- DockTo == OldDockTo &&
- Dock == OldDock &&
- ContentIndex == OldContentIndex;
- }
- }
-
- private Rectangle m_floatWindowBounds;
- public Rectangle FloatWindowBounds
- {
- get { return m_floatWindowBounds; }
- }
-
- private Control m_dockTo;
- public Control DockTo
- {
- get { return m_dockTo; }
- }
-
- private DockStyle m_dock;
- public DockStyle Dock
- {
- get { return m_dock; }
- }
-
- private int m_contentIndex;
- public int ContentIndex
- {
- get { return m_contentIndex; }
- }
-
- public bool FlagFullEdge
- {
- get { return m_contentIndex != 0; }
- }
-
- private bool m_flagTestDrop = false;
- public bool FlagTestDrop
- {
- get { return m_flagTestDrop; }
- set { m_flagTestDrop = value; }
- }
-
- private void SaveOldValues()
- {
- m_oldDockTo = m_dockTo;
- m_oldDock = m_dock;
- m_oldContentIndex = m_contentIndex;
- m_oldFloatWindowBounds = m_floatWindowBounds;
- }
-
- protected abstract void OnShow();
-
- protected abstract void OnClose();
-
- private void SetValues(Rectangle floatWindowBounds, Control dockTo, DockStyle dock, int contentIndex)
- {
- m_floatWindowBounds = floatWindowBounds;
- m_dockTo = dockTo;
- m_dock = dock;
- m_contentIndex = contentIndex;
- FlagTestDrop = true;
- }
-
- private void TestChange()
- {
- if (m_floatWindowBounds != m_oldFloatWindowBounds ||
- m_dockTo != m_oldDockTo ||
- m_dock != m_oldDock ||
- m_contentIndex != m_oldContentIndex)
- OnShow();
- }
-
- public void Show()
- {
- SaveOldValues();
- SetValues(Rectangle.Empty, null, DockStyle.None, -1);
- TestChange();
- }
-
- public void Show(DockPane pane, DockStyle dock)
- {
- SaveOldValues();
- SetValues(Rectangle.Empty, pane, dock, -1);
- TestChange();
- }
-
- public void Show(DockPane pane, int contentIndex)
- {
- SaveOldValues();
- SetValues(Rectangle.Empty, pane, DockStyle.Fill, contentIndex);
- TestChange();
- }
-
- public void Show(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge)
- {
- SaveOldValues();
- SetValues(Rectangle.Empty, dockPanel, dock, fullPanelEdge ? -1 : 0);
- TestChange();
- }
-
- public void Show(Rectangle floatWindowBounds)
- {
- SaveOldValues();
- SetValues(floatWindowBounds, null, DockStyle.None, -1);
- TestChange();
- }
-
- public void Close()
- {
- OnClose();
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ internal abstract class DockOutlineBase
+ {
+ public DockOutlineBase()
+ {
+ Init();
+ }
+
+ private void Init()
+ {
+ SetValues(Rectangle.Empty, null, DockStyle.None, -1);
+ SaveOldValues();
+ }
+
+ private Rectangle m_oldFloatWindowBounds;
+ protected Rectangle OldFloatWindowBounds
+ {
+ get { return m_oldFloatWindowBounds; }
+ }
+
+ private Control m_oldDockTo;
+ protected Control OldDockTo
+ {
+ get { return m_oldDockTo; }
+ }
+
+ private DockStyle m_oldDock;
+ protected DockStyle OldDock
+ {
+ get { return m_oldDock; }
+ }
+
+ private int m_oldContentIndex;
+ protected int OldContentIndex
+ {
+ get { return m_oldContentIndex; }
+ }
+
+ protected bool SameAsOldValue
+ {
+ get
+ {
+ return FloatWindowBounds == OldFloatWindowBounds &&
+ DockTo == OldDockTo &&
+ Dock == OldDock &&
+ ContentIndex == OldContentIndex;
+ }
+ }
+
+ private Rectangle m_floatWindowBounds;
+ public Rectangle FloatWindowBounds
+ {
+ get { return m_floatWindowBounds; }
+ }
+
+ private Control m_dockTo;
+ public Control DockTo
+ {
+ get { return m_dockTo; }
+ }
+
+ private DockStyle m_dock;
+ public DockStyle Dock
+ {
+ get { return m_dock; }
+ }
+
+ private int m_contentIndex;
+ public int ContentIndex
+ {
+ get { return m_contentIndex; }
+ }
+
+ public bool FlagFullEdge
+ {
+ get { return m_contentIndex != 0; }
+ }
+
+ private bool m_flagTestDrop = false;
+ public bool FlagTestDrop
+ {
+ get { return m_flagTestDrop; }
+ set { m_flagTestDrop = value; }
+ }
+
+ private void SaveOldValues()
+ {
+ m_oldDockTo = m_dockTo;
+ m_oldDock = m_dock;
+ m_oldContentIndex = m_contentIndex;
+ m_oldFloatWindowBounds = m_floatWindowBounds;
+ }
+
+ protected abstract void OnShow();
+
+ protected abstract void OnClose();
+
+ private void SetValues(Rectangle floatWindowBounds, Control dockTo, DockStyle dock, int contentIndex)
+ {
+ m_floatWindowBounds = floatWindowBounds;
+ m_dockTo = dockTo;
+ m_dock = dock;
+ m_contentIndex = contentIndex;
+ FlagTestDrop = true;
+ }
+
+ private void TestChange()
+ {
+ if (m_floatWindowBounds != m_oldFloatWindowBounds ||
+ m_dockTo != m_oldDockTo ||
+ m_dock != m_oldDock ||
+ m_contentIndex != m_oldContentIndex)
+ OnShow();
+ }
+
+ public void Show()
+ {
+ SaveOldValues();
+ SetValues(Rectangle.Empty, null, DockStyle.None, -1);
+ TestChange();
+ }
+
+ public void Show(DockPane pane, DockStyle dock)
+ {
+ SaveOldValues();
+ SetValues(Rectangle.Empty, pane, dock, -1);
+ TestChange();
+ }
+
+ public void Show(DockPane pane, int contentIndex)
+ {
+ SaveOldValues();
+ SetValues(Rectangle.Empty, pane, DockStyle.Fill, contentIndex);
+ TestChange();
+ }
+
+ public void Show(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge)
+ {
+ SaveOldValues();
+ SetValues(Rectangle.Empty, dockPanel, dock, fullPanelEdge ? -1 : 0);
+ TestChange();
+ }
+
+ public void Show(Rectangle floatWindowBounds)
+ {
+ SaveOldValues();
+ SetValues(floatWindowBounds, null, DockStyle.None, -1);
+ TestChange();
+ }
+
+ public void Close()
+ {
+ OnClose();
+ }
+ }
+}
diff --git a/trunk/Docking/DockPane.SplitterControl.cs b/source/Docking/DockPane.SplitterControl.cs
similarity index 97%
rename from trunk/Docking/DockPane.SplitterControl.cs
rename to source/Docking/DockPane.SplitterControl.cs
index da35ed2..04b669f 100644
--- a/trunk/Docking/DockPane.SplitterControl.cs
+++ b/source/Docking/DockPane.SplitterControl.cs
@@ -1,157 +1,157 @@
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- partial class DockPane
- {
- private class SplitterControl : Control, ISplitterDragSource
- {
- DockPane m_pane;
-
- public SplitterControl(DockPane pane)
- {
- SetStyle(ControlStyles.Selectable, false);
- m_pane = pane;
- }
-
- public DockPane DockPane
- {
- get { return m_pane; }
- }
-
- private DockAlignment m_alignment;
- public DockAlignment Alignment
- {
- get { return m_alignment; }
- set
- {
- m_alignment = value;
- if (m_alignment == DockAlignment.Left || m_alignment == DockAlignment.Right)
- Cursor = Cursors.VSplit;
- else if (m_alignment == DockAlignment.Top || m_alignment == DockAlignment.Bottom)
- Cursor = Cursors.HSplit;
- else
- Cursor = Cursors.Default;
-
- if (DockPane.DockState == DockState.Document)
- Invalidate();
- }
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
-
- if (DockPane.DockState != DockState.Document)
- return;
-
- Graphics g = e.Graphics;
- Rectangle rect = ClientRectangle;
- if (Alignment == DockAlignment.Top || Alignment == DockAlignment.Bottom)
- g.DrawLine(SystemPens.ControlDark, rect.Left, rect.Bottom - 1, rect.Right, rect.Bottom - 1);
- else if (Alignment == DockAlignment.Left || Alignment == DockAlignment.Right)
- g.DrawLine(SystemPens.ControlDarkDark, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom);
- }
-
- protected override void OnMouseDown(MouseEventArgs e)
- {
- base.OnMouseDown(e);
-
- if (e.Button != MouseButtons.Left)
- return;
-
- DockPane.DockPanel.BeginDrag(this, Parent.RectangleToScreen(Bounds));
- }
-
- #region ISplitterDragSource Members
-
- void ISplitterDragSource.BeginDrag(Rectangle rectSplitter)
- {
- }
-
- void ISplitterDragSource.EndDrag()
- {
- }
-
- bool ISplitterDragSource.IsVertical
- {
- get
- {
- NestedDockingStatus status = DockPane.NestedDockingStatus;
- return (status.DisplayingAlignment == DockAlignment.Left ||
- status.DisplayingAlignment == DockAlignment.Right);
- }
- }
-
- Rectangle ISplitterDragSource.DragLimitBounds
- {
- get
- {
- NestedDockingStatus status = DockPane.NestedDockingStatus;
- Rectangle rectLimit = Parent.RectangleToScreen(status.LogicalBounds);
- if (((ISplitterDragSource)this).IsVertical)
- {
- rectLimit.X += MeasurePane.MinSize;
- rectLimit.Width -= 2 * MeasurePane.MinSize;
- }
- else
- {
- rectLimit.Y += MeasurePane.MinSize;
- rectLimit.Height -= 2 * MeasurePane.MinSize;
- }
-
- return rectLimit;
- }
- }
-
- void ISplitterDragSource.MoveSplitter(int offset)
- {
- NestedDockingStatus status = DockPane.NestedDockingStatus;
- double proportion = status.Proportion;
- if (status.LogicalBounds.Width <= 0 || status.LogicalBounds.Height <= 0)
- return;
- else if (status.DisplayingAlignment == DockAlignment.Left)
- proportion += ((double)offset) / (double)status.LogicalBounds.Width;
- else if (status.DisplayingAlignment == DockAlignment.Right)
- proportion -= ((double)offset) / (double)status.LogicalBounds.Width;
- else if (status.DisplayingAlignment == DockAlignment.Top)
- proportion += ((double)offset) / (double)status.LogicalBounds.Height;
- else
- proportion -= ((double)offset) / (double)status.LogicalBounds.Height;
-
- DockPane.SetNestedDockingProportion(proportion);
- }
-
- #region IDragSource Members
-
- Control IDragSource.DragControl
- {
- get { return this; }
- }
-
- #endregion
-
- #endregion
- }
-
- private SplitterControl m_splitter;
- private SplitterControl Splitter
- {
- get { return m_splitter; }
- }
-
- internal Rectangle SplitterBounds
- {
- set { Splitter.Bounds = value; }
- }
-
- internal DockAlignment SplitterAlignment
- {
- set { Splitter.Alignment = value; }
- }
- }
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ partial class DockPane
+ {
+ private class SplitterControl : Control, ISplitterDragSource
+ {
+ DockPane m_pane;
+
+ public SplitterControl(DockPane pane)
+ {
+ SetStyle(ControlStyles.Selectable, false);
+ m_pane = pane;
+ }
+
+ public DockPane DockPane
+ {
+ get { return m_pane; }
+ }
+
+ private DockAlignment m_alignment;
+ public DockAlignment Alignment
+ {
+ get { return m_alignment; }
+ set
+ {
+ m_alignment = value;
+ if (m_alignment == DockAlignment.Left || m_alignment == DockAlignment.Right)
+ Cursor = Cursors.VSplit;
+ else if (m_alignment == DockAlignment.Top || m_alignment == DockAlignment.Bottom)
+ Cursor = Cursors.HSplit;
+ else
+ Cursor = Cursors.Default;
+
+ if (DockPane.DockState == DockState.Document)
+ Invalidate();
+ }
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+
+ if (DockPane.DockState != DockState.Document)
+ return;
+
+ Graphics g = e.Graphics;
+ Rectangle rect = ClientRectangle;
+ if (Alignment == DockAlignment.Top || Alignment == DockAlignment.Bottom)
+ g.DrawLine(SystemPens.ControlDark, rect.Left, rect.Bottom - 1, rect.Right, rect.Bottom - 1);
+ else if (Alignment == DockAlignment.Left || Alignment == DockAlignment.Right)
+ g.DrawLine(SystemPens.ControlDarkDark, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom);
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ base.OnMouseDown(e);
+
+ if (e.Button != MouseButtons.Left)
+ return;
+
+ DockPane.DockPanel.BeginDrag(this, Parent.RectangleToScreen(Bounds));
+ }
+
+ #region ISplitterDragSource Members
+
+ void ISplitterDragSource.BeginDrag(Rectangle rectSplitter)
+ {
+ }
+
+ void ISplitterDragSource.EndDrag()
+ {
+ }
+
+ bool ISplitterDragSource.IsVertical
+ {
+ get
+ {
+ NestedDockingStatus status = DockPane.NestedDockingStatus;
+ return (status.DisplayingAlignment == DockAlignment.Left ||
+ status.DisplayingAlignment == DockAlignment.Right);
+ }
+ }
+
+ Rectangle ISplitterDragSource.DragLimitBounds
+ {
+ get
+ {
+ NestedDockingStatus status = DockPane.NestedDockingStatus;
+ Rectangle rectLimit = Parent.RectangleToScreen(status.LogicalBounds);
+ if (((ISplitterDragSource)this).IsVertical)
+ {
+ rectLimit.X += MeasurePane.MinSize;
+ rectLimit.Width -= 2 * MeasurePane.MinSize;
+ }
+ else
+ {
+ rectLimit.Y += MeasurePane.MinSize;
+ rectLimit.Height -= 2 * MeasurePane.MinSize;
+ }
+
+ return rectLimit;
+ }
+ }
+
+ void ISplitterDragSource.MoveSplitter(int offset)
+ {
+ NestedDockingStatus status = DockPane.NestedDockingStatus;
+ double proportion = status.Proportion;
+ if (status.LogicalBounds.Width <= 0 || status.LogicalBounds.Height <= 0)
+ return;
+ else if (status.DisplayingAlignment == DockAlignment.Left)
+ proportion += ((double)offset) / (double)status.LogicalBounds.Width;
+ else if (status.DisplayingAlignment == DockAlignment.Right)
+ proportion -= ((double)offset) / (double)status.LogicalBounds.Width;
+ else if (status.DisplayingAlignment == DockAlignment.Top)
+ proportion += ((double)offset) / (double)status.LogicalBounds.Height;
+ else
+ proportion -= ((double)offset) / (double)status.LogicalBounds.Height;
+
+ DockPane.SetNestedDockingProportion(proportion);
+ }
+
+ #region IDragSource Members
+
+ Control IDragSource.DragControl
+ {
+ get { return this; }
+ }
+
+ #endregion
+
+ #endregion
+ }
+
+ private SplitterControl m_splitter;
+ private SplitterControl Splitter
+ {
+ get { return m_splitter; }
+ }
+
+ internal Rectangle SplitterBounds
+ {
+ set { Splitter.Bounds = value; }
+ }
+
+ internal DockAlignment SplitterAlignment
+ {
+ set { Splitter.Alignment = value; }
+ }
+ }
}
\ No newline at end of file
diff --git a/trunk/Docking/DockPane.cs b/source/Docking/DockPane.cs
similarity index 96%
rename from trunk/Docking/DockPane.cs
rename to source/Docking/DockPane.cs
index 83dd35c..ecb70dd 100644
--- a/trunk/Docking/DockPane.cs
+++ b/source/Docking/DockPane.cs
@@ -1,1288 +1,1288 @@
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-using System.Runtime.InteropServices;
-using System.Security.Permissions;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- [ToolboxItem(false)]
- public partial class DockPane : UserControl, IDockDragSource
- {
- public enum AppearanceStyle
- {
- ToolWindow,
- Document
- }
-
- private enum HitTestArea
- {
- Caption,
- TabStrip,
- Content,
- None
- }
-
- private struct HitTestResult
- {
- public HitTestArea HitArea;
- public int Index;
-
- public HitTestResult(HitTestArea hitTestArea, int index)
- {
- HitArea = hitTestArea;
- Index = index;
- }
- }
-
- private DockPaneCaptionBase m_captionControl;
- private DockPaneCaptionBase CaptionControl
- {
- get { return m_captionControl; }
- }
-
- private DockPaneStripBase m_tabStripControl;
- internal DockPaneStripBase TabStripControl
- {
- get { return m_tabStripControl; }
- }
-
- internal protected DockPane(IDockContent content, DockState visibleState, bool show)
- {
- InternalConstruct(content, visibleState, false, Rectangle.Empty, null, DockAlignment.Right, 0.5, show);
- }
-
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
- internal protected DockPane(IDockContent content, FloatWindow floatWindow, bool show)
- {
- if (floatWindow == null)
- throw new ArgumentNullException("floatWindow");
-
- InternalConstruct(content, DockState.Float, false, Rectangle.Empty, floatWindow.NestedPanes.GetDefaultPreviousPane(this), DockAlignment.Right, 0.5, show);
- }
-
- internal protected DockPane(IDockContent content, DockPane previousPane, DockAlignment alignment, double proportion, bool show)
- {
- if (previousPane == null)
- throw(new ArgumentNullException("previousPane"));
- InternalConstruct(content, previousPane.DockState, false, Rectangle.Empty, previousPane, alignment, proportion, show);
- }
-
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
- internal protected DockPane(IDockContent content, Rectangle floatWindowBounds, bool show)
- {
- InternalConstruct(content, DockState.Float, true, floatWindowBounds, null, DockAlignment.Right, 0.5, show);
- }
-
- private void InternalConstruct(IDockContent content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
- {
- if (dockState == DockState.Hidden || dockState == DockState.Unknown)
- throw new ArgumentException(Strings.DockPane_SetDockState_InvalidState);
-
- if (content == null)
- throw new ArgumentNullException(Strings.DockPane_Constructor_NullContent);
-
- if (content.DockHandler.DockPanel == null)
- throw new ArgumentException(Strings.DockPane_Constructor_NullDockPanel);
-
-
- SuspendLayout();
- SetStyle(ControlStyles.Selectable, false);
-
- m_isFloat = (dockState == DockState.Float);
-
- m_contents = new DockContentCollection();
- m_displayingContents = new DockContentCollection(this);
- m_dockPanel = content.DockHandler.DockPanel;
- m_dockPanel.AddPane(this);
-
- m_splitter = new SplitterControl(this);
-
- m_nestedDockingStatus = new NestedDockingStatus(this);
-
- m_captionControl = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this);
- m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this);
- Controls.AddRange(new Control[] { m_captionControl, m_tabStripControl });
-
- DockPanel.SuspendLayout(true);
- if (flagBounds)
- FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
- else if (prevPane != null)
- DockTo(prevPane.NestedPanesContainer, prevPane, alignment, proportion);
-
- SetDockState(dockState);
- if (show)
- content.DockHandler.Pane = this;
- else if (this.IsFloat)
- content.DockHandler.FloatPane = this;
- else
- content.DockHandler.PanelPane = this;
-
- ResumeLayout();
- DockPanel.ResumeLayout(true, true);
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- m_dockState = DockState.Unknown;
-
- if (NestedPanesContainer != null)
- NestedPanesContainer.NestedPanes.Remove(this);
-
- if (DockPanel != null)
- {
- DockPanel.RemovePane(this);
- m_dockPanel = null;
- }
-
- Splitter.Dispose();
- if (m_autoHidePane != null)
- m_autoHidePane.Dispose();
- }
- base.Dispose(disposing);
- }
-
- private IDockContent m_activeContent = null;
- public virtual IDockContent ActiveContent
- {
- get { return m_activeContent; }
- set
- {
- if (ActiveContent == value)
- return;
-
- if (value != null)
- {
- if (!DisplayingContents.Contains(value))
- throw(new InvalidOperationException(Strings.DockPane_ActiveContent_InvalidValue));
- }
- else
- {
- if (DisplayingContents.Count != 0)
- throw(new InvalidOperationException(Strings.DockPane_ActiveContent_InvalidValue));
- }
-
- IDockContent oldValue = m_activeContent;
-
- if (DockPanel.ActiveAutoHideContent == oldValue)
- DockPanel.ActiveAutoHideContent = null;
-
- m_activeContent = value;
-
- if (DockPanel.DocumentStyle == DocumentStyle.DockingMdi && DockState == DockState.Document)
- {
- if (m_activeContent != null)
- m_activeContent.DockHandler.Form.BringToFront();
- }
- else
- {
- if (m_activeContent != null)
- m_activeContent.DockHandler.SetVisible();
- if (oldValue != null && DisplayingContents.Contains(oldValue))
- oldValue.DockHandler.SetVisible();
- if (IsActivated && m_activeContent != null)
- m_activeContent.DockHandler.Activate();
- }
-
- if (FloatWindow != null)
- FloatWindow.SetText();
-
- if (DockPanel.DocumentStyle == DocumentStyle.DockingMdi &&
- DockState == DockState.Document)
- RefreshChanges(false); // delayed layout to reduce screen flicker
- else
- RefreshChanges();
-
- if (m_activeContent != null)
- TabStripControl.EnsureTabVisible(m_activeContent);
- }
- }
-
- private bool m_allowDockDragAndDrop = true;
- public virtual bool AllowDockDragAndDrop
- {
- get { return m_allowDockDragAndDrop; }
- set { m_allowDockDragAndDrop = value; }
- }
-
- private IDisposable m_autoHidePane = null;
- internal IDisposable AutoHidePane
- {
- get { return m_autoHidePane; }
- set { m_autoHidePane = value; }
- }
-
- private object m_autoHideTabs = null;
- internal object AutoHideTabs
- {
- get { return m_autoHideTabs; }
- set { m_autoHideTabs = value; }
- }
-
- private object TabPageContextMenu
- {
- get
- {
- IDockContent content = ActiveContent;
-
- if (content == null)
- return null;
-
- if (content.DockHandler.TabPageContextMenuStrip != null)
- return content.DockHandler.TabPageContextMenuStrip;
- else if (content.DockHandler.TabPageContextMenu != null)
- return content.DockHandler.TabPageContextMenu;
- else
- return null;
- }
- }
-
- internal bool HasTabPageContextMenu
- {
- get { return TabPageContextMenu != null; }
- }
-
- internal void ShowTabPageContextMenu(Control control, Point position)
- {
- object menu = TabPageContextMenu;
-
- if (menu == null)
- return;
-
- ContextMenuStrip contextMenuStrip = menu as ContextMenuStrip;
- if (contextMenuStrip != null)
- {
- contextMenuStrip.Show(control, position);
- return;
- }
-
- ContextMenu contextMenu = menu as ContextMenu;
- if (contextMenu != null)
- contextMenu.Show(this, position);
- }
-
- private Rectangle CaptionRectangle
- {
- get
- {
- if (!HasCaption)
- return Rectangle.Empty;
-
- Rectangle rectWindow = DisplayingRectangle;
- int x, y, width;
- x = rectWindow.X;
- y = rectWindow.Y;
- width = rectWindow.Width;
- int height = CaptionControl.MeasureHeight();
-
- return new Rectangle(x, y, width, height);
- }
- }
-
- internal Rectangle ContentRectangle
- {
- get
- {
- Rectangle rectWindow = DisplayingRectangle;
- Rectangle rectCaption = CaptionRectangle;
- Rectangle rectTabStrip = TabStripRectangle;
-
- int x = rectWindow.X;
-
- int y = rectWindow.Y + (rectCaption.IsEmpty ? 0 : rectCaption.Height);
- if (DockState == DockState.Document && DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Top)
- y += rectTabStrip.Height;
-
- int width = rectWindow.Width;
- int height = rectWindow.Height - rectCaption.Height - rectTabStrip.Height;
-
- return new Rectangle(x, y, width, height);
- }
- }
-
- internal Rectangle TabStripRectangle
- {
- get
- {
- if (Appearance == AppearanceStyle.ToolWindow)
- return TabStripRectangle_ToolWindow;
- else
- return TabStripRectangle_Document;
- }
- }
-
- private Rectangle TabStripRectangle_ToolWindow
- {
- get
- {
- if (DisplayingContents.Count <= 1 || IsAutoHide)
- return Rectangle.Empty;
-
- Rectangle rectWindow = DisplayingRectangle;
-
- int width = rectWindow.Width;
- int height = TabStripControl.MeasureHeight();
- int x = rectWindow.X;
- int y = rectWindow.Bottom - height;
- Rectangle rectCaption = CaptionRectangle;
- if (rectCaption.Contains(x, y))
- y = rectCaption.Y + rectCaption.Height;
-
- return new Rectangle(x, y, width, height);
- }
- }
-
- private Rectangle TabStripRectangle_Document
- {
- get
- {
- if (DisplayingContents.Count == 0)
- return Rectangle.Empty;
-
- if (DisplayingContents.Count == 1 && DockPanel.DocumentStyle == DocumentStyle.DockingSdi)
- return Rectangle.Empty;
-
- Rectangle rectWindow = DisplayingRectangle;
- int x = rectWindow.X;
- int width = rectWindow.Width;
- int height = TabStripControl.MeasureHeight();
-
- int y = 0;
- if (DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
- y = rectWindow.Height - height;
- else
- y = rectWindow.Y;
-
- return new Rectangle(x, y, width, height);
- }
- }
-
- public virtual string CaptionText
- {
- get { return ActiveContent == null ? string.Empty : ActiveContent.DockHandler.TabText; }
- }
-
- private DockContentCollection m_contents;
- public DockContentCollection Contents
- {
- get { return m_contents; }
- }
-
- private DockContentCollection m_displayingContents;
- public DockContentCollection DisplayingContents
- {
- get { return m_displayingContents; }
- }
-
- private DockPanel m_dockPanel;
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- private bool HasCaption
- {
- get
- {
- if (DockState == DockState.Document ||
- DockState == DockState.Hidden ||
- DockState == DockState.Unknown ||
- (DockState == DockState.Float && FloatWindow.VisibleNestedPanes.Count <= 1))
- return false;
- else
- return true;
- }
- }
-
- private bool m_isActivated = false;
- public bool IsActivated
- {
- get { return m_isActivated; }
- }
- internal void SetIsActivated(bool value)
- {
- if (m_isActivated == value)
- return;
-
- m_isActivated = value;
- if (DockState != DockState.Document)
- RefreshChanges(false);
- OnIsActivatedChanged(EventArgs.Empty);
- }
-
- private bool m_isActiveDocumentPane = false;
- public bool IsActiveDocumentPane
- {
- get { return m_isActiveDocumentPane; }
- }
- internal void SetIsActiveDocumentPane(bool value)
- {
- if (m_isActiveDocumentPane == value)
- return;
-
- m_isActiveDocumentPane = value;
- if (DockState == DockState.Document)
- RefreshChanges();
- OnIsActiveDocumentPaneChanged(EventArgs.Empty);
- }
-
- public bool IsDockStateValid(DockState dockState)
- {
- foreach (IDockContent content in Contents)
- if (!content.DockHandler.IsDockStateValid(dockState))
- return false;
-
- return true;
- }
-
- public bool IsAutoHide
- {
- get { return DockHelper.IsDockStateAutoHide(DockState); }
- }
-
- public AppearanceStyle Appearance
- {
- get { return (DockState == DockState.Document) ? AppearanceStyle.Document : AppearanceStyle.ToolWindow; }
- }
-
- internal Rectangle DisplayingRectangle
- {
- get { return ClientRectangle; }
- }
-
- public void Activate()
- {
- if (DockHelper.IsDockStateAutoHide(DockState) && DockPanel.ActiveAutoHideContent != ActiveContent)
- DockPanel.ActiveAutoHideContent = ActiveContent;
- else if (!IsActivated && ActiveContent != null)
- ActiveContent.DockHandler.Activate();
- }
-
- internal void AddContent(IDockContent content)
- {
- if (Contents.Contains(content))
- return;
-
- Contents.Add(content);
- }
-
- internal void Close()
- {
- Dispose();
- }
-
- public void CloseActiveContent()
- {
- CloseContent(ActiveContent);
- }
-
- internal void CloseContent(IDockContent content)
- {
- DockPanel dockPanel = DockPanel;
- dockPanel.SuspendLayout(true);
-
- if (content == null)
- return;
-
- if (!content.DockHandler.CloseButton)
- return;
-
- if (content.DockHandler.HideOnClose)
- content.DockHandler.Hide();
- else
- content.DockHandler.Close();
-
- dockPanel.ResumeLayout(true, true);
- }
-
- private HitTestResult GetHitTest(Point ptMouse)
- {
- Point ptMouseClient = PointToClient(ptMouse);
-
- Rectangle rectCaption = CaptionRectangle;
- if (rectCaption.Contains(ptMouseClient))
- return new HitTestResult(HitTestArea.Caption, -1);
-
- Rectangle rectContent = ContentRectangle;
- if (rectContent.Contains(ptMouseClient))
- return new HitTestResult(HitTestArea.Content, -1);
-
- Rectangle rectTabStrip = TabStripRectangle;
- if (rectTabStrip.Contains(ptMouseClient))
- return new HitTestResult(HitTestArea.TabStrip, TabStripControl.HitTest(TabStripControl.PointToClient(ptMouse)));
-
- return new HitTestResult(HitTestArea.None, -1);
- }
-
- private bool m_isHidden = true;
- public bool IsHidden
- {
- get { return m_isHidden; }
- }
- private void SetIsHidden(bool value)
- {
- if (m_isHidden == value)
- return;
-
- m_isHidden = value;
- if (DockHelper.IsDockStateAutoHide(DockState))
- {
- DockPanel.RefreshAutoHideStrip();
- DockPanel.PerformLayout();
- }
- else if (NestedPanesContainer != null)
- ((Control)NestedPanesContainer).PerformLayout();
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- SetIsHidden(DisplayingContents.Count == 0);
- if (!IsHidden)
- {
- CaptionControl.Bounds = CaptionRectangle;
- TabStripControl.Bounds = TabStripRectangle;
-
- SetContentBounds();
-
- foreach (IDockContent content in Contents)
- {
- if (DisplayingContents.Contains(content))
- if (content.DockHandler.FlagClipWindow && content.DockHandler.Form.Visible)
- content.DockHandler.FlagClipWindow = false;
- }
- }
-
- base.OnLayout(levent);
- }
-
- internal void SetContentBounds()
- {
- Rectangle rectContent = ContentRectangle;
- if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi)
- rectContent = DockPanel.RectangleToMdiClient(RectangleToScreen(rectContent));
-
- Rectangle rectInactive = new Rectangle(-rectContent.Width, rectContent.Y, rectContent.Width, rectContent.Height);
- foreach (IDockContent content in Contents)
- if (content.DockHandler.Pane == this)
- {
- if (content == ActiveContent)
- content.DockHandler.Form.Bounds = rectContent;
- else
- content.DockHandler.Form.Bounds = rectInactive;
- }
- }
-
- internal void RefreshChanges()
- {
- RefreshChanges(true);
- }
-
- private void RefreshChanges(bool performLayout)
- {
- if (IsDisposed)
- return;
-
- CaptionControl.RefreshChanges();
- TabStripControl.RefreshChanges();
- if (DockState == DockState.Float)
- FloatWindow.RefreshChanges();
- if (DockHelper.IsDockStateAutoHide(DockState) && DockPanel != null)
- {
- DockPanel.RefreshAutoHideStrip();
- DockPanel.PerformLayout();
- }
-
- if (performLayout)
- PerformLayout();
- }
-
- internal void RemoveContent(IDockContent content)
- {
- if (!Contents.Contains(content))
- return;
-
- Contents.Remove(content);
- }
-
- public void SetContentIndex(IDockContent content, int index)
- {
- int oldIndex = Contents.IndexOf(content);
- if (oldIndex == -1)
- throw(new ArgumentException(Strings.DockPane_SetContentIndex_InvalidContent));
-
- if (index < 0 || index > Contents.Count - 1)
- if (index != -1)
- throw(new ArgumentOutOfRangeException(Strings.DockPane_SetContentIndex_InvalidIndex));
-
- if (oldIndex == index)
- return;
- if (oldIndex == Contents.Count - 1 && index == -1)
- return;
-
- Contents.Remove(content);
- if (index == -1)
- Contents.Add(content);
- else if (oldIndex < index)
- Contents.AddAt(content, index - 1);
- else
- Contents.AddAt(content, index);
-
- RefreshChanges();
- }
-
- private void SetParent()
- {
- if (DockState == DockState.Unknown || DockState == DockState.Hidden)
- {
- SetParent(null);
- Splitter.Parent = null;
- }
- else if (DockState == DockState.Float)
- {
- SetParent(FloatWindow);
- Splitter.Parent = FloatWindow;
- }
- else if (DockHelper.IsDockStateAutoHide(DockState))
- {
- SetParent(DockPanel.AutoHideControl);
- Splitter.Parent = null;
- }
- else
- {
- SetParent(DockPanel.DockWindows[DockState]);
- Splitter.Parent = Parent;
- }
- }
-
- private void SetParent(Control value)
- {
- if (Parent == value)
- return;
-
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // Workaround of .Net Framework bug:
- // Change the parent of a control with focus may result in the first
- // MDI child form get activated.
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- IDockContent contentFocused = GetFocusedContent();
- if (contentFocused != null)
- DockPanel.SaveFocus();
-
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- Parent = value;
-
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // Workaround of .Net Framework bug:
- // Change the parent of a control with focus may result in the first
- // MDI child form get activated.
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if (contentFocused != null)
- contentFocused.DockHandler.Activate();
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
-
- public new void Show()
- {
- Activate();
- }
-
- internal void TestDrop(IDockDragSource dragSource, DockOutlineBase dockOutline)
- {
- if (!dragSource.CanDockTo(this))
- return;
-
- Point ptMouse = Control.MousePosition;
-
- HitTestResult hitTestResult = GetHitTest(ptMouse);
- if (hitTestResult.HitArea == HitTestArea.Caption)
- dockOutline.Show(this, -1);
- else if (hitTestResult.HitArea == HitTestArea.TabStrip && hitTestResult.Index != -1)
- dockOutline.Show(this, hitTestResult.Index);
- }
-
- internal void ValidateActiveContent()
- {
- if (ActiveContent == null)
- {
- if (DisplayingContents.Count != 0)
- ActiveContent = DisplayingContents[0];
- return;
- }
-
- if (DisplayingContents.IndexOf(ActiveContent) >= 0)
- return;
-
- IDockContent prevVisible = null;
- for (int i=Contents.IndexOf(ActiveContent)-1; i>=0; i--)
- if (Contents[i].DockHandler.DockState == DockState)
- {
- prevVisible = Contents[i];
- break;
- }
-
- IDockContent nextVisible = null;
- for (int i=Contents.IndexOf(ActiveContent)+1; i= 0);
- DockPanel.ResumeLayout(true, true);
- }
-
- private bool IsRefreshStateChangeSuspended
- {
- get { return m_countRefreshStateChange != 0; }
- }
-
- private void ResumeRefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState)
- {
- ResumeRefreshStateChange();
- RefreshStateChange(oldContainer, oldDockState);
- }
-
- private void RefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState)
- {
- lock (this)
- {
- if (IsRefreshStateChangeSuspended)
- return;
-
- SuspendRefreshStateChange();
- }
-
- DockPanel.SuspendLayout(true);
-
- IDockContent contentFocused = GetFocusedContent();
- if (contentFocused != null)
- DockPanel.SaveFocus();
- SetParent();
-
- if (ActiveContent != null)
- ActiveContent.DockHandler.SetDockState(ActiveContent.DockHandler.IsHidden, DockState, ActiveContent.DockHandler.Pane);
- foreach (IDockContent content in Contents)
- {
- if (content.DockHandler.Pane == this)
- content.DockHandler.SetDockState(content.DockHandler.IsHidden, DockState, content.DockHandler.Pane);
- }
-
- if (oldContainer != null)
- {
- Control oldContainerControl = (Control)oldContainer;
- if (oldContainer.DockState == oldDockState && !oldContainerControl.IsDisposed)
- oldContainerControl.PerformLayout();
- }
- if (DockHelper.IsDockStateAutoHide(oldDockState))
- DockPanel.RefreshActiveAutoHideContent();
-
- if (NestedPanesContainer.DockState == DockState)
- ((Control)NestedPanesContainer).PerformLayout();
- if (DockHelper.IsDockStateAutoHide(DockState))
- DockPanel.RefreshActiveAutoHideContent();
-
- if (DockHelper.IsDockStateAutoHide(oldDockState) ||
- DockHelper.IsDockStateAutoHide(DockState))
- {
- DockPanel.RefreshAutoHideStrip();
- DockPanel.PerformLayout();
- }
-
- ResumeRefreshStateChange();
-
- if (contentFocused != null)
- contentFocused.DockHandler.Activate();
-
- DockPanel.ResumeLayout(true, true);
-
- if (oldDockState != DockState)
- OnDockStateChanged(EventArgs.Empty);
- }
-
- private IDockContent GetFocusedContent()
- {
- IDockContent contentFocused = null;
- foreach (IDockContent content in Contents)
- {
- if (content.DockHandler.Form.ContainsFocus)
- {
- contentFocused = content;
- break;
- }
- }
-
- return contentFocused;
- }
-
- public DockPane DockTo(INestedPanesContainer container)
- {
- if (container == null)
- throw new InvalidOperationException(Strings.DockPane_DockTo_NullContainer);
-
- DockAlignment alignment;
- if (container.DockState == DockState.DockLeft || container.DockState == DockState.DockRight)
- alignment = DockAlignment.Bottom;
- else
- alignment = DockAlignment.Right;
-
- return DockTo(container, container.NestedPanes.GetDefaultPreviousPane(this), alignment, 0.5);
- }
-
- public DockPane DockTo(INestedPanesContainer container, DockPane previousPane, DockAlignment alignment, double proportion)
- {
- if (container == null)
- throw new InvalidOperationException(Strings.DockPane_DockTo_NullContainer);
-
- if (container.IsFloat == this.IsFloat)
- {
- InternalAddToDockList(container, previousPane, alignment, proportion);
- return this;
- }
-
- IDockContent firstContent = GetFirstContent(container.DockState);
- if (firstContent == null)
- return null;
-
- DockPane pane;
- DockPanel.DummyContent.DockPanel = DockPanel;
- if (container.IsFloat)
- pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, (FloatWindow)container, true);
- else
- pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, container.DockState, true);
-
- pane.DockTo(container, previousPane, alignment, proportion);
- SetVisibleContentsToPane(pane);
- DockPanel.DummyContent.DockPanel = null;
-
- return pane;
- }
-
- private void SetVisibleContentsToPane(DockPane pane)
- {
- SetVisibleContentsToPane(pane, ActiveContent);
- }
-
- private void SetVisibleContentsToPane(DockPane pane, IDockContent activeContent)
- {
- for (int i=0; i 0)
- throw new InvalidOperationException(Strings.DockPane_DockTo_NullPrevPane);
-
- if (prevPane != null && !container.NestedPanes.Contains(prevPane))
- throw new InvalidOperationException(Strings.DockPane_DockTo_NoPrevPane);
-
- if (prevPane == this)
- throw new InvalidOperationException(Strings.DockPane_DockTo_SelfPrevPane);
-
- INestedPanesContainer oldContainer = NestedPanesContainer;
- DockState oldDockState = DockState;
- container.NestedPanes.Add(this);
- NestedDockingStatus.SetStatus(container.NestedPanes, prevPane, alignment, proportion);
-
- if (DockHelper.IsDockWindowState(DockState))
- m_dockState = container.DockState;
-
- RefreshStateChange(oldContainer, oldDockState);
- }
-
- public void SetNestedDockingProportion(double proportion)
- {
- NestedDockingStatus.SetStatus(NestedDockingStatus.NestedPanes, NestedDockingStatus.PreviousPane, NestedDockingStatus.Alignment, proportion);
- if (NestedPanesContainer != null)
- ((Control)NestedPanesContainer).PerformLayout();
- }
-
- public DockPane Float()
- {
- DockPanel.SuspendLayout(true);
-
- IDockContent activeContent = ActiveContent;
-
- DockPane floatPane = GetFloatPaneFromContents();
- if (floatPane == null)
- {
- IDockContent firstContent = GetFirstContent(DockState.Float);
- if (firstContent == null)
- {
- DockPanel.ResumeLayout(true, true);
- return null;
- }
- floatPane = DockPanel.DockPaneFactory.CreateDockPane(firstContent,DockState.Float, true);
- }
- SetVisibleContentsToPane(floatPane, activeContent);
-
- DockPanel.ResumeLayout(true, true);
- return floatPane;
- }
-
- private DockPane GetFloatPaneFromContents()
- {
- DockPane floatPane = null;
- for (int i=0; i=0; i--)
- {
- IDockContent content = DisplayingContents[i];
- if (content.DockHandler.CheckDockState(false) != DockState.Unknown)
- content.DockHandler.IsFloat = false;
- }
-
- DockPanel.ResumeLayout(true, true);
- }
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
- Activate();
-
- base.WndProc(ref m);
- }
-
- #region IDockDragSource Members
-
- #region IDragSource Members
-
- Control IDragSource.DragControl
- {
- get { return this; }
- }
-
- #endregion
-
- bool IDockDragSource.IsDockStateValid(DockState dockState)
- {
- return IsDockStateValid(dockState);
- }
-
- bool IDockDragSource.CanDockTo(DockPane pane)
- {
- if (!IsDockStateValid(pane.DockState))
- return false;
-
- if (pane == this)
- return false;
-
- return true;
- }
-
- Rectangle IDockDragSource.BeginDrag(Point ptMouse)
- {
- Point location = PointToScreen(new Point(0, 0));
- Size size;
-
- DockPane floatPane = ActiveContent.DockHandler.FloatPane;
- if (DockState == DockState.Float || floatPane == null || floatPane.FloatWindow.NestedPanes.Count != 1)
- size = DockPanel.DefaultFloatWindowSize;
- else
- size = floatPane.FloatWindow.Size;
-
- if (ptMouse.X > location.X + size.Width)
- location.X += ptMouse.X - (location.X + size.Width) + Measures.SplitterSize;
-
- return new Rectangle(location, size);
- }
-
- public void FloatAt(Rectangle floatWindowBounds)
- {
- if (FloatWindow == null || FloatWindow.NestedPanes.Count != 1)
- FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
- else
- FloatWindow.Bounds = floatWindowBounds;
-
- DockState = DockState.Float;
- }
-
- public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
- {
- if (dockStyle == DockStyle.Fill)
- {
- IDockContent activeContent = ActiveContent;
- for (int i = Contents.Count - 1; i >= 0; i--)
- {
- IDockContent c = Contents[i];
- if (c.DockHandler.DockState == DockState)
- {
- c.DockHandler.Pane = pane;
- if (contentIndex != -1)
- pane.SetContentIndex(c, contentIndex);
- }
- }
- pane.ActiveContent = activeContent;
- }
- else
- {
- if (dockStyle == DockStyle.Left)
- DockTo(pane.NestedPanesContainer, pane, DockAlignment.Left, 0.5);
- else if (dockStyle == DockStyle.Right)
- DockTo(pane.NestedPanesContainer, pane, DockAlignment.Right, 0.5);
- else if (dockStyle == DockStyle.Top)
- DockTo(pane.NestedPanesContainer, pane, DockAlignment.Top, 0.5);
- else if (dockStyle == DockStyle.Bottom)
- DockTo(pane.NestedPanesContainer, pane, DockAlignment.Bottom, 0.5);
-
- DockState = pane.DockState;
- }
- }
-
- public void DockTo(DockPanel panel, DockStyle dockStyle)
- {
- if (panel != DockPanel)
- throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
-
- if (dockStyle == DockStyle.Top)
- DockState = DockState.DockTop;
- else if (dockStyle == DockStyle.Bottom)
- DockState = DockState.DockBottom;
- else if (dockStyle == DockStyle.Left)
- DockState = DockState.DockLeft;
- else if (dockStyle == DockStyle.Right)
- DockState = DockState.DockRight;
- else if (dockStyle == DockStyle.Fill)
- DockState = DockState.Document;
- }
-
- #endregion
- }
-}
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ [ToolboxItem(false)]
+ public partial class DockPane : UserControl, IDockDragSource
+ {
+ public enum AppearanceStyle
+ {
+ ToolWindow,
+ Document
+ }
+
+ private enum HitTestArea
+ {
+ Caption,
+ TabStrip,
+ Content,
+ None
+ }
+
+ private struct HitTestResult
+ {
+ public HitTestArea HitArea;
+ public int Index;
+
+ public HitTestResult(HitTestArea hitTestArea, int index)
+ {
+ HitArea = hitTestArea;
+ Index = index;
+ }
+ }
+
+ private DockPaneCaptionBase m_captionControl;
+ private DockPaneCaptionBase CaptionControl
+ {
+ get { return m_captionControl; }
+ }
+
+ private DockPaneStripBase m_tabStripControl;
+ internal DockPaneStripBase TabStripControl
+ {
+ get { return m_tabStripControl; }
+ }
+
+ internal protected DockPane(IDockContent content, DockState visibleState, bool show)
+ {
+ InternalConstruct(content, visibleState, false, Rectangle.Empty, null, DockAlignment.Right, 0.5, show);
+ }
+
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
+ internal protected DockPane(IDockContent content, FloatWindow floatWindow, bool show)
+ {
+ if (floatWindow == null)
+ throw new ArgumentNullException("floatWindow");
+
+ InternalConstruct(content, DockState.Float, false, Rectangle.Empty, floatWindow.NestedPanes.GetDefaultPreviousPane(this), DockAlignment.Right, 0.5, show);
+ }
+
+ internal protected DockPane(IDockContent content, DockPane previousPane, DockAlignment alignment, double proportion, bool show)
+ {
+ if (previousPane == null)
+ throw(new ArgumentNullException("previousPane"));
+ InternalConstruct(content, previousPane.DockState, false, Rectangle.Empty, previousPane, alignment, proportion, show);
+ }
+
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
+ internal protected DockPane(IDockContent content, Rectangle floatWindowBounds, bool show)
+ {
+ InternalConstruct(content, DockState.Float, true, floatWindowBounds, null, DockAlignment.Right, 0.5, show);
+ }
+
+ private void InternalConstruct(IDockContent content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
+ {
+ if (dockState == DockState.Hidden || dockState == DockState.Unknown)
+ throw new ArgumentException(Strings.DockPane_SetDockState_InvalidState);
+
+ if (content == null)
+ throw new ArgumentNullException(Strings.DockPane_Constructor_NullContent);
+
+ if (content.DockHandler.DockPanel == null)
+ throw new ArgumentException(Strings.DockPane_Constructor_NullDockPanel);
+
+
+ SuspendLayout();
+ SetStyle(ControlStyles.Selectable, false);
+
+ m_isFloat = (dockState == DockState.Float);
+
+ m_contents = new DockContentCollection();
+ m_displayingContents = new DockContentCollection(this);
+ m_dockPanel = content.DockHandler.DockPanel;
+ m_dockPanel.AddPane(this);
+
+ m_splitter = new SplitterControl(this);
+
+ m_nestedDockingStatus = new NestedDockingStatus(this);
+
+ m_captionControl = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this);
+ m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this);
+ Controls.AddRange(new Control[] { m_captionControl, m_tabStripControl });
+
+ DockPanel.SuspendLayout(true);
+ if (flagBounds)
+ FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
+ else if (prevPane != null)
+ DockTo(prevPane.NestedPanesContainer, prevPane, alignment, proportion);
+
+ SetDockState(dockState);
+ if (show)
+ content.DockHandler.Pane = this;
+ else if (this.IsFloat)
+ content.DockHandler.FloatPane = this;
+ else
+ content.DockHandler.PanelPane = this;
+
+ ResumeLayout();
+ DockPanel.ResumeLayout(true, true);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ m_dockState = DockState.Unknown;
+
+ if (NestedPanesContainer != null)
+ NestedPanesContainer.NestedPanes.Remove(this);
+
+ if (DockPanel != null)
+ {
+ DockPanel.RemovePane(this);
+ m_dockPanel = null;
+ }
+
+ Splitter.Dispose();
+ if (m_autoHidePane != null)
+ m_autoHidePane.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private IDockContent m_activeContent = null;
+ public virtual IDockContent ActiveContent
+ {
+ get { return m_activeContent; }
+ set
+ {
+ if (ActiveContent == value)
+ return;
+
+ if (value != null)
+ {
+ if (!DisplayingContents.Contains(value))
+ throw(new InvalidOperationException(Strings.DockPane_ActiveContent_InvalidValue));
+ }
+ else
+ {
+ if (DisplayingContents.Count != 0)
+ throw(new InvalidOperationException(Strings.DockPane_ActiveContent_InvalidValue));
+ }
+
+ IDockContent oldValue = m_activeContent;
+
+ if (DockPanel.ActiveAutoHideContent == oldValue)
+ DockPanel.ActiveAutoHideContent = null;
+
+ m_activeContent = value;
+
+ if (DockPanel.DocumentStyle == DocumentStyle.DockingMdi && DockState == DockState.Document)
+ {
+ if (m_activeContent != null)
+ m_activeContent.DockHandler.Form.BringToFront();
+ }
+ else
+ {
+ if (m_activeContent != null)
+ m_activeContent.DockHandler.SetVisible();
+ if (oldValue != null && DisplayingContents.Contains(oldValue))
+ oldValue.DockHandler.SetVisible();
+ if (IsActivated && m_activeContent != null)
+ m_activeContent.DockHandler.Activate();
+ }
+
+ if (FloatWindow != null)
+ FloatWindow.SetText();
+
+ if (DockPanel.DocumentStyle == DocumentStyle.DockingMdi &&
+ DockState == DockState.Document)
+ RefreshChanges(false); // delayed layout to reduce screen flicker
+ else
+ RefreshChanges();
+
+ if (m_activeContent != null)
+ TabStripControl.EnsureTabVisible(m_activeContent);
+ }
+ }
+
+ private bool m_allowDockDragAndDrop = true;
+ public virtual bool AllowDockDragAndDrop
+ {
+ get { return m_allowDockDragAndDrop; }
+ set { m_allowDockDragAndDrop = value; }
+ }
+
+ private IDisposable m_autoHidePane = null;
+ internal IDisposable AutoHidePane
+ {
+ get { return m_autoHidePane; }
+ set { m_autoHidePane = value; }
+ }
+
+ private object m_autoHideTabs = null;
+ internal object AutoHideTabs
+ {
+ get { return m_autoHideTabs; }
+ set { m_autoHideTabs = value; }
+ }
+
+ private object TabPageContextMenu
+ {
+ get
+ {
+ IDockContent content = ActiveContent;
+
+ if (content == null)
+ return null;
+
+ if (content.DockHandler.TabPageContextMenuStrip != null)
+ return content.DockHandler.TabPageContextMenuStrip;
+ else if (content.DockHandler.TabPageContextMenu != null)
+ return content.DockHandler.TabPageContextMenu;
+ else
+ return null;
+ }
+ }
+
+ internal bool HasTabPageContextMenu
+ {
+ get { return TabPageContextMenu != null; }
+ }
+
+ internal void ShowTabPageContextMenu(Control control, Point position)
+ {
+ object menu = TabPageContextMenu;
+
+ if (menu == null)
+ return;
+
+ ContextMenuStrip contextMenuStrip = menu as ContextMenuStrip;
+ if (contextMenuStrip != null)
+ {
+ contextMenuStrip.Show(control, position);
+ return;
+ }
+
+ ContextMenu contextMenu = menu as ContextMenu;
+ if (contextMenu != null)
+ contextMenu.Show(this, position);
+ }
+
+ private Rectangle CaptionRectangle
+ {
+ get
+ {
+ if (!HasCaption)
+ return Rectangle.Empty;
+
+ Rectangle rectWindow = DisplayingRectangle;
+ int x, y, width;
+ x = rectWindow.X;
+ y = rectWindow.Y;
+ width = rectWindow.Width;
+ int height = CaptionControl.MeasureHeight();
+
+ return new Rectangle(x, y, width, height);
+ }
+ }
+
+ internal Rectangle ContentRectangle
+ {
+ get
+ {
+ Rectangle rectWindow = DisplayingRectangle;
+ Rectangle rectCaption = CaptionRectangle;
+ Rectangle rectTabStrip = TabStripRectangle;
+
+ int x = rectWindow.X;
+
+ int y = rectWindow.Y + (rectCaption.IsEmpty ? 0 : rectCaption.Height);
+ if (DockState == DockState.Document && DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Top)
+ y += rectTabStrip.Height;
+
+ int width = rectWindow.Width;
+ int height = rectWindow.Height - rectCaption.Height - rectTabStrip.Height;
+
+ return new Rectangle(x, y, width, height);
+ }
+ }
+
+ internal Rectangle TabStripRectangle
+ {
+ get
+ {
+ if (Appearance == AppearanceStyle.ToolWindow)
+ return TabStripRectangle_ToolWindow;
+ else
+ return TabStripRectangle_Document;
+ }
+ }
+
+ private Rectangle TabStripRectangle_ToolWindow
+ {
+ get
+ {
+ if (DisplayingContents.Count <= 1 || IsAutoHide)
+ return Rectangle.Empty;
+
+ Rectangle rectWindow = DisplayingRectangle;
+
+ int width = rectWindow.Width;
+ int height = TabStripControl.MeasureHeight();
+ int x = rectWindow.X;
+ int y = rectWindow.Bottom - height;
+ Rectangle rectCaption = CaptionRectangle;
+ if (rectCaption.Contains(x, y))
+ y = rectCaption.Y + rectCaption.Height;
+
+ return new Rectangle(x, y, width, height);
+ }
+ }
+
+ private Rectangle TabStripRectangle_Document
+ {
+ get
+ {
+ if (DisplayingContents.Count == 0)
+ return Rectangle.Empty;
+
+ if (DisplayingContents.Count == 1 && DockPanel.DocumentStyle == DocumentStyle.DockingSdi)
+ return Rectangle.Empty;
+
+ Rectangle rectWindow = DisplayingRectangle;
+ int x = rectWindow.X;
+ int width = rectWindow.Width;
+ int height = TabStripControl.MeasureHeight();
+
+ int y = 0;
+ if (DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
+ y = rectWindow.Height - height;
+ else
+ y = rectWindow.Y;
+
+ return new Rectangle(x, y, width, height);
+ }
+ }
+
+ public virtual string CaptionText
+ {
+ get { return ActiveContent == null ? string.Empty : ActiveContent.DockHandler.TabText; }
+ }
+
+ private DockContentCollection m_contents;
+ public DockContentCollection Contents
+ {
+ get { return m_contents; }
+ }
+
+ private DockContentCollection m_displayingContents;
+ public DockContentCollection DisplayingContents
+ {
+ get { return m_displayingContents; }
+ }
+
+ private DockPanel m_dockPanel;
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ private bool HasCaption
+ {
+ get
+ {
+ if (DockState == DockState.Document ||
+ DockState == DockState.Hidden ||
+ DockState == DockState.Unknown ||
+ (DockState == DockState.Float && FloatWindow.VisibleNestedPanes.Count <= 1))
+ return false;
+ else
+ return true;
+ }
+ }
+
+ private bool m_isActivated = false;
+ public bool IsActivated
+ {
+ get { return m_isActivated; }
+ }
+ internal void SetIsActivated(bool value)
+ {
+ if (m_isActivated == value)
+ return;
+
+ m_isActivated = value;
+ if (DockState != DockState.Document)
+ RefreshChanges(false);
+ OnIsActivatedChanged(EventArgs.Empty);
+ }
+
+ private bool m_isActiveDocumentPane = false;
+ public bool IsActiveDocumentPane
+ {
+ get { return m_isActiveDocumentPane; }
+ }
+ internal void SetIsActiveDocumentPane(bool value)
+ {
+ if (m_isActiveDocumentPane == value)
+ return;
+
+ m_isActiveDocumentPane = value;
+ if (DockState == DockState.Document)
+ RefreshChanges();
+ OnIsActiveDocumentPaneChanged(EventArgs.Empty);
+ }
+
+ public bool IsDockStateValid(DockState dockState)
+ {
+ foreach (IDockContent content in Contents)
+ if (!content.DockHandler.IsDockStateValid(dockState))
+ return false;
+
+ return true;
+ }
+
+ public bool IsAutoHide
+ {
+ get { return DockHelper.IsDockStateAutoHide(DockState); }
+ }
+
+ public AppearanceStyle Appearance
+ {
+ get { return (DockState == DockState.Document) ? AppearanceStyle.Document : AppearanceStyle.ToolWindow; }
+ }
+
+ internal Rectangle DisplayingRectangle
+ {
+ get { return ClientRectangle; }
+ }
+
+ public void Activate()
+ {
+ if (DockHelper.IsDockStateAutoHide(DockState) && DockPanel.ActiveAutoHideContent != ActiveContent)
+ DockPanel.ActiveAutoHideContent = ActiveContent;
+ else if (!IsActivated && ActiveContent != null)
+ ActiveContent.DockHandler.Activate();
+ }
+
+ internal void AddContent(IDockContent content)
+ {
+ if (Contents.Contains(content))
+ return;
+
+ Contents.Add(content);
+ }
+
+ internal void Close()
+ {
+ Dispose();
+ }
+
+ public void CloseActiveContent()
+ {
+ CloseContent(ActiveContent);
+ }
+
+ internal void CloseContent(IDockContent content)
+ {
+ DockPanel dockPanel = DockPanel;
+ dockPanel.SuspendLayout(true);
+
+ if (content == null)
+ return;
+
+ if (!content.DockHandler.CloseButton)
+ return;
+
+ if (content.DockHandler.HideOnClose)
+ content.DockHandler.Hide();
+ else
+ content.DockHandler.Close();
+
+ dockPanel.ResumeLayout(true, true);
+ }
+
+ private HitTestResult GetHitTest(Point ptMouse)
+ {
+ Point ptMouseClient = PointToClient(ptMouse);
+
+ Rectangle rectCaption = CaptionRectangle;
+ if (rectCaption.Contains(ptMouseClient))
+ return new HitTestResult(HitTestArea.Caption, -1);
+
+ Rectangle rectContent = ContentRectangle;
+ if (rectContent.Contains(ptMouseClient))
+ return new HitTestResult(HitTestArea.Content, -1);
+
+ Rectangle rectTabStrip = TabStripRectangle;
+ if (rectTabStrip.Contains(ptMouseClient))
+ return new HitTestResult(HitTestArea.TabStrip, TabStripControl.HitTest(TabStripControl.PointToClient(ptMouse)));
+
+ return new HitTestResult(HitTestArea.None, -1);
+ }
+
+ private bool m_isHidden = true;
+ public bool IsHidden
+ {
+ get { return m_isHidden; }
+ }
+ private void SetIsHidden(bool value)
+ {
+ if (m_isHidden == value)
+ return;
+
+ m_isHidden = value;
+ if (DockHelper.IsDockStateAutoHide(DockState))
+ {
+ DockPanel.RefreshAutoHideStrip();
+ DockPanel.PerformLayout();
+ }
+ else if (NestedPanesContainer != null)
+ ((Control)NestedPanesContainer).PerformLayout();
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ SetIsHidden(DisplayingContents.Count == 0);
+ if (!IsHidden)
+ {
+ CaptionControl.Bounds = CaptionRectangle;
+ TabStripControl.Bounds = TabStripRectangle;
+
+ SetContentBounds();
+
+ foreach (IDockContent content in Contents)
+ {
+ if (DisplayingContents.Contains(content))
+ if (content.DockHandler.FlagClipWindow && content.DockHandler.Form.Visible)
+ content.DockHandler.FlagClipWindow = false;
+ }
+ }
+
+ base.OnLayout(levent);
+ }
+
+ internal void SetContentBounds()
+ {
+ Rectangle rectContent = ContentRectangle;
+ if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi)
+ rectContent = DockPanel.RectangleToMdiClient(RectangleToScreen(rectContent));
+
+ Rectangle rectInactive = new Rectangle(-rectContent.Width, rectContent.Y, rectContent.Width, rectContent.Height);
+ foreach (IDockContent content in Contents)
+ if (content.DockHandler.Pane == this)
+ {
+ if (content == ActiveContent)
+ content.DockHandler.Form.Bounds = rectContent;
+ else
+ content.DockHandler.Form.Bounds = rectInactive;
+ }
+ }
+
+ internal void RefreshChanges()
+ {
+ RefreshChanges(true);
+ }
+
+ private void RefreshChanges(bool performLayout)
+ {
+ if (IsDisposed)
+ return;
+
+ CaptionControl.RefreshChanges();
+ TabStripControl.RefreshChanges();
+ if (DockState == DockState.Float)
+ FloatWindow.RefreshChanges();
+ if (DockHelper.IsDockStateAutoHide(DockState) && DockPanel != null)
+ {
+ DockPanel.RefreshAutoHideStrip();
+ DockPanel.PerformLayout();
+ }
+
+ if (performLayout)
+ PerformLayout();
+ }
+
+ internal void RemoveContent(IDockContent content)
+ {
+ if (!Contents.Contains(content))
+ return;
+
+ Contents.Remove(content);
+ }
+
+ public void SetContentIndex(IDockContent content, int index)
+ {
+ int oldIndex = Contents.IndexOf(content);
+ if (oldIndex == -1)
+ throw(new ArgumentException(Strings.DockPane_SetContentIndex_InvalidContent));
+
+ if (index < 0 || index > Contents.Count - 1)
+ if (index != -1)
+ throw(new ArgumentOutOfRangeException(Strings.DockPane_SetContentIndex_InvalidIndex));
+
+ if (oldIndex == index)
+ return;
+ if (oldIndex == Contents.Count - 1 && index == -1)
+ return;
+
+ Contents.Remove(content);
+ if (index == -1)
+ Contents.Add(content);
+ else if (oldIndex < index)
+ Contents.AddAt(content, index - 1);
+ else
+ Contents.AddAt(content, index);
+
+ RefreshChanges();
+ }
+
+ private void SetParent()
+ {
+ if (DockState == DockState.Unknown || DockState == DockState.Hidden)
+ {
+ SetParent(null);
+ Splitter.Parent = null;
+ }
+ else if (DockState == DockState.Float)
+ {
+ SetParent(FloatWindow);
+ Splitter.Parent = FloatWindow;
+ }
+ else if (DockHelper.IsDockStateAutoHide(DockState))
+ {
+ SetParent(DockPanel.AutoHideControl);
+ Splitter.Parent = null;
+ }
+ else
+ {
+ SetParent(DockPanel.DockWindows[DockState]);
+ Splitter.Parent = Parent;
+ }
+ }
+
+ private void SetParent(Control value)
+ {
+ if (Parent == value)
+ return;
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // Workaround of .Net Framework bug:
+ // Change the parent of a control with focus may result in the first
+ // MDI child form get activated.
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ IDockContent contentFocused = GetFocusedContent();
+ if (contentFocused != null)
+ DockPanel.SaveFocus();
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ Parent = value;
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // Workaround of .Net Framework bug:
+ // Change the parent of a control with focus may result in the first
+ // MDI child form get activated.
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ if (contentFocused != null)
+ contentFocused.DockHandler.Activate();
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ }
+
+ public new void Show()
+ {
+ Activate();
+ }
+
+ internal void TestDrop(IDockDragSource dragSource, DockOutlineBase dockOutline)
+ {
+ if (!dragSource.CanDockTo(this))
+ return;
+
+ Point ptMouse = Control.MousePosition;
+
+ HitTestResult hitTestResult = GetHitTest(ptMouse);
+ if (hitTestResult.HitArea == HitTestArea.Caption)
+ dockOutline.Show(this, -1);
+ else if (hitTestResult.HitArea == HitTestArea.TabStrip && hitTestResult.Index != -1)
+ dockOutline.Show(this, hitTestResult.Index);
+ }
+
+ internal void ValidateActiveContent()
+ {
+ if (ActiveContent == null)
+ {
+ if (DisplayingContents.Count != 0)
+ ActiveContent = DisplayingContents[0];
+ return;
+ }
+
+ if (DisplayingContents.IndexOf(ActiveContent) >= 0)
+ return;
+
+ IDockContent prevVisible = null;
+ for (int i=Contents.IndexOf(ActiveContent)-1; i>=0; i--)
+ if (Contents[i].DockHandler.DockState == DockState)
+ {
+ prevVisible = Contents[i];
+ break;
+ }
+
+ IDockContent nextVisible = null;
+ for (int i=Contents.IndexOf(ActiveContent)+1; i= 0);
+ DockPanel.ResumeLayout(true, true);
+ }
+
+ private bool IsRefreshStateChangeSuspended
+ {
+ get { return m_countRefreshStateChange != 0; }
+ }
+
+ private void ResumeRefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState)
+ {
+ ResumeRefreshStateChange();
+ RefreshStateChange(oldContainer, oldDockState);
+ }
+
+ private void RefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState)
+ {
+ lock (this)
+ {
+ if (IsRefreshStateChangeSuspended)
+ return;
+
+ SuspendRefreshStateChange();
+ }
+
+ DockPanel.SuspendLayout(true);
+
+ IDockContent contentFocused = GetFocusedContent();
+ if (contentFocused != null)
+ DockPanel.SaveFocus();
+ SetParent();
+
+ if (ActiveContent != null)
+ ActiveContent.DockHandler.SetDockState(ActiveContent.DockHandler.IsHidden, DockState, ActiveContent.DockHandler.Pane);
+ foreach (IDockContent content in Contents)
+ {
+ if (content.DockHandler.Pane == this)
+ content.DockHandler.SetDockState(content.DockHandler.IsHidden, DockState, content.DockHandler.Pane);
+ }
+
+ if (oldContainer != null)
+ {
+ Control oldContainerControl = (Control)oldContainer;
+ if (oldContainer.DockState == oldDockState && !oldContainerControl.IsDisposed)
+ oldContainerControl.PerformLayout();
+ }
+ if (DockHelper.IsDockStateAutoHide(oldDockState))
+ DockPanel.RefreshActiveAutoHideContent();
+
+ if (NestedPanesContainer.DockState == DockState)
+ ((Control)NestedPanesContainer).PerformLayout();
+ if (DockHelper.IsDockStateAutoHide(DockState))
+ DockPanel.RefreshActiveAutoHideContent();
+
+ if (DockHelper.IsDockStateAutoHide(oldDockState) ||
+ DockHelper.IsDockStateAutoHide(DockState))
+ {
+ DockPanel.RefreshAutoHideStrip();
+ DockPanel.PerformLayout();
+ }
+
+ ResumeRefreshStateChange();
+
+ if (contentFocused != null)
+ contentFocused.DockHandler.Activate();
+
+ DockPanel.ResumeLayout(true, true);
+
+ if (oldDockState != DockState)
+ OnDockStateChanged(EventArgs.Empty);
+ }
+
+ private IDockContent GetFocusedContent()
+ {
+ IDockContent contentFocused = null;
+ foreach (IDockContent content in Contents)
+ {
+ if (content.DockHandler.Form.ContainsFocus)
+ {
+ contentFocused = content;
+ break;
+ }
+ }
+
+ return contentFocused;
+ }
+
+ public DockPane DockTo(INestedPanesContainer container)
+ {
+ if (container == null)
+ throw new InvalidOperationException(Strings.DockPane_DockTo_NullContainer);
+
+ DockAlignment alignment;
+ if (container.DockState == DockState.DockLeft || container.DockState == DockState.DockRight)
+ alignment = DockAlignment.Bottom;
+ else
+ alignment = DockAlignment.Right;
+
+ return DockTo(container, container.NestedPanes.GetDefaultPreviousPane(this), alignment, 0.5);
+ }
+
+ public DockPane DockTo(INestedPanesContainer container, DockPane previousPane, DockAlignment alignment, double proportion)
+ {
+ if (container == null)
+ throw new InvalidOperationException(Strings.DockPane_DockTo_NullContainer);
+
+ if (container.IsFloat == this.IsFloat)
+ {
+ InternalAddToDockList(container, previousPane, alignment, proportion);
+ return this;
+ }
+
+ IDockContent firstContent = GetFirstContent(container.DockState);
+ if (firstContent == null)
+ return null;
+
+ DockPane pane;
+ DockPanel.DummyContent.DockPanel = DockPanel;
+ if (container.IsFloat)
+ pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, (FloatWindow)container, true);
+ else
+ pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, container.DockState, true);
+
+ pane.DockTo(container, previousPane, alignment, proportion);
+ SetVisibleContentsToPane(pane);
+ DockPanel.DummyContent.DockPanel = null;
+
+ return pane;
+ }
+
+ private void SetVisibleContentsToPane(DockPane pane)
+ {
+ SetVisibleContentsToPane(pane, ActiveContent);
+ }
+
+ private void SetVisibleContentsToPane(DockPane pane, IDockContent activeContent)
+ {
+ for (int i=0; i 0)
+ throw new InvalidOperationException(Strings.DockPane_DockTo_NullPrevPane);
+
+ if (prevPane != null && !container.NestedPanes.Contains(prevPane))
+ throw new InvalidOperationException(Strings.DockPane_DockTo_NoPrevPane);
+
+ if (prevPane == this)
+ throw new InvalidOperationException(Strings.DockPane_DockTo_SelfPrevPane);
+
+ INestedPanesContainer oldContainer = NestedPanesContainer;
+ DockState oldDockState = DockState;
+ container.NestedPanes.Add(this);
+ NestedDockingStatus.SetStatus(container.NestedPanes, prevPane, alignment, proportion);
+
+ if (DockHelper.IsDockWindowState(DockState))
+ m_dockState = container.DockState;
+
+ RefreshStateChange(oldContainer, oldDockState);
+ }
+
+ public void SetNestedDockingProportion(double proportion)
+ {
+ NestedDockingStatus.SetStatus(NestedDockingStatus.NestedPanes, NestedDockingStatus.PreviousPane, NestedDockingStatus.Alignment, proportion);
+ if (NestedPanesContainer != null)
+ ((Control)NestedPanesContainer).PerformLayout();
+ }
+
+ public DockPane Float()
+ {
+ DockPanel.SuspendLayout(true);
+
+ IDockContent activeContent = ActiveContent;
+
+ DockPane floatPane = GetFloatPaneFromContents();
+ if (floatPane == null)
+ {
+ IDockContent firstContent = GetFirstContent(DockState.Float);
+ if (firstContent == null)
+ {
+ DockPanel.ResumeLayout(true, true);
+ return null;
+ }
+ floatPane = DockPanel.DockPaneFactory.CreateDockPane(firstContent,DockState.Float, true);
+ }
+ SetVisibleContentsToPane(floatPane, activeContent);
+
+ DockPanel.ResumeLayout(true, true);
+ return floatPane;
+ }
+
+ private DockPane GetFloatPaneFromContents()
+ {
+ DockPane floatPane = null;
+ for (int i=0; i=0; i--)
+ {
+ IDockContent content = DisplayingContents[i];
+ if (content.DockHandler.CheckDockState(false) != DockState.Unknown)
+ content.DockHandler.IsFloat = false;
+ }
+
+ DockPanel.ResumeLayout(true, true);
+ }
+
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ protected override void WndProc(ref Message m)
+ {
+ if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
+ Activate();
+
+ base.WndProc(ref m);
+ }
+
+ #region IDockDragSource Members
+
+ #region IDragSource Members
+
+ Control IDragSource.DragControl
+ {
+ get { return this; }
+ }
+
+ #endregion
+
+ bool IDockDragSource.IsDockStateValid(DockState dockState)
+ {
+ return IsDockStateValid(dockState);
+ }
+
+ bool IDockDragSource.CanDockTo(DockPane pane)
+ {
+ if (!IsDockStateValid(pane.DockState))
+ return false;
+
+ if (pane == this)
+ return false;
+
+ return true;
+ }
+
+ Rectangle IDockDragSource.BeginDrag(Point ptMouse)
+ {
+ Point location = PointToScreen(new Point(0, 0));
+ Size size;
+
+ DockPane floatPane = ActiveContent.DockHandler.FloatPane;
+ if (DockState == DockState.Float || floatPane == null || floatPane.FloatWindow.NestedPanes.Count != 1)
+ size = DockPanel.DefaultFloatWindowSize;
+ else
+ size = floatPane.FloatWindow.Size;
+
+ if (ptMouse.X > location.X + size.Width)
+ location.X += ptMouse.X - (location.X + size.Width) + Measures.SplitterSize;
+
+ return new Rectangle(location, size);
+ }
+
+ public void FloatAt(Rectangle floatWindowBounds)
+ {
+ if (FloatWindow == null || FloatWindow.NestedPanes.Count != 1)
+ FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
+ else
+ FloatWindow.Bounds = floatWindowBounds;
+
+ DockState = DockState.Float;
+ }
+
+ public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
+ {
+ if (dockStyle == DockStyle.Fill)
+ {
+ IDockContent activeContent = ActiveContent;
+ for (int i = Contents.Count - 1; i >= 0; i--)
+ {
+ IDockContent c = Contents[i];
+ if (c.DockHandler.DockState == DockState)
+ {
+ c.DockHandler.Pane = pane;
+ if (contentIndex != -1)
+ pane.SetContentIndex(c, contentIndex);
+ }
+ }
+ pane.ActiveContent = activeContent;
+ }
+ else
+ {
+ if (dockStyle == DockStyle.Left)
+ DockTo(pane.NestedPanesContainer, pane, DockAlignment.Left, 0.5);
+ else if (dockStyle == DockStyle.Right)
+ DockTo(pane.NestedPanesContainer, pane, DockAlignment.Right, 0.5);
+ else if (dockStyle == DockStyle.Top)
+ DockTo(pane.NestedPanesContainer, pane, DockAlignment.Top, 0.5);
+ else if (dockStyle == DockStyle.Bottom)
+ DockTo(pane.NestedPanesContainer, pane, DockAlignment.Bottom, 0.5);
+
+ DockState = pane.DockState;
+ }
+ }
+
+ public void DockTo(DockPanel panel, DockStyle dockStyle)
+ {
+ if (panel != DockPanel)
+ throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
+
+ if (dockStyle == DockStyle.Top)
+ DockState = DockState.DockTop;
+ else if (dockStyle == DockStyle.Bottom)
+ DockState = DockState.DockBottom;
+ else if (dockStyle == DockStyle.Left)
+ DockState = DockState.DockLeft;
+ else if (dockStyle == DockStyle.Right)
+ DockState = DockState.DockRight;
+ else if (dockStyle == DockStyle.Fill)
+ DockState = DockState.Document;
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/Docking/DockPaneCaptionBase.cs b/source/Docking/DockPaneCaptionBase.cs
similarity index 96%
rename from trunk/Docking/DockPaneCaptionBase.cs
rename to source/Docking/DockPaneCaptionBase.cs
index 5c2c180..73d4c63 100644
--- a/trunk/Docking/DockPaneCaptionBase.cs
+++ b/source/Docking/DockPaneCaptionBase.cs
@@ -1,100 +1,100 @@
-using System;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Runtime.InteropServices;
-using System.Security.Permissions;
-
-namespace LSLEditor.Docking
-{
- public abstract class DockPaneCaptionBase : Control
- {
- protected internal DockPaneCaptionBase(DockPane pane)
- {
- m_dockPane = pane;
-
- SetStyle(ControlStyles.OptimizedDoubleBuffer |
- ControlStyles.ResizeRedraw |
- ControlStyles.UserPaint |
- ControlStyles.AllPaintingInWmPaint, true);
- SetStyle(ControlStyles.Selectable, false);
- }
-
- private DockPane m_dockPane;
- protected DockPane DockPane
- {
- get { return m_dockPane; }
- }
-
- protected DockPane.AppearanceStyle Appearance
- {
- get { return DockPane.Appearance; }
- }
-
- protected bool HasTabPageContextMenu
- {
- get { return DockPane.HasTabPageContextMenu; }
- }
-
- protected void ShowTabPageContextMenu(Point position)
- {
- DockPane.ShowTabPageContextMenu(this, position);
- }
-
- protected override void OnMouseUp(MouseEventArgs e)
- {
- base.OnMouseUp(e);
-
- if (e.Button == MouseButtons.Right)
- ShowTabPageContextMenu(new Point(e.X, e.Y));
- }
-
- protected override void OnMouseDown(MouseEventArgs e)
- {
- base.OnMouseDown(e);
-
- if (e.Button == MouseButtons.Left &&
- DockPane.DockPanel.AllowEndUserDocking &&
- DockPane.AllowDockDragAndDrop &&
- !DockHelper.IsDockStateAutoHide(DockPane.DockState) &&
- DockPane.ActiveContent != null)
- DockPane.DockPanel.BeginDrag(DockPane);
- }
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
- {
- if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
- {
- DockPane.DockPanel.ActiveAutoHideContent = null;
- return;
- }
-
- if (DockPane.IsFloat)
- DockPane.RestoreToPanel();
- else
- DockPane.Float();
- }
- base.WndProc(ref m);
- }
-
- internal void RefreshChanges()
- {
- if (IsDisposed)
- return;
-
- OnRefreshChanges();
- }
-
- protected virtual void OnRightToLeftLayoutChanged()
- {
- }
-
- protected virtual void OnRefreshChanges()
- {
- }
-
- protected internal abstract int MeasureHeight();
- }
-}
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace LSLEditor.Docking
+{
+ public abstract class DockPaneCaptionBase : Control
+ {
+ protected internal DockPaneCaptionBase(DockPane pane)
+ {
+ m_dockPane = pane;
+
+ SetStyle(ControlStyles.OptimizedDoubleBuffer |
+ ControlStyles.ResizeRedraw |
+ ControlStyles.UserPaint |
+ ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle(ControlStyles.Selectable, false);
+ }
+
+ private DockPane m_dockPane;
+ protected DockPane DockPane
+ {
+ get { return m_dockPane; }
+ }
+
+ protected DockPane.AppearanceStyle Appearance
+ {
+ get { return DockPane.Appearance; }
+ }
+
+ protected bool HasTabPageContextMenu
+ {
+ get { return DockPane.HasTabPageContextMenu; }
+ }
+
+ protected void ShowTabPageContextMenu(Point position)
+ {
+ DockPane.ShowTabPageContextMenu(this, position);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp(e);
+
+ if (e.Button == MouseButtons.Right)
+ ShowTabPageContextMenu(new Point(e.X, e.Y));
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ base.OnMouseDown(e);
+
+ if (e.Button == MouseButtons.Left &&
+ DockPane.DockPanel.AllowEndUserDocking &&
+ DockPane.AllowDockDragAndDrop &&
+ !DockHelper.IsDockStateAutoHide(DockPane.DockState) &&
+ DockPane.ActiveContent != null)
+ DockPane.DockPanel.BeginDrag(DockPane);
+ }
+
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ protected override void WndProc(ref Message m)
+ {
+ if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
+ {
+ if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
+ {
+ DockPane.DockPanel.ActiveAutoHideContent = null;
+ return;
+ }
+
+ if (DockPane.IsFloat)
+ DockPane.RestoreToPanel();
+ else
+ DockPane.Float();
+ }
+ base.WndProc(ref m);
+ }
+
+ internal void RefreshChanges()
+ {
+ if (IsDisposed)
+ return;
+
+ OnRefreshChanges();
+ }
+
+ protected virtual void OnRightToLeftLayoutChanged()
+ {
+ }
+
+ protected virtual void OnRefreshChanges()
+ {
+ }
+
+ protected internal abstract int MeasureHeight();
+ }
+}
diff --git a/trunk/Docking/DockPaneCollection.cs b/source/Docking/DockPaneCollection.cs
similarity index 94%
rename from trunk/Docking/DockPaneCollection.cs
rename to source/Docking/DockPaneCollection.cs
index 7896aec..84db71b 100644
--- a/trunk/Docking/DockPaneCollection.cs
+++ b/source/Docking/DockPaneCollection.cs
@@ -1,47 +1,47 @@
-using System;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- public class DockPaneCollection : ReadOnlyCollection
- {
- internal DockPaneCollection()
- : base(new List())
- {
- }
-
- internal int Add(DockPane pane)
- {
- if (Items.Contains(pane))
- return Items.IndexOf(pane);
-
- Items.Add(pane);
- return Count - 1;
- }
-
- internal void AddAt(DockPane pane, int index)
- {
- if (index < 0 || index > Items.Count - 1)
- return;
-
- if (Contains(pane))
- return;
-
- Items.Insert(index, pane);
- }
-
- internal void Dispose()
- {
- for (int i=Count - 1; i>=0; i--)
- this[i].Close();
- }
-
- internal void Remove(DockPane pane)
- {
- Items.Remove(pane);
- }
- }
-}
+using System;
+using System.Collections.ObjectModel;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ public class DockPaneCollection : ReadOnlyCollection
+ {
+ internal DockPaneCollection()
+ : base(new List())
+ {
+ }
+
+ internal int Add(DockPane pane)
+ {
+ if (Items.Contains(pane))
+ return Items.IndexOf(pane);
+
+ Items.Add(pane);
+ return Count - 1;
+ }
+
+ internal void AddAt(DockPane pane, int index)
+ {
+ if (index < 0 || index > Items.Count - 1)
+ return;
+
+ if (Contains(pane))
+ return;
+
+ Items.Insert(index, pane);
+ }
+
+ internal void Dispose()
+ {
+ for (int i=Count - 1; i>=0; i--)
+ this[i].Close();
+ }
+
+ internal void Remove(DockPane pane)
+ {
+ Items.Remove(pane);
+ }
+ }
+}
diff --git a/trunk/Docking/DockPaneStripBase.cs b/source/Docking/DockPaneStripBase.cs
similarity index 96%
rename from trunk/Docking/DockPaneStripBase.cs
rename to source/Docking/DockPaneStripBase.cs
index 10b6368..db0524f 100644
--- a/trunk/Docking/DockPaneStripBase.cs
+++ b/source/Docking/DockPaneStripBase.cs
@@ -1,252 +1,252 @@
-using System;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Collections;
-using System.Collections.Generic;
-using System.Security.Permissions;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- public abstract class DockPaneStripBase : Control
- {
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- protected internal class Tab : IDisposable
- {
- private IDockContent m_content;
-
- public Tab(IDockContent content)
- {
- m_content = content;
- }
-
- ~Tab()
- {
- Dispose(false);
- }
-
- public IDockContent Content
- {
- get { return m_content; }
- }
-
- public Form ContentForm
- {
- get { return m_content as Form; }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- }
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- protected sealed class TabCollection : IEnumerable
- {
- #region IEnumerable Members
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (int i = 0; i < Count; i++)
- yield return this[i];
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (int i = 0; i < Count; i++)
- yield return this[i];
- }
- #endregion
-
- internal TabCollection(DockPane pane)
- {
- m_dockPane = pane;
- }
-
- private DockPane m_dockPane;
- public DockPane DockPane
- {
- get { return m_dockPane; }
- }
-
- public int Count
- {
- get { return DockPane.DisplayingContents.Count; }
- }
-
- public Tab this[int index]
- {
- get
- {
- IDockContent content = DockPane.DisplayingContents[index];
- if (content == null)
- throw (new ArgumentOutOfRangeException("index"));
- return content.DockHandler.GetTab(DockPane.TabStripControl);
- }
- }
-
- public bool Contains(Tab tab)
- {
- return (IndexOf(tab) != -1);
- }
-
- public bool Contains(IDockContent content)
- {
- return (IndexOf(content) != -1);
- }
-
- public int IndexOf(Tab tab)
- {
- if (tab == null)
- return -1;
-
- return DockPane.DisplayingContents.IndexOf(tab.Content);
- }
-
- public int IndexOf(IDockContent content)
- {
- return DockPane.DisplayingContents.IndexOf(content);
- }
- }
-
- protected DockPaneStripBase(DockPane pane)
- {
- m_dockPane = pane;
-
- SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- SetStyle(ControlStyles.Selectable, false);
- AllowDrop = true;
- }
-
- private DockPane m_dockPane;
- protected DockPane DockPane
- {
- get { return m_dockPane; }
- }
-
- protected DockPane.AppearanceStyle Appearance
- {
- get { return DockPane.Appearance; }
- }
-
- private TabCollection m_tabs = null;
- protected TabCollection Tabs
- {
- get
- {
- if (m_tabs == null)
- m_tabs = new TabCollection(DockPane);
-
- return m_tabs;
- }
- }
-
- internal void RefreshChanges()
- {
- if (IsDisposed)
- return;
-
- OnRefreshChanges();
- }
-
- protected virtual void OnRefreshChanges()
- {
- }
-
- protected internal abstract int MeasureHeight();
-
- protected internal abstract void EnsureTabVisible(IDockContent content);
-
- protected int HitTest()
- {
- return HitTest(PointToClient(Control.MousePosition));
- }
-
- protected internal abstract int HitTest(Point point);
-
- protected internal abstract GraphicsPath GetOutline(int index);
-
- protected internal virtual Tab CreateTab(IDockContent content)
- {
- return new Tab(content);
- }
-
- protected override void OnMouseDown(MouseEventArgs e)
- {
- base.OnMouseDown(e);
-
- int index = HitTest();
- if (index != -1)
- {
- IDockContent content = Tabs[index].Content;
- if (DockPane.ActiveContent != content)
- DockPane.ActiveContent = content;
- }
-
- if (e.Button == MouseButtons.Left)
- {
- if (DockPane.DockPanel.AllowEndUserDocking && DockPane.AllowDockDragAndDrop && DockPane.ActiveContent.DockHandler.AllowEndUserDocking)
- DockPane.DockPanel.BeginDrag(DockPane.ActiveContent.DockHandler);
- }
- }
-
- protected bool HasTabPageContextMenu
- {
- get { return DockPane.HasTabPageContextMenu; }
- }
-
- protected void ShowTabPageContextMenu(Point position)
- {
- DockPane.ShowTabPageContextMenu(this, position);
- }
-
- protected override void OnMouseUp(MouseEventArgs e)
- {
- base.OnMouseUp(e);
-
- if (e.Button == MouseButtons.Right)
- ShowTabPageContextMenu(new Point(e.X, e.Y));
- }
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
- {
- base.WndProc(ref m);
-
- int index = HitTest();
- if (DockPane.DockPanel.AllowEndUserDocking && index != -1)
- {
- IDockContent content = Tabs[index].Content;
- if (content.DockHandler.CheckDockState(!content.DockHandler.IsFloat) != DockState.Unknown)
- content.DockHandler.IsFloat = !content.DockHandler.IsFloat;
- }
-
- return;
- }
-
- base.WndProc(ref m);
- return;
- }
-
- protected override void OnDragOver(DragEventArgs drgevent)
- {
- base.OnDragOver(drgevent);
-
- int index = HitTest();
- if (index != -1)
- {
- IDockContent content = Tabs[index].Content;
- if (DockPane.ActiveContent != content)
- DockPane.ActiveContent = content;
- }
- }
- }
-}
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Collections;
+using System.Collections.Generic;
+using System.Security.Permissions;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ public abstract class DockPaneStripBase : Control
+ {
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ protected internal class Tab : IDisposable
+ {
+ private IDockContent m_content;
+
+ public Tab(IDockContent content)
+ {
+ m_content = content;
+ }
+
+ ~Tab()
+ {
+ Dispose(false);
+ }
+
+ public IDockContent Content
+ {
+ get { return m_content; }
+ }
+
+ public Form ContentForm
+ {
+ get { return m_content as Form; }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ }
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ protected sealed class TabCollection : IEnumerable
+ {
+ #region IEnumerable Members
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (int i = 0; i < Count; i++)
+ yield return this[i];
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (int i = 0; i < Count; i++)
+ yield return this[i];
+ }
+ #endregion
+
+ internal TabCollection(DockPane pane)
+ {
+ m_dockPane = pane;
+ }
+
+ private DockPane m_dockPane;
+ public DockPane DockPane
+ {
+ get { return m_dockPane; }
+ }
+
+ public int Count
+ {
+ get { return DockPane.DisplayingContents.Count; }
+ }
+
+ public Tab this[int index]
+ {
+ get
+ {
+ IDockContent content = DockPane.DisplayingContents[index];
+ if (content == null)
+ throw (new ArgumentOutOfRangeException("index"));
+ return content.DockHandler.GetTab(DockPane.TabStripControl);
+ }
+ }
+
+ public bool Contains(Tab tab)
+ {
+ return (IndexOf(tab) != -1);
+ }
+
+ public bool Contains(IDockContent content)
+ {
+ return (IndexOf(content) != -1);
+ }
+
+ public int IndexOf(Tab tab)
+ {
+ if (tab == null)
+ return -1;
+
+ return DockPane.DisplayingContents.IndexOf(tab.Content);
+ }
+
+ public int IndexOf(IDockContent content)
+ {
+ return DockPane.DisplayingContents.IndexOf(content);
+ }
+ }
+
+ protected DockPaneStripBase(DockPane pane)
+ {
+ m_dockPane = pane;
+
+ SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
+ SetStyle(ControlStyles.Selectable, false);
+ AllowDrop = true;
+ }
+
+ private DockPane m_dockPane;
+ protected DockPane DockPane
+ {
+ get { return m_dockPane; }
+ }
+
+ protected DockPane.AppearanceStyle Appearance
+ {
+ get { return DockPane.Appearance; }
+ }
+
+ private TabCollection m_tabs = null;
+ protected TabCollection Tabs
+ {
+ get
+ {
+ if (m_tabs == null)
+ m_tabs = new TabCollection(DockPane);
+
+ return m_tabs;
+ }
+ }
+
+ internal void RefreshChanges()
+ {
+ if (IsDisposed)
+ return;
+
+ OnRefreshChanges();
+ }
+
+ protected virtual void OnRefreshChanges()
+ {
+ }
+
+ protected internal abstract int MeasureHeight();
+
+ protected internal abstract void EnsureTabVisible(IDockContent content);
+
+ protected int HitTest()
+ {
+ return HitTest(PointToClient(Control.MousePosition));
+ }
+
+ protected internal abstract int HitTest(Point point);
+
+ protected internal abstract GraphicsPath GetOutline(int index);
+
+ protected internal virtual Tab CreateTab(IDockContent content)
+ {
+ return new Tab(content);
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ base.OnMouseDown(e);
+
+ int index = HitTest();
+ if (index != -1)
+ {
+ IDockContent content = Tabs[index].Content;
+ if (DockPane.ActiveContent != content)
+ DockPane.ActiveContent = content;
+ }
+
+ if (e.Button == MouseButtons.Left)
+ {
+ if (DockPane.DockPanel.AllowEndUserDocking && DockPane.AllowDockDragAndDrop && DockPane.ActiveContent.DockHandler.AllowEndUserDocking)
+ DockPane.DockPanel.BeginDrag(DockPane.ActiveContent.DockHandler);
+ }
+ }
+
+ protected bool HasTabPageContextMenu
+ {
+ get { return DockPane.HasTabPageContextMenu; }
+ }
+
+ protected void ShowTabPageContextMenu(Point position)
+ {
+ DockPane.ShowTabPageContextMenu(this, position);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp(e);
+
+ if (e.Button == MouseButtons.Right)
+ ShowTabPageContextMenu(new Point(e.X, e.Y));
+ }
+
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ protected override void WndProc(ref Message m)
+ {
+ if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
+ {
+ base.WndProc(ref m);
+
+ int index = HitTest();
+ if (DockPane.DockPanel.AllowEndUserDocking && index != -1)
+ {
+ IDockContent content = Tabs[index].Content;
+ if (content.DockHandler.CheckDockState(!content.DockHandler.IsFloat) != DockState.Unknown)
+ content.DockHandler.IsFloat = !content.DockHandler.IsFloat;
+ }
+
+ return;
+ }
+
+ base.WndProc(ref m);
+ return;
+ }
+
+ protected override void OnDragOver(DragEventArgs drgevent)
+ {
+ base.OnDragOver(drgevent);
+
+ int index = HitTest();
+ if (index != -1)
+ {
+ IDockContent content = Tabs[index].Content;
+ if (DockPane.ActiveContent != content)
+ DockPane.ActiveContent = content;
+ }
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanel.AutoHideWindow.cs b/source/Docking/DockPanel.AutoHideWindow.cs
similarity index 97%
rename from trunk/Docking/DockPanel.AutoHideWindow.cs
rename to source/Docking/DockPanel.AutoHideWindow.cs
index 062768a..99b950e 100644
--- a/trunk/Docking/DockPanel.AutoHideWindow.cs
+++ b/source/Docking/DockPanel.AutoHideWindow.cs
@@ -1,612 +1,612 @@
-using System;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Runtime.InteropServices;
-
-namespace LSLEditor.Docking
-{
- partial class DockPanel
- {
- private class AutoHideWindowControl : Panel, ISplitterDragSource
- {
- private class SplitterControl : SplitterBase
- {
- public SplitterControl(AutoHideWindowControl autoHideWindow)
- {
- m_autoHideWindow = autoHideWindow;
- }
-
- private AutoHideWindowControl m_autoHideWindow;
- private AutoHideWindowControl AutoHideWindow
- {
- get { return m_autoHideWindow; }
- }
-
- protected override int SplitterSize
- {
- get { return Measures.SplitterSize; }
- }
-
- protected override void StartDrag()
- {
- AutoHideWindow.DockPanel.BeginDrag(AutoHideWindow, AutoHideWindow.RectangleToScreen(Bounds));
- }
- }
-
- #region consts
- private const int ANIMATE_TIME = 100; // in mini-seconds
- #endregion
-
- private Timer m_timerMouseTrack;
- private SplitterControl m_splitter;
-
- public AutoHideWindowControl(DockPanel dockPanel)
- {
- m_dockPanel = dockPanel;
-
- m_timerMouseTrack = new Timer();
- m_timerMouseTrack.Tick += new EventHandler(TimerMouseTrack_Tick);
-
- Visible = false;
- m_splitter = new SplitterControl(this);
- Controls.Add(m_splitter);
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- m_timerMouseTrack.Dispose();
- }
- base.Dispose(disposing);
- }
-
- private DockPanel m_dockPanel = null;
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- private DockPane m_activePane = null;
- public DockPane ActivePane
- {
- get { return m_activePane; }
- }
- private void SetActivePane()
- {
- DockPane value = (ActiveContent == null ? null : ActiveContent.DockHandler.Pane);
-
- if (value == m_activePane)
- return;
-
- m_activePane = value;
- }
-
- private IDockContent m_activeContent = null;
- public IDockContent ActiveContent
- {
- get { return m_activeContent; }
- set
- {
- if (value == m_activeContent)
- return;
-
- if (value != null)
- {
- if (!DockHelper.IsDockStateAutoHide(value.DockHandler.DockState) || value.DockHandler.DockPanel != DockPanel)
- throw (new InvalidOperationException(Strings.DockPanel_ActiveAutoHideContent_InvalidValue));
- }
-
- DockPanel.SuspendLayout();
-
- if (m_activeContent != null)
- {
- if (m_activeContent.DockHandler.Form.ContainsFocus)
- DockPanel.ContentFocusManager.GiveUpFocus(m_activeContent);
- AnimateWindow(false);
- }
-
- m_activeContent = value;
- SetActivePane();
- if (ActivePane != null)
- ActivePane.ActiveContent = m_activeContent;
-
- if (m_activeContent != null)
- AnimateWindow(true);
-
- DockPanel.ResumeLayout();
- DockPanel.RefreshAutoHideStrip();
-
- SetTimerMouseTrack();
- }
- }
-
- public DockState DockState
- {
- get { return ActiveContent == null ? DockState.Unknown : ActiveContent.DockHandler.DockState; }
- }
-
- private bool m_flagAnimate = true;
- private bool FlagAnimate
- {
- get { return m_flagAnimate; }
- set { m_flagAnimate = value; }
- }
-
- private bool m_flagDragging = false;
- internal bool FlagDragging
- {
- get { return m_flagDragging; }
- set
- {
- if (m_flagDragging == value)
- return;
-
- m_flagDragging = value;
- SetTimerMouseTrack();
- }
- }
-
- private void AnimateWindow(bool show)
- {
- if (!FlagAnimate && Visible != show)
- {
- Visible = show;
- return;
- }
-
- Parent.SuspendLayout();
-
- Rectangle rectSource = GetRectangle(!show);
- Rectangle rectTarget = GetRectangle(show);
- int dxLoc, dyLoc;
- int dWidth, dHeight;
- dxLoc = dyLoc = dWidth = dHeight = 0;
- if (DockState == DockState.DockTopAutoHide)
- dHeight = show ? 1 : -1;
- else if (DockState == DockState.DockLeftAutoHide)
- dWidth = show ? 1 : -1;
- else if (DockState == DockState.DockRightAutoHide)
- {
- dxLoc = show ? -1 : 1;
- dWidth = show ? 1 : -1;
- }
- else if (DockState == DockState.DockBottomAutoHide)
- {
- dyLoc = (show ? -1 : 1);
- dHeight = (show ? 1 : -1);
- }
-
- if (show)
- {
- Bounds = DockPanel.GetAutoHideWindowBounds(new Rectangle(-rectTarget.Width, -rectTarget.Height, rectTarget.Width, rectTarget.Height));
- if (Visible == false)
- Visible = true;
- PerformLayout();
- }
-
- SuspendLayout();
-
- LayoutAnimateWindow(rectSource);
- if (Visible == false)
- Visible = true;
-
- int speedFactor = 1;
- int totalPixels = (rectSource.Width != rectTarget.Width) ?
- Math.Abs(rectSource.Width - rectTarget.Width) :
- Math.Abs(rectSource.Height - rectTarget.Height);
- int remainPixels = totalPixels;
- DateTime startingTime = DateTime.Now;
- while (rectSource != rectTarget)
- {
- DateTime startPerMove = DateTime.Now;
-
- rectSource.X += dxLoc * speedFactor;
- rectSource.Y += dyLoc * speedFactor;
- rectSource.Width += dWidth * speedFactor;
- rectSource.Height += dHeight * speedFactor;
- if (Math.Sign(rectTarget.X - rectSource.X) != Math.Sign(dxLoc))
- rectSource.X = rectTarget.X;
- if (Math.Sign(rectTarget.Y - rectSource.Y) != Math.Sign(dyLoc))
- rectSource.Y = rectTarget.Y;
- if (Math.Sign(rectTarget.Width - rectSource.Width) != Math.Sign(dWidth))
- rectSource.Width = rectTarget.Width;
- if (Math.Sign(rectTarget.Height - rectSource.Height) != Math.Sign(dHeight))
- rectSource.Height = rectTarget.Height;
-
- LayoutAnimateWindow(rectSource);
- if (Parent != null)
- Parent.Update();
-
- remainPixels -= speedFactor;
-
- while (true)
- {
- TimeSpan time = new TimeSpan(0, 0, 0, 0, ANIMATE_TIME);
- TimeSpan elapsedPerMove = DateTime.Now - startPerMove;
- TimeSpan elapsedTime = DateTime.Now - startingTime;
- if (((int)((time - elapsedTime).TotalMilliseconds)) <= 0)
- {
- speedFactor = remainPixels;
- break;
- }
- else
- speedFactor = remainPixels * (int)elapsedPerMove.TotalMilliseconds / (int)((time - elapsedTime).TotalMilliseconds);
- if (speedFactor >= 1)
- break;
- }
- }
- ResumeLayout();
- Parent.ResumeLayout();
- }
-
- private void LayoutAnimateWindow(Rectangle rect)
- {
- Bounds = DockPanel.GetAutoHideWindowBounds(rect);
-
- Rectangle rectClient = ClientRectangle;
-
- if (DockState == DockState.DockLeftAutoHide)
- ActivePane.Location = new Point(rectClient.Right - 2 - Measures.SplitterSize - ActivePane.Width, ActivePane.Location.Y);
- else if (DockState == DockState.DockTopAutoHide)
- ActivePane.Location = new Point(ActivePane.Location.X, rectClient.Bottom - 2 - Measures.SplitterSize - ActivePane.Height);
- }
-
- private Rectangle GetRectangle(bool show)
- {
- if (DockState == DockState.Unknown)
- return Rectangle.Empty;
-
- Rectangle rect = DockPanel.AutoHideWindowRectangle;
-
- if (show)
- return rect;
-
- if (DockState == DockState.DockLeftAutoHide)
- rect.Width = 0;
- else if (DockState == DockState.DockRightAutoHide)
- {
- rect.X += rect.Width;
- rect.Width = 0;
- }
- else if (DockState == DockState.DockTopAutoHide)
- rect.Height = 0;
- else
- {
- rect.Y += rect.Height;
- rect.Height = 0;
- }
-
- return rect;
- }
-
- private void SetTimerMouseTrack()
- {
- if (ActivePane == null || ActivePane.IsActivated || FlagDragging)
- {
- m_timerMouseTrack.Enabled = false;
- return;
- }
-
- // start the timer
- int hovertime = SystemInformation.MouseHoverTime ;
-
- // assign a default value 400 in case of setting Timer.Interval invalid value exception
- if (hovertime <= 0)
- hovertime = 400;
-
- m_timerMouseTrack.Interval = 2 * (int)hovertime;
- m_timerMouseTrack.Enabled = true;
- }
-
- protected virtual Rectangle DisplayingRectangle
- {
- get
- {
- Rectangle rect = ClientRectangle;
-
- // exclude the border and the splitter
- if (DockState == DockState.DockBottomAutoHide)
- {
- rect.Y += 2 + Measures.SplitterSize;
- rect.Height -= 2 + Measures.SplitterSize;
- }
- else if (DockState == DockState.DockRightAutoHide)
- {
- rect.X += 2 + Measures.SplitterSize;
- rect.Width -= 2 + Measures.SplitterSize;
- }
- else if (DockState == DockState.DockTopAutoHide)
- rect.Height -= 2 + Measures.SplitterSize;
- else if (DockState == DockState.DockLeftAutoHide)
- rect.Width -= 2 + Measures.SplitterSize;
-
- return rect;
- }
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- DockPadding.All = 0;
- if (DockState == DockState.DockLeftAutoHide)
- {
- DockPadding.Right = 2;
- m_splitter.Dock = DockStyle.Right;
- }
- else if (DockState == DockState.DockRightAutoHide)
- {
- DockPadding.Left = 2;
- m_splitter.Dock = DockStyle.Left;
- }
- else if (DockState == DockState.DockTopAutoHide)
- {
- DockPadding.Bottom = 2;
- m_splitter.Dock = DockStyle.Bottom;
- }
- else if (DockState == DockState.DockBottomAutoHide)
- {
- DockPadding.Top = 2;
- m_splitter.Dock = DockStyle.Top;
- }
-
- Rectangle rectDisplaying = DisplayingRectangle;
- Rectangle rectHidden = new Rectangle(-rectDisplaying.Width, rectDisplaying.Y, rectDisplaying.Width, rectDisplaying.Height);
- foreach (Control c in Controls)
- {
- DockPane pane = c as DockPane;
- if (pane == null)
- continue;
-
-
- if (pane == ActivePane)
- pane.Bounds = rectDisplaying;
- else
- pane.Bounds = rectHidden;
- }
-
- base.OnLayout(levent);
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- // Draw the border
- Graphics g = e.Graphics;
-
- if (DockState == DockState.DockBottomAutoHide)
- g.DrawLine(SystemPens.ControlLightLight, 0, 1, ClientRectangle.Right, 1);
- else if (DockState == DockState.DockRightAutoHide)
- g.DrawLine(SystemPens.ControlLightLight, 1, 0, 1, ClientRectangle.Bottom);
- else if (DockState == DockState.DockTopAutoHide)
- {
- g.DrawLine(SystemPens.ControlDark, 0, ClientRectangle.Height - 2, ClientRectangle.Right, ClientRectangle.Height - 2);
- g.DrawLine(SystemPens.ControlDarkDark, 0, ClientRectangle.Height - 1, ClientRectangle.Right, ClientRectangle.Height - 1);
- }
- else if (DockState == DockState.DockLeftAutoHide)
- {
- g.DrawLine(SystemPens.ControlDark, ClientRectangle.Width - 2, 0, ClientRectangle.Width - 2, ClientRectangle.Bottom);
- g.DrawLine(SystemPens.ControlDarkDark, ClientRectangle.Width - 1, 0, ClientRectangle.Width - 1, ClientRectangle.Bottom);
- }
-
- base.OnPaint(e);
- }
-
- public void RefreshActiveContent()
- {
- if (ActiveContent == null)
- return;
-
- if (!DockHelper.IsDockStateAutoHide(ActiveContent.DockHandler.DockState))
- {
- FlagAnimate = false;
- ActiveContent = null;
- FlagAnimate = true;
- }
- }
-
- public void RefreshActivePane()
- {
- SetTimerMouseTrack();
- }
-
- private void TimerMouseTrack_Tick(object sender, EventArgs e)
- {
- if (IsDisposed)
- return;
-
- if (ActivePane == null || ActivePane.IsActivated)
- {
- m_timerMouseTrack.Enabled = false;
- return;
- }
-
- DockPane pane = ActivePane;
- Point ptMouseInAutoHideWindow = PointToClient(Control.MousePosition);
- Point ptMouseInDockPanel = DockPanel.PointToClient(Control.MousePosition);
-
- Rectangle rectTabStrip = DockPanel.GetTabStripRectangle(pane.DockState);
-
- if (!ClientRectangle.Contains(ptMouseInAutoHideWindow) && !rectTabStrip.Contains(ptMouseInDockPanel))
- {
- ActiveContent = null;
- m_timerMouseTrack.Enabled = false;
- }
- }
-
- #region ISplitterDragSource Members
-
- void ISplitterDragSource.BeginDrag(Rectangle rectSplitter)
- {
- FlagDragging = true;
- }
-
- void ISplitterDragSource.EndDrag()
- {
- FlagDragging = false;
- }
-
- bool ISplitterDragSource.IsVertical
- {
- get { return (DockState == DockState.DockLeftAutoHide || DockState == DockState.DockRightAutoHide); }
- }
-
- Rectangle ISplitterDragSource.DragLimitBounds
- {
- get
- {
- Rectangle rectLimit = DockPanel.DockArea;
-
- if ((this as ISplitterDragSource).IsVertical)
- {
- rectLimit.X += MeasurePane.MinSize;
- rectLimit.Width -= 2 * MeasurePane.MinSize;
- }
- else
- {
- rectLimit.Y += MeasurePane.MinSize;
- rectLimit.Height -= 2 * MeasurePane.MinSize;
- }
-
- return DockPanel.RectangleToScreen(rectLimit);
- }
- }
-
- void ISplitterDragSource.MoveSplitter(int offset)
- {
- Rectangle rectDockArea = DockPanel.DockArea;
- IDockContent content = ActiveContent;
- if (DockState == DockState.DockLeftAutoHide && rectDockArea.Width > 0)
- {
- if (content.DockHandler.AutoHidePortion < 1)
- content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Width;
- else
- content.DockHandler.AutoHidePortion = Width + offset;
- }
- else if (DockState == DockState.DockRightAutoHide && rectDockArea.Width > 0)
- {
- if (content.DockHandler.AutoHidePortion < 1)
- content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Width;
- else
- content.DockHandler.AutoHidePortion = Width - offset;
- }
- else if (DockState == DockState.DockBottomAutoHide && rectDockArea.Height > 0)
- {
- if (content.DockHandler.AutoHidePortion < 1)
- content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Height;
- else
- content.DockHandler.AutoHidePortion = Height - offset;
- }
- else if (DockState == DockState.DockTopAutoHide && rectDockArea.Height > 0)
- {
- if (content.DockHandler.AutoHidePortion < 1)
- content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Height;
- else
- content.DockHandler.AutoHidePortion = Height + offset;
- }
- }
-
- #region IDragSource Members
-
- Control IDragSource.DragControl
- {
- get { return this; }
- }
-
- #endregion
-
- #endregion
- }
-
- private AutoHideWindowControl AutoHideWindow
- {
- get { return m_autoHideWindow; }
- }
-
- internal Control AutoHideControl
- {
- get { return m_autoHideWindow; }
- }
-
- internal void RefreshActiveAutoHideContent()
- {
- AutoHideWindow.RefreshActiveContent();
- }
-
- internal Rectangle AutoHideWindowRectangle
- {
- get
- {
- DockState state = AutoHideWindow.DockState;
- Rectangle rectDockArea = DockArea;
- if (ActiveAutoHideContent == null)
- return Rectangle.Empty;
-
- if (Parent == null)
- return Rectangle.Empty;
-
- Rectangle rect = Rectangle.Empty;
- double autoHideSize = ActiveAutoHideContent.DockHandler.AutoHidePortion;
- if (state == DockState.DockLeftAutoHide)
- {
- if (autoHideSize < 1)
- autoHideSize = rectDockArea.Width * autoHideSize;
- if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize)
- autoHideSize = rectDockArea.Width - MeasurePane.MinSize;
- rect.X = rectDockArea.X;
- rect.Y = rectDockArea.Y;
- rect.Width = (int)autoHideSize;
- rect.Height = rectDockArea.Height;
- }
- else if (state == DockState.DockRightAutoHide)
- {
- if (autoHideSize < 1)
- autoHideSize = rectDockArea.Width * autoHideSize;
- if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize)
- autoHideSize = rectDockArea.Width - MeasurePane.MinSize;
- rect.X = rectDockArea.X + rectDockArea.Width - (int)autoHideSize;
- rect.Y = rectDockArea.Y;
- rect.Width = (int)autoHideSize;
- rect.Height = rectDockArea.Height;
- }
- else if (state == DockState.DockTopAutoHide)
- {
- if (autoHideSize < 1)
- autoHideSize = rectDockArea.Height * autoHideSize;
- if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize)
- autoHideSize = rectDockArea.Height - MeasurePane.MinSize;
- rect.X = rectDockArea.X;
- rect.Y = rectDockArea.Y;
- rect.Width = rectDockArea.Width;
- rect.Height = (int)autoHideSize;
- }
- else if (state == DockState.DockBottomAutoHide)
- {
- if (autoHideSize < 1)
- autoHideSize = rectDockArea.Height * autoHideSize;
- if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize)
- autoHideSize = rectDockArea.Height - MeasurePane.MinSize;
- rect.X = rectDockArea.X;
- rect.Y = rectDockArea.Y + rectDockArea.Height - (int)autoHideSize;
- rect.Width = rectDockArea.Width;
- rect.Height = (int)autoHideSize;
- }
-
- return rect;
- }
- }
-
- internal Rectangle GetAutoHideWindowBounds(Rectangle rectAutoHideWindow)
- {
- if (DocumentStyle == DocumentStyle.SystemMdi ||
- DocumentStyle == DocumentStyle.DockingMdi)
- return (Parent == null) ? Rectangle.Empty : Parent.RectangleToClient(RectangleToScreen(rectAutoHideWindow));
- else
- return rectAutoHideWindow;
- }
-
- internal void RefreshAutoHideStrip()
- {
- AutoHideStripControl.RefreshChanges();
- }
-
- }
-}
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace LSLEditor.Docking
+{
+ partial class DockPanel
+ {
+ private class AutoHideWindowControl : Panel, ISplitterDragSource
+ {
+ private class SplitterControl : SplitterBase
+ {
+ public SplitterControl(AutoHideWindowControl autoHideWindow)
+ {
+ m_autoHideWindow = autoHideWindow;
+ }
+
+ private AutoHideWindowControl m_autoHideWindow;
+ private AutoHideWindowControl AutoHideWindow
+ {
+ get { return m_autoHideWindow; }
+ }
+
+ protected override int SplitterSize
+ {
+ get { return Measures.SplitterSize; }
+ }
+
+ protected override void StartDrag()
+ {
+ AutoHideWindow.DockPanel.BeginDrag(AutoHideWindow, AutoHideWindow.RectangleToScreen(Bounds));
+ }
+ }
+
+ #region consts
+ private const int ANIMATE_TIME = 100; // in mini-seconds
+ #endregion
+
+ private Timer m_timerMouseTrack;
+ private SplitterControl m_splitter;
+
+ public AutoHideWindowControl(DockPanel dockPanel)
+ {
+ m_dockPanel = dockPanel;
+
+ m_timerMouseTrack = new Timer();
+ m_timerMouseTrack.Tick += new EventHandler(TimerMouseTrack_Tick);
+
+ Visible = false;
+ m_splitter = new SplitterControl(this);
+ Controls.Add(m_splitter);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ m_timerMouseTrack.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private DockPanel m_dockPanel = null;
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ private DockPane m_activePane = null;
+ public DockPane ActivePane
+ {
+ get { return m_activePane; }
+ }
+ private void SetActivePane()
+ {
+ DockPane value = (ActiveContent == null ? null : ActiveContent.DockHandler.Pane);
+
+ if (value == m_activePane)
+ return;
+
+ m_activePane = value;
+ }
+
+ private IDockContent m_activeContent = null;
+ public IDockContent ActiveContent
+ {
+ get { return m_activeContent; }
+ set
+ {
+ if (value == m_activeContent)
+ return;
+
+ if (value != null)
+ {
+ if (!DockHelper.IsDockStateAutoHide(value.DockHandler.DockState) || value.DockHandler.DockPanel != DockPanel)
+ throw (new InvalidOperationException(Strings.DockPanel_ActiveAutoHideContent_InvalidValue));
+ }
+
+ DockPanel.SuspendLayout();
+
+ if (m_activeContent != null)
+ {
+ if (m_activeContent.DockHandler.Form.ContainsFocus)
+ DockPanel.ContentFocusManager.GiveUpFocus(m_activeContent);
+ AnimateWindow(false);
+ }
+
+ m_activeContent = value;
+ SetActivePane();
+ if (ActivePane != null)
+ ActivePane.ActiveContent = m_activeContent;
+
+ if (m_activeContent != null)
+ AnimateWindow(true);
+
+ DockPanel.ResumeLayout();
+ DockPanel.RefreshAutoHideStrip();
+
+ SetTimerMouseTrack();
+ }
+ }
+
+ public DockState DockState
+ {
+ get { return ActiveContent == null ? DockState.Unknown : ActiveContent.DockHandler.DockState; }
+ }
+
+ private bool m_flagAnimate = true;
+ private bool FlagAnimate
+ {
+ get { return m_flagAnimate; }
+ set { m_flagAnimate = value; }
+ }
+
+ private bool m_flagDragging = false;
+ internal bool FlagDragging
+ {
+ get { return m_flagDragging; }
+ set
+ {
+ if (m_flagDragging == value)
+ return;
+
+ m_flagDragging = value;
+ SetTimerMouseTrack();
+ }
+ }
+
+ private void AnimateWindow(bool show)
+ {
+ if (!FlagAnimate && Visible != show)
+ {
+ Visible = show;
+ return;
+ }
+
+ Parent.SuspendLayout();
+
+ Rectangle rectSource = GetRectangle(!show);
+ Rectangle rectTarget = GetRectangle(show);
+ int dxLoc, dyLoc;
+ int dWidth, dHeight;
+ dxLoc = dyLoc = dWidth = dHeight = 0;
+ if (DockState == DockState.DockTopAutoHide)
+ dHeight = show ? 1 : -1;
+ else if (DockState == DockState.DockLeftAutoHide)
+ dWidth = show ? 1 : -1;
+ else if (DockState == DockState.DockRightAutoHide)
+ {
+ dxLoc = show ? -1 : 1;
+ dWidth = show ? 1 : -1;
+ }
+ else if (DockState == DockState.DockBottomAutoHide)
+ {
+ dyLoc = (show ? -1 : 1);
+ dHeight = (show ? 1 : -1);
+ }
+
+ if (show)
+ {
+ Bounds = DockPanel.GetAutoHideWindowBounds(new Rectangle(-rectTarget.Width, -rectTarget.Height, rectTarget.Width, rectTarget.Height));
+ if (Visible == false)
+ Visible = true;
+ PerformLayout();
+ }
+
+ SuspendLayout();
+
+ LayoutAnimateWindow(rectSource);
+ if (Visible == false)
+ Visible = true;
+
+ int speedFactor = 1;
+ int totalPixels = (rectSource.Width != rectTarget.Width) ?
+ Math.Abs(rectSource.Width - rectTarget.Width) :
+ Math.Abs(rectSource.Height - rectTarget.Height);
+ int remainPixels = totalPixels;
+ DateTime startingTime = DateTime.Now;
+ while (rectSource != rectTarget)
+ {
+ DateTime startPerMove = DateTime.Now;
+
+ rectSource.X += dxLoc * speedFactor;
+ rectSource.Y += dyLoc * speedFactor;
+ rectSource.Width += dWidth * speedFactor;
+ rectSource.Height += dHeight * speedFactor;
+ if (Math.Sign(rectTarget.X - rectSource.X) != Math.Sign(dxLoc))
+ rectSource.X = rectTarget.X;
+ if (Math.Sign(rectTarget.Y - rectSource.Y) != Math.Sign(dyLoc))
+ rectSource.Y = rectTarget.Y;
+ if (Math.Sign(rectTarget.Width - rectSource.Width) != Math.Sign(dWidth))
+ rectSource.Width = rectTarget.Width;
+ if (Math.Sign(rectTarget.Height - rectSource.Height) != Math.Sign(dHeight))
+ rectSource.Height = rectTarget.Height;
+
+ LayoutAnimateWindow(rectSource);
+ if (Parent != null)
+ Parent.Update();
+
+ remainPixels -= speedFactor;
+
+ while (true)
+ {
+ TimeSpan time = new TimeSpan(0, 0, 0, 0, ANIMATE_TIME);
+ TimeSpan elapsedPerMove = DateTime.Now - startPerMove;
+ TimeSpan elapsedTime = DateTime.Now - startingTime;
+ if (((int)((time - elapsedTime).TotalMilliseconds)) <= 0)
+ {
+ speedFactor = remainPixels;
+ break;
+ }
+ else
+ speedFactor = remainPixels * (int)elapsedPerMove.TotalMilliseconds / (int)((time - elapsedTime).TotalMilliseconds);
+ if (speedFactor >= 1)
+ break;
+ }
+ }
+ ResumeLayout();
+ Parent.ResumeLayout();
+ }
+
+ private void LayoutAnimateWindow(Rectangle rect)
+ {
+ Bounds = DockPanel.GetAutoHideWindowBounds(rect);
+
+ Rectangle rectClient = ClientRectangle;
+
+ if (DockState == DockState.DockLeftAutoHide)
+ ActivePane.Location = new Point(rectClient.Right - 2 - Measures.SplitterSize - ActivePane.Width, ActivePane.Location.Y);
+ else if (DockState == DockState.DockTopAutoHide)
+ ActivePane.Location = new Point(ActivePane.Location.X, rectClient.Bottom - 2 - Measures.SplitterSize - ActivePane.Height);
+ }
+
+ private Rectangle GetRectangle(bool show)
+ {
+ if (DockState == DockState.Unknown)
+ return Rectangle.Empty;
+
+ Rectangle rect = DockPanel.AutoHideWindowRectangle;
+
+ if (show)
+ return rect;
+
+ if (DockState == DockState.DockLeftAutoHide)
+ rect.Width = 0;
+ else if (DockState == DockState.DockRightAutoHide)
+ {
+ rect.X += rect.Width;
+ rect.Width = 0;
+ }
+ else if (DockState == DockState.DockTopAutoHide)
+ rect.Height = 0;
+ else
+ {
+ rect.Y += rect.Height;
+ rect.Height = 0;
+ }
+
+ return rect;
+ }
+
+ private void SetTimerMouseTrack()
+ {
+ if (ActivePane == null || ActivePane.IsActivated || FlagDragging)
+ {
+ m_timerMouseTrack.Enabled = false;
+ return;
+ }
+
+ // start the timer
+ int hovertime = SystemInformation.MouseHoverTime ;
+
+ // assign a default value 400 in case of setting Timer.Interval invalid value exception
+ if (hovertime <= 0)
+ hovertime = 400;
+
+ m_timerMouseTrack.Interval = 2 * (int)hovertime;
+ m_timerMouseTrack.Enabled = true;
+ }
+
+ protected virtual Rectangle DisplayingRectangle
+ {
+ get
+ {
+ Rectangle rect = ClientRectangle;
+
+ // exclude the border and the splitter
+ if (DockState == DockState.DockBottomAutoHide)
+ {
+ rect.Y += 2 + Measures.SplitterSize;
+ rect.Height -= 2 + Measures.SplitterSize;
+ }
+ else if (DockState == DockState.DockRightAutoHide)
+ {
+ rect.X += 2 + Measures.SplitterSize;
+ rect.Width -= 2 + Measures.SplitterSize;
+ }
+ else if (DockState == DockState.DockTopAutoHide)
+ rect.Height -= 2 + Measures.SplitterSize;
+ else if (DockState == DockState.DockLeftAutoHide)
+ rect.Width -= 2 + Measures.SplitterSize;
+
+ return rect;
+ }
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ DockPadding.All = 0;
+ if (DockState == DockState.DockLeftAutoHide)
+ {
+ DockPadding.Right = 2;
+ m_splitter.Dock = DockStyle.Right;
+ }
+ else if (DockState == DockState.DockRightAutoHide)
+ {
+ DockPadding.Left = 2;
+ m_splitter.Dock = DockStyle.Left;
+ }
+ else if (DockState == DockState.DockTopAutoHide)
+ {
+ DockPadding.Bottom = 2;
+ m_splitter.Dock = DockStyle.Bottom;
+ }
+ else if (DockState == DockState.DockBottomAutoHide)
+ {
+ DockPadding.Top = 2;
+ m_splitter.Dock = DockStyle.Top;
+ }
+
+ Rectangle rectDisplaying = DisplayingRectangle;
+ Rectangle rectHidden = new Rectangle(-rectDisplaying.Width, rectDisplaying.Y, rectDisplaying.Width, rectDisplaying.Height);
+ foreach (Control c in Controls)
+ {
+ DockPane pane = c as DockPane;
+ if (pane == null)
+ continue;
+
+
+ if (pane == ActivePane)
+ pane.Bounds = rectDisplaying;
+ else
+ pane.Bounds = rectHidden;
+ }
+
+ base.OnLayout(levent);
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ // Draw the border
+ Graphics g = e.Graphics;
+
+ if (DockState == DockState.DockBottomAutoHide)
+ g.DrawLine(SystemPens.ControlLightLight, 0, 1, ClientRectangle.Right, 1);
+ else if (DockState == DockState.DockRightAutoHide)
+ g.DrawLine(SystemPens.ControlLightLight, 1, 0, 1, ClientRectangle.Bottom);
+ else if (DockState == DockState.DockTopAutoHide)
+ {
+ g.DrawLine(SystemPens.ControlDark, 0, ClientRectangle.Height - 2, ClientRectangle.Right, ClientRectangle.Height - 2);
+ g.DrawLine(SystemPens.ControlDarkDark, 0, ClientRectangle.Height - 1, ClientRectangle.Right, ClientRectangle.Height - 1);
+ }
+ else if (DockState == DockState.DockLeftAutoHide)
+ {
+ g.DrawLine(SystemPens.ControlDark, ClientRectangle.Width - 2, 0, ClientRectangle.Width - 2, ClientRectangle.Bottom);
+ g.DrawLine(SystemPens.ControlDarkDark, ClientRectangle.Width - 1, 0, ClientRectangle.Width - 1, ClientRectangle.Bottom);
+ }
+
+ base.OnPaint(e);
+ }
+
+ public void RefreshActiveContent()
+ {
+ if (ActiveContent == null)
+ return;
+
+ if (!DockHelper.IsDockStateAutoHide(ActiveContent.DockHandler.DockState))
+ {
+ FlagAnimate = false;
+ ActiveContent = null;
+ FlagAnimate = true;
+ }
+ }
+
+ public void RefreshActivePane()
+ {
+ SetTimerMouseTrack();
+ }
+
+ private void TimerMouseTrack_Tick(object sender, EventArgs e)
+ {
+ if (IsDisposed)
+ return;
+
+ if (ActivePane == null || ActivePane.IsActivated)
+ {
+ m_timerMouseTrack.Enabled = false;
+ return;
+ }
+
+ DockPane pane = ActivePane;
+ Point ptMouseInAutoHideWindow = PointToClient(Control.MousePosition);
+ Point ptMouseInDockPanel = DockPanel.PointToClient(Control.MousePosition);
+
+ Rectangle rectTabStrip = DockPanel.GetTabStripRectangle(pane.DockState);
+
+ if (!ClientRectangle.Contains(ptMouseInAutoHideWindow) && !rectTabStrip.Contains(ptMouseInDockPanel))
+ {
+ ActiveContent = null;
+ m_timerMouseTrack.Enabled = false;
+ }
+ }
+
+ #region ISplitterDragSource Members
+
+ void ISplitterDragSource.BeginDrag(Rectangle rectSplitter)
+ {
+ FlagDragging = true;
+ }
+
+ void ISplitterDragSource.EndDrag()
+ {
+ FlagDragging = false;
+ }
+
+ bool ISplitterDragSource.IsVertical
+ {
+ get { return (DockState == DockState.DockLeftAutoHide || DockState == DockState.DockRightAutoHide); }
+ }
+
+ Rectangle ISplitterDragSource.DragLimitBounds
+ {
+ get
+ {
+ Rectangle rectLimit = DockPanel.DockArea;
+
+ if ((this as ISplitterDragSource).IsVertical)
+ {
+ rectLimit.X += MeasurePane.MinSize;
+ rectLimit.Width -= 2 * MeasurePane.MinSize;
+ }
+ else
+ {
+ rectLimit.Y += MeasurePane.MinSize;
+ rectLimit.Height -= 2 * MeasurePane.MinSize;
+ }
+
+ return DockPanel.RectangleToScreen(rectLimit);
+ }
+ }
+
+ void ISplitterDragSource.MoveSplitter(int offset)
+ {
+ Rectangle rectDockArea = DockPanel.DockArea;
+ IDockContent content = ActiveContent;
+ if (DockState == DockState.DockLeftAutoHide && rectDockArea.Width > 0)
+ {
+ if (content.DockHandler.AutoHidePortion < 1)
+ content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Width;
+ else
+ content.DockHandler.AutoHidePortion = Width + offset;
+ }
+ else if (DockState == DockState.DockRightAutoHide && rectDockArea.Width > 0)
+ {
+ if (content.DockHandler.AutoHidePortion < 1)
+ content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Width;
+ else
+ content.DockHandler.AutoHidePortion = Width - offset;
+ }
+ else if (DockState == DockState.DockBottomAutoHide && rectDockArea.Height > 0)
+ {
+ if (content.DockHandler.AutoHidePortion < 1)
+ content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Height;
+ else
+ content.DockHandler.AutoHidePortion = Height - offset;
+ }
+ else if (DockState == DockState.DockTopAutoHide && rectDockArea.Height > 0)
+ {
+ if (content.DockHandler.AutoHidePortion < 1)
+ content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Height;
+ else
+ content.DockHandler.AutoHidePortion = Height + offset;
+ }
+ }
+
+ #region IDragSource Members
+
+ Control IDragSource.DragControl
+ {
+ get { return this; }
+ }
+
+ #endregion
+
+ #endregion
+ }
+
+ private AutoHideWindowControl AutoHideWindow
+ {
+ get { return m_autoHideWindow; }
+ }
+
+ internal Control AutoHideControl
+ {
+ get { return m_autoHideWindow; }
+ }
+
+ internal void RefreshActiveAutoHideContent()
+ {
+ AutoHideWindow.RefreshActiveContent();
+ }
+
+ internal Rectangle AutoHideWindowRectangle
+ {
+ get
+ {
+ DockState state = AutoHideWindow.DockState;
+ Rectangle rectDockArea = DockArea;
+ if (ActiveAutoHideContent == null)
+ return Rectangle.Empty;
+
+ if (Parent == null)
+ return Rectangle.Empty;
+
+ Rectangle rect = Rectangle.Empty;
+ double autoHideSize = ActiveAutoHideContent.DockHandler.AutoHidePortion;
+ if (state == DockState.DockLeftAutoHide)
+ {
+ if (autoHideSize < 1)
+ autoHideSize = rectDockArea.Width * autoHideSize;
+ if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize)
+ autoHideSize = rectDockArea.Width - MeasurePane.MinSize;
+ rect.X = rectDockArea.X;
+ rect.Y = rectDockArea.Y;
+ rect.Width = (int)autoHideSize;
+ rect.Height = rectDockArea.Height;
+ }
+ else if (state == DockState.DockRightAutoHide)
+ {
+ if (autoHideSize < 1)
+ autoHideSize = rectDockArea.Width * autoHideSize;
+ if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize)
+ autoHideSize = rectDockArea.Width - MeasurePane.MinSize;
+ rect.X = rectDockArea.X + rectDockArea.Width - (int)autoHideSize;
+ rect.Y = rectDockArea.Y;
+ rect.Width = (int)autoHideSize;
+ rect.Height = rectDockArea.Height;
+ }
+ else if (state == DockState.DockTopAutoHide)
+ {
+ if (autoHideSize < 1)
+ autoHideSize = rectDockArea.Height * autoHideSize;
+ if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize)
+ autoHideSize = rectDockArea.Height - MeasurePane.MinSize;
+ rect.X = rectDockArea.X;
+ rect.Y = rectDockArea.Y;
+ rect.Width = rectDockArea.Width;
+ rect.Height = (int)autoHideSize;
+ }
+ else if (state == DockState.DockBottomAutoHide)
+ {
+ if (autoHideSize < 1)
+ autoHideSize = rectDockArea.Height * autoHideSize;
+ if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize)
+ autoHideSize = rectDockArea.Height - MeasurePane.MinSize;
+ rect.X = rectDockArea.X;
+ rect.Y = rectDockArea.Y + rectDockArea.Height - (int)autoHideSize;
+ rect.Width = rectDockArea.Width;
+ rect.Height = (int)autoHideSize;
+ }
+
+ return rect;
+ }
+ }
+
+ internal Rectangle GetAutoHideWindowBounds(Rectangle rectAutoHideWindow)
+ {
+ if (DocumentStyle == DocumentStyle.SystemMdi ||
+ DocumentStyle == DocumentStyle.DockingMdi)
+ return (Parent == null) ? Rectangle.Empty : Parent.RectangleToClient(RectangleToScreen(rectAutoHideWindow));
+ else
+ return rectAutoHideWindow;
+ }
+
+ internal void RefreshAutoHideStrip()
+ {
+ AutoHideStripControl.RefreshChanges();
+ }
+
+ }
+}
diff --git a/trunk/Docking/DockPanel.DockDragHandler.cs b/source/Docking/DockPanel.DockDragHandler.cs
similarity index 97%
rename from trunk/Docking/DockPanel.DockDragHandler.cs
rename to source/Docking/DockPanel.DockDragHandler.cs
index ebc2254..eb518ac 100644
--- a/trunk/Docking/DockPanel.DockDragHandler.cs
+++ b/source/Docking/DockPanel.DockDragHandler.cs
@@ -1,814 +1,814 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.ComponentModel;
-
-namespace LSLEditor.Docking
-{
- partial class DockPanel
- {
- private sealed class DockDragHandler : DragHandler
- {
- private class DockIndicator : DragForm
- {
- #region IHitTest
- private interface IHitTest
- {
- DockStyle HitTest(Point pt);
- DockStyle Status { get; set; }
- }
- #endregion
-
- #region PanelIndicator
- private class PanelIndicator : PictureBox, IHitTest
- {
- private static Image _imagePanelLeft = Resources.DockIndicator_PanelLeft;
- private static Image _imagePanelRight = Resources.DockIndicator_PanelRight;
- private static Image _imagePanelTop = Resources.DockIndicator_PanelTop;
- private static Image _imagePanelBottom = Resources.DockIndicator_PanelBottom;
- private static Image _imagePanelFill = Resources.DockIndicator_PanelFill;
- private static Image _imagePanelLeftActive = Resources.DockIndicator_PanelLeft_Active;
- private static Image _imagePanelRightActive = Resources.DockIndicator_PanelRight_Active;
- private static Image _imagePanelTopActive = Resources.DockIndicator_PanelTop_Active;
- private static Image _imagePanelBottomActive = Resources.DockIndicator_PanelBottom_Active;
- private static Image _imagePanelFillActive = Resources.DockIndicator_PanelFill_Active;
-
- public PanelIndicator(DockStyle dockStyle)
- {
- m_dockStyle = dockStyle;
- SizeMode = PictureBoxSizeMode.AutoSize;
- Image = ImageInactive;
- }
-
- private DockStyle m_dockStyle;
- private DockStyle DockStyle
- {
- get { return m_dockStyle; }
- }
-
- private DockStyle m_status;
- public DockStyle Status
- {
- get { return m_status; }
- set
- {
- if (value != DockStyle && value != DockStyle.None)
- throw new InvalidEnumArgumentException();
-
- if (m_status == value)
- return;
-
- m_status = value;
- IsActivated = (m_status != DockStyle.None);
- }
- }
-
- private Image ImageInactive
- {
- get
- {
- if (DockStyle == DockStyle.Left)
- return _imagePanelLeft;
- else if (DockStyle == DockStyle.Right)
- return _imagePanelRight;
- else if (DockStyle == DockStyle.Top)
- return _imagePanelTop;
- else if (DockStyle == DockStyle.Bottom)
- return _imagePanelBottom;
- else if (DockStyle == DockStyle.Fill)
- return _imagePanelFill;
- else
- return null;
- }
- }
-
- private Image ImageActive
- {
- get
- {
- if (DockStyle == DockStyle.Left)
- return _imagePanelLeftActive;
- else if (DockStyle == DockStyle.Right)
- return _imagePanelRightActive;
- else if (DockStyle == DockStyle.Top)
- return _imagePanelTopActive;
- else if (DockStyle == DockStyle.Bottom)
- return _imagePanelBottomActive;
- else if (DockStyle == DockStyle.Fill)
- return _imagePanelFillActive;
- else
- return null;
- }
- }
-
- private bool m_isActivated = false;
- private bool IsActivated
- {
- get { return m_isActivated; }
- set
- {
- m_isActivated = value;
- Image = IsActivated ? ImageActive : ImageInactive;
- }
- }
-
- public DockStyle HitTest(Point pt)
- {
- return this.Visible && ClientRectangle.Contains(PointToClient(pt)) ? DockStyle : DockStyle.None;
- }
- }
- #endregion PanelIndicator
-
- #region PaneIndicator
- private class PaneIndicator : PictureBox, IHitTest
- {
- private struct HotSpotIndex
- {
- public HotSpotIndex(int x, int y, DockStyle dockStyle)
- {
- m_x = x;
- m_y = y;
- m_dockStyle = dockStyle;
- }
-
- private int m_x;
- public int X
- {
- get { return m_x; }
- }
-
- private int m_y;
- public int Y
- {
- get { return m_y; }
- }
-
- private DockStyle m_dockStyle;
- public DockStyle DockStyle
- {
- get { return m_dockStyle; }
- }
- }
-
- private static Bitmap _bitmapPaneDiamond = Resources.DockIndicator_PaneDiamond;
- private static Bitmap _bitmapPaneDiamondLeft = Resources.DockIndicator_PaneDiamond_Left;
- private static Bitmap _bitmapPaneDiamondRight = Resources.DockIndicator_PaneDiamond_Right;
- private static Bitmap _bitmapPaneDiamondTop = Resources.DockIndicator_PaneDiamond_Top;
- private static Bitmap _bitmapPaneDiamondBottom = Resources.DockIndicator_PaneDiamond_Bottom;
- private static Bitmap _bitmapPaneDiamondFill = Resources.DockIndicator_PaneDiamond_Fill;
- private static Bitmap _bitmapPaneDiamondHotSpot = Resources.DockIndicator_PaneDiamond_HotSpot;
- private static Bitmap _bitmapPaneDiamondHotSpotIndex = Resources.DockIndicator_PaneDiamond_HotSpotIndex;
- private static HotSpotIndex[] _hotSpots = new HotSpotIndex[]
- {
- new HotSpotIndex(1, 0, DockStyle.Top),
- new HotSpotIndex(0, 1, DockStyle.Left),
- new HotSpotIndex(1, 1, DockStyle.Fill),
- new HotSpotIndex(2, 1, DockStyle.Right),
- new HotSpotIndex(1, 2, DockStyle.Bottom)
- };
- private static GraphicsPath _displayingGraphicsPath = DrawHelper.CalculateGraphicsPathFromBitmap(_bitmapPaneDiamond);
-
- public PaneIndicator()
- {
- SizeMode = PictureBoxSizeMode.AutoSize;
- Image = _bitmapPaneDiamond;
- Region = new Region(DisplayingGraphicsPath);
- }
-
- public static GraphicsPath DisplayingGraphicsPath
- {
- get { return _displayingGraphicsPath; }
- }
-
- public DockStyle HitTest(Point pt)
- {
- if (!Visible)
- return DockStyle.None;
-
- pt = PointToClient(pt);
- if (!ClientRectangle.Contains(pt))
- return DockStyle.None;
-
- for (int i = _hotSpots.GetLowerBound(0); i <= _hotSpots.GetUpperBound(0); i++)
- {
- if (_bitmapPaneDiamondHotSpot.GetPixel(pt.X, pt.Y) == _bitmapPaneDiamondHotSpotIndex.GetPixel(_hotSpots[i].X, _hotSpots[i].Y))
- return _hotSpots[i].DockStyle;
- }
-
- return DockStyle.None;
- }
-
- private DockStyle m_status = DockStyle.None;
- public DockStyle Status
- {
- get { return m_status; }
- set
- {
- m_status = value;
- if (m_status == DockStyle.None)
- Image = _bitmapPaneDiamond;
- else if (m_status == DockStyle.Left)
- Image = _bitmapPaneDiamondLeft;
- else if (m_status == DockStyle.Right)
- Image = _bitmapPaneDiamondRight;
- else if (m_status == DockStyle.Top)
- Image = _bitmapPaneDiamondTop;
- else if (m_status == DockStyle.Bottom)
- Image = _bitmapPaneDiamondBottom;
- else if (m_status == DockStyle.Fill)
- Image = _bitmapPaneDiamondFill;
- }
- }
- }
- #endregion PaneIndicator
-
- #region consts
- private int _PanelIndicatorMargin = 10;
- #endregion
-
- private DockDragHandler m_dragHandler;
-
- public DockIndicator(DockDragHandler dragHandler)
- {
- m_dragHandler = dragHandler;
- Controls.AddRange(new Control[] {
- PaneDiamond,
- PanelLeft,
- PanelRight,
- PanelTop,
- PanelBottom,
- PanelFill
- });
- Region = new Region(Rectangle.Empty);
- }
-
- private PaneIndicator m_paneDiamond = null;
- private PaneIndicator PaneDiamond
- {
- get
- {
- if (m_paneDiamond == null)
- m_paneDiamond = new PaneIndicator();
-
- return m_paneDiamond;
- }
- }
-
- private PanelIndicator m_panelLeft = null;
- private PanelIndicator PanelLeft
- {
- get
- {
- if (m_panelLeft == null)
- m_panelLeft = new PanelIndicator(DockStyle.Left);
-
- return m_panelLeft;
- }
- }
-
- private PanelIndicator m_panelRight = null;
- private PanelIndicator PanelRight
- {
- get
- {
- if (m_panelRight == null)
- m_panelRight = new PanelIndicator(DockStyle.Right);
-
- return m_panelRight;
- }
- }
-
- private PanelIndicator m_panelTop = null;
- private PanelIndicator PanelTop
- {
- get
- {
- if (m_panelTop == null)
- m_panelTop = new PanelIndicator(DockStyle.Top);
-
- return m_panelTop;
- }
- }
-
- private PanelIndicator m_panelBottom = null;
- private PanelIndicator PanelBottom
- {
- get
- {
- if (m_panelBottom == null)
- m_panelBottom = new PanelIndicator(DockStyle.Bottom);
-
- return m_panelBottom;
- }
- }
-
- private PanelIndicator m_panelFill = null;
- private PanelIndicator PanelFill
- {
- get
- {
- if (m_panelFill == null)
- m_panelFill = new PanelIndicator(DockStyle.Fill);
-
- return m_panelFill;
- }
- }
-
- private bool m_fullPanelEdge = false;
- public bool FullPanelEdge
- {
- get { return m_fullPanelEdge; }
- set
- {
- if (m_fullPanelEdge == value)
- return;
-
- m_fullPanelEdge = value;
- RefreshChanges();
- }
- }
-
- public DockDragHandler DragHandler
- {
- get { return m_dragHandler; }
- }
-
- public DockPanel DockPanel
- {
- get { return DragHandler.DockPanel; }
- }
-
- private DockPane m_dockPane = null;
- public DockPane DockPane
- {
- get { return m_dockPane; }
- internal set
- {
- if (m_dockPane == value)
- return;
-
- DockPane oldDisplayingPane = DisplayingPane;
- m_dockPane = value;
- if (oldDisplayingPane != DisplayingPane)
- RefreshChanges();
- }
- }
-
- private IHitTest m_hitTest = null;
- private IHitTest HitTestResult
- {
- get { return m_hitTest; }
- set
- {
- if (m_hitTest == value)
- return;
-
- if (m_hitTest != null)
- m_hitTest.Status = DockStyle.None;
-
- m_hitTest = value;
- }
- }
-
- private DockPane DisplayingPane
- {
- get { return ShouldPaneDiamondVisible() ? DockPane : null; }
- }
-
- private void RefreshChanges()
- {
- Region region = new Region(Rectangle.Empty);
- Rectangle rectDockArea = FullPanelEdge ? DockPanel.DockArea : DockPanel.DocumentWindowBounds;
-
- rectDockArea = RectangleToClient(DockPanel.RectangleToScreen(rectDockArea));
- if (ShouldPanelIndicatorVisible(DockState.DockLeft))
- {
- PanelLeft.Location = new Point(rectDockArea.X + _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
- PanelLeft.Visible = true;
- region.Union(PanelLeft.Bounds);
- }
- else
- PanelLeft.Visible = false;
-
- if (ShouldPanelIndicatorVisible(DockState.DockRight))
- {
- PanelRight.Location = new Point(rectDockArea.X + rectDockArea.Width - PanelRight.Width - _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
- PanelRight.Visible = true;
- region.Union(PanelRight.Bounds);
- }
- else
- PanelRight.Visible = false;
-
- if (ShouldPanelIndicatorVisible(DockState.DockTop))
- {
- PanelTop.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelTop.Width) / 2, rectDockArea.Y + _PanelIndicatorMargin);
- PanelTop.Visible = true;
- region.Union(PanelTop.Bounds);
- }
- else
- PanelTop.Visible = false;
-
- if (ShouldPanelIndicatorVisible(DockState.DockBottom))
- {
- PanelBottom.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelBottom.Width) / 2, rectDockArea.Y + rectDockArea.Height - PanelBottom.Height - _PanelIndicatorMargin);
- PanelBottom.Visible = true;
- region.Union(PanelBottom.Bounds);
- }
- else
- PanelBottom.Visible = false;
-
- if (ShouldPanelIndicatorVisible(DockState.Document))
- {
- Rectangle rectDocumentWindow = RectangleToClient(DockPanel.RectangleToScreen(DockPanel.DocumentWindowBounds));
- PanelFill.Location = new Point(rectDocumentWindow.X + (rectDocumentWindow.Width - PanelFill.Width) / 2, rectDocumentWindow.Y + (rectDocumentWindow.Height - PanelFill.Height) / 2);
- PanelFill.Visible = true;
- region.Union(PanelFill.Bounds);
- }
- else
- PanelFill.Visible = false;
-
- if (ShouldPaneDiamondVisible())
- {
- Rectangle rect = RectangleToClient(DockPane.RectangleToScreen(DockPane.ClientRectangle));
- PaneDiamond.Location = new Point(rect.Left + (rect.Width - PaneDiamond.Width) / 2, rect.Top + (rect.Height - PaneDiamond.Height) / 2);
- PaneDiamond.Visible = true;
- using (GraphicsPath graphicsPath = PaneIndicator.DisplayingGraphicsPath.Clone() as GraphicsPath)
- {
- Point[] pts = new Point[]
- {
- new Point(PaneDiamond.Left, PaneDiamond.Top),
- new Point(PaneDiamond.Right, PaneDiamond.Top),
- new Point(PaneDiamond.Left, PaneDiamond.Bottom)
- };
- using (Matrix matrix = new Matrix(PaneDiamond.ClientRectangle, pts))
- {
- graphicsPath.Transform(matrix);
- }
- region.Union(graphicsPath);
- }
- }
- else
- PaneDiamond.Visible = false;
-
- Region = region;
- }
-
- private bool ShouldPanelIndicatorVisible(DockState dockState)
- {
- if (!Visible)
- return false;
-
- if (DockPanel.DockWindows[dockState].Visible)
- return false;
-
- return DragHandler.DragSource.IsDockStateValid(dockState);
- }
-
- private bool ShouldPaneDiamondVisible()
- {
- if (DockPane == null)
- return false;
-
- if (!DockPanel.AllowEndUserNestedDocking)
- return false;
-
- return DragHandler.DragSource.CanDockTo(DockPane);
- }
-
- public override void Show(bool bActivate)
- {
- base.Show(bActivate);
- Bounds = SystemInformation.VirtualScreen;
- RefreshChanges();
- }
-
- public void TestDrop()
- {
- Point pt = Control.MousePosition;
- DockPane = DockHelper.PaneAtPoint(pt, DockPanel);
-
- if (TestDrop(PanelLeft, pt) != DockStyle.None)
- HitTestResult = PanelLeft;
- else if (TestDrop(PanelRight, pt) != DockStyle.None)
- HitTestResult = PanelRight;
- else if (TestDrop(PanelTop, pt) != DockStyle.None)
- HitTestResult = PanelTop;
- else if (TestDrop(PanelBottom, pt) != DockStyle.None)
- HitTestResult = PanelBottom;
- else if (TestDrop(PanelFill, pt) != DockStyle.None)
- HitTestResult = PanelFill;
- else if (TestDrop(PaneDiamond, pt) != DockStyle.None)
- HitTestResult = PaneDiamond;
- else
- HitTestResult = null;
-
- if (HitTestResult != null)
- {
- if (HitTestResult is PaneIndicator)
- DragHandler.Outline.Show(DockPane, HitTestResult.Status);
- else
- DragHandler.Outline.Show(DockPanel, HitTestResult.Status, FullPanelEdge);
- }
- }
-
- private static DockStyle TestDrop(IHitTest hitTest, Point pt)
- {
- return hitTest.Status = hitTest.HitTest(pt);
- }
- }
-
- private class DockOutline : DockOutlineBase
- {
- public DockOutline()
- {
- m_dragForm = new DragForm();
- SetDragForm(Rectangle.Empty);
- DragForm.BackColor = SystemColors.ActiveCaption;
- DragForm.Opacity = 0.5;
- DragForm.Show(false);
- }
-
- DragForm m_dragForm;
- private DragForm DragForm
- {
- get { return m_dragForm; }
- }
-
- protected override void OnShow()
- {
- CalculateRegion();
- }
-
- protected override void OnClose()
- {
- DragForm.Close();
- }
-
- private void CalculateRegion()
- {
- if (SameAsOldValue)
- return;
-
- if (!FloatWindowBounds.IsEmpty)
- SetOutline(FloatWindowBounds);
- else if (DockTo is DockPanel)
- SetOutline(DockTo as DockPanel, Dock, (ContentIndex != 0));
- else if (DockTo is DockPane)
- SetOutline(DockTo as DockPane, Dock, ContentIndex);
- else
- SetOutline();
- }
-
- private void SetOutline()
- {
- SetDragForm(Rectangle.Empty);
- }
-
- private void SetOutline(Rectangle floatWindowBounds)
- {
- SetDragForm(floatWindowBounds);
- }
-
- private void SetOutline(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge)
- {
- Rectangle rect = fullPanelEdge ? dockPanel.DockArea : dockPanel.DocumentWindowBounds;
- rect.Location = dockPanel.PointToScreen(rect.Location);
- if (dock == DockStyle.Top)
- {
- int height = dockPanel.GetDockWindowSize(DockState.DockTop);
- rect = new Rectangle(rect.X, rect.Y, rect.Width, height);
- }
- else if (dock == DockStyle.Bottom)
- {
- int height = dockPanel.GetDockWindowSize(DockState.DockBottom);
- rect = new Rectangle(rect.X, rect.Bottom - height, rect.Width, height);
- }
- else if (dock == DockStyle.Left)
- {
- int width = dockPanel.GetDockWindowSize(DockState.DockLeft);
- rect = new Rectangle(rect.X, rect.Y, width, rect.Height);
- }
- else if (dock == DockStyle.Right)
- {
- int width = dockPanel.GetDockWindowSize(DockState.DockRight);
- rect = new Rectangle(rect.Right - width, rect.Y, width, rect.Height);
- }
- else if (dock == DockStyle.Fill)
- {
- rect = dockPanel.DocumentWindowBounds;
- rect.Location = dockPanel.PointToScreen(rect.Location);
- }
-
- SetDragForm(rect);
- }
-
- private void SetOutline(DockPane pane, DockStyle dock, int contentIndex)
- {
- if (dock != DockStyle.Fill)
- {
- Rectangle rect = pane.DisplayingRectangle;
- if (dock == DockStyle.Right)
- rect.X += rect.Width / 2;
- if (dock == DockStyle.Bottom)
- rect.Y += rect.Height / 2;
- if (dock == DockStyle.Left || dock == DockStyle.Right)
- rect.Width -= rect.Width / 2;
- if (dock == DockStyle.Top || dock == DockStyle.Bottom)
- rect.Height -= rect.Height / 2;
- rect.Location = pane.PointToScreen(rect.Location);
-
- SetDragForm(rect);
- }
- else if (contentIndex == -1)
- {
- Rectangle rect = pane.DisplayingRectangle;
- rect.Location = pane.PointToScreen(rect.Location);
- SetDragForm(rect);
- }
- else
- {
- using (GraphicsPath path = pane.TabStripControl.GetOutline(contentIndex))
- {
- RectangleF rectF = path.GetBounds();
- Rectangle rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
- using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) }))
- {
- path.Transform(matrix);
- }
- Region region = new Region(path);
- SetDragForm(rect, region);
- }
- }
- }
-
- private void SetDragForm(Rectangle rect)
- {
- DragForm.Bounds = rect;
- if (rect == Rectangle.Empty)
- DragForm.Region = new Region(Rectangle.Empty);
- else if (DragForm.Region != null)
- DragForm.Region = null;
- }
-
- private void SetDragForm(Rectangle rect, Region region)
- {
- DragForm.Bounds = rect;
- DragForm.Region = region;
- }
- }
-
- public DockDragHandler(DockPanel panel)
- : base(panel)
- {
- }
-
- public new IDockDragSource DragSource
- {
- get { return base.DragSource as IDockDragSource; }
- set { base.DragSource = value; }
- }
-
- private DockOutlineBase m_outline;
- public DockOutlineBase Outline
- {
- get { return m_outline; }
- private set { m_outline = value; }
- }
-
- private DockIndicator m_indicator;
- private DockIndicator Indicator
- {
- get { return m_indicator; }
- set { m_indicator = value; }
- }
-
- private Rectangle m_floatOutlineBounds;
- private Rectangle FloatOutlineBounds
- {
- get { return m_floatOutlineBounds; }
- set { m_floatOutlineBounds = value; }
- }
-
- public void BeginDrag(IDockDragSource dragSource)
- {
- DragSource = dragSource;
-
- if (!BeginDrag())
- {
- DragSource = null;
- return;
- }
-
- Outline = new DockOutline();
- Indicator = new DockIndicator(this);
- Indicator.Show(false);
-
- FloatOutlineBounds = DragSource.BeginDrag(StartMousePosition);
- }
-
- protected override void OnDragging()
- {
- TestDrop();
- }
-
- protected override void OnEndDrag(bool abort)
- {
- DockPanel.SuspendLayout(true);
-
- Outline.Close();
- Indicator.Close();
-
- EndDrag(abort);
-
- // Queue a request to layout all children controls
- DockPanel.PerformMdiClientLayout();
-
- DockPanel.ResumeLayout(true, true);
-
- DragSource = null;
- }
-
- private void TestDrop()
- {
- Outline.FlagTestDrop = false;
-
- Indicator.FullPanelEdge = ((Control.ModifierKeys & Keys.Shift) != 0);
-
- if ((Control.ModifierKeys & Keys.Control) == 0)
- {
- Indicator.TestDrop();
-
- if (!Outline.FlagTestDrop)
- {
- DockPane pane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel);
- if (pane != null && DragSource.IsDockStateValid(pane.DockState))
- pane.TestDrop(DragSource, Outline);
- }
-
- if (!Outline.FlagTestDrop && DragSource.IsDockStateValid(DockState.Float))
- {
- FloatWindow floatWindow = DockHelper.FloatWindowAtPoint(Control.MousePosition, DockPanel);
- if (floatWindow != null)
- floatWindow.TestDrop(DragSource, Outline);
- }
- }
- else
- Indicator.DockPane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel);
-
- if (!Outline.FlagTestDrop)
- {
- if (DragSource.IsDockStateValid(DockState.Float))
- {
- Rectangle rect = FloatOutlineBounds;
- rect.Offset(Control.MousePosition.X - StartMousePosition.X, Control.MousePosition.Y - StartMousePosition.Y);
- Outline.Show(rect);
- }
- }
-
- if (!Outline.FlagTestDrop)
- {
- Cursor.Current = Cursors.No;
- Outline.Show();
- }
- else
- Cursor.Current = DragControl.Cursor;
- }
-
- private void EndDrag(bool abort)
- {
- if (abort)
- return;
-
- if (!Outline.FloatWindowBounds.IsEmpty)
- DragSource.FloatAt(Outline.FloatWindowBounds);
- else if (Outline.DockTo is DockPane)
- {
- DockPane pane = Outline.DockTo as DockPane;
- DragSource.DockTo(pane, Outline.Dock, Outline.ContentIndex);
- }
- else if (Outline.DockTo is DockPanel)
- {
- DockPanel panel = Outline.DockTo as DockPanel;
- panel.UpdateDockWindowZOrder(Outline.Dock, Outline.FlagFullEdge);
- DragSource.DockTo(panel, Outline.Dock);
- }
- }
- }
-
- private DockDragHandler m_dockDragHandler = null;
- private DockDragHandler GetDockDragHandler()
- {
- if (m_dockDragHandler == null)
- m_dockDragHandler = new DockDragHandler(this);
- return m_dockDragHandler;
- }
-
- internal void BeginDrag(IDockDragSource dragSource)
- {
- GetDockDragHandler().BeginDrag(dragSource);
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.ComponentModel;
+
+namespace LSLEditor.Docking
+{
+ partial class DockPanel
+ {
+ private sealed class DockDragHandler : DragHandler
+ {
+ private class DockIndicator : DragForm
+ {
+ #region IHitTest
+ private interface IHitTest
+ {
+ DockStyle HitTest(Point pt);
+ DockStyle Status { get; set; }
+ }
+ #endregion
+
+ #region PanelIndicator
+ private class PanelIndicator : PictureBox, IHitTest
+ {
+ private static Image _imagePanelLeft = Resources.DockIndicator_PanelLeft;
+ private static Image _imagePanelRight = Resources.DockIndicator_PanelRight;
+ private static Image _imagePanelTop = Resources.DockIndicator_PanelTop;
+ private static Image _imagePanelBottom = Resources.DockIndicator_PanelBottom;
+ private static Image _imagePanelFill = Resources.DockIndicator_PanelFill;
+ private static Image _imagePanelLeftActive = Resources.DockIndicator_PanelLeft_Active;
+ private static Image _imagePanelRightActive = Resources.DockIndicator_PanelRight_Active;
+ private static Image _imagePanelTopActive = Resources.DockIndicator_PanelTop_Active;
+ private static Image _imagePanelBottomActive = Resources.DockIndicator_PanelBottom_Active;
+ private static Image _imagePanelFillActive = Resources.DockIndicator_PanelFill_Active;
+
+ public PanelIndicator(DockStyle dockStyle)
+ {
+ m_dockStyle = dockStyle;
+ SizeMode = PictureBoxSizeMode.AutoSize;
+ Image = ImageInactive;
+ }
+
+ private DockStyle m_dockStyle;
+ private DockStyle DockStyle
+ {
+ get { return m_dockStyle; }
+ }
+
+ private DockStyle m_status;
+ public DockStyle Status
+ {
+ get { return m_status; }
+ set
+ {
+ if (value != DockStyle && value != DockStyle.None)
+ throw new InvalidEnumArgumentException();
+
+ if (m_status == value)
+ return;
+
+ m_status = value;
+ IsActivated = (m_status != DockStyle.None);
+ }
+ }
+
+ private Image ImageInactive
+ {
+ get
+ {
+ if (DockStyle == DockStyle.Left)
+ return _imagePanelLeft;
+ else if (DockStyle == DockStyle.Right)
+ return _imagePanelRight;
+ else if (DockStyle == DockStyle.Top)
+ return _imagePanelTop;
+ else if (DockStyle == DockStyle.Bottom)
+ return _imagePanelBottom;
+ else if (DockStyle == DockStyle.Fill)
+ return _imagePanelFill;
+ else
+ return null;
+ }
+ }
+
+ private Image ImageActive
+ {
+ get
+ {
+ if (DockStyle == DockStyle.Left)
+ return _imagePanelLeftActive;
+ else if (DockStyle == DockStyle.Right)
+ return _imagePanelRightActive;
+ else if (DockStyle == DockStyle.Top)
+ return _imagePanelTopActive;
+ else if (DockStyle == DockStyle.Bottom)
+ return _imagePanelBottomActive;
+ else if (DockStyle == DockStyle.Fill)
+ return _imagePanelFillActive;
+ else
+ return null;
+ }
+ }
+
+ private bool m_isActivated = false;
+ private bool IsActivated
+ {
+ get { return m_isActivated; }
+ set
+ {
+ m_isActivated = value;
+ Image = IsActivated ? ImageActive : ImageInactive;
+ }
+ }
+
+ public DockStyle HitTest(Point pt)
+ {
+ return this.Visible && ClientRectangle.Contains(PointToClient(pt)) ? DockStyle : DockStyle.None;
+ }
+ }
+ #endregion PanelIndicator
+
+ #region PaneIndicator
+ private class PaneIndicator : PictureBox, IHitTest
+ {
+ private struct HotSpotIndex
+ {
+ public HotSpotIndex(int x, int y, DockStyle dockStyle)
+ {
+ m_x = x;
+ m_y = y;
+ m_dockStyle = dockStyle;
+ }
+
+ private int m_x;
+ public int X
+ {
+ get { return m_x; }
+ }
+
+ private int m_y;
+ public int Y
+ {
+ get { return m_y; }
+ }
+
+ private DockStyle m_dockStyle;
+ public DockStyle DockStyle
+ {
+ get { return m_dockStyle; }
+ }
+ }
+
+ private static Bitmap _bitmapPaneDiamond = Resources.DockIndicator_PaneDiamond;
+ private static Bitmap _bitmapPaneDiamondLeft = Resources.DockIndicator_PaneDiamond_Left;
+ private static Bitmap _bitmapPaneDiamondRight = Resources.DockIndicator_PaneDiamond_Right;
+ private static Bitmap _bitmapPaneDiamondTop = Resources.DockIndicator_PaneDiamond_Top;
+ private static Bitmap _bitmapPaneDiamondBottom = Resources.DockIndicator_PaneDiamond_Bottom;
+ private static Bitmap _bitmapPaneDiamondFill = Resources.DockIndicator_PaneDiamond_Fill;
+ private static Bitmap _bitmapPaneDiamondHotSpot = Resources.DockIndicator_PaneDiamond_HotSpot;
+ private static Bitmap _bitmapPaneDiamondHotSpotIndex = Resources.DockIndicator_PaneDiamond_HotSpotIndex;
+ private static HotSpotIndex[] _hotSpots = new HotSpotIndex[]
+ {
+ new HotSpotIndex(1, 0, DockStyle.Top),
+ new HotSpotIndex(0, 1, DockStyle.Left),
+ new HotSpotIndex(1, 1, DockStyle.Fill),
+ new HotSpotIndex(2, 1, DockStyle.Right),
+ new HotSpotIndex(1, 2, DockStyle.Bottom)
+ };
+ private static GraphicsPath _displayingGraphicsPath = DrawHelper.CalculateGraphicsPathFromBitmap(_bitmapPaneDiamond);
+
+ public PaneIndicator()
+ {
+ SizeMode = PictureBoxSizeMode.AutoSize;
+ Image = _bitmapPaneDiamond;
+ Region = new Region(DisplayingGraphicsPath);
+ }
+
+ public static GraphicsPath DisplayingGraphicsPath
+ {
+ get { return _displayingGraphicsPath; }
+ }
+
+ public DockStyle HitTest(Point pt)
+ {
+ if (!Visible)
+ return DockStyle.None;
+
+ pt = PointToClient(pt);
+ if (!ClientRectangle.Contains(pt))
+ return DockStyle.None;
+
+ for (int i = _hotSpots.GetLowerBound(0); i <= _hotSpots.GetUpperBound(0); i++)
+ {
+ if (_bitmapPaneDiamondHotSpot.GetPixel(pt.X, pt.Y) == _bitmapPaneDiamondHotSpotIndex.GetPixel(_hotSpots[i].X, _hotSpots[i].Y))
+ return _hotSpots[i].DockStyle;
+ }
+
+ return DockStyle.None;
+ }
+
+ private DockStyle m_status = DockStyle.None;
+ public DockStyle Status
+ {
+ get { return m_status; }
+ set
+ {
+ m_status = value;
+ if (m_status == DockStyle.None)
+ Image = _bitmapPaneDiamond;
+ else if (m_status == DockStyle.Left)
+ Image = _bitmapPaneDiamondLeft;
+ else if (m_status == DockStyle.Right)
+ Image = _bitmapPaneDiamondRight;
+ else if (m_status == DockStyle.Top)
+ Image = _bitmapPaneDiamondTop;
+ else if (m_status == DockStyle.Bottom)
+ Image = _bitmapPaneDiamondBottom;
+ else if (m_status == DockStyle.Fill)
+ Image = _bitmapPaneDiamondFill;
+ }
+ }
+ }
+ #endregion PaneIndicator
+
+ #region consts
+ private int _PanelIndicatorMargin = 10;
+ #endregion
+
+ private DockDragHandler m_dragHandler;
+
+ public DockIndicator(DockDragHandler dragHandler)
+ {
+ m_dragHandler = dragHandler;
+ Controls.AddRange(new Control[] {
+ PaneDiamond,
+ PanelLeft,
+ PanelRight,
+ PanelTop,
+ PanelBottom,
+ PanelFill
+ });
+ Region = new Region(Rectangle.Empty);
+ }
+
+ private PaneIndicator m_paneDiamond = null;
+ private PaneIndicator PaneDiamond
+ {
+ get
+ {
+ if (m_paneDiamond == null)
+ m_paneDiamond = new PaneIndicator();
+
+ return m_paneDiamond;
+ }
+ }
+
+ private PanelIndicator m_panelLeft = null;
+ private PanelIndicator PanelLeft
+ {
+ get
+ {
+ if (m_panelLeft == null)
+ m_panelLeft = new PanelIndicator(DockStyle.Left);
+
+ return m_panelLeft;
+ }
+ }
+
+ private PanelIndicator m_panelRight = null;
+ private PanelIndicator PanelRight
+ {
+ get
+ {
+ if (m_panelRight == null)
+ m_panelRight = new PanelIndicator(DockStyle.Right);
+
+ return m_panelRight;
+ }
+ }
+
+ private PanelIndicator m_panelTop = null;
+ private PanelIndicator PanelTop
+ {
+ get
+ {
+ if (m_panelTop == null)
+ m_panelTop = new PanelIndicator(DockStyle.Top);
+
+ return m_panelTop;
+ }
+ }
+
+ private PanelIndicator m_panelBottom = null;
+ private PanelIndicator PanelBottom
+ {
+ get
+ {
+ if (m_panelBottom == null)
+ m_panelBottom = new PanelIndicator(DockStyle.Bottom);
+
+ return m_panelBottom;
+ }
+ }
+
+ private PanelIndicator m_panelFill = null;
+ private PanelIndicator PanelFill
+ {
+ get
+ {
+ if (m_panelFill == null)
+ m_panelFill = new PanelIndicator(DockStyle.Fill);
+
+ return m_panelFill;
+ }
+ }
+
+ private bool m_fullPanelEdge = false;
+ public bool FullPanelEdge
+ {
+ get { return m_fullPanelEdge; }
+ set
+ {
+ if (m_fullPanelEdge == value)
+ return;
+
+ m_fullPanelEdge = value;
+ RefreshChanges();
+ }
+ }
+
+ public DockDragHandler DragHandler
+ {
+ get { return m_dragHandler; }
+ }
+
+ public DockPanel DockPanel
+ {
+ get { return DragHandler.DockPanel; }
+ }
+
+ private DockPane m_dockPane = null;
+ public DockPane DockPane
+ {
+ get { return m_dockPane; }
+ internal set
+ {
+ if (m_dockPane == value)
+ return;
+
+ DockPane oldDisplayingPane = DisplayingPane;
+ m_dockPane = value;
+ if (oldDisplayingPane != DisplayingPane)
+ RefreshChanges();
+ }
+ }
+
+ private IHitTest m_hitTest = null;
+ private IHitTest HitTestResult
+ {
+ get { return m_hitTest; }
+ set
+ {
+ if (m_hitTest == value)
+ return;
+
+ if (m_hitTest != null)
+ m_hitTest.Status = DockStyle.None;
+
+ m_hitTest = value;
+ }
+ }
+
+ private DockPane DisplayingPane
+ {
+ get { return ShouldPaneDiamondVisible() ? DockPane : null; }
+ }
+
+ private void RefreshChanges()
+ {
+ Region region = new Region(Rectangle.Empty);
+ Rectangle rectDockArea = FullPanelEdge ? DockPanel.DockArea : DockPanel.DocumentWindowBounds;
+
+ rectDockArea = RectangleToClient(DockPanel.RectangleToScreen(rectDockArea));
+ if (ShouldPanelIndicatorVisible(DockState.DockLeft))
+ {
+ PanelLeft.Location = new Point(rectDockArea.X + _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
+ PanelLeft.Visible = true;
+ region.Union(PanelLeft.Bounds);
+ }
+ else
+ PanelLeft.Visible = false;
+
+ if (ShouldPanelIndicatorVisible(DockState.DockRight))
+ {
+ PanelRight.Location = new Point(rectDockArea.X + rectDockArea.Width - PanelRight.Width - _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
+ PanelRight.Visible = true;
+ region.Union(PanelRight.Bounds);
+ }
+ else
+ PanelRight.Visible = false;
+
+ if (ShouldPanelIndicatorVisible(DockState.DockTop))
+ {
+ PanelTop.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelTop.Width) / 2, rectDockArea.Y + _PanelIndicatorMargin);
+ PanelTop.Visible = true;
+ region.Union(PanelTop.Bounds);
+ }
+ else
+ PanelTop.Visible = false;
+
+ if (ShouldPanelIndicatorVisible(DockState.DockBottom))
+ {
+ PanelBottom.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelBottom.Width) / 2, rectDockArea.Y + rectDockArea.Height - PanelBottom.Height - _PanelIndicatorMargin);
+ PanelBottom.Visible = true;
+ region.Union(PanelBottom.Bounds);
+ }
+ else
+ PanelBottom.Visible = false;
+
+ if (ShouldPanelIndicatorVisible(DockState.Document))
+ {
+ Rectangle rectDocumentWindow = RectangleToClient(DockPanel.RectangleToScreen(DockPanel.DocumentWindowBounds));
+ PanelFill.Location = new Point(rectDocumentWindow.X + (rectDocumentWindow.Width - PanelFill.Width) / 2, rectDocumentWindow.Y + (rectDocumentWindow.Height - PanelFill.Height) / 2);
+ PanelFill.Visible = true;
+ region.Union(PanelFill.Bounds);
+ }
+ else
+ PanelFill.Visible = false;
+
+ if (ShouldPaneDiamondVisible())
+ {
+ Rectangle rect = RectangleToClient(DockPane.RectangleToScreen(DockPane.ClientRectangle));
+ PaneDiamond.Location = new Point(rect.Left + (rect.Width - PaneDiamond.Width) / 2, rect.Top + (rect.Height - PaneDiamond.Height) / 2);
+ PaneDiamond.Visible = true;
+ using (GraphicsPath graphicsPath = PaneIndicator.DisplayingGraphicsPath.Clone() as GraphicsPath)
+ {
+ Point[] pts = new Point[]
+ {
+ new Point(PaneDiamond.Left, PaneDiamond.Top),
+ new Point(PaneDiamond.Right, PaneDiamond.Top),
+ new Point(PaneDiamond.Left, PaneDiamond.Bottom)
+ };
+ using (Matrix matrix = new Matrix(PaneDiamond.ClientRectangle, pts))
+ {
+ graphicsPath.Transform(matrix);
+ }
+ region.Union(graphicsPath);
+ }
+ }
+ else
+ PaneDiamond.Visible = false;
+
+ Region = region;
+ }
+
+ private bool ShouldPanelIndicatorVisible(DockState dockState)
+ {
+ if (!Visible)
+ return false;
+
+ if (DockPanel.DockWindows[dockState].Visible)
+ return false;
+
+ return DragHandler.DragSource.IsDockStateValid(dockState);
+ }
+
+ private bool ShouldPaneDiamondVisible()
+ {
+ if (DockPane == null)
+ return false;
+
+ if (!DockPanel.AllowEndUserNestedDocking)
+ return false;
+
+ return DragHandler.DragSource.CanDockTo(DockPane);
+ }
+
+ public override void Show(bool bActivate)
+ {
+ base.Show(bActivate);
+ Bounds = SystemInformation.VirtualScreen;
+ RefreshChanges();
+ }
+
+ public void TestDrop()
+ {
+ Point pt = Control.MousePosition;
+ DockPane = DockHelper.PaneAtPoint(pt, DockPanel);
+
+ if (TestDrop(PanelLeft, pt) != DockStyle.None)
+ HitTestResult = PanelLeft;
+ else if (TestDrop(PanelRight, pt) != DockStyle.None)
+ HitTestResult = PanelRight;
+ else if (TestDrop(PanelTop, pt) != DockStyle.None)
+ HitTestResult = PanelTop;
+ else if (TestDrop(PanelBottom, pt) != DockStyle.None)
+ HitTestResult = PanelBottom;
+ else if (TestDrop(PanelFill, pt) != DockStyle.None)
+ HitTestResult = PanelFill;
+ else if (TestDrop(PaneDiamond, pt) != DockStyle.None)
+ HitTestResult = PaneDiamond;
+ else
+ HitTestResult = null;
+
+ if (HitTestResult != null)
+ {
+ if (HitTestResult is PaneIndicator)
+ DragHandler.Outline.Show(DockPane, HitTestResult.Status);
+ else
+ DragHandler.Outline.Show(DockPanel, HitTestResult.Status, FullPanelEdge);
+ }
+ }
+
+ private static DockStyle TestDrop(IHitTest hitTest, Point pt)
+ {
+ return hitTest.Status = hitTest.HitTest(pt);
+ }
+ }
+
+ private class DockOutline : DockOutlineBase
+ {
+ public DockOutline()
+ {
+ m_dragForm = new DragForm();
+ SetDragForm(Rectangle.Empty);
+ DragForm.BackColor = SystemColors.ActiveCaption;
+ DragForm.Opacity = 0.5;
+ DragForm.Show(false);
+ }
+
+ DragForm m_dragForm;
+ private DragForm DragForm
+ {
+ get { return m_dragForm; }
+ }
+
+ protected override void OnShow()
+ {
+ CalculateRegion();
+ }
+
+ protected override void OnClose()
+ {
+ DragForm.Close();
+ }
+
+ private void CalculateRegion()
+ {
+ if (SameAsOldValue)
+ return;
+
+ if (!FloatWindowBounds.IsEmpty)
+ SetOutline(FloatWindowBounds);
+ else if (DockTo is DockPanel)
+ SetOutline(DockTo as DockPanel, Dock, (ContentIndex != 0));
+ else if (DockTo is DockPane)
+ SetOutline(DockTo as DockPane, Dock, ContentIndex);
+ else
+ SetOutline();
+ }
+
+ private void SetOutline()
+ {
+ SetDragForm(Rectangle.Empty);
+ }
+
+ private void SetOutline(Rectangle floatWindowBounds)
+ {
+ SetDragForm(floatWindowBounds);
+ }
+
+ private void SetOutline(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge)
+ {
+ Rectangle rect = fullPanelEdge ? dockPanel.DockArea : dockPanel.DocumentWindowBounds;
+ rect.Location = dockPanel.PointToScreen(rect.Location);
+ if (dock == DockStyle.Top)
+ {
+ int height = dockPanel.GetDockWindowSize(DockState.DockTop);
+ rect = new Rectangle(rect.X, rect.Y, rect.Width, height);
+ }
+ else if (dock == DockStyle.Bottom)
+ {
+ int height = dockPanel.GetDockWindowSize(DockState.DockBottom);
+ rect = new Rectangle(rect.X, rect.Bottom - height, rect.Width, height);
+ }
+ else if (dock == DockStyle.Left)
+ {
+ int width = dockPanel.GetDockWindowSize(DockState.DockLeft);
+ rect = new Rectangle(rect.X, rect.Y, width, rect.Height);
+ }
+ else if (dock == DockStyle.Right)
+ {
+ int width = dockPanel.GetDockWindowSize(DockState.DockRight);
+ rect = new Rectangle(rect.Right - width, rect.Y, width, rect.Height);
+ }
+ else if (dock == DockStyle.Fill)
+ {
+ rect = dockPanel.DocumentWindowBounds;
+ rect.Location = dockPanel.PointToScreen(rect.Location);
+ }
+
+ SetDragForm(rect);
+ }
+
+ private void SetOutline(DockPane pane, DockStyle dock, int contentIndex)
+ {
+ if (dock != DockStyle.Fill)
+ {
+ Rectangle rect = pane.DisplayingRectangle;
+ if (dock == DockStyle.Right)
+ rect.X += rect.Width / 2;
+ if (dock == DockStyle.Bottom)
+ rect.Y += rect.Height / 2;
+ if (dock == DockStyle.Left || dock == DockStyle.Right)
+ rect.Width -= rect.Width / 2;
+ if (dock == DockStyle.Top || dock == DockStyle.Bottom)
+ rect.Height -= rect.Height / 2;
+ rect.Location = pane.PointToScreen(rect.Location);
+
+ SetDragForm(rect);
+ }
+ else if (contentIndex == -1)
+ {
+ Rectangle rect = pane.DisplayingRectangle;
+ rect.Location = pane.PointToScreen(rect.Location);
+ SetDragForm(rect);
+ }
+ else
+ {
+ using (GraphicsPath path = pane.TabStripControl.GetOutline(contentIndex))
+ {
+ RectangleF rectF = path.GetBounds();
+ Rectangle rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
+ using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) }))
+ {
+ path.Transform(matrix);
+ }
+ Region region = new Region(path);
+ SetDragForm(rect, region);
+ }
+ }
+ }
+
+ private void SetDragForm(Rectangle rect)
+ {
+ DragForm.Bounds = rect;
+ if (rect == Rectangle.Empty)
+ DragForm.Region = new Region(Rectangle.Empty);
+ else if (DragForm.Region != null)
+ DragForm.Region = null;
+ }
+
+ private void SetDragForm(Rectangle rect, Region region)
+ {
+ DragForm.Bounds = rect;
+ DragForm.Region = region;
+ }
+ }
+
+ public DockDragHandler(DockPanel panel)
+ : base(panel)
+ {
+ }
+
+ public new IDockDragSource DragSource
+ {
+ get { return base.DragSource as IDockDragSource; }
+ set { base.DragSource = value; }
+ }
+
+ private DockOutlineBase m_outline;
+ public DockOutlineBase Outline
+ {
+ get { return m_outline; }
+ private set { m_outline = value; }
+ }
+
+ private DockIndicator m_indicator;
+ private DockIndicator Indicator
+ {
+ get { return m_indicator; }
+ set { m_indicator = value; }
+ }
+
+ private Rectangle m_floatOutlineBounds;
+ private Rectangle FloatOutlineBounds
+ {
+ get { return m_floatOutlineBounds; }
+ set { m_floatOutlineBounds = value; }
+ }
+
+ public void BeginDrag(IDockDragSource dragSource)
+ {
+ DragSource = dragSource;
+
+ if (!BeginDrag())
+ {
+ DragSource = null;
+ return;
+ }
+
+ Outline = new DockOutline();
+ Indicator = new DockIndicator(this);
+ Indicator.Show(false);
+
+ FloatOutlineBounds = DragSource.BeginDrag(StartMousePosition);
+ }
+
+ protected override void OnDragging()
+ {
+ TestDrop();
+ }
+
+ protected override void OnEndDrag(bool abort)
+ {
+ DockPanel.SuspendLayout(true);
+
+ Outline.Close();
+ Indicator.Close();
+
+ EndDrag(abort);
+
+ // Queue a request to layout all children controls
+ DockPanel.PerformMdiClientLayout();
+
+ DockPanel.ResumeLayout(true, true);
+
+ DragSource = null;
+ }
+
+ private void TestDrop()
+ {
+ Outline.FlagTestDrop = false;
+
+ Indicator.FullPanelEdge = ((Control.ModifierKeys & Keys.Shift) != 0);
+
+ if ((Control.ModifierKeys & Keys.Control) == 0)
+ {
+ Indicator.TestDrop();
+
+ if (!Outline.FlagTestDrop)
+ {
+ DockPane pane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel);
+ if (pane != null && DragSource.IsDockStateValid(pane.DockState))
+ pane.TestDrop(DragSource, Outline);
+ }
+
+ if (!Outline.FlagTestDrop && DragSource.IsDockStateValid(DockState.Float))
+ {
+ FloatWindow floatWindow = DockHelper.FloatWindowAtPoint(Control.MousePosition, DockPanel);
+ if (floatWindow != null)
+ floatWindow.TestDrop(DragSource, Outline);
+ }
+ }
+ else
+ Indicator.DockPane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel);
+
+ if (!Outline.FlagTestDrop)
+ {
+ if (DragSource.IsDockStateValid(DockState.Float))
+ {
+ Rectangle rect = FloatOutlineBounds;
+ rect.Offset(Control.MousePosition.X - StartMousePosition.X, Control.MousePosition.Y - StartMousePosition.Y);
+ Outline.Show(rect);
+ }
+ }
+
+ if (!Outline.FlagTestDrop)
+ {
+ Cursor.Current = Cursors.No;
+ Outline.Show();
+ }
+ else
+ Cursor.Current = DragControl.Cursor;
+ }
+
+ private void EndDrag(bool abort)
+ {
+ if (abort)
+ return;
+
+ if (!Outline.FloatWindowBounds.IsEmpty)
+ DragSource.FloatAt(Outline.FloatWindowBounds);
+ else if (Outline.DockTo is DockPane)
+ {
+ DockPane pane = Outline.DockTo as DockPane;
+ DragSource.DockTo(pane, Outline.Dock, Outline.ContentIndex);
+ }
+ else if (Outline.DockTo is DockPanel)
+ {
+ DockPanel panel = Outline.DockTo as DockPanel;
+ panel.UpdateDockWindowZOrder(Outline.Dock, Outline.FlagFullEdge);
+ DragSource.DockTo(panel, Outline.Dock);
+ }
+ }
+ }
+
+ private DockDragHandler m_dockDragHandler = null;
+ private DockDragHandler GetDockDragHandler()
+ {
+ if (m_dockDragHandler == null)
+ m_dockDragHandler = new DockDragHandler(this);
+ return m_dockDragHandler;
+ }
+
+ internal void BeginDrag(IDockDragSource dragSource)
+ {
+ GetDockDragHandler().BeginDrag(dragSource);
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanel.DragHandler.cs b/source/Docking/DockPanel.DragHandler.cs
similarity index 96%
rename from trunk/Docking/DockPanel.DragHandler.cs
rename to source/Docking/DockPanel.DragHandler.cs
index 370572a..8f44aa0 100644
--- a/trunk/Docking/DockPanel.DragHandler.cs
+++ b/source/Docking/DockPanel.DragHandler.cs
@@ -1,135 +1,135 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.ComponentModel;
-
-namespace LSLEditor.Docking
-{
- partial class DockPanel
- {
- ///
- /// DragHandlerBase is the base class for drag handlers. The derived class should:
- /// 1. Define its public method BeginDrag. From within this public BeginDrag method,
- /// DragHandlerBase.BeginDrag should be called to initialize the mouse capture
- /// and message filtering.
- /// 2. Override the OnDragging and OnEndDrag methods.
- ///
- private abstract class DragHandlerBase : NativeWindow, IMessageFilter
- {
- protected DragHandlerBase()
- {
- }
-
- protected abstract Control DragControl
- {
- get;
- }
-
- private Point m_startMousePosition = Point.Empty;
- protected Point StartMousePosition
- {
- get { return m_startMousePosition; }
- private set { m_startMousePosition = value; }
- }
-
- protected bool BeginDrag()
- {
- // Avoid re-entrance;
- lock (this)
- {
- if (DragControl == null)
- return false;
-
- StartMousePosition = Control.MousePosition;
-
- if (!NativeMethods.DragDetect(DragControl.Handle, StartMousePosition))
- return false;
-
- DragControl.FindForm().Capture = true;
- AssignHandle(DragControl.FindForm().Handle);
- Application.AddMessageFilter(this);
- return true;
- }
- }
-
- protected abstract void OnDragging();
-
- protected abstract void OnEndDrag(bool abort);
-
- private void EndDrag(bool abort)
- {
- ReleaseHandle();
- Application.RemoveMessageFilter(this);
- DragControl.FindForm().Capture = false;
-
- OnEndDrag(abort);
- }
-
- bool IMessageFilter.PreFilterMessage(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_MOUSEMOVE)
- OnDragging();
- else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONUP)
- EndDrag(false);
- else if (m.Msg == (int)Win32.Msgs.WM_CAPTURECHANGED)
- EndDrag(true);
- else if (m.Msg == (int)Win32.Msgs.WM_KEYDOWN && (int)m.WParam == (int)Keys.Escape)
- EndDrag(true);
-
- return OnPreFilterMessage(ref m);
- }
-
- protected virtual bool OnPreFilterMessage(ref Message m)
- {
- return false;
- }
-
- protected sealed override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_CANCELMODE || m.Msg == (int)Win32.Msgs.WM_CAPTURECHANGED)
- EndDrag(true);
-
- base.WndProc(ref m);
- }
- }
-
- private abstract class DragHandler : DragHandlerBase
- {
- private DockPanel m_dockPanel;
-
- protected DragHandler(DockPanel dockPanel)
- {
- m_dockPanel = dockPanel;
- }
-
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- private IDragSource m_dragSource;
- protected IDragSource DragSource
- {
- get { return m_dragSource; }
- set { m_dragSource = value; }
- }
-
- protected sealed override Control DragControl
- {
- get { return DragSource == null ? null : DragSource.DragControl; }
- }
-
- protected sealed override bool OnPreFilterMessage(ref Message m)
- {
- if ((m.Msg == (int)Win32.Msgs.WM_KEYDOWN || m.Msg == (int)Win32.Msgs.WM_KEYUP) &&
- ((int)m.WParam == (int)Keys.ControlKey || (int)m.WParam == (int)Keys.ShiftKey))
- OnDragging();
-
- return base.OnPreFilterMessage(ref m);
- }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.ComponentModel;
+
+namespace LSLEditor.Docking
+{
+ partial class DockPanel
+ {
+ ///
+ /// DragHandlerBase is the base class for drag handlers. The derived class should:
+ /// 1. Define its public method BeginDrag. From within this public BeginDrag method,
+ /// DragHandlerBase.BeginDrag should be called to initialize the mouse capture
+ /// and message filtering.
+ /// 2. Override the OnDragging and OnEndDrag methods.
+ ///
+ private abstract class DragHandlerBase : NativeWindow, IMessageFilter
+ {
+ protected DragHandlerBase()
+ {
+ }
+
+ protected abstract Control DragControl
+ {
+ get;
+ }
+
+ private Point m_startMousePosition = Point.Empty;
+ protected Point StartMousePosition
+ {
+ get { return m_startMousePosition; }
+ private set { m_startMousePosition = value; }
+ }
+
+ protected bool BeginDrag()
+ {
+ // Avoid re-entrance;
+ lock (this)
+ {
+ if (DragControl == null)
+ return false;
+
+ StartMousePosition = Control.MousePosition;
+
+ if (!NativeMethods.DragDetect(DragControl.Handle, StartMousePosition))
+ return false;
+
+ DragControl.FindForm().Capture = true;
+ AssignHandle(DragControl.FindForm().Handle);
+ Application.AddMessageFilter(this);
+ return true;
+ }
+ }
+
+ protected abstract void OnDragging();
+
+ protected abstract void OnEndDrag(bool abort);
+
+ private void EndDrag(bool abort)
+ {
+ ReleaseHandle();
+ Application.RemoveMessageFilter(this);
+ DragControl.FindForm().Capture = false;
+
+ OnEndDrag(abort);
+ }
+
+ bool IMessageFilter.PreFilterMessage(ref Message m)
+ {
+ if (m.Msg == (int)Win32.Msgs.WM_MOUSEMOVE)
+ OnDragging();
+ else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONUP)
+ EndDrag(false);
+ else if (m.Msg == (int)Win32.Msgs.WM_CAPTURECHANGED)
+ EndDrag(true);
+ else if (m.Msg == (int)Win32.Msgs.WM_KEYDOWN && (int)m.WParam == (int)Keys.Escape)
+ EndDrag(true);
+
+ return OnPreFilterMessage(ref m);
+ }
+
+ protected virtual bool OnPreFilterMessage(ref Message m)
+ {
+ return false;
+ }
+
+ protected sealed override void WndProc(ref Message m)
+ {
+ if (m.Msg == (int)Win32.Msgs.WM_CANCELMODE || m.Msg == (int)Win32.Msgs.WM_CAPTURECHANGED)
+ EndDrag(true);
+
+ base.WndProc(ref m);
+ }
+ }
+
+ private abstract class DragHandler : DragHandlerBase
+ {
+ private DockPanel m_dockPanel;
+
+ protected DragHandler(DockPanel dockPanel)
+ {
+ m_dockPanel = dockPanel;
+ }
+
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ private IDragSource m_dragSource;
+ protected IDragSource DragSource
+ {
+ get { return m_dragSource; }
+ set { m_dragSource = value; }
+ }
+
+ protected sealed override Control DragControl
+ {
+ get { return DragSource == null ? null : DragSource.DragControl; }
+ }
+
+ protected sealed override bool OnPreFilterMessage(ref Message m)
+ {
+ if ((m.Msg == (int)Win32.Msgs.WM_KEYDOWN || m.Msg == (int)Win32.Msgs.WM_KEYUP) &&
+ ((int)m.WParam == (int)Keys.ControlKey || (int)m.WParam == (int)Keys.ShiftKey))
+ OnDragging();
+
+ return base.OnPreFilterMessage(ref m);
+ }
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanel.FocusManager.cs b/source/Docking/DockPanel.FocusManager.cs
similarity index 97%
rename from trunk/Docking/DockPanel.FocusManager.cs
rename to source/Docking/DockPanel.FocusManager.cs
index d967b58..b320dce 100644
--- a/trunk/Docking/DockPanel.FocusManager.cs
+++ b/source/Docking/DockPanel.FocusManager.cs
@@ -1,568 +1,568 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.ComponentModel;
-using System.Runtime.InteropServices;
-using System.Windows.Forms;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- internal interface IContentFocusManager
- {
- void Activate(IDockContent content);
- void GiveUpFocus(IDockContent content);
- void AddToList(IDockContent content);
- void RemoveFromList(IDockContent content);
- }
-
- partial class DockPanel
- {
- private interface IFocusManager
- {
- void SuspendFocusTracking();
- void ResumeFocusTracking();
- bool IsFocusTrackingSuspended { get; }
- IDockContent ActiveContent { get; }
- DockPane ActivePane { get; }
- IDockContent ActiveDocument { get; }
- DockPane ActiveDocumentPane { get; }
- }
-
- private class FocusManagerImpl : Component, IContentFocusManager, IFocusManager
- {
- private class HookEventArgs : EventArgs
- {
- [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
- public int HookCode;
- [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
- public IntPtr wParam;
- public IntPtr lParam;
- }
-
- private class LocalWindowsHook : IDisposable
- {
- // Internal properties
- private IntPtr m_hHook = IntPtr.Zero;
- private NativeMethods.HookProc m_filterFunc = null;
- private Win32.HookType m_hookType;
-
- // Event delegate
- public delegate void HookEventHandler(object sender, HookEventArgs e);
-
- // Event: HookInvoked
- public event HookEventHandler HookInvoked;
- protected void OnHookInvoked(HookEventArgs e)
- {
- if (HookInvoked != null)
- HookInvoked(this, e);
- }
-
- public LocalWindowsHook(Win32.HookType hook)
- {
- m_hookType = hook;
- m_filterFunc = new NativeMethods.HookProc(this.CoreHookProc);
- }
-
- // Default filter function
- public IntPtr CoreHookProc(int code, IntPtr wParam, IntPtr lParam)
- {
- if (code < 0)
- return NativeMethods.CallNextHookEx(m_hHook, code, wParam, lParam);
-
- // Let clients determine what to do
- HookEventArgs e = new HookEventArgs();
- e.HookCode = code;
- e.wParam = wParam;
- e.lParam = lParam;
- OnHookInvoked(e);
-
- // Yield to the next hook in the chain
- return NativeMethods.CallNextHookEx(m_hHook, code, wParam, lParam);
- }
-
- // Install the hook
- public void Install()
- {
- if (m_hHook != IntPtr.Zero)
- Uninstall();
-
- int threadId = NativeMethods.GetCurrentThreadId();
- m_hHook = NativeMethods.SetWindowsHookEx(m_hookType, m_filterFunc, IntPtr.Zero, threadId);
- }
-
- // Uninstall the hook
- public void Uninstall()
- {
- if (m_hHook != IntPtr.Zero)
- {
- NativeMethods.UnhookWindowsHookEx(m_hHook);
- m_hHook = IntPtr.Zero;
- }
- }
-
- ~LocalWindowsHook()
- {
- Dispose(false);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- Uninstall();
- }
- }
-
- private LocalWindowsHook m_localWindowsHook;
- private LocalWindowsHook.HookEventHandler m_hookEventHandler;
-
- public FocusManagerImpl(DockPanel dockPanel)
- {
- m_dockPanel = dockPanel;
- m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET);
- m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler);
- m_localWindowsHook.HookInvoked += m_hookEventHandler;
- m_localWindowsHook.Install();
- }
-
- private DockPanel m_dockPanel;
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- private bool m_disposed = false;
- protected override void Dispose(bool disposing)
- {
- lock (this)
- {
- if (!m_disposed && disposing)
- {
- m_localWindowsHook.Dispose();
- m_disposed = true;
- }
-
- base.Dispose(disposing);
- }
- }
-
- private IDockContent m_contentActivating = null;
- private IDockContent ContentActivating
- {
- get { return m_contentActivating; }
- set { m_contentActivating = value; }
- }
-
- public void Activate(IDockContent content)
- {
- if (IsFocusTrackingSuspended)
- {
- ContentActivating = content;
- return;
- }
-
- if (content == null)
- return;
- DockContentHandler handler = content.DockHandler;
- if (handler.Form.IsDisposed)
- return; // Should not reach here, but better than throwing an exception
- if (ContentContains(content, handler.ActiveWindowHandle))
- NativeMethods.SetFocus(handler.ActiveWindowHandle);
- if (!handler.Form.ContainsFocus)
- {
- if (!handler.Form.SelectNextControl(handler.Form.ActiveControl, true, true, true, true))
- // Since DockContent Form is not selectalbe, use Win32 SetFocus instead
- NativeMethods.SetFocus(handler.Form.Handle);
- }
- }
-
- private List m_listContent = new List();
- private List ListContent
- {
- get { return m_listContent; }
- }
- public void AddToList(IDockContent content)
- {
- if (ListContent.Contains(content) || IsInActiveList(content))
- return;
-
- ListContent.Add(content);
- }
-
- public void RemoveFromList(IDockContent content)
- {
- if (IsInActiveList(content))
- RemoveFromActiveList(content);
- if (ListContent.Contains(content))
- ListContent.Remove(content);
- }
-
- private IDockContent m_lastActiveContent = null;
- private IDockContent LastActiveContent
- {
- get { return m_lastActiveContent; }
- set { m_lastActiveContent = value; }
- }
-
- private bool IsInActiveList(IDockContent content)
- {
- return !(content.DockHandler.NextActive == null && LastActiveContent != content);
- }
-
- private void AddLastToActiveList(IDockContent content)
- {
- IDockContent last = LastActiveContent;
- if (last == content)
- return;
-
- DockContentHandler handler = content.DockHandler;
-
- if (IsInActiveList(content))
- RemoveFromActiveList(content);
-
- handler.PreviousActive = last;
- handler.NextActive = null;
- LastActiveContent = content;
- if (last != null)
- last.DockHandler.NextActive = LastActiveContent;
- }
-
- private void RemoveFromActiveList(IDockContent content)
- {
- if (LastActiveContent == content)
- LastActiveContent = content.DockHandler.PreviousActive;
-
- IDockContent prev = content.DockHandler.PreviousActive;
- IDockContent next = content.DockHandler.NextActive;
- if (prev != null)
- prev.DockHandler.NextActive = next;
- if (next != null)
- next.DockHandler.PreviousActive = prev;
-
- content.DockHandler.PreviousActive = null;
- content.DockHandler.NextActive = null;
- }
-
- public void GiveUpFocus(IDockContent content)
- {
- DockContentHandler handler = content.DockHandler;
- if (!handler.Form.ContainsFocus)
- return;
-
- if (IsFocusTrackingSuspended)
- DockPanel.DummyControl.Focus();
-
- if (LastActiveContent == content)
- {
- IDockContent prev = handler.PreviousActive;
- if (prev != null)
- Activate(prev);
- else if (ListContent.Count > 0)
- Activate(ListContent[ListContent.Count - 1]);
- }
- else if (LastActiveContent != null)
- Activate(LastActiveContent);
- else if (ListContent.Count > 0)
- Activate(ListContent[ListContent.Count - 1]);
- }
-
- private static bool ContentContains(IDockContent content, IntPtr hWnd)
- {
- Control control = Control.FromChildHandle(hWnd);
- for (Control parent = control; parent != null; parent = parent.Parent)
- if (parent == content.DockHandler.Form)
- return true;
-
- return false;
- }
-
- private int m_countSuspendFocusTracking = 0;
- public void SuspendFocusTracking()
- {
- m_countSuspendFocusTracking++;
- m_localWindowsHook.HookInvoked -= m_hookEventHandler;
- }
-
- public void ResumeFocusTracking()
- {
- if (m_countSuspendFocusTracking > 0)
- m_countSuspendFocusTracking--;
-
- if (m_countSuspendFocusTracking == 0)
- {
- if (ContentActivating != null)
- {
- Activate(ContentActivating);
- ContentActivating = null;
- }
- m_localWindowsHook.HookInvoked += m_hookEventHandler;
- if (!InRefreshActiveWindow)
- RefreshActiveWindow();
- }
- }
-
- public bool IsFocusTrackingSuspended
- {
- get { return m_countSuspendFocusTracking != 0; }
- }
-
- // Windows hook event handler
- private void HookEventHandler(object sender, HookEventArgs e)
- {
- Win32.Msgs msg = (Win32.Msgs)Marshal.ReadInt32(e.lParam, IntPtr.Size * 3);
-
- if (msg == Win32.Msgs.WM_KILLFOCUS)
- {
- IntPtr wParam = Marshal.ReadIntPtr(e.lParam, IntPtr.Size * 2);
- DockPane pane = GetPaneFromHandle(wParam);
- if (pane == null)
- RefreshActiveWindow();
- }
- else if (msg == Win32.Msgs.WM_SETFOCUS)
- RefreshActiveWindow();
- }
-
- private DockPane GetPaneFromHandle(IntPtr hWnd)
- {
- Control control = Control.FromChildHandle(hWnd);
-
- IDockContent content = null;
- DockPane pane = null;
- for (; control != null; control = control.Parent)
- {
- content = control as IDockContent;
- if (content != null)
- content.DockHandler.ActiveWindowHandle = hWnd;
-
- if (content != null && content.DockHandler.DockPanel == DockPanel)
- return content.DockHandler.Pane;
-
- pane = control as DockPane;
- if (pane != null && pane.DockPanel == DockPanel)
- break;
- }
-
- return pane;
- }
-
- private bool m_inRefreshActiveWindow = false;
- private bool InRefreshActiveWindow
- {
- get { return m_inRefreshActiveWindow; }
- }
-
- private void RefreshActiveWindow()
- {
- SuspendFocusTracking();
- m_inRefreshActiveWindow = true;
-
- DockPane oldActivePane = ActivePane;
- IDockContent oldActiveContent = ActiveContent;
- IDockContent oldActiveDocument = ActiveDocument;
-
- SetActivePane();
- SetActiveContent();
- SetActiveDocumentPane();
- SetActiveDocument();
- DockPanel.AutoHideWindow.RefreshActivePane();
-
- ResumeFocusTracking();
- m_inRefreshActiveWindow = false;
-
- if (oldActiveContent != ActiveContent)
- DockPanel.OnActiveContentChanged(EventArgs.Empty);
- if (oldActiveDocument != ActiveDocument)
- DockPanel.OnActiveDocumentChanged(EventArgs.Empty);
- if (oldActivePane != ActivePane)
- DockPanel.OnActivePaneChanged(EventArgs.Empty);
- }
-
- private DockPane m_activePane = null;
- public DockPane ActivePane
- {
- get { return m_activePane; }
- }
-
- private void SetActivePane()
- {
- DockPane value = GetPaneFromHandle(NativeMethods.GetFocus());
- if (m_activePane == value)
- return;
-
- if (m_activePane != null)
- m_activePane.SetIsActivated(false);
-
- m_activePane = value;
-
- if (m_activePane != null)
- m_activePane.SetIsActivated(true);
- }
-
- private IDockContent m_activeContent = null;
- public IDockContent ActiveContent
- {
- get { return m_activeContent; }
- }
-
- internal void SetActiveContent()
- {
- IDockContent value = ActivePane == null ? null : ActivePane.ActiveContent;
-
- if (m_activeContent == value)
- return;
-
- if (m_activeContent != null)
- m_activeContent.DockHandler.IsActivated = false;
-
- m_activeContent = value;
-
- if (m_activeContent != null)
- {
- m_activeContent.DockHandler.IsActivated = true;
- if (!DockHelper.IsDockStateAutoHide((m_activeContent.DockHandler.DockState)))
- AddLastToActiveList(m_activeContent);
- }
- }
-
- private DockPane m_activeDocumentPane = null;
- public DockPane ActiveDocumentPane
- {
- get { return m_activeDocumentPane; }
- }
-
- private void SetActiveDocumentPane()
- {
- DockPane value = null;
-
- if (ActivePane != null && ActivePane.DockState == DockState.Document)
- value = ActivePane;
-
- if (value == null && DockPanel.DockWindows != null)
- {
- if (ActiveDocumentPane == null)
- value = DockPanel.DockWindows[DockState.Document].DefaultPane;
- else if (ActiveDocumentPane.DockPanel != DockPanel || ActiveDocumentPane.DockState != DockState.Document)
- value = DockPanel.DockWindows[DockState.Document].DefaultPane;
- else
- value = ActiveDocumentPane;
- }
-
- if (m_activeDocumentPane == value)
- return;
-
- if (m_activeDocumentPane != null)
- m_activeDocumentPane.SetIsActiveDocumentPane(false);
-
- m_activeDocumentPane = value;
-
- if (m_activeDocumentPane != null)
- m_activeDocumentPane.SetIsActiveDocumentPane(true);
- }
-
- private IDockContent m_activeDocument = null;
- public IDockContent ActiveDocument
- {
- get { return m_activeDocument; }
- }
-
- private void SetActiveDocument()
- {
- IDockContent value = ActiveDocumentPane == null ? null : ActiveDocumentPane.ActiveContent;
-
- if (m_activeDocument == value)
- return;
-
- m_activeDocument = value;
- }
- }
-
- private IFocusManager FocusManager
- {
- get { return m_focusManager; }
- }
-
- internal IContentFocusManager ContentFocusManager
- {
- get { return m_focusManager; }
- }
-
- internal void SaveFocus()
- {
- DummyControl.Focus();
- }
-
- [Browsable(false)]
- public IDockContent ActiveContent
- {
- get { return FocusManager.ActiveContent; }
- }
-
- [Browsable(false)]
- public DockPane ActivePane
- {
- get { return FocusManager.ActivePane; }
- }
-
- [Browsable(false)]
- public IDockContent ActiveDocument
- {
- get { return FocusManager.ActiveDocument; }
- }
-
- [Browsable(false)]
- public DockPane ActiveDocumentPane
- {
- get { return FocusManager.ActiveDocumentPane; }
- }
-
- private static readonly object ActiveDocumentChangedEvent = new object();
- [LocalizedCategory("Category_PropertyChanged")]
- [LocalizedDescription("DockPanel_ActiveDocumentChanged_Description")]
- public event EventHandler ActiveDocumentChanged
- {
- add { Events.AddHandler(ActiveDocumentChangedEvent, value); }
- remove { Events.RemoveHandler(ActiveDocumentChangedEvent, value); }
- }
- protected virtual void OnActiveDocumentChanged(EventArgs e)
- {
- EventHandler handler = (EventHandler)Events[ActiveDocumentChangedEvent];
- if (handler != null)
- handler(this, e);
- }
-
- private static readonly object ActiveContentChangedEvent = new object();
- [LocalizedCategory("Category_PropertyChanged")]
- [LocalizedDescription("DockPanel_ActiveContentChanged_Description")]
- public event EventHandler ActiveContentChanged
- {
- add { Events.AddHandler(ActiveContentChangedEvent, value); }
- remove { Events.RemoveHandler(ActiveContentChangedEvent, value); }
- }
- protected void OnActiveContentChanged(EventArgs e)
- {
- EventHandler handler = (EventHandler)Events[ActiveContentChangedEvent];
- if (handler != null)
- handler(this, e);
- }
-
- private static readonly object ActivePaneChangedEvent = new object();
- [LocalizedCategory("Category_PropertyChanged")]
- [LocalizedDescription("DockPanel_ActivePaneChanged_Description")]
- public event EventHandler ActivePaneChanged
- {
- add { Events.AddHandler(ActivePaneChangedEvent, value); }
- remove { Events.RemoveHandler(ActivePaneChangedEvent, value); }
- }
- protected virtual void OnActivePaneChanged(EventArgs e)
- {
- EventHandler handler = (EventHandler)Events[ActivePaneChangedEvent];
- if (handler != null)
- handler(this, e);
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ internal interface IContentFocusManager
+ {
+ void Activate(IDockContent content);
+ void GiveUpFocus(IDockContent content);
+ void AddToList(IDockContent content);
+ void RemoveFromList(IDockContent content);
+ }
+
+ partial class DockPanel
+ {
+ private interface IFocusManager
+ {
+ void SuspendFocusTracking();
+ void ResumeFocusTracking();
+ bool IsFocusTrackingSuspended { get; }
+ IDockContent ActiveContent { get; }
+ DockPane ActivePane { get; }
+ IDockContent ActiveDocument { get; }
+ DockPane ActiveDocumentPane { get; }
+ }
+
+ private class FocusManagerImpl : Component, IContentFocusManager, IFocusManager
+ {
+ private class HookEventArgs : EventArgs
+ {
+ [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+ public int HookCode;
+ [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+ public IntPtr wParam;
+ public IntPtr lParam;
+ }
+
+ private class LocalWindowsHook : IDisposable
+ {
+ // Internal properties
+ private IntPtr m_hHook = IntPtr.Zero;
+ private NativeMethods.HookProc m_filterFunc = null;
+ private Win32.HookType m_hookType;
+
+ // Event delegate
+ public delegate void HookEventHandler(object sender, HookEventArgs e);
+
+ // Event: HookInvoked
+ public event HookEventHandler HookInvoked;
+ protected void OnHookInvoked(HookEventArgs e)
+ {
+ if (HookInvoked != null)
+ HookInvoked(this, e);
+ }
+
+ public LocalWindowsHook(Win32.HookType hook)
+ {
+ m_hookType = hook;
+ m_filterFunc = new NativeMethods.HookProc(this.CoreHookProc);
+ }
+
+ // Default filter function
+ public IntPtr CoreHookProc(int code, IntPtr wParam, IntPtr lParam)
+ {
+ if (code < 0)
+ return NativeMethods.CallNextHookEx(m_hHook, code, wParam, lParam);
+
+ // Let clients determine what to do
+ HookEventArgs e = new HookEventArgs();
+ e.HookCode = code;
+ e.wParam = wParam;
+ e.lParam = lParam;
+ OnHookInvoked(e);
+
+ // Yield to the next hook in the chain
+ return NativeMethods.CallNextHookEx(m_hHook, code, wParam, lParam);
+ }
+
+ // Install the hook
+ public void Install()
+ {
+ if (m_hHook != IntPtr.Zero)
+ Uninstall();
+
+ int threadId = NativeMethods.GetCurrentThreadId();
+ m_hHook = NativeMethods.SetWindowsHookEx(m_hookType, m_filterFunc, IntPtr.Zero, threadId);
+ }
+
+ // Uninstall the hook
+ public void Uninstall()
+ {
+ if (m_hHook != IntPtr.Zero)
+ {
+ NativeMethods.UnhookWindowsHookEx(m_hHook);
+ m_hHook = IntPtr.Zero;
+ }
+ }
+
+ ~LocalWindowsHook()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ Uninstall();
+ }
+ }
+
+ private LocalWindowsHook m_localWindowsHook;
+ private LocalWindowsHook.HookEventHandler m_hookEventHandler;
+
+ public FocusManagerImpl(DockPanel dockPanel)
+ {
+ m_dockPanel = dockPanel;
+ m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET);
+ m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler);
+ m_localWindowsHook.HookInvoked += m_hookEventHandler;
+ m_localWindowsHook.Install();
+ }
+
+ private DockPanel m_dockPanel;
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ private bool m_disposed = false;
+ protected override void Dispose(bool disposing)
+ {
+ lock (this)
+ {
+ if (!m_disposed && disposing)
+ {
+ m_localWindowsHook.Dispose();
+ m_disposed = true;
+ }
+
+ base.Dispose(disposing);
+ }
+ }
+
+ private IDockContent m_contentActivating = null;
+ private IDockContent ContentActivating
+ {
+ get { return m_contentActivating; }
+ set { m_contentActivating = value; }
+ }
+
+ public void Activate(IDockContent content)
+ {
+ if (IsFocusTrackingSuspended)
+ {
+ ContentActivating = content;
+ return;
+ }
+
+ if (content == null)
+ return;
+ DockContentHandler handler = content.DockHandler;
+ if (handler.Form.IsDisposed)
+ return; // Should not reach here, but better than throwing an exception
+ if (ContentContains(content, handler.ActiveWindowHandle))
+ NativeMethods.SetFocus(handler.ActiveWindowHandle);
+ if (!handler.Form.ContainsFocus)
+ {
+ if (!handler.Form.SelectNextControl(handler.Form.ActiveControl, true, true, true, true))
+ // Since DockContent Form is not selectalbe, use Win32 SetFocus instead
+ NativeMethods.SetFocus(handler.Form.Handle);
+ }
+ }
+
+ private List m_listContent = new List();
+ private List ListContent
+ {
+ get { return m_listContent; }
+ }
+ public void AddToList(IDockContent content)
+ {
+ if (ListContent.Contains(content) || IsInActiveList(content))
+ return;
+
+ ListContent.Add(content);
+ }
+
+ public void RemoveFromList(IDockContent content)
+ {
+ if (IsInActiveList(content))
+ RemoveFromActiveList(content);
+ if (ListContent.Contains(content))
+ ListContent.Remove(content);
+ }
+
+ private IDockContent m_lastActiveContent = null;
+ private IDockContent LastActiveContent
+ {
+ get { return m_lastActiveContent; }
+ set { m_lastActiveContent = value; }
+ }
+
+ private bool IsInActiveList(IDockContent content)
+ {
+ return !(content.DockHandler.NextActive == null && LastActiveContent != content);
+ }
+
+ private void AddLastToActiveList(IDockContent content)
+ {
+ IDockContent last = LastActiveContent;
+ if (last == content)
+ return;
+
+ DockContentHandler handler = content.DockHandler;
+
+ if (IsInActiveList(content))
+ RemoveFromActiveList(content);
+
+ handler.PreviousActive = last;
+ handler.NextActive = null;
+ LastActiveContent = content;
+ if (last != null)
+ last.DockHandler.NextActive = LastActiveContent;
+ }
+
+ private void RemoveFromActiveList(IDockContent content)
+ {
+ if (LastActiveContent == content)
+ LastActiveContent = content.DockHandler.PreviousActive;
+
+ IDockContent prev = content.DockHandler.PreviousActive;
+ IDockContent next = content.DockHandler.NextActive;
+ if (prev != null)
+ prev.DockHandler.NextActive = next;
+ if (next != null)
+ next.DockHandler.PreviousActive = prev;
+
+ content.DockHandler.PreviousActive = null;
+ content.DockHandler.NextActive = null;
+ }
+
+ public void GiveUpFocus(IDockContent content)
+ {
+ DockContentHandler handler = content.DockHandler;
+ if (!handler.Form.ContainsFocus)
+ return;
+
+ if (IsFocusTrackingSuspended)
+ DockPanel.DummyControl.Focus();
+
+ if (LastActiveContent == content)
+ {
+ IDockContent prev = handler.PreviousActive;
+ if (prev != null)
+ Activate(prev);
+ else if (ListContent.Count > 0)
+ Activate(ListContent[ListContent.Count - 1]);
+ }
+ else if (LastActiveContent != null)
+ Activate(LastActiveContent);
+ else if (ListContent.Count > 0)
+ Activate(ListContent[ListContent.Count - 1]);
+ }
+
+ private static bool ContentContains(IDockContent content, IntPtr hWnd)
+ {
+ Control control = Control.FromChildHandle(hWnd);
+ for (Control parent = control; parent != null; parent = parent.Parent)
+ if (parent == content.DockHandler.Form)
+ return true;
+
+ return false;
+ }
+
+ private int m_countSuspendFocusTracking = 0;
+ public void SuspendFocusTracking()
+ {
+ m_countSuspendFocusTracking++;
+ m_localWindowsHook.HookInvoked -= m_hookEventHandler;
+ }
+
+ public void ResumeFocusTracking()
+ {
+ if (m_countSuspendFocusTracking > 0)
+ m_countSuspendFocusTracking--;
+
+ if (m_countSuspendFocusTracking == 0)
+ {
+ if (ContentActivating != null)
+ {
+ Activate(ContentActivating);
+ ContentActivating = null;
+ }
+ m_localWindowsHook.HookInvoked += m_hookEventHandler;
+ if (!InRefreshActiveWindow)
+ RefreshActiveWindow();
+ }
+ }
+
+ public bool IsFocusTrackingSuspended
+ {
+ get { return m_countSuspendFocusTracking != 0; }
+ }
+
+ // Windows hook event handler
+ private void HookEventHandler(object sender, HookEventArgs e)
+ {
+ Win32.Msgs msg = (Win32.Msgs)Marshal.ReadInt32(e.lParam, IntPtr.Size * 3);
+
+ if (msg == Win32.Msgs.WM_KILLFOCUS)
+ {
+ IntPtr wParam = Marshal.ReadIntPtr(e.lParam, IntPtr.Size * 2);
+ DockPane pane = GetPaneFromHandle(wParam);
+ if (pane == null)
+ RefreshActiveWindow();
+ }
+ else if (msg == Win32.Msgs.WM_SETFOCUS)
+ RefreshActiveWindow();
+ }
+
+ private DockPane GetPaneFromHandle(IntPtr hWnd)
+ {
+ Control control = Control.FromChildHandle(hWnd);
+
+ IDockContent content = null;
+ DockPane pane = null;
+ for (; control != null; control = control.Parent)
+ {
+ content = control as IDockContent;
+ if (content != null)
+ content.DockHandler.ActiveWindowHandle = hWnd;
+
+ if (content != null && content.DockHandler.DockPanel == DockPanel)
+ return content.DockHandler.Pane;
+
+ pane = control as DockPane;
+ if (pane != null && pane.DockPanel == DockPanel)
+ break;
+ }
+
+ return pane;
+ }
+
+ private bool m_inRefreshActiveWindow = false;
+ private bool InRefreshActiveWindow
+ {
+ get { return m_inRefreshActiveWindow; }
+ }
+
+ private void RefreshActiveWindow()
+ {
+ SuspendFocusTracking();
+ m_inRefreshActiveWindow = true;
+
+ DockPane oldActivePane = ActivePane;
+ IDockContent oldActiveContent = ActiveContent;
+ IDockContent oldActiveDocument = ActiveDocument;
+
+ SetActivePane();
+ SetActiveContent();
+ SetActiveDocumentPane();
+ SetActiveDocument();
+ DockPanel.AutoHideWindow.RefreshActivePane();
+
+ ResumeFocusTracking();
+ m_inRefreshActiveWindow = false;
+
+ if (oldActiveContent != ActiveContent)
+ DockPanel.OnActiveContentChanged(EventArgs.Empty);
+ if (oldActiveDocument != ActiveDocument)
+ DockPanel.OnActiveDocumentChanged(EventArgs.Empty);
+ if (oldActivePane != ActivePane)
+ DockPanel.OnActivePaneChanged(EventArgs.Empty);
+ }
+
+ private DockPane m_activePane = null;
+ public DockPane ActivePane
+ {
+ get { return m_activePane; }
+ }
+
+ private void SetActivePane()
+ {
+ DockPane value = GetPaneFromHandle(NativeMethods.GetFocus());
+ if (m_activePane == value)
+ return;
+
+ if (m_activePane != null)
+ m_activePane.SetIsActivated(false);
+
+ m_activePane = value;
+
+ if (m_activePane != null)
+ m_activePane.SetIsActivated(true);
+ }
+
+ private IDockContent m_activeContent = null;
+ public IDockContent ActiveContent
+ {
+ get { return m_activeContent; }
+ }
+
+ internal void SetActiveContent()
+ {
+ IDockContent value = ActivePane == null ? null : ActivePane.ActiveContent;
+
+ if (m_activeContent == value)
+ return;
+
+ if (m_activeContent != null)
+ m_activeContent.DockHandler.IsActivated = false;
+
+ m_activeContent = value;
+
+ if (m_activeContent != null)
+ {
+ m_activeContent.DockHandler.IsActivated = true;
+ if (!DockHelper.IsDockStateAutoHide((m_activeContent.DockHandler.DockState)))
+ AddLastToActiveList(m_activeContent);
+ }
+ }
+
+ private DockPane m_activeDocumentPane = null;
+ public DockPane ActiveDocumentPane
+ {
+ get { return m_activeDocumentPane; }
+ }
+
+ private void SetActiveDocumentPane()
+ {
+ DockPane value = null;
+
+ if (ActivePane != null && ActivePane.DockState == DockState.Document)
+ value = ActivePane;
+
+ if (value == null && DockPanel.DockWindows != null)
+ {
+ if (ActiveDocumentPane == null)
+ value = DockPanel.DockWindows[DockState.Document].DefaultPane;
+ else if (ActiveDocumentPane.DockPanel != DockPanel || ActiveDocumentPane.DockState != DockState.Document)
+ value = DockPanel.DockWindows[DockState.Document].DefaultPane;
+ else
+ value = ActiveDocumentPane;
+ }
+
+ if (m_activeDocumentPane == value)
+ return;
+
+ if (m_activeDocumentPane != null)
+ m_activeDocumentPane.SetIsActiveDocumentPane(false);
+
+ m_activeDocumentPane = value;
+
+ if (m_activeDocumentPane != null)
+ m_activeDocumentPane.SetIsActiveDocumentPane(true);
+ }
+
+ private IDockContent m_activeDocument = null;
+ public IDockContent ActiveDocument
+ {
+ get { return m_activeDocument; }
+ }
+
+ private void SetActiveDocument()
+ {
+ IDockContent value = ActiveDocumentPane == null ? null : ActiveDocumentPane.ActiveContent;
+
+ if (m_activeDocument == value)
+ return;
+
+ m_activeDocument = value;
+ }
+ }
+
+ private IFocusManager FocusManager
+ {
+ get { return m_focusManager; }
+ }
+
+ internal IContentFocusManager ContentFocusManager
+ {
+ get { return m_focusManager; }
+ }
+
+ internal void SaveFocus()
+ {
+ DummyControl.Focus();
+ }
+
+ [Browsable(false)]
+ public IDockContent ActiveContent
+ {
+ get { return FocusManager.ActiveContent; }
+ }
+
+ [Browsable(false)]
+ public DockPane ActivePane
+ {
+ get { return FocusManager.ActivePane; }
+ }
+
+ [Browsable(false)]
+ public IDockContent ActiveDocument
+ {
+ get { return FocusManager.ActiveDocument; }
+ }
+
+ [Browsable(false)]
+ public DockPane ActiveDocumentPane
+ {
+ get { return FocusManager.ActiveDocumentPane; }
+ }
+
+ private static readonly object ActiveDocumentChangedEvent = new object();
+ [LocalizedCategory("Category_PropertyChanged")]
+ [LocalizedDescription("DockPanel_ActiveDocumentChanged_Description")]
+ public event EventHandler ActiveDocumentChanged
+ {
+ add { Events.AddHandler(ActiveDocumentChangedEvent, value); }
+ remove { Events.RemoveHandler(ActiveDocumentChangedEvent, value); }
+ }
+ protected virtual void OnActiveDocumentChanged(EventArgs e)
+ {
+ EventHandler handler = (EventHandler)Events[ActiveDocumentChangedEvent];
+ if (handler != null)
+ handler(this, e);
+ }
+
+ private static readonly object ActiveContentChangedEvent = new object();
+ [LocalizedCategory("Category_PropertyChanged")]
+ [LocalizedDescription("DockPanel_ActiveContentChanged_Description")]
+ public event EventHandler ActiveContentChanged
+ {
+ add { Events.AddHandler(ActiveContentChangedEvent, value); }
+ remove { Events.RemoveHandler(ActiveContentChangedEvent, value); }
+ }
+ protected void OnActiveContentChanged(EventArgs e)
+ {
+ EventHandler handler = (EventHandler)Events[ActiveContentChangedEvent];
+ if (handler != null)
+ handler(this, e);
+ }
+
+ private static readonly object ActivePaneChangedEvent = new object();
+ [LocalizedCategory("Category_PropertyChanged")]
+ [LocalizedDescription("DockPanel_ActivePaneChanged_Description")]
+ public event EventHandler ActivePaneChanged
+ {
+ add { Events.AddHandler(ActivePaneChangedEvent, value); }
+ remove { Events.RemoveHandler(ActivePaneChangedEvent, value); }
+ }
+ protected virtual void OnActivePaneChanged(EventArgs e)
+ {
+ EventHandler handler = (EventHandler)Events[ActivePaneChangedEvent];
+ if (handler != null)
+ handler(this, e);
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanel.MdiClientController.cs b/source/Docking/DockPanel.MdiClientController.cs
similarity index 97%
rename from trunk/Docking/DockPanel.MdiClientController.cs
rename to source/Docking/DockPanel.MdiClientController.cs
index 24fd0cf..cd3f7d1 100644
--- a/trunk/Docking/DockPanel.MdiClientController.cs
+++ b/source/Docking/DockPanel.MdiClientController.cs
@@ -1,430 +1,430 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Runtime.InteropServices;
-
-namespace LSLEditor.Docking
-{
- partial class DockPanel
- {
- // This class comes from Jacob Slusser's MdiClientController class:
- // http://www.codeproject.com/cs/miscctrl/mdiclientcontroller.asp
- private class MdiClientController : NativeWindow, IComponent, IDisposable
- {
- private bool m_autoScroll = true;
- private BorderStyle m_borderStyle = BorderStyle.Fixed3D;
- private MdiClient m_mdiClient = null;
- private Form m_parentForm = null;
- private ISite m_site = null;
-
- public MdiClientController()
- {
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- lock (this)
- {
- if (Site != null && Site.Container != null)
- Site.Container.Remove(this);
-
- if (Disposed != null)
- Disposed(this, EventArgs.Empty);
- }
- }
- }
-
- public bool AutoScroll
- {
- get { return m_autoScroll; }
- set
- {
- // By default the MdiClient control scrolls. It can appear though that
- // there are no scrollbars by turning them off when the non-client
- // area is calculated. I decided to expose this method following
- // the .NET vernacular of an AutoScroll property.
- m_autoScroll = value;
- if (MdiClient != null)
- UpdateStyles();
- }
- }
-
- public BorderStyle BorderStyle
- {
- set
- {
- // Error-check the enum.
- if (!Enum.IsDefined(typeof(BorderStyle), value))
- throw new InvalidEnumArgumentException();
-
- m_borderStyle = value;
-
- if (MdiClient == null)
- return;
-
- // This property can actually be visible in design-mode,
- // but to keep it consistent with the others,
- // prevent this from being show at design-time.
- if (Site != null && Site.DesignMode)
- return;
-
- // There is no BorderStyle property exposed by the MdiClient class,
- // but this can be controlled by Win32 functions. A Win32 ExStyle
- // of WS_EX_CLIENTEDGE is equivalent to a Fixed3D border and a
- // Style of WS_BORDER is equivalent to a FixedSingle border.
-
- // This code is inspired Jason Dori's article:
- // "Adding designable borders to user controls".
- // http://www.codeproject.com/cs/miscctrl/CsAddingBorders.asp
-
- // Get styles using Win32 calls
- int style = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE);
- int exStyle = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE);
-
- // Add or remove style flags as necessary.
- switch (m_borderStyle)
- {
- case BorderStyle.Fixed3D:
- exStyle |= (int)Win32.WindowExStyles.WS_EX_CLIENTEDGE;
- style &= ~((int)Win32.WindowStyles.WS_BORDER);
- break;
-
- case BorderStyle.FixedSingle:
- exStyle &= ~((int)Win32.WindowExStyles.WS_EX_CLIENTEDGE);
- style |= (int)Win32.WindowStyles.WS_BORDER;
- break;
-
- case BorderStyle.None:
- style &= ~((int)Win32.WindowStyles.WS_BORDER);
- exStyle &= ~((int)Win32.WindowExStyles.WS_EX_CLIENTEDGE);
- break;
- }
-
- // Set the styles using Win32 calls
- NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE, style);
- NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE, exStyle);
-
- // Cause an update of the non-client area.
- UpdateStyles();
- }
- }
-
- public MdiClient MdiClient
- {
- get { return m_mdiClient; }
- }
-
- [Browsable(false)]
- public Form ParentForm
- {
- get { return m_parentForm; }
- set
- {
- // If the ParentForm has previously been set,
- // unwire events connected to the old parent.
- if (m_parentForm != null)
- {
- m_parentForm.HandleCreated -= new EventHandler(ParentFormHandleCreated);
- m_parentForm.MdiChildActivate -= new EventHandler(ParentFormMdiChildActivate);
- }
-
- m_parentForm = value;
-
- if (m_parentForm == null)
- return;
-
- // If the parent form has not been created yet,
- // wait to initialize the MDI client until it is.
- if (m_parentForm.IsHandleCreated)
- {
- InitializeMdiClient();
- RefreshProperties();
- }
- else
- m_parentForm.HandleCreated += new EventHandler(ParentFormHandleCreated);
-
- m_parentForm.MdiChildActivate += new EventHandler(ParentFormMdiChildActivate);
- }
- }
-
- public ISite Site
- {
- get { return m_site; }
- set
- {
- m_site = value;
-
- if (m_site == null)
- return;
-
- // If the component is dropped onto a form during design-time,
- // set the ParentForm property.
- IDesignerHost host = (value.GetService(typeof(IDesignerHost)) as IDesignerHost);
- if (host != null)
- {
- Form parent = host.RootComponent as Form;
- if (parent != null)
- ParentForm = parent;
- }
- }
- }
-
- public void RenewMdiClient()
- {
- // Reinitialize the MdiClient and its properties.
- InitializeMdiClient();
- RefreshProperties();
- }
-
- public event EventHandler Disposed;
-
- public event EventHandler HandleAssigned;
-
- public event EventHandler MdiChildActivate;
-
- public event LayoutEventHandler Layout;
-
- protected virtual void OnHandleAssigned(EventArgs e)
- {
- // Raise the HandleAssigned event.
- if (HandleAssigned != null)
- HandleAssigned(this, e);
- }
-
- protected virtual void OnMdiChildActivate(EventArgs e)
- {
- // Raise the MdiChildActivate event
- if (MdiChildActivate != null)
- MdiChildActivate(this, e);
- }
-
- protected virtual void OnLayout(LayoutEventArgs e)
- {
- // Raise the Layout event
- if (Layout != null)
- Layout(this, e);
- }
-
- public event PaintEventHandler Paint;
-
- protected virtual void OnPaint(PaintEventArgs e)
- {
- // Raise the Paint event.
- if (Paint != null)
- Paint(this, e);
- }
-
- protected override void WndProc(ref Message m)
- {
- switch (m.Msg)
- {
- case (int)Win32.Msgs.WM_NCCALCSIZE:
- // If AutoScroll is set to false, hide the scrollbars when the control
- // calculates its non-client area.
- if (!AutoScroll)
- NativeMethods.ShowScrollBar(m.HWnd, (int)Win32.ScrollBars.SB_BOTH, 0 /*false*/);
- break;
- }
-
- base.WndProc(ref m);
- }
-
- private void ParentFormHandleCreated(object sender, EventArgs e)
- {
- // The form has been created, unwire the event, and initialize the MdiClient.
- this.m_parentForm.HandleCreated -= new EventHandler(ParentFormHandleCreated);
- InitializeMdiClient();
- RefreshProperties();
- }
-
- private void ParentFormMdiChildActivate(object sender, EventArgs e)
- {
- OnMdiChildActivate(e);
- }
-
- private void MdiClientLayout(object sender, LayoutEventArgs e)
- {
- OnLayout(e);
- }
-
- private void MdiClientHandleDestroyed(object sender, EventArgs e)
- {
- // If the MdiClient handle has been released, drop the reference and
- // release the handle.
- if (m_mdiClient != null)
- {
- m_mdiClient.HandleDestroyed -= new EventHandler(MdiClientHandleDestroyed);
- m_mdiClient = null;
- }
-
- ReleaseHandle();
- }
-
- private void InitializeMdiClient()
- {
- // If the mdiClient has previously been set, unwire events connected
- // to the old MDI.
- if (MdiClient != null)
- {
- MdiClient.HandleDestroyed -= new EventHandler(MdiClientHandleDestroyed);
- MdiClient.Layout -= new LayoutEventHandler(MdiClientLayout);
- }
-
- if (ParentForm == null)
- return;
-
- // Get the MdiClient from the parent form.
- foreach (Control control in ParentForm.Controls)
- {
- // If the form is an MDI container, it will contain an MdiClient control
- // just as it would any other control.
-
- m_mdiClient = control as MdiClient;
- if (m_mdiClient == null)
- continue;
-
- // Assign the MdiClient Handle to the NativeWindow.
- ReleaseHandle();
- AssignHandle(MdiClient.Handle);
-
- // Raise the HandleAssigned event.
- OnHandleAssigned(EventArgs.Empty);
-
- // Monitor the MdiClient for when its handle is destroyed.
- MdiClient.HandleDestroyed += new EventHandler(MdiClientHandleDestroyed);
- MdiClient.Layout += new LayoutEventHandler(MdiClientLayout);
-
- break;
- }
- }
-
- private void RefreshProperties()
- {
- // Refresh all the properties
- BorderStyle = m_borderStyle;
- AutoScroll = m_autoScroll;
- }
-
- private void UpdateStyles()
- {
- // To show style changes, the non-client area must be repainted. Using the
- // control's Invalidate method does not affect the non-client area.
- // Instead use a Win32 call to signal the style has changed.
- NativeMethods.SetWindowPos(MdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0,
- Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
- Win32.FlagsSetWindowPos.SWP_NOMOVE |
- Win32.FlagsSetWindowPos.SWP_NOSIZE |
- Win32.FlagsSetWindowPos.SWP_NOZORDER |
- Win32.FlagsSetWindowPos.SWP_NOOWNERZORDER |
- Win32.FlagsSetWindowPos.SWP_FRAMECHANGED);
- }
- }
-
- private MdiClientController m_mdiClientController = null;
- private MdiClientController GetMdiClientController()
- {
- if (m_mdiClientController == null)
- {
- m_mdiClientController = new MdiClientController();
- m_mdiClientController.HandleAssigned += new EventHandler(MdiClientHandleAssigned);
- m_mdiClientController.MdiChildActivate += new EventHandler(ParentFormMdiChildActivate);
- m_mdiClientController.Layout += new LayoutEventHandler(MdiClient_Layout);
- }
-
- return m_mdiClientController;
- }
-
- private void ParentFormMdiChildActivate(object sender, EventArgs e)
- {
- if (GetMdiClientController().ParentForm == null)
- return;
-
- IDockContent content = GetMdiClientController().ParentForm.ActiveMdiChild as IDockContent;
- if (content == null)
- return;
-
- if (content.DockHandler.DockPanel == this && content.DockHandler.Pane != null)
- content.DockHandler.Pane.ActiveContent = content;
- }
-
- private bool MdiClientExists
- {
- get { return GetMdiClientController().MdiClient != null; }
- }
-
- private void SetMdiClientBounds(Rectangle bounds)
- {
- GetMdiClientController().MdiClient.Bounds = bounds;
- }
-
- private void SuspendMdiClientLayout()
- {
- if (GetMdiClientController().MdiClient != null)
- GetMdiClientController().MdiClient.SuspendLayout();
- }
-
- private void ResumeMdiClientLayout(bool perform)
- {
- if (GetMdiClientController().MdiClient != null)
- GetMdiClientController().MdiClient.ResumeLayout(perform);
- }
-
- private void PerformMdiClientLayout()
- {
- if (GetMdiClientController().MdiClient != null)
- GetMdiClientController().MdiClient.PerformLayout();
- }
-
- // Called when:
- // 1. DockPanel.DocumentStyle changed
- // 2. DockPanel.Visible changed
- // 3. MdiClientController.Handle assigned
- private void SetMdiClient()
- {
- MdiClientController controller = GetMdiClientController();
-
- if (this.DocumentStyle == DocumentStyle.DockingMdi)
- {
- controller.AutoScroll = false;
- controller.BorderStyle = BorderStyle.None;
- if (MdiClientExists)
- controller.MdiClient.Dock = DockStyle.Fill;
- }
- else if (DocumentStyle == DocumentStyle.DockingSdi || DocumentStyle == DocumentStyle.DockingWindow)
- {
- controller.AutoScroll = true;
- controller.BorderStyle = BorderStyle.Fixed3D;
- if (MdiClientExists)
- controller.MdiClient.Dock = DockStyle.Fill;
- }
- else if (this.DocumentStyle == DocumentStyle.SystemMdi)
- {
- controller.AutoScroll = true;
- controller.BorderStyle = BorderStyle.Fixed3D;
- if (controller.MdiClient != null)
- {
- controller.MdiClient.Dock = DockStyle.None;
- controller.MdiClient.Bounds = SystemMdiClientBounds;
- }
- }
- }
-
- internal Rectangle RectangleToMdiClient(Rectangle rect)
- {
- if (MdiClientExists)
- return GetMdiClientController().MdiClient.RectangleToClient(rect);
- else
- return Rectangle.Empty;
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Runtime.InteropServices;
+
+namespace LSLEditor.Docking
+{
+ partial class DockPanel
+ {
+ // This class comes from Jacob Slusser's MdiClientController class:
+ // http://www.codeproject.com/cs/miscctrl/mdiclientcontroller.asp
+ private class MdiClientController : NativeWindow, IComponent, IDisposable
+ {
+ private bool m_autoScroll = true;
+ private BorderStyle m_borderStyle = BorderStyle.Fixed3D;
+ private MdiClient m_mdiClient = null;
+ private Form m_parentForm = null;
+ private ISite m_site = null;
+
+ public MdiClientController()
+ {
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ lock (this)
+ {
+ if (Site != null && Site.Container != null)
+ Site.Container.Remove(this);
+
+ if (Disposed != null)
+ Disposed(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool AutoScroll
+ {
+ get { return m_autoScroll; }
+ set
+ {
+ // By default the MdiClient control scrolls. It can appear though that
+ // there are no scrollbars by turning them off when the non-client
+ // area is calculated. I decided to expose this method following
+ // the .NET vernacular of an AutoScroll property.
+ m_autoScroll = value;
+ if (MdiClient != null)
+ UpdateStyles();
+ }
+ }
+
+ public BorderStyle BorderStyle
+ {
+ set
+ {
+ // Error-check the enum.
+ if (!Enum.IsDefined(typeof(BorderStyle), value))
+ throw new InvalidEnumArgumentException();
+
+ m_borderStyle = value;
+
+ if (MdiClient == null)
+ return;
+
+ // This property can actually be visible in design-mode,
+ // but to keep it consistent with the others,
+ // prevent this from being show at design-time.
+ if (Site != null && Site.DesignMode)
+ return;
+
+ // There is no BorderStyle property exposed by the MdiClient class,
+ // but this can be controlled by Win32 functions. A Win32 ExStyle
+ // of WS_EX_CLIENTEDGE is equivalent to a Fixed3D border and a
+ // Style of WS_BORDER is equivalent to a FixedSingle border.
+
+ // This code is inspired Jason Dori's article:
+ // "Adding designable borders to user controls".
+ // http://www.codeproject.com/cs/miscctrl/CsAddingBorders.asp
+
+ // Get styles using Win32 calls
+ int style = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE);
+ int exStyle = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE);
+
+ // Add or remove style flags as necessary.
+ switch (m_borderStyle)
+ {
+ case BorderStyle.Fixed3D:
+ exStyle |= (int)Win32.WindowExStyles.WS_EX_CLIENTEDGE;
+ style &= ~((int)Win32.WindowStyles.WS_BORDER);
+ break;
+
+ case BorderStyle.FixedSingle:
+ exStyle &= ~((int)Win32.WindowExStyles.WS_EX_CLIENTEDGE);
+ style |= (int)Win32.WindowStyles.WS_BORDER;
+ break;
+
+ case BorderStyle.None:
+ style &= ~((int)Win32.WindowStyles.WS_BORDER);
+ exStyle &= ~((int)Win32.WindowExStyles.WS_EX_CLIENTEDGE);
+ break;
+ }
+
+ // Set the styles using Win32 calls
+ NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE, style);
+ NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE, exStyle);
+
+ // Cause an update of the non-client area.
+ UpdateStyles();
+ }
+ }
+
+ public MdiClient MdiClient
+ {
+ get { return m_mdiClient; }
+ }
+
+ [Browsable(false)]
+ public Form ParentForm
+ {
+ get { return m_parentForm; }
+ set
+ {
+ // If the ParentForm has previously been set,
+ // unwire events connected to the old parent.
+ if (m_parentForm != null)
+ {
+ m_parentForm.HandleCreated -= new EventHandler(ParentFormHandleCreated);
+ m_parentForm.MdiChildActivate -= new EventHandler(ParentFormMdiChildActivate);
+ }
+
+ m_parentForm = value;
+
+ if (m_parentForm == null)
+ return;
+
+ // If the parent form has not been created yet,
+ // wait to initialize the MDI client until it is.
+ if (m_parentForm.IsHandleCreated)
+ {
+ InitializeMdiClient();
+ RefreshProperties();
+ }
+ else
+ m_parentForm.HandleCreated += new EventHandler(ParentFormHandleCreated);
+
+ m_parentForm.MdiChildActivate += new EventHandler(ParentFormMdiChildActivate);
+ }
+ }
+
+ public ISite Site
+ {
+ get { return m_site; }
+ set
+ {
+ m_site = value;
+
+ if (m_site == null)
+ return;
+
+ // If the component is dropped onto a form during design-time,
+ // set the ParentForm property.
+ IDesignerHost host = (value.GetService(typeof(IDesignerHost)) as IDesignerHost);
+ if (host != null)
+ {
+ Form parent = host.RootComponent as Form;
+ if (parent != null)
+ ParentForm = parent;
+ }
+ }
+ }
+
+ public void RenewMdiClient()
+ {
+ // Reinitialize the MdiClient and its properties.
+ InitializeMdiClient();
+ RefreshProperties();
+ }
+
+ public event EventHandler Disposed;
+
+ public event EventHandler HandleAssigned;
+
+ public event EventHandler MdiChildActivate;
+
+ public event LayoutEventHandler Layout;
+
+ protected virtual void OnHandleAssigned(EventArgs e)
+ {
+ // Raise the HandleAssigned event.
+ if (HandleAssigned != null)
+ HandleAssigned(this, e);
+ }
+
+ protected virtual void OnMdiChildActivate(EventArgs e)
+ {
+ // Raise the MdiChildActivate event
+ if (MdiChildActivate != null)
+ MdiChildActivate(this, e);
+ }
+
+ protected virtual void OnLayout(LayoutEventArgs e)
+ {
+ // Raise the Layout event
+ if (Layout != null)
+ Layout(this, e);
+ }
+
+ public event PaintEventHandler Paint;
+
+ protected virtual void OnPaint(PaintEventArgs e)
+ {
+ // Raise the Paint event.
+ if (Paint != null)
+ Paint(this, e);
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ switch (m.Msg)
+ {
+ case (int)Win32.Msgs.WM_NCCALCSIZE:
+ // If AutoScroll is set to false, hide the scrollbars when the control
+ // calculates its non-client area.
+ if (!AutoScroll)
+ NativeMethods.ShowScrollBar(m.HWnd, (int)Win32.ScrollBars.SB_BOTH, 0 /*false*/);
+ break;
+ }
+
+ base.WndProc(ref m);
+ }
+
+ private void ParentFormHandleCreated(object sender, EventArgs e)
+ {
+ // The form has been created, unwire the event, and initialize the MdiClient.
+ this.m_parentForm.HandleCreated -= new EventHandler(ParentFormHandleCreated);
+ InitializeMdiClient();
+ RefreshProperties();
+ }
+
+ private void ParentFormMdiChildActivate(object sender, EventArgs e)
+ {
+ OnMdiChildActivate(e);
+ }
+
+ private void MdiClientLayout(object sender, LayoutEventArgs e)
+ {
+ OnLayout(e);
+ }
+
+ private void MdiClientHandleDestroyed(object sender, EventArgs e)
+ {
+ // If the MdiClient handle has been released, drop the reference and
+ // release the handle.
+ if (m_mdiClient != null)
+ {
+ m_mdiClient.HandleDestroyed -= new EventHandler(MdiClientHandleDestroyed);
+ m_mdiClient = null;
+ }
+
+ ReleaseHandle();
+ }
+
+ private void InitializeMdiClient()
+ {
+ // If the mdiClient has previously been set, unwire events connected
+ // to the old MDI.
+ if (MdiClient != null)
+ {
+ MdiClient.HandleDestroyed -= new EventHandler(MdiClientHandleDestroyed);
+ MdiClient.Layout -= new LayoutEventHandler(MdiClientLayout);
+ }
+
+ if (ParentForm == null)
+ return;
+
+ // Get the MdiClient from the parent form.
+ foreach (Control control in ParentForm.Controls)
+ {
+ // If the form is an MDI container, it will contain an MdiClient control
+ // just as it would any other control.
+
+ m_mdiClient = control as MdiClient;
+ if (m_mdiClient == null)
+ continue;
+
+ // Assign the MdiClient Handle to the NativeWindow.
+ ReleaseHandle();
+ AssignHandle(MdiClient.Handle);
+
+ // Raise the HandleAssigned event.
+ OnHandleAssigned(EventArgs.Empty);
+
+ // Monitor the MdiClient for when its handle is destroyed.
+ MdiClient.HandleDestroyed += new EventHandler(MdiClientHandleDestroyed);
+ MdiClient.Layout += new LayoutEventHandler(MdiClientLayout);
+
+ break;
+ }
+ }
+
+ private void RefreshProperties()
+ {
+ // Refresh all the properties
+ BorderStyle = m_borderStyle;
+ AutoScroll = m_autoScroll;
+ }
+
+ private void UpdateStyles()
+ {
+ // To show style changes, the non-client area must be repainted. Using the
+ // control's Invalidate method does not affect the non-client area.
+ // Instead use a Win32 call to signal the style has changed.
+ NativeMethods.SetWindowPos(MdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0,
+ Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
+ Win32.FlagsSetWindowPos.SWP_NOMOVE |
+ Win32.FlagsSetWindowPos.SWP_NOSIZE |
+ Win32.FlagsSetWindowPos.SWP_NOZORDER |
+ Win32.FlagsSetWindowPos.SWP_NOOWNERZORDER |
+ Win32.FlagsSetWindowPos.SWP_FRAMECHANGED);
+ }
+ }
+
+ private MdiClientController m_mdiClientController = null;
+ private MdiClientController GetMdiClientController()
+ {
+ if (m_mdiClientController == null)
+ {
+ m_mdiClientController = new MdiClientController();
+ m_mdiClientController.HandleAssigned += new EventHandler(MdiClientHandleAssigned);
+ m_mdiClientController.MdiChildActivate += new EventHandler(ParentFormMdiChildActivate);
+ m_mdiClientController.Layout += new LayoutEventHandler(MdiClient_Layout);
+ }
+
+ return m_mdiClientController;
+ }
+
+ private void ParentFormMdiChildActivate(object sender, EventArgs e)
+ {
+ if (GetMdiClientController().ParentForm == null)
+ return;
+
+ IDockContent content = GetMdiClientController().ParentForm.ActiveMdiChild as IDockContent;
+ if (content == null)
+ return;
+
+ if (content.DockHandler.DockPanel == this && content.DockHandler.Pane != null)
+ content.DockHandler.Pane.ActiveContent = content;
+ }
+
+ private bool MdiClientExists
+ {
+ get { return GetMdiClientController().MdiClient != null; }
+ }
+
+ private void SetMdiClientBounds(Rectangle bounds)
+ {
+ GetMdiClientController().MdiClient.Bounds = bounds;
+ }
+
+ private void SuspendMdiClientLayout()
+ {
+ if (GetMdiClientController().MdiClient != null)
+ GetMdiClientController().MdiClient.SuspendLayout();
+ }
+
+ private void ResumeMdiClientLayout(bool perform)
+ {
+ if (GetMdiClientController().MdiClient != null)
+ GetMdiClientController().MdiClient.ResumeLayout(perform);
+ }
+
+ private void PerformMdiClientLayout()
+ {
+ if (GetMdiClientController().MdiClient != null)
+ GetMdiClientController().MdiClient.PerformLayout();
+ }
+
+ // Called when:
+ // 1. DockPanel.DocumentStyle changed
+ // 2. DockPanel.Visible changed
+ // 3. MdiClientController.Handle assigned
+ private void SetMdiClient()
+ {
+ MdiClientController controller = GetMdiClientController();
+
+ if (this.DocumentStyle == DocumentStyle.DockingMdi)
+ {
+ controller.AutoScroll = false;
+ controller.BorderStyle = BorderStyle.None;
+ if (MdiClientExists)
+ controller.MdiClient.Dock = DockStyle.Fill;
+ }
+ else if (DocumentStyle == DocumentStyle.DockingSdi || DocumentStyle == DocumentStyle.DockingWindow)
+ {
+ controller.AutoScroll = true;
+ controller.BorderStyle = BorderStyle.Fixed3D;
+ if (MdiClientExists)
+ controller.MdiClient.Dock = DockStyle.Fill;
+ }
+ else if (this.DocumentStyle == DocumentStyle.SystemMdi)
+ {
+ controller.AutoScroll = true;
+ controller.BorderStyle = BorderStyle.Fixed3D;
+ if (controller.MdiClient != null)
+ {
+ controller.MdiClient.Dock = DockStyle.None;
+ controller.MdiClient.Bounds = SystemMdiClientBounds;
+ }
+ }
+ }
+
+ internal Rectangle RectangleToMdiClient(Rectangle rect)
+ {
+ if (MdiClientExists)
+ return GetMdiClientController().MdiClient.RectangleToClient(rect);
+ else
+ return Rectangle.Empty;
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanel.Persistor.cs b/source/Docking/DockPanel.Persistor.cs
similarity index 98%
rename from trunk/Docking/DockPanel.Persistor.cs
rename to source/Docking/DockPanel.Persistor.cs
index b51ea44..7f4d25d 100644
--- a/trunk/Docking/DockPanel.Persistor.cs
+++ b/source/Docking/DockPanel.Persistor.cs
@@ -1,781 +1,781 @@
-using System;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Drawing;
-using LSLEditor.Docking;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Globalization;
-
-namespace LSLEditor.Docking
-{
- partial class DockPanel
- {
- private static class Persistor
- {
- private const string ConfigFileVersion = "1.0";
- private static string[] CompatibleConfigFileVersions = new string[] { };
-
- private class DummyContent : DockContent
- {
- }
-
- private struct DockPanelStruct
- {
- private double m_dockLeftPortion;
- public double DockLeftPortion
- {
- get { return m_dockLeftPortion; }
- set { m_dockLeftPortion = value; }
- }
-
- private double m_dockRightPortion;
- public double DockRightPortion
- {
- get { return m_dockRightPortion; }
- set { m_dockRightPortion = value; }
- }
-
- private double m_dockTopPortion;
- public double DockTopPortion
- {
- get { return m_dockTopPortion; }
- set { m_dockTopPortion = value; }
- }
-
- private double m_dockBottomPortion;
- public double DockBottomPortion
- {
- get { return m_dockBottomPortion; }
- set { m_dockBottomPortion = value; }
- }
-
- private int m_indexActiveDocumentPane;
- public int IndexActiveDocumentPane
- {
- get { return m_indexActiveDocumentPane; }
- set { m_indexActiveDocumentPane = value; }
- }
-
- private int m_indexActivePane;
- public int IndexActivePane
- {
- get { return m_indexActivePane; }
- set { m_indexActivePane = value; }
- }
- }
-
- private struct ContentStruct
- {
- private string m_persistString;
- public string PersistString
- {
- get { return m_persistString; }
- set { m_persistString = value; }
- }
-
- private double m_autoHidePortion;
- public double AutoHidePortion
- {
- get { return m_autoHidePortion; }
- set { m_autoHidePortion = value; }
- }
-
- private bool m_isHidden;
- public bool IsHidden
- {
- get { return m_isHidden; }
- set { m_isHidden = value; }
- }
-
- private bool m_isFloat;
- public bool IsFloat
- {
- get { return m_isFloat; }
- set { m_isFloat = value; }
- }
- }
-
- private struct PaneStruct
- {
- private DockState m_dockState;
- public DockState DockState
- {
- get { return m_dockState; }
- set { m_dockState = value; }
- }
-
- private int m_indexActiveContent;
- public int IndexActiveContent
- {
- get { return m_indexActiveContent; }
- set { m_indexActiveContent = value; }
- }
-
- private int[] m_indexContents;
- public int[] IndexContents
- {
- get { return m_indexContents; }
- set { m_indexContents = value; }
- }
-
- private int m_zOrderIndex;
- public int ZOrderIndex
- {
- get { return m_zOrderIndex; }
- set { m_zOrderIndex = value; }
- }
- }
-
- private struct NestedPane
- {
- private int m_indexPane;
- public int IndexPane
- {
- get { return m_indexPane; }
- set { m_indexPane = value; }
- }
-
- private int m_indexPrevPane;
- public int IndexPrevPane
- {
- get { return m_indexPrevPane; }
- set { m_indexPrevPane = value; }
- }
-
- private DockAlignment m_alignment;
- public DockAlignment Alignment
- {
- get { return m_alignment; }
- set { m_alignment = value; }
- }
-
- private double m_proportion;
- public double Proportion
- {
- get { return m_proportion; }
- set { m_proportion = value; }
- }
- }
-
- private struct DockWindowStruct
- {
- private DockState m_dockState;
- public DockState DockState
- {
- get { return m_dockState; }
- set { m_dockState = value; }
- }
-
- private int m_zOrderIndex;
- public int ZOrderIndex
- {
- get { return m_zOrderIndex; }
- set { m_zOrderIndex = value; }
- }
-
- private NestedPane[] m_nestedPanes;
- public NestedPane[] NestedPanes
- {
- get { return m_nestedPanes; }
- set { m_nestedPanes = value; }
- }
- }
-
- private struct FloatWindowStruct
- {
- private Rectangle m_bounds;
- public Rectangle Bounds
- {
- get { return m_bounds; }
- set { m_bounds = value; }
- }
-
- private int m_zOrderIndex;
- public int ZOrderIndex
- {
- get { return m_zOrderIndex; }
- set { m_zOrderIndex = value; }
- }
-
- private NestedPane[] m_nestedPanes;
- public NestedPane[] NestedPanes
- {
- get { return m_nestedPanes; }
- set { m_nestedPanes = value; }
- }
- }
-
- public static void SaveAsXml(DockPanel dockPanel, string fileName)
- {
- SaveAsXml(dockPanel, fileName, Encoding.Unicode);
- }
-
- public static void SaveAsXml(DockPanel dockPanel, string fileName, Encoding encoding)
- {
- FileStream fs = new FileStream(fileName, FileMode.Create);
- try
- {
- SaveAsXml(dockPanel, fs, encoding);
- }
- finally
- {
- fs.Close();
- }
- }
-
- public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encoding)
- {
- SaveAsXml(dockPanel, stream, encoding, false);
- }
-
- public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encoding, bool upstream)
- {
- XmlTextWriter xmlOut = new XmlTextWriter(stream, encoding);
-
- // Use indenting for readability
- xmlOut.Formatting = Formatting.Indented;
-
- if (!upstream)
- xmlOut.WriteStartDocument();
-
- // Always begin file with identification and warning
- xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment1);
- xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment2);
-
- // Associate a version number with the root element so that future version of the code
- // will be able to be backwards compatible or at least recognise out of date versions
- xmlOut.WriteStartElement("DockPanel");
- xmlOut.WriteAttributeString("FormatVersion", ConfigFileVersion);
- xmlOut.WriteAttributeString("DockLeftPortion", dockPanel.DockLeftPortion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("DockRightPortion", dockPanel.DockRightPortion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("DockTopPortion", dockPanel.DockTopPortion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("DockBottomPortion", dockPanel.DockBottomPortion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture));
-
- // Contents
- xmlOut.WriteStartElement("Contents");
- xmlOut.WriteAttributeString("Count", dockPanel.Contents.Count.ToString(CultureInfo.InvariantCulture));
- foreach (IDockContent content in dockPanel.Contents)
- {
- xmlOut.WriteStartElement("Content");
- xmlOut.WriteAttributeString("ID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("PersistString", content.DockHandler.PersistString);
- xmlOut.WriteAttributeString("AutoHidePortion", content.DockHandler.AutoHidePortion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("IsHidden", content.DockHandler.IsHidden.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("IsFloat", content.DockHandler.IsFloat.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteEndElement();
- }
- xmlOut.WriteEndElement();
-
- // Panes
- xmlOut.WriteStartElement("Panes");
- xmlOut.WriteAttributeString("Count", dockPanel.Panes.Count.ToString(CultureInfo.InvariantCulture));
- foreach (DockPane pane in dockPanel.Panes)
- {
- xmlOut.WriteStartElement("Pane");
- xmlOut.WriteAttributeString("ID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("DockState", pane.DockState.ToString());
- xmlOut.WriteAttributeString("ActiveContent", dockPanel.Contents.IndexOf(pane.ActiveContent).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteStartElement("Contents");
- xmlOut.WriteAttributeString("Count", pane.Contents.Count.ToString(CultureInfo.InvariantCulture));
- foreach (IDockContent content in pane.Contents)
- {
- xmlOut.WriteStartElement("Content");
- xmlOut.WriteAttributeString("ID", pane.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("RefID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteEndElement();
- }
- xmlOut.WriteEndElement();
- xmlOut.WriteEndElement();
- }
- xmlOut.WriteEndElement();
-
- // DockWindows
- xmlOut.WriteStartElement("DockWindows");
- int dockWindowId = 0;
- foreach (DockWindow dw in dockPanel.DockWindows)
- {
- xmlOut.WriteStartElement("DockWindow");
- xmlOut.WriteAttributeString("ID", dockWindowId.ToString(CultureInfo.InvariantCulture));
- dockWindowId++;
- xmlOut.WriteAttributeString("DockState", dw.DockState.ToString());
- xmlOut.WriteAttributeString("ZOrderIndex", dockPanel.Controls.IndexOf(dw).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteStartElement("NestedPanes");
- xmlOut.WriteAttributeString("Count", dw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture));
- foreach (DockPane pane in dw.NestedPanes)
- {
- xmlOut.WriteStartElement("Pane");
- xmlOut.WriteAttributeString("ID", dw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
- NestedDockingStatus status = pane.NestedDockingStatus;
- xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString());
- xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteEndElement();
- }
- xmlOut.WriteEndElement();
- xmlOut.WriteEndElement();
- }
- xmlOut.WriteEndElement();
-
- // FloatWindows
- RectangleConverter rectConverter = new RectangleConverter();
- xmlOut.WriteStartElement("FloatWindows");
- xmlOut.WriteAttributeString("Count", dockPanel.FloatWindows.Count.ToString(CultureInfo.InvariantCulture));
- foreach (FloatWindow fw in dockPanel.FloatWindows)
- {
- xmlOut.WriteStartElement("FloatWindow");
- xmlOut.WriteAttributeString("ID", dockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("Bounds", rectConverter.ConvertToInvariantString(fw.Bounds));
- xmlOut.WriteAttributeString("ZOrderIndex", fw.DockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteStartElement("NestedPanes");
- xmlOut.WriteAttributeString("Count", fw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture));
- foreach (DockPane pane in fw.NestedPanes)
- {
- xmlOut.WriteStartElement("Pane");
- xmlOut.WriteAttributeString("ID", fw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
- NestedDockingStatus status = pane.NestedDockingStatus;
- xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString());
- xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteEndElement();
- }
- xmlOut.WriteEndElement();
- xmlOut.WriteEndElement();
- }
- xmlOut.WriteEndElement(); //
-
- xmlOut.WriteEndElement();
-
- if (!upstream)
- {
- xmlOut.WriteEndDocument();
- xmlOut.Close();
- }
- else
- xmlOut.Flush();
- }
-
- public static void LoadFromXml(DockPanel dockPanel, string fileName, DeserializeDockContent deserializeContent)
- {
- FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
- try
- {
- LoadFromXml(dockPanel, fs, deserializeContent);
- }
- finally
- {
- fs.Close();
- }
- }
-
- public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent)
- {
- LoadFromXml(dockPanel, stream, deserializeContent, true);
- }
-
- private static ContentStruct[] LoadContents(XmlTextReader xmlIn)
- {
- int countOfContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
- ContentStruct[] contents = new ContentStruct[countOfContents];
- MoveToNextElement(xmlIn);
- for (int i = 0; i < countOfContents; i++)
- {
- int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
- if (xmlIn.Name != "Content" || id != i)
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
-
- contents[i].PersistString = xmlIn.GetAttribute("PersistString");
- contents[i].AutoHidePortion = Convert.ToDouble(xmlIn.GetAttribute("AutoHidePortion"), CultureInfo.InvariantCulture);
- contents[i].IsHidden = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden"), CultureInfo.InvariantCulture);
- contents[i].IsFloat = Convert.ToBoolean(xmlIn.GetAttribute("IsFloat"), CultureInfo.InvariantCulture);
- MoveToNextElement(xmlIn);
- }
-
- return contents;
- }
-
- private static PaneStruct[] LoadPanes(XmlTextReader xmlIn)
- {
- EnumConverter dockStateConverter = new EnumConverter(typeof(DockState));
- int countOfPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
- PaneStruct[] panes = new PaneStruct[countOfPanes];
- MoveToNextElement(xmlIn);
- for (int i = 0; i < countOfPanes; i++)
- {
- int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
- if (xmlIn.Name != "Pane" || id != i)
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
-
- panes[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
- panes[i].IndexActiveContent = Convert.ToInt32(xmlIn.GetAttribute("ActiveContent"), CultureInfo.InvariantCulture);
- panes[i].ZOrderIndex = -1;
-
- MoveToNextElement(xmlIn);
- if (xmlIn.Name != "Contents")
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- int countOfPaneContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
- panes[i].IndexContents = new int[countOfPaneContents];
- MoveToNextElement(xmlIn);
- for (int j = 0; j < countOfPaneContents; j++)
- {
- int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
- if (xmlIn.Name != "Content" || id2 != j)
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
-
- panes[i].IndexContents[j] = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
- MoveToNextElement(xmlIn);
- }
- }
-
- return panes;
- }
-
- private static DockWindowStruct[] LoadDockWindows(XmlTextReader xmlIn, DockPanel dockPanel)
- {
- EnumConverter dockStateConverter = new EnumConverter(typeof(DockState));
- EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
- int countOfDockWindows = dockPanel.DockWindows.Count;
- DockWindowStruct[] dockWindows = new DockWindowStruct[countOfDockWindows];
- MoveToNextElement(xmlIn);
- for (int i = 0; i < countOfDockWindows; i++)
- {
- int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
- if (xmlIn.Name != "DockWindow" || id != i)
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
-
- dockWindows[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
- dockWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture);
- MoveToNextElement(xmlIn);
- if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes")
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
- dockWindows[i].NestedPanes = new NestedPane[countOfNestedPanes];
- MoveToNextElement(xmlIn);
- for (int j = 0; j < countOfNestedPanes; j++)
- {
- int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
- if (xmlIn.Name != "Pane" || id2 != j)
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- dockWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
- dockWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture);
- dockWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
- dockWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
- MoveToNextElement(xmlIn);
- }
- }
-
- return dockWindows;
- }
-
- private static FloatWindowStruct[] LoadFloatWindows(XmlTextReader xmlIn)
- {
- EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
- RectangleConverter rectConverter = new RectangleConverter();
- int countOfFloatWindows = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
- FloatWindowStruct[] floatWindows = new FloatWindowStruct[countOfFloatWindows];
- MoveToNextElement(xmlIn);
- for (int i = 0; i < countOfFloatWindows; i++)
- {
- int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
- if (xmlIn.Name != "FloatWindow" || id != i)
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
-
- floatWindows[i].Bounds = (Rectangle)rectConverter.ConvertFromInvariantString(xmlIn.GetAttribute("Bounds"));
- floatWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture);
- MoveToNextElement(xmlIn);
- if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes")
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
- floatWindows[i].NestedPanes = new NestedPane[countOfNestedPanes];
- MoveToNextElement(xmlIn);
- for (int j = 0; j < countOfNestedPanes; j++)
- {
- int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
- if (xmlIn.Name != "Pane" || id2 != j)
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- floatWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
- floatWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture);
- floatWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
- floatWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
- MoveToNextElement(xmlIn);
- }
- }
-
- return floatWindows;
- }
-
- public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
- {
-
- if (dockPanel.Contents.Count != 0)
- throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
-
- XmlTextReader xmlIn = new XmlTextReader(stream);
- xmlIn.WhitespaceHandling = WhitespaceHandling.None;
- xmlIn.MoveToContent();
-
- while (!xmlIn.Name.Equals("DockPanel"))
- {
- if (!MoveToNextElement(xmlIn))
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- }
-
- string formatVersion = xmlIn.GetAttribute("FormatVersion");
- if (!IsFormatVersionValid(formatVersion))
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
-
- DockPanelStruct dockPanelStruct = new DockPanelStruct();
- dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
- dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
- dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
- dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
- dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture);
- dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);
-
- // Load Contents
- MoveToNextElement(xmlIn);
- if (xmlIn.Name != "Contents")
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- ContentStruct[] contents = LoadContents(xmlIn);
-
- // Load Panes
- if (xmlIn.Name != "Panes")
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- PaneStruct[] panes = LoadPanes(xmlIn);
-
- // Load DockWindows
- if (xmlIn.Name != "DockWindows")
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);
-
- // Load FloatWindows
- if (xmlIn.Name != "FloatWindows")
- throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
- FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);
-
- if (closeStream)
- xmlIn.Close();
-
- dockPanel.SuspendLayout(true);
-
- dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion;
- dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion;
- dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion;
- dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;
-
- // Set DockWindow ZOrders
- int prevMaxDockWindowZOrder = int.MaxValue;
- for (int i = 0; i < dockWindows.Length; i++)
- {
- int maxDockWindowZOrder = -1;
- int index = -1;
- for (int j = 0; j < dockWindows.Length; j++)
- {
- if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
- {
- maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
- index = j;
- }
- }
-
- dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
- prevMaxDockWindowZOrder = maxDockWindowZOrder;
- }
-
- // Create Contents
- for (int i = 0; i < contents.Length; i++)
- {
- IDockContent content = deserializeContent(contents[i].PersistString);
- if (content == null)
- content = new DummyContent();
- content.DockHandler.DockPanel = dockPanel;
- content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
- content.DockHandler.IsHidden = true;
- content.DockHandler.IsFloat = contents[i].IsFloat;
- }
-
- // Create panes
- for (int i = 0; i < panes.Length; i++)
- {
- DockPane pane = null;
- for (int j = 0; j < panes[i].IndexContents.Length; j++)
- {
- IDockContent content = dockPanel.Contents[panes[i].IndexContents[j]];
- if (j == 0)
- pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false);
- else if (panes[i].DockState == DockState.Float)
- content.DockHandler.FloatPane = pane;
- else
- content.DockHandler.PanelPane = pane;
- }
- }
-
- // Assign Panes to DockWindows
- for (int i = 0; i < dockWindows.Length; i++)
- {
- for (int j = 0; j < dockWindows[i].NestedPanes.Length; j++)
- {
- DockWindow dw = dockPanel.DockWindows[dockWindows[i].DockState];
- int indexPane = dockWindows[i].NestedPanes[j].IndexPane;
- DockPane pane = dockPanel.Panes[indexPane];
- int indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane;
- DockPane prevPane = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane];
- DockAlignment alignment = dockWindows[i].NestedPanes[j].Alignment;
- double proportion = dockWindows[i].NestedPanes[j].Proportion;
- pane.DockTo(dw, prevPane, alignment, proportion);
- if (panes[indexPane].DockState == dw.DockState)
- panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex;
- }
- }
-
- // Create float windows
- for (int i = 0; i < floatWindows.Length; i++)
- {
- FloatWindow fw = null;
- for (int j = 0; j < floatWindows[i].NestedPanes.Length; j++)
- {
- int indexPane = floatWindows[i].NestedPanes[j].IndexPane;
- DockPane pane = dockPanel.Panes[indexPane];
- if (j == 0)
- fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
- else
- {
- int indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane;
- DockPane prevPane = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
- DockAlignment alignment = floatWindows[i].NestedPanes[j].Alignment;
- double proportion = floatWindows[i].NestedPanes[j].Proportion;
- pane.DockTo(fw, prevPane, alignment, proportion);
- }
-
- if (panes[indexPane].DockState == fw.DockState)
- panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex;
- }
- }
-
- // sort IDockContent by its Pane's ZOrder
- int[] sortedContents = null;
- if (contents.Length > 0)
- {
- sortedContents = new int[contents.Length];
- for (int i = 0; i < contents.Length; i++)
- sortedContents[i] = i;
-
- int lastDocument = contents.Length;
- for (int i = 0; i < contents.Length - 1; i++)
- {
- for (int j = i + 1; j < contents.Length; j++)
- {
- DockPane pane1 = dockPanel.Contents[sortedContents[i]].DockHandler.Pane;
- int ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
- DockPane pane2 = dockPanel.Contents[sortedContents[j]].DockHandler.Pane;
- int ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
- if (ZOrderIndex1 > ZOrderIndex2)
- {
- int temp = sortedContents[i];
- sortedContents[i] = sortedContents[j];
- sortedContents[j] = temp;
- }
- }
- }
- }
-
- // show non-document IDockContent first to avoid screen flickers
- for (int i = 0; i < contents.Length; i++)
- {
- IDockContent content = dockPanel.Contents[sortedContents[i]];
- if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document)
- content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
- }
-
- // after all non-document IDockContent, show document IDockContent
- for (int i = 0; i < contents.Length; i++)
- {
- IDockContent content = dockPanel.Contents[sortedContents[i]];
- if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document)
- content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
- }
-
- for (int i = 0; i < panes.Length; i++)
- dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1 ? null : dockPanel.Contents[panes[i].IndexActiveContent];
-
- if (dockPanelStruct.IndexActiveDocumentPane != -1)
- dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate();
-
- if (dockPanelStruct.IndexActivePane != -1)
- dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate();
-
- for (int i = dockPanel.Contents.Count - 1; i >= 0; i--)
- if (dockPanel.Contents[i] is DummyContent)
- dockPanel.Contents[i].DockHandler.Form.Close();
-
- dockPanel.ResumeLayout(true, true);
- }
-
- private static bool MoveToNextElement(XmlTextReader xmlIn)
- {
- if (!xmlIn.Read())
- return false;
-
- while (xmlIn.NodeType == XmlNodeType.EndElement)
- {
- if (!xmlIn.Read())
- return false;
- }
-
- return true;
- }
-
- private static bool IsFormatVersionValid(string formatVersion)
- {
- if (formatVersion == ConfigFileVersion)
- return true;
-
- foreach (string s in CompatibleConfigFileVersions)
- if (s == formatVersion)
- return true;
-
- return false;
- }
- }
-
- public void SaveAsXml(string fileName)
- {
- Persistor.SaveAsXml(this, fileName);
- }
-
- public void SaveAsXml(string fileName, Encoding encoding)
- {
- Persistor.SaveAsXml(this, fileName, encoding);
- }
-
- public void SaveAsXml(Stream stream, Encoding encoding)
- {
- Persistor.SaveAsXml(this, stream, encoding);
- }
-
- public void SaveAsXml(Stream stream, Encoding encoding, bool upstream)
- {
- Persistor.SaveAsXml(this, stream, encoding, upstream);
- }
-
- public void LoadFromXml(string fileName, DeserializeDockContent deserializeContent)
- {
- Persistor.LoadFromXml(this, fileName, deserializeContent);
- }
-
- public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent)
- {
- Persistor.LoadFromXml(this, stream, deserializeContent);
- }
-
- public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
- {
- Persistor.LoadFromXml(this, stream, deserializeContent, closeStream);
- }
- }
-}
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Drawing;
+using LSLEditor.Docking;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+
+namespace LSLEditor.Docking
+{
+ partial class DockPanel
+ {
+ private static class Persistor
+ {
+ private const string ConfigFileVersion = "1.0";
+ private static string[] CompatibleConfigFileVersions = new string[] { };
+
+ private class DummyContent : DockContent
+ {
+ }
+
+ private struct DockPanelStruct
+ {
+ private double m_dockLeftPortion;
+ public double DockLeftPortion
+ {
+ get { return m_dockLeftPortion; }
+ set { m_dockLeftPortion = value; }
+ }
+
+ private double m_dockRightPortion;
+ public double DockRightPortion
+ {
+ get { return m_dockRightPortion; }
+ set { m_dockRightPortion = value; }
+ }
+
+ private double m_dockTopPortion;
+ public double DockTopPortion
+ {
+ get { return m_dockTopPortion; }
+ set { m_dockTopPortion = value; }
+ }
+
+ private double m_dockBottomPortion;
+ public double DockBottomPortion
+ {
+ get { return m_dockBottomPortion; }
+ set { m_dockBottomPortion = value; }
+ }
+
+ private int m_indexActiveDocumentPane;
+ public int IndexActiveDocumentPane
+ {
+ get { return m_indexActiveDocumentPane; }
+ set { m_indexActiveDocumentPane = value; }
+ }
+
+ private int m_indexActivePane;
+ public int IndexActivePane
+ {
+ get { return m_indexActivePane; }
+ set { m_indexActivePane = value; }
+ }
+ }
+
+ private struct ContentStruct
+ {
+ private string m_persistString;
+ public string PersistString
+ {
+ get { return m_persistString; }
+ set { m_persistString = value; }
+ }
+
+ private double m_autoHidePortion;
+ public double AutoHidePortion
+ {
+ get { return m_autoHidePortion; }
+ set { m_autoHidePortion = value; }
+ }
+
+ private bool m_isHidden;
+ public bool IsHidden
+ {
+ get { return m_isHidden; }
+ set { m_isHidden = value; }
+ }
+
+ private bool m_isFloat;
+ public bool IsFloat
+ {
+ get { return m_isFloat; }
+ set { m_isFloat = value; }
+ }
+ }
+
+ private struct PaneStruct
+ {
+ private DockState m_dockState;
+ public DockState DockState
+ {
+ get { return m_dockState; }
+ set { m_dockState = value; }
+ }
+
+ private int m_indexActiveContent;
+ public int IndexActiveContent
+ {
+ get { return m_indexActiveContent; }
+ set { m_indexActiveContent = value; }
+ }
+
+ private int[] m_indexContents;
+ public int[] IndexContents
+ {
+ get { return m_indexContents; }
+ set { m_indexContents = value; }
+ }
+
+ private int m_zOrderIndex;
+ public int ZOrderIndex
+ {
+ get { return m_zOrderIndex; }
+ set { m_zOrderIndex = value; }
+ }
+ }
+
+ private struct NestedPane
+ {
+ private int m_indexPane;
+ public int IndexPane
+ {
+ get { return m_indexPane; }
+ set { m_indexPane = value; }
+ }
+
+ private int m_indexPrevPane;
+ public int IndexPrevPane
+ {
+ get { return m_indexPrevPane; }
+ set { m_indexPrevPane = value; }
+ }
+
+ private DockAlignment m_alignment;
+ public DockAlignment Alignment
+ {
+ get { return m_alignment; }
+ set { m_alignment = value; }
+ }
+
+ private double m_proportion;
+ public double Proportion
+ {
+ get { return m_proportion; }
+ set { m_proportion = value; }
+ }
+ }
+
+ private struct DockWindowStruct
+ {
+ private DockState m_dockState;
+ public DockState DockState
+ {
+ get { return m_dockState; }
+ set { m_dockState = value; }
+ }
+
+ private int m_zOrderIndex;
+ public int ZOrderIndex
+ {
+ get { return m_zOrderIndex; }
+ set { m_zOrderIndex = value; }
+ }
+
+ private NestedPane[] m_nestedPanes;
+ public NestedPane[] NestedPanes
+ {
+ get { return m_nestedPanes; }
+ set { m_nestedPanes = value; }
+ }
+ }
+
+ private struct FloatWindowStruct
+ {
+ private Rectangle m_bounds;
+ public Rectangle Bounds
+ {
+ get { return m_bounds; }
+ set { m_bounds = value; }
+ }
+
+ private int m_zOrderIndex;
+ public int ZOrderIndex
+ {
+ get { return m_zOrderIndex; }
+ set { m_zOrderIndex = value; }
+ }
+
+ private NestedPane[] m_nestedPanes;
+ public NestedPane[] NestedPanes
+ {
+ get { return m_nestedPanes; }
+ set { m_nestedPanes = value; }
+ }
+ }
+
+ public static void SaveAsXml(DockPanel dockPanel, string fileName)
+ {
+ SaveAsXml(dockPanel, fileName, Encoding.Unicode);
+ }
+
+ public static void SaveAsXml(DockPanel dockPanel, string fileName, Encoding encoding)
+ {
+ FileStream fs = new FileStream(fileName, FileMode.Create);
+ try
+ {
+ SaveAsXml(dockPanel, fs, encoding);
+ }
+ finally
+ {
+ fs.Close();
+ }
+ }
+
+ public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encoding)
+ {
+ SaveAsXml(dockPanel, stream, encoding, false);
+ }
+
+ public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encoding, bool upstream)
+ {
+ XmlTextWriter xmlOut = new XmlTextWriter(stream, encoding);
+
+ // Use indenting for readability
+ xmlOut.Formatting = Formatting.Indented;
+
+ if (!upstream)
+ xmlOut.WriteStartDocument();
+
+ // Always begin file with identification and warning
+ xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment1);
+ xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment2);
+
+ // Associate a version number with the root element so that future version of the code
+ // will be able to be backwards compatible or at least recognise out of date versions
+ xmlOut.WriteStartElement("DockPanel");
+ xmlOut.WriteAttributeString("FormatVersion", ConfigFileVersion);
+ xmlOut.WriteAttributeString("DockLeftPortion", dockPanel.DockLeftPortion.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("DockRightPortion", dockPanel.DockRightPortion.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("DockTopPortion", dockPanel.DockTopPortion.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("DockBottomPortion", dockPanel.DockBottomPortion.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture));
+
+ // Contents
+ xmlOut.WriteStartElement("Contents");
+ xmlOut.WriteAttributeString("Count", dockPanel.Contents.Count.ToString(CultureInfo.InvariantCulture));
+ foreach (IDockContent content in dockPanel.Contents)
+ {
+ xmlOut.WriteStartElement("Content");
+ xmlOut.WriteAttributeString("ID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("PersistString", content.DockHandler.PersistString);
+ xmlOut.WriteAttributeString("AutoHidePortion", content.DockHandler.AutoHidePortion.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("IsHidden", content.DockHandler.IsHidden.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("IsFloat", content.DockHandler.IsFloat.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteEndElement();
+ }
+ xmlOut.WriteEndElement();
+
+ // Panes
+ xmlOut.WriteStartElement("Panes");
+ xmlOut.WriteAttributeString("Count", dockPanel.Panes.Count.ToString(CultureInfo.InvariantCulture));
+ foreach (DockPane pane in dockPanel.Panes)
+ {
+ xmlOut.WriteStartElement("Pane");
+ xmlOut.WriteAttributeString("ID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("DockState", pane.DockState.ToString());
+ xmlOut.WriteAttributeString("ActiveContent", dockPanel.Contents.IndexOf(pane.ActiveContent).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteStartElement("Contents");
+ xmlOut.WriteAttributeString("Count", pane.Contents.Count.ToString(CultureInfo.InvariantCulture));
+ foreach (IDockContent content in pane.Contents)
+ {
+ xmlOut.WriteStartElement("Content");
+ xmlOut.WriteAttributeString("ID", pane.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("RefID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteEndElement();
+ }
+ xmlOut.WriteEndElement();
+ xmlOut.WriteEndElement();
+ }
+ xmlOut.WriteEndElement();
+
+ // DockWindows
+ xmlOut.WriteStartElement("DockWindows");
+ int dockWindowId = 0;
+ foreach (DockWindow dw in dockPanel.DockWindows)
+ {
+ xmlOut.WriteStartElement("DockWindow");
+ xmlOut.WriteAttributeString("ID", dockWindowId.ToString(CultureInfo.InvariantCulture));
+ dockWindowId++;
+ xmlOut.WriteAttributeString("DockState", dw.DockState.ToString());
+ xmlOut.WriteAttributeString("ZOrderIndex", dockPanel.Controls.IndexOf(dw).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteStartElement("NestedPanes");
+ xmlOut.WriteAttributeString("Count", dw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture));
+ foreach (DockPane pane in dw.NestedPanes)
+ {
+ xmlOut.WriteStartElement("Pane");
+ xmlOut.WriteAttributeString("ID", dw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
+ NestedDockingStatus status = pane.NestedDockingStatus;
+ xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString());
+ xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteEndElement();
+ }
+ xmlOut.WriteEndElement();
+ xmlOut.WriteEndElement();
+ }
+ xmlOut.WriteEndElement();
+
+ // FloatWindows
+ RectangleConverter rectConverter = new RectangleConverter();
+ xmlOut.WriteStartElement("FloatWindows");
+ xmlOut.WriteAttributeString("Count", dockPanel.FloatWindows.Count.ToString(CultureInfo.InvariantCulture));
+ foreach (FloatWindow fw in dockPanel.FloatWindows)
+ {
+ xmlOut.WriteStartElement("FloatWindow");
+ xmlOut.WriteAttributeString("ID", dockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("Bounds", rectConverter.ConvertToInvariantString(fw.Bounds));
+ xmlOut.WriteAttributeString("ZOrderIndex", fw.DockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteStartElement("NestedPanes");
+ xmlOut.WriteAttributeString("Count", fw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture));
+ foreach (DockPane pane in fw.NestedPanes)
+ {
+ xmlOut.WriteStartElement("Pane");
+ xmlOut.WriteAttributeString("ID", fw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
+ NestedDockingStatus status = pane.NestedDockingStatus;
+ xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString());
+ xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteEndElement();
+ }
+ xmlOut.WriteEndElement();
+ xmlOut.WriteEndElement();
+ }
+ xmlOut.WriteEndElement(); //
+
+ xmlOut.WriteEndElement();
+
+ if (!upstream)
+ {
+ xmlOut.WriteEndDocument();
+ xmlOut.Close();
+ }
+ else
+ xmlOut.Flush();
+ }
+
+ public static void LoadFromXml(DockPanel dockPanel, string fileName, DeserializeDockContent deserializeContent)
+ {
+ FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+ try
+ {
+ LoadFromXml(dockPanel, fs, deserializeContent);
+ }
+ finally
+ {
+ fs.Close();
+ }
+ }
+
+ public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent)
+ {
+ LoadFromXml(dockPanel, stream, deserializeContent, true);
+ }
+
+ private static ContentStruct[] LoadContents(XmlTextReader xmlIn)
+ {
+ int countOfContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
+ ContentStruct[] contents = new ContentStruct[countOfContents];
+ MoveToNextElement(xmlIn);
+ for (int i = 0; i < countOfContents; i++)
+ {
+ int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
+ if (xmlIn.Name != "Content" || id != i)
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+
+ contents[i].PersistString = xmlIn.GetAttribute("PersistString");
+ contents[i].AutoHidePortion = Convert.ToDouble(xmlIn.GetAttribute("AutoHidePortion"), CultureInfo.InvariantCulture);
+ contents[i].IsHidden = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden"), CultureInfo.InvariantCulture);
+ contents[i].IsFloat = Convert.ToBoolean(xmlIn.GetAttribute("IsFloat"), CultureInfo.InvariantCulture);
+ MoveToNextElement(xmlIn);
+ }
+
+ return contents;
+ }
+
+ private static PaneStruct[] LoadPanes(XmlTextReader xmlIn)
+ {
+ EnumConverter dockStateConverter = new EnumConverter(typeof(DockState));
+ int countOfPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
+ PaneStruct[] panes = new PaneStruct[countOfPanes];
+ MoveToNextElement(xmlIn);
+ for (int i = 0; i < countOfPanes; i++)
+ {
+ int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
+ if (xmlIn.Name != "Pane" || id != i)
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+
+ panes[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
+ panes[i].IndexActiveContent = Convert.ToInt32(xmlIn.GetAttribute("ActiveContent"), CultureInfo.InvariantCulture);
+ panes[i].ZOrderIndex = -1;
+
+ MoveToNextElement(xmlIn);
+ if (xmlIn.Name != "Contents")
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ int countOfPaneContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
+ panes[i].IndexContents = new int[countOfPaneContents];
+ MoveToNextElement(xmlIn);
+ for (int j = 0; j < countOfPaneContents; j++)
+ {
+ int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
+ if (xmlIn.Name != "Content" || id2 != j)
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+
+ panes[i].IndexContents[j] = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
+ MoveToNextElement(xmlIn);
+ }
+ }
+
+ return panes;
+ }
+
+ private static DockWindowStruct[] LoadDockWindows(XmlTextReader xmlIn, DockPanel dockPanel)
+ {
+ EnumConverter dockStateConverter = new EnumConverter(typeof(DockState));
+ EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
+ int countOfDockWindows = dockPanel.DockWindows.Count;
+ DockWindowStruct[] dockWindows = new DockWindowStruct[countOfDockWindows];
+ MoveToNextElement(xmlIn);
+ for (int i = 0; i < countOfDockWindows; i++)
+ {
+ int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
+ if (xmlIn.Name != "DockWindow" || id != i)
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+
+ dockWindows[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
+ dockWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture);
+ MoveToNextElement(xmlIn);
+ if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes")
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
+ dockWindows[i].NestedPanes = new NestedPane[countOfNestedPanes];
+ MoveToNextElement(xmlIn);
+ for (int j = 0; j < countOfNestedPanes; j++)
+ {
+ int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
+ if (xmlIn.Name != "Pane" || id2 != j)
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ dockWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
+ dockWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture);
+ dockWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
+ dockWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
+ MoveToNextElement(xmlIn);
+ }
+ }
+
+ return dockWindows;
+ }
+
+ private static FloatWindowStruct[] LoadFloatWindows(XmlTextReader xmlIn)
+ {
+ EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
+ RectangleConverter rectConverter = new RectangleConverter();
+ int countOfFloatWindows = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
+ FloatWindowStruct[] floatWindows = new FloatWindowStruct[countOfFloatWindows];
+ MoveToNextElement(xmlIn);
+ for (int i = 0; i < countOfFloatWindows; i++)
+ {
+ int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
+ if (xmlIn.Name != "FloatWindow" || id != i)
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+
+ floatWindows[i].Bounds = (Rectangle)rectConverter.ConvertFromInvariantString(xmlIn.GetAttribute("Bounds"));
+ floatWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture);
+ MoveToNextElement(xmlIn);
+ if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes")
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
+ floatWindows[i].NestedPanes = new NestedPane[countOfNestedPanes];
+ MoveToNextElement(xmlIn);
+ for (int j = 0; j < countOfNestedPanes; j++)
+ {
+ int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
+ if (xmlIn.Name != "Pane" || id2 != j)
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ floatWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
+ floatWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture);
+ floatWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
+ floatWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
+ MoveToNextElement(xmlIn);
+ }
+ }
+
+ return floatWindows;
+ }
+
+ public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
+ {
+
+ if (dockPanel.Contents.Count != 0)
+ throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
+
+ XmlTextReader xmlIn = new XmlTextReader(stream);
+ xmlIn.WhitespaceHandling = WhitespaceHandling.None;
+ xmlIn.MoveToContent();
+
+ while (!xmlIn.Name.Equals("DockPanel"))
+ {
+ if (!MoveToNextElement(xmlIn))
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ }
+
+ string formatVersion = xmlIn.GetAttribute("FormatVersion");
+ if (!IsFormatVersionValid(formatVersion))
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
+
+ DockPanelStruct dockPanelStruct = new DockPanelStruct();
+ dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
+ dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
+ dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
+ dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
+ dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture);
+ dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);
+
+ // Load Contents
+ MoveToNextElement(xmlIn);
+ if (xmlIn.Name != "Contents")
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ ContentStruct[] contents = LoadContents(xmlIn);
+
+ // Load Panes
+ if (xmlIn.Name != "Panes")
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ PaneStruct[] panes = LoadPanes(xmlIn);
+
+ // Load DockWindows
+ if (xmlIn.Name != "DockWindows")
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);
+
+ // Load FloatWindows
+ if (xmlIn.Name != "FloatWindows")
+ throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
+ FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);
+
+ if (closeStream)
+ xmlIn.Close();
+
+ dockPanel.SuspendLayout(true);
+
+ dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion;
+ dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion;
+ dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion;
+ dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;
+
+ // Set DockWindow ZOrders
+ int prevMaxDockWindowZOrder = int.MaxValue;
+ for (int i = 0; i < dockWindows.Length; i++)
+ {
+ int maxDockWindowZOrder = -1;
+ int index = -1;
+ for (int j = 0; j < dockWindows.Length; j++)
+ {
+ if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
+ {
+ maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
+ index = j;
+ }
+ }
+
+ dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
+ prevMaxDockWindowZOrder = maxDockWindowZOrder;
+ }
+
+ // Create Contents
+ for (int i = 0; i < contents.Length; i++)
+ {
+ IDockContent content = deserializeContent(contents[i].PersistString);
+ if (content == null)
+ content = new DummyContent();
+ content.DockHandler.DockPanel = dockPanel;
+ content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
+ content.DockHandler.IsHidden = true;
+ content.DockHandler.IsFloat = contents[i].IsFloat;
+ }
+
+ // Create panes
+ for (int i = 0; i < panes.Length; i++)
+ {
+ DockPane pane = null;
+ for (int j = 0; j < panes[i].IndexContents.Length; j++)
+ {
+ IDockContent content = dockPanel.Contents[panes[i].IndexContents[j]];
+ if (j == 0)
+ pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false);
+ else if (panes[i].DockState == DockState.Float)
+ content.DockHandler.FloatPane = pane;
+ else
+ content.DockHandler.PanelPane = pane;
+ }
+ }
+
+ // Assign Panes to DockWindows
+ for (int i = 0; i < dockWindows.Length; i++)
+ {
+ for (int j = 0; j < dockWindows[i].NestedPanes.Length; j++)
+ {
+ DockWindow dw = dockPanel.DockWindows[dockWindows[i].DockState];
+ int indexPane = dockWindows[i].NestedPanes[j].IndexPane;
+ DockPane pane = dockPanel.Panes[indexPane];
+ int indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane;
+ DockPane prevPane = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane];
+ DockAlignment alignment = dockWindows[i].NestedPanes[j].Alignment;
+ double proportion = dockWindows[i].NestedPanes[j].Proportion;
+ pane.DockTo(dw, prevPane, alignment, proportion);
+ if (panes[indexPane].DockState == dw.DockState)
+ panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex;
+ }
+ }
+
+ // Create float windows
+ for (int i = 0; i < floatWindows.Length; i++)
+ {
+ FloatWindow fw = null;
+ for (int j = 0; j < floatWindows[i].NestedPanes.Length; j++)
+ {
+ int indexPane = floatWindows[i].NestedPanes[j].IndexPane;
+ DockPane pane = dockPanel.Panes[indexPane];
+ if (j == 0)
+ fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
+ else
+ {
+ int indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane;
+ DockPane prevPane = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
+ DockAlignment alignment = floatWindows[i].NestedPanes[j].Alignment;
+ double proportion = floatWindows[i].NestedPanes[j].Proportion;
+ pane.DockTo(fw, prevPane, alignment, proportion);
+ }
+
+ if (panes[indexPane].DockState == fw.DockState)
+ panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex;
+ }
+ }
+
+ // sort IDockContent by its Pane's ZOrder
+ int[] sortedContents = null;
+ if (contents.Length > 0)
+ {
+ sortedContents = new int[contents.Length];
+ for (int i = 0; i < contents.Length; i++)
+ sortedContents[i] = i;
+
+ int lastDocument = contents.Length;
+ for (int i = 0; i < contents.Length - 1; i++)
+ {
+ for (int j = i + 1; j < contents.Length; j++)
+ {
+ DockPane pane1 = dockPanel.Contents[sortedContents[i]].DockHandler.Pane;
+ int ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
+ DockPane pane2 = dockPanel.Contents[sortedContents[j]].DockHandler.Pane;
+ int ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
+ if (ZOrderIndex1 > ZOrderIndex2)
+ {
+ int temp = sortedContents[i];
+ sortedContents[i] = sortedContents[j];
+ sortedContents[j] = temp;
+ }
+ }
+ }
+ }
+
+ // show non-document IDockContent first to avoid screen flickers
+ for (int i = 0; i < contents.Length; i++)
+ {
+ IDockContent content = dockPanel.Contents[sortedContents[i]];
+ if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document)
+ content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
+ }
+
+ // after all non-document IDockContent, show document IDockContent
+ for (int i = 0; i < contents.Length; i++)
+ {
+ IDockContent content = dockPanel.Contents[sortedContents[i]];
+ if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document)
+ content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
+ }
+
+ for (int i = 0; i < panes.Length; i++)
+ dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1 ? null : dockPanel.Contents[panes[i].IndexActiveContent];
+
+ if (dockPanelStruct.IndexActiveDocumentPane != -1)
+ dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate();
+
+ if (dockPanelStruct.IndexActivePane != -1)
+ dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate();
+
+ for (int i = dockPanel.Contents.Count - 1; i >= 0; i--)
+ if (dockPanel.Contents[i] is DummyContent)
+ dockPanel.Contents[i].DockHandler.Form.Close();
+
+ dockPanel.ResumeLayout(true, true);
+ }
+
+ private static bool MoveToNextElement(XmlTextReader xmlIn)
+ {
+ if (!xmlIn.Read())
+ return false;
+
+ while (xmlIn.NodeType == XmlNodeType.EndElement)
+ {
+ if (!xmlIn.Read())
+ return false;
+ }
+
+ return true;
+ }
+
+ private static bool IsFormatVersionValid(string formatVersion)
+ {
+ if (formatVersion == ConfigFileVersion)
+ return true;
+
+ foreach (string s in CompatibleConfigFileVersions)
+ if (s == formatVersion)
+ return true;
+
+ return false;
+ }
+ }
+
+ public void SaveAsXml(string fileName)
+ {
+ Persistor.SaveAsXml(this, fileName);
+ }
+
+ public void SaveAsXml(string fileName, Encoding encoding)
+ {
+ Persistor.SaveAsXml(this, fileName, encoding);
+ }
+
+ public void SaveAsXml(Stream stream, Encoding encoding)
+ {
+ Persistor.SaveAsXml(this, stream, encoding);
+ }
+
+ public void SaveAsXml(Stream stream, Encoding encoding, bool upstream)
+ {
+ Persistor.SaveAsXml(this, stream, encoding, upstream);
+ }
+
+ public void LoadFromXml(string fileName, DeserializeDockContent deserializeContent)
+ {
+ Persistor.LoadFromXml(this, fileName, deserializeContent);
+ }
+
+ public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent)
+ {
+ Persistor.LoadFromXml(this, stream, deserializeContent);
+ }
+
+ public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
+ {
+ Persistor.LoadFromXml(this, stream, deserializeContent, closeStream);
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanel.SplitterDragHandler.cs b/source/Docking/DockPanel.SplitterDragHandler.cs
similarity index 96%
rename from trunk/Docking/DockPanel.SplitterDragHandler.cs
rename to source/Docking/DockPanel.SplitterDragHandler.cs
index e6bab36..50b103d 100644
--- a/trunk/Docking/DockPanel.SplitterDragHandler.cs
+++ b/source/Docking/DockPanel.SplitterDragHandler.cs
@@ -1,165 +1,165 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.ComponentModel;
-
-namespace LSLEditor.Docking
-{
- partial class DockPanel
- {
- private sealed class SplitterDragHandler : DragHandler
- {
- private class SplitterOutline
- {
- public SplitterOutline()
- {
- m_dragForm = new DragForm();
- SetDragForm(Rectangle.Empty);
- DragForm.BackColor = Color.Black;
- DragForm.Opacity = 0.7;
- DragForm.Show(false);
- }
-
- DragForm m_dragForm;
- private DragForm DragForm
- {
- get { return m_dragForm; }
- }
-
- public void Show(Rectangle rect)
- {
- SetDragForm(rect);
- }
-
- public void Close()
- {
- DragForm.Close();
- }
-
- private void SetDragForm(Rectangle rect)
- {
- DragForm.Bounds = rect;
- if (rect == Rectangle.Empty)
- DragForm.Region = new Region(Rectangle.Empty);
- else if (DragForm.Region != null)
- DragForm.Region = null;
- }
- }
-
- public SplitterDragHandler(DockPanel dockPanel)
- : base(dockPanel)
- {
- }
-
- public new ISplitterDragSource DragSource
- {
- get { return base.DragSource as ISplitterDragSource; }
- private set { base.DragSource = value; }
- }
-
- private SplitterOutline m_outline;
- private SplitterOutline Outline
- {
- get { return m_outline; }
- set { m_outline = value; }
- }
-
- private Rectangle m_rectSplitter;
- private Rectangle RectSplitter
- {
- get { return m_rectSplitter; }
- set { m_rectSplitter = value; }
- }
-
- public void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
- {
- DragSource = dragSource;
- RectSplitter = rectSplitter;
-
- if (!BeginDrag())
- {
- DragSource = null;
- return;
- }
-
- Outline = new SplitterOutline();
- Outline.Show(rectSplitter);
- DragSource.BeginDrag(rectSplitter);
- }
-
- protected override void OnDragging()
- {
- Outline.Show(GetSplitterOutlineBounds(Control.MousePosition));
- }
-
- protected override void OnEndDrag(bool abort)
- {
- DockPanel.SuspendLayout(true);
-
- Outline.Close();
-
- if (!abort)
- DragSource.MoveSplitter(GetMovingOffset(Control.MousePosition));
-
- DragSource.EndDrag();
- DockPanel.ResumeLayout(true, true);
- }
-
- private int GetMovingOffset(Point ptMouse)
- {
- Rectangle rect = GetSplitterOutlineBounds(ptMouse);
- if (DragSource.IsVertical)
- return rect.X - RectSplitter.X;
- else
- return rect.Y - RectSplitter.Y;
- }
-
- private Rectangle GetSplitterOutlineBounds(Point ptMouse)
- {
- Rectangle rectLimit = DragSource.DragLimitBounds;
-
- Rectangle rect = RectSplitter;
- if (rectLimit.Width <= 0 || rectLimit.Height <= 0)
- return rect;
-
- if (DragSource.IsVertical)
- {
- rect.X += ptMouse.X - StartMousePosition.X;
- rect.Height = rectLimit.Height;
- }
- else
- {
- rect.Y += ptMouse.Y - StartMousePosition.Y;
- rect.Width = rectLimit.Width;
- }
-
- if (rect.Left < rectLimit.Left)
- rect.X = rectLimit.X;
- if (rect.Top < rectLimit.Top)
- rect.Y = rectLimit.Y;
- if (rect.Right > rectLimit.Right)
- rect.X -= rect.Right - rectLimit.Right;
- if (rect.Bottom > rectLimit.Bottom)
- rect.Y -= rect.Bottom - rectLimit.Bottom;
-
- return rect;
- }
- }
-
- private SplitterDragHandler m_splitterDragHandler = null;
- private SplitterDragHandler GetSplitterDragHandler()
- {
- if (m_splitterDragHandler == null)
- m_splitterDragHandler = new SplitterDragHandler(this);
- return m_splitterDragHandler;
- }
-
- internal void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
- {
- GetSplitterDragHandler().BeginDrag(dragSource, rectSplitter);
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.ComponentModel;
+
+namespace LSLEditor.Docking
+{
+ partial class DockPanel
+ {
+ private sealed class SplitterDragHandler : DragHandler
+ {
+ private class SplitterOutline
+ {
+ public SplitterOutline()
+ {
+ m_dragForm = new DragForm();
+ SetDragForm(Rectangle.Empty);
+ DragForm.BackColor = Color.Black;
+ DragForm.Opacity = 0.7;
+ DragForm.Show(false);
+ }
+
+ DragForm m_dragForm;
+ private DragForm DragForm
+ {
+ get { return m_dragForm; }
+ }
+
+ public void Show(Rectangle rect)
+ {
+ SetDragForm(rect);
+ }
+
+ public void Close()
+ {
+ DragForm.Close();
+ }
+
+ private void SetDragForm(Rectangle rect)
+ {
+ DragForm.Bounds = rect;
+ if (rect == Rectangle.Empty)
+ DragForm.Region = new Region(Rectangle.Empty);
+ else if (DragForm.Region != null)
+ DragForm.Region = null;
+ }
+ }
+
+ public SplitterDragHandler(DockPanel dockPanel)
+ : base(dockPanel)
+ {
+ }
+
+ public new ISplitterDragSource DragSource
+ {
+ get { return base.DragSource as ISplitterDragSource; }
+ private set { base.DragSource = value; }
+ }
+
+ private SplitterOutline m_outline;
+ private SplitterOutline Outline
+ {
+ get { return m_outline; }
+ set { m_outline = value; }
+ }
+
+ private Rectangle m_rectSplitter;
+ private Rectangle RectSplitter
+ {
+ get { return m_rectSplitter; }
+ set { m_rectSplitter = value; }
+ }
+
+ public void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
+ {
+ DragSource = dragSource;
+ RectSplitter = rectSplitter;
+
+ if (!BeginDrag())
+ {
+ DragSource = null;
+ return;
+ }
+
+ Outline = new SplitterOutline();
+ Outline.Show(rectSplitter);
+ DragSource.BeginDrag(rectSplitter);
+ }
+
+ protected override void OnDragging()
+ {
+ Outline.Show(GetSplitterOutlineBounds(Control.MousePosition));
+ }
+
+ protected override void OnEndDrag(bool abort)
+ {
+ DockPanel.SuspendLayout(true);
+
+ Outline.Close();
+
+ if (!abort)
+ DragSource.MoveSplitter(GetMovingOffset(Control.MousePosition));
+
+ DragSource.EndDrag();
+ DockPanel.ResumeLayout(true, true);
+ }
+
+ private int GetMovingOffset(Point ptMouse)
+ {
+ Rectangle rect = GetSplitterOutlineBounds(ptMouse);
+ if (DragSource.IsVertical)
+ return rect.X - RectSplitter.X;
+ else
+ return rect.Y - RectSplitter.Y;
+ }
+
+ private Rectangle GetSplitterOutlineBounds(Point ptMouse)
+ {
+ Rectangle rectLimit = DragSource.DragLimitBounds;
+
+ Rectangle rect = RectSplitter;
+ if (rectLimit.Width <= 0 || rectLimit.Height <= 0)
+ return rect;
+
+ if (DragSource.IsVertical)
+ {
+ rect.X += ptMouse.X - StartMousePosition.X;
+ rect.Height = rectLimit.Height;
+ }
+ else
+ {
+ rect.Y += ptMouse.Y - StartMousePosition.Y;
+ rect.Width = rectLimit.Width;
+ }
+
+ if (rect.Left < rectLimit.Left)
+ rect.X = rectLimit.X;
+ if (rect.Top < rectLimit.Top)
+ rect.Y = rectLimit.Y;
+ if (rect.Right > rectLimit.Right)
+ rect.X -= rect.Right - rectLimit.Right;
+ if (rect.Bottom > rectLimit.Bottom)
+ rect.Y -= rect.Bottom - rectLimit.Bottom;
+
+ return rect;
+ }
+ }
+
+ private SplitterDragHandler m_splitterDragHandler = null;
+ private SplitterDragHandler GetSplitterDragHandler()
+ {
+ if (m_splitterDragHandler == null)
+ m_splitterDragHandler = new SplitterDragHandler(this);
+ return m_splitterDragHandler;
+ }
+
+ internal void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
+ {
+ GetSplitterDragHandler().BeginDrag(dragSource, rectSplitter);
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanel.bmp b/source/Docking/DockPanel.bmp
similarity index 100%
rename from trunk/Docking/DockPanel.bmp
rename to source/Docking/DockPanel.bmp
diff --git a/trunk/Docking/DockPanel.cs b/source/Docking/DockPanel.cs
similarity index 96%
rename from trunk/Docking/DockPanel.cs
rename to source/Docking/DockPanel.cs
index c602dee..edefc53 100644
--- a/trunk/Docking/DockPanel.cs
+++ b/source/Docking/DockPanel.cs
@@ -1,1028 +1,1028 @@
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Runtime.InteropServices;
-using System.IO;
-using System.Text;
-using System.Diagnostics.CodeAnalysis;
-using System.Collections.Generic;
-
-// To simplify the process of finding the toolbox bitmap resource:
-// #1 Create an internal class called "resfinder" outside of the root namespace.
-// #2 Use "resfinder" in the toolbox bitmap attribute instead of the control name.
-// #3 use the "." string to locate the resource.
-// See: http://www.bobpowell.net/toolboxbitmap.htm
-internal class resfinder
-{
-}
-
-namespace LSLEditor.Docking
-{
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "0#")]
- public delegate IDockContent DeserializeDockContent(string persistString);
-
- [LocalizedDescription("DockPanel_Description")]
- [Designer(typeof(System.Windows.Forms.Design.ControlDesigner))]
- [ToolboxBitmap(typeof(resfinder), "LSLEditor.Docking.DockPanel.bmp")]
- [DefaultProperty("DocumentStyle")]
- [DefaultEvent("ActiveContentChanged")]
- public partial class DockPanel : Panel
- {
- private FocusManagerImpl m_focusManager;
- private DockPanelExtender m_extender;
- private DockPaneCollection m_panes;
- private FloatWindowCollection m_floatWindows;
- private AutoHideWindowControl m_autoHideWindow;
- private DockWindowCollection m_dockWindows;
- private DockContent m_dummyContent;
- private Control m_dummyControl;
-
- public DockPanel()
- {
- m_focusManager = new FocusManagerImpl(this);
- m_extender = new DockPanelExtender(this);
- m_panes = new DockPaneCollection();
- m_floatWindows = new FloatWindowCollection();
-
- SuspendLayout();
-
- m_autoHideWindow = new AutoHideWindowControl(this);
- m_autoHideWindow.Visible = false;
- SetAutoHideWindowParent();
-
- m_dummyControl = new DummyControl();
- m_dummyControl.Bounds = new Rectangle(0, 0, 1, 1);
- Controls.Add(m_dummyControl);
-
- m_dockWindows = new DockWindowCollection(this);
- Controls.AddRange(new Control[] {
- DockWindows[DockState.Document],
- DockWindows[DockState.DockLeft],
- DockWindows[DockState.DockRight],
- DockWindows[DockState.DockTop],
- DockWindows[DockState.DockBottom]
- });
-
- m_dummyContent = new DockContent();
- ResumeLayout();
- }
-
- private Color m_BackColor;
- ///
- /// Determines the color with which the client rectangle will be drawn.
- /// If you take this property instead of the BackColor it will not have any influence on the borders to the surrounding controls (DockPane).
- /// If you use BackColor the borders to the surrounding controls (DockPane) will also change there colors.
- /// Alternatively you can use both of them (BackColor to draw the define the color of the borders and DockBackColor to define the color of the client rectangle).
- /// For Backgroundimages: Set your prefered Image, then set the DockBackColor and the BackColor to the same Color (Control)
- ///
- public Color DockBackColor
- {
- get
- {
- return !m_BackColor.IsEmpty ? m_BackColor : base.BackColor;
- }
- set
- {
- m_BackColor = value;
- }
- }
-
- private AutoHideStripBase m_autoHideStripControl = null;
- internal AutoHideStripBase AutoHideStripControl
- {
- get
- {
- if (m_autoHideStripControl == null)
- {
- m_autoHideStripControl = AutoHideStripFactory.CreateAutoHideStrip(this);
- Controls.Add(m_autoHideStripControl);
- }
- return m_autoHideStripControl;
- }
- }
- internal void ResetAutoHideStripControl()
- {
- if (m_autoHideStripControl != null)
- m_autoHideStripControl.Dispose();
-
- m_autoHideStripControl = null;
- }
-
- private void MdiClientHandleAssigned(object sender, EventArgs e)
- {
- SetMdiClient();
- PerformLayout();
- }
-
- private void MdiClient_Layout(object sender, LayoutEventArgs e)
- {
- if (DocumentStyle != DocumentStyle.DockingMdi)
- return;
-
- foreach (DockPane pane in Panes)
- if (pane.DockState == DockState.Document)
- pane.SetContentBounds();
-
- InvalidateWindowRegion();
- }
-
- private bool m_disposed = false;
- protected override void Dispose(bool disposing)
- {
- lock (this)
- {
- if (!m_disposed && disposing)
- {
- m_focusManager.Dispose();
- if (m_mdiClientController != null)
- {
- m_mdiClientController.HandleAssigned -= new EventHandler(MdiClientHandleAssigned);
- m_mdiClientController.MdiChildActivate -= new EventHandler(ParentFormMdiChildActivate);
- m_mdiClientController.Layout -= new LayoutEventHandler(MdiClient_Layout);
- m_mdiClientController.Dispose();
- }
- FloatWindows.Dispose();
- Panes.Dispose();
- DummyContent.Dispose();
-
- m_disposed = true;
- }
-
- base.Dispose(disposing);
- }
- }
-
- [Browsable(false)]
- public IDockContent ActiveAutoHideContent
- {
- get { return AutoHideWindow.ActiveContent; }
- set { AutoHideWindow.ActiveContent = value; }
- }
-
- private bool m_allowEndUserDocking = true;
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_AllowEndUserDocking_Description")]
- [DefaultValue(true)]
- public bool AllowEndUserDocking
- {
- get { return m_allowEndUserDocking; }
- set { m_allowEndUserDocking = value; }
- }
-
- private bool m_allowEndUserNestedDocking = true;
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_AllowEndUserNestedDocking_Description")]
- [DefaultValue(true)]
- public bool AllowEndUserNestedDocking
- {
- get { return m_allowEndUserNestedDocking; }
- set { m_allowEndUserNestedDocking = value; }
- }
-
- private DockContentCollection m_contents = new DockContentCollection();
- [Browsable(false)]
- public DockContentCollection Contents
- {
- get { return m_contents; }
- }
-
- internal DockContent DummyContent
- {
- get { return m_dummyContent; }
- }
-
- private bool m_rightToLeftLayout = false;
- [DefaultValue(false)]
- [LocalizedCategory("Appearance")]
- [LocalizedDescription("DockPanel_RightToLeftLayout_Description")]
- public bool RightToLeftLayout
- {
- get { return m_rightToLeftLayout; }
- set
- {
- if (m_rightToLeftLayout == value)
- return;
-
- m_rightToLeftLayout = value;
- foreach (FloatWindow floatWindow in FloatWindows)
- floatWindow.RightToLeftLayout = value;
- }
- }
-
- protected override void OnRightToLeftChanged(EventArgs e)
- {
- base.OnRightToLeftChanged(e);
- foreach (FloatWindow floatWindow in FloatWindows)
- {
- if (floatWindow.RightToLeft != RightToLeft)
- floatWindow.RightToLeft = RightToLeft;
- }
- }
-
- private bool m_showDocumentIcon = false;
- [DefaultValue(false)]
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_ShowDocumentIcon_Description")]
- public bool ShowDocumentIcon
- {
- get { return m_showDocumentIcon; }
- set
- {
- if (m_showDocumentIcon == value)
- return;
-
- m_showDocumentIcon = value;
- Refresh();
- }
- }
-
- private DockPanelSkin m_dockPanelSkin = new DockPanelSkin();
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_DockPanelSkin")]
- public DockPanelSkin Skin
- {
- get { return m_dockPanelSkin; }
- set { m_dockPanelSkin = value; }
- }
-
- private DocumentTabStripLocation m_documentTabStripLocation = DocumentTabStripLocation.Top;
- [DefaultValue(DocumentTabStripLocation.Top)]
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_DocumentTabStripLocation")]
- public DocumentTabStripLocation DocumentTabStripLocation
- {
- get { return m_documentTabStripLocation; }
- set { m_documentTabStripLocation = value; }
- }
-
- [Browsable(false)]
- public DockPanelExtender Extender
- {
- get { return m_extender; }
- }
-
- public DockPanelExtender.IDockPaneFactory DockPaneFactory
- {
- get { return Extender.DockPaneFactory; }
- }
-
- public DockPanelExtender.IFloatWindowFactory FloatWindowFactory
- {
- get { return Extender.FloatWindowFactory; }
- }
-
- internal DockPanelExtender.IDockPaneCaptionFactory DockPaneCaptionFactory
- {
- get { return Extender.DockPaneCaptionFactory; }
- }
-
- internal DockPanelExtender.IDockPaneStripFactory DockPaneStripFactory
- {
- get { return Extender.DockPaneStripFactory; }
- }
-
- internal DockPanelExtender.IAutoHideStripFactory AutoHideStripFactory
- {
- get { return Extender.AutoHideStripFactory; }
- }
-
- [Browsable(false)]
- public DockPaneCollection Panes
- {
- get { return m_panes; }
- }
-
- internal Rectangle DockArea
- {
- get
- {
- return new Rectangle(DockPadding.Left, DockPadding.Top,
- ClientRectangle.Width - DockPadding.Left - DockPadding.Right,
- ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom);
- }
- }
-
- private double m_dockBottomPortion = 0.25;
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_DockBottomPortion_Description")]
- [DefaultValue(0.25)]
- public double DockBottomPortion
- {
- get { return m_dockBottomPortion; }
- set
- {
- if (value <= 0)
- throw new ArgumentOutOfRangeException("value");
-
- if (value == m_dockBottomPortion)
- return;
-
- m_dockBottomPortion = value;
-
- if (m_dockBottomPortion < 1 && m_dockTopPortion < 1)
- {
- if (m_dockTopPortion + m_dockBottomPortion > 1)
- m_dockTopPortion = 1 - m_dockBottomPortion;
- }
-
- PerformLayout();
- }
- }
-
- private double m_dockLeftPortion = 0.25;
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_DockLeftPortion_Description")]
- [DefaultValue(0.25)]
- public double DockLeftPortion
- {
- get { return m_dockLeftPortion; }
- set
- {
- if (value <= 0)
- throw new ArgumentOutOfRangeException("value");
-
- if (value == m_dockLeftPortion)
- return;
-
- m_dockLeftPortion = value;
-
- if (m_dockLeftPortion < 1 && m_dockRightPortion < 1)
- {
- if (m_dockLeftPortion + m_dockRightPortion > 1)
- m_dockRightPortion = 1 - m_dockLeftPortion;
- }
- PerformLayout();
- }
- }
-
- private double m_dockRightPortion = 0.25;
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_DockRightPortion_Description")]
- [DefaultValue(0.25)]
- public double DockRightPortion
- {
- get { return m_dockRightPortion; }
- set
- {
- if (value <= 0)
- throw new ArgumentOutOfRangeException("value");
-
- if (value == m_dockRightPortion)
- return;
-
- m_dockRightPortion = value;
-
- if (m_dockLeftPortion < 1 && m_dockRightPortion < 1)
- {
- if (m_dockLeftPortion + m_dockRightPortion > 1)
- m_dockLeftPortion = 1 - m_dockRightPortion;
- }
- PerformLayout();
- }
- }
-
- private double m_dockTopPortion = 0.25;
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_DockTopPortion_Description")]
- [DefaultValue(0.25)]
- public double DockTopPortion
- {
- get { return m_dockTopPortion; }
- set
- {
- if (value <= 0)
- throw new ArgumentOutOfRangeException("value");
-
- if (value == m_dockTopPortion)
- return;
-
- m_dockTopPortion = value;
-
- if (m_dockTopPortion < 1 && m_dockBottomPortion < 1)
- {
- if (m_dockTopPortion + m_dockBottomPortion > 1)
- m_dockBottomPortion = 1 - m_dockTopPortion;
- }
- PerformLayout();
- }
- }
-
- [Browsable(false)]
- public DockWindowCollection DockWindows
- {
- get { return m_dockWindows; }
- }
-
- public void UpdateDockWindowZOrder(DockStyle dockStyle, bool fullPanelEdge)
- {
- if (dockStyle == DockStyle.Left)
- {
- if (fullPanelEdge)
- DockWindows[DockState.DockLeft].SendToBack();
- else
- DockWindows[DockState.DockLeft].BringToFront();
- }
- else if (dockStyle == DockStyle.Right)
- {
- if (fullPanelEdge)
- DockWindows[DockState.DockRight].SendToBack();
- else
- DockWindows[DockState.DockRight].BringToFront();
- }
- else if (dockStyle == DockStyle.Top)
- {
- if (fullPanelEdge)
- DockWindows[DockState.DockTop].SendToBack();
- else
- DockWindows[DockState.DockTop].BringToFront();
- }
- else if (dockStyle == DockStyle.Bottom)
- {
- if (fullPanelEdge)
- DockWindows[DockState.DockBottom].SendToBack();
- else
- DockWindows[DockState.DockBottom].BringToFront();
- }
- }
-
- public int DocumentsCount
- {
- get
- {
- int count = 0;
- foreach (IDockContent content in Documents)
- count++;
-
- return count;
- }
- }
-
- public IDockContent[] DocumentsToArray()
- {
- int count = DocumentsCount;
- IDockContent[] documents = new IDockContent[count];
- int i = 0;
- foreach (IDockContent content in Documents)
- {
- documents[i] = content;
- i++;
- }
-
- return documents;
- }
-
- public IEnumerable Documents
- {
- get
- {
- foreach (IDockContent content in Contents)
- {
- if (content.DockHandler.DockState == DockState.Document)
- yield return content;
- }
- }
- }
-
- private Rectangle DocumentRectangle
- {
- get
- {
- Rectangle rect = DockArea;
- if (DockWindows[DockState.DockLeft].VisibleNestedPanes.Count != 0)
- {
- rect.X += (int)(DockArea.Width * DockLeftPortion);
- rect.Width -= (int)(DockArea.Width * DockLeftPortion);
- }
- if (DockWindows[DockState.DockRight].VisibleNestedPanes.Count != 0)
- rect.Width -= (int)(DockArea.Width * DockRightPortion);
- if (DockWindows[DockState.DockTop].VisibleNestedPanes.Count != 0)
- {
- rect.Y += (int)(DockArea.Height * DockTopPortion);
- rect.Height -= (int)(DockArea.Height * DockTopPortion);
- }
- if (DockWindows[DockState.DockBottom].VisibleNestedPanes.Count != 0)
- rect.Height -= (int)(DockArea.Height * DockBottomPortion);
-
- return rect;
- }
- }
-
- private Control DummyControl
- {
- get { return m_dummyControl; }
- }
-
- [Browsable(false)]
- public FloatWindowCollection FloatWindows
- {
- get { return m_floatWindows; }
- }
-
- private Size m_defaultFloatWindowSize = new Size(300, 300);
- [Category("Layout")]
- [LocalizedDescription("DockPanel_DefaultFloatWindowSize_Description")]
- public Size DefaultFloatWindowSize
- {
- get { return m_defaultFloatWindowSize; }
- set { m_defaultFloatWindowSize = value; }
- }
- private bool ShouldSerializeDefaultFloatWindowSize()
- {
- return DefaultFloatWindowSize != new Size(300, 300);
- }
-
- private DocumentStyle m_documentStyle = DocumentStyle.DockingMdi;
- [LocalizedCategory("Category_Docking")]
- [LocalizedDescription("DockPanel_DocumentStyle_Description")]
- [DefaultValue(DocumentStyle.DockingMdi)]
- public DocumentStyle DocumentStyle
- {
- get { return m_documentStyle; }
- set
- {
- if (value == m_documentStyle)
- return;
-
- if (!Enum.IsDefined(typeof(DocumentStyle), value))
- throw new InvalidEnumArgumentException();
-
- if (value == DocumentStyle.SystemMdi && DockWindows[DockState.Document].VisibleNestedPanes.Count > 0)
- throw new InvalidEnumArgumentException();
-
- m_documentStyle = value;
-
- SuspendLayout(true);
-
- SetAutoHideWindowParent();
- SetMdiClient();
- InvalidateWindowRegion();
-
- foreach (IDockContent content in Contents)
- {
- if (content.DockHandler.DockState == DockState.Document)
- content.DockHandler.SetPaneAndVisible(content.DockHandler.Pane);
- }
-
- PerformMdiClientLayout();
-
- ResumeLayout(true, true);
- }
- }
-
- private int GetDockWindowSize(DockState dockState)
- {
- if (dockState == DockState.DockLeft || dockState == DockState.DockRight)
- {
- int width = ClientRectangle.Width - DockPadding.Left - DockPadding.Right;
- int dockLeftSize = m_dockLeftPortion >= 1 ? (int)m_dockLeftPortion : (int)(width * m_dockLeftPortion);
- int dockRightSize = m_dockRightPortion >= 1 ? (int)m_dockRightPortion : (int)(width * m_dockRightPortion);
-
- if (dockLeftSize < MeasurePane.MinSize)
- dockLeftSize = MeasurePane.MinSize;
- if (dockRightSize < MeasurePane.MinSize)
- dockRightSize = MeasurePane.MinSize;
-
- if (dockLeftSize + dockRightSize > width - MeasurePane.MinSize)
- {
- int adjust = (dockLeftSize + dockRightSize) - (width - MeasurePane.MinSize);
- dockLeftSize -= adjust / 2;
- dockRightSize -= adjust / 2;
- }
-
- return dockState == DockState.DockLeft ? dockLeftSize : dockRightSize;
- }
- else if (dockState == DockState.DockTop || dockState == DockState.DockBottom)
- {
- int height = ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom;
- int dockTopSize = m_dockTopPortion >= 1 ? (int)m_dockTopPortion : (int)(height * m_dockTopPortion);
- int dockBottomSize = m_dockBottomPortion >= 1 ? (int)m_dockBottomPortion : (int)(height * m_dockBottomPortion);
-
- if (dockTopSize < MeasurePane.MinSize)
- dockTopSize = MeasurePane.MinSize;
- if (dockBottomSize < MeasurePane.MinSize)
- dockBottomSize = MeasurePane.MinSize;
-
- if (dockTopSize + dockBottomSize > height - MeasurePane.MinSize)
- {
- int adjust = (dockTopSize + dockBottomSize) - (height - MeasurePane.MinSize);
- dockTopSize -= adjust / 2;
- dockBottomSize -= adjust / 2;
- }
-
- return dockState == DockState.DockTop ? dockTopSize : dockBottomSize;
- }
- else
- return 0;
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- SuspendLayout(true);
-
- AutoHideStripControl.Bounds = ClientRectangle;
-
- CalculateDockPadding();
-
- DockWindows[DockState.DockLeft].Width = GetDockWindowSize(DockState.DockLeft);
- DockWindows[DockState.DockRight].Width = GetDockWindowSize(DockState.DockRight);
- DockWindows[DockState.DockTop].Height = GetDockWindowSize(DockState.DockTop);
- DockWindows[DockState.DockBottom].Height = GetDockWindowSize(DockState.DockBottom);
-
- AutoHideWindow.Bounds = GetAutoHideWindowBounds(AutoHideWindowRectangle);
-
- DockWindows[DockState.Document].BringToFront();
- AutoHideWindow.BringToFront();
-
- base.OnLayout(levent);
-
- if (DocumentStyle == DocumentStyle.SystemMdi && MdiClientExists)
- {
- SetMdiClientBounds(SystemMdiClientBounds);
- InvalidateWindowRegion();
- }
- else if (DocumentStyle == DocumentStyle.DockingMdi)
- InvalidateWindowRegion();
-
- ResumeLayout(true, true);
- }
-
- internal Rectangle GetTabStripRectangle(DockState dockState)
- {
- return AutoHideStripControl.GetTabStripRectangle(dockState);
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
-
- if (DockBackColor == BackColor) return;
-
- Graphics g = e.Graphics;
- SolidBrush bgBrush = new SolidBrush(DockBackColor);
- g.FillRectangle(bgBrush, ClientRectangle);
- }
-
- internal void AddContent(IDockContent content)
- {
- if (content == null)
- throw(new ArgumentNullException());
-
- if (!Contents.Contains(content))
- {
- Contents.Add(content);
- OnContentAdded(new DockContentEventArgs(content));
- }
- }
-
- internal void AddPane(DockPane pane)
- {
- if (Panes.Contains(pane))
- return;
-
- Panes.Add(pane);
- }
-
- internal void AddFloatWindow(FloatWindow floatWindow)
- {
- if (FloatWindows.Contains(floatWindow))
- return;
-
- FloatWindows.Add(floatWindow);
- }
-
- private void CalculateDockPadding()
- {
- DockPadding.All = 0;
-
- int height = AutoHideStripControl.MeasureHeight();
-
- if (AutoHideStripControl.GetNumberOfPanes(DockState.DockLeftAutoHide) > 0)
- DockPadding.Left = height;
- if (AutoHideStripControl.GetNumberOfPanes(DockState.DockRightAutoHide) > 0)
- DockPadding.Right = height;
- if (AutoHideStripControl.GetNumberOfPanes(DockState.DockTopAutoHide) > 0)
- DockPadding.Top = height;
- if (AutoHideStripControl.GetNumberOfPanes(DockState.DockBottomAutoHide) > 0)
- DockPadding.Bottom = height;
- }
-
- internal void RemoveContent(IDockContent content)
- {
- if (content == null)
- throw(new ArgumentNullException());
-
- if (Contents.Contains(content))
- {
- Contents.Remove(content);
- OnContentRemoved(new DockContentEventArgs(content));
- }
- }
-
- internal void RemovePane(DockPane pane)
- {
- if (!Panes.Contains(pane))
- return;
-
- Panes.Remove(pane);
- }
-
- internal void RemoveFloatWindow(FloatWindow floatWindow)
- {
- if (!FloatWindows.Contains(floatWindow))
- return;
-
- FloatWindows.Remove(floatWindow);
- }
-
- public void SetPaneIndex(DockPane pane, int index)
- {
- int oldIndex = Panes.IndexOf(pane);
- if (oldIndex == -1)
- throw(new ArgumentException(Strings.DockPanel_SetPaneIndex_InvalidPane));
-
- if (index < 0 || index > Panes.Count - 1)
- if (index != -1)
- throw(new ArgumentOutOfRangeException(Strings.DockPanel_SetPaneIndex_InvalidIndex));
-
- if (oldIndex == index)
- return;
- if (oldIndex == Panes.Count - 1 && index == -1)
- return;
-
- Panes.Remove(pane);
- if (index == -1)
- Panes.Add(pane);
- else if (oldIndex < index)
- Panes.AddAt(pane, index - 1);
- else
- Panes.AddAt(pane, index);
- }
-
- public void SuspendLayout(bool allWindows)
- {
- FocusManager.SuspendFocusTracking();
- SuspendLayout();
- if (allWindows)
- SuspendMdiClientLayout();
- }
-
- public void ResumeLayout(bool performLayout, bool allWindows)
- {
- FocusManager.ResumeFocusTracking();
- ResumeLayout(performLayout);
- if (allWindows)
- ResumeMdiClientLayout(performLayout);
- }
-
- internal Form ParentForm
- {
- get
- {
- if (!IsParentFormValid())
- throw new InvalidOperationException(Strings.DockPanel_ParentForm_Invalid);
-
- return GetMdiClientController().ParentForm;
- }
- }
-
- private bool IsParentFormValid()
- {
- if (DocumentStyle == DocumentStyle.DockingSdi || DocumentStyle == DocumentStyle.DockingWindow)
- return true;
-
- if (!MdiClientExists)
- GetMdiClientController().RenewMdiClient();
-
- return (MdiClientExists);
- }
-
- protected override void OnParentChanged(EventArgs e)
- {
- SetAutoHideWindowParent();
- GetMdiClientController().ParentForm = (this.Parent as Form);
- base.OnParentChanged (e);
- }
-
- private void SetAutoHideWindowParent()
- {
- Control parent;
- if (DocumentStyle == DocumentStyle.DockingMdi ||
- DocumentStyle == DocumentStyle.SystemMdi)
- parent = this.Parent;
- else
- parent = this;
- if (AutoHideWindow.Parent != parent)
- {
- AutoHideWindow.Parent = parent;
- AutoHideWindow.BringToFront();
- }
- }
-
- protected override void OnVisibleChanged(EventArgs e)
- {
- base.OnVisibleChanged (e);
-
- if (Visible)
- SetMdiClient();
- }
-
- private Rectangle SystemMdiClientBounds
- {
- get
- {
- if (!IsParentFormValid() || !Visible)
- return Rectangle.Empty;
-
- Rectangle rect = ParentForm.RectangleToClient(RectangleToScreen(DocumentWindowBounds));
- return rect;
- }
- }
-
- internal Rectangle DocumentWindowBounds
- {
- get
- {
- Rectangle rectDocumentBounds = DisplayRectangle;
- if (DockWindows[DockState.DockLeft].Visible)
- {
- rectDocumentBounds.X += DockWindows[DockState.DockLeft].Width;
- rectDocumentBounds.Width -= DockWindows[DockState.DockLeft].Width;
- }
- if (DockWindows[DockState.DockRight].Visible)
- rectDocumentBounds.Width -= DockWindows[DockState.DockRight].Width;
- if (DockWindows[DockState.DockTop].Visible)
- {
- rectDocumentBounds.Y += DockWindows[DockState.DockTop].Height;
- rectDocumentBounds.Height -= DockWindows[DockState.DockTop].Height;
- }
- if (DockWindows[DockState.DockBottom].Visible)
- rectDocumentBounds.Height -= DockWindows[DockState.DockBottom].Height;
-
- return rectDocumentBounds;
-
- }
- }
-
- private PaintEventHandler m_dummyControlPaintEventHandler = null;
- private void InvalidateWindowRegion()
- {
- if (DesignMode)
- return;
-
- if (m_dummyControlPaintEventHandler == null)
- m_dummyControlPaintEventHandler = new PaintEventHandler(DummyControl_Paint);
-
- DummyControl.Paint += m_dummyControlPaintEventHandler;
- DummyControl.Invalidate();
- }
-
- void DummyControl_Paint(object sender, PaintEventArgs e)
- {
- DummyControl.Paint -= m_dummyControlPaintEventHandler;
- UpdateWindowRegion();
- }
-
- private void UpdateWindowRegion()
- {
- if (this.DocumentStyle == DocumentStyle.DockingMdi)
- UpdateWindowRegion_ClipContent();
- else if (this.DocumentStyle == DocumentStyle.DockingSdi ||
- this.DocumentStyle == DocumentStyle.DockingWindow)
- UpdateWindowRegion_FullDocumentArea();
- else if (this.DocumentStyle == DocumentStyle.SystemMdi)
- UpdateWindowRegion_EmptyDocumentArea();
- }
-
- private void UpdateWindowRegion_FullDocumentArea()
- {
- SetRegion(null);
- }
-
- private void UpdateWindowRegion_EmptyDocumentArea()
- {
- Rectangle rect = DocumentWindowBounds;
- SetRegion(new Rectangle[] { rect });
- }
-
- private void UpdateWindowRegion_ClipContent()
- {
- int count = 0;
- foreach (DockPane pane in this.Panes)
- {
- if (!pane.Visible || pane.DockState != DockState.Document)
- continue;
-
- count ++;
- }
-
- if (count == 0)
- {
- SetRegion(null);
- return;
- }
-
- Rectangle[] rects = new Rectangle[count];
- int i = 0;
- foreach (DockPane pane in this.Panes)
- {
- if (!pane.Visible || pane.DockState != DockState.Document)
- continue;
-
- rects[i] = RectangleToClient(pane.RectangleToScreen(pane.ContentRectangle));
- i++;
- }
-
- SetRegion(rects);
- }
-
- private Rectangle[] m_clipRects = null;
- private void SetRegion(Rectangle[] clipRects)
- {
- if (!IsClipRectsChanged(clipRects))
- return;
-
- m_clipRects = clipRects;
-
- if (m_clipRects == null || m_clipRects.GetLength(0) == 0)
- Region = null;
- else
- {
- Region region = new Region(new Rectangle(0, 0, this.Width, this.Height));
- foreach (Rectangle rect in m_clipRects)
- region.Exclude(rect);
- Region = region;
- }
- }
-
- private bool IsClipRectsChanged(Rectangle[] clipRects)
- {
- if (clipRects == null && m_clipRects == null)
- return false;
- else if ((clipRects == null) != (m_clipRects == null))
- return true;
-
- foreach (Rectangle rect in clipRects)
- {
- bool matched = false;
- foreach (Rectangle rect2 in m_clipRects)
- {
- if (rect == rect2)
- {
- matched = true;
- break;
- }
- }
- if (!matched)
- return true;
- }
-
- foreach (Rectangle rect2 in m_clipRects)
- {
- bool matched = false;
- foreach (Rectangle rect in clipRects)
- {
- if (rect == rect2)
- {
- matched = true;
- break;
- }
- }
- if (!matched)
- return true;
- }
- return false;
- }
-
- private static readonly object ContentAddedEvent = new object();
- [LocalizedCategory("Category_DockingNotification")]
- [LocalizedDescription("DockPanel_ContentAdded_Description")]
- public event EventHandler ContentAdded
- {
- add { Events.AddHandler(ContentAddedEvent, value); }
- remove { Events.RemoveHandler(ContentAddedEvent, value); }
- }
- protected virtual void OnContentAdded(DockContentEventArgs e)
- {
- EventHandler handler = (EventHandler)Events[ContentAddedEvent];
- if (handler != null)
- handler(this, e);
- }
-
- private static readonly object ContentRemovedEvent = new object();
- [LocalizedCategory("Category_DockingNotification")]
- [LocalizedDescription("DockPanel_ContentRemoved_Description")]
- public event EventHandler ContentRemoved
- {
- add { Events.AddHandler(ContentRemovedEvent, value); }
- remove { Events.RemoveHandler(ContentRemovedEvent, value); }
- }
- protected virtual void OnContentRemoved(DockContentEventArgs e)
- {
- EventHandler handler = (EventHandler)Events[ContentRemovedEvent];
- if (handler != null)
- handler(this, e);
- }
- }
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using System.IO;
+using System.Text;
+using System.Diagnostics.CodeAnalysis;
+using System.Collections.Generic;
+
+// To simplify the process of finding the toolbox bitmap resource:
+// #1 Create an internal class called "resfinder" outside of the root namespace.
+// #2 Use "resfinder" in the toolbox bitmap attribute instead of the control name.
+// #3 use the "." string to locate the resource.
+// See: http://www.bobpowell.net/toolboxbitmap.htm
+internal class resfinder
+{
+}
+
+namespace LSLEditor.Docking
+{
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "0#")]
+ public delegate IDockContent DeserializeDockContent(string persistString);
+
+ [LocalizedDescription("DockPanel_Description")]
+ [Designer(typeof(System.Windows.Forms.Design.ControlDesigner))]
+ [ToolboxBitmap(typeof(resfinder), "LSLEditor.Docking.DockPanel.bmp")]
+ [DefaultProperty("DocumentStyle")]
+ [DefaultEvent("ActiveContentChanged")]
+ public partial class DockPanel : Panel
+ {
+ private FocusManagerImpl m_focusManager;
+ private DockPanelExtender m_extender;
+ private DockPaneCollection m_panes;
+ private FloatWindowCollection m_floatWindows;
+ private AutoHideWindowControl m_autoHideWindow;
+ private DockWindowCollection m_dockWindows;
+ private DockContent m_dummyContent;
+ private Control m_dummyControl;
+
+ public DockPanel()
+ {
+ m_focusManager = new FocusManagerImpl(this);
+ m_extender = new DockPanelExtender(this);
+ m_panes = new DockPaneCollection();
+ m_floatWindows = new FloatWindowCollection();
+
+ SuspendLayout();
+
+ m_autoHideWindow = new AutoHideWindowControl(this);
+ m_autoHideWindow.Visible = false;
+ SetAutoHideWindowParent();
+
+ m_dummyControl = new DummyControl();
+ m_dummyControl.Bounds = new Rectangle(0, 0, 1, 1);
+ Controls.Add(m_dummyControl);
+
+ m_dockWindows = new DockWindowCollection(this);
+ Controls.AddRange(new Control[] {
+ DockWindows[DockState.Document],
+ DockWindows[DockState.DockLeft],
+ DockWindows[DockState.DockRight],
+ DockWindows[DockState.DockTop],
+ DockWindows[DockState.DockBottom]
+ });
+
+ m_dummyContent = new DockContent();
+ ResumeLayout();
+ }
+
+ private Color m_BackColor;
+ ///
+ /// Determines the color with which the client rectangle will be drawn.
+ /// If you take this property instead of the BackColor it will not have any influence on the borders to the surrounding controls (DockPane).
+ /// If you use BackColor the borders to the surrounding controls (DockPane) will also change there colors.
+ /// Alternatively you can use both of them (BackColor to draw the define the color of the borders and DockBackColor to define the color of the client rectangle).
+ /// For Backgroundimages: Set your prefered Image, then set the DockBackColor and the BackColor to the same Color (Control)
+ ///
+ public Color DockBackColor
+ {
+ get
+ {
+ return !m_BackColor.IsEmpty ? m_BackColor : base.BackColor;
+ }
+ set
+ {
+ m_BackColor = value;
+ }
+ }
+
+ private AutoHideStripBase m_autoHideStripControl = null;
+ internal AutoHideStripBase AutoHideStripControl
+ {
+ get
+ {
+ if (m_autoHideStripControl == null)
+ {
+ m_autoHideStripControl = AutoHideStripFactory.CreateAutoHideStrip(this);
+ Controls.Add(m_autoHideStripControl);
+ }
+ return m_autoHideStripControl;
+ }
+ }
+ internal void ResetAutoHideStripControl()
+ {
+ if (m_autoHideStripControl != null)
+ m_autoHideStripControl.Dispose();
+
+ m_autoHideStripControl = null;
+ }
+
+ private void MdiClientHandleAssigned(object sender, EventArgs e)
+ {
+ SetMdiClient();
+ PerformLayout();
+ }
+
+ private void MdiClient_Layout(object sender, LayoutEventArgs e)
+ {
+ if (DocumentStyle != DocumentStyle.DockingMdi)
+ return;
+
+ foreach (DockPane pane in Panes)
+ if (pane.DockState == DockState.Document)
+ pane.SetContentBounds();
+
+ InvalidateWindowRegion();
+ }
+
+ private bool m_disposed = false;
+ protected override void Dispose(bool disposing)
+ {
+ lock (this)
+ {
+ if (!m_disposed && disposing)
+ {
+ m_focusManager.Dispose();
+ if (m_mdiClientController != null)
+ {
+ m_mdiClientController.HandleAssigned -= new EventHandler(MdiClientHandleAssigned);
+ m_mdiClientController.MdiChildActivate -= new EventHandler(ParentFormMdiChildActivate);
+ m_mdiClientController.Layout -= new LayoutEventHandler(MdiClient_Layout);
+ m_mdiClientController.Dispose();
+ }
+ FloatWindows.Dispose();
+ Panes.Dispose();
+ DummyContent.Dispose();
+
+ m_disposed = true;
+ }
+
+ base.Dispose(disposing);
+ }
+ }
+
+ [Browsable(false)]
+ public IDockContent ActiveAutoHideContent
+ {
+ get { return AutoHideWindow.ActiveContent; }
+ set { AutoHideWindow.ActiveContent = value; }
+ }
+
+ private bool m_allowEndUserDocking = true;
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_AllowEndUserDocking_Description")]
+ [DefaultValue(true)]
+ public bool AllowEndUserDocking
+ {
+ get { return m_allowEndUserDocking; }
+ set { m_allowEndUserDocking = value; }
+ }
+
+ private bool m_allowEndUserNestedDocking = true;
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_AllowEndUserNestedDocking_Description")]
+ [DefaultValue(true)]
+ public bool AllowEndUserNestedDocking
+ {
+ get { return m_allowEndUserNestedDocking; }
+ set { m_allowEndUserNestedDocking = value; }
+ }
+
+ private DockContentCollection m_contents = new DockContentCollection();
+ [Browsable(false)]
+ public DockContentCollection Contents
+ {
+ get { return m_contents; }
+ }
+
+ internal DockContent DummyContent
+ {
+ get { return m_dummyContent; }
+ }
+
+ private bool m_rightToLeftLayout = false;
+ [DefaultValue(false)]
+ [LocalizedCategory("Appearance")]
+ [LocalizedDescription("DockPanel_RightToLeftLayout_Description")]
+ public bool RightToLeftLayout
+ {
+ get { return m_rightToLeftLayout; }
+ set
+ {
+ if (m_rightToLeftLayout == value)
+ return;
+
+ m_rightToLeftLayout = value;
+ foreach (FloatWindow floatWindow in FloatWindows)
+ floatWindow.RightToLeftLayout = value;
+ }
+ }
+
+ protected override void OnRightToLeftChanged(EventArgs e)
+ {
+ base.OnRightToLeftChanged(e);
+ foreach (FloatWindow floatWindow in FloatWindows)
+ {
+ if (floatWindow.RightToLeft != RightToLeft)
+ floatWindow.RightToLeft = RightToLeft;
+ }
+ }
+
+ private bool m_showDocumentIcon = false;
+ [DefaultValue(false)]
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_ShowDocumentIcon_Description")]
+ public bool ShowDocumentIcon
+ {
+ get { return m_showDocumentIcon; }
+ set
+ {
+ if (m_showDocumentIcon == value)
+ return;
+
+ m_showDocumentIcon = value;
+ Refresh();
+ }
+ }
+
+ private DockPanelSkin m_dockPanelSkin = new DockPanelSkin();
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_DockPanelSkin")]
+ public DockPanelSkin Skin
+ {
+ get { return m_dockPanelSkin; }
+ set { m_dockPanelSkin = value; }
+ }
+
+ private DocumentTabStripLocation m_documentTabStripLocation = DocumentTabStripLocation.Top;
+ [DefaultValue(DocumentTabStripLocation.Top)]
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_DocumentTabStripLocation")]
+ public DocumentTabStripLocation DocumentTabStripLocation
+ {
+ get { return m_documentTabStripLocation; }
+ set { m_documentTabStripLocation = value; }
+ }
+
+ [Browsable(false)]
+ public DockPanelExtender Extender
+ {
+ get { return m_extender; }
+ }
+
+ public DockPanelExtender.IDockPaneFactory DockPaneFactory
+ {
+ get { return Extender.DockPaneFactory; }
+ }
+
+ public DockPanelExtender.IFloatWindowFactory FloatWindowFactory
+ {
+ get { return Extender.FloatWindowFactory; }
+ }
+
+ internal DockPanelExtender.IDockPaneCaptionFactory DockPaneCaptionFactory
+ {
+ get { return Extender.DockPaneCaptionFactory; }
+ }
+
+ internal DockPanelExtender.IDockPaneStripFactory DockPaneStripFactory
+ {
+ get { return Extender.DockPaneStripFactory; }
+ }
+
+ internal DockPanelExtender.IAutoHideStripFactory AutoHideStripFactory
+ {
+ get { return Extender.AutoHideStripFactory; }
+ }
+
+ [Browsable(false)]
+ public DockPaneCollection Panes
+ {
+ get { return m_panes; }
+ }
+
+ internal Rectangle DockArea
+ {
+ get
+ {
+ return new Rectangle(DockPadding.Left, DockPadding.Top,
+ ClientRectangle.Width - DockPadding.Left - DockPadding.Right,
+ ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom);
+ }
+ }
+
+ private double m_dockBottomPortion = 0.25;
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_DockBottomPortion_Description")]
+ [DefaultValue(0.25)]
+ public double DockBottomPortion
+ {
+ get { return m_dockBottomPortion; }
+ set
+ {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException("value");
+
+ if (value == m_dockBottomPortion)
+ return;
+
+ m_dockBottomPortion = value;
+
+ if (m_dockBottomPortion < 1 && m_dockTopPortion < 1)
+ {
+ if (m_dockTopPortion + m_dockBottomPortion > 1)
+ m_dockTopPortion = 1 - m_dockBottomPortion;
+ }
+
+ PerformLayout();
+ }
+ }
+
+ private double m_dockLeftPortion = 0.25;
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_DockLeftPortion_Description")]
+ [DefaultValue(0.25)]
+ public double DockLeftPortion
+ {
+ get { return m_dockLeftPortion; }
+ set
+ {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException("value");
+
+ if (value == m_dockLeftPortion)
+ return;
+
+ m_dockLeftPortion = value;
+
+ if (m_dockLeftPortion < 1 && m_dockRightPortion < 1)
+ {
+ if (m_dockLeftPortion + m_dockRightPortion > 1)
+ m_dockRightPortion = 1 - m_dockLeftPortion;
+ }
+ PerformLayout();
+ }
+ }
+
+ private double m_dockRightPortion = 0.25;
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_DockRightPortion_Description")]
+ [DefaultValue(0.25)]
+ public double DockRightPortion
+ {
+ get { return m_dockRightPortion; }
+ set
+ {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException("value");
+
+ if (value == m_dockRightPortion)
+ return;
+
+ m_dockRightPortion = value;
+
+ if (m_dockLeftPortion < 1 && m_dockRightPortion < 1)
+ {
+ if (m_dockLeftPortion + m_dockRightPortion > 1)
+ m_dockLeftPortion = 1 - m_dockRightPortion;
+ }
+ PerformLayout();
+ }
+ }
+
+ private double m_dockTopPortion = 0.25;
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_DockTopPortion_Description")]
+ [DefaultValue(0.25)]
+ public double DockTopPortion
+ {
+ get { return m_dockTopPortion; }
+ set
+ {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException("value");
+
+ if (value == m_dockTopPortion)
+ return;
+
+ m_dockTopPortion = value;
+
+ if (m_dockTopPortion < 1 && m_dockBottomPortion < 1)
+ {
+ if (m_dockTopPortion + m_dockBottomPortion > 1)
+ m_dockBottomPortion = 1 - m_dockTopPortion;
+ }
+ PerformLayout();
+ }
+ }
+
+ [Browsable(false)]
+ public DockWindowCollection DockWindows
+ {
+ get { return m_dockWindows; }
+ }
+
+ public void UpdateDockWindowZOrder(DockStyle dockStyle, bool fullPanelEdge)
+ {
+ if (dockStyle == DockStyle.Left)
+ {
+ if (fullPanelEdge)
+ DockWindows[DockState.DockLeft].SendToBack();
+ else
+ DockWindows[DockState.DockLeft].BringToFront();
+ }
+ else if (dockStyle == DockStyle.Right)
+ {
+ if (fullPanelEdge)
+ DockWindows[DockState.DockRight].SendToBack();
+ else
+ DockWindows[DockState.DockRight].BringToFront();
+ }
+ else if (dockStyle == DockStyle.Top)
+ {
+ if (fullPanelEdge)
+ DockWindows[DockState.DockTop].SendToBack();
+ else
+ DockWindows[DockState.DockTop].BringToFront();
+ }
+ else if (dockStyle == DockStyle.Bottom)
+ {
+ if (fullPanelEdge)
+ DockWindows[DockState.DockBottom].SendToBack();
+ else
+ DockWindows[DockState.DockBottom].BringToFront();
+ }
+ }
+
+ public int DocumentsCount
+ {
+ get
+ {
+ int count = 0;
+ foreach (IDockContent content in Documents)
+ count++;
+
+ return count;
+ }
+ }
+
+ public IDockContent[] DocumentsToArray()
+ {
+ int count = DocumentsCount;
+ IDockContent[] documents = new IDockContent[count];
+ int i = 0;
+ foreach (IDockContent content in Documents)
+ {
+ documents[i] = content;
+ i++;
+ }
+
+ return documents;
+ }
+
+ public IEnumerable Documents
+ {
+ get
+ {
+ foreach (IDockContent content in Contents)
+ {
+ if (content.DockHandler.DockState == DockState.Document)
+ yield return content;
+ }
+ }
+ }
+
+ private Rectangle DocumentRectangle
+ {
+ get
+ {
+ Rectangle rect = DockArea;
+ if (DockWindows[DockState.DockLeft].VisibleNestedPanes.Count != 0)
+ {
+ rect.X += (int)(DockArea.Width * DockLeftPortion);
+ rect.Width -= (int)(DockArea.Width * DockLeftPortion);
+ }
+ if (DockWindows[DockState.DockRight].VisibleNestedPanes.Count != 0)
+ rect.Width -= (int)(DockArea.Width * DockRightPortion);
+ if (DockWindows[DockState.DockTop].VisibleNestedPanes.Count != 0)
+ {
+ rect.Y += (int)(DockArea.Height * DockTopPortion);
+ rect.Height -= (int)(DockArea.Height * DockTopPortion);
+ }
+ if (DockWindows[DockState.DockBottom].VisibleNestedPanes.Count != 0)
+ rect.Height -= (int)(DockArea.Height * DockBottomPortion);
+
+ return rect;
+ }
+ }
+
+ private Control DummyControl
+ {
+ get { return m_dummyControl; }
+ }
+
+ [Browsable(false)]
+ public FloatWindowCollection FloatWindows
+ {
+ get { return m_floatWindows; }
+ }
+
+ private Size m_defaultFloatWindowSize = new Size(300, 300);
+ [Category("Layout")]
+ [LocalizedDescription("DockPanel_DefaultFloatWindowSize_Description")]
+ public Size DefaultFloatWindowSize
+ {
+ get { return m_defaultFloatWindowSize; }
+ set { m_defaultFloatWindowSize = value; }
+ }
+ private bool ShouldSerializeDefaultFloatWindowSize()
+ {
+ return DefaultFloatWindowSize != new Size(300, 300);
+ }
+
+ private DocumentStyle m_documentStyle = DocumentStyle.DockingMdi;
+ [LocalizedCategory("Category_Docking")]
+ [LocalizedDescription("DockPanel_DocumentStyle_Description")]
+ [DefaultValue(DocumentStyle.DockingMdi)]
+ public DocumentStyle DocumentStyle
+ {
+ get { return m_documentStyle; }
+ set
+ {
+ if (value == m_documentStyle)
+ return;
+
+ if (!Enum.IsDefined(typeof(DocumentStyle), value))
+ throw new InvalidEnumArgumentException();
+
+ if (value == DocumentStyle.SystemMdi && DockWindows[DockState.Document].VisibleNestedPanes.Count > 0)
+ throw new InvalidEnumArgumentException();
+
+ m_documentStyle = value;
+
+ SuspendLayout(true);
+
+ SetAutoHideWindowParent();
+ SetMdiClient();
+ InvalidateWindowRegion();
+
+ foreach (IDockContent content in Contents)
+ {
+ if (content.DockHandler.DockState == DockState.Document)
+ content.DockHandler.SetPaneAndVisible(content.DockHandler.Pane);
+ }
+
+ PerformMdiClientLayout();
+
+ ResumeLayout(true, true);
+ }
+ }
+
+ private int GetDockWindowSize(DockState dockState)
+ {
+ if (dockState == DockState.DockLeft || dockState == DockState.DockRight)
+ {
+ int width = ClientRectangle.Width - DockPadding.Left - DockPadding.Right;
+ int dockLeftSize = m_dockLeftPortion >= 1 ? (int)m_dockLeftPortion : (int)(width * m_dockLeftPortion);
+ int dockRightSize = m_dockRightPortion >= 1 ? (int)m_dockRightPortion : (int)(width * m_dockRightPortion);
+
+ if (dockLeftSize < MeasurePane.MinSize)
+ dockLeftSize = MeasurePane.MinSize;
+ if (dockRightSize < MeasurePane.MinSize)
+ dockRightSize = MeasurePane.MinSize;
+
+ if (dockLeftSize + dockRightSize > width - MeasurePane.MinSize)
+ {
+ int adjust = (dockLeftSize + dockRightSize) - (width - MeasurePane.MinSize);
+ dockLeftSize -= adjust / 2;
+ dockRightSize -= adjust / 2;
+ }
+
+ return dockState == DockState.DockLeft ? dockLeftSize : dockRightSize;
+ }
+ else if (dockState == DockState.DockTop || dockState == DockState.DockBottom)
+ {
+ int height = ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom;
+ int dockTopSize = m_dockTopPortion >= 1 ? (int)m_dockTopPortion : (int)(height * m_dockTopPortion);
+ int dockBottomSize = m_dockBottomPortion >= 1 ? (int)m_dockBottomPortion : (int)(height * m_dockBottomPortion);
+
+ if (dockTopSize < MeasurePane.MinSize)
+ dockTopSize = MeasurePane.MinSize;
+ if (dockBottomSize < MeasurePane.MinSize)
+ dockBottomSize = MeasurePane.MinSize;
+
+ if (dockTopSize + dockBottomSize > height - MeasurePane.MinSize)
+ {
+ int adjust = (dockTopSize + dockBottomSize) - (height - MeasurePane.MinSize);
+ dockTopSize -= adjust / 2;
+ dockBottomSize -= adjust / 2;
+ }
+
+ return dockState == DockState.DockTop ? dockTopSize : dockBottomSize;
+ }
+ else
+ return 0;
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ SuspendLayout(true);
+
+ AutoHideStripControl.Bounds = ClientRectangle;
+
+ CalculateDockPadding();
+
+ DockWindows[DockState.DockLeft].Width = GetDockWindowSize(DockState.DockLeft);
+ DockWindows[DockState.DockRight].Width = GetDockWindowSize(DockState.DockRight);
+ DockWindows[DockState.DockTop].Height = GetDockWindowSize(DockState.DockTop);
+ DockWindows[DockState.DockBottom].Height = GetDockWindowSize(DockState.DockBottom);
+
+ AutoHideWindow.Bounds = GetAutoHideWindowBounds(AutoHideWindowRectangle);
+
+ DockWindows[DockState.Document].BringToFront();
+ AutoHideWindow.BringToFront();
+
+ base.OnLayout(levent);
+
+ if (DocumentStyle == DocumentStyle.SystemMdi && MdiClientExists)
+ {
+ SetMdiClientBounds(SystemMdiClientBounds);
+ InvalidateWindowRegion();
+ }
+ else if (DocumentStyle == DocumentStyle.DockingMdi)
+ InvalidateWindowRegion();
+
+ ResumeLayout(true, true);
+ }
+
+ internal Rectangle GetTabStripRectangle(DockState dockState)
+ {
+ return AutoHideStripControl.GetTabStripRectangle(dockState);
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+
+ if (DockBackColor == BackColor) return;
+
+ Graphics g = e.Graphics;
+ SolidBrush bgBrush = new SolidBrush(DockBackColor);
+ g.FillRectangle(bgBrush, ClientRectangle);
+ }
+
+ internal void AddContent(IDockContent content)
+ {
+ if (content == null)
+ throw(new ArgumentNullException());
+
+ if (!Contents.Contains(content))
+ {
+ Contents.Add(content);
+ OnContentAdded(new DockContentEventArgs(content));
+ }
+ }
+
+ internal void AddPane(DockPane pane)
+ {
+ if (Panes.Contains(pane))
+ return;
+
+ Panes.Add(pane);
+ }
+
+ internal void AddFloatWindow(FloatWindow floatWindow)
+ {
+ if (FloatWindows.Contains(floatWindow))
+ return;
+
+ FloatWindows.Add(floatWindow);
+ }
+
+ private void CalculateDockPadding()
+ {
+ DockPadding.All = 0;
+
+ int height = AutoHideStripControl.MeasureHeight();
+
+ if (AutoHideStripControl.GetNumberOfPanes(DockState.DockLeftAutoHide) > 0)
+ DockPadding.Left = height;
+ if (AutoHideStripControl.GetNumberOfPanes(DockState.DockRightAutoHide) > 0)
+ DockPadding.Right = height;
+ if (AutoHideStripControl.GetNumberOfPanes(DockState.DockTopAutoHide) > 0)
+ DockPadding.Top = height;
+ if (AutoHideStripControl.GetNumberOfPanes(DockState.DockBottomAutoHide) > 0)
+ DockPadding.Bottom = height;
+ }
+
+ internal void RemoveContent(IDockContent content)
+ {
+ if (content == null)
+ throw(new ArgumentNullException());
+
+ if (Contents.Contains(content))
+ {
+ Contents.Remove(content);
+ OnContentRemoved(new DockContentEventArgs(content));
+ }
+ }
+
+ internal void RemovePane(DockPane pane)
+ {
+ if (!Panes.Contains(pane))
+ return;
+
+ Panes.Remove(pane);
+ }
+
+ internal void RemoveFloatWindow(FloatWindow floatWindow)
+ {
+ if (!FloatWindows.Contains(floatWindow))
+ return;
+
+ FloatWindows.Remove(floatWindow);
+ }
+
+ public void SetPaneIndex(DockPane pane, int index)
+ {
+ int oldIndex = Panes.IndexOf(pane);
+ if (oldIndex == -1)
+ throw(new ArgumentException(Strings.DockPanel_SetPaneIndex_InvalidPane));
+
+ if (index < 0 || index > Panes.Count - 1)
+ if (index != -1)
+ throw(new ArgumentOutOfRangeException(Strings.DockPanel_SetPaneIndex_InvalidIndex));
+
+ if (oldIndex == index)
+ return;
+ if (oldIndex == Panes.Count - 1 && index == -1)
+ return;
+
+ Panes.Remove(pane);
+ if (index == -1)
+ Panes.Add(pane);
+ else if (oldIndex < index)
+ Panes.AddAt(pane, index - 1);
+ else
+ Panes.AddAt(pane, index);
+ }
+
+ public void SuspendLayout(bool allWindows)
+ {
+ FocusManager.SuspendFocusTracking();
+ SuspendLayout();
+ if (allWindows)
+ SuspendMdiClientLayout();
+ }
+
+ public void ResumeLayout(bool performLayout, bool allWindows)
+ {
+ FocusManager.ResumeFocusTracking();
+ ResumeLayout(performLayout);
+ if (allWindows)
+ ResumeMdiClientLayout(performLayout);
+ }
+
+ internal Form ParentForm
+ {
+ get
+ {
+ if (!IsParentFormValid())
+ throw new InvalidOperationException(Strings.DockPanel_ParentForm_Invalid);
+
+ return GetMdiClientController().ParentForm;
+ }
+ }
+
+ private bool IsParentFormValid()
+ {
+ if (DocumentStyle == DocumentStyle.DockingSdi || DocumentStyle == DocumentStyle.DockingWindow)
+ return true;
+
+ if (!MdiClientExists)
+ GetMdiClientController().RenewMdiClient();
+
+ return (MdiClientExists);
+ }
+
+ protected override void OnParentChanged(EventArgs e)
+ {
+ SetAutoHideWindowParent();
+ GetMdiClientController().ParentForm = (this.Parent as Form);
+ base.OnParentChanged (e);
+ }
+
+ private void SetAutoHideWindowParent()
+ {
+ Control parent;
+ if (DocumentStyle == DocumentStyle.DockingMdi ||
+ DocumentStyle == DocumentStyle.SystemMdi)
+ parent = this.Parent;
+ else
+ parent = this;
+ if (AutoHideWindow.Parent != parent)
+ {
+ AutoHideWindow.Parent = parent;
+ AutoHideWindow.BringToFront();
+ }
+ }
+
+ protected override void OnVisibleChanged(EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+
+ if (Visible)
+ SetMdiClient();
+ }
+
+ private Rectangle SystemMdiClientBounds
+ {
+ get
+ {
+ if (!IsParentFormValid() || !Visible)
+ return Rectangle.Empty;
+
+ Rectangle rect = ParentForm.RectangleToClient(RectangleToScreen(DocumentWindowBounds));
+ return rect;
+ }
+ }
+
+ internal Rectangle DocumentWindowBounds
+ {
+ get
+ {
+ Rectangle rectDocumentBounds = DisplayRectangle;
+ if (DockWindows[DockState.DockLeft].Visible)
+ {
+ rectDocumentBounds.X += DockWindows[DockState.DockLeft].Width;
+ rectDocumentBounds.Width -= DockWindows[DockState.DockLeft].Width;
+ }
+ if (DockWindows[DockState.DockRight].Visible)
+ rectDocumentBounds.Width -= DockWindows[DockState.DockRight].Width;
+ if (DockWindows[DockState.DockTop].Visible)
+ {
+ rectDocumentBounds.Y += DockWindows[DockState.DockTop].Height;
+ rectDocumentBounds.Height -= DockWindows[DockState.DockTop].Height;
+ }
+ if (DockWindows[DockState.DockBottom].Visible)
+ rectDocumentBounds.Height -= DockWindows[DockState.DockBottom].Height;
+
+ return rectDocumentBounds;
+
+ }
+ }
+
+ private PaintEventHandler m_dummyControlPaintEventHandler = null;
+ private void InvalidateWindowRegion()
+ {
+ if (DesignMode)
+ return;
+
+ if (m_dummyControlPaintEventHandler == null)
+ m_dummyControlPaintEventHandler = new PaintEventHandler(DummyControl_Paint);
+
+ DummyControl.Paint += m_dummyControlPaintEventHandler;
+ DummyControl.Invalidate();
+ }
+
+ void DummyControl_Paint(object sender, PaintEventArgs e)
+ {
+ DummyControl.Paint -= m_dummyControlPaintEventHandler;
+ UpdateWindowRegion();
+ }
+
+ private void UpdateWindowRegion()
+ {
+ if (this.DocumentStyle == DocumentStyle.DockingMdi)
+ UpdateWindowRegion_ClipContent();
+ else if (this.DocumentStyle == DocumentStyle.DockingSdi ||
+ this.DocumentStyle == DocumentStyle.DockingWindow)
+ UpdateWindowRegion_FullDocumentArea();
+ else if (this.DocumentStyle == DocumentStyle.SystemMdi)
+ UpdateWindowRegion_EmptyDocumentArea();
+ }
+
+ private void UpdateWindowRegion_FullDocumentArea()
+ {
+ SetRegion(null);
+ }
+
+ private void UpdateWindowRegion_EmptyDocumentArea()
+ {
+ Rectangle rect = DocumentWindowBounds;
+ SetRegion(new Rectangle[] { rect });
+ }
+
+ private void UpdateWindowRegion_ClipContent()
+ {
+ int count = 0;
+ foreach (DockPane pane in this.Panes)
+ {
+ if (!pane.Visible || pane.DockState != DockState.Document)
+ continue;
+
+ count ++;
+ }
+
+ if (count == 0)
+ {
+ SetRegion(null);
+ return;
+ }
+
+ Rectangle[] rects = new Rectangle[count];
+ int i = 0;
+ foreach (DockPane pane in this.Panes)
+ {
+ if (!pane.Visible || pane.DockState != DockState.Document)
+ continue;
+
+ rects[i] = RectangleToClient(pane.RectangleToScreen(pane.ContentRectangle));
+ i++;
+ }
+
+ SetRegion(rects);
+ }
+
+ private Rectangle[] m_clipRects = null;
+ private void SetRegion(Rectangle[] clipRects)
+ {
+ if (!IsClipRectsChanged(clipRects))
+ return;
+
+ m_clipRects = clipRects;
+
+ if (m_clipRects == null || m_clipRects.GetLength(0) == 0)
+ Region = null;
+ else
+ {
+ Region region = new Region(new Rectangle(0, 0, this.Width, this.Height));
+ foreach (Rectangle rect in m_clipRects)
+ region.Exclude(rect);
+ Region = region;
+ }
+ }
+
+ private bool IsClipRectsChanged(Rectangle[] clipRects)
+ {
+ if (clipRects == null && m_clipRects == null)
+ return false;
+ else if ((clipRects == null) != (m_clipRects == null))
+ return true;
+
+ foreach (Rectangle rect in clipRects)
+ {
+ bool matched = false;
+ foreach (Rectangle rect2 in m_clipRects)
+ {
+ if (rect == rect2)
+ {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched)
+ return true;
+ }
+
+ foreach (Rectangle rect2 in m_clipRects)
+ {
+ bool matched = false;
+ foreach (Rectangle rect in clipRects)
+ {
+ if (rect == rect2)
+ {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched)
+ return true;
+ }
+ return false;
+ }
+
+ private static readonly object ContentAddedEvent = new object();
+ [LocalizedCategory("Category_DockingNotification")]
+ [LocalizedDescription("DockPanel_ContentAdded_Description")]
+ public event EventHandler ContentAdded
+ {
+ add { Events.AddHandler(ContentAddedEvent, value); }
+ remove { Events.RemoveHandler(ContentAddedEvent, value); }
+ }
+ protected virtual void OnContentAdded(DockContentEventArgs e)
+ {
+ EventHandler handler = (EventHandler)Events[ContentAddedEvent];
+ if (handler != null)
+ handler(this, e);
+ }
+
+ private static readonly object ContentRemovedEvent = new object();
+ [LocalizedCategory("Category_DockingNotification")]
+ [LocalizedDescription("DockPanel_ContentRemoved_Description")]
+ public event EventHandler ContentRemoved
+ {
+ add { Events.AddHandler(ContentRemovedEvent, value); }
+ remove { Events.RemoveHandler(ContentRemovedEvent, value); }
+ }
+ protected virtual void OnContentRemoved(DockContentEventArgs e)
+ {
+ EventHandler handler = (EventHandler)Events[ContentRemovedEvent];
+ if (handler != null)
+ handler(this, e);
+ }
+ }
}
\ No newline at end of file
diff --git a/trunk/Docking/DockPanelExtender.cs b/source/Docking/DockPanelExtender.cs
similarity index 96%
rename from trunk/Docking/DockPanelExtender.cs
rename to source/Docking/DockPanelExtender.cs
index 08d431b..9053039 100644
--- a/trunk/Docking/DockPanelExtender.cs
+++ b/source/Docking/DockPanelExtender.cs
@@ -1,225 +1,225 @@
-using System;
-using System.Drawing;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- public sealed class DockPanelExtender
- {
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- public interface IDockPaneFactory
- {
- DockPane CreateDockPane(IDockContent content, DockState visibleState, bool show);
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
- DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show);
- DockPane CreateDockPane(IDockContent content, DockPane previousPane, DockAlignment alignment, double proportion, bool show);
- [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
- DockPane CreateDockPane(IDockContent content, Rectangle floatWindowBounds, bool show);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- public interface IFloatWindowFactory
- {
- FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane);
- FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- public interface IDockPaneCaptionFactory
- {
- DockPaneCaptionBase CreateDockPaneCaption(DockPane pane);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- public interface IDockPaneStripFactory
- {
- DockPaneStripBase CreateDockPaneStrip(DockPane pane);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
- public interface IAutoHideStripFactory
- {
- AutoHideStripBase CreateAutoHideStrip(DockPanel panel);
- }
-
- #region DefaultDockPaneFactory
- private class DefaultDockPaneFactory : IDockPaneFactory
- {
- public DockPane CreateDockPane(IDockContent content, DockState visibleState, bool show)
- {
- return new DockPane(content, visibleState, show);
- }
-
- public DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show)
- {
- return new DockPane(content, floatWindow, show);
- }
-
- public DockPane CreateDockPane(IDockContent content, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
- {
- return new DockPane(content, prevPane, alignment, proportion, show);
- }
-
- public DockPane CreateDockPane(IDockContent content, Rectangle floatWindowBounds, bool show)
- {
- return new DockPane(content, floatWindowBounds, show);
- }
- }
- #endregion
-
- #region DefaultFloatWindowFactory
- private class DefaultFloatWindowFactory : IFloatWindowFactory
- {
- public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane)
- {
- return new FloatWindow(dockPanel, pane);
- }
-
- public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
- {
- return new FloatWindow(dockPanel, pane, bounds);
- }
- }
- #endregion
-
- #region DefaultDockPaneCaptionFactory
- private class DefaultDockPaneCaptionFactory : IDockPaneCaptionFactory
- {
- public DockPaneCaptionBase CreateDockPaneCaption(DockPane pane)
- {
- return new VS2005DockPaneCaption(pane);
- }
- }
- #endregion
-
- #region DefaultDockPaneTabStripFactory
- private class DefaultDockPaneStripFactory : IDockPaneStripFactory
- {
- public DockPaneStripBase CreateDockPaneStrip(DockPane pane)
- {
- return new VS2005DockPaneStrip(pane);
- }
- }
- #endregion
-
- #region DefaultAutoHideStripFactory
- private class DefaultAutoHideStripFactory : IAutoHideStripFactory
- {
- public AutoHideStripBase CreateAutoHideStrip(DockPanel panel)
- {
- return new VS2005AutoHideStrip(panel);
- }
- }
- #endregion
-
- internal DockPanelExtender(DockPanel dockPanel)
- {
- m_dockPanel = dockPanel;
- }
-
- private DockPanel m_dockPanel;
- private DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- private IDockPaneFactory m_dockPaneFactory = null;
- public IDockPaneFactory DockPaneFactory
- {
- get
- {
- if (m_dockPaneFactory == null)
- m_dockPaneFactory = new DefaultDockPaneFactory();
-
- return m_dockPaneFactory;
- }
- set
- {
- if (DockPanel.Panes.Count > 0)
- throw new InvalidOperationException();
-
- m_dockPaneFactory = value;
- }
- }
-
- private IFloatWindowFactory m_floatWindowFactory = null;
- public IFloatWindowFactory FloatWindowFactory
- {
- get
- {
- if (m_floatWindowFactory == null)
- m_floatWindowFactory = new DefaultFloatWindowFactory();
-
- return m_floatWindowFactory;
- }
- set
- {
- if (DockPanel.FloatWindows.Count > 0)
- throw new InvalidOperationException();
-
- m_floatWindowFactory = value;
- }
- }
-
- private IDockPaneCaptionFactory m_dockPaneCaptionFactory = null;
- public IDockPaneCaptionFactory DockPaneCaptionFactory
- {
- get
- {
- if (m_dockPaneCaptionFactory == null)
- m_dockPaneCaptionFactory = new DefaultDockPaneCaptionFactory();
-
- return m_dockPaneCaptionFactory;
- }
- set
- {
- if (DockPanel.Panes.Count > 0)
- throw new InvalidOperationException();
-
- m_dockPaneCaptionFactory = value;
- }
- }
-
- private IDockPaneStripFactory m_dockPaneStripFactory = null;
- public IDockPaneStripFactory DockPaneStripFactory
- {
- get
- {
- if (m_dockPaneStripFactory == null)
- m_dockPaneStripFactory = new DefaultDockPaneStripFactory();
-
- return m_dockPaneStripFactory;
- }
- set
- {
- if (DockPanel.Contents.Count > 0)
- throw new InvalidOperationException();
-
- m_dockPaneStripFactory = value;
- }
- }
-
- private IAutoHideStripFactory m_autoHideStripFactory = null;
- public IAutoHideStripFactory AutoHideStripFactory
- {
- get
- {
- if (m_autoHideStripFactory == null)
- m_autoHideStripFactory = new DefaultAutoHideStripFactory();
-
- return m_autoHideStripFactory;
- }
- set
- {
- if (DockPanel.Contents.Count > 0)
- throw new InvalidOperationException();
-
- if (m_autoHideStripFactory == value)
- return;
-
- m_autoHideStripFactory = value;
- DockPanel.ResetAutoHideStripControl();
- }
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ public sealed class DockPanelExtender
+ {
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ public interface IDockPaneFactory
+ {
+ DockPane CreateDockPane(IDockContent content, DockState visibleState, bool show);
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
+ DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show);
+ DockPane CreateDockPane(IDockContent content, DockPane previousPane, DockAlignment alignment, double proportion, bool show);
+ [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "1#")]
+ DockPane CreateDockPane(IDockContent content, Rectangle floatWindowBounds, bool show);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ public interface IFloatWindowFactory
+ {
+ FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane);
+ FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ public interface IDockPaneCaptionFactory
+ {
+ DockPaneCaptionBase CreateDockPaneCaption(DockPane pane);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ public interface IDockPaneStripFactory
+ {
+ DockPaneStripBase CreateDockPaneStrip(DockPane pane);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
+ public interface IAutoHideStripFactory
+ {
+ AutoHideStripBase CreateAutoHideStrip(DockPanel panel);
+ }
+
+ #region DefaultDockPaneFactory
+ private class DefaultDockPaneFactory : IDockPaneFactory
+ {
+ public DockPane CreateDockPane(IDockContent content, DockState visibleState, bool show)
+ {
+ return new DockPane(content, visibleState, show);
+ }
+
+ public DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show)
+ {
+ return new DockPane(content, floatWindow, show);
+ }
+
+ public DockPane CreateDockPane(IDockContent content, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
+ {
+ return new DockPane(content, prevPane, alignment, proportion, show);
+ }
+
+ public DockPane CreateDockPane(IDockContent content, Rectangle floatWindowBounds, bool show)
+ {
+ return new DockPane(content, floatWindowBounds, show);
+ }
+ }
+ #endregion
+
+ #region DefaultFloatWindowFactory
+ private class DefaultFloatWindowFactory : IFloatWindowFactory
+ {
+ public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane)
+ {
+ return new FloatWindow(dockPanel, pane);
+ }
+
+ public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
+ {
+ return new FloatWindow(dockPanel, pane, bounds);
+ }
+ }
+ #endregion
+
+ #region DefaultDockPaneCaptionFactory
+ private class DefaultDockPaneCaptionFactory : IDockPaneCaptionFactory
+ {
+ public DockPaneCaptionBase CreateDockPaneCaption(DockPane pane)
+ {
+ return new VS2005DockPaneCaption(pane);
+ }
+ }
+ #endregion
+
+ #region DefaultDockPaneTabStripFactory
+ private class DefaultDockPaneStripFactory : IDockPaneStripFactory
+ {
+ public DockPaneStripBase CreateDockPaneStrip(DockPane pane)
+ {
+ return new VS2005DockPaneStrip(pane);
+ }
+ }
+ #endregion
+
+ #region DefaultAutoHideStripFactory
+ private class DefaultAutoHideStripFactory : IAutoHideStripFactory
+ {
+ public AutoHideStripBase CreateAutoHideStrip(DockPanel panel)
+ {
+ return new VS2005AutoHideStrip(panel);
+ }
+ }
+ #endregion
+
+ internal DockPanelExtender(DockPanel dockPanel)
+ {
+ m_dockPanel = dockPanel;
+ }
+
+ private DockPanel m_dockPanel;
+ private DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ private IDockPaneFactory m_dockPaneFactory = null;
+ public IDockPaneFactory DockPaneFactory
+ {
+ get
+ {
+ if (m_dockPaneFactory == null)
+ m_dockPaneFactory = new DefaultDockPaneFactory();
+
+ return m_dockPaneFactory;
+ }
+ set
+ {
+ if (DockPanel.Panes.Count > 0)
+ throw new InvalidOperationException();
+
+ m_dockPaneFactory = value;
+ }
+ }
+
+ private IFloatWindowFactory m_floatWindowFactory = null;
+ public IFloatWindowFactory FloatWindowFactory
+ {
+ get
+ {
+ if (m_floatWindowFactory == null)
+ m_floatWindowFactory = new DefaultFloatWindowFactory();
+
+ return m_floatWindowFactory;
+ }
+ set
+ {
+ if (DockPanel.FloatWindows.Count > 0)
+ throw new InvalidOperationException();
+
+ m_floatWindowFactory = value;
+ }
+ }
+
+ private IDockPaneCaptionFactory m_dockPaneCaptionFactory = null;
+ public IDockPaneCaptionFactory DockPaneCaptionFactory
+ {
+ get
+ {
+ if (m_dockPaneCaptionFactory == null)
+ m_dockPaneCaptionFactory = new DefaultDockPaneCaptionFactory();
+
+ return m_dockPaneCaptionFactory;
+ }
+ set
+ {
+ if (DockPanel.Panes.Count > 0)
+ throw new InvalidOperationException();
+
+ m_dockPaneCaptionFactory = value;
+ }
+ }
+
+ private IDockPaneStripFactory m_dockPaneStripFactory = null;
+ public IDockPaneStripFactory DockPaneStripFactory
+ {
+ get
+ {
+ if (m_dockPaneStripFactory == null)
+ m_dockPaneStripFactory = new DefaultDockPaneStripFactory();
+
+ return m_dockPaneStripFactory;
+ }
+ set
+ {
+ if (DockPanel.Contents.Count > 0)
+ throw new InvalidOperationException();
+
+ m_dockPaneStripFactory = value;
+ }
+ }
+
+ private IAutoHideStripFactory m_autoHideStripFactory = null;
+ public IAutoHideStripFactory AutoHideStripFactory
+ {
+ get
+ {
+ if (m_autoHideStripFactory == null)
+ m_autoHideStripFactory = new DefaultAutoHideStripFactory();
+
+ return m_autoHideStripFactory;
+ }
+ set
+ {
+ if (DockPanel.Contents.Count > 0)
+ throw new InvalidOperationException();
+
+ if (m_autoHideStripFactory == value)
+ return;
+
+ m_autoHideStripFactory = value;
+ DockPanel.ResetAutoHideStripControl();
+ }
+ }
+ }
+}
diff --git a/trunk/Docking/DockPanelSkin.cs b/source/Docking/DockPanelSkin.cs
similarity index 97%
rename from trunk/Docking/DockPanelSkin.cs
rename to source/Docking/DockPanelSkin.cs
index fedd9be..1d48efb 100644
--- a/trunk/Docking/DockPanelSkin.cs
+++ b/source/Docking/DockPanelSkin.cs
@@ -1,421 +1,421 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Design;
-using System.Windows.Forms.Design;
-using System.ComponentModel;
-
-namespace LSLEditor.Docking
-{
- #region DockPanelSkin classes
- ///
- /// The skin to use when displaying the DockPanel.
- /// The skin allows custom gradient color schemes to be used when drawing the
- /// DockStrips and Tabs.
- ///
- [TypeConverter(typeof(DockPanelSkinConverter))]
- public class DockPanelSkin
- {
- private AutoHideStripSkin m_autoHideStripSkin;
- private DockPaneStripSkin m_dockPaneStripSkin;
-
- public DockPanelSkin()
- {
- m_autoHideStripSkin = new AutoHideStripSkin();
- m_dockPaneStripSkin = new DockPaneStripSkin();
- }
-
- ///
- /// The skin used to display the auto hide strips and tabs.
- ///
- public AutoHideStripSkin AutoHideStripSkin
- {
- get { return m_autoHideStripSkin; }
- set { m_autoHideStripSkin = value; }
- }
-
- ///
- /// The skin used to display the Document and ToolWindow style DockStrips and Tabs.
- ///
- public DockPaneStripSkin DockPaneStripSkin
- {
- get { return m_dockPaneStripSkin; }
- set { m_dockPaneStripSkin = value; }
- }
- }
-
- ///
- /// The skin used to display the auto hide strip and tabs.
- ///
- [TypeConverter(typeof(AutoHideStripConverter))]
- public class AutoHideStripSkin
- {
- private DockPanelGradient m_dockStripGradient;
- private TabGradient m_TabGradient;
-
- public AutoHideStripSkin()
- {
- m_dockStripGradient = new DockPanelGradient();
- m_dockStripGradient.StartColor = SystemColors.ControlLight;
- m_dockStripGradient.EndColor = SystemColors.ControlLight;
-
- m_TabGradient = new TabGradient();
- m_TabGradient.TextColor = SystemColors.ControlDarkDark;
- }
-
- ///
- /// The gradient color skin for the DockStrips.
- ///
- public DockPanelGradient DockStripGradient
- {
- get { return m_dockStripGradient; }
- set { m_dockStripGradient = value; }
- }
-
- ///
- /// The gradient color skin for the Tabs.
- ///
- public TabGradient TabGradient
- {
- get { return m_TabGradient; }
- set { m_TabGradient = value; }
- }
- }
-
- ///
- /// The skin used to display the document and tool strips and tabs.
- ///
- [TypeConverter(typeof(DockPaneStripConverter))]
- public class DockPaneStripSkin
- {
- private DockPaneStripGradient m_DocumentGradient;
- private DockPaneStripToolWindowGradient m_ToolWindowGradient;
-
- public DockPaneStripSkin()
- {
- m_DocumentGradient = new DockPaneStripGradient();
- m_DocumentGradient.DockStripGradient.StartColor = SystemColors.Control;
- m_DocumentGradient.DockStripGradient.EndColor = SystemColors.Control;
- m_DocumentGradient.ActiveTabGradient.StartColor = SystemColors.ControlLightLight;
- m_DocumentGradient.ActiveTabGradient.EndColor = SystemColors.ControlLightLight;
- m_DocumentGradient.InactiveTabGradient.StartColor = SystemColors.ControlLight;
- m_DocumentGradient.InactiveTabGradient.EndColor = SystemColors.ControlLight;
-
- m_ToolWindowGradient = new DockPaneStripToolWindowGradient();
- m_ToolWindowGradient.DockStripGradient.StartColor = SystemColors.ControlLight;
- m_ToolWindowGradient.DockStripGradient.EndColor = SystemColors.ControlLight;
-
- m_ToolWindowGradient.ActiveTabGradient.StartColor = SystemColors.Control;
- m_ToolWindowGradient.ActiveTabGradient.EndColor = SystemColors.Control;
-
- m_ToolWindowGradient.InactiveTabGradient.StartColor = Color.Transparent;
- m_ToolWindowGradient.InactiveTabGradient.EndColor = Color.Transparent;
- m_ToolWindowGradient.InactiveTabGradient.TextColor = SystemColors.ControlDarkDark;
-
- m_ToolWindowGradient.ActiveCaptionGradient.StartColor = SystemColors.GradientActiveCaption;
- m_ToolWindowGradient.ActiveCaptionGradient.EndColor = SystemColors.ActiveCaption;
- m_ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical;
- m_ToolWindowGradient.ActiveCaptionGradient.TextColor = SystemColors.ActiveCaptionText;
-
- m_ToolWindowGradient.InactiveCaptionGradient.StartColor = SystemColors.GradientInactiveCaption;
- m_ToolWindowGradient.InactiveCaptionGradient.EndColor = SystemColors.GradientInactiveCaption;
- m_ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical;
- m_ToolWindowGradient.InactiveCaptionGradient.TextColor = SystemColors.ControlText;
- }
-
- ///
- /// The skin used to display the Document style DockPane strip and tab.
- ///
- public DockPaneStripGradient DocumentGradient
- {
- get { return m_DocumentGradient; }
- set { m_DocumentGradient = value; }
- }
-
- ///
- /// The skin used to display the ToolWindow style DockPane strip and tab.
- ///
- public DockPaneStripToolWindowGradient ToolWindowGradient
- {
- get { return m_ToolWindowGradient; }
- set { m_ToolWindowGradient = value; }
- }
- }
-
- ///
- /// The skin used to display the DockPane ToolWindow strip and tab.
- ///
- [TypeConverter(typeof(DockPaneStripGradientConverter))]
- public class DockPaneStripToolWindowGradient : DockPaneStripGradient
- {
- private TabGradient m_activeCaptionGradient;
- private TabGradient m_inactiveCaptionGradient;
-
- public DockPaneStripToolWindowGradient()
- {
- m_activeCaptionGradient = new TabGradient();
- m_inactiveCaptionGradient = new TabGradient();
- }
-
- ///
- /// The skin used to display the active ToolWindow caption.
- ///
- public TabGradient ActiveCaptionGradient
- {
- get { return m_activeCaptionGradient; }
- set { m_activeCaptionGradient = value; }
- }
-
- ///
- /// The skin used to display the inactive ToolWindow caption.
- ///
- public TabGradient InactiveCaptionGradient
- {
- get { return m_inactiveCaptionGradient; }
- set { m_inactiveCaptionGradient = value; }
- }
- }
-
- ///
- /// The skin used to display the DockPane strip and tab.
- ///
- [TypeConverter(typeof(DockPaneStripGradientConverter))]
- public class DockPaneStripGradient
- {
- private DockPanelGradient m_dockStripGradient;
- private TabGradient m_activeTabGradient;
- private TabGradient m_inactiveTabGradient;
-
- public DockPaneStripGradient()
- {
- m_dockStripGradient = new DockPanelGradient();
- m_activeTabGradient = new TabGradient();
- m_inactiveTabGradient = new TabGradient();
- }
-
- ///
- /// The gradient color skin for the DockStrip.
- ///
- public DockPanelGradient DockStripGradient
- {
- get { return m_dockStripGradient; }
- set { m_dockStripGradient = value; }
- }
-
- ///
- /// The skin used to display the active DockPane tabs.
- ///
- public TabGradient ActiveTabGradient
- {
- get { return m_activeTabGradient; }
- set { m_activeTabGradient = value; }
- }
-
- ///
- /// The skin used to display the inactive DockPane tabs.
- ///
- public TabGradient InactiveTabGradient
- {
- get { return m_inactiveTabGradient; }
- set { m_inactiveTabGradient = value; }
- }
- }
-
- ///
- /// The skin used to display the dock pane tab
- ///
- [TypeConverter(typeof(DockPaneTabGradientConverter))]
- public class TabGradient : DockPanelGradient
- {
- private Color m_textColor;
-
- public TabGradient()
- {
- m_textColor = SystemColors.ControlText;
- }
-
- ///
- /// The text color.
- ///
- [DefaultValue(typeof(SystemColors), "ControlText")]
- public Color TextColor
- {
- get { return m_textColor; }
- set { m_textColor = value; }
- }
- }
-
- ///
- /// The gradient color skin.
- ///
- [TypeConverter(typeof(DockPanelGradientConverter))]
- public class DockPanelGradient
- {
- private Color m_startColor;
- private Color m_endColor;
- private LinearGradientMode m_linearGradientMode;
-
- public DockPanelGradient()
- {
- m_startColor = SystemColors.Control;
- m_endColor = SystemColors.Control;
- m_linearGradientMode = LinearGradientMode.Horizontal;
- }
-
- ///
- /// The beginning gradient color.
- ///
- [DefaultValue(typeof(SystemColors), "Control")]
- public Color StartColor
- {
- get { return m_startColor; }
- set { m_startColor = value; }
- }
-
- ///
- /// The ending gradient color.
- ///
- [DefaultValue(typeof(SystemColors), "Control")]
- public Color EndColor
- {
- get { return m_endColor; }
- set { m_endColor = value; }
- }
-
- ///
- /// The gradient mode to display the colors.
- ///
- [DefaultValue(LinearGradientMode.Horizontal)]
- public LinearGradientMode LinearGradientMode
- {
- get { return m_linearGradientMode; }
- set { m_linearGradientMode = value; }
- }
- }
-
- #endregion
-
- #region Converters
- public class DockPanelSkinConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPanelSkin))
- return true;
-
- return base.CanConvertTo(context, destinationType);
- }
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPanelSkin)
- {
- return "DockPanelSkin";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
-
- public class DockPanelGradientConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPanelGradient))
- return true;
-
- return base.CanConvertTo(context, destinationType);
- }
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPanelGradient)
- {
- return "DockPanelGradient";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
-
- public class AutoHideStripConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(AutoHideStripSkin))
- return true;
-
- return base.CanConvertTo(context, destinationType);
- }
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is AutoHideStripSkin)
- {
- return "AutoHideStripSkin";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
-
- public class DockPaneStripConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPaneStripSkin))
- return true;
-
- return base.CanConvertTo(context, destinationType);
- }
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPaneStripSkin)
- {
- return "DockPaneStripSkin";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
-
- public class DockPaneStripGradientConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPaneStripGradient))
- return true;
-
- return base.CanConvertTo(context, destinationType);
- }
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPaneStripGradient)
- {
- return "DockPaneStripGradient";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
-
- public class DockPaneTabGradientConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(TabGradient))
- return true;
-
- return base.CanConvertTo(context, destinationType);
- }
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is TabGradient)
- {
- return "DockPaneTabGradient";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
- #endregion
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Design;
+using System.Windows.Forms.Design;
+using System.ComponentModel;
+
+namespace LSLEditor.Docking
+{
+ #region DockPanelSkin classes
+ ///
+ /// The skin to use when displaying the DockPanel.
+ /// The skin allows custom gradient color schemes to be used when drawing the
+ /// DockStrips and Tabs.
+ ///
+ [TypeConverter(typeof(DockPanelSkinConverter))]
+ public class DockPanelSkin
+ {
+ private AutoHideStripSkin m_autoHideStripSkin;
+ private DockPaneStripSkin m_dockPaneStripSkin;
+
+ public DockPanelSkin()
+ {
+ m_autoHideStripSkin = new AutoHideStripSkin();
+ m_dockPaneStripSkin = new DockPaneStripSkin();
+ }
+
+ ///
+ /// The skin used to display the auto hide strips and tabs.
+ ///
+ public AutoHideStripSkin AutoHideStripSkin
+ {
+ get { return m_autoHideStripSkin; }
+ set { m_autoHideStripSkin = value; }
+ }
+
+ ///
+ /// The skin used to display the Document and ToolWindow style DockStrips and Tabs.
+ ///
+ public DockPaneStripSkin DockPaneStripSkin
+ {
+ get { return m_dockPaneStripSkin; }
+ set { m_dockPaneStripSkin = value; }
+ }
+ }
+
+ ///
+ /// The skin used to display the auto hide strip and tabs.
+ ///
+ [TypeConverter(typeof(AutoHideStripConverter))]
+ public class AutoHideStripSkin
+ {
+ private DockPanelGradient m_dockStripGradient;
+ private TabGradient m_TabGradient;
+
+ public AutoHideStripSkin()
+ {
+ m_dockStripGradient = new DockPanelGradient();
+ m_dockStripGradient.StartColor = SystemColors.ControlLight;
+ m_dockStripGradient.EndColor = SystemColors.ControlLight;
+
+ m_TabGradient = new TabGradient();
+ m_TabGradient.TextColor = SystemColors.ControlDarkDark;
+ }
+
+ ///
+ /// The gradient color skin for the DockStrips.
+ ///
+ public DockPanelGradient DockStripGradient
+ {
+ get { return m_dockStripGradient; }
+ set { m_dockStripGradient = value; }
+ }
+
+ ///
+ /// The gradient color skin for the Tabs.
+ ///
+ public TabGradient TabGradient
+ {
+ get { return m_TabGradient; }
+ set { m_TabGradient = value; }
+ }
+ }
+
+ ///
+ /// The skin used to display the document and tool strips and tabs.
+ ///
+ [TypeConverter(typeof(DockPaneStripConverter))]
+ public class DockPaneStripSkin
+ {
+ private DockPaneStripGradient m_DocumentGradient;
+ private DockPaneStripToolWindowGradient m_ToolWindowGradient;
+
+ public DockPaneStripSkin()
+ {
+ m_DocumentGradient = new DockPaneStripGradient();
+ m_DocumentGradient.DockStripGradient.StartColor = SystemColors.Control;
+ m_DocumentGradient.DockStripGradient.EndColor = SystemColors.Control;
+ m_DocumentGradient.ActiveTabGradient.StartColor = SystemColors.ControlLightLight;
+ m_DocumentGradient.ActiveTabGradient.EndColor = SystemColors.ControlLightLight;
+ m_DocumentGradient.InactiveTabGradient.StartColor = SystemColors.ControlLight;
+ m_DocumentGradient.InactiveTabGradient.EndColor = SystemColors.ControlLight;
+
+ m_ToolWindowGradient = new DockPaneStripToolWindowGradient();
+ m_ToolWindowGradient.DockStripGradient.StartColor = SystemColors.ControlLight;
+ m_ToolWindowGradient.DockStripGradient.EndColor = SystemColors.ControlLight;
+
+ m_ToolWindowGradient.ActiveTabGradient.StartColor = SystemColors.Control;
+ m_ToolWindowGradient.ActiveTabGradient.EndColor = SystemColors.Control;
+
+ m_ToolWindowGradient.InactiveTabGradient.StartColor = Color.Transparent;
+ m_ToolWindowGradient.InactiveTabGradient.EndColor = Color.Transparent;
+ m_ToolWindowGradient.InactiveTabGradient.TextColor = SystemColors.ControlDarkDark;
+
+ m_ToolWindowGradient.ActiveCaptionGradient.StartColor = SystemColors.GradientActiveCaption;
+ m_ToolWindowGradient.ActiveCaptionGradient.EndColor = SystemColors.ActiveCaption;
+ m_ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical;
+ m_ToolWindowGradient.ActiveCaptionGradient.TextColor = SystemColors.ActiveCaptionText;
+
+ m_ToolWindowGradient.InactiveCaptionGradient.StartColor = SystemColors.GradientInactiveCaption;
+ m_ToolWindowGradient.InactiveCaptionGradient.EndColor = SystemColors.GradientInactiveCaption;
+ m_ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical;
+ m_ToolWindowGradient.InactiveCaptionGradient.TextColor = SystemColors.ControlText;
+ }
+
+ ///
+ /// The skin used to display the Document style DockPane strip and tab.
+ ///
+ public DockPaneStripGradient DocumentGradient
+ {
+ get { return m_DocumentGradient; }
+ set { m_DocumentGradient = value; }
+ }
+
+ ///
+ /// The skin used to display the ToolWindow style DockPane strip and tab.
+ ///
+ public DockPaneStripToolWindowGradient ToolWindowGradient
+ {
+ get { return m_ToolWindowGradient; }
+ set { m_ToolWindowGradient = value; }
+ }
+ }
+
+ ///
+ /// The skin used to display the DockPane ToolWindow strip and tab.
+ ///
+ [TypeConverter(typeof(DockPaneStripGradientConverter))]
+ public class DockPaneStripToolWindowGradient : DockPaneStripGradient
+ {
+ private TabGradient m_activeCaptionGradient;
+ private TabGradient m_inactiveCaptionGradient;
+
+ public DockPaneStripToolWindowGradient()
+ {
+ m_activeCaptionGradient = new TabGradient();
+ m_inactiveCaptionGradient = new TabGradient();
+ }
+
+ ///
+ /// The skin used to display the active ToolWindow caption.
+ ///
+ public TabGradient ActiveCaptionGradient
+ {
+ get { return m_activeCaptionGradient; }
+ set { m_activeCaptionGradient = value; }
+ }
+
+ ///
+ /// The skin used to display the inactive ToolWindow caption.
+ ///
+ public TabGradient InactiveCaptionGradient
+ {
+ get { return m_inactiveCaptionGradient; }
+ set { m_inactiveCaptionGradient = value; }
+ }
+ }
+
+ ///
+ /// The skin used to display the DockPane strip and tab.
+ ///
+ [TypeConverter(typeof(DockPaneStripGradientConverter))]
+ public class DockPaneStripGradient
+ {
+ private DockPanelGradient m_dockStripGradient;
+ private TabGradient m_activeTabGradient;
+ private TabGradient m_inactiveTabGradient;
+
+ public DockPaneStripGradient()
+ {
+ m_dockStripGradient = new DockPanelGradient();
+ m_activeTabGradient = new TabGradient();
+ m_inactiveTabGradient = new TabGradient();
+ }
+
+ ///
+ /// The gradient color skin for the DockStrip.
+ ///
+ public DockPanelGradient DockStripGradient
+ {
+ get { return m_dockStripGradient; }
+ set { m_dockStripGradient = value; }
+ }
+
+ ///
+ /// The skin used to display the active DockPane tabs.
+ ///
+ public TabGradient ActiveTabGradient
+ {
+ get { return m_activeTabGradient; }
+ set { m_activeTabGradient = value; }
+ }
+
+ ///
+ /// The skin used to display the inactive DockPane tabs.
+ ///
+ public TabGradient InactiveTabGradient
+ {
+ get { return m_inactiveTabGradient; }
+ set { m_inactiveTabGradient = value; }
+ }
+ }
+
+ ///
+ /// The skin used to display the dock pane tab
+ ///
+ [TypeConverter(typeof(DockPaneTabGradientConverter))]
+ public class TabGradient : DockPanelGradient
+ {
+ private Color m_textColor;
+
+ public TabGradient()
+ {
+ m_textColor = SystemColors.ControlText;
+ }
+
+ ///
+ /// The text color.
+ ///
+ [DefaultValue(typeof(SystemColors), "ControlText")]
+ public Color TextColor
+ {
+ get { return m_textColor; }
+ set { m_textColor = value; }
+ }
+ }
+
+ ///
+ /// The gradient color skin.
+ ///
+ [TypeConverter(typeof(DockPanelGradientConverter))]
+ public class DockPanelGradient
+ {
+ private Color m_startColor;
+ private Color m_endColor;
+ private LinearGradientMode m_linearGradientMode;
+
+ public DockPanelGradient()
+ {
+ m_startColor = SystemColors.Control;
+ m_endColor = SystemColors.Control;
+ m_linearGradientMode = LinearGradientMode.Horizontal;
+ }
+
+ ///
+ /// The beginning gradient color.
+ ///
+ [DefaultValue(typeof(SystemColors), "Control")]
+ public Color StartColor
+ {
+ get { return m_startColor; }
+ set { m_startColor = value; }
+ }
+
+ ///
+ /// The ending gradient color.
+ ///
+ [DefaultValue(typeof(SystemColors), "Control")]
+ public Color EndColor
+ {
+ get { return m_endColor; }
+ set { m_endColor = value; }
+ }
+
+ ///
+ /// The gradient mode to display the colors.
+ ///
+ [DefaultValue(LinearGradientMode.Horizontal)]
+ public LinearGradientMode LinearGradientMode
+ {
+ get { return m_linearGradientMode; }
+ set { m_linearGradientMode = value; }
+ }
+ }
+
+ #endregion
+
+ #region Converters
+ public class DockPanelSkinConverter : ExpandableObjectConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof(DockPanelSkin))
+ return true;
+
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(String) && value is DockPanelSkin)
+ {
+ return "DockPanelSkin";
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+
+ public class DockPanelGradientConverter : ExpandableObjectConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof(DockPanelGradient))
+ return true;
+
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(String) && value is DockPanelGradient)
+ {
+ return "DockPanelGradient";
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+
+ public class AutoHideStripConverter : ExpandableObjectConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof(AutoHideStripSkin))
+ return true;
+
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(String) && value is AutoHideStripSkin)
+ {
+ return "AutoHideStripSkin";
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+
+ public class DockPaneStripConverter : ExpandableObjectConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof(DockPaneStripSkin))
+ return true;
+
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(String) && value is DockPaneStripSkin)
+ {
+ return "DockPaneStripSkin";
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+
+ public class DockPaneStripGradientConverter : ExpandableObjectConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof(DockPaneStripGradient))
+ return true;
+
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(String) && value is DockPaneStripGradient)
+ {
+ return "DockPaneStripGradient";
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+
+ public class DockPaneTabGradientConverter : ExpandableObjectConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof(TabGradient))
+ return true;
+
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(String) && value is TabGradient)
+ {
+ return "DockPaneTabGradient";
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+ #endregion
+}
diff --git a/trunk/Docking/DockWindow.SplitterControl.cs b/source/Docking/DockWindow.SplitterControl.cs
similarity index 96%
rename from trunk/Docking/DockWindow.SplitterControl.cs
rename to source/Docking/DockWindow.SplitterControl.cs
index 756668f..74978aa 100644
--- a/trunk/Docking/DockWindow.SplitterControl.cs
+++ b/source/Docking/DockWindow.SplitterControl.cs
@@ -1,28 +1,28 @@
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- public partial class DockWindow
- {
- private class SplitterControl : SplitterBase
- {
- protected override int SplitterSize
- {
- get { return Measures.SplitterSize; }
- }
-
- protected override void StartDrag()
- {
- DockWindow window = Parent as DockWindow;
- if (window == null)
- return;
-
- window.DockPanel.BeginDrag(window, window.RectangleToScreen(Bounds));
- }
- }
- }
-}
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ public partial class DockWindow
+ {
+ private class SplitterControl : SplitterBase
+ {
+ protected override int SplitterSize
+ {
+ get { return Measures.SplitterSize; }
+ }
+
+ protected override void StartDrag()
+ {
+ DockWindow window = Parent as DockWindow;
+ if (window == null)
+ return;
+
+ window.DockPanel.BeginDrag(window, window.RectangleToScreen(Bounds));
+ }
+ }
+ }
+}
diff --git a/trunk/Docking/DockWindow.cs b/source/Docking/DockWindow.cs
similarity index 96%
rename from trunk/Docking/DockWindow.cs
rename to source/Docking/DockWindow.cs
index 71c6051..df8383a 100644
--- a/trunk/Docking/DockWindow.cs
+++ b/source/Docking/DockWindow.cs
@@ -1,243 +1,243 @@
-using System;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Runtime.InteropServices;
-using System.ComponentModel;
-
-namespace LSLEditor.Docking
-{
- [ToolboxItem(false)]
- public partial class DockWindow : Panel, INestedPanesContainer, ISplitterDragSource
- {
- private DockPanel m_dockPanel;
- private DockState m_dockState;
- private SplitterControl m_splitter;
- private NestedPaneCollection m_nestedPanes;
-
- internal DockWindow(DockPanel dockPanel, DockState dockState)
- {
- m_nestedPanes = new NestedPaneCollection(this);
- m_dockPanel = dockPanel;
- m_dockState = dockState;
- Visible = false;
-
- SuspendLayout();
-
- if (DockState == DockState.DockLeft || DockState == DockState.DockRight ||
- DockState == DockState.DockTop || DockState == DockState.DockBottom)
- {
- m_splitter = new SplitterControl();
- Controls.Add(m_splitter);
- }
-
- if (DockState == DockState.DockLeft)
- {
- Dock = DockStyle.Left;
- m_splitter.Dock = DockStyle.Right;
- }
- else if (DockState == DockState.DockRight)
- {
- Dock = DockStyle.Right;
- m_splitter.Dock = DockStyle.Left;
- }
- else if (DockState == DockState.DockTop)
- {
- Dock = DockStyle.Top;
- m_splitter.Dock = DockStyle.Bottom;
- }
- else if (DockState == DockState.DockBottom)
- {
- Dock = DockStyle.Bottom;
- m_splitter.Dock = DockStyle.Top;
- }
- else if (DockState == DockState.Document)
- {
- Dock = DockStyle.Fill;
- }
-
- ResumeLayout();
- }
-
- public VisibleNestedPaneCollection VisibleNestedPanes
- {
- get { return NestedPanes.VisibleNestedPanes; }
- }
-
- public NestedPaneCollection NestedPanes
- {
- get { return m_nestedPanes; }
- }
-
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- public DockState DockState
- {
- get { return m_dockState; }
- }
-
- public bool IsFloat
- {
- get { return DockState == DockState.Float; }
- }
-
- internal DockPane DefaultPane
- {
- get { return VisibleNestedPanes.Count == 0 ? null : VisibleNestedPanes[0]; }
- }
-
- public virtual Rectangle DisplayingRectangle
- {
- get
- {
- Rectangle rect = ClientRectangle;
- // if DockWindow is document, exclude the border
- if (DockState == DockState.Document)
- {
- rect.X += 1;
- rect.Y += 1;
- rect.Width -= 2;
- rect.Height -= 2;
- }
- // exclude the splitter
- else if (DockState == DockState.DockLeft)
- rect.Width -= Measures.SplitterSize;
- else if (DockState == DockState.DockRight)
- {
- rect.X += Measures.SplitterSize;
- rect.Width -= Measures.SplitterSize;
- }
- else if (DockState == DockState.DockTop)
- rect.Height -= Measures.SplitterSize;
- else if (DockState == DockState.DockBottom)
- {
- rect.Y += Measures.SplitterSize;
- rect.Height -= Measures.SplitterSize;
- }
-
- return rect;
- }
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- // if DockWindow is document, draw the border
- if (DockState == DockState.Document)
- e.Graphics.DrawRectangle(SystemPens.ControlDark, ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
-
- base.OnPaint(e);
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- VisibleNestedPanes.Refresh();
- if (VisibleNestedPanes.Count == 0)
- {
- if (Visible)
- Visible = false;
- }
- else if (!Visible)
- {
- Visible = true;
- VisibleNestedPanes.Refresh();
- }
-
- base.OnLayout (levent);
- }
-
- #region ISplitterDragSource Members
-
- void ISplitterDragSource.BeginDrag(Rectangle rectSplitter)
- {
- }
-
- void ISplitterDragSource.EndDrag()
- {
- }
-
- bool ISplitterDragSource.IsVertical
- {
- get { return (DockState == DockState.DockLeft || DockState == DockState.DockRight); }
- }
-
- Rectangle ISplitterDragSource.DragLimitBounds
- {
- get
- {
- Rectangle rectLimit = DockPanel.DockArea;
- Point location;
- if ((Control.ModifierKeys & Keys.Shift) == 0)
- location = Location;
- else
- location = DockPanel.DockArea.Location;
-
- if (((ISplitterDragSource)this).IsVertical)
- {
- rectLimit.X += MeasurePane.MinSize;
- rectLimit.Width -= 2 * MeasurePane.MinSize;
- rectLimit.Y = location.Y;
- if ((Control.ModifierKeys & Keys.Shift) == 0)
- rectLimit.Height = Height;
- }
- else
- {
- rectLimit.Y += MeasurePane.MinSize;
- rectLimit.Height -= 2 * MeasurePane.MinSize;
- rectLimit.X = location.X;
- if ((Control.ModifierKeys & Keys.Shift) == 0)
- rectLimit.Width = Width;
- }
-
- return DockPanel.RectangleToScreen(rectLimit);
- }
- }
-
- void ISplitterDragSource.MoveSplitter(int offset)
- {
- if ((Control.ModifierKeys & Keys.Shift) != 0)
- SendToBack();
-
- Rectangle rectDockArea = DockPanel.DockArea;
- if (DockState == DockState.DockLeft && rectDockArea.Width > 0)
- {
- if (DockPanel.DockLeftPortion > 1)
- DockPanel.DockLeftPortion = Width + offset;
- else
- DockPanel.DockLeftPortion += ((double)offset) / (double)rectDockArea.Width;
- }
- else if (DockState == DockState.DockRight && rectDockArea.Width > 0)
- {
- if (DockPanel.DockRightPortion > 1)
- DockPanel.DockRightPortion = Width - offset;
- else
- DockPanel.DockRightPortion -= ((double)offset) / (double)rectDockArea.Width;
- }
- else if (DockState == DockState.DockBottom && rectDockArea.Height > 0)
- {
- if (DockPanel.DockBottomPortion > 1)
- DockPanel.DockBottomPortion = Height - offset;
- else
- DockPanel.DockBottomPortion -= ((double)offset) / (double)rectDockArea.Height;
- }
- else if (DockState == DockState.DockTop && rectDockArea.Height > 0)
- {
- if (DockPanel.DockTopPortion > 1)
- DockPanel.DockTopPortion = Height + offset;
- else
- DockPanel.DockTopPortion += ((double)offset) / (double)rectDockArea.Height;
- }
- }
-
- #region IDragSource Members
-
- Control IDragSource.DragControl
- {
- get { return this; }
- }
-
- #endregion
- #endregion
- }
-}
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+
+namespace LSLEditor.Docking
+{
+ [ToolboxItem(false)]
+ public partial class DockWindow : Panel, INestedPanesContainer, ISplitterDragSource
+ {
+ private DockPanel m_dockPanel;
+ private DockState m_dockState;
+ private SplitterControl m_splitter;
+ private NestedPaneCollection m_nestedPanes;
+
+ internal DockWindow(DockPanel dockPanel, DockState dockState)
+ {
+ m_nestedPanes = new NestedPaneCollection(this);
+ m_dockPanel = dockPanel;
+ m_dockState = dockState;
+ Visible = false;
+
+ SuspendLayout();
+
+ if (DockState == DockState.DockLeft || DockState == DockState.DockRight ||
+ DockState == DockState.DockTop || DockState == DockState.DockBottom)
+ {
+ m_splitter = new SplitterControl();
+ Controls.Add(m_splitter);
+ }
+
+ if (DockState == DockState.DockLeft)
+ {
+ Dock = DockStyle.Left;
+ m_splitter.Dock = DockStyle.Right;
+ }
+ else if (DockState == DockState.DockRight)
+ {
+ Dock = DockStyle.Right;
+ m_splitter.Dock = DockStyle.Left;
+ }
+ else if (DockState == DockState.DockTop)
+ {
+ Dock = DockStyle.Top;
+ m_splitter.Dock = DockStyle.Bottom;
+ }
+ else if (DockState == DockState.DockBottom)
+ {
+ Dock = DockStyle.Bottom;
+ m_splitter.Dock = DockStyle.Top;
+ }
+ else if (DockState == DockState.Document)
+ {
+ Dock = DockStyle.Fill;
+ }
+
+ ResumeLayout();
+ }
+
+ public VisibleNestedPaneCollection VisibleNestedPanes
+ {
+ get { return NestedPanes.VisibleNestedPanes; }
+ }
+
+ public NestedPaneCollection NestedPanes
+ {
+ get { return m_nestedPanes; }
+ }
+
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ public DockState DockState
+ {
+ get { return m_dockState; }
+ }
+
+ public bool IsFloat
+ {
+ get { return DockState == DockState.Float; }
+ }
+
+ internal DockPane DefaultPane
+ {
+ get { return VisibleNestedPanes.Count == 0 ? null : VisibleNestedPanes[0]; }
+ }
+
+ public virtual Rectangle DisplayingRectangle
+ {
+ get
+ {
+ Rectangle rect = ClientRectangle;
+ // if DockWindow is document, exclude the border
+ if (DockState == DockState.Document)
+ {
+ rect.X += 1;
+ rect.Y += 1;
+ rect.Width -= 2;
+ rect.Height -= 2;
+ }
+ // exclude the splitter
+ else if (DockState == DockState.DockLeft)
+ rect.Width -= Measures.SplitterSize;
+ else if (DockState == DockState.DockRight)
+ {
+ rect.X += Measures.SplitterSize;
+ rect.Width -= Measures.SplitterSize;
+ }
+ else if (DockState == DockState.DockTop)
+ rect.Height -= Measures.SplitterSize;
+ else if (DockState == DockState.DockBottom)
+ {
+ rect.Y += Measures.SplitterSize;
+ rect.Height -= Measures.SplitterSize;
+ }
+
+ return rect;
+ }
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ // if DockWindow is document, draw the border
+ if (DockState == DockState.Document)
+ e.Graphics.DrawRectangle(SystemPens.ControlDark, ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
+
+ base.OnPaint(e);
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ VisibleNestedPanes.Refresh();
+ if (VisibleNestedPanes.Count == 0)
+ {
+ if (Visible)
+ Visible = false;
+ }
+ else if (!Visible)
+ {
+ Visible = true;
+ VisibleNestedPanes.Refresh();
+ }
+
+ base.OnLayout (levent);
+ }
+
+ #region ISplitterDragSource Members
+
+ void ISplitterDragSource.BeginDrag(Rectangle rectSplitter)
+ {
+ }
+
+ void ISplitterDragSource.EndDrag()
+ {
+ }
+
+ bool ISplitterDragSource.IsVertical
+ {
+ get { return (DockState == DockState.DockLeft || DockState == DockState.DockRight); }
+ }
+
+ Rectangle ISplitterDragSource.DragLimitBounds
+ {
+ get
+ {
+ Rectangle rectLimit = DockPanel.DockArea;
+ Point location;
+ if ((Control.ModifierKeys & Keys.Shift) == 0)
+ location = Location;
+ else
+ location = DockPanel.DockArea.Location;
+
+ if (((ISplitterDragSource)this).IsVertical)
+ {
+ rectLimit.X += MeasurePane.MinSize;
+ rectLimit.Width -= 2 * MeasurePane.MinSize;
+ rectLimit.Y = location.Y;
+ if ((Control.ModifierKeys & Keys.Shift) == 0)
+ rectLimit.Height = Height;
+ }
+ else
+ {
+ rectLimit.Y += MeasurePane.MinSize;
+ rectLimit.Height -= 2 * MeasurePane.MinSize;
+ rectLimit.X = location.X;
+ if ((Control.ModifierKeys & Keys.Shift) == 0)
+ rectLimit.Width = Width;
+ }
+
+ return DockPanel.RectangleToScreen(rectLimit);
+ }
+ }
+
+ void ISplitterDragSource.MoveSplitter(int offset)
+ {
+ if ((Control.ModifierKeys & Keys.Shift) != 0)
+ SendToBack();
+
+ Rectangle rectDockArea = DockPanel.DockArea;
+ if (DockState == DockState.DockLeft && rectDockArea.Width > 0)
+ {
+ if (DockPanel.DockLeftPortion > 1)
+ DockPanel.DockLeftPortion = Width + offset;
+ else
+ DockPanel.DockLeftPortion += ((double)offset) / (double)rectDockArea.Width;
+ }
+ else if (DockState == DockState.DockRight && rectDockArea.Width > 0)
+ {
+ if (DockPanel.DockRightPortion > 1)
+ DockPanel.DockRightPortion = Width - offset;
+ else
+ DockPanel.DockRightPortion -= ((double)offset) / (double)rectDockArea.Width;
+ }
+ else if (DockState == DockState.DockBottom && rectDockArea.Height > 0)
+ {
+ if (DockPanel.DockBottomPortion > 1)
+ DockPanel.DockBottomPortion = Height - offset;
+ else
+ DockPanel.DockBottomPortion -= ((double)offset) / (double)rectDockArea.Height;
+ }
+ else if (DockState == DockState.DockTop && rectDockArea.Height > 0)
+ {
+ if (DockPanel.DockTopPortion > 1)
+ DockPanel.DockTopPortion = Height + offset;
+ else
+ DockPanel.DockTopPortion += ((double)offset) / (double)rectDockArea.Height;
+ }
+ }
+
+ #region IDragSource Members
+
+ Control IDragSource.DragControl
+ {
+ get { return this; }
+ }
+
+ #endregion
+ #endregion
+ }
+}
diff --git a/trunk/Docking/DockWindowCollection.cs b/source/Docking/DockWindowCollection.cs
similarity index 97%
rename from trunk/Docking/DockWindowCollection.cs
rename to source/Docking/DockWindowCollection.cs
index ac41974..3894e07 100644
--- a/trunk/Docking/DockWindowCollection.cs
+++ b/source/Docking/DockWindowCollection.cs
@@ -1,38 +1,38 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace LSLEditor.Docking
-{
- public class DockWindowCollection : ReadOnlyCollection
- {
- internal DockWindowCollection(DockPanel dockPanel)
- : base(new List())
- {
- Items.Add(new DockWindow(dockPanel, DockState.Document));
- Items.Add(new DockWindow(dockPanel, DockState.DockLeft));
- Items.Add(new DockWindow(dockPanel, DockState.DockRight));
- Items.Add(new DockWindow(dockPanel, DockState.DockTop));
- Items.Add(new DockWindow(dockPanel, DockState.DockBottom));
- }
-
- public DockWindow this [DockState dockState]
- {
- get
- {
- if (dockState == DockState.Document)
- return Items[0];
- else if (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide)
- return Items[1];
- else if (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide)
- return Items[2];
- else if (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide)
- return Items[3];
- else if (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide)
- return Items[4];
-
- throw (new ArgumentOutOfRangeException());
- }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace LSLEditor.Docking
+{
+ public class DockWindowCollection : ReadOnlyCollection
+ {
+ internal DockWindowCollection(DockPanel dockPanel)
+ : base(new List())
+ {
+ Items.Add(new DockWindow(dockPanel, DockState.Document));
+ Items.Add(new DockWindow(dockPanel, DockState.DockLeft));
+ Items.Add(new DockWindow(dockPanel, DockState.DockRight));
+ Items.Add(new DockWindow(dockPanel, DockState.DockTop));
+ Items.Add(new DockWindow(dockPanel, DockState.DockBottom));
+ }
+
+ public DockWindow this [DockState dockState]
+ {
+ get
+ {
+ if (dockState == DockState.Document)
+ return Items[0];
+ else if (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide)
+ return Items[1];
+ else if (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide)
+ return Items[2];
+ else if (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide)
+ return Items[3];
+ else if (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide)
+ return Items[4];
+
+ throw (new ArgumentOutOfRangeException());
+ }
+ }
+ }
+}
diff --git a/trunk/Docking/DragForm.cs b/source/Docking/DragForm.cs
similarity index 97%
rename from trunk/Docking/DragForm.cs
rename to source/Docking/DragForm.cs
index 341ff96..08e7f3d 100644
--- a/trunk/Docking/DragForm.cs
+++ b/source/Docking/DragForm.cs
@@ -1,64 +1,64 @@
-using System;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- // Inspired by Chris Sano's article:
- // http://msdn.microsoft.com/smartclient/default.aspx?pull=/library/en-us/dnwinforms/html/colorpicker.asp
- // In Sano's article, the DragForm needs to meet the following criteria:
- // (1) it was not to show up in the task bar;
- // ShowInTaskBar = false
- // (2) it needed to be the top-most window;
- // TopMost = true (not necessary here)
- // (3) its icon could not show up in the ALT+TAB window if the user pressed ALT+TAB during a drag-and-drop;
- // FormBorderStyle = FormBorderStyle.None;
- // Create with WS_EX_TOOLWINDOW window style.
- // Compares with the solution in the artile by setting FormBorderStyle as FixedToolWindow,
- // and then clip the window caption and border, this way is much simplier.
- // (4) it was not to steal focus from the application when displayed.
- // User Win32 ShowWindow API with SW_SHOWNOACTIVATE
- // In addition, this form should only for display and therefore should act as transparent, otherwise
- // WindowFromPoint will return this form, instead of the control beneath. Need BOTH of the following to
- // achieve this (don't know why, spent hours to try it out :( ):
- // 1. Enabled = false;
- // 2. WM_NCHITTEST returns HTTRANSPARENT
- internal class DragForm : Form
- {
- public DragForm()
- {
- FormBorderStyle = FormBorderStyle.None;
- ShowInTaskbar = false;
- SetStyle(ControlStyles.Selectable, false);
- Enabled = false;
- }
-
- protected override CreateParams CreateParams
- {
- get
- {
- CreateParams createParams = base.CreateParams;
- createParams.ExStyle |= (int)Win32.WindowExStyles.WS_EX_TOOLWINDOW;
- return createParams;
- }
- }
-
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_NCHITTEST)
- {
- m.Result = (IntPtr)Win32.HitTest.HTTRANSPARENT;
- return;
- }
-
- base.WndProc (ref m);
- }
-
- public virtual void Show(bool bActivate)
- {
- if (bActivate)
- Show();
- else
- NativeMethods.ShowWindow(Handle, (int)Win32.ShowWindowStyles.SW_SHOWNOACTIVATE);
- }
- }
-}
+using System;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ // Inspired by Chris Sano's article:
+ // http://msdn.microsoft.com/smartclient/default.aspx?pull=/library/en-us/dnwinforms/html/colorpicker.asp
+ // In Sano's article, the DragForm needs to meet the following criteria:
+ // (1) it was not to show up in the task bar;
+ // ShowInTaskBar = false
+ // (2) it needed to be the top-most window;
+ // TopMost = true (not necessary here)
+ // (3) its icon could not show up in the ALT+TAB window if the user pressed ALT+TAB during a drag-and-drop;
+ // FormBorderStyle = FormBorderStyle.None;
+ // Create with WS_EX_TOOLWINDOW window style.
+ // Compares with the solution in the artile by setting FormBorderStyle as FixedToolWindow,
+ // and then clip the window caption and border, this way is much simplier.
+ // (4) it was not to steal focus from the application when displayed.
+ // User Win32 ShowWindow API with SW_SHOWNOACTIVATE
+ // In addition, this form should only for display and therefore should act as transparent, otherwise
+ // WindowFromPoint will return this form, instead of the control beneath. Need BOTH of the following to
+ // achieve this (don't know why, spent hours to try it out :( ):
+ // 1. Enabled = false;
+ // 2. WM_NCHITTEST returns HTTRANSPARENT
+ internal class DragForm : Form
+ {
+ public DragForm()
+ {
+ FormBorderStyle = FormBorderStyle.None;
+ ShowInTaskbar = false;
+ SetStyle(ControlStyles.Selectable, false);
+ Enabled = false;
+ }
+
+ protected override CreateParams CreateParams
+ {
+ get
+ {
+ CreateParams createParams = base.CreateParams;
+ createParams.ExStyle |= (int)Win32.WindowExStyles.WS_EX_TOOLWINDOW;
+ return createParams;
+ }
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ if (m.Msg == (int)Win32.Msgs.WM_NCHITTEST)
+ {
+ m.Result = (IntPtr)Win32.HitTest.HTTRANSPARENT;
+ return;
+ }
+
+ base.WndProc (ref m);
+ }
+
+ public virtual void Show(bool bActivate)
+ {
+ if (bActivate)
+ Show();
+ else
+ NativeMethods.ShowWindow(Handle, (int)Win32.ShowWindowStyles.SW_SHOWNOACTIVATE);
+ }
+ }
+}
diff --git a/trunk/Docking/DummyControl.cs b/source/Docking/DummyControl.cs
similarity index 93%
rename from trunk/Docking/DummyControl.cs
rename to source/Docking/DummyControl.cs
index e74d091..25933e3 100644
--- a/trunk/Docking/DummyControl.cs
+++ b/source/Docking/DummyControl.cs
@@ -1,13 +1,13 @@
-using System;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- internal class DummyControl : Control
- {
- public DummyControl()
- {
- SetStyle(ControlStyles.Selectable, false);
- }
- }
-}
+using System;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ internal class DummyControl : Control
+ {
+ public DummyControl()
+ {
+ SetStyle(ControlStyles.Selectable, false);
+ }
+ }
+}
diff --git a/trunk/Docking/Enums.cs b/source/Docking/Enums.cs
similarity index 93%
rename from trunk/Docking/Enums.cs
rename to source/Docking/Enums.cs
index 4325288..8ae2502 100644
--- a/trunk/Docking/Enums.cs
+++ b/source/Docking/Enums.cs
@@ -1,60 +1,60 @@
-using System;
-using System.ComponentModel;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- [Flags]
- [Serializable]
- [Editor(typeof(DockAreasEditor), typeof(System.Drawing.Design.UITypeEditor))]
- public enum DockAreas
- {
- Float = 1,
- DockLeft = 2,
- DockRight = 4,
- DockTop = 8,
- DockBottom = 16,
- Document = 32
- }
-
- public enum DockState
- {
- Unknown = 0,
- Float = 1,
- DockTopAutoHide = 2,
- DockLeftAutoHide = 3,
- DockBottomAutoHide = 4,
- DockRightAutoHide = 5,
- Document = 6,
- DockTop = 7,
- DockLeft = 8,
- DockBottom = 9,
- DockRight = 10,
- Hidden = 11
- }
-
- public enum DockAlignment
- {
- Left,
- Right,
- Top,
- Bottom
- }
-
- public enum DocumentStyle
- {
- DockingMdi,
- DockingWindow,
- DockingSdi,
- SystemMdi,
- }
-
- ///
- /// The location to draw the DockPaneStrip for Document style windows.
- ///
- public enum DocumentTabStripLocation
- {
- Top,
- Bottom
- }
-}
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ [Flags]
+ [Serializable]
+ [Editor(typeof(DockAreasEditor), typeof(System.Drawing.Design.UITypeEditor))]
+ public enum DockAreas
+ {
+ Float = 1,
+ DockLeft = 2,
+ DockRight = 4,
+ DockTop = 8,
+ DockBottom = 16,
+ Document = 32
+ }
+
+ public enum DockState
+ {
+ Unknown = 0,
+ Float = 1,
+ DockTopAutoHide = 2,
+ DockLeftAutoHide = 3,
+ DockBottomAutoHide = 4,
+ DockRightAutoHide = 5,
+ Document = 6,
+ DockTop = 7,
+ DockLeft = 8,
+ DockBottom = 9,
+ DockRight = 10,
+ Hidden = 11
+ }
+
+ public enum DockAlignment
+ {
+ Left,
+ Right,
+ Top,
+ Bottom
+ }
+
+ public enum DocumentStyle
+ {
+ DockingMdi,
+ DockingWindow,
+ DockingSdi,
+ SystemMdi,
+ }
+
+ ///
+ /// The location to draw the DockPaneStrip for Document style windows.
+ ///
+ public enum DocumentTabStripLocation
+ {
+ Top,
+ Bottom
+ }
+}
diff --git a/trunk/Docking/FloatWindow.cs b/source/Docking/FloatWindow.cs
similarity index 96%
rename from trunk/Docking/FloatWindow.cs
rename to source/Docking/FloatWindow.cs
index 98f96e8..671d124 100644
--- a/trunk/Docking/FloatWindow.cs
+++ b/source/Docking/FloatWindow.cs
@@ -1,453 +1,453 @@
-using System;
-using System.Collections;
-using System.Drawing;
-using System.Windows.Forms;
-using System.Runtime.InteropServices;
-using System.Security.Permissions;
-using System.Diagnostics.CodeAnalysis;
-
-namespace LSLEditor.Docking
-{
- public class FloatWindow : Form, INestedPanesContainer, IDockDragSource
- {
- private NestedPaneCollection m_nestedPanes;
- internal const int WM_CHECKDISPOSE = (int)(Win32.Msgs.WM_USER + 1);
-
- internal protected FloatWindow(DockPanel dockPanel, DockPane pane)
- {
- InternalConstruct(dockPanel, pane, false, Rectangle.Empty);
- }
-
- internal protected FloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
- {
- InternalConstruct(dockPanel, pane, true, bounds);
- }
-
- private void InternalConstruct(DockPanel dockPanel, DockPane pane, bool boundsSpecified, Rectangle bounds)
- {
- if (dockPanel == null)
- throw(new ArgumentNullException(Strings.FloatWindow_Constructor_NullDockPanel));
-
- m_nestedPanes = new NestedPaneCollection(this);
-
- FormBorderStyle = FormBorderStyle.SizableToolWindow;
- ShowInTaskbar = false;
- if (dockPanel.RightToLeft != RightToLeft)
- RightToLeft = dockPanel.RightToLeft;
- if (RightToLeftLayout != dockPanel.RightToLeftLayout)
- RightToLeftLayout = dockPanel.RightToLeftLayout;
-
- SuspendLayout();
- if (boundsSpecified)
- {
- Bounds = bounds;
- StartPosition = FormStartPosition.Manual;
- }
- else
- {
- StartPosition = FormStartPosition.WindowsDefaultLocation;
- Size = dockPanel.DefaultFloatWindowSize;
- }
-
- m_dockPanel = dockPanel;
- Owner = DockPanel.FindForm();
- DockPanel.AddFloatWindow(this);
- if (pane != null)
- pane.FloatWindow = this;
-
- ResumeLayout();
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (DockPanel != null)
- DockPanel.RemoveFloatWindow(this);
- m_dockPanel = null;
- }
- base.Dispose(disposing);
- }
-
- private bool m_allowEndUserDocking = true;
- public bool AllowEndUserDocking
- {
- get { return m_allowEndUserDocking; }
- set { m_allowEndUserDocking = value; }
- }
-
- public NestedPaneCollection NestedPanes
- {
- get { return m_nestedPanes; }
- }
-
- public VisibleNestedPaneCollection VisibleNestedPanes
- {
- get { return NestedPanes.VisibleNestedPanes; }
- }
-
- private DockPanel m_dockPanel;
- public DockPanel DockPanel
- {
- get { return m_dockPanel; }
- }
-
- public DockState DockState
- {
- get { return DockState.Float; }
- }
-
- public bool IsFloat
- {
- get { return DockState == DockState.Float; }
- }
-
- internal bool IsDockStateValid(DockState dockState)
- {
- foreach (DockPane pane in NestedPanes)
- foreach (IDockContent content in pane.Contents)
- if (!DockHelper.IsDockStateValid(dockState, content.DockHandler.DockAreas))
- return false;
-
- return true;
- }
-
- protected override void OnActivated(EventArgs e)
- {
- DockPanel.FloatWindows.BringWindowToFront(this);
- base.OnActivated (e);
- // Propagate the Activated event to the visible panes content objects
- foreach (DockPane pane in VisibleNestedPanes)
- foreach (IDockContent content in pane.Contents)
- content.OnActivated(e);
- }
-
- protected override void OnDeactivate(EventArgs e)
- {
- base.OnDeactivate(e);
- // Propagate the Deactivate event to the visible panes content objects
- foreach (DockPane pane in VisibleNestedPanes)
- foreach (IDockContent content in pane.Contents)
- content.OnDeactivate(e);
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- VisibleNestedPanes.Refresh();
- RefreshChanges();
- Visible = (VisibleNestedPanes.Count > 0);
- SetText();
-
- base.OnLayout(levent);
- }
-
-
- [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.Windows.Forms.Control.set_Text(System.String)")]
- internal void SetText()
- {
- DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
-
- if (theOnlyPane == null)
- Text = " "; // use " " instead of string.Empty because the whole title bar will disappear when ControlBox is set to false.
- else if (theOnlyPane.ActiveContent == null)
- Text = " ";
- else
- Text = theOnlyPane.ActiveContent.DockHandler.TabText;
- }
-
- protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
- {
- Rectangle rectWorkArea = SystemInformation.VirtualScreen;
-
- if (y + height > rectWorkArea.Bottom)
- y -= (y + height) - rectWorkArea.Bottom;
-
- if (y < rectWorkArea.Top)
- y += rectWorkArea.Top - y;
-
- base.SetBoundsCore (x, y, width, height, specified);
- }
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN)
- {
- if (IsDisposed)
- return;
-
- uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
- if (result == 2 && DockPanel.AllowEndUserDocking && this.AllowEndUserDocking) // HITTEST_CAPTION
- {
- Activate();
- m_dockPanel.BeginDrag(this);
- }
- else
- base.WndProc(ref m);
-
- return;
- }
- else if (m.Msg == (int)Win32.Msgs.WM_NCRBUTTONDOWN)
- {
- uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
- if (result == 2) // HITTEST_CAPTION
- {
- DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
- if (theOnlyPane != null && theOnlyPane.ActiveContent != null)
- {
- theOnlyPane.ShowTabPageContextMenu(this, PointToClient(Control.MousePosition));
- return;
- }
- }
-
- base.WndProc(ref m);
- return;
- }
- else if (m.Msg == (int)Win32.Msgs.WM_CLOSE)
- {
- if (NestedPanes.Count == 0)
- {
- base.WndProc(ref m);
- return;
- }
-
- for (int i = NestedPanes.Count - 1; i >= 0; i--)
- {
- DockContentCollection contents = NestedPanes[i].Contents;
- for (int j = contents.Count - 1; j >= 0; j--)
- {
- IDockContent content = contents[j];
- if (content.DockHandler.DockState != DockState.Float)
- continue;
-
- if (!content.DockHandler.CloseButton)
- continue;
-
- if (content.DockHandler.HideOnClose)
- content.DockHandler.Hide();
- else
- content.DockHandler.Close();
- }
- }
-
- return;
- }
- else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
- {
- uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
- if (result != 2) // HITTEST_CAPTION
- {
- base.WndProc(ref m);
- return;
- }
-
- DockPanel.SuspendLayout(true);
-
- // Restore to panel
- foreach (DockPane pane in NestedPanes)
- {
- if (pane.DockState != DockState.Float)
- continue;
- pane.RestoreToPanel();
- }
-
-
- DockPanel.ResumeLayout(true, true);
- return;
- }
- else if (m.Msg == WM_CHECKDISPOSE)
- {
- if (NestedPanes.Count == 0)
- Dispose();
-
- return;
- }
-
- base.WndProc(ref m);
- }
-
- internal void RefreshChanges()
- {
- if (IsDisposed)
- return;
-
- if (VisibleNestedPanes.Count == 0)
- {
- ControlBox = true;
- return;
- }
-
- for (int i=VisibleNestedPanes.Count - 1; i>=0; i--)
- {
- DockContentCollection contents = VisibleNestedPanes[i].Contents;
- for (int j=contents.Count - 1; j>=0; j--)
- {
- IDockContent content = contents[j];
- if (content.DockHandler.DockState != DockState.Float)
- continue;
-
- if (content.DockHandler.CloseButton && content.DockHandler.CloseButtonVisible)
- {
- ControlBox = true;
- return;
- }
- }
- }
- //Only if there is a ControlBox do we turn it off
- //old code caused a flash of the window.
- if (ControlBox)
- ControlBox = false;
- }
-
- public virtual Rectangle DisplayingRectangle
- {
- get { return ClientRectangle; }
- }
-
- internal void TestDrop(IDockDragSource dragSource, DockOutlineBase dockOutline)
- {
- if (VisibleNestedPanes.Count == 1)
- {
- DockPane pane = VisibleNestedPanes[0];
- if (!dragSource.CanDockTo(pane))
- return;
-
- Point ptMouse = Control.MousePosition;
- uint lParam = Win32Helper.MakeLong(ptMouse.X, ptMouse.Y);
- if (NativeMethods.SendMessage(Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, lParam) == (uint)Win32.HitTest.HTCAPTION)
- dockOutline.Show(VisibleNestedPanes[0], -1);
- }
- }
-
- #region IDockDragSource Members
-
- #region IDragSource Members
-
- Control IDragSource.DragControl
- {
- get { return this; }
- }
-
- #endregion
-
- bool IDockDragSource.IsDockStateValid(DockState dockState)
- {
- return IsDockStateValid(dockState);
- }
-
- bool IDockDragSource.CanDockTo(DockPane pane)
- {
- if (!IsDockStateValid(pane.DockState))
- return false;
-
- if (pane.FloatWindow == this)
- return false;
-
- return true;
- }
-
- Rectangle IDockDragSource.BeginDrag(Point ptMouse)
- {
- return Bounds;
- }
-
- public void FloatAt(Rectangle floatWindowBounds)
- {
- Bounds = floatWindowBounds;
- }
-
- public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
- {
- if (dockStyle == DockStyle.Fill)
- {
- for (int i = NestedPanes.Count - 1; i >= 0; i--)
- {
- DockPane paneFrom = NestedPanes[i];
- for (int j = paneFrom.Contents.Count - 1; j >= 0; j--)
- {
- IDockContent c = paneFrom.Contents[j];
- c.DockHandler.Pane = pane;
- if (contentIndex != -1)
- pane.SetContentIndex(c, contentIndex);
- c.DockHandler.Activate();
- }
- }
- }
- else
- {
- DockAlignment alignment = DockAlignment.Left;
- if (dockStyle == DockStyle.Left)
- alignment = DockAlignment.Left;
- else if (dockStyle == DockStyle.Right)
- alignment = DockAlignment.Right;
- else if (dockStyle == DockStyle.Top)
- alignment = DockAlignment.Top;
- else if (dockStyle == DockStyle.Bottom)
- alignment = DockAlignment.Bottom;
-
- MergeNestedPanes(VisibleNestedPanes, pane.NestedPanesContainer.NestedPanes, pane, alignment, 0.5);
- }
- }
-
- public void DockTo(DockPanel panel, DockStyle dockStyle)
- {
- if (panel != DockPanel)
- throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
-
- NestedPaneCollection nestedPanesTo = null;
-
- if (dockStyle == DockStyle.Top)
- nestedPanesTo = DockPanel.DockWindows[DockState.DockTop].NestedPanes;
- else if (dockStyle == DockStyle.Bottom)
- nestedPanesTo = DockPanel.DockWindows[DockState.DockBottom].NestedPanes;
- else if (dockStyle == DockStyle.Left)
- nestedPanesTo = DockPanel.DockWindows[DockState.DockLeft].NestedPanes;
- else if (dockStyle == DockStyle.Right)
- nestedPanesTo = DockPanel.DockWindows[DockState.DockRight].NestedPanes;
- else if (dockStyle == DockStyle.Fill)
- nestedPanesTo = DockPanel.DockWindows[DockState.Document].NestedPanes;
-
- DockPane prevPane = null;
- for (int i = nestedPanesTo.Count - 1; i >= 0; i--)
- if (nestedPanesTo[i] != VisibleNestedPanes[0])
- prevPane = nestedPanesTo[i];
- MergeNestedPanes(VisibleNestedPanes, nestedPanesTo, prevPane, DockAlignment.Left, 0.5);
- }
-
- private static void MergeNestedPanes(VisibleNestedPaneCollection nestedPanesFrom, NestedPaneCollection nestedPanesTo, DockPane prevPane, DockAlignment alignment, double proportion)
- {
- if (nestedPanesFrom.Count == 0)
- return;
-
- int count = nestedPanesFrom.Count;
- DockPane[] panes = new DockPane[count];
- DockPane[] prevPanes = new DockPane[count];
- DockAlignment[] alignments = new DockAlignment[count];
- double[] proportions = new double[count];
-
- for (int i = 0; i < count; i++)
- {
- panes[i] = nestedPanesFrom[i];
- prevPanes[i] = nestedPanesFrom[i].NestedDockingStatus.PreviousPane;
- alignments[i] = nestedPanesFrom[i].NestedDockingStatus.Alignment;
- proportions[i] = nestedPanesFrom[i].NestedDockingStatus.Proportion;
- }
-
- DockPane pane = panes[0].DockTo(nestedPanesTo.Container, prevPane, alignment, proportion);
- panes[0].DockState = nestedPanesTo.DockState;
-
- for (int i = 1; i < count; i++)
- {
- for (int j = i; j < count; j++)
- {
- if (prevPanes[j] == panes[i - 1])
- prevPanes[j] = pane;
- }
- pane = panes[i].DockTo(nestedPanesTo.Container, prevPanes[i], alignments[i], proportions[i]);
- panes[i].DockState = nestedPanesTo.DockState;
- }
- }
-
- #endregion
- }
-}
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+using System.Diagnostics.CodeAnalysis;
+
+namespace LSLEditor.Docking
+{
+ public class FloatWindow : Form, INestedPanesContainer, IDockDragSource
+ {
+ private NestedPaneCollection m_nestedPanes;
+ internal const int WM_CHECKDISPOSE = (int)(Win32.Msgs.WM_USER + 1);
+
+ internal protected FloatWindow(DockPanel dockPanel, DockPane pane)
+ {
+ InternalConstruct(dockPanel, pane, false, Rectangle.Empty);
+ }
+
+ internal protected FloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
+ {
+ InternalConstruct(dockPanel, pane, true, bounds);
+ }
+
+ private void InternalConstruct(DockPanel dockPanel, DockPane pane, bool boundsSpecified, Rectangle bounds)
+ {
+ if (dockPanel == null)
+ throw(new ArgumentNullException(Strings.FloatWindow_Constructor_NullDockPanel));
+
+ m_nestedPanes = new NestedPaneCollection(this);
+
+ FormBorderStyle = FormBorderStyle.SizableToolWindow;
+ ShowInTaskbar = false;
+ if (dockPanel.RightToLeft != RightToLeft)
+ RightToLeft = dockPanel.RightToLeft;
+ if (RightToLeftLayout != dockPanel.RightToLeftLayout)
+ RightToLeftLayout = dockPanel.RightToLeftLayout;
+
+ SuspendLayout();
+ if (boundsSpecified)
+ {
+ Bounds = bounds;
+ StartPosition = FormStartPosition.Manual;
+ }
+ else
+ {
+ StartPosition = FormStartPosition.WindowsDefaultLocation;
+ Size = dockPanel.DefaultFloatWindowSize;
+ }
+
+ m_dockPanel = dockPanel;
+ Owner = DockPanel.FindForm();
+ DockPanel.AddFloatWindow(this);
+ if (pane != null)
+ pane.FloatWindow = this;
+
+ ResumeLayout();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (DockPanel != null)
+ DockPanel.RemoveFloatWindow(this);
+ m_dockPanel = null;
+ }
+ base.Dispose(disposing);
+ }
+
+ private bool m_allowEndUserDocking = true;
+ public bool AllowEndUserDocking
+ {
+ get { return m_allowEndUserDocking; }
+ set { m_allowEndUserDocking = value; }
+ }
+
+ public NestedPaneCollection NestedPanes
+ {
+ get { return m_nestedPanes; }
+ }
+
+ public VisibleNestedPaneCollection VisibleNestedPanes
+ {
+ get { return NestedPanes.VisibleNestedPanes; }
+ }
+
+ private DockPanel m_dockPanel;
+ public DockPanel DockPanel
+ {
+ get { return m_dockPanel; }
+ }
+
+ public DockState DockState
+ {
+ get { return DockState.Float; }
+ }
+
+ public bool IsFloat
+ {
+ get { return DockState == DockState.Float; }
+ }
+
+ internal bool IsDockStateValid(DockState dockState)
+ {
+ foreach (DockPane pane in NestedPanes)
+ foreach (IDockContent content in pane.Contents)
+ if (!DockHelper.IsDockStateValid(dockState, content.DockHandler.DockAreas))
+ return false;
+
+ return true;
+ }
+
+ protected override void OnActivated(EventArgs e)
+ {
+ DockPanel.FloatWindows.BringWindowToFront(this);
+ base.OnActivated (e);
+ // Propagate the Activated event to the visible panes content objects
+ foreach (DockPane pane in VisibleNestedPanes)
+ foreach (IDockContent content in pane.Contents)
+ content.OnActivated(e);
+ }
+
+ protected override void OnDeactivate(EventArgs e)
+ {
+ base.OnDeactivate(e);
+ // Propagate the Deactivate event to the visible panes content objects
+ foreach (DockPane pane in VisibleNestedPanes)
+ foreach (IDockContent content in pane.Contents)
+ content.OnDeactivate(e);
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ VisibleNestedPanes.Refresh();
+ RefreshChanges();
+ Visible = (VisibleNestedPanes.Count > 0);
+ SetText();
+
+ base.OnLayout(levent);
+ }
+
+
+ [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.Windows.Forms.Control.set_Text(System.String)")]
+ internal void SetText()
+ {
+ DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
+
+ if (theOnlyPane == null)
+ Text = " "; // use " " instead of string.Empty because the whole title bar will disappear when ControlBox is set to false.
+ else if (theOnlyPane.ActiveContent == null)
+ Text = " ";
+ else
+ Text = theOnlyPane.ActiveContent.DockHandler.TabText;
+ }
+
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ Rectangle rectWorkArea = SystemInformation.VirtualScreen;
+
+ if (y + height > rectWorkArea.Bottom)
+ y -= (y + height) - rectWorkArea.Bottom;
+
+ if (y < rectWorkArea.Top)
+ y += rectWorkArea.Top - y;
+
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ protected override void WndProc(ref Message m)
+ {
+ if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN)
+ {
+ if (IsDisposed)
+ return;
+
+ uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
+ if (result == 2 && DockPanel.AllowEndUserDocking && this.AllowEndUserDocking) // HITTEST_CAPTION
+ {
+ Activate();
+ m_dockPanel.BeginDrag(this);
+ }
+ else
+ base.WndProc(ref m);
+
+ return;
+ }
+ else if (m.Msg == (int)Win32.Msgs.WM_NCRBUTTONDOWN)
+ {
+ uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
+ if (result == 2) // HITTEST_CAPTION
+ {
+ DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
+ if (theOnlyPane != null && theOnlyPane.ActiveContent != null)
+ {
+ theOnlyPane.ShowTabPageContextMenu(this, PointToClient(Control.MousePosition));
+ return;
+ }
+ }
+
+ base.WndProc(ref m);
+ return;
+ }
+ else if (m.Msg == (int)Win32.Msgs.WM_CLOSE)
+ {
+ if (NestedPanes.Count == 0)
+ {
+ base.WndProc(ref m);
+ return;
+ }
+
+ for (int i = NestedPanes.Count - 1; i >= 0; i--)
+ {
+ DockContentCollection contents = NestedPanes[i].Contents;
+ for (int j = contents.Count - 1; j >= 0; j--)
+ {
+ IDockContent content = contents[j];
+ if (content.DockHandler.DockState != DockState.Float)
+ continue;
+
+ if (!content.DockHandler.CloseButton)
+ continue;
+
+ if (content.DockHandler.HideOnClose)
+ content.DockHandler.Hide();
+ else
+ content.DockHandler.Close();
+ }
+ }
+
+ return;
+ }
+ else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
+ {
+ uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
+ if (result != 2) // HITTEST_CAPTION
+ {
+ base.WndProc(ref m);
+ return;
+ }
+
+ DockPanel.SuspendLayout(true);
+
+ // Restore to panel
+ foreach (DockPane pane in NestedPanes)
+ {
+ if (pane.DockState != DockState.Float)
+ continue;
+ pane.RestoreToPanel();
+ }
+
+
+ DockPanel.ResumeLayout(true, true);
+ return;
+ }
+ else if (m.Msg == WM_CHECKDISPOSE)
+ {
+ if (NestedPanes.Count == 0)
+ Dispose();
+
+ return;
+ }
+
+ base.WndProc(ref m);
+ }
+
+ internal void RefreshChanges()
+ {
+ if (IsDisposed)
+ return;
+
+ if (VisibleNestedPanes.Count == 0)
+ {
+ ControlBox = true;
+ return;
+ }
+
+ for (int i=VisibleNestedPanes.Count - 1; i>=0; i--)
+ {
+ DockContentCollection contents = VisibleNestedPanes[i].Contents;
+ for (int j=contents.Count - 1; j>=0; j--)
+ {
+ IDockContent content = contents[j];
+ if (content.DockHandler.DockState != DockState.Float)
+ continue;
+
+ if (content.DockHandler.CloseButton && content.DockHandler.CloseButtonVisible)
+ {
+ ControlBox = true;
+ return;
+ }
+ }
+ }
+ //Only if there is a ControlBox do we turn it off
+ //old code caused a flash of the window.
+ if (ControlBox)
+ ControlBox = false;
+ }
+
+ public virtual Rectangle DisplayingRectangle
+ {
+ get { return ClientRectangle; }
+ }
+
+ internal void TestDrop(IDockDragSource dragSource, DockOutlineBase dockOutline)
+ {
+ if (VisibleNestedPanes.Count == 1)
+ {
+ DockPane pane = VisibleNestedPanes[0];
+ if (!dragSource.CanDockTo(pane))
+ return;
+
+ Point ptMouse = Control.MousePosition;
+ uint lParam = Win32Helper.MakeLong(ptMouse.X, ptMouse.Y);
+ if (NativeMethods.SendMessage(Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, lParam) == (uint)Win32.HitTest.HTCAPTION)
+ dockOutline.Show(VisibleNestedPanes[0], -1);
+ }
+ }
+
+ #region IDockDragSource Members
+
+ #region IDragSource Members
+
+ Control IDragSource.DragControl
+ {
+ get { return this; }
+ }
+
+ #endregion
+
+ bool IDockDragSource.IsDockStateValid(DockState dockState)
+ {
+ return IsDockStateValid(dockState);
+ }
+
+ bool IDockDragSource.CanDockTo(DockPane pane)
+ {
+ if (!IsDockStateValid(pane.DockState))
+ return false;
+
+ if (pane.FloatWindow == this)
+ return false;
+
+ return true;
+ }
+
+ Rectangle IDockDragSource.BeginDrag(Point ptMouse)
+ {
+ return Bounds;
+ }
+
+ public void FloatAt(Rectangle floatWindowBounds)
+ {
+ Bounds = floatWindowBounds;
+ }
+
+ public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
+ {
+ if (dockStyle == DockStyle.Fill)
+ {
+ for (int i = NestedPanes.Count - 1; i >= 0; i--)
+ {
+ DockPane paneFrom = NestedPanes[i];
+ for (int j = paneFrom.Contents.Count - 1; j >= 0; j--)
+ {
+ IDockContent c = paneFrom.Contents[j];
+ c.DockHandler.Pane = pane;
+ if (contentIndex != -1)
+ pane.SetContentIndex(c, contentIndex);
+ c.DockHandler.Activate();
+ }
+ }
+ }
+ else
+ {
+ DockAlignment alignment = DockAlignment.Left;
+ if (dockStyle == DockStyle.Left)
+ alignment = DockAlignment.Left;
+ else if (dockStyle == DockStyle.Right)
+ alignment = DockAlignment.Right;
+ else if (dockStyle == DockStyle.Top)
+ alignment = DockAlignment.Top;
+ else if (dockStyle == DockStyle.Bottom)
+ alignment = DockAlignment.Bottom;
+
+ MergeNestedPanes(VisibleNestedPanes, pane.NestedPanesContainer.NestedPanes, pane, alignment, 0.5);
+ }
+ }
+
+ public void DockTo(DockPanel panel, DockStyle dockStyle)
+ {
+ if (panel != DockPanel)
+ throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
+
+ NestedPaneCollection nestedPanesTo = null;
+
+ if (dockStyle == DockStyle.Top)
+ nestedPanesTo = DockPanel.DockWindows[DockState.DockTop].NestedPanes;
+ else if (dockStyle == DockStyle.Bottom)
+ nestedPanesTo = DockPanel.DockWindows[DockState.DockBottom].NestedPanes;
+ else if (dockStyle == DockStyle.Left)
+ nestedPanesTo = DockPanel.DockWindows[DockState.DockLeft].NestedPanes;
+ else if (dockStyle == DockStyle.Right)
+ nestedPanesTo = DockPanel.DockWindows[DockState.DockRight].NestedPanes;
+ else if (dockStyle == DockStyle.Fill)
+ nestedPanesTo = DockPanel.DockWindows[DockState.Document].NestedPanes;
+
+ DockPane prevPane = null;
+ for (int i = nestedPanesTo.Count - 1; i >= 0; i--)
+ if (nestedPanesTo[i] != VisibleNestedPanes[0])
+ prevPane = nestedPanesTo[i];
+ MergeNestedPanes(VisibleNestedPanes, nestedPanesTo, prevPane, DockAlignment.Left, 0.5);
+ }
+
+ private static void MergeNestedPanes(VisibleNestedPaneCollection nestedPanesFrom, NestedPaneCollection nestedPanesTo, DockPane prevPane, DockAlignment alignment, double proportion)
+ {
+ if (nestedPanesFrom.Count == 0)
+ return;
+
+ int count = nestedPanesFrom.Count;
+ DockPane[] panes = new DockPane[count];
+ DockPane[] prevPanes = new DockPane[count];
+ DockAlignment[] alignments = new DockAlignment[count];
+ double[] proportions = new double[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ panes[i] = nestedPanesFrom[i];
+ prevPanes[i] = nestedPanesFrom[i].NestedDockingStatus.PreviousPane;
+ alignments[i] = nestedPanesFrom[i].NestedDockingStatus.Alignment;
+ proportions[i] = nestedPanesFrom[i].NestedDockingStatus.Proportion;
+ }
+
+ DockPane pane = panes[0].DockTo(nestedPanesTo.Container, prevPane, alignment, proportion);
+ panes[0].DockState = nestedPanesTo.DockState;
+
+ for (int i = 1; i < count; i++)
+ {
+ for (int j = i; j < count; j++)
+ {
+ if (prevPanes[j] == panes[i - 1])
+ prevPanes[j] = pane;
+ }
+ pane = panes[i].DockTo(nestedPanesTo.Container, prevPanes[i], alignments[i], proportions[i]);
+ panes[i].DockState = nestedPanesTo.DockState;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/Docking/FloatWindowCollection.cs b/source/Docking/FloatWindowCollection.cs
similarity index 94%
rename from trunk/Docking/FloatWindowCollection.cs
rename to source/Docking/FloatWindowCollection.cs
index 9dc4f7c..e6078b2 100644
--- a/trunk/Docking/FloatWindowCollection.cs
+++ b/source/Docking/FloatWindowCollection.cs
@@ -1,42 +1,42 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- public class FloatWindowCollection : ReadOnlyCollection
- {
- internal FloatWindowCollection()
- : base(new List())
- {
- }
-
- internal int Add(FloatWindow fw)
- {
- if (Items.Contains(fw))
- return Items.IndexOf(fw);
-
- Items.Add(fw);
- return Count - 1;
- }
-
- internal void Dispose()
- {
- for (int i=Count - 1; i>=0; i--)
- this[i].Close();
- }
-
- internal void Remove(FloatWindow fw)
- {
- Items.Remove(fw);
- }
-
- internal void BringWindowToFront(FloatWindow fw)
- {
- Items.Remove(fw);
- Items.Add(fw);
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ public class FloatWindowCollection : ReadOnlyCollection
+ {
+ internal FloatWindowCollection()
+ : base(new List())
+ {
+ }
+
+ internal int Add(FloatWindow fw)
+ {
+ if (Items.Contains(fw))
+ return Items.IndexOf(fw);
+
+ Items.Add(fw);
+ return Count - 1;
+ }
+
+ internal void Dispose()
+ {
+ for (int i=Count - 1; i>=0; i--)
+ this[i].Close();
+ }
+
+ internal void Remove(FloatWindow fw)
+ {
+ Items.Remove(fw);
+ }
+
+ internal void BringWindowToFront(FloatWindow fw)
+ {
+ Items.Remove(fw);
+ Items.Add(fw);
+ }
+ }
+}
diff --git a/trunk/Docking/Helpers/DockHelper.cs b/source/Docking/Helpers/DockHelper.cs
similarity index 96%
rename from trunk/Docking/Helpers/DockHelper.cs
rename to source/Docking/Helpers/DockHelper.cs
index ecbae43..c48b166 100644
--- a/trunk/Docking/Helpers/DockHelper.cs
+++ b/source/Docking/Helpers/DockHelper.cs
@@ -1,103 +1,103 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- internal static class DockHelper
- {
- public static bool IsDockStateAutoHide(DockState dockState)
- {
- if (dockState == DockState.DockLeftAutoHide ||
- dockState == DockState.DockRightAutoHide ||
- dockState == DockState.DockTopAutoHide ||
- dockState == DockState.DockBottomAutoHide)
- return true;
- else
- return false;
- }
-
- public static bool IsDockStateValid(DockState dockState, DockAreas dockableAreas)
- {
- if (((dockableAreas & DockAreas.Float) == 0) &&
- (dockState == DockState.Float))
- return false;
- else if (((dockableAreas & DockAreas.Document) == 0) &&
- (dockState == DockState.Document))
- return false;
- else if (((dockableAreas & DockAreas.DockLeft) == 0) &&
- (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide))
- return false;
- else if (((dockableAreas & DockAreas.DockRight) == 0) &&
- (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide))
- return false;
- else if (((dockableAreas & DockAreas.DockTop) == 0) &&
- (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide))
- return false;
- else if (((dockableAreas & DockAreas.DockBottom) == 0) &&
- (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide))
- return false;
- else
- return true;
- }
-
- public static bool IsDockWindowState(DockState state)
- {
- if (state == DockState.DockTop || state == DockState.DockBottom || state == DockState.DockLeft ||
- state == DockState.DockRight || state == DockState.Document)
- return true;
- else
- return false;
- }
-
- public static DockState ToggleAutoHideState(DockState state)
- {
- if (state == DockState.DockLeft)
- return DockState.DockLeftAutoHide;
- else if (state == DockState.DockRight)
- return DockState.DockRightAutoHide;
- else if (state == DockState.DockTop)
- return DockState.DockTopAutoHide;
- else if (state == DockState.DockBottom)
- return DockState.DockBottomAutoHide;
- else if (state == DockState.DockLeftAutoHide)
- return DockState.DockLeft;
- else if (state == DockState.DockRightAutoHide)
- return DockState.DockRight;
- else if (state == DockState.DockTopAutoHide)
- return DockState.DockTop;
- else if (state == DockState.DockBottomAutoHide)
- return DockState.DockBottom;
- else
- return state;
- }
-
- public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel)
- {
- for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
- {
- IDockContent content = control as IDockContent;
- if (content != null && content.DockHandler.DockPanel == dockPanel)
- return content.DockHandler.Pane;
-
- DockPane pane = control as DockPane;
- if (pane != null && pane.DockPanel == dockPanel)
- return pane;
- }
-
- return null;
- }
-
- public static FloatWindow FloatWindowAtPoint(Point pt, DockPanel dockPanel)
- {
- for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
- {
- FloatWindow floatWindow = control as FloatWindow;
- if (floatWindow != null && floatWindow.DockPanel == dockPanel)
- return floatWindow;
- }
-
- return null;
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ internal static class DockHelper
+ {
+ public static bool IsDockStateAutoHide(DockState dockState)
+ {
+ if (dockState == DockState.DockLeftAutoHide ||
+ dockState == DockState.DockRightAutoHide ||
+ dockState == DockState.DockTopAutoHide ||
+ dockState == DockState.DockBottomAutoHide)
+ return true;
+ else
+ return false;
+ }
+
+ public static bool IsDockStateValid(DockState dockState, DockAreas dockableAreas)
+ {
+ if (((dockableAreas & DockAreas.Float) == 0) &&
+ (dockState == DockState.Float))
+ return false;
+ else if (((dockableAreas & DockAreas.Document) == 0) &&
+ (dockState == DockState.Document))
+ return false;
+ else if (((dockableAreas & DockAreas.DockLeft) == 0) &&
+ (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide))
+ return false;
+ else if (((dockableAreas & DockAreas.DockRight) == 0) &&
+ (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide))
+ return false;
+ else if (((dockableAreas & DockAreas.DockTop) == 0) &&
+ (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide))
+ return false;
+ else if (((dockableAreas & DockAreas.DockBottom) == 0) &&
+ (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide))
+ return false;
+ else
+ return true;
+ }
+
+ public static bool IsDockWindowState(DockState state)
+ {
+ if (state == DockState.DockTop || state == DockState.DockBottom || state == DockState.DockLeft ||
+ state == DockState.DockRight || state == DockState.Document)
+ return true;
+ else
+ return false;
+ }
+
+ public static DockState ToggleAutoHideState(DockState state)
+ {
+ if (state == DockState.DockLeft)
+ return DockState.DockLeftAutoHide;
+ else if (state == DockState.DockRight)
+ return DockState.DockRightAutoHide;
+ else if (state == DockState.DockTop)
+ return DockState.DockTopAutoHide;
+ else if (state == DockState.DockBottom)
+ return DockState.DockBottomAutoHide;
+ else if (state == DockState.DockLeftAutoHide)
+ return DockState.DockLeft;
+ else if (state == DockState.DockRightAutoHide)
+ return DockState.DockRight;
+ else if (state == DockState.DockTopAutoHide)
+ return DockState.DockTop;
+ else if (state == DockState.DockBottomAutoHide)
+ return DockState.DockBottom;
+ else
+ return state;
+ }
+
+ public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel)
+ {
+ for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
+ {
+ IDockContent content = control as IDockContent;
+ if (content != null && content.DockHandler.DockPanel == dockPanel)
+ return content.DockHandler.Pane;
+
+ DockPane pane = control as DockPane;
+ if (pane != null && pane.DockPanel == dockPanel)
+ return pane;
+ }
+
+ return null;
+ }
+
+ public static FloatWindow FloatWindowAtPoint(Point pt, DockPanel dockPanel)
+ {
+ for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
+ {
+ FloatWindow floatWindow = control as FloatWindow;
+ if (floatWindow != null && floatWindow.DockPanel == dockPanel)
+ return floatWindow;
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/trunk/Docking/Helpers/DrawHelper.cs b/source/Docking/Helpers/DrawHelper.cs
similarity index 97%
rename from trunk/Docking/Helpers/DrawHelper.cs
rename to source/Docking/Helpers/DrawHelper.cs
index b9759fa..058da2b 100644
--- a/trunk/Docking/Helpers/DrawHelper.cs
+++ b/source/Docking/Helpers/DrawHelper.cs
@@ -1,88 +1,88 @@
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- internal static class DrawHelper
- {
- public static Point RtlTransform(Control control, Point point)
- {
- if (control.RightToLeft != RightToLeft.Yes)
- return point;
- else
- return new Point(control.Right - point.X, point.Y);
- }
-
- public static Rectangle RtlTransform(Control control, Rectangle rectangle)
- {
- if (control.RightToLeft != RightToLeft.Yes)
- return rectangle;
- else
- return new Rectangle(control.ClientRectangle.Right - rectangle.Right, rectangle.Y, rectangle.Width, rectangle.Height);
- }
-
- public static GraphicsPath GetRoundedCornerTab(GraphicsPath graphicsPath, Rectangle rect, bool upCorner)
- {
- if (graphicsPath == null)
- graphicsPath = new GraphicsPath();
- else
- graphicsPath.Reset();
-
- int curveSize = 6;
- if (upCorner)
- {
- graphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top + curveSize / 2);
- graphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90);
- graphicsPath.AddLine(rect.Left + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top);
- graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90);
- graphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom);
- }
- else
- {
- graphicsPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom - curveSize / 2);
- graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize), 0, 90);
- graphicsPath.AddLine(rect.Right - curveSize / 2, rect.Bottom, rect.Left + curveSize / 2, rect.Bottom);
- graphicsPath.AddArc(new Rectangle(rect.Left, rect.Bottom - curveSize, curveSize, curveSize), 90, 90);
- graphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Top);
- }
-
- return graphicsPath;
- }
-
- public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap)
- {
- return CalculateGraphicsPathFromBitmap(bitmap, Color.Empty);
- }
-
- // From http://edu.cnzz.cn/show_3281.html
- public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap, Color colorTransparent)
- {
- GraphicsPath graphicsPath = new GraphicsPath();
- if (colorTransparent == Color.Empty)
- colorTransparent = bitmap.GetPixel(0, 0);
-
- for(int row = 0; row < bitmap.Height; row ++)
- {
- int colOpaquePixel = 0;
- for(int col = 0; col < bitmap.Width; col ++)
- {
- if(bitmap.GetPixel(col, row) != colorTransparent)
- {
- colOpaquePixel = col;
- int colNext = col;
- for(colNext = colOpaquePixel; colNext < bitmap.Width; colNext ++)
- if(bitmap.GetPixel(colNext, row) == colorTransparent)
- break;
-
- graphicsPath.AddRectangle(new Rectangle(colOpaquePixel, row, colNext - colOpaquePixel, 1));
- col = colNext;
- }
- }
- }
- return graphicsPath;
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ internal static class DrawHelper
+ {
+ public static Point RtlTransform(Control control, Point point)
+ {
+ if (control.RightToLeft != RightToLeft.Yes)
+ return point;
+ else
+ return new Point(control.Right - point.X, point.Y);
+ }
+
+ public static Rectangle RtlTransform(Control control, Rectangle rectangle)
+ {
+ if (control.RightToLeft != RightToLeft.Yes)
+ return rectangle;
+ else
+ return new Rectangle(control.ClientRectangle.Right - rectangle.Right, rectangle.Y, rectangle.Width, rectangle.Height);
+ }
+
+ public static GraphicsPath GetRoundedCornerTab(GraphicsPath graphicsPath, Rectangle rect, bool upCorner)
+ {
+ if (graphicsPath == null)
+ graphicsPath = new GraphicsPath();
+ else
+ graphicsPath.Reset();
+
+ int curveSize = 6;
+ if (upCorner)
+ {
+ graphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top + curveSize / 2);
+ graphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90);
+ graphicsPath.AddLine(rect.Left + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top);
+ graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90);
+ graphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom);
+ }
+ else
+ {
+ graphicsPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom - curveSize / 2);
+ graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize), 0, 90);
+ graphicsPath.AddLine(rect.Right - curveSize / 2, rect.Bottom, rect.Left + curveSize / 2, rect.Bottom);
+ graphicsPath.AddArc(new Rectangle(rect.Left, rect.Bottom - curveSize, curveSize, curveSize), 90, 90);
+ graphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Top);
+ }
+
+ return graphicsPath;
+ }
+
+ public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap)
+ {
+ return CalculateGraphicsPathFromBitmap(bitmap, Color.Empty);
+ }
+
+ // From http://edu.cnzz.cn/show_3281.html
+ public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap, Color colorTransparent)
+ {
+ GraphicsPath graphicsPath = new GraphicsPath();
+ if (colorTransparent == Color.Empty)
+ colorTransparent = bitmap.GetPixel(0, 0);
+
+ for(int row = 0; row < bitmap.Height; row ++)
+ {
+ int colOpaquePixel = 0;
+ for(int col = 0; col < bitmap.Width; col ++)
+ {
+ if(bitmap.GetPixel(col, row) != colorTransparent)
+ {
+ colOpaquePixel = col;
+ int colNext = col;
+ for(colNext = colOpaquePixel; colNext < bitmap.Width; colNext ++)
+ if(bitmap.GetPixel(colNext, row) == colorTransparent)
+ break;
+
+ graphicsPath.AddRectangle(new Rectangle(colOpaquePixel, row, colNext - colOpaquePixel, 1));
+ col = colNext;
+ }
+ }
+ }
+ return graphicsPath;
+ }
+ }
+}
diff --git a/trunk/Docking/Helpers/ResourceHelper.cs b/source/Docking/Helpers/ResourceHelper.cs
similarity index 95%
rename from trunk/Docking/Helpers/ResourceHelper.cs
rename to source/Docking/Helpers/ResourceHelper.cs
index 24e8fef..ec9ce4d 100644
--- a/trunk/Docking/Helpers/ResourceHelper.cs
+++ b/source/Docking/Helpers/ResourceHelper.cs
@@ -1,29 +1,29 @@
-using System;
-using System.Drawing;
-using System.Reflection;
-using System.Resources;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- internal static class ResourceHelper
- {
- private static ResourceManager _resourceManager = null;
-
- private static ResourceManager ResourceManager
- {
- get
- {
- if (_resourceManager == null)
- _resourceManager = new ResourceManager("LSLEditor.Docking.Strings", typeof(ResourceHelper).Assembly);
- return _resourceManager;
- }
-
- }
-
- public static string GetString(string name)
- {
- return ResourceManager.GetString(name);
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Reflection;
+using System.Resources;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ internal static class ResourceHelper
+ {
+ private static ResourceManager _resourceManager = null;
+
+ private static ResourceManager ResourceManager
+ {
+ get
+ {
+ if (_resourceManager == null)
+ _resourceManager = new ResourceManager("LSLEditor.Docking.Strings", typeof(ResourceHelper).Assembly);
+ return _resourceManager;
+ }
+
+ }
+
+ public static string GetString(string name)
+ {
+ return ResourceManager.GetString(name);
+ }
+ }
+}
diff --git a/trunk/Docking/Helpers/Win32Helper.cs b/source/Docking/Helpers/Win32Helper.cs
similarity index 95%
rename from trunk/Docking/Helpers/Win32Helper.cs
rename to source/Docking/Helpers/Win32Helper.cs
index 5d26655..3263f21 100644
--- a/trunk/Docking/Helpers/Win32Helper.cs
+++ b/source/Docking/Helpers/Win32Helper.cs
@@ -1,19 +1,19 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- internal static class Win32Helper
- {
- public static Control ControlAtPoint(Point pt)
- {
- return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt));
- }
-
- public static uint MakeLong(int low, int high)
- {
- return (uint)((high << 16) + low);
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ internal static class Win32Helper
+ {
+ public static Control ControlAtPoint(Point pt)
+ {
+ return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt));
+ }
+
+ public static uint MakeLong(int low, int high)
+ {
+ return (uint)((high << 16) + low);
+ }
+ }
+}
diff --git a/trunk/Docking/InertButtonBase.cs b/source/Docking/InertButtonBase.cs
similarity index 96%
rename from trunk/Docking/InertButtonBase.cs
rename to source/Docking/InertButtonBase.cs
index c0859b7..fd43b84 100644
--- a/trunk/Docking/InertButtonBase.cs
+++ b/source/Docking/InertButtonBase.cs
@@ -1,115 +1,115 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Imaging;
-
-namespace LSLEditor.Docking
-{
- internal abstract class InertButtonBase : Control
- {
- protected InertButtonBase()
- {
- SetStyle(ControlStyles.SupportsTransparentBackColor, true);
- BackColor = Color.Transparent;
- }
-
- public abstract Bitmap Image
- {
- get;
- }
-
- private bool m_isMouseOver = false;
- protected bool IsMouseOver
- {
- get { return m_isMouseOver; }
- private set
- {
- if (m_isMouseOver == value)
- return;
-
- m_isMouseOver = value;
- Invalidate();
- }
- }
-
- protected override Size DefaultSize
- {
- get { return Resources.DockPane_Close.Size; }
- }
-
- protected override void OnMouseMove(MouseEventArgs e)
- {
- base.OnMouseMove(e);
- bool over = ClientRectangle.Contains(e.X, e.Y);
- if (IsMouseOver != over)
- IsMouseOver = over;
- }
-
- protected override void OnMouseEnter(EventArgs e)
- {
- base.OnMouseEnter(e);
- if (!IsMouseOver)
- IsMouseOver = true;
- }
-
- protected override void OnMouseLeave(EventArgs e)
- {
- base.OnMouseLeave(e);
- if (IsMouseOver)
- IsMouseOver = false;
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- if (IsMouseOver && Enabled)
- {
- using (Pen pen = new Pen(ForeColor))
- {
- e.Graphics.DrawRectangle(pen, Rectangle.Inflate(ClientRectangle, -1, -1));
- }
- }
-
- using (ImageAttributes imageAttributes = new ImageAttributes())
- {
- ColorMap[] colorMap = new ColorMap[2];
- colorMap[0] = new ColorMap();
- colorMap[0].OldColor = Color.FromArgb(0, 0, 0);
- colorMap[0].NewColor = ForeColor;
- colorMap[1] = new ColorMap();
- colorMap[1].OldColor = Image.GetPixel(0, 0);
- colorMap[1].NewColor = Color.Transparent;
-
- imageAttributes.SetRemapTable(colorMap);
-
- e.Graphics.DrawImage(
- Image,
- new Rectangle(0, 0, Image.Width, Image.Height),
- 0, 0,
- Image.Width,
- Image.Height,
- GraphicsUnit.Pixel,
- imageAttributes);
- }
-
- base.OnPaint(e);
- }
-
- public void RefreshChanges()
- {
- if (IsDisposed)
- return;
-
- bool mouseOver = ClientRectangle.Contains(PointToClient(Control.MousePosition));
- if (mouseOver != IsMouseOver)
- IsMouseOver = mouseOver;
-
- OnRefreshChanges();
- }
-
- protected virtual void OnRefreshChanges()
- {
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Imaging;
+
+namespace LSLEditor.Docking
+{
+ internal abstract class InertButtonBase : Control
+ {
+ protected InertButtonBase()
+ {
+ SetStyle(ControlStyles.SupportsTransparentBackColor, true);
+ BackColor = Color.Transparent;
+ }
+
+ public abstract Bitmap Image
+ {
+ get;
+ }
+
+ private bool m_isMouseOver = false;
+ protected bool IsMouseOver
+ {
+ get { return m_isMouseOver; }
+ private set
+ {
+ if (m_isMouseOver == value)
+ return;
+
+ m_isMouseOver = value;
+ Invalidate();
+ }
+ }
+
+ protected override Size DefaultSize
+ {
+ get { return Resources.DockPane_Close.Size; }
+ }
+
+ protected override void OnMouseMove(MouseEventArgs e)
+ {
+ base.OnMouseMove(e);
+ bool over = ClientRectangle.Contains(e.X, e.Y);
+ if (IsMouseOver != over)
+ IsMouseOver = over;
+ }
+
+ protected override void OnMouseEnter(EventArgs e)
+ {
+ base.OnMouseEnter(e);
+ if (!IsMouseOver)
+ IsMouseOver = true;
+ }
+
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ base.OnMouseLeave(e);
+ if (IsMouseOver)
+ IsMouseOver = false;
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ if (IsMouseOver && Enabled)
+ {
+ using (Pen pen = new Pen(ForeColor))
+ {
+ e.Graphics.DrawRectangle(pen, Rectangle.Inflate(ClientRectangle, -1, -1));
+ }
+ }
+
+ using (ImageAttributes imageAttributes = new ImageAttributes())
+ {
+ ColorMap[] colorMap = new ColorMap[2];
+ colorMap[0] = new ColorMap();
+ colorMap[0].OldColor = Color.FromArgb(0, 0, 0);
+ colorMap[0].NewColor = ForeColor;
+ colorMap[1] = new ColorMap();
+ colorMap[1].OldColor = Image.GetPixel(0, 0);
+ colorMap[1].NewColor = Color.Transparent;
+
+ imageAttributes.SetRemapTable(colorMap);
+
+ e.Graphics.DrawImage(
+ Image,
+ new Rectangle(0, 0, Image.Width, Image.Height),
+ 0, 0,
+ Image.Width,
+ Image.Height,
+ GraphicsUnit.Pixel,
+ imageAttributes);
+ }
+
+ base.OnPaint(e);
+ }
+
+ public void RefreshChanges()
+ {
+ if (IsDisposed)
+ return;
+
+ bool mouseOver = ClientRectangle.Contains(PointToClient(Control.MousePosition));
+ if (mouseOver != IsMouseOver)
+ IsMouseOver = mouseOver;
+
+ OnRefreshChanges();
+ }
+
+ protected virtual void OnRefreshChanges()
+ {
+ }
+ }
+}
diff --git a/trunk/Docking/Interfaces.cs b/source/Docking/Interfaces.cs
similarity index 96%
rename from trunk/Docking/Interfaces.cs
rename to source/Docking/Interfaces.cs
index 96f02a9..d0d9ab6 100644
--- a/trunk/Docking/Interfaces.cs
+++ b/source/Docking/Interfaces.cs
@@ -1,46 +1,46 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- public interface IDockContent
- {
- DockContentHandler DockHandler { get; }
- void OnActivated(EventArgs e);
- void OnDeactivate(EventArgs e);
- }
-
- public interface INestedPanesContainer
- {
- DockState DockState { get; }
- Rectangle DisplayingRectangle { get; }
- NestedPaneCollection NestedPanes { get; }
- VisibleNestedPaneCollection VisibleNestedPanes { get; }
- bool IsFloat { get; }
- }
-
- internal interface IDragSource
- {
- Control DragControl { get; }
- }
-
- internal interface IDockDragSource : IDragSource
- {
- Rectangle BeginDrag(Point ptMouse);
- bool IsDockStateValid(DockState dockState);
- bool CanDockTo(DockPane pane);
- void FloatAt(Rectangle floatWindowBounds);
- void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex);
- void DockTo(DockPanel panel, DockStyle dockStyle);
- }
-
- internal interface ISplitterDragSource : IDragSource
- {
- void BeginDrag(Rectangle rectSplitter);
- void EndDrag();
- bool IsVertical { get; }
- Rectangle DragLimitBounds { get; }
- void MoveSplitter(int offset);
- }
-}
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ public interface IDockContent
+ {
+ DockContentHandler DockHandler { get; }
+ void OnActivated(EventArgs e);
+ void OnDeactivate(EventArgs e);
+ }
+
+ public interface INestedPanesContainer
+ {
+ DockState DockState { get; }
+ Rectangle DisplayingRectangle { get; }
+ NestedPaneCollection NestedPanes { get; }
+ VisibleNestedPaneCollection VisibleNestedPanes { get; }
+ bool IsFloat { get; }
+ }
+
+ internal interface IDragSource
+ {
+ Control DragControl { get; }
+ }
+
+ internal interface IDockDragSource : IDragSource
+ {
+ Rectangle BeginDrag(Point ptMouse);
+ bool IsDockStateValid(DockState dockState);
+ bool CanDockTo(DockPane pane);
+ void FloatAt(Rectangle floatWindowBounds);
+ void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex);
+ void DockTo(DockPanel panel, DockStyle dockStyle);
+ }
+
+ internal interface ISplitterDragSource : IDragSource
+ {
+ void BeginDrag(Rectangle rectSplitter);
+ void EndDrag();
+ bool IsVertical { get; }
+ Rectangle DragLimitBounds { get; }
+ void MoveSplitter(int offset);
+ }
+}
diff --git a/trunk/Docking/Localization.cs b/source/Docking/Localization.cs
similarity index 95%
rename from trunk/Docking/Localization.cs
rename to source/Docking/Localization.cs
index 03307dd..d0c89ab 100644
--- a/trunk/Docking/Localization.cs
+++ b/source/Docking/Localization.cs
@@ -1,46 +1,46 @@
-using System;
-using System.ComponentModel;
-
-namespace LSLEditor.Docking
-{
- [AttributeUsage(AttributeTargets.All)]
- internal sealed class LocalizedDescriptionAttribute : DescriptionAttribute
- {
- private bool m_initialized = false;
-
- public LocalizedDescriptionAttribute(string key) : base(key)
- {
- }
-
- public override string Description
- {
- get
- {
- if (!m_initialized)
- {
- string key = base.Description;
- DescriptionValue = ResourceHelper.GetString(key);
- if (DescriptionValue == null)
- DescriptionValue = String.Empty;
-
- m_initialized = true;
- }
-
- return DescriptionValue;
- }
- }
- }
-
- [AttributeUsage(AttributeTargets.All)]
- internal sealed class LocalizedCategoryAttribute : CategoryAttribute
- {
- public LocalizedCategoryAttribute(string key) : base(key)
- {
- }
-
- protected override string GetLocalizedString(string key)
- {
- return ResourceHelper.GetString(key);
- }
- }
-}
+using System;
+using System.ComponentModel;
+
+namespace LSLEditor.Docking
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal sealed class LocalizedDescriptionAttribute : DescriptionAttribute
+ {
+ private bool m_initialized = false;
+
+ public LocalizedDescriptionAttribute(string key) : base(key)
+ {
+ }
+
+ public override string Description
+ {
+ get
+ {
+ if (!m_initialized)
+ {
+ string key = base.Description;
+ DescriptionValue = ResourceHelper.GetString(key);
+ if (DescriptionValue == null)
+ DescriptionValue = String.Empty;
+
+ m_initialized = true;
+ }
+
+ return DescriptionValue;
+ }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.All)]
+ internal sealed class LocalizedCategoryAttribute : CategoryAttribute
+ {
+ public LocalizedCategoryAttribute(string key) : base(key)
+ {
+ }
+
+ protected override string GetLocalizedString(string key)
+ {
+ return ResourceHelper.GetString(key);
+ }
+ }
+}
diff --git a/trunk/Docking/Measures.cs b/source/Docking/Measures.cs
similarity index 93%
rename from trunk/Docking/Measures.cs
rename to source/Docking/Measures.cs
index cdc4c20..3526bcc 100644
--- a/trunk/Docking/Measures.cs
+++ b/source/Docking/Measures.cs
@@ -1,14 +1,14 @@
-using System;
-
-namespace LSLEditor.Docking
-{
- internal static class Measures
- {
- public const int SplitterSize = 4;
- }
-
- internal static class MeasurePane
- {
- public const int MinSize = 24;
- }
-}
+using System;
+
+namespace LSLEditor.Docking
+{
+ internal static class Measures
+ {
+ public const int SplitterSize = 4;
+ }
+
+ internal static class MeasurePane
+ {
+ public const int MinSize = 24;
+ }
+}
diff --git a/trunk/Docking/NestedDockingStatus.cs b/source/Docking/NestedDockingStatus.cs
similarity index 95%
rename from trunk/Docking/NestedDockingStatus.cs
rename to source/Docking/NestedDockingStatus.cs
index aa37220..362196d 100644
--- a/trunk/Docking/NestedDockingStatus.cs
+++ b/source/Docking/NestedDockingStatus.cs
@@ -1,108 +1,108 @@
-using System;
-using System.Drawing;
-
-namespace LSLEditor.Docking
-{
- public sealed class NestedDockingStatus
- {
- internal NestedDockingStatus(DockPane pane)
- {
- m_dockPane = pane;
- }
-
- private DockPane m_dockPane = null;
- public DockPane DockPane
- {
- get { return m_dockPane; }
- }
-
- private NestedPaneCollection m_nestedPanes = null;
- public NestedPaneCollection NestedPanes
- {
- get { return m_nestedPanes; }
- }
-
- private DockPane m_previousPane = null;
- public DockPane PreviousPane
- {
- get { return m_previousPane; }
- }
-
- private DockAlignment m_alignment = DockAlignment.Left;
- public DockAlignment Alignment
- {
- get { return m_alignment; }
- }
-
- private double m_proportion = 0.5;
- public double Proportion
- {
- get { return m_proportion; }
- }
-
- private bool m_isDisplaying = false;
- public bool IsDisplaying
- {
- get { return m_isDisplaying; }
- }
-
- private DockPane m_displayingPreviousPane = null;
- public DockPane DisplayingPreviousPane
- {
- get { return m_displayingPreviousPane; }
- }
-
- private DockAlignment m_displayingAlignment = DockAlignment.Left;
- public DockAlignment DisplayingAlignment
- {
- get { return m_displayingAlignment; }
- }
-
- private double m_displayingProportion = 0.5;
- public double DisplayingProportion
- {
- get { return m_displayingProportion; }
- }
-
- private Rectangle m_logicalBounds = Rectangle.Empty;
- public Rectangle LogicalBounds
- {
- get { return m_logicalBounds; }
- }
-
- private Rectangle m_paneBounds = Rectangle.Empty;
- public Rectangle PaneBounds
- {
- get { return m_paneBounds; }
- }
-
- private Rectangle m_splitterBounds = Rectangle.Empty;
- public Rectangle SplitterBounds
- {
- get { return m_splitterBounds; }
- }
-
- internal void SetStatus(NestedPaneCollection nestedPanes, DockPane previousPane, DockAlignment alignment, double proportion)
- {
- m_nestedPanes = nestedPanes;
- m_previousPane = previousPane;
- m_alignment = alignment;
- m_proportion = proportion;
- }
-
- internal void SetDisplayingStatus(bool isDisplaying, DockPane displayingPreviousPane, DockAlignment displayingAlignment, double displayingProportion)
- {
- m_isDisplaying = isDisplaying;
- m_displayingPreviousPane = displayingPreviousPane;
- m_displayingAlignment = displayingAlignment;
- m_displayingProportion = displayingProportion;
- }
-
- internal void SetDisplayingBounds(Rectangle logicalBounds, Rectangle paneBounds, Rectangle splitterBounds)
- {
- m_logicalBounds = logicalBounds;
- m_paneBounds = paneBounds;
- m_splitterBounds = splitterBounds;
- }
- }
-}
+using System;
+using System.Drawing;
+
+namespace LSLEditor.Docking
+{
+ public sealed class NestedDockingStatus
+ {
+ internal NestedDockingStatus(DockPane pane)
+ {
+ m_dockPane = pane;
+ }
+
+ private DockPane m_dockPane = null;
+ public DockPane DockPane
+ {
+ get { return m_dockPane; }
+ }
+
+ private NestedPaneCollection m_nestedPanes = null;
+ public NestedPaneCollection NestedPanes
+ {
+ get { return m_nestedPanes; }
+ }
+
+ private DockPane m_previousPane = null;
+ public DockPane PreviousPane
+ {
+ get { return m_previousPane; }
+ }
+
+ private DockAlignment m_alignment = DockAlignment.Left;
+ public DockAlignment Alignment
+ {
+ get { return m_alignment; }
+ }
+
+ private double m_proportion = 0.5;
+ public double Proportion
+ {
+ get { return m_proportion; }
+ }
+
+ private bool m_isDisplaying = false;
+ public bool IsDisplaying
+ {
+ get { return m_isDisplaying; }
+ }
+
+ private DockPane m_displayingPreviousPane = null;
+ public DockPane DisplayingPreviousPane
+ {
+ get { return m_displayingPreviousPane; }
+ }
+
+ private DockAlignment m_displayingAlignment = DockAlignment.Left;
+ public DockAlignment DisplayingAlignment
+ {
+ get { return m_displayingAlignment; }
+ }
+
+ private double m_displayingProportion = 0.5;
+ public double DisplayingProportion
+ {
+ get { return m_displayingProportion; }
+ }
+
+ private Rectangle m_logicalBounds = Rectangle.Empty;
+ public Rectangle LogicalBounds
+ {
+ get { return m_logicalBounds; }
+ }
+
+ private Rectangle m_paneBounds = Rectangle.Empty;
+ public Rectangle PaneBounds
+ {
+ get { return m_paneBounds; }
+ }
+
+ private Rectangle m_splitterBounds = Rectangle.Empty;
+ public Rectangle SplitterBounds
+ {
+ get { return m_splitterBounds; }
+ }
+
+ internal void SetStatus(NestedPaneCollection nestedPanes, DockPane previousPane, DockAlignment alignment, double proportion)
+ {
+ m_nestedPanes = nestedPanes;
+ m_previousPane = previousPane;
+ m_alignment = alignment;
+ m_proportion = proportion;
+ }
+
+ internal void SetDisplayingStatus(bool isDisplaying, DockPane displayingPreviousPane, DockAlignment displayingAlignment, double displayingProportion)
+ {
+ m_isDisplaying = isDisplaying;
+ m_displayingPreviousPane = displayingPreviousPane;
+ m_displayingAlignment = displayingAlignment;
+ m_displayingProportion = displayingProportion;
+ }
+
+ internal void SetDisplayingBounds(Rectangle logicalBounds, Rectangle paneBounds, Rectangle splitterBounds)
+ {
+ m_logicalBounds = logicalBounds;
+ m_paneBounds = paneBounds;
+ m_splitterBounds = splitterBounds;
+ }
+ }
+}
diff --git a/trunk/Docking/NestedPaneCollection.cs b/source/Docking/NestedPaneCollection.cs
similarity index 96%
rename from trunk/Docking/NestedPaneCollection.cs
rename to source/Docking/NestedPaneCollection.cs
index d1b19ca..ed6144e 100644
--- a/trunk/Docking/NestedPaneCollection.cs
+++ b/source/Docking/NestedPaneCollection.cs
@@ -1,116 +1,116 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Drawing;
-
-namespace LSLEditor.Docking
-{
- public sealed class NestedPaneCollection : ReadOnlyCollection
- {
- private INestedPanesContainer m_container;
- private VisibleNestedPaneCollection m_visibleNestedPanes;
-
- internal NestedPaneCollection(INestedPanesContainer container)
- : base(new List())
- {
- m_container = container;
- m_visibleNestedPanes = new VisibleNestedPaneCollection(this);
- }
-
- public INestedPanesContainer Container
- {
- get { return m_container; }
- }
-
- public VisibleNestedPaneCollection VisibleNestedPanes
- {
- get { return m_visibleNestedPanes; }
- }
-
- public DockState DockState
- {
- get { return Container.DockState; }
- }
-
- public bool IsFloat
- {
- get { return DockState == DockState.Float; }
- }
-
- internal void Add(DockPane pane)
- {
- if (pane == null)
- return;
-
- NestedPaneCollection oldNestedPanes = (pane.NestedPanesContainer == null) ? null : pane.NestedPanesContainer.NestedPanes;
- if (oldNestedPanes != null)
- oldNestedPanes.InternalRemove(pane);
- Items.Add(pane);
- if (oldNestedPanes != null)
- oldNestedPanes.CheckFloatWindowDispose();
- }
-
- private void CheckFloatWindowDispose()
- {
- if (Count == 0 && Container.DockState == DockState.Float)
- {
- FloatWindow floatWindow = (FloatWindow)Container;
- if (!floatWindow.Disposing && !floatWindow.IsDisposed)
- NativeMethods.PostMessage(((FloatWindow)Container).Handle, FloatWindow.WM_CHECKDISPOSE, 0, 0);
- }
- }
-
- internal void Remove(DockPane pane)
- {
- InternalRemove(pane);
- CheckFloatWindowDispose();
- }
-
- private void InternalRemove(DockPane pane)
- {
- if (!Contains(pane))
- return;
-
- NestedDockingStatus statusPane = pane.NestedDockingStatus;
- DockPane lastNestedPane = null;
- for (int i=Count - 1; i> IndexOf(pane); i--)
- {
- if (this[i].NestedDockingStatus.PreviousPane == pane)
- {
- lastNestedPane = this[i];
- break;
- }
- }
-
- if (lastNestedPane != null)
- {
- int indexLastNestedPane = IndexOf(lastNestedPane);
- Items.Remove(lastNestedPane);
- Items[IndexOf(pane)] = lastNestedPane;
- NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;
- lastNestedDock.SetStatus(this, statusPane.PreviousPane, statusPane.Alignment, statusPane.Proportion);
- for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--)
- {
- NestedDockingStatus status = this[i].NestedDockingStatus;
- if (status.PreviousPane == pane)
- status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion);
- }
- }
- else
- Items.Remove(pane);
-
- statusPane.SetStatus(null, null, DockAlignment.Left, 0.5);
- statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5);
- statusPane.SetDisplayingBounds(Rectangle.Empty, Rectangle.Empty, Rectangle.Empty);
- }
-
- public DockPane GetDefaultPreviousPane(DockPane pane)
- {
- for (int i=Count-1; i>=0; i--)
- if (this[i] != pane)
- return this[i];
-
- return null;
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Drawing;
+
+namespace LSLEditor.Docking
+{
+ public sealed class NestedPaneCollection : ReadOnlyCollection
+ {
+ private INestedPanesContainer m_container;
+ private VisibleNestedPaneCollection m_visibleNestedPanes;
+
+ internal NestedPaneCollection(INestedPanesContainer container)
+ : base(new List())
+ {
+ m_container = container;
+ m_visibleNestedPanes = new VisibleNestedPaneCollection(this);
+ }
+
+ public INestedPanesContainer Container
+ {
+ get { return m_container; }
+ }
+
+ public VisibleNestedPaneCollection VisibleNestedPanes
+ {
+ get { return m_visibleNestedPanes; }
+ }
+
+ public DockState DockState
+ {
+ get { return Container.DockState; }
+ }
+
+ public bool IsFloat
+ {
+ get { return DockState == DockState.Float; }
+ }
+
+ internal void Add(DockPane pane)
+ {
+ if (pane == null)
+ return;
+
+ NestedPaneCollection oldNestedPanes = (pane.NestedPanesContainer == null) ? null : pane.NestedPanesContainer.NestedPanes;
+ if (oldNestedPanes != null)
+ oldNestedPanes.InternalRemove(pane);
+ Items.Add(pane);
+ if (oldNestedPanes != null)
+ oldNestedPanes.CheckFloatWindowDispose();
+ }
+
+ private void CheckFloatWindowDispose()
+ {
+ if (Count == 0 && Container.DockState == DockState.Float)
+ {
+ FloatWindow floatWindow = (FloatWindow)Container;
+ if (!floatWindow.Disposing && !floatWindow.IsDisposed)
+ NativeMethods.PostMessage(((FloatWindow)Container).Handle, FloatWindow.WM_CHECKDISPOSE, 0, 0);
+ }
+ }
+
+ internal void Remove(DockPane pane)
+ {
+ InternalRemove(pane);
+ CheckFloatWindowDispose();
+ }
+
+ private void InternalRemove(DockPane pane)
+ {
+ if (!Contains(pane))
+ return;
+
+ NestedDockingStatus statusPane = pane.NestedDockingStatus;
+ DockPane lastNestedPane = null;
+ for (int i=Count - 1; i> IndexOf(pane); i--)
+ {
+ if (this[i].NestedDockingStatus.PreviousPane == pane)
+ {
+ lastNestedPane = this[i];
+ break;
+ }
+ }
+
+ if (lastNestedPane != null)
+ {
+ int indexLastNestedPane = IndexOf(lastNestedPane);
+ Items.Remove(lastNestedPane);
+ Items[IndexOf(pane)] = lastNestedPane;
+ NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;
+ lastNestedDock.SetStatus(this, statusPane.PreviousPane, statusPane.Alignment, statusPane.Proportion);
+ for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--)
+ {
+ NestedDockingStatus status = this[i].NestedDockingStatus;
+ if (status.PreviousPane == pane)
+ status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion);
+ }
+ }
+ else
+ Items.Remove(pane);
+
+ statusPane.SetStatus(null, null, DockAlignment.Left, 0.5);
+ statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5);
+ statusPane.SetDisplayingBounds(Rectangle.Empty, Rectangle.Empty, Rectangle.Empty);
+ }
+
+ public DockPane GetDefaultPreviousPane(DockPane pane)
+ {
+ for (int i=Count-1; i>=0; i--)
+ if (this[i] != pane)
+ return this[i];
+
+ return null;
+ }
+ }
+}
diff --git a/trunk/Docking/Resources.Designer.cs b/source/Docking/Resources.Designer.cs
similarity index 97%
rename from trunk/Docking/Resources.Designer.cs
rename to source/Docking/Resources.Designer.cs
index 90cc35c..18801de 100644
--- a/trunk/Docking/Resources.Designer.cs
+++ b/source/Docking/Resources.Designer.cs
@@ -1,225 +1,225 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3603
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace LSLEditor.Docking
-{
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LSLEditor.Docking.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Bottom {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Bottom", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Fill {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Fill", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_HotSpot {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_HotSpot", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_HotSpotIndex {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_HotSpotIndex", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Left {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Left", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Right {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Right", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Top {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Top", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelBottom {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelBottom", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelBottom_Active {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelBottom_Active", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelFill {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelFill", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelFill_Active {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelFill_Active", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelLeft {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelLeft", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelLeft_Active {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelLeft_Active", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelRight {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelRight", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelRight_Active {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelRight_Active", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelTop {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelTop", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockIndicator_PanelTop_Active {
- get {
- object obj = ResourceManager.GetObject("DockIndicator_PanelTop_Active", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockPane_AutoHide {
- get {
- object obj = ResourceManager.GetObject("DockPane_AutoHide", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockPane_Close {
- get {
- object obj = ResourceManager.GetObject("DockPane_Close", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockPane_Dock {
- get {
- object obj = ResourceManager.GetObject("DockPane_Dock", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockPane_Option {
- get {
- object obj = ResourceManager.GetObject("DockPane_Option", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap DockPane_OptionOverflow {
- get {
- object obj = ResourceManager.GetObject("DockPane_OptionOverflow", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3603
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace LSLEditor.Docking
+{
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LSLEditor.Docking.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Bottom {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Bottom", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Fill {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Fill", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_HotSpot {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_HotSpot", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_HotSpotIndex {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_HotSpotIndex", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Left {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Left", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Right {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Right", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PaneDiamond_Top {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PaneDiamond_Top", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelBottom {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelBottom", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelBottom_Active {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelBottom_Active", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelFill {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelFill", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelFill_Active {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelFill_Active", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelLeft {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelLeft", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelLeft_Active {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelLeft_Active", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelRight {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelRight", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelRight_Active {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelRight_Active", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelTop {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelTop", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockIndicator_PanelTop_Active {
+ get {
+ object obj = ResourceManager.GetObject("DockIndicator_PanelTop_Active", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockPane_AutoHide {
+ get {
+ object obj = ResourceManager.GetObject("DockPane_AutoHide", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockPane_Close {
+ get {
+ object obj = ResourceManager.GetObject("DockPane_Close", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockPane_Dock {
+ get {
+ object obj = ResourceManager.GetObject("DockPane_Dock", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockPane_Option {
+ get {
+ object obj = ResourceManager.GetObject("DockPane_Option", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap DockPane_OptionOverflow {
+ get {
+ object obj = ResourceManager.GetObject("DockPane_OptionOverflow", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/trunk/Docking/Resources.resx b/source/Docking/Resources.resx
similarity index 98%
rename from trunk/Docking/Resources.resx
rename to source/Docking/Resources.resx
index bd5a077..0f8b146 100644
--- a/trunk/Docking/Resources.resx
+++ b/source/Docking/Resources.resx
@@ -1,190 +1,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- Resources\DockIndicator_PaneDiamond.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PaneDiamond_Bottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PaneDiamond_Fill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PaneDiamond_HotSpot.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PaneDiamond_HotSpotIndex.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PaneDiamond_Left.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PaneDiamond_Right.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PaneDiamond_Top.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelBottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelBottom_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelFill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelFill_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelLeft.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelLeft_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelRight.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelRight_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelTop.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockIndicator_PanelTop_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockPane_AutoHide.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockPane_Close.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockPane_Dock.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockPane_Option.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- Resources\DockPane_OptionOverflow.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ Resources\DockIndicator_PaneDiamond.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PaneDiamond_Bottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PaneDiamond_Fill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PaneDiamond_HotSpot.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PaneDiamond_HotSpotIndex.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PaneDiamond_Left.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PaneDiamond_Right.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PaneDiamond_Top.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelBottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelBottom_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelFill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelFill_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelLeft.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelLeft_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelRight.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelRight_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelTop.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockIndicator_PanelTop_Active.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockPane_AutoHide.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockPane_Close.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockPane_Dock.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockPane_Option.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\DockPane_OptionOverflow.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/trunk/Docking/Resources/DockIndicator_PaneDiamond.bmp b/source/Docking/Resources/DockIndicator_PaneDiamond.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PaneDiamond.bmp
rename to source/Docking/Resources/DockIndicator_PaneDiamond.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PaneDiamond_Bottom.bmp b/source/Docking/Resources/DockIndicator_PaneDiamond_Bottom.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PaneDiamond_Bottom.bmp
rename to source/Docking/Resources/DockIndicator_PaneDiamond_Bottom.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.bmp b/source/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.bmp
rename to source/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.bmp b/source/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.bmp
rename to source/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PaneDiamond_Left.bmp b/source/Docking/Resources/DockIndicator_PaneDiamond_Left.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PaneDiamond_Left.bmp
rename to source/Docking/Resources/DockIndicator_PaneDiamond_Left.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PaneDiamond_Right.bmp b/source/Docking/Resources/DockIndicator_PaneDiamond_Right.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PaneDiamond_Right.bmp
rename to source/Docking/Resources/DockIndicator_PaneDiamond_Right.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PaneDiamond_Top.bmp b/source/Docking/Resources/DockIndicator_PaneDiamond_Top.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PaneDiamond_Top.bmp
rename to source/Docking/Resources/DockIndicator_PaneDiamond_Top.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelBottom.bmp b/source/Docking/Resources/DockIndicator_PanelBottom.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelBottom.bmp
rename to source/Docking/Resources/DockIndicator_PanelBottom.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelBottom_Active.bmp b/source/Docking/Resources/DockIndicator_PanelBottom_Active.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelBottom_Active.bmp
rename to source/Docking/Resources/DockIndicator_PanelBottom_Active.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelFill.bmp b/source/Docking/Resources/DockIndicator_PanelFill.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelFill.bmp
rename to source/Docking/Resources/DockIndicator_PanelFill.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelFill_Active.bmp b/source/Docking/Resources/DockIndicator_PanelFill_Active.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelFill_Active.bmp
rename to source/Docking/Resources/DockIndicator_PanelFill_Active.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelLeft.bmp b/source/Docking/Resources/DockIndicator_PanelLeft.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelLeft.bmp
rename to source/Docking/Resources/DockIndicator_PanelLeft.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelLeft_Active.bmp b/source/Docking/Resources/DockIndicator_PanelLeft_Active.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelLeft_Active.bmp
rename to source/Docking/Resources/DockIndicator_PanelLeft_Active.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelRight.bmp b/source/Docking/Resources/DockIndicator_PanelRight.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelRight.bmp
rename to source/Docking/Resources/DockIndicator_PanelRight.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelRight_Active.bmp b/source/Docking/Resources/DockIndicator_PanelRight_Active.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelRight_Active.bmp
rename to source/Docking/Resources/DockIndicator_PanelRight_Active.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelTop.bmp b/source/Docking/Resources/DockIndicator_PanelTop.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelTop.bmp
rename to source/Docking/Resources/DockIndicator_PanelTop.bmp
diff --git a/trunk/Docking/Resources/DockIndicator_PanelTop_Active.bmp b/source/Docking/Resources/DockIndicator_PanelTop_Active.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockIndicator_PanelTop_Active.bmp
rename to source/Docking/Resources/DockIndicator_PanelTop_Active.bmp
diff --git a/trunk/Docking/Resources/DockPane_AutoHide.bmp b/source/Docking/Resources/DockPane_AutoHide.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockPane_AutoHide.bmp
rename to source/Docking/Resources/DockPane_AutoHide.bmp
diff --git a/trunk/Docking/Resources/DockPane_Close.bmp b/source/Docking/Resources/DockPane_Close.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockPane_Close.bmp
rename to source/Docking/Resources/DockPane_Close.bmp
diff --git a/trunk/Docking/Resources/DockPane_Dock.bmp b/source/Docking/Resources/DockPane_Dock.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockPane_Dock.bmp
rename to source/Docking/Resources/DockPane_Dock.bmp
diff --git a/trunk/Docking/Resources/DockPane_Option.bmp b/source/Docking/Resources/DockPane_Option.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockPane_Option.bmp
rename to source/Docking/Resources/DockPane_Option.bmp
diff --git a/trunk/Docking/Resources/DockPane_OptionOverflow.bmp b/source/Docking/Resources/DockPane_OptionOverflow.bmp
similarity index 100%
rename from trunk/Docking/Resources/DockPane_OptionOverflow.bmp
rename to source/Docking/Resources/DockPane_OptionOverflow.bmp
diff --git a/trunk/Docking/Resources/Dockindicator_PaneDiamond_Fill.bmp b/source/Docking/Resources/Dockindicator_PaneDiamond_Fill.bmp
similarity index 100%
rename from trunk/Docking/Resources/Dockindicator_PaneDiamond_Fill.bmp
rename to source/Docking/Resources/Dockindicator_PaneDiamond_Fill.bmp
diff --git a/trunk/Docking/SplitterBase.cs b/source/Docking/SplitterBase.cs
similarity index 95%
rename from trunk/Docking/SplitterBase.cs
rename to source/Docking/SplitterBase.cs
index e6416fe..5ab85c7 100644
--- a/trunk/Docking/SplitterBase.cs
+++ b/source/Docking/SplitterBase.cs
@@ -1,70 +1,70 @@
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- internal class SplitterBase : Control
- {
- public SplitterBase()
- {
- SetStyle(ControlStyles.Selectable, false);
- }
-
- public override DockStyle Dock
- {
- get { return base.Dock; }
- set
- {
- SuspendLayout();
- base.Dock = value;
-
- if (Dock == DockStyle.Left || Dock == DockStyle.Right)
- Width = SplitterSize;
- else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
- Height = SplitterSize;
- else
- Bounds = Rectangle.Empty;
-
- if (Dock == DockStyle.Left || Dock == DockStyle.Right)
- Cursor = Cursors.VSplit;
- else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
- Cursor = Cursors.HSplit;
- else
- Cursor = Cursors.Default;
-
- ResumeLayout();
- }
- }
-
- protected virtual int SplitterSize
- {
- get { return 0; }
- }
-
- protected override void OnMouseDown(MouseEventArgs e)
- {
- base.OnMouseDown(e);
-
- if (e.Button != MouseButtons.Left)
- return;
-
- StartDrag();
- }
-
- protected virtual void StartDrag()
- {
- }
-
- protected override void WndProc(ref Message m)
- {
- // eat the WM_MOUSEACTIVATE message
- if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
- return;
-
- base.WndProc(ref m);
- }
- }
-}
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Docking
+{
+ internal class SplitterBase : Control
+ {
+ public SplitterBase()
+ {
+ SetStyle(ControlStyles.Selectable, false);
+ }
+
+ public override DockStyle Dock
+ {
+ get { return base.Dock; }
+ set
+ {
+ SuspendLayout();
+ base.Dock = value;
+
+ if (Dock == DockStyle.Left || Dock == DockStyle.Right)
+ Width = SplitterSize;
+ else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
+ Height = SplitterSize;
+ else
+ Bounds = Rectangle.Empty;
+
+ if (Dock == DockStyle.Left || Dock == DockStyle.Right)
+ Cursor = Cursors.VSplit;
+ else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
+ Cursor = Cursors.HSplit;
+ else
+ Cursor = Cursors.Default;
+
+ ResumeLayout();
+ }
+ }
+
+ protected virtual int SplitterSize
+ {
+ get { return 0; }
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ base.OnMouseDown(e);
+
+ if (e.Button != MouseButtons.Left)
+ return;
+
+ StartDrag();
+ }
+
+ protected virtual void StartDrag()
+ {
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ // eat the WM_MOUSEACTIVATE message
+ if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
+ return;
+
+ base.WndProc(ref m);
+ }
+ }
+}
diff --git a/trunk/Docking/Strings.Designer.cs b/source/Docking/Strings.Designer.cs
similarity index 97%
rename from trunk/Docking/Strings.Designer.cs
rename to source/Docking/Strings.Designer.cs
index d21de31..05e9cf6 100644
--- a/trunk/Docking/Strings.Designer.cs
+++ b/source/Docking/Strings.Designer.cs
@@ -1,774 +1,774 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3603
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace LSLEditor.Docking {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LSLEditor.Docking.Strings", typeof(Strings).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to Docking.
- ///
- internal static string Category_Docking {
- get {
- return ResourceManager.GetString("Category_Docking", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Docking Notification.
- ///
- internal static string Category_DockingNotification {
- get {
- return ResourceManager.GetString("Category_DockingNotification", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Property Changed.
- ///
- internal static string Category_PropertyChanged {
- get {
- return ResourceManager.GetString("Category_PropertyChanged", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to (Float).
- ///
- internal static string DockAreaEditor_FloatCheckBoxText {
- get {
- return ResourceManager.GetString("DockAreaEditor_FloatCheckBoxText", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Determines if end user drag and drop docking is allowed..
- ///
- internal static string DockContent_AllowEndUserDocking_Description {
- get {
- return ResourceManager.GetString("DockContent_AllowEndUserDocking_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The size to display the content in auto hide mode. Value < 1 to specify the size in portion; value >= 1 to specify the size in pixel..
- ///
- internal static string DockContent_AutoHidePortion_Description {
- get {
- return ResourceManager.GetString("DockContent_AutoHidePortion_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Enable/Disable the close button of the content..
- ///
- internal static string DockContent_CloseButton_Description {
- get {
- return ResourceManager.GetString("DockContent_CloseButton_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Shows or hides the close button of the content. This property does not function with System MDI Document Style..
- ///
- internal static string DockContent_CloseButtonVisible_Description {
- get {
- return ResourceManager.GetString("DockContent_CloseButtonVisible_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The form must be of type IDockContent..
- ///
- internal static string DockContent_Constructor_InvalidForm {
- get {
- return ResourceManager.GetString("DockContent_Constructor_InvalidForm", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Gets or sets a value indicating in which area of the DockPanel the content allowed to show..
- ///
- internal static string DockContent_DockAreas_Description {
- get {
- return ResourceManager.GetString("DockContent_DockAreas_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Occurs when the value of DockState property changed..
- ///
- internal static string DockContent_DockStateChanged_Description {
- get {
- return ResourceManager.GetString("DockContent_DockStateChanged_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Indicates the content will be hidden instead of being closed..
- ///
- internal static string DockContent_HideOnClose_Description {
- get {
- return ResourceManager.GetString("DockContent_HideOnClose_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The desired docking state when first showing..
- ///
- internal static string DockContent_ShowHint_Description {
- get {
- return ResourceManager.GetString("DockContent_ShowHint_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Context menu displayed for the dock pane tab strip..
- ///
- internal static string DockContent_TabPageContextMenu_Description {
- get {
- return ResourceManager.GetString("DockContent_TabPageContextMenu_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The tab text displayed in the dock pane. If not set, the Text property will be used..
- ///
- internal static string DockContent_TabText_Description {
- get {
- return ResourceManager.GetString("DockContent_TabText_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The text displayed when mouse hovers over the tab..
- ///
- internal static string DockContent_ToolTipText_Description {
- get {
- return ResourceManager.GetString("DockContent_ToolTipText_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The provided value is out of range..
- ///
- internal static string DockContentHandler_AutoHidePortion_OutOfRange {
- get {
- return ResourceManager.GetString("DockContentHandler_AutoHidePortion_OutOfRange", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Value: The value of DockAreas conflicts with current DockState..
- ///
- internal static string DockContentHandler_DockAreas_InvalidValue {
- get {
- return ResourceManager.GetString("DockContentHandler_DockAreas_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane..
- ///
- internal static string DockContentHandler_DockPane_InvalidValue {
- get {
- return ResourceManager.GetString("DockContentHandler_DockPane_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane..
- ///
- internal static string DockContentHandler_FloatPane_InvalidValue {
- get {
- return ResourceManager.GetString("DockContentHandler_FloatPane_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid value, conflicts with DockableAreas property..
- ///
- internal static string DockContentHandler_IsFloat_InvalidValue {
- get {
- return ResourceManager.GetString("DockContentHandler_IsFloat_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The dock state is invalid..
- ///
- internal static string DockContentHandler_SetDockState_InvalidState {
- get {
- return ResourceManager.GetString("DockContentHandler_SetDockState_InvalidState", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The dock panel is null..
- ///
- internal static string DockContentHandler_SetDockState_NullPanel {
- get {
- return ResourceManager.GetString("DockContentHandler_SetDockState_NullPanel", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid beforeContent, it must be contained by the pane..
- ///
- internal static string DockContentHandler_Show_InvalidBeforeContent {
- get {
- return ResourceManager.GetString("DockContentHandler_Show_InvalidBeforeContent", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid DockState: Content can not be showed as "Unknown" or "Hidden"..
- ///
- internal static string DockContentHandler_Show_InvalidDockState {
- get {
- return ResourceManager.GetString("DockContentHandler_Show_InvalidDockState", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The previous pane is invalid. It can not be null, and its docking state must not be auto-hide..
- ///
- internal static string DockContentHandler_Show_InvalidPrevPane {
- get {
- return ResourceManager.GetString("DockContentHandler_Show_InvalidPrevPane", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to DockPanel can not be null..
- ///
- internal static string DockContentHandler_Show_NullDockPanel {
- get {
- return ResourceManager.GetString("DockContentHandler_Show_NullDockPanel", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The Pane can not be null..
- ///
- internal static string DockContentHandler_Show_NullPane {
- get {
- return ResourceManager.GetString("DockContentHandler_Show_NullPane", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid value, check DockableAreas property..
- ///
- internal static string DockContentHandler_ShowHint_InvalidValue {
- get {
- return ResourceManager.GetString("DockContentHandler_ShowHint_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Context menu displayed for the dock pane tab strip..
- ///
- internal static string DockHandler_TabPageContextMenuStrip_Description {
- get {
- return ResourceManager.GetString("DockHandler_TabPageContextMenuStrip_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Press SHIFT for docking to full side..
- ///
- internal static string DockIndicator_ToolTipText {
- get {
- return ResourceManager.GetString("DockIndicator_ToolTipText", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content..
- ///
- internal static string DockPane_ActiveContent_InvalidValue {
- get {
- return ResourceManager.GetString("DockPane_ActiveContent_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid argument: Content can not be "null"..
- ///
- internal static string DockPane_Constructor_NullContent {
- get {
- return ResourceManager.GetString("DockPane_Constructor_NullContent", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid argument: The content's DockPanel can not be "null"..
- ///
- internal static string DockPane_Constructor_NullDockPanel {
- get {
- return ResourceManager.GetString("DockPane_Constructor_NullDockPanel", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The specified container conflicts with the IsFloat property..
- ///
- internal static string DockPane_DockTo_InvalidContainer {
- get {
- return ResourceManager.GetString("DockPane_DockTo_InvalidContainer", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The previous pane does not exist in the nested docking pane collection..
- ///
- internal static string DockPane_DockTo_NoPrevPane {
- get {
- return ResourceManager.GetString("DockPane_DockTo_NoPrevPane", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The container can not be null..
- ///
- internal static string DockPane_DockTo_NullContainer {
- get {
- return ResourceManager.GetString("DockPane_DockTo_NullContainer", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The previous pane can not be null when the nested docking pane collection is not empty..
- ///
- internal static string DockPane_DockTo_NullPrevPane {
- get {
- return ResourceManager.GetString("DockPane_DockTo_NullPrevPane", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The previous pane can not be itself..
- ///
- internal static string DockPane_DockTo_SelfPrevPane {
- get {
- return ResourceManager.GetString("DockPane_DockTo_SelfPrevPane", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to FloatWindow property can not be set to "null" when DockState is DockState.Float..
- ///
- internal static string DockPane_FloatWindow_InvalidValue {
- get {
- return ResourceManager.GetString("DockPane_FloatWindow_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Content: Content not within the collection..
- ///
- internal static string DockPane_SetContentIndex_InvalidContent {
- get {
- return ResourceManager.GetString("DockPane_SetContentIndex_InvalidContent", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Index: The index is out of range..
- ///
- internal static string DockPane_SetContentIndex_InvalidIndex {
- get {
- return ResourceManager.GetString("DockPane_SetContentIndex_InvalidIndex", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The state for the dock pane is invalid..
- ///
- internal static string DockPane_SetDockState_InvalidState {
- get {
- return ResourceManager.GetString("DockPane_SetDockState_InvalidState", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Auto Hide.
- ///
- internal static string DockPaneCaption_ToolTipAutoHide {
- get {
- return ResourceManager.GetString("DockPaneCaption_ToolTipAutoHide", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Close.
- ///
- internal static string DockPaneCaption_ToolTipClose {
- get {
- return ResourceManager.GetString("DockPaneCaption_ToolTipClose", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Options.
- ///
- internal static string DockPaneCaption_ToolTipOptions {
- get {
- return ResourceManager.GetString("DockPaneCaption_ToolTipOptions", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Content: The content must be auto-hide state and associates with this DockPanel..
- ///
- internal static string DockPanel_ActiveAutoHideContent_InvalidValue {
- get {
- return ResourceManager.GetString("DockPanel_ActiveAutoHideContent_InvalidValue", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Occurs when the value of ActiveContentProperty changed..
- ///
- internal static string DockPanel_ActiveContentChanged_Description {
- get {
- return ResourceManager.GetString("DockPanel_ActiveContentChanged_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Occurs when the value of ActiveDocument property changed..
- ///
- internal static string DockPanel_ActiveDocumentChanged_Description {
- get {
- return ResourceManager.GetString("DockPanel_ActiveDocumentChanged_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Occurs when the value of ActivePane property changed..
- ///
- internal static string DockPanel_ActivePaneChanged_Description {
- get {
- return ResourceManager.GetString("DockPanel_ActivePaneChanged_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Determines if the drag and drop docking is allowed..
- ///
- internal static string DockPanel_AllowEndUserDocking_Description {
- get {
- return ResourceManager.GetString("DockPanel_AllowEndUserDocking_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Determines if the drag and drop nested docking is allowed..
- ///
- internal static string DockPanel_AllowEndUserNestedDocking_Description {
- get {
- return ResourceManager.GetString("DockPanel_AllowEndUserNestedDocking_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Occurs when a content added to the DockPanel..
- ///
- internal static string DockPanel_ContentAdded_Description {
- get {
- return ResourceManager.GetString("DockPanel_ContentAdded_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Occurs when a content removed from the DockPanel..
- ///
- internal static string DockPanel_ContentRemoved_Description {
- get {
- return ResourceManager.GetString("DockPanel_ContentRemoved_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The default size of float window..
- ///
- internal static string DockPanel_DefaultFloatWindowSize_Description {
- get {
- return ResourceManager.GetString("DockPanel_DefaultFloatWindowSize_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Provides Visual Studio .Net style docking..
- ///
- internal static string DockPanel_Description {
- get {
- return ResourceManager.GetString("DockPanel_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
- ///
- internal static string DockPanel_DockBottomPortion_Description {
- get {
- return ResourceManager.GetString("DockPanel_DockBottomPortion_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Size of the left docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
- ///
- internal static string DockPanel_DockLeftPortion_Description {
- get {
- return ResourceManager.GetString("DockPanel_DockLeftPortion_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The visual skin to use when displaying the docked windows..
- ///
- internal static string DockPanel_DockPanelSkin {
- get {
- return ResourceManager.GetString("DockPanel_DockPanelSkin", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Size of the right docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
- ///
- internal static string DockPanel_DockRightPortion_Description {
- get {
- return ResourceManager.GetString("DockPanel_DockRightPortion_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Size of the top docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
- ///
- internal static string DockPanel_DockTopPortion_Description {
- get {
- return ResourceManager.GetString("DockPanel_DockTopPortion_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The style of the document window..
- ///
- internal static string DockPanel_DocumentStyle_Description {
- get {
- return ResourceManager.GetString("DockPanel_DocumentStyle_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Determines where the tab strip for Document style content is drawn..
- ///
- internal static string DockPanel_DocumentTabStripLocation {
- get {
- return ResourceManager.GetString("DockPanel_DocumentTabStripLocation", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The DockPanel has already been initialized..
- ///
- internal static string DockPanel_LoadFromXml_AlreadyInitialized {
- get {
- return ResourceManager.GetString("DockPanel_LoadFromXml_AlreadyInitialized", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The configuration file's version is invalid..
- ///
- internal static string DockPanel_LoadFromXml_InvalidFormatVersion {
- get {
- return ResourceManager.GetString("DockPanel_LoadFromXml_InvalidFormatVersion", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The XML file format is invalid..
- ///
- internal static string DockPanel_LoadFromXml_InvalidXmlFormat {
- get {
- return ResourceManager.GetString("DockPanel_LoadFromXml_InvalidXmlFormat", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid parent form. When using DockingMdi or SystemMdi document style, the DockPanel control must be the child control of the main MDI container form..
- ///
- internal static string DockPanel_ParentForm_Invalid {
- get {
- return ResourceManager.GetString("DockPanel_ParentForm_Invalid", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to DockPanel configuration file. Author: Weifen Luo, all rights reserved..
- ///
- internal static string DockPanel_Persistor_XmlFileComment1 {
- get {
- return ResourceManager.GetString("DockPanel_Persistor_XmlFileComment1", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!!.
- ///
- internal static string DockPanel_Persistor_XmlFileComment2 {
- get {
- return ResourceManager.GetString("DockPanel_Persistor_XmlFileComment2", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Indicates whether the control layout is right-to-left when the RightToLeft property is set to Yes..
- ///
- internal static string DockPanel_RightToLeftLayout_Description {
- get {
- return ResourceManager.GetString("DockPanel_RightToLeftLayout_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Index: The index is out of range..
- ///
- internal static string DockPanel_SetPaneIndex_InvalidIndex {
- get {
- return ResourceManager.GetString("DockPanel_SetPaneIndex_InvalidIndex", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Pane: DockPane not within the collection..
- ///
- internal static string DockPanel_SetPaneIndex_InvalidPane {
- get {
- return ResourceManager.GetString("DockPanel_SetPaneIndex_InvalidPane", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Determines if the document icon will be displayed in the tab strip..
- ///
- internal static string DockPanel_ShowDocumentIcon_Description {
- get {
- return ResourceManager.GetString("DockPanel_ShowDocumentIcon_Description", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Close.
- ///
- internal static string DockPaneStrip_ToolTipClose {
- get {
- return ResourceManager.GetString("DockPaneStrip_ToolTipClose", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Window List.
- ///
- internal static string DockPaneStrip_ToolTipWindowList {
- get {
- return ResourceManager.GetString("DockPaneStrip_ToolTipWindowList", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid argument: DockPanel can not be "null"..
- ///
- internal static string FloatWindow_Constructor_NullDockPanel {
- get {
- return ResourceManager.GetString("FloatWindow_Constructor_NullDockPanel", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Index: The index is out of range..
- ///
- internal static string FloatWindow_SetPaneIndex_InvalidIndex {
- get {
- return ResourceManager.GetString("FloatWindow_SetPaneIndex_InvalidIndex", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid Pane: DockPane not within the collection..
- ///
- internal static string FloatWindow_SetPaneIndex_InvalidPane {
- get {
- return ResourceManager.GetString("FloatWindow_SetPaneIndex_InvalidPane", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Invalid DockPanel..
- ///
- internal static string IDockDragSource_DockTo_InvalidPanel {
- get {
- return ResourceManager.GetString("IDockDragSource_DockTo_InvalidPanel", resourceCulture);
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3603
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace LSLEditor.Docking {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Strings {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Strings() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LSLEditor.Docking.Strings", typeof(Strings).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Docking.
+ ///
+ internal static string Category_Docking {
+ get {
+ return ResourceManager.GetString("Category_Docking", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Docking Notification.
+ ///
+ internal static string Category_DockingNotification {
+ get {
+ return ResourceManager.GetString("Category_DockingNotification", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Property Changed.
+ ///
+ internal static string Category_PropertyChanged {
+ get {
+ return ResourceManager.GetString("Category_PropertyChanged", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to (Float).
+ ///
+ internal static string DockAreaEditor_FloatCheckBoxText {
+ get {
+ return ResourceManager.GetString("DockAreaEditor_FloatCheckBoxText", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Determines if end user drag and drop docking is allowed..
+ ///
+ internal static string DockContent_AllowEndUserDocking_Description {
+ get {
+ return ResourceManager.GetString("DockContent_AllowEndUserDocking_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The size to display the content in auto hide mode. Value < 1 to specify the size in portion; value >= 1 to specify the size in pixel..
+ ///
+ internal static string DockContent_AutoHidePortion_Description {
+ get {
+ return ResourceManager.GetString("DockContent_AutoHidePortion_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Enable/Disable the close button of the content..
+ ///
+ internal static string DockContent_CloseButton_Description {
+ get {
+ return ResourceManager.GetString("DockContent_CloseButton_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Shows or hides the close button of the content. This property does not function with System MDI Document Style..
+ ///
+ internal static string DockContent_CloseButtonVisible_Description {
+ get {
+ return ResourceManager.GetString("DockContent_CloseButtonVisible_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The form must be of type IDockContent..
+ ///
+ internal static string DockContent_Constructor_InvalidForm {
+ get {
+ return ResourceManager.GetString("DockContent_Constructor_InvalidForm", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Gets or sets a value indicating in which area of the DockPanel the content allowed to show..
+ ///
+ internal static string DockContent_DockAreas_Description {
+ get {
+ return ResourceManager.GetString("DockContent_DockAreas_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Occurs when the value of DockState property changed..
+ ///
+ internal static string DockContent_DockStateChanged_Description {
+ get {
+ return ResourceManager.GetString("DockContent_DockStateChanged_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Indicates the content will be hidden instead of being closed..
+ ///
+ internal static string DockContent_HideOnClose_Description {
+ get {
+ return ResourceManager.GetString("DockContent_HideOnClose_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The desired docking state when first showing..
+ ///
+ internal static string DockContent_ShowHint_Description {
+ get {
+ return ResourceManager.GetString("DockContent_ShowHint_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Context menu displayed for the dock pane tab strip..
+ ///
+ internal static string DockContent_TabPageContextMenu_Description {
+ get {
+ return ResourceManager.GetString("DockContent_TabPageContextMenu_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The tab text displayed in the dock pane. If not set, the Text property will be used..
+ ///
+ internal static string DockContent_TabText_Description {
+ get {
+ return ResourceManager.GetString("DockContent_TabText_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The text displayed when mouse hovers over the tab..
+ ///
+ internal static string DockContent_ToolTipText_Description {
+ get {
+ return ResourceManager.GetString("DockContent_ToolTipText_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The provided value is out of range..
+ ///
+ internal static string DockContentHandler_AutoHidePortion_OutOfRange {
+ get {
+ return ResourceManager.GetString("DockContentHandler_AutoHidePortion_OutOfRange", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Value: The value of DockAreas conflicts with current DockState..
+ ///
+ internal static string DockContentHandler_DockAreas_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockContentHandler_DockAreas_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane..
+ ///
+ internal static string DockContentHandler_DockPane_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockContentHandler_DockPane_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane..
+ ///
+ internal static string DockContentHandler_FloatPane_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockContentHandler_FloatPane_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid value, conflicts with DockableAreas property..
+ ///
+ internal static string DockContentHandler_IsFloat_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockContentHandler_IsFloat_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The dock state is invalid..
+ ///
+ internal static string DockContentHandler_SetDockState_InvalidState {
+ get {
+ return ResourceManager.GetString("DockContentHandler_SetDockState_InvalidState", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The dock panel is null..
+ ///
+ internal static string DockContentHandler_SetDockState_NullPanel {
+ get {
+ return ResourceManager.GetString("DockContentHandler_SetDockState_NullPanel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid beforeContent, it must be contained by the pane..
+ ///
+ internal static string DockContentHandler_Show_InvalidBeforeContent {
+ get {
+ return ResourceManager.GetString("DockContentHandler_Show_InvalidBeforeContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid DockState: Content can not be showed as "Unknown" or "Hidden"..
+ ///
+ internal static string DockContentHandler_Show_InvalidDockState {
+ get {
+ return ResourceManager.GetString("DockContentHandler_Show_InvalidDockState", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The previous pane is invalid. It can not be null, and its docking state must not be auto-hide..
+ ///
+ internal static string DockContentHandler_Show_InvalidPrevPane {
+ get {
+ return ResourceManager.GetString("DockContentHandler_Show_InvalidPrevPane", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DockPanel can not be null..
+ ///
+ internal static string DockContentHandler_Show_NullDockPanel {
+ get {
+ return ResourceManager.GetString("DockContentHandler_Show_NullDockPanel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The Pane can not be null..
+ ///
+ internal static string DockContentHandler_Show_NullPane {
+ get {
+ return ResourceManager.GetString("DockContentHandler_Show_NullPane", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid value, check DockableAreas property..
+ ///
+ internal static string DockContentHandler_ShowHint_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockContentHandler_ShowHint_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Context menu displayed for the dock pane tab strip..
+ ///
+ internal static string DockHandler_TabPageContextMenuStrip_Description {
+ get {
+ return ResourceManager.GetString("DockHandler_TabPageContextMenuStrip_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Press SHIFT for docking to full side..
+ ///
+ internal static string DockIndicator_ToolTipText {
+ get {
+ return ResourceManager.GetString("DockIndicator_ToolTipText", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content..
+ ///
+ internal static string DockPane_ActiveContent_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockPane_ActiveContent_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid argument: Content can not be "null"..
+ ///
+ internal static string DockPane_Constructor_NullContent {
+ get {
+ return ResourceManager.GetString("DockPane_Constructor_NullContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid argument: The content's DockPanel can not be "null"..
+ ///
+ internal static string DockPane_Constructor_NullDockPanel {
+ get {
+ return ResourceManager.GetString("DockPane_Constructor_NullDockPanel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The specified container conflicts with the IsFloat property..
+ ///
+ internal static string DockPane_DockTo_InvalidContainer {
+ get {
+ return ResourceManager.GetString("DockPane_DockTo_InvalidContainer", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The previous pane does not exist in the nested docking pane collection..
+ ///
+ internal static string DockPane_DockTo_NoPrevPane {
+ get {
+ return ResourceManager.GetString("DockPane_DockTo_NoPrevPane", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The container can not be null..
+ ///
+ internal static string DockPane_DockTo_NullContainer {
+ get {
+ return ResourceManager.GetString("DockPane_DockTo_NullContainer", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The previous pane can not be null when the nested docking pane collection is not empty..
+ ///
+ internal static string DockPane_DockTo_NullPrevPane {
+ get {
+ return ResourceManager.GetString("DockPane_DockTo_NullPrevPane", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The previous pane can not be itself..
+ ///
+ internal static string DockPane_DockTo_SelfPrevPane {
+ get {
+ return ResourceManager.GetString("DockPane_DockTo_SelfPrevPane", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to FloatWindow property can not be set to "null" when DockState is DockState.Float..
+ ///
+ internal static string DockPane_FloatWindow_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockPane_FloatWindow_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Content: Content not within the collection..
+ ///
+ internal static string DockPane_SetContentIndex_InvalidContent {
+ get {
+ return ResourceManager.GetString("DockPane_SetContentIndex_InvalidContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Index: The index is out of range..
+ ///
+ internal static string DockPane_SetContentIndex_InvalidIndex {
+ get {
+ return ResourceManager.GetString("DockPane_SetContentIndex_InvalidIndex", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The state for the dock pane is invalid..
+ ///
+ internal static string DockPane_SetDockState_InvalidState {
+ get {
+ return ResourceManager.GetString("DockPane_SetDockState_InvalidState", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Auto Hide.
+ ///
+ internal static string DockPaneCaption_ToolTipAutoHide {
+ get {
+ return ResourceManager.GetString("DockPaneCaption_ToolTipAutoHide", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Close.
+ ///
+ internal static string DockPaneCaption_ToolTipClose {
+ get {
+ return ResourceManager.GetString("DockPaneCaption_ToolTipClose", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Options.
+ ///
+ internal static string DockPaneCaption_ToolTipOptions {
+ get {
+ return ResourceManager.GetString("DockPaneCaption_ToolTipOptions", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Content: The content must be auto-hide state and associates with this DockPanel..
+ ///
+ internal static string DockPanel_ActiveAutoHideContent_InvalidValue {
+ get {
+ return ResourceManager.GetString("DockPanel_ActiveAutoHideContent_InvalidValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Occurs when the value of ActiveContentProperty changed..
+ ///
+ internal static string DockPanel_ActiveContentChanged_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_ActiveContentChanged_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Occurs when the value of ActiveDocument property changed..
+ ///
+ internal static string DockPanel_ActiveDocumentChanged_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_ActiveDocumentChanged_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Occurs when the value of ActivePane property changed..
+ ///
+ internal static string DockPanel_ActivePaneChanged_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_ActivePaneChanged_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Determines if the drag and drop docking is allowed..
+ ///
+ internal static string DockPanel_AllowEndUserDocking_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_AllowEndUserDocking_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Determines if the drag and drop nested docking is allowed..
+ ///
+ internal static string DockPanel_AllowEndUserNestedDocking_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_AllowEndUserNestedDocking_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Occurs when a content added to the DockPanel..
+ ///
+ internal static string DockPanel_ContentAdded_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_ContentAdded_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Occurs when a content removed from the DockPanel..
+ ///
+ internal static string DockPanel_ContentRemoved_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_ContentRemoved_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The default size of float window..
+ ///
+ internal static string DockPanel_DefaultFloatWindowSize_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_DefaultFloatWindowSize_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Provides Visual Studio .Net style docking..
+ ///
+ internal static string DockPanel_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
+ ///
+ internal static string DockPanel_DockBottomPortion_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_DockBottomPortion_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Size of the left docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
+ ///
+ internal static string DockPanel_DockLeftPortion_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_DockLeftPortion_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The visual skin to use when displaying the docked windows..
+ ///
+ internal static string DockPanel_DockPanelSkin {
+ get {
+ return ResourceManager.GetString("DockPanel_DockPanelSkin", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Size of the right docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
+ ///
+ internal static string DockPanel_DockRightPortion_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_DockRightPortion_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Size of the top docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels..
+ ///
+ internal static string DockPanel_DockTopPortion_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_DockTopPortion_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The style of the document window..
+ ///
+ internal static string DockPanel_DocumentStyle_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_DocumentStyle_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Determines where the tab strip for Document style content is drawn..
+ ///
+ internal static string DockPanel_DocumentTabStripLocation {
+ get {
+ return ResourceManager.GetString("DockPanel_DocumentTabStripLocation", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The DockPanel has already been initialized..
+ ///
+ internal static string DockPanel_LoadFromXml_AlreadyInitialized {
+ get {
+ return ResourceManager.GetString("DockPanel_LoadFromXml_AlreadyInitialized", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The configuration file's version is invalid..
+ ///
+ internal static string DockPanel_LoadFromXml_InvalidFormatVersion {
+ get {
+ return ResourceManager.GetString("DockPanel_LoadFromXml_InvalidFormatVersion", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The XML file format is invalid..
+ ///
+ internal static string DockPanel_LoadFromXml_InvalidXmlFormat {
+ get {
+ return ResourceManager.GetString("DockPanel_LoadFromXml_InvalidXmlFormat", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid parent form. When using DockingMdi or SystemMdi document style, the DockPanel control must be the child control of the main MDI container form..
+ ///
+ internal static string DockPanel_ParentForm_Invalid {
+ get {
+ return ResourceManager.GetString("DockPanel_ParentForm_Invalid", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DockPanel configuration file. Author: Weifen Luo, all rights reserved..
+ ///
+ internal static string DockPanel_Persistor_XmlFileComment1 {
+ get {
+ return ResourceManager.GetString("DockPanel_Persistor_XmlFileComment1", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!!.
+ ///
+ internal static string DockPanel_Persistor_XmlFileComment2 {
+ get {
+ return ResourceManager.GetString("DockPanel_Persistor_XmlFileComment2", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Indicates whether the control layout is right-to-left when the RightToLeft property is set to Yes..
+ ///
+ internal static string DockPanel_RightToLeftLayout_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_RightToLeftLayout_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Index: The index is out of range..
+ ///
+ internal static string DockPanel_SetPaneIndex_InvalidIndex {
+ get {
+ return ResourceManager.GetString("DockPanel_SetPaneIndex_InvalidIndex", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Pane: DockPane not within the collection..
+ ///
+ internal static string DockPanel_SetPaneIndex_InvalidPane {
+ get {
+ return ResourceManager.GetString("DockPanel_SetPaneIndex_InvalidPane", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Determines if the document icon will be displayed in the tab strip..
+ ///
+ internal static string DockPanel_ShowDocumentIcon_Description {
+ get {
+ return ResourceManager.GetString("DockPanel_ShowDocumentIcon_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Close.
+ ///
+ internal static string DockPaneStrip_ToolTipClose {
+ get {
+ return ResourceManager.GetString("DockPaneStrip_ToolTipClose", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Window List.
+ ///
+ internal static string DockPaneStrip_ToolTipWindowList {
+ get {
+ return ResourceManager.GetString("DockPaneStrip_ToolTipWindowList", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid argument: DockPanel can not be "null"..
+ ///
+ internal static string FloatWindow_Constructor_NullDockPanel {
+ get {
+ return ResourceManager.GetString("FloatWindow_Constructor_NullDockPanel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Index: The index is out of range..
+ ///
+ internal static string FloatWindow_SetPaneIndex_InvalidIndex {
+ get {
+ return ResourceManager.GetString("FloatWindow_SetPaneIndex_InvalidIndex", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid Pane: DockPane not within the collection..
+ ///
+ internal static string FloatWindow_SetPaneIndex_InvalidPane {
+ get {
+ return ResourceManager.GetString("FloatWindow_SetPaneIndex_InvalidPane", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid DockPanel..
+ ///
+ internal static string IDockDragSource_DockTo_InvalidPanel {
+ get {
+ return ResourceManager.GetString("IDockDragSource_DockTo_InvalidPanel", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/trunk/Docking/Strings.resx b/source/Docking/Strings.resx
similarity index 98%
rename from trunk/Docking/Strings.resx
rename to source/Docking/Strings.resx
index d5ff49d..1500401 100644
--- a/trunk/Docking/Strings.resx
+++ b/source/Docking/Strings.resx
@@ -1,357 +1,357 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Docking
-
-
- Docking Notification
-
-
- Property Changed
-
-
- (Float)
-
-
- Determines if end user drag and drop docking is allowed.
-
-
- The size to display the content in auto hide mode. Value < 1 to specify the size in portion; value >= 1 to specify the size in pixel.
-
-
- Enable/Disable the close button of the content.
-
-
- The form must be of type IDockContent.
-
-
- Gets or sets a value indicating in which area of the DockPanel the content allowed to show.
-
-
- Occurs when the value of DockState property changed.
-
-
- Indicates the content will be hidden instead of being closed.
-
-
- The desired docking state when first showing.
-
-
- Context menu displayed for the dock pane tab strip.
-
-
- The tab text displayed in the dock pane. If not set, the Text property will be used.
-
-
- The text displayed when mouse hovers over the tab.
-
-
- The provided value is out of range.
-
-
- Invalid Value: The value of DockAreas conflicts with current DockState.
-
-
- The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane.
-
-
- The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane.
-
-
- Invalid value, conflicts with DockableAreas property.
-
-
- The dock state is invalid.
-
-
- The dock panel is null.
-
-
- Invalid beforeContent, it must be contained by the pane.
-
-
- Invalid DockState: Content can not be showed as "Unknown" or "Hidden".
-
-
- The previous pane is invalid. It can not be null, and its docking state must not be auto-hide.
-
-
- DockPanel can not be null.
-
-
- The Pane can not be null.
-
-
- Invalid value, check DockableAreas property.
-
-
- Context menu displayed for the dock pane tab strip.
-
-
- Press SHIFT for docking to full side.
-
-
- Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content.
-
-
- Invalid argument: Content can not be "null".
-
-
- Invalid argument: The content's DockPanel can not be "null".
-
-
- The specified container conflicts with the IsFloat property.
-
-
- The previous pane does not exist in the nested docking pane collection.
-
-
- The container can not be null.
-
-
- The previous pane can not be null when the nested docking pane collection is not empty.
-
-
- The previous pane can not be itself.
-
-
- FloatWindow property can not be set to "null" when DockState is DockState.Float.
-
-
- Invalid Content: Content not within the collection.
-
-
- Invalid Index: The index is out of range.
-
-
- The state for the dock pane is invalid.
-
-
- Auto Hide
-
-
- Close
-
-
- Options
-
-
- Invalid Content: The content must be auto-hide state and associates with this DockPanel.
-
-
- Occurs when the value of ActiveContentProperty changed.
-
-
- Occurs when the value of ActiveDocument property changed.
-
-
- Occurs when the value of ActivePane property changed.
-
-
- Determines if the drag and drop docking is allowed.
-
-
- Determines if the drag and drop nested docking is allowed.
-
-
- Occurs when a content added to the DockPanel.
-
-
- Occurs when a content removed from the DockPanel.
-
-
- The default size of float window.
-
-
- Provides Visual Studio .Net style docking.
-
-
- Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
-
-
- Size of the left docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
-
-
- Size of the right docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
-
-
- Size of the top docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
-
-
- The style of the document window.
-
-
- The DockPanel has already been initialized.
-
-
- The configuration file's version is invalid.
-
-
- The XML file format is invalid.
-
-
- Invalid parent form. When using DockingMdi or SystemMdi document style, the DockPanel control must be the child control of the main MDI container form.
-
-
- DockPanel configuration file. Author: Weifen Luo, all rights reserved.
-
-
- !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!!
-
-
- Indicates whether the control layout is right-to-left when the RightToLeft property is set to Yes.
-
-
- Invalid Index: The index is out of range.
-
-
- Invalid Pane: DockPane not within the collection.
-
-
- Determines if the document icon will be displayed in the tab strip.
-
-
- Close
-
-
- Window List
-
-
- Invalid argument: DockPanel can not be "null".
-
-
- Invalid Index: The index is out of range.
-
-
- Invalid Pane: DockPane not within the collection.
-
-
- Invalid DockPanel.
-
-
- Shows or hides the close button of the content. This property does not function with System MDI Document Style.
-
-
- The visual skin to use when displaying the docked windows.
-
-
- Determines where the tab strip for Document style content is drawn.
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Docking
+
+
+ Docking Notification
+
+
+ Property Changed
+
+
+ (Float)
+
+
+ Determines if end user drag and drop docking is allowed.
+
+
+ The size to display the content in auto hide mode. Value < 1 to specify the size in portion; value >= 1 to specify the size in pixel.
+
+
+ Enable/Disable the close button of the content.
+
+
+ The form must be of type IDockContent.
+
+
+ Gets or sets a value indicating in which area of the DockPanel the content allowed to show.
+
+
+ Occurs when the value of DockState property changed.
+
+
+ Indicates the content will be hidden instead of being closed.
+
+
+ The desired docking state when first showing.
+
+
+ Context menu displayed for the dock pane tab strip.
+
+
+ The tab text displayed in the dock pane. If not set, the Text property will be used.
+
+
+ The text displayed when mouse hovers over the tab.
+
+
+ The provided value is out of range.
+
+
+ Invalid Value: The value of DockAreas conflicts with current DockState.
+
+
+ The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane.
+
+
+ The pane is invalid. Check the IsFloat and DockPanel properties of this dock pane.
+
+
+ Invalid value, conflicts with DockableAreas property.
+
+
+ The dock state is invalid.
+
+
+ The dock panel is null.
+
+
+ Invalid beforeContent, it must be contained by the pane.
+
+
+ Invalid DockState: Content can not be showed as "Unknown" or "Hidden".
+
+
+ The previous pane is invalid. It can not be null, and its docking state must not be auto-hide.
+
+
+ DockPanel can not be null.
+
+
+ The Pane can not be null.
+
+
+ Invalid value, check DockableAreas property.
+
+
+ Context menu displayed for the dock pane tab strip.
+
+
+ Press SHIFT for docking to full side.
+
+
+ Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content.
+
+
+ Invalid argument: Content can not be "null".
+
+
+ Invalid argument: The content's DockPanel can not be "null".
+
+
+ The specified container conflicts with the IsFloat property.
+
+
+ The previous pane does not exist in the nested docking pane collection.
+
+
+ The container can not be null.
+
+
+ The previous pane can not be null when the nested docking pane collection is not empty.
+
+
+ The previous pane can not be itself.
+
+
+ FloatWindow property can not be set to "null" when DockState is DockState.Float.
+
+
+ Invalid Content: Content not within the collection.
+
+
+ Invalid Index: The index is out of range.
+
+
+ The state for the dock pane is invalid.
+
+
+ Auto Hide
+
+
+ Close
+
+
+ Options
+
+
+ Invalid Content: The content must be auto-hide state and associates with this DockPanel.
+
+
+ Occurs when the value of ActiveContentProperty changed.
+
+
+ Occurs when the value of ActiveDocument property changed.
+
+
+ Occurs when the value of ActivePane property changed.
+
+
+ Determines if the drag and drop docking is allowed.
+
+
+ Determines if the drag and drop nested docking is allowed.
+
+
+ Occurs when a content added to the DockPanel.
+
+
+ Occurs when a content removed from the DockPanel.
+
+
+ The default size of float window.
+
+
+ Provides Visual Studio .Net style docking.
+
+
+ Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
+
+
+ Size of the left docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
+
+
+ Size of the right docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
+
+
+ Size of the top docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.
+
+
+ The style of the document window.
+
+
+ The DockPanel has already been initialized.
+
+
+ The configuration file's version is invalid.
+
+
+ The XML file format is invalid.
+
+
+ Invalid parent form. When using DockingMdi or SystemMdi document style, the DockPanel control must be the child control of the main MDI container form.
+
+
+ DockPanel configuration file. Author: Weifen Luo, all rights reserved.
+
+
+ !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!!
+
+
+ Indicates whether the control layout is right-to-left when the RightToLeft property is set to Yes.
+
+
+ Invalid Index: The index is out of range.
+
+
+ Invalid Pane: DockPane not within the collection.
+
+
+ Determines if the document icon will be displayed in the tab strip.
+
+
+ Close
+
+
+ Window List
+
+
+ Invalid argument: DockPanel can not be "null".
+
+
+ Invalid Index: The index is out of range.
+
+
+ Invalid Pane: DockPane not within the collection.
+
+
+ Invalid DockPanel.
+
+
+ Shows or hides the close button of the content. This property does not function with System MDI Document Style.
+
+
+ The visual skin to use when displaying the docked windows.
+
+
+ Determines where the tab strip for Document style content is drawn.
+
\ No newline at end of file
diff --git a/trunk/Docking/VS2005AutoHideStrip.cs b/source/Docking/VS2005AutoHideStrip.cs
similarity index 96%
rename from trunk/Docking/VS2005AutoHideStrip.cs
rename to source/Docking/VS2005AutoHideStrip.cs
index 1a78052..4f0afce 100644
--- a/trunk/Docking/VS2005AutoHideStrip.cs
+++ b/source/Docking/VS2005AutoHideStrip.cs
@@ -1,505 +1,505 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-using System.Drawing.Drawing2D;
-using System.ComponentModel;
-
-namespace LSLEditor.Docking
-{
- internal class VS2005AutoHideStrip : AutoHideStripBase
- {
- private class TabVS2005 : Tab
- {
- internal TabVS2005(IDockContent content)
- : base(content)
- {
- }
-
- private int m_tabX = 0;
- public int TabX
- {
- get { return m_tabX; }
- set { m_tabX = value; }
- }
-
- private int m_tabWidth = 0;
- public int TabWidth
- {
- get { return m_tabWidth; }
- set { m_tabWidth = value; }
- }
-
- }
-
- private const int _ImageHeight = 16;
- private const int _ImageWidth = 16;
- private const int _ImageGapTop = 2;
- private const int _ImageGapLeft = 4;
- private const int _ImageGapRight = 2;
- private const int _ImageGapBottom = 2;
- private const int _TextGapLeft = 0;
- private const int _TextGapRight = 0;
- private const int _TabGapTop = 3;
- private const int _TabGapLeft = 4;
- private const int _TabGapBetween = 10;
-
- #region Customizable Properties
- private static Font TextFont
- {
- get { return SystemInformation.MenuFont; }
- }
-
- private static StringFormat _stringFormatTabHorizontal;
- private StringFormat StringFormatTabHorizontal
- {
- get
- {
- if (_stringFormatTabHorizontal == null)
- {
- _stringFormatTabHorizontal = new StringFormat();
- _stringFormatTabHorizontal.Alignment = StringAlignment.Near;
- _stringFormatTabHorizontal.LineAlignment = StringAlignment.Center;
- _stringFormatTabHorizontal.FormatFlags = StringFormatFlags.NoWrap;
- _stringFormatTabHorizontal.Trimming = StringTrimming.None;
- }
-
- if (RightToLeft == RightToLeft.Yes)
- _stringFormatTabHorizontal.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
- else
- _stringFormatTabHorizontal.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft;
-
- return _stringFormatTabHorizontal;
- }
- }
-
- private static StringFormat _stringFormatTabVertical;
- private StringFormat StringFormatTabVertical
- {
- get
- {
- if (_stringFormatTabVertical == null)
- {
- _stringFormatTabVertical = new StringFormat();
- _stringFormatTabVertical.Alignment = StringAlignment.Near;
- _stringFormatTabVertical.LineAlignment = StringAlignment.Center;
- _stringFormatTabVertical.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical;
- _stringFormatTabVertical.Trimming = StringTrimming.None;
- }
- if (RightToLeft == RightToLeft.Yes)
- _stringFormatTabVertical.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
- else
- _stringFormatTabVertical.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft;
-
- return _stringFormatTabVertical;
- }
- }
-
- private static int ImageHeight
- {
- get { return _ImageHeight; }
- }
-
- private static int ImageWidth
- {
- get { return _ImageWidth; }
- }
-
- private static int ImageGapTop
- {
- get { return _ImageGapTop; }
- }
-
- private static int ImageGapLeft
- {
- get { return _ImageGapLeft; }
- }
-
- private static int ImageGapRight
- {
- get { return _ImageGapRight; }
- }
-
- private static int ImageGapBottom
- {
- get { return _ImageGapBottom; }
- }
-
- private static int TextGapLeft
- {
- get { return _TextGapLeft; }
- }
-
- private static int TextGapRight
- {
- get { return _TextGapRight; }
- }
-
- private static int TabGapTop
- {
- get { return _TabGapTop; }
- }
-
- private static int TabGapLeft
- {
- get { return _TabGapLeft; }
- }
-
- private static int TabGapBetween
- {
- get { return _TabGapBetween; }
- }
-
- private static Pen PenTabBorder
- {
- get { return SystemPens.GrayText; }
- }
- #endregion
-
- private static Matrix _matrixIdentity = new Matrix();
- private static Matrix MatrixIdentity
- {
- get { return _matrixIdentity; }
- }
-
- private static DockState[] _dockStates;
- private static DockState[] DockStates
- {
- get
- {
- if (_dockStates == null)
- {
- _dockStates = new DockState[4];
- _dockStates[0] = DockState.DockLeftAutoHide;
- _dockStates[1] = DockState.DockRightAutoHide;
- _dockStates[2] = DockState.DockTopAutoHide;
- _dockStates[3] = DockState.DockBottomAutoHide;
- }
- return _dockStates;
- }
- }
-
- private static GraphicsPath _graphicsPath;
- internal static GraphicsPath GraphicsPath
- {
- get
- {
- if (_graphicsPath == null)
- _graphicsPath = new GraphicsPath();
-
- return _graphicsPath;
- }
- }
-
- public VS2005AutoHideStrip(DockPanel panel) : base(panel)
- {
- SetStyle(ControlStyles.ResizeRedraw |
- ControlStyles.UserPaint |
- ControlStyles.AllPaintingInWmPaint |
- ControlStyles.OptimizedDoubleBuffer, true);
- BackColor = SystemColors.ControlLight;
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- Graphics g = e.Graphics;
-
- Color startColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.StartColor;
- Color endColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.EndColor;
- LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.LinearGradientMode;
- using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
- {
- g.FillRectangle(brush, ClientRectangle);
- }
-
- DrawTabStrip(g);
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- CalculateTabs();
- base.OnLayout (levent);
- }
-
- private void DrawTabStrip(Graphics g)
- {
- DrawTabStrip(g, DockState.DockTopAutoHide);
- DrawTabStrip(g, DockState.DockBottomAutoHide);
- DrawTabStrip(g, DockState.DockLeftAutoHide);
- DrawTabStrip(g, DockState.DockRightAutoHide);
- }
-
- private void DrawTabStrip(Graphics g, DockState dockState)
- {
- Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
-
- if (rectTabStrip.IsEmpty)
- return;
-
- Matrix matrixIdentity = g.Transform;
- if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
- {
- Matrix matrixRotated = new Matrix();
- matrixRotated.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2,
- (float)rectTabStrip.Y + (float)rectTabStrip.Height / 2));
- g.Transform = matrixRotated;
- }
-
- foreach (Pane pane in GetPanes(dockState))
- {
- foreach (TabVS2005 tab in pane.AutoHideTabs)
- DrawTab(g, tab);
- }
- g.Transform = matrixIdentity;
- }
-
- private void CalculateTabs()
- {
- CalculateTabs(DockState.DockTopAutoHide);
- CalculateTabs(DockState.DockBottomAutoHide);
- CalculateTabs(DockState.DockLeftAutoHide);
- CalculateTabs(DockState.DockRightAutoHide);
- }
-
- private void CalculateTabs(DockState dockState)
- {
- Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
-
- int imageHeight = rectTabStrip.Height - ImageGapTop - ImageGapBottom;
- int imageWidth = ImageWidth;
- if (imageHeight > ImageHeight)
- imageWidth = ImageWidth * (imageHeight / ImageHeight);
-
- int x = TabGapLeft + rectTabStrip.X;
- foreach (Pane pane in GetPanes(dockState))
- {
- foreach (TabVS2005 tab in pane.AutoHideTabs)
- {
- int width = imageWidth + ImageGapLeft + ImageGapRight +
- TextRenderer.MeasureText(tab.Content.DockHandler.TabText, TextFont).Width +
- TextGapLeft + TextGapRight;
- tab.TabX = x;
- tab.TabWidth = width;
- x += width;
- }
-
- x += TabGapBetween;
- }
- }
-
- private Rectangle RtlTransform(Rectangle rect, DockState dockState)
- {
- Rectangle rectTransformed;
- if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
- rectTransformed = rect;
- else
- rectTransformed = DrawHelper.RtlTransform(this, rect);
-
- return rectTransformed;
- }
-
- private GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform)
- {
- DockState dockState = tab.Content.DockHandler.DockState;
- Rectangle rectTab = GetTabRectangle(tab, transformed);
- if (rtlTransform)
- rectTab = RtlTransform(rectTab, dockState);
- bool upTab = (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide);
- DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab);
-
- return GraphicsPath;
- }
-
- private void DrawTab(Graphics g, TabVS2005 tab)
- {
- Rectangle rectTabOrigin = GetTabRectangle(tab);
- if (rectTabOrigin.IsEmpty)
- return;
-
- DockState dockState = tab.Content.DockHandler.DockState;
- IDockContent content = tab.Content;
-
- GraphicsPath path = GetTabOutline(tab, false, true);
-
- Color startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor;
- Color endColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor;
- LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode;
- g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path);
- g.DrawPath(PenTabBorder, path);
-
- // Set no rotate for drawing icon and text
- Matrix matrixRotate = g.Transform;
- g.Transform = MatrixIdentity;
-
- // Draw the icon
- Rectangle rectImage = rectTabOrigin;
- rectImage.X += ImageGapLeft;
- rectImage.Y += ImageGapTop;
- int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
- int imageWidth = ImageWidth;
- if (imageHeight > ImageHeight)
- imageWidth = ImageWidth * (imageHeight/ImageHeight);
- rectImage.Height = imageHeight;
- rectImage.Width = imageWidth;
- rectImage = GetTransformedRectangle(dockState, rectImage);
- g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
-
- // Draw the text
- Rectangle rectText = rectTabOrigin;
- rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
- rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
- rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
-
- Color textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor;
-
- if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
- g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical);
- else
- g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal);
-
- // Set rotate back
- g.Transform = matrixRotate;
- }
-
- private Rectangle GetLogicalTabStripRectangle(DockState dockState)
- {
- return GetLogicalTabStripRectangle(dockState, false);
- }
-
- private Rectangle GetLogicalTabStripRectangle(DockState dockState, bool transformed)
- {
- if (!DockHelper.IsDockStateAutoHide(dockState))
- return Rectangle.Empty;
-
- int leftPanes = GetPanes(DockState.DockLeftAutoHide).Count;
- int rightPanes = GetPanes(DockState.DockRightAutoHide).Count;
- int topPanes = GetPanes(DockState.DockTopAutoHide).Count;
- int bottomPanes = GetPanes(DockState.DockBottomAutoHide).Count;
-
- int x, y, width, height;
-
- height = MeasureHeight();
- if (dockState == DockState.DockLeftAutoHide && leftPanes > 0)
- {
- x = 0;
- y = (topPanes == 0) ? 0 : height;
- width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 :height);
- }
- else if (dockState == DockState.DockRightAutoHide && rightPanes > 0)
- {
- x = Width - height;
- if (leftPanes != 0 && x < height)
- x = height;
- y = (topPanes == 0) ? 0 : height;
- width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 :height);
- }
- else if (dockState == DockState.DockTopAutoHide && topPanes > 0)
- {
- x = leftPanes == 0 ? 0 : height;
- y = 0;
- width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height);
- }
- else if (dockState == DockState.DockBottomAutoHide && bottomPanes > 0)
- {
- x = leftPanes == 0 ? 0 : height;
- y = Height - height;
- if (topPanes != 0 && y < height)
- y = height;
- width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height);
- }
- else
- return Rectangle.Empty;
-
- if (!transformed)
- return new Rectangle(x, y, width, height);
- else
- return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height));
- }
-
- private Rectangle GetTabRectangle(TabVS2005 tab)
- {
- return GetTabRectangle(tab, false);
- }
-
- private Rectangle GetTabRectangle(TabVS2005 tab, bool transformed)
- {
- DockState dockState = tab.Content.DockHandler.DockState;
- Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
-
- if (rectTabStrip.IsEmpty)
- return Rectangle.Empty;
-
- int x = tab.TabX;
- int y = rectTabStrip.Y +
- (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ?
- 0 : TabGapTop);
- int width = tab.TabWidth;
- int height = rectTabStrip.Height - TabGapTop;
-
- if (!transformed)
- return new Rectangle(x, y, width, height);
- else
- return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height));
- }
-
- private Rectangle GetTransformedRectangle(DockState dockState, Rectangle rect)
- {
- if (dockState != DockState.DockLeftAutoHide && dockState != DockState.DockRightAutoHide)
- return rect;
-
- PointF[] pts = new PointF[1];
- // the center of the rectangle
- pts[0].X = (float)rect.X + (float)rect.Width / 2;
- pts[0].Y = (float)rect.Y + (float)rect.Height / 2;
- Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
- Matrix matrix = new Matrix();
- matrix.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2,
- (float)rectTabStrip.Y + (float)rectTabStrip.Height / 2));
- matrix.TransformPoints(pts);
-
- return new Rectangle((int)(pts[0].X - (float)rect.Height / 2 + .5F),
- (int)(pts[0].Y - (float)rect.Width / 2 + .5F),
- rect.Height, rect.Width);
- }
-
- protected override IDockContent HitTest(Point ptMouse)
- {
- foreach(DockState state in DockStates)
- {
- Rectangle rectTabStrip = GetLogicalTabStripRectangle(state, true);
- if (!rectTabStrip.Contains(ptMouse))
- continue;
-
- foreach(Pane pane in GetPanes(state))
- {
- DockState dockState = pane.DockPane.DockState;
- foreach(TabVS2005 tab in pane.AutoHideTabs)
- {
- GraphicsPath path = GetTabOutline(tab, true, true);
- if (path.IsVisible(ptMouse))
- return tab.Content;
- }
- }
- }
-
- return null;
- }
-
- protected internal override int MeasureHeight()
- {
- return Math.Max(ImageGapBottom +
- ImageGapTop + ImageHeight,
- TextFont.Height) + TabGapTop;
- }
-
- protected override void OnRefreshChanges()
- {
- CalculateTabs();
- Invalidate();
- }
-
- protected override AutoHideStripBase.Tab CreateTab(IDockContent content)
- {
- return new TabVS2005(content);
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Drawing.Drawing2D;
+using System.ComponentModel;
+
+namespace LSLEditor.Docking
+{
+ internal class VS2005AutoHideStrip : AutoHideStripBase
+ {
+ private class TabVS2005 : Tab
+ {
+ internal TabVS2005(IDockContent content)
+ : base(content)
+ {
+ }
+
+ private int m_tabX = 0;
+ public int TabX
+ {
+ get { return m_tabX; }
+ set { m_tabX = value; }
+ }
+
+ private int m_tabWidth = 0;
+ public int TabWidth
+ {
+ get { return m_tabWidth; }
+ set { m_tabWidth = value; }
+ }
+
+ }
+
+ private const int _ImageHeight = 16;
+ private const int _ImageWidth = 16;
+ private const int _ImageGapTop = 2;
+ private const int _ImageGapLeft = 4;
+ private const int _ImageGapRight = 2;
+ private const int _ImageGapBottom = 2;
+ private const int _TextGapLeft = 0;
+ private const int _TextGapRight = 0;
+ private const int _TabGapTop = 3;
+ private const int _TabGapLeft = 4;
+ private const int _TabGapBetween = 10;
+
+ #region Customizable Properties
+ private static Font TextFont
+ {
+ get { return SystemInformation.MenuFont; }
+ }
+
+ private static StringFormat _stringFormatTabHorizontal;
+ private StringFormat StringFormatTabHorizontal
+ {
+ get
+ {
+ if (_stringFormatTabHorizontal == null)
+ {
+ _stringFormatTabHorizontal = new StringFormat();
+ _stringFormatTabHorizontal.Alignment = StringAlignment.Near;
+ _stringFormatTabHorizontal.LineAlignment = StringAlignment.Center;
+ _stringFormatTabHorizontal.FormatFlags = StringFormatFlags.NoWrap;
+ _stringFormatTabHorizontal.Trimming = StringTrimming.None;
+ }
+
+ if (RightToLeft == RightToLeft.Yes)
+ _stringFormatTabHorizontal.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
+ else
+ _stringFormatTabHorizontal.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft;
+
+ return _stringFormatTabHorizontal;
+ }
+ }
+
+ private static StringFormat _stringFormatTabVertical;
+ private StringFormat StringFormatTabVertical
+ {
+ get
+ {
+ if (_stringFormatTabVertical == null)
+ {
+ _stringFormatTabVertical = new StringFormat();
+ _stringFormatTabVertical.Alignment = StringAlignment.Near;
+ _stringFormatTabVertical.LineAlignment = StringAlignment.Center;
+ _stringFormatTabVertical.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical;
+ _stringFormatTabVertical.Trimming = StringTrimming.None;
+ }
+ if (RightToLeft == RightToLeft.Yes)
+ _stringFormatTabVertical.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
+ else
+ _stringFormatTabVertical.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft;
+
+ return _stringFormatTabVertical;
+ }
+ }
+
+ private static int ImageHeight
+ {
+ get { return _ImageHeight; }
+ }
+
+ private static int ImageWidth
+ {
+ get { return _ImageWidth; }
+ }
+
+ private static int ImageGapTop
+ {
+ get { return _ImageGapTop; }
+ }
+
+ private static int ImageGapLeft
+ {
+ get { return _ImageGapLeft; }
+ }
+
+ private static int ImageGapRight
+ {
+ get { return _ImageGapRight; }
+ }
+
+ private static int ImageGapBottom
+ {
+ get { return _ImageGapBottom; }
+ }
+
+ private static int TextGapLeft
+ {
+ get { return _TextGapLeft; }
+ }
+
+ private static int TextGapRight
+ {
+ get { return _TextGapRight; }
+ }
+
+ private static int TabGapTop
+ {
+ get { return _TabGapTop; }
+ }
+
+ private static int TabGapLeft
+ {
+ get { return _TabGapLeft; }
+ }
+
+ private static int TabGapBetween
+ {
+ get { return _TabGapBetween; }
+ }
+
+ private static Pen PenTabBorder
+ {
+ get { return SystemPens.GrayText; }
+ }
+ #endregion
+
+ private static Matrix _matrixIdentity = new Matrix();
+ private static Matrix MatrixIdentity
+ {
+ get { return _matrixIdentity; }
+ }
+
+ private static DockState[] _dockStates;
+ private static DockState[] DockStates
+ {
+ get
+ {
+ if (_dockStates == null)
+ {
+ _dockStates = new DockState[4];
+ _dockStates[0] = DockState.DockLeftAutoHide;
+ _dockStates[1] = DockState.DockRightAutoHide;
+ _dockStates[2] = DockState.DockTopAutoHide;
+ _dockStates[3] = DockState.DockBottomAutoHide;
+ }
+ return _dockStates;
+ }
+ }
+
+ private static GraphicsPath _graphicsPath;
+ internal static GraphicsPath GraphicsPath
+ {
+ get
+ {
+ if (_graphicsPath == null)
+ _graphicsPath = new GraphicsPath();
+
+ return _graphicsPath;
+ }
+ }
+
+ public VS2005AutoHideStrip(DockPanel panel) : base(panel)
+ {
+ SetStyle(ControlStyles.ResizeRedraw |
+ ControlStyles.UserPaint |
+ ControlStyles.AllPaintingInWmPaint |
+ ControlStyles.OptimizedDoubleBuffer, true);
+ BackColor = SystemColors.ControlLight;
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ Graphics g = e.Graphics;
+
+ Color startColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.StartColor;
+ Color endColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.EndColor;
+ LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.LinearGradientMode;
+ using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
+ {
+ g.FillRectangle(brush, ClientRectangle);
+ }
+
+ DrawTabStrip(g);
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ CalculateTabs();
+ base.OnLayout (levent);
+ }
+
+ private void DrawTabStrip(Graphics g)
+ {
+ DrawTabStrip(g, DockState.DockTopAutoHide);
+ DrawTabStrip(g, DockState.DockBottomAutoHide);
+ DrawTabStrip(g, DockState.DockLeftAutoHide);
+ DrawTabStrip(g, DockState.DockRightAutoHide);
+ }
+
+ private void DrawTabStrip(Graphics g, DockState dockState)
+ {
+ Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
+
+ if (rectTabStrip.IsEmpty)
+ return;
+
+ Matrix matrixIdentity = g.Transform;
+ if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
+ {
+ Matrix matrixRotated = new Matrix();
+ matrixRotated.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2,
+ (float)rectTabStrip.Y + (float)rectTabStrip.Height / 2));
+ g.Transform = matrixRotated;
+ }
+
+ foreach (Pane pane in GetPanes(dockState))
+ {
+ foreach (TabVS2005 tab in pane.AutoHideTabs)
+ DrawTab(g, tab);
+ }
+ g.Transform = matrixIdentity;
+ }
+
+ private void CalculateTabs()
+ {
+ CalculateTabs(DockState.DockTopAutoHide);
+ CalculateTabs(DockState.DockBottomAutoHide);
+ CalculateTabs(DockState.DockLeftAutoHide);
+ CalculateTabs(DockState.DockRightAutoHide);
+ }
+
+ private void CalculateTabs(DockState dockState)
+ {
+ Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
+
+ int imageHeight = rectTabStrip.Height - ImageGapTop - ImageGapBottom;
+ int imageWidth = ImageWidth;
+ if (imageHeight > ImageHeight)
+ imageWidth = ImageWidth * (imageHeight / ImageHeight);
+
+ int x = TabGapLeft + rectTabStrip.X;
+ foreach (Pane pane in GetPanes(dockState))
+ {
+ foreach (TabVS2005 tab in pane.AutoHideTabs)
+ {
+ int width = imageWidth + ImageGapLeft + ImageGapRight +
+ TextRenderer.MeasureText(tab.Content.DockHandler.TabText, TextFont).Width +
+ TextGapLeft + TextGapRight;
+ tab.TabX = x;
+ tab.TabWidth = width;
+ x += width;
+ }
+
+ x += TabGapBetween;
+ }
+ }
+
+ private Rectangle RtlTransform(Rectangle rect, DockState dockState)
+ {
+ Rectangle rectTransformed;
+ if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
+ rectTransformed = rect;
+ else
+ rectTransformed = DrawHelper.RtlTransform(this, rect);
+
+ return rectTransformed;
+ }
+
+ private GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform)
+ {
+ DockState dockState = tab.Content.DockHandler.DockState;
+ Rectangle rectTab = GetTabRectangle(tab, transformed);
+ if (rtlTransform)
+ rectTab = RtlTransform(rectTab, dockState);
+ bool upTab = (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide);
+ DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab);
+
+ return GraphicsPath;
+ }
+
+ private void DrawTab(Graphics g, TabVS2005 tab)
+ {
+ Rectangle rectTabOrigin = GetTabRectangle(tab);
+ if (rectTabOrigin.IsEmpty)
+ return;
+
+ DockState dockState = tab.Content.DockHandler.DockState;
+ IDockContent content = tab.Content;
+
+ GraphicsPath path = GetTabOutline(tab, false, true);
+
+ Color startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor;
+ Color endColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor;
+ LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode;
+ g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path);
+ g.DrawPath(PenTabBorder, path);
+
+ // Set no rotate for drawing icon and text
+ Matrix matrixRotate = g.Transform;
+ g.Transform = MatrixIdentity;
+
+ // Draw the icon
+ Rectangle rectImage = rectTabOrigin;
+ rectImage.X += ImageGapLeft;
+ rectImage.Y += ImageGapTop;
+ int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom;
+ int imageWidth = ImageWidth;
+ if (imageHeight > ImageHeight)
+ imageWidth = ImageWidth * (imageHeight/ImageHeight);
+ rectImage.Height = imageHeight;
+ rectImage.Width = imageWidth;
+ rectImage = GetTransformedRectangle(dockState, rectImage);
+ g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState));
+
+ // Draw the text
+ Rectangle rectText = rectTabOrigin;
+ rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
+ rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
+ rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
+
+ Color textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor;
+
+ if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
+ g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical);
+ else
+ g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal);
+
+ // Set rotate back
+ g.Transform = matrixRotate;
+ }
+
+ private Rectangle GetLogicalTabStripRectangle(DockState dockState)
+ {
+ return GetLogicalTabStripRectangle(dockState, false);
+ }
+
+ private Rectangle GetLogicalTabStripRectangle(DockState dockState, bool transformed)
+ {
+ if (!DockHelper.IsDockStateAutoHide(dockState))
+ return Rectangle.Empty;
+
+ int leftPanes = GetPanes(DockState.DockLeftAutoHide).Count;
+ int rightPanes = GetPanes(DockState.DockRightAutoHide).Count;
+ int topPanes = GetPanes(DockState.DockTopAutoHide).Count;
+ int bottomPanes = GetPanes(DockState.DockBottomAutoHide).Count;
+
+ int x, y, width, height;
+
+ height = MeasureHeight();
+ if (dockState == DockState.DockLeftAutoHide && leftPanes > 0)
+ {
+ x = 0;
+ y = (topPanes == 0) ? 0 : height;
+ width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 :height);
+ }
+ else if (dockState == DockState.DockRightAutoHide && rightPanes > 0)
+ {
+ x = Width - height;
+ if (leftPanes != 0 && x < height)
+ x = height;
+ y = (topPanes == 0) ? 0 : height;
+ width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 :height);
+ }
+ else if (dockState == DockState.DockTopAutoHide && topPanes > 0)
+ {
+ x = leftPanes == 0 ? 0 : height;
+ y = 0;
+ width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height);
+ }
+ else if (dockState == DockState.DockBottomAutoHide && bottomPanes > 0)
+ {
+ x = leftPanes == 0 ? 0 : height;
+ y = Height - height;
+ if (topPanes != 0 && y < height)
+ y = height;
+ width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height);
+ }
+ else
+ return Rectangle.Empty;
+
+ if (!transformed)
+ return new Rectangle(x, y, width, height);
+ else
+ return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height));
+ }
+
+ private Rectangle GetTabRectangle(TabVS2005 tab)
+ {
+ return GetTabRectangle(tab, false);
+ }
+
+ private Rectangle GetTabRectangle(TabVS2005 tab, bool transformed)
+ {
+ DockState dockState = tab.Content.DockHandler.DockState;
+ Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
+
+ if (rectTabStrip.IsEmpty)
+ return Rectangle.Empty;
+
+ int x = tab.TabX;
+ int y = rectTabStrip.Y +
+ (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ?
+ 0 : TabGapTop);
+ int width = tab.TabWidth;
+ int height = rectTabStrip.Height - TabGapTop;
+
+ if (!transformed)
+ return new Rectangle(x, y, width, height);
+ else
+ return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height));
+ }
+
+ private Rectangle GetTransformedRectangle(DockState dockState, Rectangle rect)
+ {
+ if (dockState != DockState.DockLeftAutoHide && dockState != DockState.DockRightAutoHide)
+ return rect;
+
+ PointF[] pts = new PointF[1];
+ // the center of the rectangle
+ pts[0].X = (float)rect.X + (float)rect.Width / 2;
+ pts[0].Y = (float)rect.Y + (float)rect.Height / 2;
+ Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);
+ Matrix matrix = new Matrix();
+ matrix.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2,
+ (float)rectTabStrip.Y + (float)rectTabStrip.Height / 2));
+ matrix.TransformPoints(pts);
+
+ return new Rectangle((int)(pts[0].X - (float)rect.Height / 2 + .5F),
+ (int)(pts[0].Y - (float)rect.Width / 2 + .5F),
+ rect.Height, rect.Width);
+ }
+
+ protected override IDockContent HitTest(Point ptMouse)
+ {
+ foreach(DockState state in DockStates)
+ {
+ Rectangle rectTabStrip = GetLogicalTabStripRectangle(state, true);
+ if (!rectTabStrip.Contains(ptMouse))
+ continue;
+
+ foreach(Pane pane in GetPanes(state))
+ {
+ DockState dockState = pane.DockPane.DockState;
+ foreach(TabVS2005 tab in pane.AutoHideTabs)
+ {
+ GraphicsPath path = GetTabOutline(tab, true, true);
+ if (path.IsVisible(ptMouse))
+ return tab.Content;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected internal override int MeasureHeight()
+ {
+ return Math.Max(ImageGapBottom +
+ ImageGapTop + ImageHeight,
+ TextFont.Height) + TabGapTop;
+ }
+
+ protected override void OnRefreshChanges()
+ {
+ CalculateTabs();
+ Invalidate();
+ }
+
+ protected override AutoHideStripBase.Tab CreateTab(IDockContent content)
+ {
+ return new TabVS2005(content);
+ }
+ }
+}
diff --git a/trunk/Docking/VS2005DockPaneCaption.cs b/source/Docking/VS2005DockPaneCaption.cs
similarity index 96%
rename from trunk/Docking/VS2005DockPaneCaption.cs
rename to source/Docking/VS2005DockPaneCaption.cs
index 1a738e5..7626bd6 100644
--- a/trunk/Docking/VS2005DockPaneCaption.cs
+++ b/source/Docking/VS2005DockPaneCaption.cs
@@ -1,478 +1,478 @@
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Windows.Forms.VisualStyles;
-
-namespace LSLEditor.Docking
-{
- internal class VS2005DockPaneCaption : DockPaneCaptionBase
- {
- private sealed class InertButton : InertButtonBase
- {
- private Bitmap m_image, m_imageAutoHide;
-
- public InertButton(VS2005DockPaneCaption dockPaneCaption, Bitmap image, Bitmap imageAutoHide)
- : base()
- {
- m_dockPaneCaption = dockPaneCaption;
- m_image = image;
- m_imageAutoHide = imageAutoHide;
- RefreshChanges();
- }
-
- private VS2005DockPaneCaption m_dockPaneCaption;
- private VS2005DockPaneCaption DockPaneCaption
- {
- get { return m_dockPaneCaption; }
- }
-
- public bool IsAutoHide
- {
- get { return DockPaneCaption.DockPane.IsAutoHide; }
- }
-
- public override Bitmap Image
- {
- get { return IsAutoHide ? m_imageAutoHide : m_image; }
- }
-
- protected override void OnRefreshChanges()
- {
- if (DockPaneCaption.DockPane.DockPanel != null)
- {
- if (DockPaneCaption.TextColor != ForeColor)
- {
- ForeColor = DockPaneCaption.TextColor;
- Invalidate();
- }
- }
- }
- }
-
- #region consts
- private const int _TextGapTop = 2;
- private const int _TextGapBottom = 0;
- private const int _TextGapLeft = 3;
- private const int _TextGapRight = 3;
- private const int _ButtonGapTop = 2;
- private const int _ButtonGapBottom = 1;
- private const int _ButtonGapBetween = 1;
- private const int _ButtonGapLeft = 1;
- private const int _ButtonGapRight = 2;
- #endregion
-
- private static Bitmap _imageButtonClose;
- private static Bitmap ImageButtonClose
- {
- get
- {
- if (_imageButtonClose == null)
- _imageButtonClose = Resources.DockPane_Close;
-
- return _imageButtonClose;
- }
- }
-
- private InertButton m_buttonClose;
- private InertButton ButtonClose
- {
- get
- {
- if (m_buttonClose == null)
- {
- m_buttonClose = new InertButton(this, ImageButtonClose, ImageButtonClose);
- m_toolTip.SetToolTip(m_buttonClose, ToolTipClose);
- m_buttonClose.Click += new EventHandler(Close_Click);
- Controls.Add(m_buttonClose);
- }
-
- return m_buttonClose;
- }
- }
-
- private static Bitmap _imageButtonAutoHide;
- private static Bitmap ImageButtonAutoHide
- {
- get
- {
- if (_imageButtonAutoHide == null)
- _imageButtonAutoHide = Resources.DockPane_AutoHide;
-
- return _imageButtonAutoHide;
- }
- }
-
- private static Bitmap _imageButtonDock;
- private static Bitmap ImageButtonDock
- {
- get
- {
- if (_imageButtonDock == null)
- _imageButtonDock = Resources.DockPane_Dock;
-
- return _imageButtonDock;
- }
- }
-
- private InertButton m_buttonAutoHide;
- private InertButton ButtonAutoHide
- {
- get
- {
- if (m_buttonAutoHide == null)
- {
- m_buttonAutoHide = new InertButton(this, ImageButtonDock, ImageButtonAutoHide);
- m_toolTip.SetToolTip(m_buttonAutoHide, ToolTipAutoHide);
- m_buttonAutoHide.Click += new EventHandler(AutoHide_Click);
- Controls.Add(m_buttonAutoHide);
- }
-
- return m_buttonAutoHide;
- }
- }
-
- private static Bitmap _imageButtonOptions;
- private static Bitmap ImageButtonOptions
- {
- get
- {
- if (_imageButtonOptions == null)
- _imageButtonOptions = Resources.DockPane_Option;
-
- return _imageButtonOptions;
- }
- }
-
- private InertButton m_buttonOptions;
- private InertButton ButtonOptions
- {
- get
- {
- if (m_buttonOptions == null)
- {
- m_buttonOptions = new InertButton(this, ImageButtonOptions, ImageButtonOptions);
- m_toolTip.SetToolTip(m_buttonOptions, ToolTipOptions);
- m_buttonOptions.Click += new EventHandler(Options_Click);
- Controls.Add(m_buttonOptions);
- }
- return m_buttonOptions;
- }
- }
-
- private IContainer m_components;
- private IContainer Components
- {
- get { return m_components; }
- }
-
- private ToolTip m_toolTip;
-
- public VS2005DockPaneCaption(DockPane pane) : base(pane)
- {
- SuspendLayout();
-
- m_components = new Container();
- m_toolTip = new ToolTip(Components);
-
- ResumeLayout();
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- Components.Dispose();
- base.Dispose(disposing);
- }
-
- private static int TextGapTop
- {
- get { return _TextGapTop; }
- }
-
- private static Font TextFont
- {
- get { return SystemInformation.MenuFont; }
- }
-
- private static int TextGapBottom
- {
- get { return _TextGapBottom; }
- }
-
- private static int TextGapLeft
- {
- get { return _TextGapLeft; }
- }
-
- private static int TextGapRight
- {
- get { return _TextGapRight; }
- }
-
- private static int ButtonGapTop
- {
- get { return _ButtonGapTop; }
- }
-
- private static int ButtonGapBottom
- {
- get { return _ButtonGapBottom; }
- }
-
- private static int ButtonGapLeft
- {
- get { return _ButtonGapLeft; }
- }
-
- private static int ButtonGapRight
- {
- get { return _ButtonGapRight; }
- }
-
- private static int ButtonGapBetween
- {
- get { return _ButtonGapBetween; }
- }
-
- private static string _toolTipClose;
- private static string ToolTipClose
- {
- get
- {
- if (_toolTipClose == null)
- _toolTipClose = Strings.DockPaneCaption_ToolTipClose;
- return _toolTipClose;
- }
- }
-
- private static string _toolTipOptions;
- private static string ToolTipOptions
- {
- get
- {
- if (_toolTipOptions == null)
- _toolTipOptions = Strings.DockPaneCaption_ToolTipOptions;
-
- return _toolTipOptions;
- }
- }
-
- private static string _toolTipAutoHide;
- private static string ToolTipAutoHide
- {
- get
- {
- if (_toolTipAutoHide == null)
- _toolTipAutoHide = Strings.DockPaneCaption_ToolTipAutoHide;
- return _toolTipAutoHide;
- }
- }
-
- private static Blend _activeBackColorGradientBlend;
- private static Blend ActiveBackColorGradientBlend
- {
- get
- {
- if (_activeBackColorGradientBlend == null)
- {
- Blend blend = new Blend(2);
-
- blend.Factors = new float[]{0.5F, 1.0F};
- blend.Positions = new float[]{0.0F, 1.0F};
- _activeBackColorGradientBlend = blend;
- }
-
- return _activeBackColorGradientBlend;
- }
- }
-
- private Color TextColor
- {
- get
- {
- if (DockPane.IsActivated)
- return DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor;
- else
- return DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor;
- }
- }
-
- private static TextFormatFlags _textFormat =
- TextFormatFlags.SingleLine |
- TextFormatFlags.EndEllipsis |
- TextFormatFlags.VerticalCenter;
- private TextFormatFlags TextFormat
- {
- get
- {
- if (RightToLeft == RightToLeft.No)
- return _textFormat;
- else
- return _textFormat | TextFormatFlags.RightToLeft | TextFormatFlags.Right;
- }
- }
-
- protected internal override int MeasureHeight()
- {
- int height = TextFont.Height + TextGapTop + TextGapBottom;
-
- if (height < ButtonClose.Image.Height + ButtonGapTop + ButtonGapBottom)
- height = ButtonClose.Image.Height + ButtonGapTop + ButtonGapBottom;
-
- return height;
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint (e);
- DrawCaption(e.Graphics);
- }
-
- private void DrawCaption(Graphics g)
- {
- if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
- return;
-
- if (DockPane.IsActivated)
- {
- Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor;
- Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
- LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
- using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
- {
- brush.Blend = ActiveBackColorGradientBlend;
- g.FillRectangle(brush, ClientRectangle);
- }
- }
- else
- {
- Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor;
- Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
- LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode;
- using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
- {
- g.FillRectangle(brush, ClientRectangle);
- }
- }
-
- Rectangle rectCaption = ClientRectangle;
-
- Rectangle rectCaptionText = rectCaption;
- rectCaptionText.X += TextGapLeft;
- rectCaptionText.Width -= TextGapLeft + TextGapRight;
- rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight;
- if (ShouldShowAutoHideButton)
- rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween;
- if (HasTabPageContextMenu)
- rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween;
- rectCaptionText.Y += TextGapTop;
- rectCaptionText.Height -= TextGapTop + TextGapBottom;
-
- Color colorText;
- if (DockPane.IsActivated)
- colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor;
- else
- colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor;
-
- TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat);
- }
-
- protected override void OnLayout(LayoutEventArgs levent)
- {
- SetButtonsPosition();
- base.OnLayout (levent);
- }
-
- protected override void OnRefreshChanges()
- {
- SetButtons();
- Invalidate();
- }
-
- private bool CloseButtonEnabled
- {
- get { return (DockPane.ActiveContent != null)? DockPane.ActiveContent.DockHandler.CloseButton : false; }
- }
-
- ///
- /// Determines whether the close button is visible on the content
- ///
- private bool CloseButtonVisible
- {
- get { return (DockPane.ActiveContent != null) ? DockPane.ActiveContent.DockHandler.CloseButtonVisible : false; }
- }
-
- private bool ShouldShowAutoHideButton
- {
- get { return !DockPane.IsFloat; }
- }
-
- private void SetButtons()
- {
- ButtonClose.Enabled = CloseButtonEnabled;
- ButtonClose.Visible = CloseButtonVisible;
- ButtonAutoHide.Visible = ShouldShowAutoHideButton;
- ButtonOptions.Visible = HasTabPageContextMenu;
- ButtonClose.RefreshChanges();
- ButtonAutoHide.RefreshChanges();
- ButtonOptions.RefreshChanges();
-
- SetButtonsPosition();
- }
-
- private void SetButtonsPosition()
- {
- // set the size and location for close and auto-hide buttons
- Rectangle rectCaption = ClientRectangle;
- int buttonWidth = ButtonClose.Image.Width;
- int buttonHeight = ButtonClose.Image.Height;
- int height = rectCaption.Height - ButtonGapTop - ButtonGapBottom;
- if (buttonHeight < height)
- {
- buttonWidth = buttonWidth * (height / buttonHeight);
- buttonHeight = height;
- }
- Size buttonSize = new Size(buttonWidth, buttonHeight);
- int x = rectCaption.X + rectCaption.Width - 1 - ButtonGapRight - m_buttonClose.Width;
- int y = rectCaption.Y + ButtonGapTop;
- Point point = new Point(x, y);
- ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
-
- // If the close button is not visible draw the auto hide button overtop.
- // Otherwise it is drawn to the left of the close button.
- if (CloseButtonVisible)
- point.Offset(-(buttonWidth + ButtonGapBetween), 0);
-
- ButtonAutoHide.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
- if (ShouldShowAutoHideButton)
- point.Offset(-(buttonWidth + ButtonGapBetween), 0);
- ButtonOptions.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
- }
-
- private void Close_Click(object sender, EventArgs e)
- {
- DockPane.CloseActiveContent();
- }
-
- private void AutoHide_Click(object sender, EventArgs e)
- {
- DockPane.DockState = DockHelper.ToggleAutoHideState(DockPane.DockState);
- if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
- DockPane.DockPanel.ActiveAutoHideContent = null;
-
- }
-
- private void Options_Click(object sender, EventArgs e)
- {
- ShowTabPageContextMenu(PointToClient(Control.MousePosition));
- }
-
- protected override void OnRightToLeftChanged(EventArgs e)
- {
- base.OnRightToLeftChanged(e);
- PerformLayout();
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Windows.Forms.VisualStyles;
+
+namespace LSLEditor.Docking
+{
+ internal class VS2005DockPaneCaption : DockPaneCaptionBase
+ {
+ private sealed class InertButton : InertButtonBase
+ {
+ private Bitmap m_image, m_imageAutoHide;
+
+ public InertButton(VS2005DockPaneCaption dockPaneCaption, Bitmap image, Bitmap imageAutoHide)
+ : base()
+ {
+ m_dockPaneCaption = dockPaneCaption;
+ m_image = image;
+ m_imageAutoHide = imageAutoHide;
+ RefreshChanges();
+ }
+
+ private VS2005DockPaneCaption m_dockPaneCaption;
+ private VS2005DockPaneCaption DockPaneCaption
+ {
+ get { return m_dockPaneCaption; }
+ }
+
+ public bool IsAutoHide
+ {
+ get { return DockPaneCaption.DockPane.IsAutoHide; }
+ }
+
+ public override Bitmap Image
+ {
+ get { return IsAutoHide ? m_imageAutoHide : m_image; }
+ }
+
+ protected override void OnRefreshChanges()
+ {
+ if (DockPaneCaption.DockPane.DockPanel != null)
+ {
+ if (DockPaneCaption.TextColor != ForeColor)
+ {
+ ForeColor = DockPaneCaption.TextColor;
+ Invalidate();
+ }
+ }
+ }
+ }
+
+ #region consts
+ private const int _TextGapTop = 2;
+ private const int _TextGapBottom = 0;
+ private const int _TextGapLeft = 3;
+ private const int _TextGapRight = 3;
+ private const int _ButtonGapTop = 2;
+ private const int _ButtonGapBottom = 1;
+ private const int _ButtonGapBetween = 1;
+ private const int _ButtonGapLeft = 1;
+ private const int _ButtonGapRight = 2;
+ #endregion
+
+ private static Bitmap _imageButtonClose;
+ private static Bitmap ImageButtonClose
+ {
+ get
+ {
+ if (_imageButtonClose == null)
+ _imageButtonClose = Resources.DockPane_Close;
+
+ return _imageButtonClose;
+ }
+ }
+
+ private InertButton m_buttonClose;
+ private InertButton ButtonClose
+ {
+ get
+ {
+ if (m_buttonClose == null)
+ {
+ m_buttonClose = new InertButton(this, ImageButtonClose, ImageButtonClose);
+ m_toolTip.SetToolTip(m_buttonClose, ToolTipClose);
+ m_buttonClose.Click += new EventHandler(Close_Click);
+ Controls.Add(m_buttonClose);
+ }
+
+ return m_buttonClose;
+ }
+ }
+
+ private static Bitmap _imageButtonAutoHide;
+ private static Bitmap ImageButtonAutoHide
+ {
+ get
+ {
+ if (_imageButtonAutoHide == null)
+ _imageButtonAutoHide = Resources.DockPane_AutoHide;
+
+ return _imageButtonAutoHide;
+ }
+ }
+
+ private static Bitmap _imageButtonDock;
+ private static Bitmap ImageButtonDock
+ {
+ get
+ {
+ if (_imageButtonDock == null)
+ _imageButtonDock = Resources.DockPane_Dock;
+
+ return _imageButtonDock;
+ }
+ }
+
+ private InertButton m_buttonAutoHide;
+ private InertButton ButtonAutoHide
+ {
+ get
+ {
+ if (m_buttonAutoHide == null)
+ {
+ m_buttonAutoHide = new InertButton(this, ImageButtonDock, ImageButtonAutoHide);
+ m_toolTip.SetToolTip(m_buttonAutoHide, ToolTipAutoHide);
+ m_buttonAutoHide.Click += new EventHandler(AutoHide_Click);
+ Controls.Add(m_buttonAutoHide);
+ }
+
+ return m_buttonAutoHide;
+ }
+ }
+
+ private static Bitmap _imageButtonOptions;
+ private static Bitmap ImageButtonOptions
+ {
+ get
+ {
+ if (_imageButtonOptions == null)
+ _imageButtonOptions = Resources.DockPane_Option;
+
+ return _imageButtonOptions;
+ }
+ }
+
+ private InertButton m_buttonOptions;
+ private InertButton ButtonOptions
+ {
+ get
+ {
+ if (m_buttonOptions == null)
+ {
+ m_buttonOptions = new InertButton(this, ImageButtonOptions, ImageButtonOptions);
+ m_toolTip.SetToolTip(m_buttonOptions, ToolTipOptions);
+ m_buttonOptions.Click += new EventHandler(Options_Click);
+ Controls.Add(m_buttonOptions);
+ }
+ return m_buttonOptions;
+ }
+ }
+
+ private IContainer m_components;
+ private IContainer Components
+ {
+ get { return m_components; }
+ }
+
+ private ToolTip m_toolTip;
+
+ public VS2005DockPaneCaption(DockPane pane) : base(pane)
+ {
+ SuspendLayout();
+
+ m_components = new Container();
+ m_toolTip = new ToolTip(Components);
+
+ ResumeLayout();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ Components.Dispose();
+ base.Dispose(disposing);
+ }
+
+ private static int TextGapTop
+ {
+ get { return _TextGapTop; }
+ }
+
+ private static Font TextFont
+ {
+ get { return SystemInformation.MenuFont; }
+ }
+
+ private static int TextGapBottom
+ {
+ get { return _TextGapBottom; }
+ }
+
+ private static int TextGapLeft
+ {
+ get { return _TextGapLeft; }
+ }
+
+ private static int TextGapRight
+ {
+ get { return _TextGapRight; }
+ }
+
+ private static int ButtonGapTop
+ {
+ get { return _ButtonGapTop; }
+ }
+
+ private static int ButtonGapBottom
+ {
+ get { return _ButtonGapBottom; }
+ }
+
+ private static int ButtonGapLeft
+ {
+ get { return _ButtonGapLeft; }
+ }
+
+ private static int ButtonGapRight
+ {
+ get { return _ButtonGapRight; }
+ }
+
+ private static int ButtonGapBetween
+ {
+ get { return _ButtonGapBetween; }
+ }
+
+ private static string _toolTipClose;
+ private static string ToolTipClose
+ {
+ get
+ {
+ if (_toolTipClose == null)
+ _toolTipClose = Strings.DockPaneCaption_ToolTipClose;
+ return _toolTipClose;
+ }
+ }
+
+ private static string _toolTipOptions;
+ private static string ToolTipOptions
+ {
+ get
+ {
+ if (_toolTipOptions == null)
+ _toolTipOptions = Strings.DockPaneCaption_ToolTipOptions;
+
+ return _toolTipOptions;
+ }
+ }
+
+ private static string _toolTipAutoHide;
+ private static string ToolTipAutoHide
+ {
+ get
+ {
+ if (_toolTipAutoHide == null)
+ _toolTipAutoHide = Strings.DockPaneCaption_ToolTipAutoHide;
+ return _toolTipAutoHide;
+ }
+ }
+
+ private static Blend _activeBackColorGradientBlend;
+ private static Blend ActiveBackColorGradientBlend
+ {
+ get
+ {
+ if (_activeBackColorGradientBlend == null)
+ {
+ Blend blend = new Blend(2);
+
+ blend.Factors = new float[]{0.5F, 1.0F};
+ blend.Positions = new float[]{0.0F, 1.0F};
+ _activeBackColorGradientBlend = blend;
+ }
+
+ return _activeBackColorGradientBlend;
+ }
+ }
+
+ private Color TextColor
+ {
+ get
+ {
+ if (DockPane.IsActivated)
+ return DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor;
+ else
+ return DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor;
+ }
+ }
+
+ private static TextFormatFlags _textFormat =
+ TextFormatFlags.SingleLine |
+ TextFormatFlags.EndEllipsis |
+ TextFormatFlags.VerticalCenter;
+ private TextFormatFlags TextFormat
+ {
+ get
+ {
+ if (RightToLeft == RightToLeft.No)
+ return _textFormat;
+ else
+ return _textFormat | TextFormatFlags.RightToLeft | TextFormatFlags.Right;
+ }
+ }
+
+ protected internal override int MeasureHeight()
+ {
+ int height = TextFont.Height + TextGapTop + TextGapBottom;
+
+ if (height < ButtonClose.Image.Height + ButtonGapTop + ButtonGapBottom)
+ height = ButtonClose.Image.Height + ButtonGapTop + ButtonGapBottom;
+
+ return height;
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint (e);
+ DrawCaption(e.Graphics);
+ }
+
+ private void DrawCaption(Graphics g)
+ {
+ if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
+ return;
+
+ if (DockPane.IsActivated)
+ {
+ Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.StartColor;
+ Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.EndColor;
+ LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode;
+ using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
+ {
+ brush.Blend = ActiveBackColorGradientBlend;
+ g.FillRectangle(brush, ClientRectangle);
+ }
+ }
+ else
+ {
+ Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor;
+ Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor;
+ LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode;
+ using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode))
+ {
+ g.FillRectangle(brush, ClientRectangle);
+ }
+ }
+
+ Rectangle rectCaption = ClientRectangle;
+
+ Rectangle rectCaptionText = rectCaption;
+ rectCaptionText.X += TextGapLeft;
+ rectCaptionText.Width -= TextGapLeft + TextGapRight;
+ rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight;
+ if (ShouldShowAutoHideButton)
+ rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween;
+ if (HasTabPageContextMenu)
+ rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween;
+ rectCaptionText.Y += TextGapTop;
+ rectCaptionText.Height -= TextGapTop + TextGapBottom;
+
+ Color colorText;
+ if (DockPane.IsActivated)
+ colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveCaptionGradient.TextColor;
+ else
+ colorText = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.TextColor;
+
+ TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), colorText, TextFormat);
+ }
+
+ protected override void OnLayout(LayoutEventArgs levent)
+ {
+ SetButtonsPosition();
+ base.OnLayout (levent);
+ }
+
+ protected override void OnRefreshChanges()
+ {
+ SetButtons();
+ Invalidate();
+ }
+
+ private bool CloseButtonEnabled
+ {
+ get { return (DockPane.ActiveContent != null)? DockPane.ActiveContent.DockHandler.CloseButton : false; }
+ }
+
+ ///
+ /// Determines whether the close button is visible on the content
+ ///
+ private bool CloseButtonVisible
+ {
+ get { return (DockPane.ActiveContent != null) ? DockPane.ActiveContent.DockHandler.CloseButtonVisible : false; }
+ }
+
+ private bool ShouldShowAutoHideButton
+ {
+ get { return !DockPane.IsFloat; }
+ }
+
+ private void SetButtons()
+ {
+ ButtonClose.Enabled = CloseButtonEnabled;
+ ButtonClose.Visible = CloseButtonVisible;
+ ButtonAutoHide.Visible = ShouldShowAutoHideButton;
+ ButtonOptions.Visible = HasTabPageContextMenu;
+ ButtonClose.RefreshChanges();
+ ButtonAutoHide.RefreshChanges();
+ ButtonOptions.RefreshChanges();
+
+ SetButtonsPosition();
+ }
+
+ private void SetButtonsPosition()
+ {
+ // set the size and location for close and auto-hide buttons
+ Rectangle rectCaption = ClientRectangle;
+ int buttonWidth = ButtonClose.Image.Width;
+ int buttonHeight = ButtonClose.Image.Height;
+ int height = rectCaption.Height - ButtonGapTop - ButtonGapBottom;
+ if (buttonHeight < height)
+ {
+ buttonWidth = buttonWidth * (height / buttonHeight);
+ buttonHeight = height;
+ }
+ Size buttonSize = new Size(buttonWidth, buttonHeight);
+ int x = rectCaption.X + rectCaption.Width - 1 - ButtonGapRight - m_buttonClose.Width;
+ int y = rectCaption.Y + ButtonGapTop;
+ Point point = new Point(x, y);
+ ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
+
+ // If the close button is not visible draw the auto hide button overtop.
+ // Otherwise it is drawn to the left of the close button.
+ if (CloseButtonVisible)
+ point.Offset(-(buttonWidth + ButtonGapBetween), 0);
+
+ ButtonAutoHide.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
+ if (ShouldShowAutoHideButton)
+ point.Offset(-(buttonWidth + ButtonGapBetween), 0);
+ ButtonOptions.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
+ }
+
+ private void Close_Click(object sender, EventArgs e)
+ {
+ DockPane.CloseActiveContent();
+ }
+
+ private void AutoHide_Click(object sender, EventArgs e)
+ {
+ DockPane.DockState = DockHelper.ToggleAutoHideState(DockPane.DockState);
+ if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
+ DockPane.DockPanel.ActiveAutoHideContent = null;
+
+ }
+
+ private void Options_Click(object sender, EventArgs e)
+ {
+ ShowTabPageContextMenu(PointToClient(Control.MousePosition));
+ }
+
+ protected override void OnRightToLeftChanged(EventArgs e)
+ {
+ base.OnRightToLeftChanged(e);
+ PerformLayout();
+ }
+ }
+}
diff --git a/trunk/Docking/VS2005DockPaneStrip.cs b/source/Docking/VS2005DockPaneStrip.cs
similarity index 97%
rename from trunk/Docking/VS2005DockPaneStrip.cs
rename to source/Docking/VS2005DockPaneStrip.cs
index 042a906..8ec9e1e 100644
--- a/trunk/Docking/VS2005DockPaneStrip.cs
+++ b/source/Docking/VS2005DockPaneStrip.cs
@@ -1,1479 +1,1479 @@
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace LSLEditor.Docking
-{
- internal class VS2005DockPaneStrip : DockPaneStripBase
- {
- private class TabVS2005 : Tab
- {
- public TabVS2005(IDockContent content)
- : base(content)
- {
- }
-
- private int m_tabX;
- public int TabX
- {
- get { return m_tabX; }
- set { m_tabX = value; }
- }
-
- private int m_tabWidth;
- public int TabWidth
- {
- get { return m_tabWidth; }
- set { m_tabWidth = value; }
- }
-
- private int m_maxWidth;
- public int MaxWidth
- {
- get { return m_maxWidth; }
- set { m_maxWidth = value; }
- }
-
- private bool m_flag;
- protected internal bool Flag
- {
- get { return m_flag; }
- set { m_flag = value; }
- }
- }
-
- protected internal override DockPaneStripBase.Tab CreateTab(IDockContent content)
- {
- return new TabVS2005(content);
- }
-
- private sealed class InertButton : InertButtonBase
- {
- private Bitmap m_image0, m_image1;
-
- public InertButton(Bitmap image0, Bitmap image1)
- : base()
- {
- m_image0 = image0;
- m_image1 = image1;
- }
-
- private int m_imageCategory = 0;
- public int ImageCategory
- {
- get { return m_imageCategory; }
- set
- {
- if (m_imageCategory == value)
- return;
-
- m_imageCategory = value;
- Invalidate();
- }
- }
-
- public override Bitmap Image
- {
- get { return ImageCategory == 0 ? m_image0 : m_image1; }
- }
- }
-
- #region consts
- private const int _ToolWindowStripGapTop = 0;
- private const int _ToolWindowStripGapBottom = 1;
- private const int _ToolWindowStripGapLeft = 0;
- private const int _ToolWindowStripGapRight = 0;
- private const int _ToolWindowImageHeight = 16;
- private const int _ToolWindowImageWidth = 16;
- private const int _ToolWindowImageGapTop = 3;
- private const int _ToolWindowImageGapBottom = 1;
- private const int _ToolWindowImageGapLeft = 2;
- private const int _ToolWindowImageGapRight = 0;
- private const int _ToolWindowTextGapRight = 3;
- private const int _ToolWindowTabSeperatorGapTop = 3;
- private const int _ToolWindowTabSeperatorGapBottom = 3;
-
- private const int _DocumentStripGapTop = 0;
- private const int _DocumentStripGapBottom = 1;
- private const int _DocumentTabMaxWidth = 200;
- private const int _DocumentButtonGapTop = 4;
- private const int _DocumentButtonGapBottom = 4;
- private const int _DocumentButtonGapBetween = 0;
- private const int _DocumentButtonGapRight = 3;
- private const int _DocumentTabGapTop = 3;
- private const int _DocumentTabGapLeft = 3;
- private const int _DocumentTabGapRight = 3;
- private const int _DocumentIconGapBottom = 2;
- private const int _DocumentIconGapLeft = 8;
- private const int _DocumentIconGapRight = 0;
- private const int _DocumentIconHeight = 16;
- private const int _DocumentIconWidth = 16;
- private const int _DocumentTextGapRight = 3;
- #endregion
-
- private static Bitmap _imageButtonClose;
- private static Bitmap ImageButtonClose
- {
- get
- {
- if (_imageButtonClose == null)
- _imageButtonClose = Resources.DockPane_Close;
-
- return _imageButtonClose;
- }
- }
-
- private InertButton m_buttonClose;
- private InertButton ButtonClose
- {
- get
- {
- if (m_buttonClose == null)
- {
- m_buttonClose = new InertButton(ImageButtonClose, ImageButtonClose);
- m_toolTip.SetToolTip(m_buttonClose, ToolTipClose);
- m_buttonClose.Click += new EventHandler(Close_Click);
- Controls.Add(m_buttonClose);
- }
-
- return m_buttonClose;
- }
- }
-
- private static Bitmap _imageButtonWindowList;
- private static Bitmap ImageButtonWindowList
- {
- get
- {
- if (_imageButtonWindowList == null)
- _imageButtonWindowList = Resources.DockPane_Option;
-
- return _imageButtonWindowList;
- }
- }
-
- private static Bitmap _imageButtonWindowListOverflow;
- private static Bitmap ImageButtonWindowListOverflow
- {
- get
- {
- if (_imageButtonWindowListOverflow == null)
- _imageButtonWindowListOverflow = Resources.DockPane_OptionOverflow;
-
- return _imageButtonWindowListOverflow;
- }
- }
-
- private InertButton m_buttonWindowList;
- private InertButton ButtonWindowList
- {
- get
- {
- if (m_buttonWindowList == null)
- {
- m_buttonWindowList = new InertButton(ImageButtonWindowList, ImageButtonWindowListOverflow);
- m_toolTip.SetToolTip(m_buttonWindowList, ToolTipSelect);
- m_buttonWindowList.Click += new EventHandler(WindowList_Click);
- Controls.Add(m_buttonWindowList);
- }
-
- return m_buttonWindowList;
- }
- }
-
- private static GraphicsPath GraphicsPath
- {
- get { return VS2005AutoHideStrip.GraphicsPath; }
- }
-
- private IContainer m_components;
- private ToolTip m_toolTip;
- private IContainer Components
- {
- get { return m_components; }
- }
-
- #region Customizable Properties
- private static int ToolWindowStripGapTop
- {
- get { return _ToolWindowStripGapTop; }
- }
-
- private static int ToolWindowStripGapBottom
- {
- get { return _ToolWindowStripGapBottom; }
- }
-
- private static int ToolWindowStripGapLeft
- {
- get { return _ToolWindowStripGapLeft; }
- }
-
- private static int ToolWindowStripGapRight
- {
- get { return _ToolWindowStripGapRight; }
- }
-
- private static int ToolWindowImageHeight
- {
- get { return _ToolWindowImageHeight; }
- }
-
- private static int ToolWindowImageWidth
- {
- get { return _ToolWindowImageWidth; }
- }
-
- private static int ToolWindowImageGapTop
- {
- get { return _ToolWindowImageGapTop; }
- }
-
- private static int ToolWindowImageGapBottom
- {
- get { return _ToolWindowImageGapBottom; }
- }
-
- private static int ToolWindowImageGapLeft
- {
- get { return _ToolWindowImageGapLeft; }
- }
-
- private static int ToolWindowImageGapRight
- {
- get { return _ToolWindowImageGapRight; }
- }
-
- private static int ToolWindowTextGapRight
- {
- get { return _ToolWindowTextGapRight; }
- }
-
- private static int ToolWindowTabSeperatorGapTop
- {
- get { return _ToolWindowTabSeperatorGapTop; }
- }
-
- private static int ToolWindowTabSeperatorGapBottom
- {
- get { return _ToolWindowTabSeperatorGapBottom; }
- }
-
- private static string _toolTipClose;
- private static string ToolTipClose
- {
- get
- {
- if (_toolTipClose == null)
- _toolTipClose = Strings.DockPaneStrip_ToolTipClose;
- return _toolTipClose;
- }
- }
-
- private static string _toolTipSelect;
- private static string ToolTipSelect
- {
- get
- {
- if (_toolTipSelect == null)
- _toolTipSelect = Strings.DockPaneStrip_ToolTipWindowList;
- return _toolTipSelect;
- }
- }
-
- private TextFormatFlags ToolWindowTextFormat
- {
- get
- {
- TextFormatFlags textFormat = TextFormatFlags.EndEllipsis |
- TextFormatFlags.HorizontalCenter |
- TextFormatFlags.SingleLine |
- TextFormatFlags.VerticalCenter;
- if (RightToLeft == RightToLeft.Yes)
- return textFormat | TextFormatFlags.RightToLeft | TextFormatFlags.Right;
- else
- return textFormat;
- }
- }
-
- private static int DocumentStripGapTop
- {
- get { return _DocumentStripGapTop; }
- }
-
- private static int DocumentStripGapBottom
- {
- get { return _DocumentStripGapBottom; }
- }
-
- private TextFormatFlags DocumentTextFormat
- {
- get
- {
- TextFormatFlags textFormat = TextFormatFlags.EndEllipsis |
- TextFormatFlags.SingleLine |
- TextFormatFlags.VerticalCenter |
- TextFormatFlags.HorizontalCenter;
- if (RightToLeft == RightToLeft.Yes)
- return textFormat | TextFormatFlags.RightToLeft;
- else
- return textFormat;
- }
- }
-
- private static int DocumentTabMaxWidth
- {
- get { return _DocumentTabMaxWidth; }
- }
-
- private static int DocumentButtonGapTop
- {
- get { return _DocumentButtonGapTop; }
- }
-
- private static int DocumentButtonGapBottom
- {
- get { return _DocumentButtonGapBottom; }
- }
-
- private static int DocumentButtonGapBetween
- {
- get { return _DocumentButtonGapBetween; }
- }
-
- private static int DocumentButtonGapRight
- {
- get { return _DocumentButtonGapRight; }
- }
-
- private static int DocumentTabGapTop
- {
- get { return _DocumentTabGapTop; }
- }
-
- private static int DocumentTabGapLeft
- {
- get { return _DocumentTabGapLeft; }
- }
-
- private static int DocumentTabGapRight
- {
- get { return _DocumentTabGapRight; }
- }
-
- private static int DocumentIconGapBottom
- {
- get { return _DocumentIconGapBottom; }
- }
-
- private static int DocumentIconGapLeft
- {
- get { return _DocumentIconGapLeft; }
- }
-
- private static int DocumentIconGapRight
- {
- get { return _DocumentIconGapRight; }
- }
-
- private static int DocumentIconWidth
- {
- get { return _DocumentIconWidth; }
- }
-
- private static int DocumentIconHeight
- {
- get { return _DocumentIconHeight; }
- }
-
- private static int DocumentTextGapRight
- {
- get { return _DocumentTextGapRight; }
- }
-
- private static Pen PenToolWindowTabBorder
- {
- get { return SystemPens.GrayText; }
- }
-
- private static Pen PenDocumentTabActiveBorder
- {
- get { return SystemPens.ControlDarkDark; }
- }
-
- private static Pen PenDocumentTabInactiveBorder
- {
- get { return SystemPens.GrayText; }
- }
- #endregion
-
- public VS2005DockPaneStrip(DockPane pane) : base(pane)
- {
- SetStyle(ControlStyles.ResizeRedraw |
- ControlStyles.UserPaint |
- ControlStyles.AllPaintingInWmPaint |
- ControlStyles.OptimizedDoubleBuffer, true);
-
- SuspendLayout();
-
- m_components = new Container();
- m_toolTip = new ToolTip(Components);
- m_selectMenu = new ContextMenuStrip(Components);
-
- ResumeLayout();
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- Components.Dispose();
- if (m_boldFont != null)
- {
- m_boldFont.Dispose();
- m_boldFont = null;
- }
- }
- base.Dispose (disposing);
- }
-
- private static Font TextFont
- {
- get { return SystemInformation.MenuFont; }
- }
-
- private Font m_font;
- private Font m_boldFont;
- private Font BoldFont
- {
- get
- {
- if (IsDisposed)
- return null;
-
- if (m_boldFont == null)
- {
- m_font = TextFont;
- m_boldFont = new Font(TextFont, FontStyle.Bold);
- }
- else if (m_font != TextFont)
- {
- m_boldFont.Dispose();
- m_font = TextFont;
- m_boldFont = new Font(TextFont, FontStyle.Bold);
- }
-
- return m_boldFont;
- }
- }
-
- private int m_startDisplayingTab = 0;
- private int StartDisplayingTab
- {
- get { return m_startDisplayingTab; }
- set
- {
- m_startDisplayingTab = value;
- Invalidate();
- }
- }
-
- private int m_endDisplayingTab = 0;
- private int EndDisplayingTab
- {
- get { return m_endDisplayingTab; }
- set { m_endDisplayingTab = value; }
- }
-
- private int m_firstDisplayingTab = 0;
- private int FirstDisplayingTab
- {
- get { return m_firstDisplayingTab; }
- set { m_firstDisplayingTab = value; }
- }
-
- private bool m_documentTabsOverflow = false;
- private bool DocumentTabsOverflow
- {
- set
- {
- if (m_documentTabsOverflow == value)
- return;
-
- m_documentTabsOverflow = value;
- if (value)
- ButtonWindowList.ImageCategory = 1;
- else
- ButtonWindowList.ImageCategory = 0;
- }
- }
-
- protected internal override int MeasureHeight()
- {
- if (Appearance == DockPane.AppearanceStyle.ToolWindow)
- return MeasureHeight_ToolWindow();
- else
- return MeasureHeight_Document();
- }
-
- private int MeasureHeight_ToolWindow()
- {
- if (DockPane.IsAutoHide || Tabs.Count <= 1)
- return 0;
-
- int height = Math.Max(TextFont.Height, ToolWindowImageHeight + ToolWindowImageGapTop + ToolWindowImageGapBottom)
- + ToolWindowStripGapTop + ToolWindowStripGapBottom;
-
- return height;
- }
-
- private int MeasureHeight_Document()
- {
- int height = Math.Max(TextFont.Height + DocumentTabGapTop,
- ButtonClose.Height + DocumentButtonGapTop + DocumentButtonGapBottom)
- + DocumentStripGapBottom + DocumentStripGapTop;
-
- return height;
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- Rectangle rect = TabsRectangle;
-
- if (Appearance == DockPane.AppearanceStyle.Document)
- {
- rect.X -= DocumentTabGapLeft;
-
- // Add these values back in so that the DockStrip color is drawn
- // beneath the close button and window list button.
- rect.Width += DocumentTabGapLeft +
- DocumentTabGapRight +
- DocumentButtonGapRight +
- ButtonClose.Width +
- ButtonWindowList.Width;
-
- // It is possible depending on the DockPanel DocumentStyle to have
- // a Document without a DockStrip.
- if (rect.Width > 0 && rect.Height > 0)
- {
- Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.StartColor;
- Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.EndColor;
- LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.LinearGradientMode;
- using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode))
- {
- e.Graphics.FillRectangle(brush, rect);
- }
- }
- }
- else
- {
- Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.StartColor;
- Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.EndColor;
- LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.LinearGradientMode;
- using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode))
- {
- e.Graphics.FillRectangle(brush, rect);
- }
- }
- base.OnPaint (e);
- CalculateTabs();
- if (Appearance == DockPane.AppearanceStyle.Document && DockPane.ActiveContent != null)
- {
- if (EnsureDocumentTabVisible(DockPane.ActiveContent, false))
- CalculateTabs();
- }
-
- DrawTabStrip(e.Graphics);
- }
-
- protected override void OnRefreshChanges()
- {
- SetInertButtons();
- Invalidate();
- }
-
- protected internal override GraphicsPath GetOutline(int index)
- {
-
- if (Appearance == DockPane.AppearanceStyle.Document)
- return GetOutline_Document(index);
- else
- return GetOutline_ToolWindow(index);
-
- }
-
- private GraphicsPath GetOutline_Document(int index)
- {
- Rectangle rectTab = GetTabRectangle(index);
- rectTab.X -= rectTab.Height / 2;
- rectTab.Intersect(TabsRectangle);
- rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
- Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle);
-
- GraphicsPath path = new GraphicsPath();
- GraphicsPath pathTab = GetTabOutline_Document(Tabs[index], true, true, true);
- path.AddPath(pathTab, true);
-
- if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
- {
- path.AddLine(rectTab.Right, rectTab.Top, rectPaneClient.Right, rectTab.Top);
- path.AddLine(rectPaneClient.Right, rectTab.Top, rectPaneClient.Right, rectPaneClient.Top);
- path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Left, rectPaneClient.Top);
- path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Left, rectTab.Top);
- path.AddLine(rectPaneClient.Left, rectTab.Top, rectTab.Right, rectTab.Top);
- }
- else
- {
- path.AddLine(rectTab.Right, rectTab.Bottom, rectPaneClient.Right, rectTab.Bottom);
- path.AddLine(rectPaneClient.Right, rectTab.Bottom, rectPaneClient.Right, rectPaneClient.Bottom);
- path.AddLine(rectPaneClient.Right, rectPaneClient.Bottom, rectPaneClient.Left, rectPaneClient.Bottom);
- path.AddLine(rectPaneClient.Left, rectPaneClient.Bottom, rectPaneClient.Left, rectTab.Bottom);
- path.AddLine(rectPaneClient.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom);
- }
- return path;
- }
-
- private GraphicsPath GetOutline_ToolWindow(int index)
- {
- Rectangle rectTab = GetTabRectangle(index);
- rectTab.Intersect(TabsRectangle);
- rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
- int y = rectTab.Top;
- Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle);
-
- GraphicsPath path = new GraphicsPath();
- GraphicsPath pathTab = GetTabOutline(Tabs[index], true, true);
- path.AddPath(pathTab, true);
- path.AddLine(rectTab.Left, rectTab.Top, rectPaneClient.Left, rectTab.Top);
- path.AddLine(rectPaneClient.Left, rectTab.Top, rectPaneClient.Left, rectPaneClient.Top);
- path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Right, rectPaneClient.Top);
- path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Right, rectTab.Top);
- path.AddLine(rectPaneClient.Right, rectTab.Top, rectTab.Right, rectTab.Top);
- return path;
- }
-
- private void CalculateTabs()
- {
- if (Appearance == DockPane.AppearanceStyle.ToolWindow)
- CalculateTabs_ToolWindow();
- else
- CalculateTabs_Document();
- }
-
- private void CalculateTabs_ToolWindow()
- {
- if (Tabs.Count <= 1 || DockPane.IsAutoHide)
- return;
-
- Rectangle rectTabStrip = TabStripRectangle;
-
- // Calculate tab widths
- int countTabs = Tabs.Count;
- foreach (TabVS2005 tab in Tabs)
- {
- tab.MaxWidth = GetMaxTabWidth(Tabs.IndexOf(tab));
- tab.Flag = false;
- }
-
- // Set tab whose max width less than average width
- bool anyWidthWithinAverage = true;
- int totalWidth = rectTabStrip.Width - ToolWindowStripGapLeft - ToolWindowStripGapRight;
- int totalAllocatedWidth = 0;
- int averageWidth = totalWidth / countTabs;
- int remainedTabs = countTabs;
- for (anyWidthWithinAverage=true; anyWidthWithinAverage && remainedTabs>0;)
- {
- anyWidthWithinAverage = false;
- foreach (TabVS2005 tab in Tabs)
- {
- if (tab.Flag)
- continue;
-
- if (tab.MaxWidth <= averageWidth)
- {
- tab.Flag = true;
- tab.TabWidth = tab.MaxWidth;
- totalAllocatedWidth += tab.TabWidth;
- anyWidthWithinAverage = true;
- remainedTabs--;
- }
- }
- if (remainedTabs != 0)
- averageWidth = (totalWidth - totalAllocatedWidth) / remainedTabs;
- }
-
- // If any tab width not set yet, set it to the average width
- if (remainedTabs > 0)
- {
- int roundUpWidth = (totalWidth - totalAllocatedWidth) - (averageWidth * remainedTabs);
- foreach (TabVS2005 tab in Tabs)
- {
- if (tab.Flag)
- continue;
-
- tab.Flag = true;
- if (roundUpWidth > 0)
- {
- tab.TabWidth = averageWidth + 1;
- roundUpWidth --;
- }
- else
- tab.TabWidth = averageWidth;
- }
- }
-
- // Set the X position of the tabs
- int x = rectTabStrip.X + ToolWindowStripGapLeft;
- foreach (TabVS2005 tab in Tabs)
- {
- tab.TabX = x;
- x += tab.TabWidth;
- }
- }
-
- private bool CalculateDocumentTab(Rectangle rectTabStrip, ref int x, int index)
- {
- bool overflow = false;
-
- TabVS2005 tab = Tabs[index] as TabVS2005;
- tab.MaxWidth = GetMaxTabWidth(index);
- int width = Math.Min(tab.MaxWidth, DocumentTabMaxWidth);
- if (x + width < rectTabStrip.Right || index == StartDisplayingTab)
- {
- tab.TabX = x;
- tab.TabWidth = width;
- EndDisplayingTab = index;
- }
- else
- {
- tab.TabX = 0;
- tab.TabWidth = 0;
- overflow = true;
- }
- x += width;
-
- return overflow;
- }
-
- ///
- /// Calculate which tabs are displayed and in what order.
- ///
- private void CalculateTabs_Document()
- {
- if (m_startDisplayingTab >= Tabs.Count)
- m_startDisplayingTab = 0;
-
- Rectangle rectTabStrip = TabsRectangle;
-
- int x = rectTabStrip.X + rectTabStrip.Height / 2;
- bool overflow = false;
-
- // Originally all new documents that were considered overflow
- // (not enough pane strip space to show all tabs) were added to
- // the far left (assuming not right to left) and the tabs on the
- // right were dropped from view. If StartDisplayingTab is not 0
- // then we are dealing with making sure a specific tab is kept in focus.
- if (m_startDisplayingTab > 0)
- {
- int tempX = x;
- TabVS2005 tab = Tabs[m_startDisplayingTab] as TabVS2005;
- tab.MaxWidth = GetMaxTabWidth(m_startDisplayingTab);
- int width = Math.Min(tab.MaxWidth, DocumentTabMaxWidth);
-
- // Add the active tab and tabs to the left
- for (int i = StartDisplayingTab; i >= 0; i--)
- CalculateDocumentTab(rectTabStrip, ref tempX, i);
-
- // Store which tab is the first one displayed so that it
- // will be drawn correctly (without part of the tab cut off)
- FirstDisplayingTab = EndDisplayingTab;
-
- tempX = x; // Reset X location because we are starting over
-
- // Start with the first tab displayed - name is a little misleading.
- // Loop through each tab and set its location. If there is not enough
- // room for all of them overflow will be returned.
- for (int i = EndDisplayingTab; i < Tabs.Count; i++)
- overflow = CalculateDocumentTab(rectTabStrip, ref tempX, i);
-
- // If not all tabs are shown then we have an overflow.
- if (FirstDisplayingTab != 0)
- overflow = true;
- }
- else
- {
- for (int i = StartDisplayingTab; i < Tabs.Count; i++)
- overflow = CalculateDocumentTab(rectTabStrip, ref x, i);
- for (int i = 0; i < StartDisplayingTab; i++)
- overflow = CalculateDocumentTab(rectTabStrip, ref x, i);
-
- FirstDisplayingTab = StartDisplayingTab;
- }
-
- if (!overflow)
- {
- m_startDisplayingTab = 0;
- FirstDisplayingTab = 0;
- x = rectTabStrip.X + rectTabStrip.Height / 2;
- foreach (TabVS2005 tab in Tabs)
- {
- tab.TabX = x;
- x += tab.TabWidth;
- }
- }
- DocumentTabsOverflow = overflow;
- }
-
- protected internal override void EnsureTabVisible(IDockContent content)
- {
- if (Appearance != DockPane.AppearanceStyle.Document || !Tabs.Contains(content))
- return;
-
- CalculateTabs();
- EnsureDocumentTabVisible(content, true);
- }
-
- private bool EnsureDocumentTabVisible(IDockContent content, bool repaint)
- {
- int index = Tabs.IndexOf(content);
- TabVS2005 tab = Tabs[index] as TabVS2005;
- if (tab.TabWidth != 0)
- return false;
-
- StartDisplayingTab = index;
- if (repaint)
- Invalidate();
-
- return true;
- }
-
- private int GetMaxTabWidth(int index)
- {
- if (Appearance == DockPane.AppearanceStyle.ToolWindow)
- return GetMaxTabWidth_ToolWindow(index);
- else
- return GetMaxTabWidth_Document(index);
- }
-
- private int GetMaxTabWidth_ToolWindow(int index)
- {
- IDockContent content = Tabs[index].Content;
- Size sizeString = TextRenderer.MeasureText(content.DockHandler.TabText, TextFont);
- return ToolWindowImageWidth + sizeString.Width + ToolWindowImageGapLeft
- + ToolWindowImageGapRight + ToolWindowTextGapRight;
- }
-
- private int GetMaxTabWidth_Document(int index)
- {
- IDockContent content = Tabs[index].Content;
-
- int height = GetTabRectangle_Document(index).Height;
-
- Size sizeText = TextRenderer.MeasureText(content.DockHandler.TabText, BoldFont, new Size(DocumentTabMaxWidth, height), DocumentTextFormat);
-
- if (DockPane.DockPanel.ShowDocumentIcon)
- return sizeText.Width + DocumentIconWidth + DocumentIconGapLeft + DocumentIconGapRight + DocumentTextGapRight;
- else
- return sizeText.Width + DocumentIconGapLeft + DocumentTextGapRight;
- }
-
- private void DrawTabStrip(Graphics g)
- {
- if (Appearance == DockPane.AppearanceStyle.Document)
- DrawTabStrip_Document(g);
- else
- DrawTabStrip_ToolWindow(g);
- }
-
- private void DrawTabStrip_Document(Graphics g)
- {
- int count = Tabs.Count;
- if (count == 0)
- return;
-
- Rectangle rectTabStrip = TabStripRectangle;
-
- // Draw the tabs
- Rectangle rectTabOnly = TabsRectangle;
- Rectangle rectTab = Rectangle.Empty;
- TabVS2005 tabActive = null;
- g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly));
- for (int i=0; i tab.TabWidth)
- toolTip = tab.Content.DockHandler.TabText;
- }
-
- if (m_toolTip.GetToolTip(this) != toolTip)
- {
- m_toolTip.Active = false;
- m_toolTip.SetToolTip(this, toolTip);
- m_toolTip.Active = true;
- }
-
- // requires further tracking of mouse hover behavior,
- ResetMouseEventArgs();
- }
-
- protected override void OnRightToLeftChanged(EventArgs e)
- {
- base.OnRightToLeftChanged(e);
- PerformLayout();
- }
- }
-}
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace LSLEditor.Docking
+{
+ internal class VS2005DockPaneStrip : DockPaneStripBase
+ {
+ private class TabVS2005 : Tab
+ {
+ public TabVS2005(IDockContent content)
+ : base(content)
+ {
+ }
+
+ private int m_tabX;
+ public int TabX
+ {
+ get { return m_tabX; }
+ set { m_tabX = value; }
+ }
+
+ private int m_tabWidth;
+ public int TabWidth
+ {
+ get { return m_tabWidth; }
+ set { m_tabWidth = value; }
+ }
+
+ private int m_maxWidth;
+ public int MaxWidth
+ {
+ get { return m_maxWidth; }
+ set { m_maxWidth = value; }
+ }
+
+ private bool m_flag;
+ protected internal bool Flag
+ {
+ get { return m_flag; }
+ set { m_flag = value; }
+ }
+ }
+
+ protected internal override DockPaneStripBase.Tab CreateTab(IDockContent content)
+ {
+ return new TabVS2005(content);
+ }
+
+ private sealed class InertButton : InertButtonBase
+ {
+ private Bitmap m_image0, m_image1;
+
+ public InertButton(Bitmap image0, Bitmap image1)
+ : base()
+ {
+ m_image0 = image0;
+ m_image1 = image1;
+ }
+
+ private int m_imageCategory = 0;
+ public int ImageCategory
+ {
+ get { return m_imageCategory; }
+ set
+ {
+ if (m_imageCategory == value)
+ return;
+
+ m_imageCategory = value;
+ Invalidate();
+ }
+ }
+
+ public override Bitmap Image
+ {
+ get { return ImageCategory == 0 ? m_image0 : m_image1; }
+ }
+ }
+
+ #region consts
+ private const int _ToolWindowStripGapTop = 0;
+ private const int _ToolWindowStripGapBottom = 1;
+ private const int _ToolWindowStripGapLeft = 0;
+ private const int _ToolWindowStripGapRight = 0;
+ private const int _ToolWindowImageHeight = 16;
+ private const int _ToolWindowImageWidth = 16;
+ private const int _ToolWindowImageGapTop = 3;
+ private const int _ToolWindowImageGapBottom = 1;
+ private const int _ToolWindowImageGapLeft = 2;
+ private const int _ToolWindowImageGapRight = 0;
+ private const int _ToolWindowTextGapRight = 3;
+ private const int _ToolWindowTabSeperatorGapTop = 3;
+ private const int _ToolWindowTabSeperatorGapBottom = 3;
+
+ private const int _DocumentStripGapTop = 0;
+ private const int _DocumentStripGapBottom = 1;
+ private const int _DocumentTabMaxWidth = 200;
+ private const int _DocumentButtonGapTop = 4;
+ private const int _DocumentButtonGapBottom = 4;
+ private const int _DocumentButtonGapBetween = 0;
+ private const int _DocumentButtonGapRight = 3;
+ private const int _DocumentTabGapTop = 3;
+ private const int _DocumentTabGapLeft = 3;
+ private const int _DocumentTabGapRight = 3;
+ private const int _DocumentIconGapBottom = 2;
+ private const int _DocumentIconGapLeft = 8;
+ private const int _DocumentIconGapRight = 0;
+ private const int _DocumentIconHeight = 16;
+ private const int _DocumentIconWidth = 16;
+ private const int _DocumentTextGapRight = 3;
+ #endregion
+
+ private static Bitmap _imageButtonClose;
+ private static Bitmap ImageButtonClose
+ {
+ get
+ {
+ if (_imageButtonClose == null)
+ _imageButtonClose = Resources.DockPane_Close;
+
+ return _imageButtonClose;
+ }
+ }
+
+ private InertButton m_buttonClose;
+ private InertButton ButtonClose
+ {
+ get
+ {
+ if (m_buttonClose == null)
+ {
+ m_buttonClose = new InertButton(ImageButtonClose, ImageButtonClose);
+ m_toolTip.SetToolTip(m_buttonClose, ToolTipClose);
+ m_buttonClose.Click += new EventHandler(Close_Click);
+ Controls.Add(m_buttonClose);
+ }
+
+ return m_buttonClose;
+ }
+ }
+
+ private static Bitmap _imageButtonWindowList;
+ private static Bitmap ImageButtonWindowList
+ {
+ get
+ {
+ if (_imageButtonWindowList == null)
+ _imageButtonWindowList = Resources.DockPane_Option;
+
+ return _imageButtonWindowList;
+ }
+ }
+
+ private static Bitmap _imageButtonWindowListOverflow;
+ private static Bitmap ImageButtonWindowListOverflow
+ {
+ get
+ {
+ if (_imageButtonWindowListOverflow == null)
+ _imageButtonWindowListOverflow = Resources.DockPane_OptionOverflow;
+
+ return _imageButtonWindowListOverflow;
+ }
+ }
+
+ private InertButton m_buttonWindowList;
+ private InertButton ButtonWindowList
+ {
+ get
+ {
+ if (m_buttonWindowList == null)
+ {
+ m_buttonWindowList = new InertButton(ImageButtonWindowList, ImageButtonWindowListOverflow);
+ m_toolTip.SetToolTip(m_buttonWindowList, ToolTipSelect);
+ m_buttonWindowList.Click += new EventHandler(WindowList_Click);
+ Controls.Add(m_buttonWindowList);
+ }
+
+ return m_buttonWindowList;
+ }
+ }
+
+ private static GraphicsPath GraphicsPath
+ {
+ get { return VS2005AutoHideStrip.GraphicsPath; }
+ }
+
+ private IContainer m_components;
+ private ToolTip m_toolTip;
+ private IContainer Components
+ {
+ get { return m_components; }
+ }
+
+ #region Customizable Properties
+ private static int ToolWindowStripGapTop
+ {
+ get { return _ToolWindowStripGapTop; }
+ }
+
+ private static int ToolWindowStripGapBottom
+ {
+ get { return _ToolWindowStripGapBottom; }
+ }
+
+ private static int ToolWindowStripGapLeft
+ {
+ get { return _ToolWindowStripGapLeft; }
+ }
+
+ private static int ToolWindowStripGapRight
+ {
+ get { return _ToolWindowStripGapRight; }
+ }
+
+ private static int ToolWindowImageHeight
+ {
+ get { return _ToolWindowImageHeight; }
+ }
+
+ private static int ToolWindowImageWidth
+ {
+ get { return _ToolWindowImageWidth; }
+ }
+
+ private static int ToolWindowImageGapTop
+ {
+ get { return _ToolWindowImageGapTop; }
+ }
+
+ private static int ToolWindowImageGapBottom
+ {
+ get { return _ToolWindowImageGapBottom; }
+ }
+
+ private static int ToolWindowImageGapLeft
+ {
+ get { return _ToolWindowImageGapLeft; }
+ }
+
+ private static int ToolWindowImageGapRight
+ {
+ get { return _ToolWindowImageGapRight; }
+ }
+
+ private static int ToolWindowTextGapRight
+ {
+ get { return _ToolWindowTextGapRight; }
+ }
+
+ private static int ToolWindowTabSeperatorGapTop
+ {
+ get { return _ToolWindowTabSeperatorGapTop; }
+ }
+
+ private static int ToolWindowTabSeperatorGapBottom
+ {
+ get { return _ToolWindowTabSeperatorGapBottom; }
+ }
+
+ private static string _toolTipClose;
+ private static string ToolTipClose
+ {
+ get
+ {
+ if (_toolTipClose == null)
+ _toolTipClose = Strings.DockPaneStrip_ToolTipClose;
+ return _toolTipClose;
+ }
+ }
+
+ private static string _toolTipSelect;
+ private static string ToolTipSelect
+ {
+ get
+ {
+ if (_toolTipSelect == null)
+ _toolTipSelect = Strings.DockPaneStrip_ToolTipWindowList;
+ return _toolTipSelect;
+ }
+ }
+
+ private TextFormatFlags ToolWindowTextFormat
+ {
+ get
+ {
+ TextFormatFlags textFormat = TextFormatFlags.EndEllipsis |
+ TextFormatFlags.HorizontalCenter |
+ TextFormatFlags.SingleLine |
+ TextFormatFlags.VerticalCenter;
+ if (RightToLeft == RightToLeft.Yes)
+ return textFormat | TextFormatFlags.RightToLeft | TextFormatFlags.Right;
+ else
+ return textFormat;
+ }
+ }
+
+ private static int DocumentStripGapTop
+ {
+ get { return _DocumentStripGapTop; }
+ }
+
+ private static int DocumentStripGapBottom
+ {
+ get { return _DocumentStripGapBottom; }
+ }
+
+ private TextFormatFlags DocumentTextFormat
+ {
+ get
+ {
+ TextFormatFlags textFormat = TextFormatFlags.EndEllipsis |
+ TextFormatFlags.SingleLine |
+ TextFormatFlags.VerticalCenter |
+ TextFormatFlags.HorizontalCenter;
+ if (RightToLeft == RightToLeft.Yes)
+ return textFormat | TextFormatFlags.RightToLeft;
+ else
+ return textFormat;
+ }
+ }
+
+ private static int DocumentTabMaxWidth
+ {
+ get { return _DocumentTabMaxWidth; }
+ }
+
+ private static int DocumentButtonGapTop
+ {
+ get { return _DocumentButtonGapTop; }
+ }
+
+ private static int DocumentButtonGapBottom
+ {
+ get { return _DocumentButtonGapBottom; }
+ }
+
+ private static int DocumentButtonGapBetween
+ {
+ get { return _DocumentButtonGapBetween; }
+ }
+
+ private static int DocumentButtonGapRight
+ {
+ get { return _DocumentButtonGapRight; }
+ }
+
+ private static int DocumentTabGapTop
+ {
+ get { return _DocumentTabGapTop; }
+ }
+
+ private static int DocumentTabGapLeft
+ {
+ get { return _DocumentTabGapLeft; }
+ }
+
+ private static int DocumentTabGapRight
+ {
+ get { return _DocumentTabGapRight; }
+ }
+
+ private static int DocumentIconGapBottom
+ {
+ get { return _DocumentIconGapBottom; }
+ }
+
+ private static int DocumentIconGapLeft
+ {
+ get { return _DocumentIconGapLeft; }
+ }
+
+ private static int DocumentIconGapRight
+ {
+ get { return _DocumentIconGapRight; }
+ }
+
+ private static int DocumentIconWidth
+ {
+ get { return _DocumentIconWidth; }
+ }
+
+ private static int DocumentIconHeight
+ {
+ get { return _DocumentIconHeight; }
+ }
+
+ private static int DocumentTextGapRight
+ {
+ get { return _DocumentTextGapRight; }
+ }
+
+ private static Pen PenToolWindowTabBorder
+ {
+ get { return SystemPens.GrayText; }
+ }
+
+ private static Pen PenDocumentTabActiveBorder
+ {
+ get { return SystemPens.ControlDarkDark; }
+ }
+
+ private static Pen PenDocumentTabInactiveBorder
+ {
+ get { return SystemPens.GrayText; }
+ }
+ #endregion
+
+ public VS2005DockPaneStrip(DockPane pane) : base(pane)
+ {
+ SetStyle(ControlStyles.ResizeRedraw |
+ ControlStyles.UserPaint |
+ ControlStyles.AllPaintingInWmPaint |
+ ControlStyles.OptimizedDoubleBuffer, true);
+
+ SuspendLayout();
+
+ m_components = new Container();
+ m_toolTip = new ToolTip(Components);
+ m_selectMenu = new ContextMenuStrip(Components);
+
+ ResumeLayout();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Components.Dispose();
+ if (m_boldFont != null)
+ {
+ m_boldFont.Dispose();
+ m_boldFont = null;
+ }
+ }
+ base.Dispose (disposing);
+ }
+
+ private static Font TextFont
+ {
+ get { return SystemInformation.MenuFont; }
+ }
+
+ private Font m_font;
+ private Font m_boldFont;
+ private Font BoldFont
+ {
+ get
+ {
+ if (IsDisposed)
+ return null;
+
+ if (m_boldFont == null)
+ {
+ m_font = TextFont;
+ m_boldFont = new Font(TextFont, FontStyle.Bold);
+ }
+ else if (m_font != TextFont)
+ {
+ m_boldFont.Dispose();
+ m_font = TextFont;
+ m_boldFont = new Font(TextFont, FontStyle.Bold);
+ }
+
+ return m_boldFont;
+ }
+ }
+
+ private int m_startDisplayingTab = 0;
+ private int StartDisplayingTab
+ {
+ get { return m_startDisplayingTab; }
+ set
+ {
+ m_startDisplayingTab = value;
+ Invalidate();
+ }
+ }
+
+ private int m_endDisplayingTab = 0;
+ private int EndDisplayingTab
+ {
+ get { return m_endDisplayingTab; }
+ set { m_endDisplayingTab = value; }
+ }
+
+ private int m_firstDisplayingTab = 0;
+ private int FirstDisplayingTab
+ {
+ get { return m_firstDisplayingTab; }
+ set { m_firstDisplayingTab = value; }
+ }
+
+ private bool m_documentTabsOverflow = false;
+ private bool DocumentTabsOverflow
+ {
+ set
+ {
+ if (m_documentTabsOverflow == value)
+ return;
+
+ m_documentTabsOverflow = value;
+ if (value)
+ ButtonWindowList.ImageCategory = 1;
+ else
+ ButtonWindowList.ImageCategory = 0;
+ }
+ }
+
+ protected internal override int MeasureHeight()
+ {
+ if (Appearance == DockPane.AppearanceStyle.ToolWindow)
+ return MeasureHeight_ToolWindow();
+ else
+ return MeasureHeight_Document();
+ }
+
+ private int MeasureHeight_ToolWindow()
+ {
+ if (DockPane.IsAutoHide || Tabs.Count <= 1)
+ return 0;
+
+ int height = Math.Max(TextFont.Height, ToolWindowImageHeight + ToolWindowImageGapTop + ToolWindowImageGapBottom)
+ + ToolWindowStripGapTop + ToolWindowStripGapBottom;
+
+ return height;
+ }
+
+ private int MeasureHeight_Document()
+ {
+ int height = Math.Max(TextFont.Height + DocumentTabGapTop,
+ ButtonClose.Height + DocumentButtonGapTop + DocumentButtonGapBottom)
+ + DocumentStripGapBottom + DocumentStripGapTop;
+
+ return height;
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ Rectangle rect = TabsRectangle;
+
+ if (Appearance == DockPane.AppearanceStyle.Document)
+ {
+ rect.X -= DocumentTabGapLeft;
+
+ // Add these values back in so that the DockStrip color is drawn
+ // beneath the close button and window list button.
+ rect.Width += DocumentTabGapLeft +
+ DocumentTabGapRight +
+ DocumentButtonGapRight +
+ ButtonClose.Width +
+ ButtonWindowList.Width;
+
+ // It is possible depending on the DockPanel DocumentStyle to have
+ // a Document without a DockStrip.
+ if (rect.Width > 0 && rect.Height > 0)
+ {
+ Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.StartColor;
+ Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.EndColor;
+ LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.LinearGradientMode;
+ using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode))
+ {
+ e.Graphics.FillRectangle(brush, rect);
+ }
+ }
+ }
+ else
+ {
+ Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.StartColor;
+ Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.EndColor;
+ LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.LinearGradientMode;
+ using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode))
+ {
+ e.Graphics.FillRectangle(brush, rect);
+ }
+ }
+ base.OnPaint (e);
+ CalculateTabs();
+ if (Appearance == DockPane.AppearanceStyle.Document && DockPane.ActiveContent != null)
+ {
+ if (EnsureDocumentTabVisible(DockPane.ActiveContent, false))
+ CalculateTabs();
+ }
+
+ DrawTabStrip(e.Graphics);
+ }
+
+ protected override void OnRefreshChanges()
+ {
+ SetInertButtons();
+ Invalidate();
+ }
+
+ protected internal override GraphicsPath GetOutline(int index)
+ {
+
+ if (Appearance == DockPane.AppearanceStyle.Document)
+ return GetOutline_Document(index);
+ else
+ return GetOutline_ToolWindow(index);
+
+ }
+
+ private GraphicsPath GetOutline_Document(int index)
+ {
+ Rectangle rectTab = GetTabRectangle(index);
+ rectTab.X -= rectTab.Height / 2;
+ rectTab.Intersect(TabsRectangle);
+ rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
+ Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle);
+
+ GraphicsPath path = new GraphicsPath();
+ GraphicsPath pathTab = GetTabOutline_Document(Tabs[index], true, true, true);
+ path.AddPath(pathTab, true);
+
+ if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
+ {
+ path.AddLine(rectTab.Right, rectTab.Top, rectPaneClient.Right, rectTab.Top);
+ path.AddLine(rectPaneClient.Right, rectTab.Top, rectPaneClient.Right, rectPaneClient.Top);
+ path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Left, rectPaneClient.Top);
+ path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Left, rectTab.Top);
+ path.AddLine(rectPaneClient.Left, rectTab.Top, rectTab.Right, rectTab.Top);
+ }
+ else
+ {
+ path.AddLine(rectTab.Right, rectTab.Bottom, rectPaneClient.Right, rectTab.Bottom);
+ path.AddLine(rectPaneClient.Right, rectTab.Bottom, rectPaneClient.Right, rectPaneClient.Bottom);
+ path.AddLine(rectPaneClient.Right, rectPaneClient.Bottom, rectPaneClient.Left, rectPaneClient.Bottom);
+ path.AddLine(rectPaneClient.Left, rectPaneClient.Bottom, rectPaneClient.Left, rectTab.Bottom);
+ path.AddLine(rectPaneClient.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom);
+ }
+ return path;
+ }
+
+ private GraphicsPath GetOutline_ToolWindow(int index)
+ {
+ Rectangle rectTab = GetTabRectangle(index);
+ rectTab.Intersect(TabsRectangle);
+ rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
+ int y = rectTab.Top;
+ Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle);
+
+ GraphicsPath path = new GraphicsPath();
+ GraphicsPath pathTab = GetTabOutline(Tabs[index], true, true);
+ path.AddPath(pathTab, true);
+ path.AddLine(rectTab.Left, rectTab.Top, rectPaneClient.Left, rectTab.Top);
+ path.AddLine(rectPaneClient.Left, rectTab.Top, rectPaneClient.Left, rectPaneClient.Top);
+ path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Right, rectPaneClient.Top);
+ path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Right, rectTab.Top);
+ path.AddLine(rectPaneClient.Right, rectTab.Top, rectTab.Right, rectTab.Top);
+ return path;
+ }
+
+ private void CalculateTabs()
+ {
+ if (Appearance == DockPane.AppearanceStyle.ToolWindow)
+ CalculateTabs_ToolWindow();
+ else
+ CalculateTabs_Document();
+ }
+
+ private void CalculateTabs_ToolWindow()
+ {
+ if (Tabs.Count <= 1 || DockPane.IsAutoHide)
+ return;
+
+ Rectangle rectTabStrip = TabStripRectangle;
+
+ // Calculate tab widths
+ int countTabs = Tabs.Count;
+ foreach (TabVS2005 tab in Tabs)
+ {
+ tab.MaxWidth = GetMaxTabWidth(Tabs.IndexOf(tab));
+ tab.Flag = false;
+ }
+
+ // Set tab whose max width less than average width
+ bool anyWidthWithinAverage = true;
+ int totalWidth = rectTabStrip.Width - ToolWindowStripGapLeft - ToolWindowStripGapRight;
+ int totalAllocatedWidth = 0;
+ int averageWidth = totalWidth / countTabs;
+ int remainedTabs = countTabs;
+ for (anyWidthWithinAverage=true; anyWidthWithinAverage && remainedTabs>0;)
+ {
+ anyWidthWithinAverage = false;
+ foreach (TabVS2005 tab in Tabs)
+ {
+ if (tab.Flag)
+ continue;
+
+ if (tab.MaxWidth <= averageWidth)
+ {
+ tab.Flag = true;
+ tab.TabWidth = tab.MaxWidth;
+ totalAllocatedWidth += tab.TabWidth;
+ anyWidthWithinAverage = true;
+ remainedTabs--;
+ }
+ }
+ if (remainedTabs != 0)
+ averageWidth = (totalWidth - totalAllocatedWidth) / remainedTabs;
+ }
+
+ // If any tab width not set yet, set it to the average width
+ if (remainedTabs > 0)
+ {
+ int roundUpWidth = (totalWidth - totalAllocatedWidth) - (averageWidth * remainedTabs);
+ foreach (TabVS2005 tab in Tabs)
+ {
+ if (tab.Flag)
+ continue;
+
+ tab.Flag = true;
+ if (roundUpWidth > 0)
+ {
+ tab.TabWidth = averageWidth + 1;
+ roundUpWidth --;
+ }
+ else
+ tab.TabWidth = averageWidth;
+ }
+ }
+
+ // Set the X position of the tabs
+ int x = rectTabStrip.X + ToolWindowStripGapLeft;
+ foreach (TabVS2005 tab in Tabs)
+ {
+ tab.TabX = x;
+ x += tab.TabWidth;
+ }
+ }
+
+ private bool CalculateDocumentTab(Rectangle rectTabStrip, ref int x, int index)
+ {
+ bool overflow = false;
+
+ TabVS2005 tab = Tabs[index] as TabVS2005;
+ tab.MaxWidth = GetMaxTabWidth(index);
+ int width = Math.Min(tab.MaxWidth, DocumentTabMaxWidth);
+ if (x + width < rectTabStrip.Right || index == StartDisplayingTab)
+ {
+ tab.TabX = x;
+ tab.TabWidth = width;
+ EndDisplayingTab = index;
+ }
+ else
+ {
+ tab.TabX = 0;
+ tab.TabWidth = 0;
+ overflow = true;
+ }
+ x += width;
+
+ return overflow;
+ }
+
+ ///
+ /// Calculate which tabs are displayed and in what order.
+ ///
+ private void CalculateTabs_Document()
+ {
+ if (m_startDisplayingTab >= Tabs.Count)
+ m_startDisplayingTab = 0;
+
+ Rectangle rectTabStrip = TabsRectangle;
+
+ int x = rectTabStrip.X + rectTabStrip.Height / 2;
+ bool overflow = false;
+
+ // Originally all new documents that were considered overflow
+ // (not enough pane strip space to show all tabs) were added to
+ // the far left (assuming not right to left) and the tabs on the
+ // right were dropped from view. If StartDisplayingTab is not 0
+ // then we are dealing with making sure a specific tab is kept in focus.
+ if (m_startDisplayingTab > 0)
+ {
+ int tempX = x;
+ TabVS2005 tab = Tabs[m_startDisplayingTab] as TabVS2005;
+ tab.MaxWidth = GetMaxTabWidth(m_startDisplayingTab);
+ int width = Math.Min(tab.MaxWidth, DocumentTabMaxWidth);
+
+ // Add the active tab and tabs to the left
+ for (int i = StartDisplayingTab; i >= 0; i--)
+ CalculateDocumentTab(rectTabStrip, ref tempX, i);
+
+ // Store which tab is the first one displayed so that it
+ // will be drawn correctly (without part of the tab cut off)
+ FirstDisplayingTab = EndDisplayingTab;
+
+ tempX = x; // Reset X location because we are starting over
+
+ // Start with the first tab displayed - name is a little misleading.
+ // Loop through each tab and set its location. If there is not enough
+ // room for all of them overflow will be returned.
+ for (int i = EndDisplayingTab; i < Tabs.Count; i++)
+ overflow = CalculateDocumentTab(rectTabStrip, ref tempX, i);
+
+ // If not all tabs are shown then we have an overflow.
+ if (FirstDisplayingTab != 0)
+ overflow = true;
+ }
+ else
+ {
+ for (int i = StartDisplayingTab; i < Tabs.Count; i++)
+ overflow = CalculateDocumentTab(rectTabStrip, ref x, i);
+ for (int i = 0; i < StartDisplayingTab; i++)
+ overflow = CalculateDocumentTab(rectTabStrip, ref x, i);
+
+ FirstDisplayingTab = StartDisplayingTab;
+ }
+
+ if (!overflow)
+ {
+ m_startDisplayingTab = 0;
+ FirstDisplayingTab = 0;
+ x = rectTabStrip.X + rectTabStrip.Height / 2;
+ foreach (TabVS2005 tab in Tabs)
+ {
+ tab.TabX = x;
+ x += tab.TabWidth;
+ }
+ }
+ DocumentTabsOverflow = overflow;
+ }
+
+ protected internal override void EnsureTabVisible(IDockContent content)
+ {
+ if (Appearance != DockPane.AppearanceStyle.Document || !Tabs.Contains(content))
+ return;
+
+ CalculateTabs();
+ EnsureDocumentTabVisible(content, true);
+ }
+
+ private bool EnsureDocumentTabVisible(IDockContent content, bool repaint)
+ {
+ int index = Tabs.IndexOf(content);
+ TabVS2005 tab = Tabs[index] as TabVS2005;
+ if (tab.TabWidth != 0)
+ return false;
+
+ StartDisplayingTab = index;
+ if (repaint)
+ Invalidate();
+
+ return true;
+ }
+
+ private int GetMaxTabWidth(int index)
+ {
+ if (Appearance == DockPane.AppearanceStyle.ToolWindow)
+ return GetMaxTabWidth_ToolWindow(index);
+ else
+ return GetMaxTabWidth_Document(index);
+ }
+
+ private int GetMaxTabWidth_ToolWindow(int index)
+ {
+ IDockContent content = Tabs[index].Content;
+ Size sizeString = TextRenderer.MeasureText(content.DockHandler.TabText, TextFont);
+ return ToolWindowImageWidth + sizeString.Width + ToolWindowImageGapLeft
+ + ToolWindowImageGapRight + ToolWindowTextGapRight;
+ }
+
+ private int GetMaxTabWidth_Document(int index)
+ {
+ IDockContent content = Tabs[index].Content;
+
+ int height = GetTabRectangle_Document(index).Height;
+
+ Size sizeText = TextRenderer.MeasureText(content.DockHandler.TabText, BoldFont, new Size(DocumentTabMaxWidth, height), DocumentTextFormat);
+
+ if (DockPane.DockPanel.ShowDocumentIcon)
+ return sizeText.Width + DocumentIconWidth + DocumentIconGapLeft + DocumentIconGapRight + DocumentTextGapRight;
+ else
+ return sizeText.Width + DocumentIconGapLeft + DocumentTextGapRight;
+ }
+
+ private void DrawTabStrip(Graphics g)
+ {
+ if (Appearance == DockPane.AppearanceStyle.Document)
+ DrawTabStrip_Document(g);
+ else
+ DrawTabStrip_ToolWindow(g);
+ }
+
+ private void DrawTabStrip_Document(Graphics g)
+ {
+ int count = Tabs.Count;
+ if (count == 0)
+ return;
+
+ Rectangle rectTabStrip = TabStripRectangle;
+
+ // Draw the tabs
+ Rectangle rectTabOnly = TabsRectangle;
+ Rectangle rectTab = Rectangle.Empty;
+ TabVS2005 tabActive = null;
+ g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly));
+ for (int i=0; i tab.TabWidth)
+ toolTip = tab.Content.DockHandler.TabText;
+ }
+
+ if (m_toolTip.GetToolTip(this) != toolTip)
+ {
+ m_toolTip.Active = false;
+ m_toolTip.SetToolTip(this, toolTip);
+ m_toolTip.Active = true;
+ }
+
+ // requires further tracking of mouse hover behavior,
+ ResetMouseEventArgs();
+ }
+
+ protected override void OnRightToLeftChanged(EventArgs e)
+ {
+ base.OnRightToLeftChanged(e);
+ PerformLayout();
+ }
+ }
+}
diff --git a/trunk/Docking/VisibleNestedPaneCollection.cs b/source/Docking/VisibleNestedPaneCollection.cs
similarity index 97%
rename from trunk/Docking/VisibleNestedPaneCollection.cs
rename to source/Docking/VisibleNestedPaneCollection.cs
index 0f3ee73..0f59cfb 100644
--- a/trunk/Docking/VisibleNestedPaneCollection.cs
+++ b/source/Docking/VisibleNestedPaneCollection.cs
@@ -1,168 +1,168 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Docking
-{
- public sealed class VisibleNestedPaneCollection : ReadOnlyCollection
- {
- private NestedPaneCollection m_nestedPanes;
-
- internal VisibleNestedPaneCollection(NestedPaneCollection nestedPanes)
- : base(new List())
- {
- m_nestedPanes = nestedPanes;
- }
-
- public NestedPaneCollection NestedPanes
- {
- get { return m_nestedPanes; }
- }
-
- public INestedPanesContainer Container
- {
- get { return NestedPanes.Container; }
- }
-
- public DockState DockState
- {
- get { return NestedPanes.DockState; }
- }
-
- public bool IsFloat
- {
- get { return NestedPanes.IsFloat; }
- }
-
- internal void Refresh()
- {
- Items.Clear();
- for (int i=0; i IndexOf(pane); i--)
- {
- if (this[i].NestedDockingStatus.PreviousPane == pane)
- {
- lastNestedPane = this[i];
- break;
- }
- }
-
- if (lastNestedPane != null)
- {
- int indexLastNestedPane = IndexOf(lastNestedPane);
- Items.Remove(lastNestedPane);
- Items[IndexOf(pane)] = lastNestedPane;
- NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;
- lastNestedDock.SetDisplayingStatus(true, statusPane.DisplayingPreviousPane, statusPane.DisplayingAlignment, statusPane.DisplayingProportion);
- for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--)
- {
- NestedDockingStatus status = this[i].NestedDockingStatus;
- if (status.PreviousPane == pane)
- status.SetDisplayingStatus(true, lastNestedPane, status.DisplayingAlignment, status.DisplayingProportion);
- }
- }
- else
- Items.Remove(pane);
-
- statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5);
- }
-
- private void CalculateBounds()
- {
- if (Count == 0)
- return;
-
- this[0].NestedDockingStatus.SetDisplayingBounds(Container.DisplayingRectangle, Container.DisplayingRectangle, Rectangle.Empty);
-
- for (int i=1; i
+ {
+ private NestedPaneCollection m_nestedPanes;
+
+ internal VisibleNestedPaneCollection(NestedPaneCollection nestedPanes)
+ : base(new List())
+ {
+ m_nestedPanes = nestedPanes;
+ }
+
+ public NestedPaneCollection NestedPanes
+ {
+ get { return m_nestedPanes; }
+ }
+
+ public INestedPanesContainer Container
+ {
+ get { return NestedPanes.Container; }
+ }
+
+ public DockState DockState
+ {
+ get { return NestedPanes.DockState; }
+ }
+
+ public bool IsFloat
+ {
+ get { return NestedPanes.IsFloat; }
+ }
+
+ internal void Refresh()
+ {
+ Items.Clear();
+ for (int i=0; i IndexOf(pane); i--)
+ {
+ if (this[i].NestedDockingStatus.PreviousPane == pane)
+ {
+ lastNestedPane = this[i];
+ break;
+ }
+ }
+
+ if (lastNestedPane != null)
+ {
+ int indexLastNestedPane = IndexOf(lastNestedPane);
+ Items.Remove(lastNestedPane);
+ Items[IndexOf(pane)] = lastNestedPane;
+ NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;
+ lastNestedDock.SetDisplayingStatus(true, statusPane.DisplayingPreviousPane, statusPane.DisplayingAlignment, statusPane.DisplayingProportion);
+ for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--)
+ {
+ NestedDockingStatus status = this[i].NestedDockingStatus;
+ if (status.PreviousPane == pane)
+ status.SetDisplayingStatus(true, lastNestedPane, status.DisplayingAlignment, status.DisplayingProportion);
+ }
+ }
+ else
+ Items.Remove(pane);
+
+ statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5);
+ }
+
+ private void CalculateBounds()
+ {
+ if (Count == 0)
+ return;
+
+ this[0].NestedDockingStatus.SetDisplayingBounds(Container.DisplayingRectangle, Container.DisplayingRectangle, Rectangle.Empty);
+
+ for (int i=1; i
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.splitContainer1 = new System.Windows.Forms.SplitContainer();
- this.numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
- this.tvOutline = new System.Windows.Forms.TreeView();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.splitContainer1.Panel1.SuspendLayout();
- this.splitContainer1.Panel2.SuspendLayout();
- this.splitContainer1.SuspendLayout();
- this.SuspendLayout();
- //
- // tabControl1
- //
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl1.Location = new System.Drawing.Point(0, 0);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(560, 264);
- this.tabControl1.TabIndex = 1;
- this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
- //
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.splitContainer1);
- this.tabPage1.Location = new System.Drawing.Point(4, 22);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(552, 238);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "Script";
- this.tabPage1.UseVisualStyleBackColor = true;
- //
- // splitContainer1
- //
- this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.splitContainer1.Location = new System.Drawing.Point(3, 3);
- this.splitContainer1.Name = "splitContainer1";
- //
- // splitContainer1.Panel1
- //
- this.splitContainer1.Panel1.Controls.Add(this.numberedTextBoxUC1);
- this.splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
- //
- // splitContainer1.Panel2
- //
- this.splitContainer1.Panel2.Controls.Add(this.tvOutline);
- this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
- this.splitContainer1.RightToLeft = System.Windows.Forms.RightToLeft.No;
- this.splitContainer1.Size = new System.Drawing.Size(546, 232);
- this.splitContainer1.SplitterDistance = 397;
- this.splitContainer1.TabIndex = 7;
- //
- // numberedTextBoxUC1
- //
- this.numberedTextBoxUC1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.numberedTextBoxUC1.Location = new System.Drawing.Point(0, 0);
- this.numberedTextBoxUC1.Name = "numberedTextBoxUC1";
- this.numberedTextBoxUC1.Size = new System.Drawing.Size(393, 228);
- this.numberedTextBoxUC1.TabIndex = 4;
- //
- // tvOutline
- //
- this.tvOutline.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tvOutline.HotTracking = true;
- this.tvOutline.Location = new System.Drawing.Point(0, 0);
- this.tvOutline.Name = "tvOutline";
- this.tvOutline.Size = new System.Drawing.Size(141, 228);
- this.tvOutline.TabIndex = 6;
- this.tvOutline.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvOutline_AfterSelect);
- this.tvOutline.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvOutline_NodeMouseClick);
- this.tvOutline.VisibleChanged += new System.EventHandler(this.tvOutline_VisibleChanged);
- //
- // EditForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(560, 264);
- this.Controls.Add(this.tabControl1);
- this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.Name = "EditForm";
- this.Text = "EditForm";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditForm_FormClosing);
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.splitContainer1.Panel1.ResumeLayout(false);
- this.splitContainer1.Panel2.ResumeLayout(false);
- this.splitContainer1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.TabControl tabControl1;
- private System.Windows.Forms.TabPage tabPage1;
- private NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1;
- public System.Windows.Forms.TreeView tvOutline;
- public System.Windows.Forms.SplitContainer splitContainer1;
-
-
- }
+namespace LSLEditor
+{
+ partial class EditForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.tabControl1 = new System.Windows.Forms.TabControl();
+ this.tabPage1 = new System.Windows.Forms.TabPage();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
+ this.tvOutline = new System.Windows.Forms.TreeView();
+ this.tabControl1.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // tabControl1
+ //
+ this.tabControl1.Controls.Add(this.tabPage1);
+ this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tabControl1.Location = new System.Drawing.Point(0, 0);
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new System.Drawing.Size(560, 264);
+ this.tabControl1.TabIndex = 1;
+ this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
+ //
+ // tabPage1
+ //
+ this.tabPage1.Controls.Add(this.splitContainer1);
+ this.tabPage1.Location = new System.Drawing.Point(4, 22);
+ this.tabPage1.Name = "tabPage1";
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage1.Size = new System.Drawing.Size(552, 238);
+ this.tabPage1.TabIndex = 0;
+ this.tabPage1.Text = "Script";
+ this.tabPage1.UseVisualStyleBackColor = true;
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(3, 3);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.numberedTextBoxUC1);
+ this.splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.tvOutline);
+ this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
+ this.splitContainer1.RightToLeft = System.Windows.Forms.RightToLeft.No;
+ this.splitContainer1.Size = new System.Drawing.Size(546, 232);
+ this.splitContainer1.SplitterDistance = 397;
+ this.splitContainer1.TabIndex = 7;
+ //
+ // numberedTextBoxUC1
+ //
+ this.numberedTextBoxUC1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.numberedTextBoxUC1.Location = new System.Drawing.Point(0, 0);
+ this.numberedTextBoxUC1.Name = "numberedTextBoxUC1";
+ this.numberedTextBoxUC1.Size = new System.Drawing.Size(393, 228);
+ this.numberedTextBoxUC1.TabIndex = 4;
+ //
+ // tvOutline
+ //
+ this.tvOutline.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tvOutline.HotTracking = true;
+ this.tvOutline.Location = new System.Drawing.Point(0, 0);
+ this.tvOutline.Name = "tvOutline";
+ this.tvOutline.Size = new System.Drawing.Size(141, 228);
+ this.tvOutline.TabIndex = 6;
+ this.tvOutline.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvOutline_AfterSelect);
+ this.tvOutline.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvOutline_NodeMouseClick);
+ this.tvOutline.VisibleChanged += new System.EventHandler(this.tvOutline_VisibleChanged);
+ //
+ // EditForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(560, 264);
+ this.Controls.Add(this.tabControl1);
+ this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Name = "EditForm";
+ this.Text = "EditForm";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditForm_FormClosing);
+ this.tabControl1.ResumeLayout(false);
+ this.tabPage1.ResumeLayout(false);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TabControl tabControl1;
+ private System.Windows.Forms.TabPage tabPage1;
+ private NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1;
+ public System.Windows.Forms.TreeView tvOutline;
+ public System.Windows.Forms.SplitContainer splitContainer1;
+
+
+ }
}
\ No newline at end of file
diff --git a/trunk/EditForm.cs b/source/EditForm.cs
similarity index 96%
rename from trunk/EditForm.cs
rename to source/EditForm.cs
index 50b755e..302b092 100644
--- a/trunk/EditForm.cs
+++ b/source/EditForm.cs
@@ -1,638 +1,638 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.Xml;
-using System.Drawing;
-using System.Text;
-using System.Windows.Forms;
-using LSLEditor.Docking;
-using LSLEditor.Helpers;
-using System.Collections.Generic;
-
-namespace LSLEditor
-{
- public partial class EditForm : DockContent
- {
- public RuntimeConsole runtime;
-
- public List verboseQueue = new List();
-
- private string m_FullPathName;
- private Guid m_Guid;
- // private bool sOutline = true;
- public LSLEditorForm parent;
- public Encoding encodedAs = null;
-
- private const int WM_NCACTIVATE = 0x0086;
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == WM_NCACTIVATE) {
- if (m.LParam != IntPtr.Zero) {
- m.WParam = new IntPtr(1);
- } else {
- this.numberedTextBoxUC1.TextBox.MakeAllInvis();
- }
- }
- try { base.WndProc(ref m); } catch { }
- }
-
- public SyntaxRichTextBox TextBox
- {
- get
- {
- return this.numberedTextBoxUC1.TextBox;
- }
- }
-
- public XmlDocument ConfLSL
- {
- get
- {
- return this.parent.ConfLSL;
- }
- }
-
- public XmlDocument ConfCSharp
- {
- get
- {
- return this.parent.ConfCSharp;
- }
- }
-
- public Guid guid
- {
- get
- {
- return m_Guid;
- }
- set
- {
- this.m_Guid = value;
- }
- }
-
- public bool IsScript
- {
- get
- {
- return this.TextBox.ToolTipping;
- }
- set
- {
- if (value) {
- this.tabPage1.Text = "Script";
- } else {
- this.tabPage1.Text = "Text";
- }
- this.TextBox.ToolTipping = value;
- }
- }
-
- public EditForm(LSLEditorForm lslEditorForm)
- {
- InitializeComponent();
-
- this.guid = new Guid();
-
- this.components = new System.ComponentModel.Container();
-
- this.Icon = lslEditorForm.Icon;
- this.parent = lslEditorForm;
- this.numberedTextBoxUC1.TextBox.setEditform(this);
- this.numberedTextBoxUC1.TextBox.Init(this.parent, this.parent.ConfLSL);
- this.numberedTextBoxUC1.TextBox.OnDirtyChanged += new IsDirtyHandler(TextBox_OnDirtyChanged);
-
- this.Move += new EventHandler(EditForm_Position);
- this.Resize += new EventHandler(EditForm_Position);
-
- this.Layout += new LayoutEventHandler(EditForm_Layout);
- ImageList imageList = new ImageList();
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.Unknown.gif"));
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.Functions.gif"));
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.Events.gif"));
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.Constants.gif"));
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.Class.gif"));
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.Vars.gif"));
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.Properties.gif"));
- imageList.Images.Add(new Bitmap(this.GetType(), "Images.States.gif"));
-
- this.tvOutline.ImageList = imageList;
- if (lslEditorForm.outlineToolStripMenuItem.Checked) {
- splitContainer1.Panel2Collapsed = false;
- } else {
- splitContainer1.Panel2Collapsed = true;
- }
- SetFont();
- }
-
- public void SetFont()
- {
- this.numberedTextBoxUC1.Font = Properties.Settings.Default.FontEditor;
- }
-
- void EditForm_Layout(object sender, LayoutEventArgs e)
- {
- if (this.WindowState == FormWindowState.Minimized) {
- this.numberedTextBoxUC1.TextBox.MakeAllInvis();
- }
- }
-
- void EditForm_Position(object sender, EventArgs e)
- {
- //this.numberedTextBoxUC1.TextBox.SetPosition(this.MdiParent.RectangleToScreen(this.MdiParent.ClientRectangle));
- }
-
- void TextBox_OnDirtyChanged(object sender, EventArgs e)
- {
- if(parent.IsReadOnly(this))
- {
- Dirty = false;
- return;
- }
- if(this.Text == null || this.ScriptName == null)
- {
- this.Text = this.ScriptName;
- }
- if (LSLIPathHelper.GetExpandedTabName(this.ScriptName) == this.Text)
- {
- if (this.numberedTextBoxUC1.TextBox.Dirty)
- {
- this.Text = this.Text.Trim() + "* ";
-
- }
- }
- else
- {
- this.Text = this.ScriptName;
- if (this.numberedTextBoxUC1.TextBox.Dirty) {
- this.Text = this.Text.Trim() + "* ";
- } else {
- this.Text = this.Text.Trim() + " ";
- }
- }
-
- TabPage tabPage = this.Tag as TabPage;
- if (tabPage != null) {
- tabPage.Text = this.Text;
- }
-
- this.parent.OnDirtyChanged(this.numberedTextBoxUC1.TextBox.Dirty);
- }
-
- private void exitToolStripMenuItem_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- public string FullPathName
- {
- get
- {
- return this.m_FullPathName;
- }
- set
- {
- this.m_FullPathName = value;
- string strDirectory = Path.GetDirectoryName(this.m_FullPathName);
- if (Directory.Exists(strDirectory)) {
- Properties.Settings.Default.WorkingDirectory = strDirectory;
- } else {
- if (!Directory.Exists(Properties.Settings.Default.WorkingDirectory)) {
- Properties.Settings.Default.WorkingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
- }
- this.m_FullPathName = Path.Combine(Properties.Settings.Default.WorkingDirectory, this.m_FullPathName);
- }
- this.Text = this.ScriptName;
- TabPage tabPage = this.Tag as TabPage;
- if (tabPage != null) {
- tabPage.Text = this.Text + " ";
- }
- }
- }
-
- public string ScriptName
- {
- get
- {
- return Path.GetFileName(this.m_FullPathName);
- }
- }
-
- public string ProjectName
- {
- get
- {
- return parent.SolutionExplorer.GetProjectName(this.guid);
- }
- }
-
- public string SourceCode
- {
- get
- {
- return this.numberedTextBoxUC1.TextBox.Text;
- }
- set
- {
- this.numberedTextBoxUC1.TextBox.Text = value;
- }
- }
-
- private int PercentageIndentTab()
- {
- int intResult;
- int intSpaces = 0;
- int intTabs = 0;
- StringReader sr = new StringReader(this.TextBox.Text);
- while (true) {
- string strLine = sr.ReadLine();
- if (strLine == null) break;
- if (strLine.Length == 0) continue;
- if (strLine[0] == ' ') {
- intSpaces++;
- } else if (strLine[0] == '\t') {
- intTabs++;
- }
- }
- if (intTabs == 0 && intSpaces == 0) {
- intResult = 50;
- } else {
- intResult = (int)Math.Round((100.0 * intTabs) / (intTabs + intSpaces));
- }
- return intResult;
- }
-
- public void LoadFile(string strPath)
- {
- if (strPath.StartsWith("http://")) {
- this.FullPathName = Path.GetFileName(strPath);
- } else {
- this.FullPathName = strPath;
- }
- this.encodedAs = this.numberedTextBoxUC1.TextBox.LoadFile(strPath);
-
- if (this.IsScript) {
-
- if (Properties.Settings.Default.IndentAutoCorrect) {
- this.TextBox.FormatDocument();
- this.TextBox.ClearUndoStack();
- } else {
- if (Properties.Settings.Default.IndentWarning) {
- if ((PercentageIndentTab() > 50 && Properties.Settings.Default.SL4SpacesIndent) ||
- (PercentageIndentTab() < 50 && !Properties.Settings.Default.SL4SpacesIndent)) {
- if (MessageBox.Show("Indent scheme differs from settings\nDo you want to correct it?\nIt can also be corrected by pressing Ctrl-D or turn on Autocorrection (tools menu)", "Indent Warning!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) {
- this.TextBox.FormatDocument();
- //this.TextBox.ClearUndoStack();
- }
- }
- }
- }
- }
- }
-
- public void SaveCurrentFile(string strPath)
- {
- // Check if this is an expanded.lsl
- if (!LSLIPathHelper.IsExpandedLSL(strPath))
- {
- this.FullPathName = strPath;
- Encoding encodeAs = this.encodedAs;
- if (this.IsScript && encodeAs == null)
- {
- switch (Properties.Settings.Default.OutputFormat)
- {
- case "UTF8":
- encodeAs = Encoding.UTF8;
- break;
- case "Unicode":
- encodeAs = Encoding.Unicode;
- break;
- case "BigEndianUnicode":
- encodeAs = Encoding.BigEndianUnicode;
- break;
- default:
- encodeAs = Encoding.Default;
- break;
- }
- }
- else if (encodeAs == null)
- {
- encodeAs = Encoding.UTF8;
- }
-
- this.numberedTextBoxUC1.TextBox.SaveCurrentFile(strPath, encodeAs);
- this.encodedAs = encodeAs;
-
- } else if (LSLIPathHelper.IsExpandedLSL(strPath))
- {
- string LSLIfilePath = LSLIPathHelper.CreateCollapsedPathAndScriptName(strPath);
- // Check if an LSLI version of this script exists
- if (File.Exists(LSLIfilePath))
- {
- // Save the LSLI file as well
- File.WriteAllText(LSLIfilePath, LSLIConverter.CollapseToLSLI(this.numberedTextBoxUC1.TextBox.Text));
- EditForm form = null;
-
- // If it's currently open, then refresh it
- for (int i = 0; i < Application.OpenForms.Count; i++)
- {
- Form openForm = Application.OpenForms[i];
- string filename = LSLIPathHelper.TrimStarsAndWhiteSpace(openForm.Text);
- if (filename == Path.GetFileName(LSLIfilePath))
- {
- form = (EditForm)openForm;
- }
- }
-
- if (form != null && form.Enabled)
- {
- parent.OpenFile(LSLIfilePath, Guid.NewGuid(), true);
- form.Close();
- }
- }
- this.numberedTextBoxUC1.TextBox.Dirty = false;
- this.Text = LSLIPathHelper.GetExpandedTabName(strPath);
- }
- }
-
- public void SaveCurrentFile()
- {
- this.SaveCurrentFile(this.FullPathName);
- }
-
- public bool Dirty
- {
- get
- {
- return this.numberedTextBoxUC1.TextBox.Dirty;
- }
- set
- {
- this.numberedTextBoxUC1.TextBox.Dirty = value;
- }
- }
-
- public TabControl tabControl
- {
- get
- {
- return this.tabControl1;
- }
- }
-
- public void SetFocus()
- {
- this.numberedTextBoxUC1.TextBox.Focus();
- }
-
- public void StopCompiler()
- {
- this.numberedTextBoxUC1.TextBox.MakeAllInvis();
-
- if (runtime != null) {
- this.components.Remove(runtime);
- if (!runtime.IsDisposed) {
- runtime.Dispose();
- }
- runtime = null;
- }
-
- for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) {
- this.tabControl1.TabPages.RemoveAt(intI);
- }
- }
-
- public SecondLifeHost.SecondLifeHostChatHandler ChatHandler;
- public SecondLifeHost.SecondLifeHostMessageLinkedHandler MessageLinkedHandler;
-
- public bool StartCompiler()
- {
- bool blnResult = false;
- //if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked)
- // return false;
-
- if (this.IsScript) {
- StopCompiler();
-
- if (this.parent != null) {
- runtime = new RuntimeConsole(this.parent);
-
- // for disposing
- this.components.Add(runtime);
-
- foreach (string message in verboseQueue)
- {
- runtime.VerboseConsole(message);
-
- if (message.StartsWith("Error: "))
- {
- StopCompiler();
- this.tabControl1.SelectedIndex = 0;
- verboseQueue = new List();
- return false;
- }
- }
-
- if (!runtime.Compile(this)) {
- this.tabControl1.SelectedIndex = 0;
- return false;
- }
-
-
- TabPage tabPage = new TabPage("Debug");
- tabPage.Controls.Add(runtime);
- this.tabControl1.TabPages.Add(tabPage);
- this.tabControl1.SelectedIndex = 1;
- blnResult = true;
- }
- }
- return blnResult;
- }
-
- public bool SyntaxCheck()
- {
- bool blnResult = false;
- //if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked)
- // return false;
-
- if (this.IsScript) {
- string lsl = SourceCode;
-
- // If it is LSLI, it needs to import scripts first, before it recognizes imported functions
- if (LSLIPathHelper.IsLSLI(this.FullPathName))
- {
- LSLIConverter converter = new LSLIConverter();
- lsl = converter.ExpandToLSL(this);
- }
-
- LSL2CSharp translator = new LSL2CSharp(ConfLSL);
- string strCSharp = translator.Parse(lsl);
-
- if (System.Diagnostics.Debugger.IsAttached) {
- for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) {
- this.tabControl1.TabPages.RemoveAt(intI);
- }
-
- // TODO
- TabPage tabPage = new TabPage("C#");
- NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
- numberedTextBoxUC1.TextBox.Init(null, this.ConfCSharp);
- numberedTextBoxUC1.TextBox.Text = strCSharp;
- numberedTextBoxUC1.TextBox.ReadOnly = true;
- numberedTextBoxUC1.Dock = DockStyle.Fill;
- tabPage.Controls.Add(numberedTextBoxUC1);
- this.tabControl.TabPages.Add(tabPage);
- }
- blnResult = (null != CompilerHelper.CompileCSharp(this, strCSharp));
- }
- return blnResult;
- }
-
- public int Find(string strSearch, int intStart, int intEnd, RichTextBoxFinds options)
- {
- intStart = this.numberedTextBoxUC1.TextBox.Find(strSearch, intStart, intEnd, options);
- this.numberedTextBoxUC1.TextBox.Focus();
- return intStart;
- }
-
- private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.MakeAllInvis();
- }
-
- private void EditForm_FormClosing(object sender, FormClosingEventArgs e)
- {
- this.parent.CancelClosing = false;
- if (this.Dirty) {
- string scriptToSave = ScriptName;
- if (LSLIPathHelper.IsExpandedLSL(ScriptName))
- {
- // Expanded scripts will always be saved as LSLI's
- scriptToSave = LSLIPathHelper.CreateCollapsedScriptName(scriptToSave);
- }
-
- DialogResult dialogResult = MessageBox.Show(this, @"Save """ + scriptToSave + @"""?", "File has changed", MessageBoxButtons.YesNoCancel);
- if (dialogResult == DialogResult.Yes) {
- e.Cancel = !this.parent.SaveFile(this, false);
- } else {
- e.Cancel = (dialogResult == DialogResult.Cancel);
- }
- }
-
- if (!e.Cancel)
- {
- // Close related readonly's if this is an expanded script
- if (LSLIPathHelper.IsExpandedLSL(ScriptName))
- {
- // Check if a LSLI readonly is open
- EditForm readOnlyLSLI = (EditForm)parent.GetForm(Path.GetFileName(LSLIPathHelper.GetReadOnlyTabName(ScriptName)));
-
- if (readOnlyLSLI != null)
- {
- readOnlyLSLI.Close();
- }
- }
-
- if(!this.parent.IsReadOnly(this)) // If this is not a readonly (LSLI)
- {
- // Delete expanded file when closing
- string expandedFile = LSLIPathHelper.CreateExpandedPathAndScriptName(FullPathName);
- EditForm expandedForm = (EditForm)parent.GetForm(LSLIPathHelper.GetExpandedTabName(Path.GetFileName(expandedFile)));
-
- if (expandedForm != null && !LSLIPathHelper.IsExpandedLSL(ScriptName))
- {
- expandedForm.Close();
- }
-
- if (File.Exists(expandedFile))
- {
- File.Delete(expandedFile);
- }
- }
- }
- this.parent.CancelClosing = e.Cancel;
- }
-
- private void disableCompilesyntaxCheckToolStripMenuItem_Click(object sender, EventArgs e)
- {
- //this.disableCompilesyntaxCheckToolStripMenuItem.Checked = !this.disableCompilesyntaxCheckToolStripMenuItem.Checked;
- }
-
- private void tvOutline_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- this.parent.BeginInvoke(new TreeNodeMouseClickEventHandler(
- delegate(object sender2, TreeNodeMouseClickEventArgs e2)
- {
- if (e.Node.Tag is Helpers.OutlineHelper) {
- Helpers.OutlineHelper ohOutline = (Helpers.OutlineHelper)e.Node.Tag;
- if (ohOutline.line < this.TextBox.Lines.Length) {
- //editForm.Focus();
- //editForm.TextBox.Select();
- //editForm.TextBox.Goto(ohOutline.line + 1);
-
- //TextBox.Focus();
- this.TextBox.Select();
- this.TextBox.SelectionStart = this.TextBox.GetFirstCharIndexFromLine(ohOutline.line);
-
-
- }
- }
- }), sender, e);
- }
-
- private void tvOutline_AfterSelect(object sender, TreeViewEventArgs e)
- {
-
- //this.TextBox.Select
- }
-
- private void splitContainer1_Click(object sender, EventArgs e)
- {
-
- }
-
- private void tvOutline_VisibleChanged(object sender, EventArgs e)
- {
- this.tvOutline.ExpandAll();
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using LSLEditor.Docking;
+using LSLEditor.Helpers;
+using System.Collections.Generic;
+
+namespace LSLEditor
+{
+ public partial class EditForm : DockContent
+ {
+ public RuntimeConsole runtime;
+
+ public List verboseQueue = new List();
+
+ private string m_FullPathName;
+ private Guid m_Guid;
+ // private bool sOutline = true;
+ public LSLEditorForm parent;
+ public Encoding encodedAs = null;
+
+ private const int WM_NCACTIVATE = 0x0086;
+ protected override void WndProc(ref Message m)
+ {
+ if (m.Msg == WM_NCACTIVATE) {
+ if (m.LParam != IntPtr.Zero) {
+ m.WParam = new IntPtr(1);
+ } else {
+ this.numberedTextBoxUC1.TextBox.MakeAllInvis();
+ }
+ }
+ try { base.WndProc(ref m); } catch { }
+ }
+
+ public SyntaxRichTextBox TextBox
+ {
+ get
+ {
+ return this.numberedTextBoxUC1.TextBox;
+ }
+ }
+
+ public XmlDocument ConfLSL
+ {
+ get
+ {
+ return this.parent.ConfLSL;
+ }
+ }
+
+ public XmlDocument ConfCSharp
+ {
+ get
+ {
+ return this.parent.ConfCSharp;
+ }
+ }
+
+ public Guid guid
+ {
+ get
+ {
+ return m_Guid;
+ }
+ set
+ {
+ this.m_Guid = value;
+ }
+ }
+
+ public bool IsScript
+ {
+ get
+ {
+ return this.TextBox.ToolTipping;
+ }
+ set
+ {
+ if (value) {
+ this.tabPage1.Text = "Script";
+ } else {
+ this.tabPage1.Text = "Text";
+ }
+ this.TextBox.ToolTipping = value;
+ }
+ }
+
+ public EditForm(LSLEditorForm lslEditorForm)
+ {
+ InitializeComponent();
+
+ this.guid = new Guid();
+
+ this.components = new System.ComponentModel.Container();
+
+ this.Icon = lslEditorForm.Icon;
+ this.parent = lslEditorForm;
+ this.numberedTextBoxUC1.TextBox.setEditform(this);
+ this.numberedTextBoxUC1.TextBox.Init(this.parent, this.parent.ConfLSL);
+ this.numberedTextBoxUC1.TextBox.OnDirtyChanged += new IsDirtyHandler(TextBox_OnDirtyChanged);
+
+ this.Move += new EventHandler(EditForm_Position);
+ this.Resize += new EventHandler(EditForm_Position);
+
+ this.Layout += new LayoutEventHandler(EditForm_Layout);
+ ImageList imageList = new ImageList();
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.Unknown.gif"));
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.Functions.gif"));
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.Events.gif"));
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.Constants.gif"));
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.Class.gif"));
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.Vars.gif"));
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.Properties.gif"));
+ imageList.Images.Add(new Bitmap(this.GetType(), "Images.States.gif"));
+
+ this.tvOutline.ImageList = imageList;
+ if (lslEditorForm.outlineToolStripMenuItem.Checked) {
+ splitContainer1.Panel2Collapsed = false;
+ } else {
+ splitContainer1.Panel2Collapsed = true;
+ }
+ SetFont();
+ }
+
+ public void SetFont()
+ {
+ this.numberedTextBoxUC1.Font = Properties.Settings.Default.FontEditor;
+ }
+
+ void EditForm_Layout(object sender, LayoutEventArgs e)
+ {
+ if (this.WindowState == FormWindowState.Minimized) {
+ this.numberedTextBoxUC1.TextBox.MakeAllInvis();
+ }
+ }
+
+ void EditForm_Position(object sender, EventArgs e)
+ {
+ //this.numberedTextBoxUC1.TextBox.SetPosition(this.MdiParent.RectangleToScreen(this.MdiParent.ClientRectangle));
+ }
+
+ void TextBox_OnDirtyChanged(object sender, EventArgs e)
+ {
+ if(parent.IsReadOnly(this))
+ {
+ Dirty = false;
+ return;
+ }
+ if(this.Text == null || this.ScriptName == null)
+ {
+ this.Text = this.ScriptName;
+ }
+ if (LSLIPathHelper.GetExpandedTabName(this.ScriptName) == this.Text)
+ {
+ if (this.numberedTextBoxUC1.TextBox.Dirty)
+ {
+ this.Text = this.Text.Trim() + "* ";
+
+ }
+ }
+ else
+ {
+ this.Text = this.ScriptName;
+ if (this.numberedTextBoxUC1.TextBox.Dirty) {
+ this.Text = this.Text.Trim() + "* ";
+ } else {
+ this.Text = this.Text.Trim() + " ";
+ }
+ }
+
+ TabPage tabPage = this.Tag as TabPage;
+ if (tabPage != null) {
+ tabPage.Text = this.Text;
+ }
+
+ this.parent.OnDirtyChanged(this.numberedTextBoxUC1.TextBox.Dirty);
+ }
+
+ private void exitToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ public string FullPathName
+ {
+ get
+ {
+ return this.m_FullPathName;
+ }
+ set
+ {
+ this.m_FullPathName = value;
+ string strDirectory = Path.GetDirectoryName(this.m_FullPathName);
+ if (Directory.Exists(strDirectory)) {
+ Properties.Settings.Default.WorkingDirectory = strDirectory;
+ } else {
+ if (!Directory.Exists(Properties.Settings.Default.WorkingDirectory)) {
+ Properties.Settings.Default.WorkingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
+ }
+ this.m_FullPathName = Path.Combine(Properties.Settings.Default.WorkingDirectory, this.m_FullPathName);
+ }
+ this.Text = this.ScriptName;
+ TabPage tabPage = this.Tag as TabPage;
+ if (tabPage != null) {
+ tabPage.Text = this.Text + " ";
+ }
+ }
+ }
+
+ public string ScriptName
+ {
+ get
+ {
+ return Path.GetFileName(this.m_FullPathName);
+ }
+ }
+
+ public string ProjectName
+ {
+ get
+ {
+ return parent.SolutionExplorer.GetProjectName(this.guid);
+ }
+ }
+
+ public string SourceCode
+ {
+ get
+ {
+ return this.numberedTextBoxUC1.TextBox.Text;
+ }
+ set
+ {
+ this.numberedTextBoxUC1.TextBox.Text = value;
+ }
+ }
+
+ private int PercentageIndentTab()
+ {
+ int intResult;
+ int intSpaces = 0;
+ int intTabs = 0;
+ StringReader sr = new StringReader(this.TextBox.Text);
+ while (true) {
+ string strLine = sr.ReadLine();
+ if (strLine == null) break;
+ if (strLine.Length == 0) continue;
+ if (strLine[0] == ' ') {
+ intSpaces++;
+ } else if (strLine[0] == '\t') {
+ intTabs++;
+ }
+ }
+ if (intTabs == 0 && intSpaces == 0) {
+ intResult = 50;
+ } else {
+ intResult = (int)Math.Round((100.0 * intTabs) / (intTabs + intSpaces));
+ }
+ return intResult;
+ }
+
+ public void LoadFile(string strPath)
+ {
+ if (strPath.StartsWith("http://")) {
+ this.FullPathName = Path.GetFileName(strPath);
+ } else {
+ this.FullPathName = strPath;
+ }
+ this.encodedAs = this.numberedTextBoxUC1.TextBox.LoadFile(strPath);
+
+ if (this.IsScript) {
+
+ if (Properties.Settings.Default.IndentAutoCorrect) {
+ this.TextBox.FormatDocument();
+ this.TextBox.ClearUndoStack();
+ } else {
+ if (Properties.Settings.Default.IndentWarning) {
+ if ((PercentageIndentTab() > 50 && Properties.Settings.Default.SL4SpacesIndent) ||
+ (PercentageIndentTab() < 50 && !Properties.Settings.Default.SL4SpacesIndent)) {
+ if (MessageBox.Show("Indent scheme differs from settings\nDo you want to correct it?\nIt can also be corrected by pressing Ctrl-D or turn on Autocorrection (tools menu)", "Indent Warning!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) {
+ this.TextBox.FormatDocument();
+ //this.TextBox.ClearUndoStack();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void SaveCurrentFile(string strPath)
+ {
+ // Check if this is an expanded.lsl
+ if (!LSLIPathHelper.IsExpandedLSL(strPath))
+ {
+ this.FullPathName = strPath;
+ Encoding encodeAs = this.encodedAs;
+ if (this.IsScript && encodeAs == null)
+ {
+ switch (Properties.Settings.Default.OutputFormat)
+ {
+ case "UTF8":
+ encodeAs = Encoding.UTF8;
+ break;
+ case "Unicode":
+ encodeAs = Encoding.Unicode;
+ break;
+ case "BigEndianUnicode":
+ encodeAs = Encoding.BigEndianUnicode;
+ break;
+ default:
+ encodeAs = Encoding.Default;
+ break;
+ }
+ }
+ else if (encodeAs == null)
+ {
+ encodeAs = Encoding.UTF8;
+ }
+
+ this.numberedTextBoxUC1.TextBox.SaveCurrentFile(strPath, encodeAs);
+ this.encodedAs = encodeAs;
+
+ } else if (LSLIPathHelper.IsExpandedLSL(strPath))
+ {
+ string LSLIfilePath = LSLIPathHelper.CreateCollapsedPathAndScriptName(strPath);
+ // Check if an LSLI version of this script exists
+ if (File.Exists(LSLIfilePath))
+ {
+ // Save the LSLI file as well
+ File.WriteAllText(LSLIfilePath, LSLIConverter.CollapseToLSLI(this.numberedTextBoxUC1.TextBox.Text));
+ EditForm form = null;
+
+ // If it's currently open, then refresh it
+ for (int i = 0; i < Application.OpenForms.Count; i++)
+ {
+ Form openForm = Application.OpenForms[i];
+ string filename = LSLIPathHelper.TrimStarsAndWhiteSpace(openForm.Text);
+ if (filename == Path.GetFileName(LSLIfilePath))
+ {
+ form = (EditForm)openForm;
+ }
+ }
+
+ if (form != null && form.Enabled)
+ {
+ parent.OpenFile(LSLIfilePath, Guid.NewGuid(), true);
+ form.Close();
+ }
+ }
+ this.numberedTextBoxUC1.TextBox.Dirty = false;
+ this.Text = LSLIPathHelper.GetExpandedTabName(strPath);
+ }
+ }
+
+ public void SaveCurrentFile()
+ {
+ this.SaveCurrentFile(this.FullPathName);
+ }
+
+ public bool Dirty
+ {
+ get
+ {
+ return this.numberedTextBoxUC1.TextBox.Dirty;
+ }
+ set
+ {
+ this.numberedTextBoxUC1.TextBox.Dirty = value;
+ }
+ }
+
+ public TabControl tabControl
+ {
+ get
+ {
+ return this.tabControl1;
+ }
+ }
+
+ public void SetFocus()
+ {
+ this.numberedTextBoxUC1.TextBox.Focus();
+ }
+
+ public void StopCompiler()
+ {
+ this.numberedTextBoxUC1.TextBox.MakeAllInvis();
+
+ if (runtime != null) {
+ this.components.Remove(runtime);
+ if (!runtime.IsDisposed) {
+ runtime.Dispose();
+ }
+ runtime = null;
+ }
+
+ for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) {
+ this.tabControl1.TabPages.RemoveAt(intI);
+ }
+ }
+
+ public SecondLifeHost.SecondLifeHostChatHandler ChatHandler;
+ public SecondLifeHost.SecondLifeHostMessageLinkedHandler MessageLinkedHandler;
+
+ public bool StartCompiler()
+ {
+ bool blnResult = false;
+ //if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked)
+ // return false;
+
+ if (this.IsScript) {
+ StopCompiler();
+
+ if (this.parent != null) {
+ runtime = new RuntimeConsole(this.parent);
+
+ // for disposing
+ this.components.Add(runtime);
+
+ foreach (string message in verboseQueue)
+ {
+ runtime.VerboseConsole(message);
+
+ if (message.StartsWith("Error: "))
+ {
+ StopCompiler();
+ this.tabControl1.SelectedIndex = 0;
+ verboseQueue = new List();
+ return false;
+ }
+ }
+
+ if (!runtime.Compile(this)) {
+ this.tabControl1.SelectedIndex = 0;
+ return false;
+ }
+
+
+ TabPage tabPage = new TabPage("Debug");
+ tabPage.Controls.Add(runtime);
+ this.tabControl1.TabPages.Add(tabPage);
+ this.tabControl1.SelectedIndex = 1;
+ blnResult = true;
+ }
+ }
+ return blnResult;
+ }
+
+ public bool SyntaxCheck()
+ {
+ bool blnResult = false;
+ //if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked)
+ // return false;
+
+ if (this.IsScript) {
+ string lsl = SourceCode;
+
+ // If it is LSLI, it needs to import scripts first, before it recognizes imported functions
+ if (LSLIPathHelper.IsLSLI(this.FullPathName))
+ {
+ LSLIConverter converter = new LSLIConverter();
+ lsl = converter.ExpandToLSL(this);
+ }
+
+ LSL2CSharp translator = new LSL2CSharp(ConfLSL);
+ string strCSharp = translator.Parse(lsl);
+
+ if (System.Diagnostics.Debugger.IsAttached) {
+ for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) {
+ this.tabControl1.TabPages.RemoveAt(intI);
+ }
+
+ // TODO
+ TabPage tabPage = new TabPage("C#");
+ NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
+ numberedTextBoxUC1.TextBox.Init(null, this.ConfCSharp);
+ numberedTextBoxUC1.TextBox.Text = strCSharp;
+ numberedTextBoxUC1.TextBox.ReadOnly = true;
+ numberedTextBoxUC1.Dock = DockStyle.Fill;
+ tabPage.Controls.Add(numberedTextBoxUC1);
+ this.tabControl.TabPages.Add(tabPage);
+ }
+ blnResult = (null != CompilerHelper.CompileCSharp(this, strCSharp));
+ }
+ return blnResult;
+ }
+
+ public int Find(string strSearch, int intStart, int intEnd, RichTextBoxFinds options)
+ {
+ intStart = this.numberedTextBoxUC1.TextBox.Find(strSearch, intStart, intEnd, options);
+ this.numberedTextBoxUC1.TextBox.Focus();
+ return intStart;
+ }
+
+ private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.MakeAllInvis();
+ }
+
+ private void EditForm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ this.parent.CancelClosing = false;
+ if (this.Dirty) {
+ string scriptToSave = ScriptName;
+ if (LSLIPathHelper.IsExpandedLSL(ScriptName))
+ {
+ // Expanded scripts will always be saved as LSLI's
+ scriptToSave = LSLIPathHelper.CreateCollapsedScriptName(scriptToSave);
+ }
+
+ DialogResult dialogResult = MessageBox.Show(this, @"Save """ + scriptToSave + @"""?", "File has changed", MessageBoxButtons.YesNoCancel);
+ if (dialogResult == DialogResult.Yes) {
+ e.Cancel = !this.parent.SaveFile(this, false);
+ } else {
+ e.Cancel = (dialogResult == DialogResult.Cancel);
+ }
+ }
+
+ if (!e.Cancel)
+ {
+ // Close related readonly's if this is an expanded script
+ if (LSLIPathHelper.IsExpandedLSL(ScriptName))
+ {
+ // Check if a LSLI readonly is open
+ EditForm readOnlyLSLI = (EditForm)parent.GetForm(Path.GetFileName(LSLIPathHelper.GetReadOnlyTabName(ScriptName)));
+
+ if (readOnlyLSLI != null)
+ {
+ readOnlyLSLI.Close();
+ }
+ }
+
+ if(!this.parent.IsReadOnly(this)) // If this is not a readonly (LSLI)
+ {
+ // Delete expanded file when closing
+ string expandedFile = LSLIPathHelper.CreateExpandedPathAndScriptName(FullPathName);
+ EditForm expandedForm = (EditForm)parent.GetForm(LSLIPathHelper.GetExpandedTabName(Path.GetFileName(expandedFile)));
+
+ if (expandedForm != null && !LSLIPathHelper.IsExpandedLSL(ScriptName))
+ {
+ expandedForm.Close();
+ }
+
+ if (File.Exists(expandedFile))
+ {
+ File.Delete(expandedFile);
+ }
+ }
+ }
+ this.parent.CancelClosing = e.Cancel;
+ }
+
+ private void disableCompilesyntaxCheckToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ //this.disableCompilesyntaxCheckToolStripMenuItem.Checked = !this.disableCompilesyntaxCheckToolStripMenuItem.Checked;
+ }
+
+ private void tvOutline_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
+ {
+ this.parent.BeginInvoke(new TreeNodeMouseClickEventHandler(
+ delegate(object sender2, TreeNodeMouseClickEventArgs e2)
+ {
+ if (e.Node.Tag is Helpers.OutlineHelper) {
+ Helpers.OutlineHelper ohOutline = (Helpers.OutlineHelper)e.Node.Tag;
+ if (ohOutline.line < this.TextBox.Lines.Length) {
+ //editForm.Focus();
+ //editForm.TextBox.Select();
+ //editForm.TextBox.Goto(ohOutline.line + 1);
+
+ //TextBox.Focus();
+ this.TextBox.Select();
+ this.TextBox.SelectionStart = this.TextBox.GetFirstCharIndexFromLine(ohOutline.line);
+
+
+ }
+ }
+ }), sender, e);
+ }
+
+ private void tvOutline_AfterSelect(object sender, TreeViewEventArgs e)
+ {
+
+ //this.TextBox.Select
+ }
+
+ private void splitContainer1_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void tvOutline_VisibleChanged(object sender, EventArgs e)
+ {
+ this.tvOutline.ExpandAll();
+ }
+ }
+}
diff --git a/trunk/EditForm.resx b/source/EditForm.resx
similarity index 97%
rename from trunk/EditForm.resx
rename to source/EditForm.resx
index a403b40..7ede018 100644
--- a/trunk/EditForm.resx
+++ b/source/EditForm.resx
@@ -1,123 +1,123 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 37
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 37
+
\ No newline at end of file
diff --git a/trunk/Editor/GListBox.Designer.cs b/source/Editor/GListBox.Designer.cs
similarity index 95%
rename from trunk/Editor/GListBox.Designer.cs
rename to source/Editor/GListBox.Designer.cs
index 9bc0ead..94c7f87 100644
--- a/trunk/Editor/GListBox.Designer.cs
+++ b/source/Editor/GListBox.Designer.cs
@@ -1,36 +1,36 @@
-namespace LSLEditor
-{
- partial class GListBox
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- }
-
- #endregion
- }
-}
+namespace LSLEditor
+{
+ partial class GListBox
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/Editor/GListBox.cs b/source/Editor/GListBox.cs
similarity index 96%
rename from trunk/Editor/GListBox.cs
rename to source/Editor/GListBox.cs
index ed2966c..7ffa649 100644
--- a/trunk/Editor/GListBox.cs
+++ b/source/Editor/GListBox.cs
@@ -1,148 +1,148 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-using System.ComponentModel;
-
-namespace LSLEditor
-{
- public partial class GListBox : ListBox
- {
- public ImageList ImageList;
-
- public GListBox(IContainer container)
- {
- container.Add(this);
-
- InitializeComponent();
-
- // Set owner draw mode
- this.DrawMode = DrawMode.OwnerDrawFixed;
- this.ImageList = new ImageList();
- }
-
- public GListBox()
- {
- InitializeComponent();
-
- // Set owner draw mode
- this.DrawMode = DrawMode.OwnerDrawFixed;
- this.ImageList = new ImageList();
- }
-
- protected override void OnDrawItem(DrawItemEventArgs e)
- {
- try
- {
- GListBoxItem item;
- Rectangle bounds = new Rectangle(e.Bounds.X + e.Bounds.Height, e.Bounds.Y, e.Bounds.Width - e.Bounds.Height - 1, e.Bounds.Height);
- item = (GListBoxItem)Items[e.Index];
- if (item.ImageIndex != -1)
- {
- e.Graphics.FillRectangle(new SolidBrush(this.BackColor), bounds);
- if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
- e.Graphics.FillRectangle(SystemBrushes.Highlight, bounds);
-
- e.Graphics.DrawImage(ImageList.Images[item.ImageIndex], bounds.Left - bounds.Height, bounds.Top, bounds.Height, bounds.Height);
- e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
- bounds.Left, bounds.Top);
- }
- else
- {
- e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
- bounds.Left, bounds.Top);
- }
- }
- catch
- {
- e.DrawBackground();
- e.DrawFocusRectangle();
- if (e.Index != -1)
- {
- try
- {
- e.Graphics.DrawString(Items[e.Index].ToString(), e.Font,
- new SolidBrush(e.ForeColor), e.Bounds.Left, e.Bounds.Top);
- }
- catch
- {
- }
- }
- else
- {
- e.Graphics.DrawString(Text, e.Font, new SolidBrush(e.ForeColor),
- e.Bounds.Left, e.Bounds.Top);
- }
- }
- base.OnDrawItem(e);
- }
- }//End of GListBox class
-
- // GListBoxItem class
- public class GListBoxItem
- {
- private string _myText;
- private int _myImageIndex;
- // properties
- public string Text
- {
- get { return _myText; }
- set { _myText = value; }
- }
- public int ImageIndex
- {
- get { return _myImageIndex; }
- set { _myImageIndex = value; }
- }
- //constructor
- public GListBoxItem(string text, int index)
- {
- _myText = text;
- _myImageIndex = index;
- }
- public GListBoxItem(string text) : this(text, -1) { }
- public GListBoxItem() : this("") { }
- public override string ToString()
- {
- return _myText;
- }
- }//End of GListBoxItem class
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+
+namespace LSLEditor
+{
+ public partial class GListBox : ListBox
+ {
+ public ImageList ImageList;
+
+ public GListBox(IContainer container)
+ {
+ container.Add(this);
+
+ InitializeComponent();
+
+ // Set owner draw mode
+ this.DrawMode = DrawMode.OwnerDrawFixed;
+ this.ImageList = new ImageList();
+ }
+
+ public GListBox()
+ {
+ InitializeComponent();
+
+ // Set owner draw mode
+ this.DrawMode = DrawMode.OwnerDrawFixed;
+ this.ImageList = new ImageList();
+ }
+
+ protected override void OnDrawItem(DrawItemEventArgs e)
+ {
+ try
+ {
+ GListBoxItem item;
+ Rectangle bounds = new Rectangle(e.Bounds.X + e.Bounds.Height, e.Bounds.Y, e.Bounds.Width - e.Bounds.Height - 1, e.Bounds.Height);
+ item = (GListBoxItem)Items[e.Index];
+ if (item.ImageIndex != -1)
+ {
+ e.Graphics.FillRectangle(new SolidBrush(this.BackColor), bounds);
+ if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
+ e.Graphics.FillRectangle(SystemBrushes.Highlight, bounds);
+
+ e.Graphics.DrawImage(ImageList.Images[item.ImageIndex], bounds.Left - bounds.Height, bounds.Top, bounds.Height, bounds.Height);
+ e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
+ bounds.Left, bounds.Top);
+ }
+ else
+ {
+ e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
+ bounds.Left, bounds.Top);
+ }
+ }
+ catch
+ {
+ e.DrawBackground();
+ e.DrawFocusRectangle();
+ if (e.Index != -1)
+ {
+ try
+ {
+ e.Graphics.DrawString(Items[e.Index].ToString(), e.Font,
+ new SolidBrush(e.ForeColor), e.Bounds.Left, e.Bounds.Top);
+ }
+ catch
+ {
+ }
+ }
+ else
+ {
+ e.Graphics.DrawString(Text, e.Font, new SolidBrush(e.ForeColor),
+ e.Bounds.Left, e.Bounds.Top);
+ }
+ }
+ base.OnDrawItem(e);
+ }
+ }//End of GListBox class
+
+ // GListBoxItem class
+ public class GListBoxItem
+ {
+ private string _myText;
+ private int _myImageIndex;
+ // properties
+ public string Text
+ {
+ get { return _myText; }
+ set { _myText = value; }
+ }
+ public int ImageIndex
+ {
+ get { return _myImageIndex; }
+ set { _myImageIndex = value; }
+ }
+ //constructor
+ public GListBoxItem(string text, int index)
+ {
+ _myText = text;
+ _myImageIndex = index;
+ }
+ public GListBoxItem(string text) : this(text, -1) { }
+ public GListBoxItem() : this("") { }
+ public override string ToString()
+ {
+ return _myText;
+ }
+ }//End of GListBoxItem class
+}
diff --git a/trunk/Editor/GListBoxWindow.Designer.cs b/source/Editor/GListBoxWindow.Designer.cs
similarity index 96%
rename from trunk/Editor/GListBoxWindow.Designer.cs
rename to source/Editor/GListBoxWindow.Designer.cs
index 79faa22..18622d5 100644
--- a/trunk/Editor/GListBoxWindow.Designer.cs
+++ b/source/Editor/GListBoxWindow.Designer.cs
@@ -1,64 +1,64 @@
-namespace LSLEditor
-{
- partial class GListBoxWindow
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.gListBox1 = new LSLEditor.GListBox(this.components);
- this.SuspendLayout();
- //
- // gListBox1
- //
- this.gListBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.gListBox1.FormattingEnabled = true;
- this.gListBox1.Location = new System.Drawing.Point(0, 0);
- this.gListBox1.Name = "gListBox1";
- this.gListBox1.Size = new System.Drawing.Size(192, 134);
- this.gListBox1.TabIndex = 0;
- this.gListBox1.Resize += new System.EventHandler(this.gListBox1_Resize);
- //
- // GListBoxWindow
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(212, 156);
- this.Controls.Add(this.gListBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
- this.Name = "GListBoxWindow";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- this.Text = "GListBoxWindow";
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private GListBox gListBox1;
- }
+namespace LSLEditor
+{
+ partial class GListBoxWindow
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.gListBox1 = new LSLEditor.GListBox(this.components);
+ this.SuspendLayout();
+ //
+ // gListBox1
+ //
+ this.gListBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.gListBox1.FormattingEnabled = true;
+ this.gListBox1.Location = new System.Drawing.Point(0, 0);
+ this.gListBox1.Name = "gListBox1";
+ this.gListBox1.Size = new System.Drawing.Size(192, 134);
+ this.gListBox1.TabIndex = 0;
+ this.gListBox1.Resize += new System.EventHandler(this.gListBox1_Resize);
+ //
+ // GListBoxWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(212, 156);
+ this.Controls.Add(this.gListBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+ this.Name = "GListBoxWindow";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
+ this.Text = "GListBoxWindow";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private GListBox gListBox1;
+ }
}
\ No newline at end of file
diff --git a/trunk/Editor/GListBoxWindow.cs b/source/Editor/GListBoxWindow.cs
similarity index 96%
rename from trunk/Editor/GListBoxWindow.cs
rename to source/Editor/GListBoxWindow.cs
index 079b84d..526c459 100644
--- a/trunk/Editor/GListBoxWindow.cs
+++ b/source/Editor/GListBoxWindow.cs
@@ -1,173 +1,173 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Drawing;
-using System.ComponentModel;
-using System.Windows.Forms;
-
-namespace LSLEditor
-{
- public partial class GListBoxWindow : Form
- {
- public GListBox GListBox
- {
- get
- {
- return this.gListBox1;
- }
- }
-
- public GListBoxItem Selected
- {
- get
- {
- return (GListBoxItem)this.gListBox1.Items[this.gListBox1.SelectedIndex];
- }
- }
-
- public GListBoxWindow(Form parent)
- {
- InitializeComponent();
-
- this.Owner = parent;
-
- this.GListBox.Cursor = Cursors.Arrow;
- this.GListBox.Sorted = true;
-
- this.FontChanged += new EventHandler(GListBoxWindow_FontChanged);
- }
-
- void GListBoxWindow_FontChanged(object sender, EventArgs e)
- {
- this.GListBox.ItemHeight = 2 + (int)LSLEditor.Helpers.Measure.MeasureDisplayString(this.GListBox, "M", this.Font).Height;
- }
-
- public void KeyDownHandler(KeyEventArgs e)
- {
- if (!this.Visible)
- return;
-
- if (e.KeyCode == Keys.Enter)
- {
- // cancel richttext enter if listbox shows
- e.Handled = true;
- }
- if (e.KeyCode == Keys.Down)
- {
- this.gListBox1.SelectedIndex = Math.Min(this.gListBox1.Items.Count - 1, this.gListBox1.SelectedIndex + 1);
- e.Handled = true;
- }
-
- if (e.KeyCode == Keys.Up)
- {
- this.gListBox1.SelectedIndex = Math.Max(0, this.gListBox1.SelectedIndex - 1);
- e.Handled = true;
- }
-
- if (e.KeyCode == Keys.PageUp)
- {
- this.gListBox1.SelectedIndex = Math.Max(0,this.gListBox1.SelectedIndex - 10);
- e.Handled = true;
- }
-
- if (e.KeyCode == Keys.PageDown)
- {
- this.gListBox1.SelectedIndex = Math.Min(this.gListBox1.Items.Count - 1, this.gListBox1.SelectedIndex + 10);
- e.Handled = true;
- }
- }
-
- public void SetPosition(Rectangle rect,RichTextBox RichTextBox)
- {
- //Rectangle rect = Screen.PrimaryScreen.WorkingArea;
- Point p = RichTextBox.GetPositionFromCharIndex(RichTextBox.SelectionStart);
-
- p = new Point(p.X - 20, p.Y + this.gListBox1.ItemHeight); // ItemHeight = exact line height
-
- Rectangle client = RichTextBox.ClientRectangle;
- if (p.X < (client.Left-20) || p.Y < client.Top || p.X > client.Width || p.Y > client.Height)
- {
- this.Visible = false;
- return;
- }
-
- Point screen = RichTextBox.PointToScreen(p);
-
- //if ((screen.Y + this.Height) > rect.Height)
- // screen = RichTextBox.PointToScreen(new Point(p.X - 20 + this.XOffset, p.Y - this.Height));
-
- if (screen.Y > rect.Bottom)
- {
- this.Visible = false;
- return;
- //screen.Y = rect.Bottom;
- }
-
- if (screen.X > rect.Right)
- {
- this.Visible = false;
- return;
- //screen.X = rect.Right;
- }
-
- if (screen.X < rect.Left)
- {
- this.Visible = false;
- return;
- //screen.X = rect.Left;
- }
-
- if ((screen.Y) < rect.Top)
- {
- this.Visible = false;
- return;
- //screen.Y = rect.Top;
- }
-
- this.Location = screen;
- }
-
- private void gListBox1_Resize(object sender, EventArgs e)
- {
- this.Size = this.gListBox1.Size;
- }
-
- }
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace LSLEditor
+{
+ public partial class GListBoxWindow : Form
+ {
+ public GListBox GListBox
+ {
+ get
+ {
+ return this.gListBox1;
+ }
+ }
+
+ public GListBoxItem Selected
+ {
+ get
+ {
+ return (GListBoxItem)this.gListBox1.Items[this.gListBox1.SelectedIndex];
+ }
+ }
+
+ public GListBoxWindow(Form parent)
+ {
+ InitializeComponent();
+
+ this.Owner = parent;
+
+ this.GListBox.Cursor = Cursors.Arrow;
+ this.GListBox.Sorted = true;
+
+ this.FontChanged += new EventHandler(GListBoxWindow_FontChanged);
+ }
+
+ void GListBoxWindow_FontChanged(object sender, EventArgs e)
+ {
+ this.GListBox.ItemHeight = 2 + (int)LSLEditor.Helpers.Measure.MeasureDisplayString(this.GListBox, "M", this.Font).Height;
+ }
+
+ public void KeyDownHandler(KeyEventArgs e)
+ {
+ if (!this.Visible)
+ return;
+
+ if (e.KeyCode == Keys.Enter)
+ {
+ // cancel richttext enter if listbox shows
+ e.Handled = true;
+ }
+ if (e.KeyCode == Keys.Down)
+ {
+ this.gListBox1.SelectedIndex = Math.Min(this.gListBox1.Items.Count - 1, this.gListBox1.SelectedIndex + 1);
+ e.Handled = true;
+ }
+
+ if (e.KeyCode == Keys.Up)
+ {
+ this.gListBox1.SelectedIndex = Math.Max(0, this.gListBox1.SelectedIndex - 1);
+ e.Handled = true;
+ }
+
+ if (e.KeyCode == Keys.PageUp)
+ {
+ this.gListBox1.SelectedIndex = Math.Max(0,this.gListBox1.SelectedIndex - 10);
+ e.Handled = true;
+ }
+
+ if (e.KeyCode == Keys.PageDown)
+ {
+ this.gListBox1.SelectedIndex = Math.Min(this.gListBox1.Items.Count - 1, this.gListBox1.SelectedIndex + 10);
+ e.Handled = true;
+ }
+ }
+
+ public void SetPosition(Rectangle rect,RichTextBox RichTextBox)
+ {
+ //Rectangle rect = Screen.PrimaryScreen.WorkingArea;
+ Point p = RichTextBox.GetPositionFromCharIndex(RichTextBox.SelectionStart);
+
+ p = new Point(p.X - 20, p.Y + this.gListBox1.ItemHeight); // ItemHeight = exact line height
+
+ Rectangle client = RichTextBox.ClientRectangle;
+ if (p.X < (client.Left-20) || p.Y < client.Top || p.X > client.Width || p.Y > client.Height)
+ {
+ this.Visible = false;
+ return;
+ }
+
+ Point screen = RichTextBox.PointToScreen(p);
+
+ //if ((screen.Y + this.Height) > rect.Height)
+ // screen = RichTextBox.PointToScreen(new Point(p.X - 20 + this.XOffset, p.Y - this.Height));
+
+ if (screen.Y > rect.Bottom)
+ {
+ this.Visible = false;
+ return;
+ //screen.Y = rect.Bottom;
+ }
+
+ if (screen.X > rect.Right)
+ {
+ this.Visible = false;
+ return;
+ //screen.X = rect.Right;
+ }
+
+ if (screen.X < rect.Left)
+ {
+ this.Visible = false;
+ return;
+ //screen.X = rect.Left;
+ }
+
+ if ((screen.Y) < rect.Top)
+ {
+ this.Visible = false;
+ return;
+ //screen.Y = rect.Top;
+ }
+
+ this.Location = screen;
+ }
+
+ private void gListBox1_Resize(object sender, EventArgs e)
+ {
+ this.Size = this.gListBox1.Size;
+ }
+
+ }
}
\ No newline at end of file
diff --git a/trunk/Editor/GListBoxWindow.resx b/source/Editor/GListBoxWindow.resx
similarity index 97%
rename from trunk/Editor/GListBoxWindow.resx
rename to source/Editor/GListBoxWindow.resx
index ff31a6d..19dc0dd 100644
--- a/trunk/Editor/GListBoxWindow.resx
+++ b/source/Editor/GListBoxWindow.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/trunk/Editor/KeyWords.cs b/source/Editor/KeyWords.cs
similarity index 96%
rename from trunk/Editor/KeyWords.cs
rename to source/Editor/KeyWords.cs
index f8f8da6..0548dda 100644
--- a/trunk/Editor/KeyWords.cs
+++ b/source/Editor/KeyWords.cs
@@ -1,410 +1,410 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.Drawing;
-using System.Xml;
-using System.Text;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-
-namespace LSLEditor
-{
- public enum KeyWordTypeEnum : int
- {
- Unknown = 0,
- Functions = 1,
- Events = 2,
- Constants = 3,
- Class = 4,
- Vars = 5,
- Properties = 6,
- States = 7
- }
-
- public struct KeyWordInfo
- {
- public KeyWordTypeEnum type;
- public string name;
- public Color color;
- public KeyWordInfo(KeyWordTypeEnum type, string name, Color color)
- {
- this.type = type;
- this.name = name;
- this.color = color;
- }
- }
-
- class KeyWords
- {
- private ArrayList m_RegexColorList;
- private Regex m_regexSplitter;
- private Hashtable m_KeyWordColorList;
- private XmlDocument xml;
-
- private void MakeSplitter(string strRegexSplitter)
- {
- m_regexSplitter = new Regex(
- @"\s*(" + strRegexSplitter + @"|\w+|.)",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- }
-
- private struct RegexColor
- {
- public Regex regex;
- public Color color;
- public RegexColor(string strRegex, Color color)
- {
- this.regex = new Regex(strRegex,
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- this.color = color;
- }
- }
-
- public KeyWords(string ColorScheme, XmlDocument xml)
- {
- this.m_RegexColorList = new ArrayList();
- this.m_KeyWordColorList = new Hashtable();
- this.xml = xml;
-
- string strRegexSplitter = "";
-
- foreach (XmlNode words in xml.SelectNodes("//Words"))
- {
- Color color = Color.FromArgb(int.Parse(words.Attributes[ColorScheme].InnerText.Replace("#", ""), System.Globalization.NumberStyles.HexNumber));
- KeyWordTypeEnum type = KeyWordTypeEnum.Unknown;
- if (words.Attributes["icon"] != null)
- {
- switch (words.Attributes["icon"].InnerText)
- {
- case "Functions":
- type = KeyWordTypeEnum.Functions;
- break;
- case "Events":
- type = KeyWordTypeEnum.Events;
- break;
- case "Constants":
- type = KeyWordTypeEnum.Constants;
- break;
- case "Class":
- type = KeyWordTypeEnum.Class;
- break;
- case "Vars":
- type = KeyWordTypeEnum.Vars;
- break;
- case "States":
- type = KeyWordTypeEnum.States;
- break;
- case "Enum":
- if (!Properties.Settings.Default.CodeCompletionAnimation)
- continue;
- type = KeyWordTypeEnum.Properties;
- break;
- default:
- type = KeyWordTypeEnum.Unknown;
- break;
- }
- }
- foreach (XmlNode word in words.SelectNodes(".//Word"))
- {
- if (word.Attributes["name"].InnerText == "regex")
- {
- string strRegex = word.InnerText;
- AddRegex(strRegex, color);
- if (strRegexSplitter != "")
- strRegexSplitter += "|";
- strRegexSplitter += strRegex;
- }
- else
- {
- AddKeyword(type, word.Attributes["name"].InnerText, color);
- }
- }
- }
- MakeSplitter(strRegexSplitter);
- }
-
- private void AddRegex(string strRegex, Color color)
- {
- m_RegexColorList.Add(new RegexColor(strRegex, color));
- }
-
- private void AddKeyword(KeyWordTypeEnum type, string name, Color color)
- {
- m_KeyWordColorList.Add(name, new KeyWordInfo(type, name, color));
- }
-
- public Color GetColorFromRegex(string strKeyWord)
- {
- // specials
- Color color = Color.Black;
- foreach (RegexColor regexColor in m_RegexColorList)
- {
- Match mm = regexColor.regex.Match(strKeyWord);
- if (mm.Success)
- {
- // must be exact match
- if (mm.Index != 0)
- continue;
- color = regexColor.color;
- break;
- }
- }
- return color;
- }
-
- public KeyWordInfo GetKeyWordInfo(string strWord)
- {
- return (KeyWordInfo)this.m_KeyWordColorList[strWord];
- }
-
- public bool ContainsKeyWord(string strWord)
- {
- return m_KeyWordColorList.ContainsKey(strWord);
- }
-
- public Color GetColorFromKeyWordList(string strKeyWord)
- {
- if (ContainsKeyWord(strKeyWord))
- return GetKeyWordInfo(strKeyWord).color;
- else
- return Color.Black;
- }
-
- public MatchCollection Matches(string strLine)
- {
- return m_regexSplitter.Matches(strLine);
- }
-
- public List KeyWordSearch(string strKeyWord, bool IsRegularExpression)
- {
- List list = new List();
- string strLowerCaseKeyWord = strKeyWord.ToLower();
- int intLen = strLowerCaseKeyWord.Length;
- foreach (string strKey in m_KeyWordColorList.Keys)
- {
- if (IsRegularExpression)
- {
- if(new Regex("^"+strKeyWord+"$").Match(strKey).Success)
- list.Add(GetKeyWordInfo(strKey));
- }
- else
- {
- if (strKey.Length < intLen)
- continue;
- if (strKey.Substring(0, intLen).ToLower() == strLowerCaseKeyWord)
- list.Add(GetKeyWordInfo(strKey));
- }
- }
- return list;
- }
-
- public string GetDescription(string strKeyWord)
- {
- if(ContainsKeyWord(strKeyWord))
- {
- XmlNode xmlNode = xml.SelectSingleNode("//Word[@name='"+strKeyWord+"']");
- if(xmlNode!=null)
- {
- if (xmlNode.ChildNodes.Count == 0)
- return "";
- string strText = xmlNode.InnerXml;
- if (strText == "")
- return strKeyWord;
- else
- {
- int intArgument = strText.IndexOf(" 0)
- strText = strText.Substring(0, intArgument);
- StringBuilder sb = new StringBuilder();
- StringReader sr = new StringReader(strText);
- while (true)
- {
- string strLine = sr.ReadLine();
- if (strLine == null)
- break;
- sb.AppendLine(strLine.Trim());
- }
- return sb.ToString();
- }
- }
- }
- return "";
- }
-
- private string MakeArgumentBold(string strText, int intArgument)
- {
- Regex regex = new Regex(
-@"(?[^(]* \( )
- (?:
- (? [^,\)]*) (?"
- + @"[\,\)])+
- )*
-(?.*)
-",
- RegexOptions.IgnorePatternWhitespace);
- Match match = regex.Match(strText);
- StringBuilder sb = new StringBuilder();
- sb.Append(match.Groups["prefix"].Value);
- for (int intI = 0; intI < match.Groups["argument"].Captures.Count; intI++)
- {
- if (intI == intArgument)
- {
- sb.Append(@"");
- sb.Append(match.Groups["argument"].Captures[intI].Value);
- sb.Append("");
- }
- else
- {
- sb.Append(match.Groups["argument"].Captures[intI].Value);
- }
- sb.Append(match.Groups["seperator"].Captures[intI].Value);
- }
- sb.Append(match.Groups["postfix"].Value);
- sb.Append('\n');
- return sb.ToString();
- }
-
- private string GetFirstLineOfKeyWord(string strWord, out XmlNode xmlNode)
- {
- xmlNode = null;
-
- if (!ContainsKeyWord(strWord))
- return "";
-
- xmlNode = xml.SelectSingleNode("//Word[@name='" + strWord + "']");
- if (xmlNode == null)
- return "";
-
- if (xmlNode.ChildNodes.Count == 0)
- return "";
-
- string strText = xmlNode.ChildNodes[0].InnerText;
- if (strText == "")
- return "";
-
- strText = strText.TrimStart();
- int intI = strText.IndexOf("\r");
- if (intI > 0)
- strText = strText.Substring(0, intI);
-
- return strText;
- }
-
- public int GetNumberOfArguments(string strWord)
- {
- XmlNode xmlNode;
- string strFirstLine = GetFirstLineOfKeyWord(strWord, out xmlNode);
-
- if (strFirstLine == "")
- return -1;
-
- Regex regex = new Regex(
-@"(?[^(]* \( )
- (?:
- (? [^,\)]*) (?"
- + @"[\,\)])+
- )*
-(?.*)
-",
- RegexOptions.IgnorePatternWhitespace);
- Match match = regex.Match(strFirstLine);
-
- // nr not 1, return nr
- int intNr = match.Groups["argument"].Captures.Count;
- if(intNr != 1)
- return intNr;
-
- // nr = 1 can be void, returns also 0
- if(match.Groups["argument"].Captures[0].Value == "void")
- return 0;
-
- // not void, return 1
- return 1;
- }
-
- public string GetFunctionAndHiglightArgument(string strWord, int intArgument, out string strWild)
- {
- XmlNode xmlNode;
- string strFirstLine = GetFirstLineOfKeyWord(strWord,out xmlNode);
-
- strWild = "";
-
- if (strFirstLine == "")
- return "";
-
- string strRichText = MakeArgumentBold(strFirstLine, intArgument);
-
- if (xmlNode == null)
- return strRichText;
-
- XmlNodeList nodeList = xmlNode.SelectNodes("./Argument");
- if (intArgument < nodeList.Count)
- {
- XmlNode xmlNodeArgument = nodeList[intArgument];
- if(xmlNodeArgument.Attributes["wild"]!=null)
- strWild = xmlNodeArgument.Attributes["wild"].Value;
- string strName = xmlNodeArgument.Attributes["name"].Value;
- string strDescription = "\n" + @"" + strName + ":";
- strRichText += strDescription + " " + xmlNodeArgument.InnerText + "\n";
- }
- return strRichText;
- }
-
- public string GetEvent(string strEventName)
- {
- string strReturn = strEventName + "(";
-
- XmlNode xmlNode;
- string strFirstLine = GetFirstLineOfKeyWord(strEventName, out xmlNode);
-
- if (strFirstLine == "")
- return strReturn;
-
- return strFirstLine.Replace(";", "").Replace("void", "");
- }
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.Drawing;
+using System.Xml;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+
+namespace LSLEditor
+{
+ public enum KeyWordTypeEnum : int
+ {
+ Unknown = 0,
+ Functions = 1,
+ Events = 2,
+ Constants = 3,
+ Class = 4,
+ Vars = 5,
+ Properties = 6,
+ States = 7
+ }
+
+ public struct KeyWordInfo
+ {
+ public KeyWordTypeEnum type;
+ public string name;
+ public Color color;
+ public KeyWordInfo(KeyWordTypeEnum type, string name, Color color)
+ {
+ this.type = type;
+ this.name = name;
+ this.color = color;
+ }
+ }
+
+ class KeyWords
+ {
+ private ArrayList m_RegexColorList;
+ private Regex m_regexSplitter;
+ private Hashtable m_KeyWordColorList;
+ private XmlDocument xml;
+
+ private void MakeSplitter(string strRegexSplitter)
+ {
+ m_regexSplitter = new Regex(
+ @"\s*(" + strRegexSplitter + @"|\w+|.)",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ }
+
+ private struct RegexColor
+ {
+ public Regex regex;
+ public Color color;
+ public RegexColor(string strRegex, Color color)
+ {
+ this.regex = new Regex(strRegex,
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ this.color = color;
+ }
+ }
+
+ public KeyWords(string ColorScheme, XmlDocument xml)
+ {
+ this.m_RegexColorList = new ArrayList();
+ this.m_KeyWordColorList = new Hashtable();
+ this.xml = xml;
+
+ string strRegexSplitter = "";
+
+ foreach (XmlNode words in xml.SelectNodes("//Words"))
+ {
+ Color color = Color.FromArgb(int.Parse(words.Attributes[ColorScheme].InnerText.Replace("#", ""), System.Globalization.NumberStyles.HexNumber));
+ KeyWordTypeEnum type = KeyWordTypeEnum.Unknown;
+ if (words.Attributes["icon"] != null)
+ {
+ switch (words.Attributes["icon"].InnerText)
+ {
+ case "Functions":
+ type = KeyWordTypeEnum.Functions;
+ break;
+ case "Events":
+ type = KeyWordTypeEnum.Events;
+ break;
+ case "Constants":
+ type = KeyWordTypeEnum.Constants;
+ break;
+ case "Class":
+ type = KeyWordTypeEnum.Class;
+ break;
+ case "Vars":
+ type = KeyWordTypeEnum.Vars;
+ break;
+ case "States":
+ type = KeyWordTypeEnum.States;
+ break;
+ case "Enum":
+ if (!Properties.Settings.Default.CodeCompletionAnimation)
+ continue;
+ type = KeyWordTypeEnum.Properties;
+ break;
+ default:
+ type = KeyWordTypeEnum.Unknown;
+ break;
+ }
+ }
+ foreach (XmlNode word in words.SelectNodes(".//Word"))
+ {
+ if (word.Attributes["name"].InnerText == "regex")
+ {
+ string strRegex = word.InnerText;
+ AddRegex(strRegex, color);
+ if (strRegexSplitter != "")
+ strRegexSplitter += "|";
+ strRegexSplitter += strRegex;
+ }
+ else
+ {
+ AddKeyword(type, word.Attributes["name"].InnerText, color);
+ }
+ }
+ }
+ MakeSplitter(strRegexSplitter);
+ }
+
+ private void AddRegex(string strRegex, Color color)
+ {
+ m_RegexColorList.Add(new RegexColor(strRegex, color));
+ }
+
+ private void AddKeyword(KeyWordTypeEnum type, string name, Color color)
+ {
+ m_KeyWordColorList.Add(name, new KeyWordInfo(type, name, color));
+ }
+
+ public Color GetColorFromRegex(string strKeyWord)
+ {
+ // specials
+ Color color = Color.Black;
+ foreach (RegexColor regexColor in m_RegexColorList)
+ {
+ Match mm = regexColor.regex.Match(strKeyWord);
+ if (mm.Success)
+ {
+ // must be exact match
+ if (mm.Index != 0)
+ continue;
+ color = regexColor.color;
+ break;
+ }
+ }
+ return color;
+ }
+
+ public KeyWordInfo GetKeyWordInfo(string strWord)
+ {
+ return (KeyWordInfo)this.m_KeyWordColorList[strWord];
+ }
+
+ public bool ContainsKeyWord(string strWord)
+ {
+ return m_KeyWordColorList.ContainsKey(strWord);
+ }
+
+ public Color GetColorFromKeyWordList(string strKeyWord)
+ {
+ if (ContainsKeyWord(strKeyWord))
+ return GetKeyWordInfo(strKeyWord).color;
+ else
+ return Color.Black;
+ }
+
+ public MatchCollection Matches(string strLine)
+ {
+ return m_regexSplitter.Matches(strLine);
+ }
+
+ public List KeyWordSearch(string strKeyWord, bool IsRegularExpression)
+ {
+ List list = new List();
+ string strLowerCaseKeyWord = strKeyWord.ToLower();
+ int intLen = strLowerCaseKeyWord.Length;
+ foreach (string strKey in m_KeyWordColorList.Keys)
+ {
+ if (IsRegularExpression)
+ {
+ if(new Regex("^"+strKeyWord+"$").Match(strKey).Success)
+ list.Add(GetKeyWordInfo(strKey));
+ }
+ else
+ {
+ if (strKey.Length < intLen)
+ continue;
+ if (strKey.Substring(0, intLen).ToLower() == strLowerCaseKeyWord)
+ list.Add(GetKeyWordInfo(strKey));
+ }
+ }
+ return list;
+ }
+
+ public string GetDescription(string strKeyWord)
+ {
+ if(ContainsKeyWord(strKeyWord))
+ {
+ XmlNode xmlNode = xml.SelectSingleNode("//Word[@name='"+strKeyWord+"']");
+ if(xmlNode!=null)
+ {
+ if (xmlNode.ChildNodes.Count == 0)
+ return "";
+ string strText = xmlNode.InnerXml;
+ if (strText == "")
+ return strKeyWord;
+ else
+ {
+ int intArgument = strText.IndexOf(" 0)
+ strText = strText.Substring(0, intArgument);
+ StringBuilder sb = new StringBuilder();
+ StringReader sr = new StringReader(strText);
+ while (true)
+ {
+ string strLine = sr.ReadLine();
+ if (strLine == null)
+ break;
+ sb.AppendLine(strLine.Trim());
+ }
+ return sb.ToString();
+ }
+ }
+ }
+ return "";
+ }
+
+ private string MakeArgumentBold(string strText, int intArgument)
+ {
+ Regex regex = new Regex(
+@"(?[^(]* \( )
+ (?:
+ (? [^,\)]*) (?"
+ + @"[\,\)])+
+ )*
+(?.*)
+",
+ RegexOptions.IgnorePatternWhitespace);
+ Match match = regex.Match(strText);
+ StringBuilder sb = new StringBuilder();
+ sb.Append(match.Groups["prefix"].Value);
+ for (int intI = 0; intI < match.Groups["argument"].Captures.Count; intI++)
+ {
+ if (intI == intArgument)
+ {
+ sb.Append(@"");
+ sb.Append(match.Groups["argument"].Captures[intI].Value);
+ sb.Append("");
+ }
+ else
+ {
+ sb.Append(match.Groups["argument"].Captures[intI].Value);
+ }
+ sb.Append(match.Groups["seperator"].Captures[intI].Value);
+ }
+ sb.Append(match.Groups["postfix"].Value);
+ sb.Append('\n');
+ return sb.ToString();
+ }
+
+ private string GetFirstLineOfKeyWord(string strWord, out XmlNode xmlNode)
+ {
+ xmlNode = null;
+
+ if (!ContainsKeyWord(strWord))
+ return "";
+
+ xmlNode = xml.SelectSingleNode("//Word[@name='" + strWord + "']");
+ if (xmlNode == null)
+ return "";
+
+ if (xmlNode.ChildNodes.Count == 0)
+ return "";
+
+ string strText = xmlNode.ChildNodes[0].InnerText;
+ if (strText == "")
+ return "";
+
+ strText = strText.TrimStart();
+ int intI = strText.IndexOf("\r");
+ if (intI > 0)
+ strText = strText.Substring(0, intI);
+
+ return strText;
+ }
+
+ public int GetNumberOfArguments(string strWord)
+ {
+ XmlNode xmlNode;
+ string strFirstLine = GetFirstLineOfKeyWord(strWord, out xmlNode);
+
+ if (strFirstLine == "")
+ return -1;
+
+ Regex regex = new Regex(
+@"(?[^(]* \( )
+ (?:
+ (? [^,\)]*) (?"
+ + @"[\,\)])+
+ )*
+(?.*)
+",
+ RegexOptions.IgnorePatternWhitespace);
+ Match match = regex.Match(strFirstLine);
+
+ // nr not 1, return nr
+ int intNr = match.Groups["argument"].Captures.Count;
+ if(intNr != 1)
+ return intNr;
+
+ // nr = 1 can be void, returns also 0
+ if(match.Groups["argument"].Captures[0].Value == "void")
+ return 0;
+
+ // not void, return 1
+ return 1;
+ }
+
+ public string GetFunctionAndHiglightArgument(string strWord, int intArgument, out string strWild)
+ {
+ XmlNode xmlNode;
+ string strFirstLine = GetFirstLineOfKeyWord(strWord,out xmlNode);
+
+ strWild = "";
+
+ if (strFirstLine == "")
+ return "";
+
+ string strRichText = MakeArgumentBold(strFirstLine, intArgument);
+
+ if (xmlNode == null)
+ return strRichText;
+
+ XmlNodeList nodeList = xmlNode.SelectNodes("./Argument");
+ if (intArgument < nodeList.Count)
+ {
+ XmlNode xmlNodeArgument = nodeList[intArgument];
+ if(xmlNodeArgument.Attributes["wild"]!=null)
+ strWild = xmlNodeArgument.Attributes["wild"].Value;
+ string strName = xmlNodeArgument.Attributes["name"].Value;
+ string strDescription = "\n" + @"" + strName + ":";
+ strRichText += strDescription + " " + xmlNodeArgument.InnerText + "\n";
+ }
+ return strRichText;
+ }
+
+ public string GetEvent(string strEventName)
+ {
+ string strReturn = strEventName + "(";
+
+ XmlNode xmlNode;
+ string strFirstLine = GetFirstLineOfKeyWord(strEventName, out xmlNode);
+
+ if (strFirstLine == "")
+ return strReturn;
+
+ return strFirstLine.Replace(";", "").Replace("void", "");
+ }
+
+ }
+}
diff --git a/trunk/Editor/MsXsltContext.cs b/source/Editor/MsXsltContext.cs
similarity index 98%
rename from trunk/Editor/MsXsltContext.cs
rename to source/Editor/MsXsltContext.cs
index 79af03e..c32fd86 100644
--- a/trunk/Editor/MsXsltContext.cs
+++ b/source/Editor/MsXsltContext.cs
@@ -1,39 +1,39 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
diff --git a/trunk/Editor/Numbered.Designer.cs b/source/Editor/Numbered.Designer.cs
similarity index 96%
rename from trunk/Editor/Numbered.Designer.cs
rename to source/Editor/Numbered.Designer.cs
index a4bb174..7536e23 100644
--- a/trunk/Editor/Numbered.Designer.cs
+++ b/source/Editor/Numbered.Designer.cs
@@ -1,37 +1,37 @@
-namespace LSLEditor.Editor
-{
- partial class Numbered
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- }
-
- #endregion
- }
-}
+namespace LSLEditor.Editor
+{
+ partial class Numbered
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/Editor/Numbered.cs b/source/Editor/Numbered.cs
similarity index 97%
rename from trunk/Editor/Numbered.cs
rename to source/Editor/Numbered.cs
index 2297fbc..155fe02 100644
--- a/trunk/Editor/Numbered.cs
+++ b/source/Editor/Numbered.cs
@@ -1,143 +1,143 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor.Editor
-{
- public partial class Numbered : UserControl
- {
- public RichTextBox richTextBox1;
- private Brush brush;
- public float LineHeight;
-
- public Numbered()
- {
- InitializeComponent();
-
- this.SetStyle(
- ControlStyles.DoubleBuffer |
- ControlStyles.UserPaint |
- ControlStyles.AllPaintingInWmPaint,
- true);
-
- this.UpdateStyles();
-
- brush = new SolidBrush(this.ForeColor);
-
- LineHeight = 0.0F;
- }
-
- private void updateNumberLabel(PaintEventArgs e)
- {
- if (this.brush == null)
- return;
-
- if (this.ClientSize.Width <= 0 || this.ClientSize.Height <= 0)
- return;
-
- int delta = 0;
- int firstLine = 0;
- int lastLine = 10;
- Font font = this.Font;
- int selectedLineStart = -1, selectedLineEnd = -1;
- if (this.richTextBox1 == null)
- {
- LineHeight = 16.0F;
- }
- else
- {
- if (richTextBox1.SelectionStart != -1)
- {
- selectedLineStart = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart);
- selectedLineEnd = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart + richTextBox1.SelectionLength);
- }
- //we get index of first visible char and number of first visible line
- Point pos = new Point(0, 0);
-
- int firstIndex = this.richTextBox1.GetCharIndexFromPosition(pos);
- firstLine = this.richTextBox1.GetLineFromCharIndex(firstIndex);
-
- font = this.richTextBox1.Font;
-
- if (LineHeight < 0.01)
- {
- if (this.richTextBox1.Lines.Length > 1)
- {
- Point pos1 = this.richTextBox1.GetPositionFromCharIndex(this.richTextBox1.GetFirstCharIndexFromLine(1));
- LineHeight = pos1.Y;
- }
- }
-
- lastLine = Math.Min(this.richTextBox1.Lines.Length, 2 + firstLine + (int)(this.richTextBox1.ClientRectangle.Height / LineHeight));
-
- int intCharIndex = this.richTextBox1.GetCharIndexFromPosition(Point.Empty);
- delta = 1 + this.richTextBox1.GetPositionFromCharIndex(intCharIndex).Y % font.Height;
- }
-
- // here we go
- lastLine = Math.Max(lastLine, 1);
-
- Graphics g = e.Graphics;
- g.Clear(this.BackColor);
- if(this.richTextBox1==null)
- g.SetClip(new Rectangle(0, 0, this.Width, this.Height));
- else
- g.SetClip(new Rectangle(0, 0, this.Width, this.richTextBox1.ClientRectangle.Height));
-
- for (int i = firstLine; i < lastLine; i++)
- g.DrawString(string.Format("{0:0###}", i + 1), (i>=selectedLineStart && i<= selectedLineEnd) ? new Font(font,FontStyle.Bold) : font, brush,
- new PointF(0F, delta + (i - firstLine) * LineHeight) );
- //g.DrawLine(new Pen(brush), backBuffer.Width - 1, 0, backBuffer.Width - 1, backBuffer.Height);
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- updateNumberLabel(e);
- }
-
- protected override void OnPaintBackground(PaintEventArgs e)
- {
- //base.OnPaintBackground(e);
- }
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor.Editor
+{
+ public partial class Numbered : UserControl
+ {
+ public RichTextBox richTextBox1;
+ private Brush brush;
+ public float LineHeight;
+
+ public Numbered()
+ {
+ InitializeComponent();
+
+ this.SetStyle(
+ ControlStyles.DoubleBuffer |
+ ControlStyles.UserPaint |
+ ControlStyles.AllPaintingInWmPaint,
+ true);
+
+ this.UpdateStyles();
+
+ brush = new SolidBrush(this.ForeColor);
+
+ LineHeight = 0.0F;
+ }
+
+ private void updateNumberLabel(PaintEventArgs e)
+ {
+ if (this.brush == null)
+ return;
+
+ if (this.ClientSize.Width <= 0 || this.ClientSize.Height <= 0)
+ return;
+
+ int delta = 0;
+ int firstLine = 0;
+ int lastLine = 10;
+ Font font = this.Font;
+ int selectedLineStart = -1, selectedLineEnd = -1;
+ if (this.richTextBox1 == null)
+ {
+ LineHeight = 16.0F;
+ }
+ else
+ {
+ if (richTextBox1.SelectionStart != -1)
+ {
+ selectedLineStart = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart);
+ selectedLineEnd = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart + richTextBox1.SelectionLength);
+ }
+ //we get index of first visible char and number of first visible line
+ Point pos = new Point(0, 0);
+
+ int firstIndex = this.richTextBox1.GetCharIndexFromPosition(pos);
+ firstLine = this.richTextBox1.GetLineFromCharIndex(firstIndex);
+
+ font = this.richTextBox1.Font;
+
+ if (LineHeight < 0.01)
+ {
+ if (this.richTextBox1.Lines.Length > 1)
+ {
+ Point pos1 = this.richTextBox1.GetPositionFromCharIndex(this.richTextBox1.GetFirstCharIndexFromLine(1));
+ LineHeight = pos1.Y;
+ }
+ }
+
+ lastLine = Math.Min(this.richTextBox1.Lines.Length, 2 + firstLine + (int)(this.richTextBox1.ClientRectangle.Height / LineHeight));
+
+ int intCharIndex = this.richTextBox1.GetCharIndexFromPosition(Point.Empty);
+ delta = 1 + this.richTextBox1.GetPositionFromCharIndex(intCharIndex).Y % font.Height;
+ }
+
+ // here we go
+ lastLine = Math.Max(lastLine, 1);
+
+ Graphics g = e.Graphics;
+ g.Clear(this.BackColor);
+ if(this.richTextBox1==null)
+ g.SetClip(new Rectangle(0, 0, this.Width, this.Height));
+ else
+ g.SetClip(new Rectangle(0, 0, this.Width, this.richTextBox1.ClientRectangle.Height));
+
+ for (int i = firstLine; i < lastLine; i++)
+ g.DrawString(string.Format("{0:0###}", i + 1), (i>=selectedLineStart && i<= selectedLineEnd) ? new Font(font,FontStyle.Bold) : font, brush,
+ new PointF(0F, delta + (i - firstLine) * LineHeight) );
+ //g.DrawLine(new Pen(brush), backBuffer.Width - 1, 0, backBuffer.Width - 1, backBuffer.Height);
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ updateNumberLabel(e);
+ }
+
+ protected override void OnPaintBackground(PaintEventArgs e)
+ {
+ //base.OnPaintBackground(e);
+ }
+
+ }
+}
diff --git a/trunk/Editor/NumberedTextBoxUC.cs b/source/Editor/NumberedTextBoxUC.cs
similarity index 97%
rename from trunk/Editor/NumberedTextBoxUC.cs
rename to source/Editor/NumberedTextBoxUC.cs
index 8aae851..f8d6db6 100644
--- a/trunk/Editor/NumberedTextBoxUC.cs
+++ b/source/Editor/NumberedTextBoxUC.cs
@@ -1,85 +1,85 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace NumberedTextBox
-{
- public partial class NumberedTextBoxUC : UserControl
- {
- public NumberedTextBoxUC()
- {
- InitializeComponent();
-
- this.numbered1.richTextBox1 = this.syntaxRichTextBox1;
- this.syntaxRichTextBox1.OnPaintNumbers += new EventHandler(syntaxRichTextBox1_OnPaintNumbers);
- this.FontChanged += new EventHandler(NumberedTextBoxUC_FontChanged);
- this.syntaxRichTextBox1.OnCursorPositionChanged += new LSLEditor.SyntaxRichTextBox.CursorPositionChangedHandler(syntaxRichTextBox1_OnCursorPositionChanged);
- }
-
- void syntaxRichTextBox1_OnCursorPositionChanged(object sender, LSLEditor.SyntaxRichTextBox.CursorPositionEventArgs e)
- {
- this.numbered1.Invalidate();
- }
-
- void NumberedTextBoxUC_FontChanged(object sender, EventArgs e)
- {
- this.numbered1.LineHeight = 0.0F; // reset!!
- RectangleF rect = LSLEditor.Helpers.Measure.MeasureDisplayString(this.syntaxRichTextBox1, "M", this.Font);
- this.splitContainer1.SplitterDistance = (int)(4 * rect.Width + 5.0);
- }
-
- void syntaxRichTextBox1_OnPaintNumbers(object sender, EventArgs e)
- {
- this.numbered1.Invalidate();
- }
-
- public LSLEditor.SyntaxRichTextBox TextBox
- {
- get
- {
- return this.syntaxRichTextBox1;
- }
- }
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace NumberedTextBox
+{
+ public partial class NumberedTextBoxUC : UserControl
+ {
+ public NumberedTextBoxUC()
+ {
+ InitializeComponent();
+
+ this.numbered1.richTextBox1 = this.syntaxRichTextBox1;
+ this.syntaxRichTextBox1.OnPaintNumbers += new EventHandler(syntaxRichTextBox1_OnPaintNumbers);
+ this.FontChanged += new EventHandler(NumberedTextBoxUC_FontChanged);
+ this.syntaxRichTextBox1.OnCursorPositionChanged += new LSLEditor.SyntaxRichTextBox.CursorPositionChangedHandler(syntaxRichTextBox1_OnCursorPositionChanged);
+ }
+
+ void syntaxRichTextBox1_OnCursorPositionChanged(object sender, LSLEditor.SyntaxRichTextBox.CursorPositionEventArgs e)
+ {
+ this.numbered1.Invalidate();
+ }
+
+ void NumberedTextBoxUC_FontChanged(object sender, EventArgs e)
+ {
+ this.numbered1.LineHeight = 0.0F; // reset!!
+ RectangleF rect = LSLEditor.Helpers.Measure.MeasureDisplayString(this.syntaxRichTextBox1, "M", this.Font);
+ this.splitContainer1.SplitterDistance = (int)(4 * rect.Width + 5.0);
+ }
+
+ void syntaxRichTextBox1_OnPaintNumbers(object sender, EventArgs e)
+ {
+ this.numbered1.Invalidate();
+ }
+
+ public LSLEditor.SyntaxRichTextBox TextBox
+ {
+ get
+ {
+ return this.syntaxRichTextBox1;
+ }
+ }
+
+ }
+}
diff --git a/trunk/Editor/NumberedTextBoxUC.designer.cs b/source/Editor/NumberedTextBoxUC.designer.cs
similarity index 97%
rename from trunk/Editor/NumberedTextBoxUC.designer.cs
rename to source/Editor/NumberedTextBoxUC.designer.cs
index c5e7838..c2b9400 100644
--- a/trunk/Editor/NumberedTextBoxUC.designer.cs
+++ b/source/Editor/NumberedTextBoxUC.designer.cs
@@ -1,106 +1,106 @@
-namespace NumberedTextBox
-{
- partial class NumberedTextBoxUC
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.splitContainer1 = new System.Windows.Forms.SplitContainer();
- this.numbered1 = new LSLEditor.Editor.Numbered();
- this.syntaxRichTextBox1 = new LSLEditor.SyntaxRichTextBox();
- this.splitContainer1.Panel1.SuspendLayout();
- this.splitContainer1.Panel2.SuspendLayout();
- this.splitContainer1.SuspendLayout();
- this.SuspendLayout();
- //
- // splitContainer1
- //
- this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
- this.splitContainer1.IsSplitterFixed = true;
- this.splitContainer1.Location = new System.Drawing.Point(0, 0);
- this.splitContainer1.Name = "splitContainer1";
- //
- // splitContainer1.Panel1
- //
- this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ActiveBorder;
- this.splitContainer1.Panel1.Controls.Add(this.numbered1);
- //
- // splitContainer1.Panel2
- //
- this.splitContainer1.Panel2.Controls.Add(this.syntaxRichTextBox1);
- this.splitContainer1.Size = new System.Drawing.Size(403, 267);
- this.splitContainer1.SplitterDistance = 41;
- this.splitContainer1.SplitterWidth = 1;
- this.splitContainer1.TabIndex = 2;
- this.splitContainer1.Text = "splitContainer1";
- //
- // numbered1
- //
- this.numbered1.BackColor = System.Drawing.SystemColors.ButtonFace;
- this.numbered1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.numbered1.Location = new System.Drawing.Point(0, 0);
- this.numbered1.Name = "numbered1";
- this.numbered1.Size = new System.Drawing.Size(41, 267);
- this.numbered1.TabIndex = 0;
- //
- // syntaxRichTextBox1
- //
- this.syntaxRichTextBox1.AcceptsTab = true;
- this.syntaxRichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.syntaxRichTextBox1.DetectUrls = false;
- this.syntaxRichTextBox1.Dirty = true;
- this.syntaxRichTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.syntaxRichTextBox1.Location = new System.Drawing.Point(0, 0);
- this.syntaxRichTextBox1.Name = "syntaxRichTextBox1";
- this.syntaxRichTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
- this.syntaxRichTextBox1.Size = new System.Drawing.Size(361, 267);
- this.syntaxRichTextBox1.TabIndex = 0;
- this.syntaxRichTextBox1.Text = "";
- this.syntaxRichTextBox1.ToolTipping = false;
- this.syntaxRichTextBox1.WordWrap = false;
- //
- // NumberedTextBoxUC
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.splitContainer1);
- this.Name = "NumberedTextBoxUC";
- this.Size = new System.Drawing.Size(403, 267);
- this.splitContainer1.Panel1.ResumeLayout(false);
- this.splitContainer1.Panel2.ResumeLayout(false);
- this.splitContainer1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.SplitContainer splitContainer1;
- private LSLEditor.Editor.Numbered numbered1;
- private LSLEditor.SyntaxRichTextBox syntaxRichTextBox1;
- }
-}
+namespace NumberedTextBox
+{
+ partial class NumberedTextBoxUC
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.numbered1 = new LSLEditor.Editor.Numbered();
+ this.syntaxRichTextBox1 = new LSLEditor.SyntaxRichTextBox();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.splitContainer1.IsSplitterFixed = true;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ActiveBorder;
+ this.splitContainer1.Panel1.Controls.Add(this.numbered1);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.syntaxRichTextBox1);
+ this.splitContainer1.Size = new System.Drawing.Size(403, 267);
+ this.splitContainer1.SplitterDistance = 41;
+ this.splitContainer1.SplitterWidth = 1;
+ this.splitContainer1.TabIndex = 2;
+ this.splitContainer1.Text = "splitContainer1";
+ //
+ // numbered1
+ //
+ this.numbered1.BackColor = System.Drawing.SystemColors.ButtonFace;
+ this.numbered1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.numbered1.Location = new System.Drawing.Point(0, 0);
+ this.numbered1.Name = "numbered1";
+ this.numbered1.Size = new System.Drawing.Size(41, 267);
+ this.numbered1.TabIndex = 0;
+ //
+ // syntaxRichTextBox1
+ //
+ this.syntaxRichTextBox1.AcceptsTab = true;
+ this.syntaxRichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.syntaxRichTextBox1.DetectUrls = false;
+ this.syntaxRichTextBox1.Dirty = true;
+ this.syntaxRichTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.syntaxRichTextBox1.Location = new System.Drawing.Point(0, 0);
+ this.syntaxRichTextBox1.Name = "syntaxRichTextBox1";
+ this.syntaxRichTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
+ this.syntaxRichTextBox1.Size = new System.Drawing.Size(361, 267);
+ this.syntaxRichTextBox1.TabIndex = 0;
+ this.syntaxRichTextBox1.Text = "";
+ this.syntaxRichTextBox1.ToolTipping = false;
+ this.syntaxRichTextBox1.WordWrap = false;
+ //
+ // NumberedTextBoxUC
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.splitContainer1);
+ this.Name = "NumberedTextBoxUC";
+ this.Size = new System.Drawing.Size(403, 267);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private LSLEditor.Editor.Numbered numbered1;
+ private LSLEditor.SyntaxRichTextBox syntaxRichTextBox1;
+ }
+}
diff --git a/trunk/Editor/NumberedTextBoxUC.resx b/source/Editor/NumberedTextBoxUC.resx
similarity index 97%
rename from trunk/Editor/NumberedTextBoxUC.resx
rename to source/Editor/NumberedTextBoxUC.resx
index ff31a6d..19dc0dd 100644
--- a/trunk/Editor/NumberedTextBoxUC.resx
+++ b/source/Editor/NumberedTextBoxUC.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/trunk/Editor/RichLabel.Designer.cs b/source/Editor/RichLabel.Designer.cs
similarity index 95%
rename from trunk/Editor/RichLabel.Designer.cs
rename to source/Editor/RichLabel.Designer.cs
index 4dc493b..9bc6db4 100644
--- a/trunk/Editor/RichLabel.Designer.cs
+++ b/source/Editor/RichLabel.Designer.cs
@@ -1,42 +1,42 @@
-namespace LSLEditor
-{
- partial class RichLabel
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // RichLabel
- //
- this.Name = "RichLabel";
- this.ResumeLayout(false);
-
- }
-
- #endregion
- }
-}
+namespace LSLEditor
+{
+ partial class RichLabel
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.SuspendLayout();
+ //
+ // RichLabel
+ //
+ this.Name = "RichLabel";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/Editor/RichLabel.cs b/source/Editor/RichLabel.cs
similarity index 96%
rename from trunk/Editor/RichLabel.cs
rename to source/Editor/RichLabel.cs
index ccd7875..f7eb9e5 100644
--- a/trunk/Editor/RichLabel.cs
+++ b/source/Editor/RichLabel.cs
@@ -1,268 +1,268 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Drawing;
-using System.Globalization;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-
-namespace LSLEditor
-{
- public partial class RichLabel : UserControl
- {
- private Regex m_regex;
-
- public override string Text
- {
- get
- {
- return base.Text;
- }
- set
- {
- base.Text = value;
- this.Invalidate();
- }
- }
-
- public RichLabel()
- {
- InitializeComponent();
-
- this.SetStyle(
- ControlStyles.DoubleBuffer |
- ControlStyles.UserPaint |
- ControlStyles.AllPaintingInWmPaint,
- true);
-
- this.UpdateStyles();
-
- this.Text = "richLabel1";
- this.BackColor = Color.LightGoldenrodYellow;
-
- this.m_regex = new Regex(@"
-(?:
- <(?:
- (?[^>/\s]*)
- (? [\s]+ (?[^=]*) = ""(?[^""]*)"")*
- )>
-|
- <[/]* (?[^>\s/]*) [/]*>
-|
- (?[^<]*)
-)
-",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled);
-
- //this.m_regex = new Regex(@"(?\w*)");
- }
-
- private void SafePaint(PaintEventArgs e)
- {
- try
- {
- Graphics g = e.Graphics;
-
- e.Graphics.Clear(this.BackColor);
-
- Stack fontFace = new Stack();
- Stack fontSize = new Stack();
- Stack fontColor = new Stack();
- Stack fontStyle = new Stack();
-
- fontFace.Push(this.Font.Name);
- fontSize.Push(this.Font.Size);
- fontStyle.Push(this.Font.Style);
- fontColor.Push(this.ForeColor);
-
- float fltLineHeight = 0;
- float fltLineHeightMax = 0;
- float fltWidth = 0;
- float fltHeight = 0;
-
- PointF point = new PointF(this.Margin.Left, this.Margin.Top);
-
- string strLines = this.Text.Replace("\r", "").Replace("\n", "
");
- foreach (Match m in this.m_regex.Matches(strLines))
- {
- string strText = m.Groups["text"].Value.Replace("<", "<").Replace(">", ">");
-
- switch (m.Groups["startTag"].Value)
- {
- case "font":
- for (int intI = 0; intI < m.Groups["attName"].Captures.Count; intI++)
- {
- string strValue = m.Groups["attValue"].Captures[intI].Value;
- switch (m.Groups["attName"].Captures[intI].Value)
- {
- case "color":
- if (strValue.StartsWith("#"))
- {
- int intColor = 255;
- int.TryParse(strValue.Substring(1), NumberStyles.HexNumber, null, out intColor);
- fontColor.Push(Color.FromArgb(255, Color.FromArgb(intColor)));
- }
- else
- {
- fontColor.Push(Color.FromName(strValue));
- }
- break;
- case "face":
- fontFace.Push(strValue);
- break;
- case "size":
- float fltSize = 10.0F;
- float.TryParse(strValue, out fltSize);
- fontSize.Push(fltSize);
- break;
- default:
- break;
- }
- }
- break;
- case "b":
- fontStyle.Push(fontStyle.Peek() | FontStyle.Bold);
- break;
- case "u":
- fontStyle.Push(fontStyle.Peek() | FontStyle.Underline);
- break;
- case "i":
- fontStyle.Push(fontStyle.Peek() | FontStyle.Italic);
- break;
- case "s":
- fontStyle.Push(fontStyle.Peek() | FontStyle.Strikeout);
- break;
- case "br":
- point = new PointF(this.Margin.Left, point.Y + fltLineHeightMax);
- fltLineHeightMax = fltLineHeight;
- break;
- default:
- break;
- }
- switch (m.Groups["endTag"].Value)
- {
- case "font":
- if (fontColor.Count > 1)
- fontColor.Pop();
- if (fontSize.Count > 1)
- fontSize.Pop();
- if (fontFace.Count > 1)
- fontFace.Pop();
- break;
- case "b":
- case "u":
- case "i":
- case "s":
- if (fontStyle.Count > 1)
- fontStyle.Pop();
- break;
- case "br":
- point = new PointF(this.Margin.Left, point.Y + fltLineHeightMax);
- fltLineHeightMax = fltLineHeight;
- break;
- default:
- break;
- }
-
- if (strText.Length == 0)
- continue;
-
- Font fontTmp = new Font(fontFace.Peek(), fontSize.Peek(), fontStyle.Peek());
- Size rect = MeasureTextIncludingSpaces(g, strText, fontTmp); // TextRenderer.MeasureText(strText, fontTmp);
- PointF pointToDraw = new PointF(point.X, point.Y);
-
- point = new PointF(point.X + rect.Width, point.Y);
- fltWidth = Math.Max(fltWidth, point.X);
- fltHeight = Math.Max(fltHeight, point.Y + rect.Height);
- fltLineHeight = rect.Height;
- fltLineHeightMax = Math.Max(fltLineHeightMax, fltLineHeight);
-
- Brush brush = new SolidBrush(fontColor.Peek());
- g.DrawString(strText, fontTmp, brush, pointToDraw);
- brush.Dispose();
- fontTmp.Dispose();
- }
- int intWidth = (int)fltWidth + (Margin.Right <<1);
- int intHeight = (int)fltHeight + Margin.Bottom;
- this.Size = new Size(intWidth, intHeight);
-
- //System.Drawing.Drawing2D.GraphicsPath path = Editor.RoundCorners.RoundedRectangle(new Rectangle(this.Location, this.Size), 10);
- //g.DrawPath(new Pen(Color.Black,2F), path);
- //this.Region = Editor.RoundCorners.RoundedRegion(this.Size, 4);
- }
- catch
- {
- }
- }
-
- public static SizeF MeasureTextVisible(Graphics graphics, string text, Font font)
- {
- StringFormat format = new StringFormat();
- RectangleF rect = new RectangleF(0, 0, 4096, 1000);
- CharacterRange[] ranges = { new CharacterRange(0, text.Length) };
- format.SetMeasurableCharacterRanges(ranges);
- Region[] regions = graphics.MeasureCharacterRanges(text, font, rect, format);
- rect = regions[0].GetBounds(graphics);
- return new SizeF(rect.Width, rect.Height);
- }
-
- public static Size MeasureTextIncludingSpaces(Graphics graphics, string text, Font font)
- {
- SizeF sizePostfix = MeasureTextVisible(graphics, "|", font);
- SizeF size = MeasureTextVisible(graphics, text + "|", font);
- return new Size((int)(size.Width - sizePostfix.Width + 1), (int)(size.Height + 1));
- }
-
-
- protected override void OnPaint(PaintEventArgs e)
- {
- SafePaint(e);
- }
-
- protected override void OnPaintBackground(PaintEventArgs e)
- {
- // base.OnPaintBackground(e);
- }
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Drawing;
+using System.Globalization;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+
+namespace LSLEditor
+{
+ public partial class RichLabel : UserControl
+ {
+ private Regex m_regex;
+
+ public override string Text
+ {
+ get
+ {
+ return base.Text;
+ }
+ set
+ {
+ base.Text = value;
+ this.Invalidate();
+ }
+ }
+
+ public RichLabel()
+ {
+ InitializeComponent();
+
+ this.SetStyle(
+ ControlStyles.DoubleBuffer |
+ ControlStyles.UserPaint |
+ ControlStyles.AllPaintingInWmPaint,
+ true);
+
+ this.UpdateStyles();
+
+ this.Text = "richLabel1";
+ this.BackColor = Color.LightGoldenrodYellow;
+
+ this.m_regex = new Regex(@"
+(?:
+ <(?:
+ (?[^>/\s]*)
+ (? [\s]+ (?[^=]*) = ""(?[^""]*)"")*
+ )>
+|
+ <[/]* (?[^>\s/]*) [/]*>
+|
+ (?[^<]*)
+)
+",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled);
+
+ //this.m_regex = new Regex(@"(?\w*)");
+ }
+
+ private void SafePaint(PaintEventArgs e)
+ {
+ try
+ {
+ Graphics g = e.Graphics;
+
+ e.Graphics.Clear(this.BackColor);
+
+ Stack fontFace = new Stack();
+ Stack fontSize = new Stack();
+ Stack fontColor = new Stack();
+ Stack fontStyle = new Stack();
+
+ fontFace.Push(this.Font.Name);
+ fontSize.Push(this.Font.Size);
+ fontStyle.Push(this.Font.Style);
+ fontColor.Push(this.ForeColor);
+
+ float fltLineHeight = 0;
+ float fltLineHeightMax = 0;
+ float fltWidth = 0;
+ float fltHeight = 0;
+
+ PointF point = new PointF(this.Margin.Left, this.Margin.Top);
+
+ string strLines = this.Text.Replace("\r", "").Replace("\n", "
");
+ foreach (Match m in this.m_regex.Matches(strLines))
+ {
+ string strText = m.Groups["text"].Value.Replace("<", "<").Replace(">", ">");
+
+ switch (m.Groups["startTag"].Value)
+ {
+ case "font":
+ for (int intI = 0; intI < m.Groups["attName"].Captures.Count; intI++)
+ {
+ string strValue = m.Groups["attValue"].Captures[intI].Value;
+ switch (m.Groups["attName"].Captures[intI].Value)
+ {
+ case "color":
+ if (strValue.StartsWith("#"))
+ {
+ int intColor = 255;
+ int.TryParse(strValue.Substring(1), NumberStyles.HexNumber, null, out intColor);
+ fontColor.Push(Color.FromArgb(255, Color.FromArgb(intColor)));
+ }
+ else
+ {
+ fontColor.Push(Color.FromName(strValue));
+ }
+ break;
+ case "face":
+ fontFace.Push(strValue);
+ break;
+ case "size":
+ float fltSize = 10.0F;
+ float.TryParse(strValue, out fltSize);
+ fontSize.Push(fltSize);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case "b":
+ fontStyle.Push(fontStyle.Peek() | FontStyle.Bold);
+ break;
+ case "u":
+ fontStyle.Push(fontStyle.Peek() | FontStyle.Underline);
+ break;
+ case "i":
+ fontStyle.Push(fontStyle.Peek() | FontStyle.Italic);
+ break;
+ case "s":
+ fontStyle.Push(fontStyle.Peek() | FontStyle.Strikeout);
+ break;
+ case "br":
+ point = new PointF(this.Margin.Left, point.Y + fltLineHeightMax);
+ fltLineHeightMax = fltLineHeight;
+ break;
+ default:
+ break;
+ }
+ switch (m.Groups["endTag"].Value)
+ {
+ case "font":
+ if (fontColor.Count > 1)
+ fontColor.Pop();
+ if (fontSize.Count > 1)
+ fontSize.Pop();
+ if (fontFace.Count > 1)
+ fontFace.Pop();
+ break;
+ case "b":
+ case "u":
+ case "i":
+ case "s":
+ if (fontStyle.Count > 1)
+ fontStyle.Pop();
+ break;
+ case "br":
+ point = new PointF(this.Margin.Left, point.Y + fltLineHeightMax);
+ fltLineHeightMax = fltLineHeight;
+ break;
+ default:
+ break;
+ }
+
+ if (strText.Length == 0)
+ continue;
+
+ Font fontTmp = new Font(fontFace.Peek(), fontSize.Peek(), fontStyle.Peek());
+ Size rect = MeasureTextIncludingSpaces(g, strText, fontTmp); // TextRenderer.MeasureText(strText, fontTmp);
+ PointF pointToDraw = new PointF(point.X, point.Y);
+
+ point = new PointF(point.X + rect.Width, point.Y);
+ fltWidth = Math.Max(fltWidth, point.X);
+ fltHeight = Math.Max(fltHeight, point.Y + rect.Height);
+ fltLineHeight = rect.Height;
+ fltLineHeightMax = Math.Max(fltLineHeightMax, fltLineHeight);
+
+ Brush brush = new SolidBrush(fontColor.Peek());
+ g.DrawString(strText, fontTmp, brush, pointToDraw);
+ brush.Dispose();
+ fontTmp.Dispose();
+ }
+ int intWidth = (int)fltWidth + (Margin.Right <<1);
+ int intHeight = (int)fltHeight + Margin.Bottom;
+ this.Size = new Size(intWidth, intHeight);
+
+ //System.Drawing.Drawing2D.GraphicsPath path = Editor.RoundCorners.RoundedRectangle(new Rectangle(this.Location, this.Size), 10);
+ //g.DrawPath(new Pen(Color.Black,2F), path);
+ //this.Region = Editor.RoundCorners.RoundedRegion(this.Size, 4);
+ }
+ catch
+ {
+ }
+ }
+
+ public static SizeF MeasureTextVisible(Graphics graphics, string text, Font font)
+ {
+ StringFormat format = new StringFormat();
+ RectangleF rect = new RectangleF(0, 0, 4096, 1000);
+ CharacterRange[] ranges = { new CharacterRange(0, text.Length) };
+ format.SetMeasurableCharacterRanges(ranges);
+ Region[] regions = graphics.MeasureCharacterRanges(text, font, rect, format);
+ rect = regions[0].GetBounds(graphics);
+ return new SizeF(rect.Width, rect.Height);
+ }
+
+ public static Size MeasureTextIncludingSpaces(Graphics graphics, string text, Font font)
+ {
+ SizeF sizePostfix = MeasureTextVisible(graphics, "|", font);
+ SizeF size = MeasureTextVisible(graphics, text + "|", font);
+ return new Size((int)(size.Width - sizePostfix.Width + 1), (int)(size.Height + 1));
+ }
+
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ SafePaint(e);
+ }
+
+ protected override void OnPaintBackground(PaintEventArgs e)
+ {
+ // base.OnPaintBackground(e);
+ }
+
+ }
+}
diff --git a/trunk/Editor/RichLabel.resx b/source/Editor/RichLabel.resx
similarity index 97%
rename from trunk/Editor/RichLabel.resx
rename to source/Editor/RichLabel.resx
index ff31a6d..19dc0dd 100644
--- a/trunk/Editor/RichLabel.resx
+++ b/source/Editor/RichLabel.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/trunk/Editor/RoundCorners.cs b/source/Editor/RoundCorners.cs
similarity index 97%
rename from trunk/Editor/RoundCorners.cs
rename to source/Editor/RoundCorners.cs
index bb35196..a692556 100644
--- a/trunk/Editor/RoundCorners.cs
+++ b/source/Editor/RoundCorners.cs
@@ -1,189 +1,189 @@
-//Author: Arman Ghazanchyan
-//Created date: 01/27/2007
-//Last updated: 01/28/2007
-using System;
-
-using System.Drawing;
-using System.Drawing.Drawing2D;
-
-namespace LSLEditor.Editor
-{
- class RoundCorners
- {
- ///
- /// Rounds a rectangle corners' and returns the graphics path.
- ///
- /// A rectangle whose corners should be rounded.
- /// The radius of the rounded corners. This value should be
- /// bigger then 0 and less or equal to the (a half of the smallest value
- /// of the rectangle’s width and height).
- /// A value that specifies if the top-left
- /// corner of the rectangle should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- /// A value that specifies if the top-right
- /// corner of the rectangle should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- /// A value that specifies if the bottom-right
- /// corner of the rectangle should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- /// A value that specifies if the bottom-left
- /// corner of the rectangle should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- public static GraphicsPath RoundedRectangle(Rectangle rec, int r)
- {
- return RoundedRectangle(rec,r,false,false,false,false);
- }
-
- public static GraphicsPath RoundedRectangle(Rectangle rec, int r,
- bool exclude_TopLeft,
- bool exclude_TopRight,
- bool exclude_BottomRight,
- bool exclude_BottomLeft)
- {
- GraphicsPath path = new GraphicsPath();
- int s = r * 2;
- //If 's' is less than or equal to zero,
- //then return a simple rectangle.
- if (s <= 0)
- {
- path.StartFigure();
- path.AddLine(rec.Right, rec.Y, rec.Right, rec.Y);
- path.AddLine(rec.Right, rec.Bottom, rec.Right, rec.Bottom);
- path.AddLine(rec.X, rec.Bottom, rec.X, rec.Bottom);
- path.AddLine(rec.X, rec.Y, rec.X, rec.Y);
- path.CloseAllFigures();
- return path;
- }
- //If 's' is bigger than the smallest value of the size,
- //then assign the value to 's'.
- if (rec.Height <= rec.Width)
- {
- if (s > rec.Height)
- s = rec.Height;
- }
- else
- {
- if (s > rec.Width)
- s = rec.Width;
- }
-
- path.StartFigure();
- //Set top-right corner.
- if (!exclude_TopRight)
- path.AddArc(rec.Right - s, rec.Y, s, s, 270, 90);
- else
- path.AddLine(rec.Right, rec.Y, rec.Right, rec.Y);
-
- //Set bottom-right corner.
- if (!exclude_BottomRight)
- path.AddArc(rec.Right - s, rec.Bottom - s, s, s, 0, 90);
- else
- path.AddLine(rec.Right, rec.Bottom, rec.Right, rec.Bottom);
-
- //Set bottom-left corner.
- if (!exclude_BottomLeft)
- path.AddArc(rec.X, rec.Bottom - s, s, s, 90, 90);
- else
- path.AddLine(rec.X, rec.Bottom, rec.X, rec.Bottom);
-
- //Set top-left corner.
- if (!exclude_TopLeft)
- path.AddArc(rec.X, rec.Y, s, s, 180, 90);
- else
- path.AddLine(rec.X, rec.Y, rec.X, rec.Y);
-
- path.CloseAllFigures();
- return path;
- }
-
- ///
- /// Rounds the corners of the newly created rectangle-shape region and returns the region.
- ///
- /// The size of the region.
- /// The radius of the rounded corners. This value should be
- /// bigger then 0 and less or equal to the (a half of the smallest value
- /// of the region’s width and height).
- /// A value that specifies if the top-left
- /// corner of the region should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- /// A value that specifies if the top-right
- /// corner of the region should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- /// A value that specifies if the bottom-right
- /// corner of the region should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- /// A value that specifies if the bottom-left
- /// corner of the region should be rounded. If the value is True
- /// then the corner is not rounded otherwise it is.
- public static Region RoundedRegion(Size rSize, int r)
- {
- return RoundedRegion(rSize, r, false, false, false, false);
- }
-
- public static Region RoundedRegion(Size rSize, int r,
- bool exclude_TopLeft,
- bool exclude_TopRight,
- bool exclude_BottomRight,
- bool exclude_BottomLeft)
- {
- int s = r * 2;
- GraphicsPath path = new GraphicsPath();
- //If 's' is less than or equal to zero,
- //then return a simple rectangle.
- if (s <= 0)
- {
- path.StartFigure();
- path.AddLine(rSize.Width, 0, rSize.Width, 0);
- path.AddLine(rSize.Width, rSize.Height, rSize.Width, rSize.Height);
- path.AddLine(0, rSize.Height, 0, rSize.Height);
- path.AddLine(0, 0, 0, 0);
- path.CloseAllFigures();
- return new Region(path);
- }
- //If 's' is bigger than the smallest value of the size,
- //then assign the value to 's'.
- if (rSize.Height < rSize.Width)
- {
- if (s > rSize.Height)
- s = rSize.Height;
- }
- else
- {
- if (s > rSize.Width)
- s = rSize.Width;
- }
- path.StartFigure();
- //Set top-right corner.
- if (!exclude_TopRight)
- path.AddArc(rSize.Width - s, 0, s - 1, s - 1, 270, 90);
- else
- path.AddLine(rSize.Width, 0, rSize.Width, 0);
- //Set bottom-right corner.
- if (!exclude_BottomRight)
- {
- path.AddLine(rSize.Width, r, rSize.Width, rSize.Height - r);
- path.AddArc(rSize.Width - s, rSize.Height - s, s - 1, s - 1, 0, 90);
- }
- else
- path.AddLine(rSize.Width, rSize.Height, rSize.Width, rSize.Height);
-
- //Set bottom-left corner.
- if (!exclude_BottomLeft)
- {
- path.AddLine(rSize.Width - r, rSize.Height, r, rSize.Height);
- path.AddArc(0, rSize.Height - s, s - 1, s - 1, 90, 90);
- }
- else
- path.AddLine(0, rSize.Height, 0, rSize.Height);
-
- //Set top-left corner.
- if (!exclude_TopLeft)
- path.AddArc(0, 0, s - 1, s - 1, 180, 90);
- else
- path.AddLine(0, 0, 0, 0);
-
- path.CloseAllFigures();
- return new Region(path);
- }
- }
-}
+//Author: Arman Ghazanchyan
+//Created date: 01/27/2007
+//Last updated: 01/28/2007
+using System;
+
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace LSLEditor.Editor
+{
+ class RoundCorners
+ {
+ ///
+ /// Rounds a rectangle corners' and returns the graphics path.
+ ///
+ /// A rectangle whose corners should be rounded.
+ /// The radius of the rounded corners. This value should be
+ /// bigger then 0 and less or equal to the (a half of the smallest value
+ /// of the rectangle’s width and height).
+ /// A value that specifies if the top-left
+ /// corner of the rectangle should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ /// A value that specifies if the top-right
+ /// corner of the rectangle should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ /// A value that specifies if the bottom-right
+ /// corner of the rectangle should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ /// A value that specifies if the bottom-left
+ /// corner of the rectangle should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ public static GraphicsPath RoundedRectangle(Rectangle rec, int r)
+ {
+ return RoundedRectangle(rec,r,false,false,false,false);
+ }
+
+ public static GraphicsPath RoundedRectangle(Rectangle rec, int r,
+ bool exclude_TopLeft,
+ bool exclude_TopRight,
+ bool exclude_BottomRight,
+ bool exclude_BottomLeft)
+ {
+ GraphicsPath path = new GraphicsPath();
+ int s = r * 2;
+ //If 's' is less than or equal to zero,
+ //then return a simple rectangle.
+ if (s <= 0)
+ {
+ path.StartFigure();
+ path.AddLine(rec.Right, rec.Y, rec.Right, rec.Y);
+ path.AddLine(rec.Right, rec.Bottom, rec.Right, rec.Bottom);
+ path.AddLine(rec.X, rec.Bottom, rec.X, rec.Bottom);
+ path.AddLine(rec.X, rec.Y, rec.X, rec.Y);
+ path.CloseAllFigures();
+ return path;
+ }
+ //If 's' is bigger than the smallest value of the size,
+ //then assign the value to 's'.
+ if (rec.Height <= rec.Width)
+ {
+ if (s > rec.Height)
+ s = rec.Height;
+ }
+ else
+ {
+ if (s > rec.Width)
+ s = rec.Width;
+ }
+
+ path.StartFigure();
+ //Set top-right corner.
+ if (!exclude_TopRight)
+ path.AddArc(rec.Right - s, rec.Y, s, s, 270, 90);
+ else
+ path.AddLine(rec.Right, rec.Y, rec.Right, rec.Y);
+
+ //Set bottom-right corner.
+ if (!exclude_BottomRight)
+ path.AddArc(rec.Right - s, rec.Bottom - s, s, s, 0, 90);
+ else
+ path.AddLine(rec.Right, rec.Bottom, rec.Right, rec.Bottom);
+
+ //Set bottom-left corner.
+ if (!exclude_BottomLeft)
+ path.AddArc(rec.X, rec.Bottom - s, s, s, 90, 90);
+ else
+ path.AddLine(rec.X, rec.Bottom, rec.X, rec.Bottom);
+
+ //Set top-left corner.
+ if (!exclude_TopLeft)
+ path.AddArc(rec.X, rec.Y, s, s, 180, 90);
+ else
+ path.AddLine(rec.X, rec.Y, rec.X, rec.Y);
+
+ path.CloseAllFigures();
+ return path;
+ }
+
+ ///
+ /// Rounds the corners of the newly created rectangle-shape region and returns the region.
+ ///
+ /// The size of the region.
+ /// The radius of the rounded corners. This value should be
+ /// bigger then 0 and less or equal to the (a half of the smallest value
+ /// of the region’s width and height).
+ /// A value that specifies if the top-left
+ /// corner of the region should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ /// A value that specifies if the top-right
+ /// corner of the region should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ /// A value that specifies if the bottom-right
+ /// corner of the region should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ /// A value that specifies if the bottom-left
+ /// corner of the region should be rounded. If the value is True
+ /// then the corner is not rounded otherwise it is.
+ public static Region RoundedRegion(Size rSize, int r)
+ {
+ return RoundedRegion(rSize, r, false, false, false, false);
+ }
+
+ public static Region RoundedRegion(Size rSize, int r,
+ bool exclude_TopLeft,
+ bool exclude_TopRight,
+ bool exclude_BottomRight,
+ bool exclude_BottomLeft)
+ {
+ int s = r * 2;
+ GraphicsPath path = new GraphicsPath();
+ //If 's' is less than or equal to zero,
+ //then return a simple rectangle.
+ if (s <= 0)
+ {
+ path.StartFigure();
+ path.AddLine(rSize.Width, 0, rSize.Width, 0);
+ path.AddLine(rSize.Width, rSize.Height, rSize.Width, rSize.Height);
+ path.AddLine(0, rSize.Height, 0, rSize.Height);
+ path.AddLine(0, 0, 0, 0);
+ path.CloseAllFigures();
+ return new Region(path);
+ }
+ //If 's' is bigger than the smallest value of the size,
+ //then assign the value to 's'.
+ if (rSize.Height < rSize.Width)
+ {
+ if (s > rSize.Height)
+ s = rSize.Height;
+ }
+ else
+ {
+ if (s > rSize.Width)
+ s = rSize.Width;
+ }
+ path.StartFigure();
+ //Set top-right corner.
+ if (!exclude_TopRight)
+ path.AddArc(rSize.Width - s, 0, s - 1, s - 1, 270, 90);
+ else
+ path.AddLine(rSize.Width, 0, rSize.Width, 0);
+ //Set bottom-right corner.
+ if (!exclude_BottomRight)
+ {
+ path.AddLine(rSize.Width, r, rSize.Width, rSize.Height - r);
+ path.AddArc(rSize.Width - s, rSize.Height - s, s - 1, s - 1, 0, 90);
+ }
+ else
+ path.AddLine(rSize.Width, rSize.Height, rSize.Width, rSize.Height);
+
+ //Set bottom-left corner.
+ if (!exclude_BottomLeft)
+ {
+ path.AddLine(rSize.Width - r, rSize.Height, r, rSize.Height);
+ path.AddArc(0, rSize.Height - s, s - 1, s - 1, 90, 90);
+ }
+ else
+ path.AddLine(0, rSize.Height, 0, rSize.Height);
+
+ //Set top-left corner.
+ if (!exclude_TopLeft)
+ path.AddArc(0, 0, s - 1, s - 1, 180, 90);
+ else
+ path.AddLine(0, 0, 0, 0);
+
+ path.CloseAllFigures();
+ return new Region(path);
+ }
+ }
+}
diff --git a/trunk/Editor/SyntaxRichTextBox.cs b/source/Editor/SyntaxRichTextBox.cs
similarity index 96%
rename from trunk/Editor/SyntaxRichTextBox.cs
rename to source/Editor/SyntaxRichTextBox.cs
index 53df880..d3421f3 100644
--- a/trunk/Editor/SyntaxRichTextBox.cs
+++ b/source/Editor/SyntaxRichTextBox.cs
@@ -1,2261 +1,2261 @@
-// /**
-// ********
-// *
-// * ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
-// * The code was donated on 4/28/2010 by Alphons van der Heijden
-// * To Brandon 'Dimentox Travanti' Husbands & Malcolm J. Kudra, who in turn License under the GPLv2.
-// * In agreement with Alphons van der Heijden's wishes.
-// *
-// * The community would like to thank Alphons for all of his hard work, blood sweat and tears.
-// * Without his work the community would be stuck with crappy editors.
-// *
-// * The source code in this file ("Source Code") is provided by The LSLEditor Group
-// * to you under the terms of the GNU General Public License, version 2.0
-// * ("GPL"), unless you have obtained a separate licensing agreement
-// * ("Other License"), formally executed by you and The LSLEditor Group. Terms of
-// * the GPL can be found in the gplv2.txt document.
-// *
-// ********
-// * GPLv2 Header
-// ********
-// * LSLEditor, a External editor for the LSL Language.
-// * Copyright (C) 2010 The LSLEditor Group.
-//
-// * This program is free software; you can redistribute it and/or
-// * modify it under the terms of the GNU General Public License
-// * as published by the Free Software Foundation; either version 2
-// * of the License, or (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program; if not, write to the Free Software
-// * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********
-// *
-// * The above copyright notice and this permission notice shall be included in all
-// * copies or substantial portions of the Software.
-// *
-// ********
-// */
-using System;
-using System.IO;
-using System.Xml;
-using System.Text;
-using System.Drawing;
-
-using System.Collections.Generic;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Drawing.Printing;
-using System.Text.RegularExpressions;
-using System.Runtime.InteropServices;
-using System.Diagnostics;
-
-using LSLEditor.Helpers;
-
-namespace LSLEditor
-{
- public delegate void IsDirtyHandler(object sender, EventArgs e);
-
- public class SyntaxRichTextBox : RichTextBox
- {
- private const int WM_SETREDRAW = 0x000B;
- private const int WM_USER = 0x400;
- private const int EM_GETEVENTMASK = (WM_USER + 59);
- private const int EM_SETEVENTMASK = (WM_USER + 69);
-
- // Scroll position
- [DllImport("user32.dll")]
- private static extern int SendMessage(IntPtr hwndLock, Int32 wMsg, Int32 wParam, ref Point pt);
-
- // Anti flicker
- [DllImport("user32", CharSet = CharSet.Auto)]
- private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
-
- // Tabs
- [DllImport("User32", CharSet = CharSet.Auto)]
- public static extern IntPtr SendMessage(IntPtr h, int msg, int wParam, int[] lParam);
-
- private bool m_Dirty;
-
- private bool blnEscape;
-
- private bool blnInsert;
-
- // for tooltipping
- private bool m_blnToolTipping;
- private System.Windows.Forms.Timer timer1;
- private GListBoxWindow GListBoxWindow;
- private TooltipWindow TooltipMouse;
- private TooltipWindow TooltipKeyboard;
- private TooltipWindow TooltipListBox;
-
- private Point OldMouseLocation;
-
- private int intKeyWordLength;
-
- // needed for flicker-free updates
- private int intUpdate;
- private IntPtr eventMask;
-
- private int intOldLines;
-
- // colored words
- private KeyWords keyWords;
-
- private Helpers.CodeCompletion codeCompletion;
-
- // after clicking on error
- private int HighLightLine;
-
- // bracket highlighting
- private List HighLightList;
- public EditForm p;
- public float CharWidth;
- public int LineHeight;
-
- // undo
- private struct UndoElement
- {
- public int SelectionStart;
- public int SelectionLength;
- public string SelectedText;
- public string RedoText;
- public UndoElement(int SelectionStart, string SelectedText, int SelectionLength, string RedoText)
- {
- this.SelectionStart = SelectionStart;
- this.SelectionLength = SelectionLength;
- this.SelectedText = SelectedText;
- this.RedoText = RedoText;
- }
- }
- private Stack UndoStack;
- private Stack RedoStack;
-
- #region printing
- //Convert the unit used by the .NET framework (1/100 inch)
- //and the unit used by Win32 API calls (twips 1/1440 inch)
- private const double anInch = 14.4;
-
- [StructLayout(LayoutKind.Sequential)]
- private struct RECT
- {
- public int Left;
- public int Top;
- public int Right;
- public int Bottom;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- private struct CHARRANGE
- {
- public int cpMin; //First character of range (0 for start of doc)
- public int cpMax; //Last character of range (-1 for end of doc)
- }
-
- [StructLayout(LayoutKind.Sequential)]
- private struct FORMATRANGE
- {
- public IntPtr hdc; //Actual DC to draw on
- public IntPtr hdcTarget; //Target DC for determining text formatting
- public RECT rc; //Region of the DC to draw to (in twips)
- public RECT rcPage; //Region of the whole DC (page size) (in twips)
- public CHARRANGE chrg; //Range of text to draw (see earlier declaration)
- }
-
- private const int EM_FORMATRANGE = WM_USER + 57;
-
- [DllImport("user32", CharSet = CharSet.Auto)]
- private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
-
- // Render the contents of the RichTextBox for printing
- // Return the last character printed + 1 (printing start from this point for next page)
- public int Print(int charFrom, int charTo, PrintPageEventArgs e)
- {
- //Calculate the area to render and print
- RECT rectToPrint;
- rectToPrint.Top = (int)(e.MarginBounds.Top * anInch);
- rectToPrint.Bottom = (int)(e.MarginBounds.Bottom * anInch);
- rectToPrint.Left = (int)(e.MarginBounds.Left * anInch);
- rectToPrint.Right = (int)(e.MarginBounds.Right * anInch);
-
- //Calculate the size of the page
- RECT rectPage;
- rectPage.Top = (int)(e.PageBounds.Top * anInch);
- rectPage.Bottom = (int)(e.PageBounds.Bottom * anInch);
- rectPage.Left = (int)(e.PageBounds.Left * anInch);
- rectPage.Right = (int)(e.PageBounds.Right * anInch);
-
- IntPtr hdc = e.Graphics.GetHdc();
-
- FORMATRANGE fmtRange;
- fmtRange.chrg.cpMax = charTo; //Indicate character from to character to
- fmtRange.chrg.cpMin = charFrom;
- fmtRange.hdc = hdc; //Use the same DC for measuring and rendering
- fmtRange.hdcTarget = hdc; //Point at printer hDC
- fmtRange.rc = rectToPrint; //Indicate the area on page to print
- fmtRange.rcPage = rectPage; //Indicate size of page
-
- IntPtr wparam = new IntPtr(1);
-
- //Get the pointer to the FORMATRANGE structure in memory
- IntPtr lparam = Marshal.AllocCoTaskMem(Marshal.SizeOf(fmtRange));
- Marshal.StructureToPtr(fmtRange, lparam, false);
-
- //Send the rendered data for printing
- IntPtr res = SendMessage(Handle, EM_FORMATRANGE, wparam, lparam);
-
- //Free the block of memory allocated
- Marshal.FreeCoTaskMem(lparam);
-
- //Release the device context handle obtained by a previous call
- e.Graphics.ReleaseHdc(hdc);
-
- //Return last + 1 character printer
- return res.ToInt32();
- }
- #endregion
-
- public event IsDirtyHandler OnDirtyChanged;
- public event EventHandler OnPaintNumbers;
-
- public delegate void CursorPositionChangedHandler(object sender, CursorPositionEventArgs e);
- public event CursorPositionChangedHandler OnCursorPositionChanged;
- public class CursorPositionEventArgs : EventArgs
- {
- public int Line;
- public int Column;
- public int Char;
- public int Total;
- public bool Insert;
- public bool Caps;
- public CursorPositionEventArgs(int intLine, int intColumn, int intChar, int intTotal, bool blnInsert, bool blnCaps)
- {
- this.Line = intLine;
- this.Column = intColumn;
- this.Char = intChar;
- this.Total = intTotal;
- this.Insert = blnInsert;
- this.Caps = blnCaps;
- }
- }
-
- public SyntaxRichTextBox()
- {
- this.intUpdate = 0;
- this.eventMask = IntPtr.Zero;
- this.m_blnToolTipping = false;
-
- this.intKeyWordLength = 0;
-
- this.AcceptsTab = true;
- this.BorderStyle = BorderStyle.None;
- this.DetectUrls = false;
- this.Dirty = false;
-
- this.ScrollBars = RichTextBoxScrollBars.ForcedBoth;
- this.WordWrap = false;
-
- this.FontChanged += new EventHandler(SyntaxRichTextBox_FontChanged);
-
- this.MouseMove += new MouseEventHandler(SyntaxRichTextBox_MouseMove);
-
- this.VScroll += new EventHandler(SyntaxRichTextBox_Position);
- this.HScroll += new EventHandler(SyntaxRichTextBox_Position);
-
- this.HighLightLine = -1;
- this.HighLightList = new List();
-
- this.UndoStack = new Stack();
- this.RedoStack = new Stack();
-
- this.blnEscape = false;
-
- this.blnInsert = true;
-
- this.intOldLines = -1;
-
- this.CharWidth = 10; //TODO
- this.LineHeight = 16;
-
- this.OldMouseLocation = Point.Empty;
-
- this.codeCompletion = new Helpers.CodeCompletion();
-
- this.HideSelection = false;
-
- // are these of any use?
- //this.DoubleBuffered = true;
- //SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- //SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- //SetStyle(ControlStyles.Opaque, true);
- }
- public void setEditform(EditForm ed)
- {
- p = ed;
- }
- public void Init(LSLEditorForm parent, XmlDocument xml)
- {
- if (parent != null)
- {
- this.ToolTipping = true;
- this.GListBoxWindow = parent.GListBoxWindow;
- this.TooltipMouse = parent.TooltipMouse;
- this.TooltipKeyboard = parent.TooltipKeyboard;
- this.TooltipListBox = parent.TooltipListBox;
- // p = this.Parent as EditForm;
- // p = parent; moved to edit form
- }
-
- string ColorScheme = "color";
- if (this.ToolTipping)
- {
- if (Properties.Settings.Default.SLColorScheme)
- {
- ColorScheme = "sl" + ColorScheme;
- }
-
- XmlNode BackgroundColorNode = xml.SelectSingleNode("/Conf");
- if (BackgroundColorNode != null)
- {
- Color bgColor = Color.FromArgb(255, Color.FromArgb(int.Parse(BackgroundColorNode.Attributes[ColorScheme].InnerText.Replace("#", ""), System.Globalization.NumberStyles.HexNumber)));
- this.BackColor = bgColor;
- }
- }
- keyWords = new KeyWords(ColorScheme, xml);
- }
-
- private void MeasureFont()
- {
- Size size = TextRenderer.MeasureText("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM", this.Font);
- CharWidth = (int)(size.Width / 50.0F);
- LineHeight = size.Height;
- }
-
- void SyntaxRichTextBox_FontChanged(object sender, EventArgs e)
- {
- this.SelectAll();
-
- TabStops();
-
- // recolor all
- ColorLine(0, this.Text.Length);
- }
-
- private void TabStops()
- {
- MeasureFont();
-
- const int EM_SETTABSTOPS = 0xCB;
-
- int intNumberOfChars = Properties.Settings.Default.TabStops;
- int[] tabs = new int[30]; // TODO
- float fltTabWidth = intNumberOfChars * CharWidth;
-
- float totalWidth = 0.0F;
- for (int intI = 0; intI < tabs.Length; intI++)
- {
- totalWidth += fltTabWidth;
- tabs[intI] = (int)totalWidth;
- }
-
- SendMessage(this.Handle, EM_SETTABSTOPS, 0, null);
- SendMessage(this.Handle, EM_SETTABSTOPS, tabs.Length, tabs);
-
- this.SelectionTabs = tabs;
- }
-
- private void PaintNumbers()
- {
- if (OnPaintNumbers != null)
- OnPaintNumbers(null, null);
- }
-
- protected override void OnVScroll(EventArgs e)
- {
- base.OnVScroll(e);
- PaintNumbers();
- }
-
-
- private Point RTBScrollPos
- {
- get
- {
- const int EM_GETSCROLLPOS = 0x0400 + 221;
- Point pt = new Point();
-
- SendMessage(this.Handle, EM_GETSCROLLPOS, 0, ref pt);
- return pt;
- }
- set
- {
- const int EM_SETSCROLLPOS = 0x0400 + 222;
-
- SendMessage(this.Handle, EM_SETSCROLLPOS, 0, ref value);
- }
- }
-
-
- public bool Dirty
- {
- get
- {
- return m_Dirty;
- }
- set
- {
- if (this.m_Dirty == value)
- return;
- this.m_Dirty = value;
-
- if (OnDirtyChanged == null)
- return;
-
- OnDirtyChanged(this, new EventArgs());
- }
- }
-
- private void SyntaxRichTextBox_Position(object sender, EventArgs e)
- {
- SetPosition(Screen.GetWorkingArea(this));
- }
-
- private void SyntaxRichTextBox_MouseMove(object sender, MouseEventArgs e)
- {
- if (!ToolTipping)
- return;
-
- if (this.timer1 == null)
- return;
-
- this.timer1.Stop();
- if (OldMouseLocation != e.Location)
- {
- OldMouseLocation = e.Location;
- this.timer1.Start();
- }
- }
-
- private int GetLine()
- {
- return 1 + this.GetLineFromCharIndex(this.SelectionStart);
- }
-
- private int GetChar()
- {
- return 1 + this.SelectionStart - this.GetFirstCharIndexOfCurrentLine();
- }
-
- private int GetColumn()
- {
- Point p1 = this.GetPositionFromCharIndex(this.GetFirstCharIndexOfCurrentLine());
- Point p2 = this.GetPositionFromCharIndex(this.SelectionStart);
- int intColumn = (int)((p2.X - p1.X) / this.CharWidth);
- return 1+ intColumn;
- }
-
- private int GetTotal()
- {
- return this.Text.Length;
- }
-
- public void Goto(int Line, int Char)
- {
- BeginUpdate();
- LineDownlighting();
-
- try
- {
- int intLine = Line - 1;
- if (intLine < 0)
- intLine = 0;
- if (intLine >= this.Lines.Length)
- intLine = this.Lines.Length - 1;
-
- if (intLine >= 0 && intLine < this.Lines.Length)
- {
- int intLength = this.Lines[intLine].Length;
- int intStart = GetFirstCharIndexFromLine(intLine);
- int intIndex = intStart + Char - 1;
- HighLightLine = intLine;
- this.SelectionStart = intStart;
- this.SelectionLength = intLength;
- this.SelectionBackColor = Color.LightBlue;
- this.SelectionLength = 0;
- this.SelectionStart = intIndex;
- }
- }
- catch
- {
- }
-
- EndUpdate(false);
- this.Focus();
- }
-
- protected override void OnSelectionChanged(EventArgs e)
- {
- base.OnSelectionChanged(e);
- if (!IsUpdating)
- CursorPositionChanged(); // show cursor position
- }
-
- private bool IsUpdating
- {
- get
- {
- return (intUpdate > 0);
- }
- }
-
- Point backupScrollPoint;
- private void BeginUpdate()
- {
- ++intUpdate;
- if (intUpdate > 1) // once is enough
- return;
-
- backupScrollPoint = this.RTBScrollPos;
- // Disable redrawing
- SendMessage(this.Handle, WM_SETREDRAW, 0, IntPtr.Zero);
-
- // Disable generating events
- eventMask = SendMessage(this.Handle, EM_GETEVENTMASK, 0, IntPtr.Zero);
- }
-
- private void EndUpdate(bool update_outline)
- {
- if(update_outline) doOutline();
-
- intUpdate = Math.Max(0, intUpdate - 1);
-
- if (intUpdate > 0) // only the last one
- return;
-
- // Enable events
- SendMessage(this.Handle, EM_SETEVENTMASK, 0, eventMask);
-
- // Enable redrawing
- SendMessage(this.Handle, WM_SETREDRAW, 1, IntPtr.Zero);
-
- // also draw when linenumbers are shifted
- if (intOldLines != this.Lines.Length || backupScrollPoint != this.RTBScrollPos)
- {
- intOldLines = this.Lines.Length;
- PaintNumbers();
- }
- Invalidate();
- }
-
- private bool IsAlpha(char chrC)
- {
- return (char.IsLetterOrDigit(chrC) || chrC == '_');
- }
-
- // used for F1 key, help and tooltipping, use Mouse of begin-selection
- public string GetCurrentKeyWord(bool blnUserMousePosition, out Point PositionFirstCharacter)
- {
- PositionFirstCharacter = Point.Empty;
-
- int intIndex = this.SelectionStart;
- if (blnUserMousePosition)
- {
- Point mp = this.PointToClient(Control.MousePosition);
- intIndex = this.GetCharIndexFromPosition(mp);
-
- // check if mouse is in region of index
- Point mpControle = this.GetPositionFromCharIndex(intIndex);
- if (Math.Abs(mp.X - mpControle.X) > 5 || Math.Abs(mp.Y - mpControle.Y) > this.LineHeight)
- return "";
- }
-
- int intLineNr = this.GetLineFromCharIndex(intIndex);
- int intFirstChar = this.GetFirstCharIndexFromLine(intLineNr);
- int intColumn = intIndex - intFirstChar;
-
- string strLine = this.Lines[intLineNr];
-
- int intStart = intColumn;
- while ((intStart > 0) && (IsAlpha(strLine[intStart - 1])))
- intStart--;
-
- // 22 jun 2007
- PositionFirstCharacter = this.GetPositionFromCharIndex(intFirstChar + intStart + 2);
-
- int intEnd = intColumn;
- while ((intEnd < strLine.Length) && (IsAlpha(strLine[intEnd])))
- intEnd++;
-
- // Calculate the length of the keyword.
- int intLength = intEnd - intStart;
-
- // return the keyword
- return strLine.Substring(intStart, intLength);
- }
-
- private string GetCurrentFunction(out int Argument, out bool DoWild)
- {
- DoWild = false;
- Argument = 0;
- int intIndex = this.SelectionStart;
- int intLineNumber = this.GetLineFromCharIndex(intIndex);
- int intStartChar = this.GetFirstCharIndexFromLine(intLineNumber);
-
- int intColumn = intIndex - intStartChar;
-
- string strLine = this.Lines[intLineNumber];
-
- // Find the end of the current function
- int intEnd = intColumn - 1;
- while (intEnd > 0 &&
- strLine[intEnd] != '(' &&
- strLine[intEnd] != ')' &&
- strLine[intEnd] != '\n')
- {
- if (strLine[intEnd] == ',')
- {
- Argument++;
- if (Argument == 1)
- DoWild = (intColumn - intEnd) == 1;
- }
- intEnd--;
- }
- if (intEnd <= 0)
- return "";
-
- if (strLine[intEnd] != '(')
- return "";
-
- if (Argument == 0)
- DoWild = (intColumn - intEnd) == 1;
-
- intEnd--;
-
- // Find the begin of the current function.
- int intStart = intEnd;
- while ((intStart > 0) && (IsAlpha(strLine[intStart])))
- intStart--;
-
- // Calculate the length of the function.
- int intLength = intEnd - intStart;
-
- // return the Function name
- return strLine.Substring(intStart + 1, intLength);
- }
-
- private string GetNewWhiteSpace(int intOffset)
- {
- int intIndex = this.GetLineFromCharIndex(this.SelectionStart);
- return AutoFormatter.GetNewWhiteSpace(this.Lines, intIndex + intOffset);
- }
-
- private void AutoFormatFromLineToLine(int intLineStart, int intLineEnd)
- {
- BeginUpdate();
- int intStart = this.GetFirstCharIndexFromLine(intLineStart);
- int intLength = this.GetFirstCharIndexFromLine(intLineEnd) +
- this.Lines[intLineEnd].Length + 1 - intStart;
- this.SelectionStart = intStart;
- this.SelectionLength = intLength;
- AutoFormat(true);
- EndUpdate(true);
- }
-
- private void ProcessEnter()
- {
- BeginUpdate();
- this.ColoredText = "\n";
- if (ToolTipping)
- {
- if (Properties.Settings.Default.Indent)
- {
- if (Properties.Settings.Default.IndentFullAuto)
- {
- int intLine = this.GetLineFromCharIndex(this.SelectionStart);
- AutoFormatFromLineToLine(intLine - 1, intLine - 1);
- this.ColoredText = GetNewWhiteSpace(-1);
- }
- else if (Properties.Settings.Default.IndentCursorPlacement)
- {
- this.ColoredText = GetNewWhiteSpace(-1);
- }
- }
- }
- EndUpdate(true);
- }
-
- private void SmartIndenting()
- {
- int intFirstLine, intC;
- int intLastLine = this.GetLineFromCharIndex(this.SelectionStart);
- int intColumn = this.SelectionStart - this.GetFirstCharIndexFromLine(intLastLine);
-
- intColumn--; // because we are at position '}'
-
- if (MatchingBracket(intLastLine, intColumn, '}', '{', -1, out intFirstLine, out intC))
- {
- if ((intLastLine - intFirstLine) >= 1)
- AutoFormatFromLineToLine(intFirstLine + 1, intLastLine);
- }
- }
-
- private void ProcessBraces(char keyChar)
- {
- BeginUpdate();
- int intStart = this.SelectionStart;
-
- this.ColoredText = keyChar.ToString();
-
- if (Properties.Settings.Default.Indent)
- {
- int intLength = this.Text.Length;
-
- if (Properties.Settings.Default.IndentFullAuto)
- {
- if (keyChar == '}')
- {
- SmartIndenting();
- }
- else
- {
- int intCurrentLine = this.GetLineFromCharIndex(this.SelectionStart);
- AutoFormatFromLineToLine(intCurrentLine, intCurrentLine);
- }
- }
-
- int intDelta = 1 + this.Text.Length - intLength;
-
- this.SelectionStart = intStart + intDelta;
-
- BracketHighlichting();
- }
-
- EndUpdate(false);
- }
-
- public void Delete()
- {
- BeginUpdate();
- if (this.SelectionLength == 0)
- this.SelectionLength = 1;
- this.ColoredText = "";
- EndUpdate(true);
- OnTextChanged(null);
- }
-
- public new void Cut()
- {
- BeginUpdate();
- this.Copy();
- this.ColoredText = "";
- EndUpdate(true);
- OnTextChanged(null);
- }
-
-
- private void SaveUndo(UndoElement el)
- {
- if (RedoStack.Count > 0)
- RedoStack.Clear();
- UndoStack.Push(el);
- }
-
- public new void Redo()
- {
- if (RedoStack.Count == 0)
- return;
-
- MakeAllInvis();
-
- BeginUpdate();
-
- this.Dirty = true;
-
- UndoElement el = RedoStack.Pop();
-
- this.SelectionStart = el.SelectionStart;
- this.SelectionLength = el.SelectedText.Length;
- this.SelectedText = el.RedoText;
-
- el.RedoText = null; // dont need it anymore
- UndoStack.Push(el);
-
- int intStartLine = this.GetLineFromCharIndex(el.SelectionStart);
- int intStart = this.GetFirstCharIndexFromLine(intStartLine);
-
- int intStopLine = this.GetLineFromCharIndex(el.SelectionStart + el.SelectedText.Length);
- if (intStopLine < this.Lines.Length)
- {
- int intLengthStopLine = this.Lines[intStopLine].Length;
- int intStop = this.GetFirstCharIndexFromLine(intStopLine) + intLengthStopLine;
-
- ColorLine(intStart, intStop - intStart);
- }
-
- EndUpdate(true);
- this.Focus();
- }
-
- public new void Undo()
- {
- if (UndoStack.Count == 0)
- return;
-
- MakeAllInvis();
-
- BeginUpdate();
-
- UndoElement el = UndoStack.Pop();
-
- this.Dirty = (UndoStack.Count != 0);
-
- this.SelectionStart = el.SelectionStart;
- this.SelectionLength = el.SelectionLength;
- el.RedoText = this.SelectedText; // save redo text!!!!
- this.SelectedText = el.SelectedText;
-
- RedoStack.Push(el);
-
- int intStartLine = this.GetLineFromCharIndex(el.SelectionStart);
- int intStart = this.GetFirstCharIndexFromLine(intStartLine);
-
- int intStopLine = this.GetLineFromCharIndex(el.SelectionStart + el.SelectedText.Length);
- if (intStopLine < this.Lines.Length)
- {
- int intLengthStopLine = this.Lines[intStopLine].Length;
- int intStop = this.GetFirstCharIndexFromLine(intStopLine) + intLengthStopLine;
-
- ColorLine(intStart, intStop - intStart);
- }
-
- EndUpdate(true);
- this.Focus();
- }
-
- public void ToClipBoard()
- {
- bool backup = Properties.Settings.Default.SL4SpacesIndent;
- Properties.Settings.Default.SL4SpacesIndent = true;
- string strFormattedText = AutoFormatter.ApplyFormatting(0, this.Text);
- Properties.Settings.Default.SL4SpacesIndent = backup;
-
- try
- {
- Clipboard.SetDataObject(strFormattedText, true);
- }
- catch(Exception exception)
- {
- // error
- Console.WriteLine(exception.Message);
- }
- }
-
- public void ReplaceSelectedText(string strReplacement)
- {
- this.blnEscape = true; // prevent windows popping up
- this.ColoredText = strReplacement;
- }
-
- public void MakeAllInvis()
- {
- if (!ToolTipping)
- return;
- this.TooltipKeyboard.Visible = false;
- this.TooltipListBox.Visible = false;
- this.TooltipMouse.Visible = false;
- this.GListBoxWindow.Visible = false;
- this.Focus();
- }
-
- private void LineDownlighting()
- {
- if (this.HighLightLine < 0)
- return;
-
- // doof line
- BeginUpdate();
- int intBackupSelectionStart = this.SelectionStart;
- int intBackupSelectionLength = this.SelectionLength;
- this.SelectionStart = this.GetFirstCharIndexFromLine(this.HighLightLine);
- this.SelectionLength = this.Lines[this.HighLightLine].Length;
- this.SelectionBackColor = this.BackColor;
- this.SelectionStart = intBackupSelectionStart;
- this.SelectionLength = intBackupSelectionLength;
- this.HighLightLine = -1;
- EndUpdate(false);
- }
-
- private void CursorPositionChanged()
- {
- BracketHighlichting();
-
- LineDownlighting();
-
- if (OnCursorPositionChanged != null)
- OnCursorPositionChanged(this, new CursorPositionEventArgs(this.GetLine(), this.GetColumn(), this.GetChar(), this.GetTotal(), this.blnInsert, Control.IsKeyLocked(Keys.CapsLock)));
- }
-
- public new void Paste()
- {
- ResetHighlighting();
-
- // First try with Unicode
- if (Clipboard.GetDataObject().GetDataPresent(DataFormats.UnicodeText, true))
- {
- string strTextToPaste = Clipboard.GetDataObject().GetData(DataFormats.UnicodeText, true).ToString().Replace("\r", "");
- this.ColoredText = strTextToPaste;
- } // failing that try ANSI text.
- else if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text, true))
- {
- string strTextToPaste = Clipboard.GetDataObject().GetData(DataFormats.Text, true).ToString().Replace("\r", "");
- this.ColoredText = strTextToPaste;
-#if DEBUG
- // TODO Add code to show encoding used in a dialogue or the status bar.
-#endif
- }
- }
-
- private void GoEnd(bool blnShift)
- {
- if (this.Lines.Length == 0)
- return;
- int intLast = this.SelectionStart + this.SelectionLength;
- int intLine = this.GetLineFromCharIndex(intLast);
- int intColumn = intLast - this.GetFirstCharIndexFromLine(intLine);
- string strLine = this.Lines[intLine];
- int intAdd = strLine.Length - intColumn;
- if (blnShift)
- this.SelectionLength += intAdd;
- else
- {
- this.SelectionStart = intLast+intAdd;
- this.SelectionLength = 0;
- }
- }
-
- private void GoHome(bool blnShift)
- {
- if (this.Lines.Length == 0)
- return;
- int intLine = this.GetLineFromCharIndex(this.SelectionStart);
- string strLine = this.Lines[intLine];
- for (int intColumn = 0; intColumn <= strLine.Length; intColumn++)
- {
- // now we are at the front of the line, ex whitespace
- if (intColumn == strLine.Length || strLine[intColumn] > ' ')
- {
- int intStart = this.GetFirstCharIndexFromLine(intLine) + intColumn;
- if (intStart == this.SelectionStart) // already here
- intStart = this.GetFirstCharIndexFromLine(intLine);
- // intStart has now got the new start position
- if (blnShift)
- {
- int intAddToLength = this.SelectionStart - intStart;
- this.SelectionStart = intStart;
- // can + of -
- this.SelectionLength = Math.Max(0, this.SelectionLength + intAddToLength);
- }
- else
- {
- this.SelectionStart = intStart;
- this.SelectionLength = 0;
- }
- return;
- }
- }
- }
-
- protected override void OnKeyDown(KeyEventArgs e)
- {
- base.OnKeyDown(e);
-
- if (this.TooltipMouse != null)
- {
- if (this.TooltipMouse.Visible)
- {
- this.TooltipMouse.Visible = false;
- this.Focus();
- }
- }
-
- if (this.GListBoxWindow != null && this.GListBoxWindow.Visible)
- {
- this.GListBoxWindow.KeyDownHandler(e);
- }
- else
- {
- if (e.KeyCode == Keys.Tab)
- {
- int intLineStart = this.GetLineFromCharIndex(this.SelectionStart);
- int intLineStop = this.GetLineFromCharIndex(this.SelectionStart + this.SelectionLength);
- if (intLineStart != intLineStop)
- MultiLineTab(!e.Shift);
- else
- SingleLineTab(!e.Shift);
- e.Handled = true;
- }
- }
-
- if (e.KeyCode == Keys.Insert)
- {
- blnInsert = !blnInsert;
- CursorPositionChanged();
- }
-
- if (e.KeyCode == Keys.Left ||
- e.KeyCode == Keys.Right ||
- e.KeyCode == Keys.End ||
- e.KeyCode == Keys.Home)
- MakeAllInvis();
-
- if (e.KeyCode == Keys.Home)
- {
- if (!e.Control)
- {
- GoHome(e.Shift);
- e.Handled = true;
- }
- }
-
- if (e.KeyCode == Keys.End)
- {
- if (!e.Control)
- {
- GoEnd(e.Shift);
- e.Handled = true;
- }
- }
-
- if (e.KeyCode == Keys.Delete)
- {
- if (e.Control)
- {
- int intWissel = 0;
- int intIndex = this.SelectionStart;
- if (intIndex < this.Text.Length)
- {
- bool blnWhiteSpace = (this.Text[intIndex] <= ' ');
-
- while (intIndex < this.Text.Length)
- {
- if (this.Text[intIndex] > ' ')
- {
- if (blnWhiteSpace)
- {
- blnWhiteSpace = false;
- intWissel++;
- }
- }
- else // whitespace
- {
- if (!blnWhiteSpace)
- {
- blnWhiteSpace = true;
- intWissel++;
- }
- }
- if (intWissel == 2)
- break;
- intIndex++;
- }
- this.SelectionLength = intIndex - this.SelectionStart;
- }
- } // control
- else
- {
- if (e.Shift)
- {
- if (this.SelectionLength == 0)
- {
- if (this.Lines.Length > 0)
- {
- BeginUpdate();
- this.SelectionStart = this.GetFirstCharIndexOfCurrentLine();
- int intLine = this.GetLineFromCharIndex(this.SelectionStart);
- this.SelectionLength = this.Lines[intLine].Length + 1;
- EndUpdate(true);
- }
- }
- this.Copy();
- } // shift
- else
- {
- if (this.SelectionLength == 0)
- this.SelectionLength = 1;
- } // no shift
- }
- this.Delete();
- e.Handled = true;
- }
-
- if (e.KeyCode == Keys.X && e.Control)
- {
- this.Cut();
- e.Handled = true;
- }
-
- if (this.TooltipKeyboard != null)
- {
- if (this.TooltipKeyboard.Visible)
- {
- if (e.KeyCode == Keys.Up ||
- e.KeyCode == Keys.Down)
- {
- this.TooltipKeyboard.Visible = false;
- this.Focus();
- }
- }
- }
-
- // 16 maart 2008
- if (e.KeyCode == Keys.Back && e.Alt)
- this.Undo();
-
- if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Back)
- e.Handled = true;
-
- if (e.Control)
- {
- if (e.KeyCode == Keys.R)
- {
- e.Handled = true;
- }
- if (e.KeyCode == Keys.V)
- {
- this.Paste();
- e.Handled = true;
- }
- if (e.KeyCode == Keys.C)
- {
- this.Copy();
- e.Handled = true;
- }
- }
-
- if (e.KeyData == Keys.CapsLock)
- CursorPositionChanged();
- }
-
- private void ProcessBackSpace()
- {
- if (this.SelectionStart == 0 && this.SelectionLength == 0)
- return;
-
- BeginUpdate();
- if (this.SelectionStart > 0 && this.SelectionLength == 0)
- this.SelectionStart--;
- if (this.SelectionLength == 0)
- this.SelectionLength = 1;
- this.ColoredText = "";
- EndUpdate(true);
- OnTextChanged(null);
- CursorPositionChanged();
- }
-
- protected override void OnKeyPress(KeyPressEventArgs e)
- {
- ResetHighlighting();
-
- char keyChar = e.KeyChar;
-
- switch (e.KeyChar)
- {
- case '\r': // Return
- if (this.GListBoxWindow.Visible)
- InsertSelectedWord();
- else
- ProcessEnter();
- e.Handled = true;
- break;
- case '\t': // TAB
- if (this.GListBoxWindow.Visible)
- InsertSelectedWord();
- e.Handled = true;
- break;
- case '{':
- case '}':
- ProcessBraces(keyChar);
- e.Handled = true;
- break;
- case '\b':
- ProcessBackSpace();
- MakeAllInvis();
- e.Handled = true;
- break;
- case (char)27:
- this.blnEscape = !this.blnEscape;
- MakeAllInvis();
- break;
- default:
- if (keyChar >= 32)
- {
- if (this.SelectionLength != 0)
- this.Delete();
- SaveUndo(new UndoElement(this.SelectionStart, "", 1, null));
- }
- if (keyChar > 32 && !Char.IsLetterOrDigit(keyChar))
- this.blnEscape = false;
- break;
- }
- base.OnKeyPress(e);
- }
-
- // event generated, make list of codecompletion words
- private void CodeCompletion(string strKeyWord, bool IsRegularExpression)
- {
- if (!ToolTipping)
- return;
-
- intKeyWordLength = strKeyWord.Length;
-
- if (IsRegularExpression)
- intKeyWordLength = 0; // else it would delete the word typed so far
-
- if (strKeyWord.Length == 0 || this.blnEscape)
- {
- this.TooltipListBox.Visible = false;
- this.GListBoxWindow.Visible = false;
- this.Focus();
- return;
- }
-
- List list;
-
- if (Properties.Settings.Default.CodeCompletion)
- list = keyWords.KeyWordSearch(strKeyWord, IsRegularExpression);
- else
- list = new List();
-
- if (Properties.Settings.Default.CodeCompletionUserVar && !IsRegularExpression)
- codeCompletion.CodeCompletionUserVar(strKeyWord, this.Text, this.SelectionStart, list);
-
- if (list.Count == 0)
- {
- this.TooltipListBox.Visible = false;
- this.GListBoxWindow.Visible = false;
- this.Focus();
- return;
- }
-
- if (list.Count == 1)
- {
- // single keyword has been typed, make listbox invisible
- if (list[0].name == strKeyWord)
- {
- /*
- // this autocompletes 1 word, backspace is a problem, use escape
- this.GListBoxWindow.GListBox.Items.Clear();
- KeyWordInfo keyWordInfo = list[0];
- GListBoxItem glbi = new GListBoxItem(keyWordInfo.name, (int)keyWordInfo.type);
- this.GListBoxWindow.GListBox.Items.Add(glbi);
-
- this.GListBoxWindow.GListBox.SelectedIndex = 0;
- InsertSelectedWord();
- */
-
- if (strKeyWord == "else") // else autocompletion annoys people!!! TODO
- {
- this.TooltipListBox.Visible = false;
- this.GListBoxWindow.Visible = false;
- this.Focus();
- return;
- }
- }
- }
-
- // Hide argument typing
- this.TooltipKeyboard.Visible = false;
- this.Focus();
-
- this.GListBoxWindow.GListBox.Items.Clear();
- foreach (KeyWordInfo keyWordInfo in list)
- {
- GListBoxItem glbi = new GListBoxItem(keyWordInfo.name, (int)keyWordInfo.type);
- this.GListBoxWindow.GListBox.Items.Add(glbi);
- }
- this.GListBoxWindow.GListBox.SelectedIndex = 0;
- this.GListBoxWindow.GListBox.Height = Math.Min(list.Count + 1, 11) * this.GListBoxWindow.GListBox.ItemHeight;
- this.GListBoxWindow.SetPosition(Screen.GetWorkingArea(this), this);
-
- // Just in case it pops up
- this.TooltipListBox.SetPosition(Screen.GetWorkingArea(this), this);
-
- this.GListBoxWindow.Visible = true;
- this.Focus();
- }
-
- private void SelectWordByDoubleClick()
- {
- int intSelectionStartBackup = this.SelectionStart;
-
- int intLineNumber = this.GetLineFromCharIndex(intSelectionStartBackup);
- int intFirstChar = this.GetFirstCharIndexFromLine(intLineNumber);
- int intColumn = intSelectionStartBackup - intFirstChar;
-
- string strLine = this.Lines[intLineNumber];
-
- // start or ending in underscore then expand
- int intStart = intColumn;
- while ((intStart > 0) && IsAlpha(strLine[intStart - 1]))
- intStart--;
-
- int intEnd = intColumn;
- while ((intEnd < strLine.Length) && IsAlpha(strLine[intEnd]))
- intEnd++;
-
- if (intStart != intColumn || intEnd != (intStart + this.SelectionLength))
- {
- this.SelectionStart = intFirstChar + intStart;
- this.SelectionLength = intEnd - intStart;
- }
- }
-
- protected override void OnMouseDown(MouseEventArgs e)
- {
- base.OnMouseDown(e);
-
- BracketHighlichting();
-
- // this sucks!!!!
- this.AutoWordSelection = true;
- this.AutoWordSelection = Properties.Settings.Default.AutoWordSelection;
-
- if (this.ToolTipping)
- MakeAllInvis();
-
- if (e.Clicks == 2)
- SelectWordByDoubleClick();
- }
-
- private void ShowKeyBoardHint()
- {
- if (!ToolTipping)
- return;
-
- if (this.GListBoxWindow.Visible)
- return;
-
- if (this.blnEscape)
- return;
-
- int intArgument;
- bool DoWild;
- string strFunction = GetCurrentFunction(out intArgument, out DoWild);
-
- if (strFunction == "")
- {
- this.TooltipKeyboard.Visible = false;
- this.Focus();
- return;
- }
-
- SetArgumentListOnRichLabel(this.TooltipKeyboard, strFunction, intArgument);
- if (DoWild && this.TooltipKeyboard.Wild != "")
- {
- CodeCompletion(this.TooltipKeyboard.Wild , true);
- this.Focus();
- return;
- }
-
- if (this.TooltipKeyboard.Text == "")
- {
- this.TooltipKeyboard.Visible = false;
- }
- else
- {
- this.TooltipKeyboard.SetPosition(Screen.GetWorkingArea(this), this);
- this.TooltipKeyboard.Visible = true;
- //this.SelectionColor = this.ForeColor;
- }
- this.Focus();
- }
-
- private bool IsInComment(string strLine, int intIndex)
- {
- bool blnInString = false;
- for (int intI = 0; intI < intIndex; intI++)
- {
- char chrC = strLine[intI];
- if (chrC == '"')
- blnInString = !blnInString;
- if (blnInString)
- {
- if (chrC == '\\')
- intI++;
- continue;
- }
- if (chrC == '/')
- {
- if ((intI + 1) < intIndex)
- if (strLine[intI + 1] == '/')
- return true;
- }
- }
- return false;
- }
-
- private bool IsInString(string strLine, int intIndex)
- {
- int intQuotes = 0;
- for (int intI = intIndex - 1; intI >= 0; intI--)
- {
- char chrC = strLine[intI];
- if (chrC == '"')
- {
- if ((intI - 1) >= 0)
- if (strLine[intI - 1] != '\\')
- intQuotes++;
- }
- }
- return ((intQuotes % 2) != 0);
- }
-
- ///
- /// OnTextChanged
- ///
- protected override void OnTextChanged(EventArgs e)
- {
- if (IsUpdating)
- return;
-
- if (this.Lines.Length == 0)
- {
- TabStops();
- return;
- }
-
- this.Dirty = true;
-
- int intSelectionStartBackup = this.SelectionStart;
-
- int intLineNumber = this.GetLineFromCharIndex(intSelectionStartBackup);
- int intFirstChar = this.GetFirstCharIndexFromLine(intLineNumber);
- int intColumn = intSelectionStartBackup - intFirstChar;
-
- string strLine = this.Lines[intLineNumber];
-
- ColorLine(intFirstChar, strLine.Length);
-
- if (IsInComment(strLine, intColumn))
- return;
-
- if (IsInString(strLine, intColumn))
- return;
-
- // not in comment and not in string, find the start of a word
- int intStart = intColumn;
- while ((intStart > 0) && IsAlpha(strLine[intStart - 1]))
- intStart--;
-
- string strTypedWord = strLine.Substring(intStart, intColumn - intStart);
-
- CodeCompletion(strTypedWord , false);
-
- ShowKeyBoardHint();
- }
-
- ///
- /// Color a line
- ///
- private void ColorLine(int intStart, int intLength)
- {
- if (!ToolTipping)
- return;
-
- if (intLength <= 0)
- return;
-
- BeginUpdate();
-
- // Backup position
- int SelectionStartBackup = this.SelectionStart;
-
- // get the line
- string strLine = this.Text.Substring(intStart, intLength);
-
- // highlight all keywords
- foreach (Match m in keyWords.Matches(strLine))
- {
- Group g = m.Groups[1];
- string strKeyWord = g.Value;
-
- this.SelectionStart = intStart + g.Index;
- this.SelectionLength = g.Length;
-
- // normal keywords
- if (keyWords.ContainsKeyWord(strKeyWord))
- this.SelectionColor = keyWords.GetColorFromKeyWordList(strKeyWord);
- else
- this.SelectionColor = keyWords.GetColorFromRegex(strKeyWord);
- }
-
- // Restore position
- this.SelectionLength = 0;
- this.SelectionStart = SelectionStartBackup;
- this.SelectionColor = this.ForeColor;
-
- EndUpdate(false);
- }
-
- private int AutoFormat(bool OnlySelectedText)
- {
- int intTabs;
- if (OnlySelectedText)
- {
- string strW = GetNewWhiteSpace(-1);
- intTabs = (int)(strW.Length / AutoFormatter.GetTab().Length);
- }
- else
- {
- this.SelectionStart = 0;
- this.SelectionLength = this.Text.Length;
- intTabs = 0;
- }
- string strFormattedText = AutoFormatter.ApplyFormatting(intTabs, this.SelectedText);
-
- this.ColoredText = strFormattedText;
-
- return strFormattedText.Length;
- }
-
- public void AutoFormatSelectedText()
- {
- BeginUpdate();
- Point scrollPoint = this.RTBScrollPos;
- int intBackupStart = this.SelectionStart;
- int intSelectionLength = AutoFormat(true);
- this.SelectionStart = intBackupStart;
- this.SelectionLength = intSelectionLength;
- this.RTBScrollPos = scrollPoint;
- EndUpdate(false);
- }
-
- public void FormatDocument()
- {
- BeginUpdate();
- Point scrollPoint = this.RTBScrollPos;
- int intLine = this.GetLineFromCharIndex(this.SelectionStart);
- AutoFormat(false);
- this.SelectionStart = Math.Max(0,this.GetFirstCharIndexFromLine(intLine));
- this.RTBScrollPos = scrollPoint;
- EndUpdate(false);
- }
-
- public void ClearUndoStack()
- {
- UndoStack.Clear();
- Dirty = false;
- }
-
- public override string Text
- {
- get
- {
- return base.Text;
- }
- set
- {
- BeginUpdate();
- int intBackup = this.SelectionStart;
- this.SelectionStart = 0;
- this.SelectionLength = this.Text.Length; //TODO
- this.ColoredText = value;
- this.SelectionStart = intBackup;
- EndUpdate(true);
- }
- }
-
- private string GetWhiteSpaceFromCurrentLine()
- {
- int intIndex = this.GetLineFromCharIndex(this.SelectionStart);
- if (intIndex < this.Lines.Length)
- return AutoFormatter.GetWhiteSpaceFromLine(this.Lines[intIndex]);
- return "";
- }
-
- // code-completion word is selected
- // also comes from mainform (doubleclick), must be public
- public void InsertSelectedWord()
- {
- this.GListBoxWindow.Visible = false;
- this.TooltipListBox.Visible = false;
-
- if (this.GListBoxWindow.GListBox.SelectedIndex < 0)
- return;
-
- int intOffset = 0;
-
- GListBoxItem glbi = this.GListBoxWindow.Selected;
- string strSelected = glbi.ToString();
- if (strSelected == "")
- {
- this.Focus();
- return;
- }
-
- if (glbi.ImageIndex == (int)KeyWordTypeEnum.Events
- || strSelected == "default" && this.Text.IndexOf("default")<0)
- {
- if (strSelected != "default")
- strSelected = keyWords.GetEvent(strSelected);
-
- string strW = GetWhiteSpaceFromCurrentLine();
- strSelected += "\n" + strW + "{\n" + strW + AutoFormatter.GetTab() + "\n" + strW + "}";
- intOffset = -(strW.Length + 2);
- }
- else if (glbi.ImageIndex == (int)KeyWordTypeEnum.Functions)
- {
- if(keyWords.GetNumberOfArguments(strSelected) == 0)
- strSelected += "()";
- else
- strSelected += "(";
- }
- else if (glbi.ImageIndex == (int)KeyWordTypeEnum.Properties)
- {
- strSelected = "\"" + strSelected.Trim() +"\"";
- }
-
- BeginUpdate();
- this.SelectionStart -= intKeyWordLength;
- this.SelectionLength = intKeyWordLength;
- this.ColoredText = strSelected;
-
- this.SelectionStart += intOffset;
- EndUpdate(true);
-
- // if any
- ShowKeyBoardHint();
-
- this.Focus();
- }
-
- // this comes from the main form
- public void ShowTooltipOnListBox()
- {
- string strSelected = this.GListBoxWindow.Selected.ToString();
- string strDescription = keyWords.GetDescription(strSelected);
- if (strDescription != "")
- {
- this.TooltipListBox.Tag = strSelected;
- this.TooltipListBox.Text = strDescription;
- this.TooltipListBox.XOffset = this.GListBoxWindow.Width;
- this.TooltipListBox.SetPosition(Screen.GetWorkingArea(this), this);
- this.TooltipListBox.Visible = true;
- this.Focus();
- }
- else
- {
- this.TooltipListBox.Visible = false;
- this.Focus();
- }
- }
-
- // Tooltip mouse by (Windows.Forms) timer
- private void timer1_Tick(object sender, EventArgs e)
- {
- this.timer1.Stop();
-
- if (this.Disposing || this.IsDisposed)
- return;
-
- if (!this.Visible)
- return;
-
- if (!ToolTipping)
- return;
-
- if (!Properties.Settings.Default.ToolTip)
- return;
-
- if (Control.MouseButtons != MouseButtons.None)
- return;
-
- Point point;
- string strKeyWord = this.GetCurrentKeyWord(true, out point);
-
- if (strKeyWord == "")
- {
- this.TooltipMouse.Visible = false;
- return;
- }
-
- if (this.TooltipMouse.Tag.ToString() != strKeyWord)
- {
- this.TooltipMouse.Tag = strKeyWord;
- this.TooltipMouse.Text = keyWords.GetDescription(strKeyWord);
- }
-
- if (this.TooltipMouse.Text == "")
- {
- this.TooltipMouse.Visible = false;
- return;
- }
-
- this.TooltipMouse.SetPosition(this, point);
- this.TooltipMouse.Visible = true;
- this.Focus();
- }
-
- public bool ToolTipping
- {
- get
- {
- return m_blnToolTipping;
- }
- set
- {
- m_blnToolTipping = value;
- if (m_blnToolTipping)
- {
- this.timer1 = new System.Windows.Forms.Timer();
- this.timer1.Interval = Properties.Settings.Default.ToolTipDelay;
- this.timer1.Tick += new EventHandler(timer1_Tick);
- }
- }
- }
-
- public void SetPosition(Rectangle rect)
- {
- if (!ToolTipping)
- return;
- if (this.GListBoxWindow.Visible)
- this.GListBoxWindow.SetPosition(rect, this);
- if (this.TooltipListBox.Visible)
- this.TooltipListBox.SetPosition(rect, this);
- if (this.TooltipKeyboard.Visible)
- this.TooltipKeyboard.SetPosition(rect, this);
- }
-
- private void SetArgumentListOnRichLabel(TooltipWindow window, string strKeyWord, int intArgument)
- {
- if (window.Tag.ToString() == (strKeyWord + intArgument))
- return; // cached information
-
- string strWild = "";
- window.Wild = "";
- window.Tag = (strKeyWord + intArgument);
- window.Text = keyWords.GetFunctionAndHiglightArgument(strKeyWord, intArgument, out strWild);
- if(Properties.Settings.Default.CodeCompletionArguments)
- window.Wild = strWild;
- }
-
-
- public void Goto(int intLine)
- {
- this.SelectionStart = this.GetFirstCharIndexFromLine(intLine - 1);
- this.Focus();
- }
-
- public void MultiLineComment(bool blnAdd)
- {
- BeginUpdate();
-
- ResetHighlighting();
-
- string strW = GetNewWhiteSpace(-1);
- int intTabs = (int)(strW.Length / AutoFormatter.GetTab().Length);
-
- int intLastLine = this.GetLineFromCharIndex(this.SelectionStart + this.SelectionLength);
-
- int intLine = this.GetLineFromCharIndex(this.SelectionStart);
- this.SelectionStart = this.GetFirstCharIndexFromLine(intLine);
- int intLength = 0;
- do
- {
- intLength += this.Lines[intLine].Length + 1;
- intLine++;
- } while (intLine <= intLastLine);
- this.SelectionLength = intLength;
-
- string strSelectedText = AutoFormatter.MultiLineComment(blnAdd, intTabs, this.SelectedText);
-
- int intBackup = this.SelectionStart;
- this.ColoredText = strSelectedText;
- this.SelectionStart = intBackup;
- this.SelectionLength = strSelectedText.Length;
- EndUpdate(true);
- }
-
- public void MultiLineTab(bool blnAdd)
- {
- string strSelectedText = AutoFormatter.MultiLineTab(blnAdd, this.SelectedText);
-
- int intBackup = this.SelectionStart;
- this.ColoredText = strSelectedText;
- this.SelectionStart = intBackup;
- this.SelectionLength = strSelectedText.Length;
- }
-
- private void SingleLineTab(bool blnAdd)
- {
- if (blnAdd)
- {
- this.SelectedText = AutoFormatter.GetTab();
- }
- else
- {
- // Shift tab on single line
- string strTab = AutoFormatter.GetTab();
- if (this.SelectionStart > strTab.Length)
- {
- string strBefore = this.Text.Substring(this.SelectionStart - strTab.Length, strTab.Length);
- if (strBefore == strTab)
- {
- int intBackupLength = this.SelectionLength;
- this.SelectionStart -= strTab.Length;
- this.SelectionLength = strTab.Length;
- this.SelectedText = "";
- this.SelectionLength = intBackupLength;
- }
- else
- {
- // space remove? TODO
- }
- }
- }
- }
-
- private void HighLightCharAt(int intIndex, Color color)
- {
- this.SelectionStart = intIndex;
- this.SelectionLength = 1;
- this.SelectionBackColor = color;
-
- if (color != this.BackColor)
- HighLightList.Add(intIndex);
- }
-
- private void HighLightCharAt(int intLine, int intColumn, Color color)
- {
- int intIndex = this.GetFirstCharIndexFromLine(intLine) + intColumn;
- HighLightCharAt(intIndex, color);
- }
-
- private bool MatchingBracket(int intCurrentLine, int intCurrentColumn, char chrOpening, char chrClosing, int intDirection, out int intLine, out int intColumn)
- {
- if (this.Lines.Length == 0)
- {
- intLine = 0;
- intColumn = 0;
- return false;
- }
- intLine = intCurrentLine;
- intColumn = intCurrentColumn;
- string strLine = AutoFormatter.RemoveComment(this.Lines[intLine]);
-
- int intNumber = 1;
- bool blnWithinString = false;
- while (true)
- {
- intColumn += intDirection;
- while (intColumn < 0)
- {
- intLine--;
- if (intLine < 0)
- return false; // nothing to do
- strLine = AutoFormatter.RemoveComment(this.Lines[intLine]); // get new previous line
- intColumn = strLine.Length - 1; // place on end of line
- }
-
- while (intColumn >= strLine.Length)
- {
- intLine++;
- if (intLine >= this.Lines.Length)
- return false; // nothing to do
- strLine = AutoFormatter.RemoveComment(this.Lines[intLine]); // get new previous line
- intColumn = 0; // place on begin of line
- }
-
- char chrC = strLine[intColumn];
-
- if (chrC == '"')
- {
- if (intDirection < 0 && intColumn > 0)
- {
- if (strLine[intColumn - 1] == '\\')
- {
- intColumn += intDirection;
- continue;
- }
- }
- blnWithinString = !blnWithinString;
- }
-
- if (blnWithinString)
- {
- if (intDirection > 0 && chrC == '\\')
- intColumn += intDirection;
- continue;
- }
-
- if (chrC == chrOpening)
- intNumber++;
- else if (chrC == chrClosing)
- {
- intNumber--;
- if (intNumber == 0)
- return true;
- }
- }
- }
-
- private void ResetHighlighting()
- {
- if (HighLightList.Count == 0)
- return;
-
- BeginUpdate();
-
- Point scrollPoint = this.RTBScrollPos;
-
- int intBackupStart = this.SelectionStart;
- int intBackupLength = this.SelectionLength;
- foreach (int intIndex in HighLightList)
- HighLightCharAt(intIndex, this.BackColor);
- HighLightList.Clear();
- this.SelectionStart = intBackupStart;
- this.SelectionLength = intBackupLength;
-
- this.RTBScrollPos = scrollPoint;
-
- EndUpdate(false);
- }
-
- private void BracketHighlichting()
- {
- if (this.TextLength == 0)
- return;
- if (this.SelectionLength != 0)
- return;
-
- BeginUpdate();
-
- Point scrollPoint = this.RTBScrollPos;
-
- int intSelectionStart = this.SelectionStart;
-
- // ResetHighlichting without the overhead
- if (HighLightList.Count > 0)
- {
- foreach (int intI in HighLightList)
- HighLightCharAt(intI, this.BackColor);
- HighLightList.Clear();
- }
-
- int intIndex;
- int intType;
-
- const string Uppers = "<({[";
- const string Downers = ">)}]";
-
- int intLine = this.GetLineFromCharIndex(intSelectionStart);
- int intColumn = intSelectionStart - this.GetFirstCharIndexFromLine(intLine);
-
- string strLine = AutoFormatter.RemoveComment(this.Lines[intLine]);
-
- if (intColumn <= strLine.Length)
- {
- intIndex = intColumn - 1;
- if (intIndex >= 0)
- {
- intType = Downers.IndexOf(strLine[intIndex]);
- if (intType >= 0)
- {
- int intL, intC;
- if (MatchingBracket(intLine, intIndex, Downers[intType], Uppers[intType], -1, out intL, out intC))
- {
- HighLightCharAt(intLine, intIndex, Properties.Settings.Default.BracketHighlight);
- HighLightCharAt(intL, intC, Properties.Settings.Default.BracketHighlight);
- }
- }
- }
-
- intIndex = intColumn;
- if (intIndex < strLine.Length)
- {
- intType = Uppers.IndexOf(strLine[intIndex]);
- if (intType >= 0)
- {
- int intL, intC;
- if (MatchingBracket(intLine, intIndex, Uppers[intType], Downers[intType], 1, out intL, out intC))
- {
- HighLightCharAt(intLine, intIndex, Properties.Settings.Default.BracketHighlight);
- HighLightCharAt(intL, intC, Properties.Settings.Default.BracketHighlight);
- }
- }
- }
- }
-
- this.SelectionStart = intSelectionStart;
- this.SelectionLength = 0;
-
- this.RTBScrollPos = scrollPoint;
-
- EndUpdate(false);
- }
-
- public override string SelectedText
- {
- get
- {
- return base.SelectedText;
- }
- set
- {
- if (!IsUpdating)
- SaveUndo(new UndoElement(this.SelectionStart, this.SelectedText, value.Length, null));
- base.SelectedText = value;
- }
- }
-
- private string ColoredText
- {
- set
- {
- BeginUpdate();
- int intFirstCharOfStartLine = this.GetFirstCharIndexOfCurrentLine();
- int intBackup = this.SelectionStart;
- if (this.SelectedText != value)
- {
- this.Dirty = true;
- string strTmp = value.Replace("\r", "");
- SaveUndo(new UndoElement(this.SelectionStart, this.SelectedText, strTmp.Length, null));
- this.SelectedText = strTmp;
- if (this.Lines.Length > 0)
- {
- int intEndLine = this.GetLineFromCharIndex(intBackup + strTmp.Length);
- int intLastCharOfEndLine = this.GetFirstCharIndexFromLine(intEndLine) + this.Lines[intEndLine].Length;
- int intLength = intLastCharOfEndLine - intFirstCharOfStartLine;
- ColorLine(intFirstCharOfStartLine, intLength);
- this.SelectionStart = intBackup + strTmp.Length;
- }
- }
- else
- {
- this.SelectionLength = 0;
- this.SelectionStart += value.Length;
- }
- EndUpdate(true);
- }
- }
- public void doOutline()
- {
- //TODO: finish the outline class and such
- // still a work in progress trying to figure out exactly how i wanna do this.
-
- int len = this.Lines.Length;
- if (len < 1)
- {
- return;
- }
- Dictionary list = new Dictionary();
- string ttext = this.Text;
- ttext.Replace("\r\n", "");
- using (StringReader reader = new StringReader(ttext))
- {
- string line;
-
- int lineNumber = 0;
- while ((line = reader.ReadLine()) != null)
- {
-
- line = line.Trim();
- line = line.Split('(')[0];
- string[] words = line.Split(' ');
- foreach (string word in words)
- {
- //Debug.WriteLine("ww:" + word);
- if (keyWords.ContainsKeyWord(word))
- {
- KeyWordInfo k = keyWords.GetKeyWordInfo(word);
- // Debug.WriteLine("w:" + word);
- //Debug.WriteLine("k:" + k.type);
- if (!list.ContainsKey(lineNumber))
- {
- switch (k.type)
- {
-
- case KeyWordTypeEnum.Functions:
- list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
- // Debug.WriteLine(k);
- break;
- case KeyWordTypeEnum.Events:
- list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
- break;
- case KeyWordTypeEnum.Constants:
- list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
- break;
- case KeyWordTypeEnum.Class:
- list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
- break;
- case KeyWordTypeEnum.Vars:
- list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
- break;
- case KeyWordTypeEnum.States:
- list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
- break;
- default:
- //Debug.WriteLine(k);
- break;
- }
- }
- }
- }
-
- lineNumber++;
-
- }
- }
- //TODO: parse dict and create the outline in the treeview
- //WILL SOMEONE PLEASE FUCKING FINISH THIS!
-
- if (p != null) //It gives the parent-scriptwindow as null when you try to run it
- {
- p.tvOutline.BeginUpdate();
- p.tvOutline.Nodes.Clear();
- TreeNode lastState = null;
- TreeNode lastEvent = null;
- TreeNode lastScope = null;
-
- foreach (LSLEditor.Helpers.OutlineHelper k in list.Values)
- {
- switch (k.info.type)
- {
- case KeyWordTypeEnum.States:
- lastState = createOutlineNode(k);
- lastScope = lastState;
- p.tvOutline.Nodes.Add(lastState);
- break;
- case KeyWordTypeEnum.Events:
- if (lastState != null) //we need a state for every event!
- {
- lastEvent = createOutlineNode(k);
- lastScope = lastEvent;
- lastState.Nodes.Add(lastEvent);
- }
- break;
- case KeyWordTypeEnum.Functions:
- if (lastScope != null)
- {
- lastScope.Nodes.Add(createOutlineNode(k));
- }
- break;
- case KeyWordTypeEnum.Class:
- if (lastScope != null)
- {
- lastScope.Nodes.Add(createOutlineNode(k));
- }
- else
- {
- p.tvOutline.Nodes.Add(createOutlineNode(k));
- }
- break;
- default:
- p.tvOutline.Nodes.Add(createOutlineNode(k));
- break;
- }
- }
- p.tvOutline.EndUpdate();
- // p.tvOutline.Nodes.Add(states);
- p.tvOutline.ExpandAll();
-
- }
- }
-
- TreeNode createOutlineNode(Helpers.OutlineHelper ohOutline)
- {
- TreeNode result = null;
- int ImageKey = (int)ohOutline.info.type;
- result = new TreeNode(string.Format("{0} [{1}]", ohOutline.info.name, ohOutline.line + 1), ImageKey, ImageKey);
- result.Tag = ohOutline;
- return result;
- }
-
- public void SaveCurrentFile(string strPath, Encoding enc)
- {
- try
- {
- //Encoding enc = null;
- if (!Directory.Exists(Path.GetDirectoryName(strPath)))
- Directory.CreateDirectory(Path.GetDirectoryName(strPath));
-
- /*
- {
- switch (Properties.Settings.Default.OutputFormat)
- {
- case "UTF8":
- enc = Encoding.UTF8;
- break;
- case "Unicode":
- enc = Encoding.Unicode;
- break;
- case "BigEndianUnicode":
- enc = Encoding.BigEndianUnicode;
- break;
- default:
- enc = Encoding.Default;
- break;
- }
- }
- else
- {
- enc = Encoding.UTF8;
- }
- * */
-
- StreamWriter sw;
- if (enc != Encoding.UTF8)
- {
- sw = new StreamWriter(strPath, false, enc);
- }
- else
- {
- sw = new StreamWriter(strPath);
- }
- sw.Write(this.Text);
- sw.Close();
- //this.SaveFile(strPath, RichTextBoxStreamType.PlainText);
- this.Dirty = false;
- }
- catch // (Exception exception)
- {
- MessageBox.Show("Error saving file, check pathname: " + strPath, "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
-
- public new Encoding LoadFile(string path)
- {
- Encoding fileEncoding = null;
- if (path.StartsWith("http://"))
- {
- System.Net.WebClient webClient = new System.Net.WebClient();
- this.Text = webClient.DownloadString(path);
- }
- else
- {
- if (File.Exists(path))
- {
- // TODO needs to be refactored to read the file in once and pass the byte array to be checked.
- fileEncoding = TextFileEncodingDetector.DetectTextFileEncoding(path, Encoding.UTF8);
- try
- {
- StreamReader sr = new StreamReader(path, fileEncoding);
- this.Text = sr.ReadToEnd();
- sr.Close();
- }
- catch
- {
- }
- }
- }
- // Fresh files can not be dirty
- ClearUndoStack();
- return fileEncoding;
- }
- }
-}
+// /**
+// ********
+// *
+// * ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
+// * The code was donated on 4/28/2010 by Alphons van der Heijden
+// * To Brandon 'Dimentox Travanti' Husbands & Malcolm J. Kudra, who in turn License under the GPLv2.
+// * In agreement with Alphons van der Heijden's wishes.
+// *
+// * The community would like to thank Alphons for all of his hard work, blood sweat and tears.
+// * Without his work the community would be stuck with crappy editors.
+// *
+// * The source code in this file ("Source Code") is provided by The LSLEditor Group
+// * to you under the terms of the GNU General Public License, version 2.0
+// * ("GPL"), unless you have obtained a separate licensing agreement
+// * ("Other License"), formally executed by you and The LSLEditor Group. Terms of
+// * the GPL can be found in the gplv2.txt document.
+// *
+// ********
+// * GPLv2 Header
+// ********
+// * LSLEditor, a External editor for the LSL Language.
+// * Copyright (C) 2010 The LSLEditor Group.
+//
+// * This program is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU General Public License
+// * as published by the Free Software Foundation; either version 2
+// * of the License, or (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program; if not, write to the Free Software
+// * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********
+// *
+// * The above copyright notice and this permission notice shall be included in all
+// * copies or substantial portions of the Software.
+// *
+// ********
+// */
+using System;
+using System.IO;
+using System.Xml;
+using System.Text;
+using System.Drawing;
+
+using System.Collections.Generic;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Drawing.Printing;
+using System.Text.RegularExpressions;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+using LSLEditor.Helpers;
+
+namespace LSLEditor
+{
+ public delegate void IsDirtyHandler(object sender, EventArgs e);
+
+ public class SyntaxRichTextBox : RichTextBox
+ {
+ private const int WM_SETREDRAW = 0x000B;
+ private const int WM_USER = 0x400;
+ private const int EM_GETEVENTMASK = (WM_USER + 59);
+ private const int EM_SETEVENTMASK = (WM_USER + 69);
+
+ // Scroll position
+ [DllImport("user32.dll")]
+ private static extern int SendMessage(IntPtr hwndLock, Int32 wMsg, Int32 wParam, ref Point pt);
+
+ // Anti flicker
+ [DllImport("user32", CharSet = CharSet.Auto)]
+ private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
+
+ // Tabs
+ [DllImport("User32", CharSet = CharSet.Auto)]
+ public static extern IntPtr SendMessage(IntPtr h, int msg, int wParam, int[] lParam);
+
+ private bool m_Dirty;
+
+ private bool blnEscape;
+
+ private bool blnInsert;
+
+ // for tooltipping
+ private bool m_blnToolTipping;
+ private System.Windows.Forms.Timer timer1;
+ private GListBoxWindow GListBoxWindow;
+ private TooltipWindow TooltipMouse;
+ private TooltipWindow TooltipKeyboard;
+ private TooltipWindow TooltipListBox;
+
+ private Point OldMouseLocation;
+
+ private int intKeyWordLength;
+
+ // needed for flicker-free updates
+ private int intUpdate;
+ private IntPtr eventMask;
+
+ private int intOldLines;
+
+ // colored words
+ private KeyWords keyWords;
+
+ private Helpers.CodeCompletion codeCompletion;
+
+ // after clicking on error
+ private int HighLightLine;
+
+ // bracket highlighting
+ private List HighLightList;
+ public EditForm p;
+ public float CharWidth;
+ public int LineHeight;
+
+ // undo
+ private struct UndoElement
+ {
+ public int SelectionStart;
+ public int SelectionLength;
+ public string SelectedText;
+ public string RedoText;
+ public UndoElement(int SelectionStart, string SelectedText, int SelectionLength, string RedoText)
+ {
+ this.SelectionStart = SelectionStart;
+ this.SelectionLength = SelectionLength;
+ this.SelectedText = SelectedText;
+ this.RedoText = RedoText;
+ }
+ }
+ private Stack UndoStack;
+ private Stack RedoStack;
+
+ #region printing
+ //Convert the unit used by the .NET framework (1/100 inch)
+ //and the unit used by Win32 API calls (twips 1/1440 inch)
+ private const double anInch = 14.4;
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct RECT
+ {
+ public int Left;
+ public int Top;
+ public int Right;
+ public int Bottom;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct CHARRANGE
+ {
+ public int cpMin; //First character of range (0 for start of doc)
+ public int cpMax; //Last character of range (-1 for end of doc)
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct FORMATRANGE
+ {
+ public IntPtr hdc; //Actual DC to draw on
+ public IntPtr hdcTarget; //Target DC for determining text formatting
+ public RECT rc; //Region of the DC to draw to (in twips)
+ public RECT rcPage; //Region of the whole DC (page size) (in twips)
+ public CHARRANGE chrg; //Range of text to draw (see earlier declaration)
+ }
+
+ private const int EM_FORMATRANGE = WM_USER + 57;
+
+ [DllImport("user32", CharSet = CharSet.Auto)]
+ private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
+
+ // Render the contents of the RichTextBox for printing
+ // Return the last character printed + 1 (printing start from this point for next page)
+ public int Print(int charFrom, int charTo, PrintPageEventArgs e)
+ {
+ //Calculate the area to render and print
+ RECT rectToPrint;
+ rectToPrint.Top = (int)(e.MarginBounds.Top * anInch);
+ rectToPrint.Bottom = (int)(e.MarginBounds.Bottom * anInch);
+ rectToPrint.Left = (int)(e.MarginBounds.Left * anInch);
+ rectToPrint.Right = (int)(e.MarginBounds.Right * anInch);
+
+ //Calculate the size of the page
+ RECT rectPage;
+ rectPage.Top = (int)(e.PageBounds.Top * anInch);
+ rectPage.Bottom = (int)(e.PageBounds.Bottom * anInch);
+ rectPage.Left = (int)(e.PageBounds.Left * anInch);
+ rectPage.Right = (int)(e.PageBounds.Right * anInch);
+
+ IntPtr hdc = e.Graphics.GetHdc();
+
+ FORMATRANGE fmtRange;
+ fmtRange.chrg.cpMax = charTo; //Indicate character from to character to
+ fmtRange.chrg.cpMin = charFrom;
+ fmtRange.hdc = hdc; //Use the same DC for measuring and rendering
+ fmtRange.hdcTarget = hdc; //Point at printer hDC
+ fmtRange.rc = rectToPrint; //Indicate the area on page to print
+ fmtRange.rcPage = rectPage; //Indicate size of page
+
+ IntPtr wparam = new IntPtr(1);
+
+ //Get the pointer to the FORMATRANGE structure in memory
+ IntPtr lparam = Marshal.AllocCoTaskMem(Marshal.SizeOf(fmtRange));
+ Marshal.StructureToPtr(fmtRange, lparam, false);
+
+ //Send the rendered data for printing
+ IntPtr res = SendMessage(Handle, EM_FORMATRANGE, wparam, lparam);
+
+ //Free the block of memory allocated
+ Marshal.FreeCoTaskMem(lparam);
+
+ //Release the device context handle obtained by a previous call
+ e.Graphics.ReleaseHdc(hdc);
+
+ //Return last + 1 character printer
+ return res.ToInt32();
+ }
+ #endregion
+
+ public event IsDirtyHandler OnDirtyChanged;
+ public event EventHandler OnPaintNumbers;
+
+ public delegate void CursorPositionChangedHandler(object sender, CursorPositionEventArgs e);
+ public event CursorPositionChangedHandler OnCursorPositionChanged;
+ public class CursorPositionEventArgs : EventArgs
+ {
+ public int Line;
+ public int Column;
+ public int Char;
+ public int Total;
+ public bool Insert;
+ public bool Caps;
+ public CursorPositionEventArgs(int intLine, int intColumn, int intChar, int intTotal, bool blnInsert, bool blnCaps)
+ {
+ this.Line = intLine;
+ this.Column = intColumn;
+ this.Char = intChar;
+ this.Total = intTotal;
+ this.Insert = blnInsert;
+ this.Caps = blnCaps;
+ }
+ }
+
+ public SyntaxRichTextBox()
+ {
+ this.intUpdate = 0;
+ this.eventMask = IntPtr.Zero;
+ this.m_blnToolTipping = false;
+
+ this.intKeyWordLength = 0;
+
+ this.AcceptsTab = true;
+ this.BorderStyle = BorderStyle.None;
+ this.DetectUrls = false;
+ this.Dirty = false;
+
+ this.ScrollBars = RichTextBoxScrollBars.ForcedBoth;
+ this.WordWrap = false;
+
+ this.FontChanged += new EventHandler(SyntaxRichTextBox_FontChanged);
+
+ this.MouseMove += new MouseEventHandler(SyntaxRichTextBox_MouseMove);
+
+ this.VScroll += new EventHandler(SyntaxRichTextBox_Position);
+ this.HScroll += new EventHandler(SyntaxRichTextBox_Position);
+
+ this.HighLightLine = -1;
+ this.HighLightList = new List();
+
+ this.UndoStack = new Stack();
+ this.RedoStack = new Stack();
+
+ this.blnEscape = false;
+
+ this.blnInsert = true;
+
+ this.intOldLines = -1;
+
+ this.CharWidth = 10; //TODO
+ this.LineHeight = 16;
+
+ this.OldMouseLocation = Point.Empty;
+
+ this.codeCompletion = new Helpers.CodeCompletion();
+
+ this.HideSelection = false;
+
+ // are these of any use?
+ //this.DoubleBuffered = true;
+ //SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ //SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
+ //SetStyle(ControlStyles.Opaque, true);
+ }
+ public void setEditform(EditForm ed)
+ {
+ p = ed;
+ }
+ public void Init(LSLEditorForm parent, XmlDocument xml)
+ {
+ if (parent != null)
+ {
+ this.ToolTipping = true;
+ this.GListBoxWindow = parent.GListBoxWindow;
+ this.TooltipMouse = parent.TooltipMouse;
+ this.TooltipKeyboard = parent.TooltipKeyboard;
+ this.TooltipListBox = parent.TooltipListBox;
+ // p = this.Parent as EditForm;
+ // p = parent; moved to edit form
+ }
+
+ string ColorScheme = "color";
+ if (this.ToolTipping)
+ {
+ if (Properties.Settings.Default.SLColorScheme)
+ {
+ ColorScheme = "sl" + ColorScheme;
+ }
+
+ XmlNode BackgroundColorNode = xml.SelectSingleNode("/Conf");
+ if (BackgroundColorNode != null)
+ {
+ Color bgColor = Color.FromArgb(255, Color.FromArgb(int.Parse(BackgroundColorNode.Attributes[ColorScheme].InnerText.Replace("#", ""), System.Globalization.NumberStyles.HexNumber)));
+ this.BackColor = bgColor;
+ }
+ }
+ keyWords = new KeyWords(ColorScheme, xml);
+ }
+
+ private void MeasureFont()
+ {
+ Size size = TextRenderer.MeasureText("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM", this.Font);
+ CharWidth = (int)(size.Width / 50.0F);
+ LineHeight = size.Height;
+ }
+
+ void SyntaxRichTextBox_FontChanged(object sender, EventArgs e)
+ {
+ this.SelectAll();
+
+ TabStops();
+
+ // recolor all
+ ColorLine(0, this.Text.Length);
+ }
+
+ private void TabStops()
+ {
+ MeasureFont();
+
+ const int EM_SETTABSTOPS = 0xCB;
+
+ int intNumberOfChars = Properties.Settings.Default.TabStops;
+ int[] tabs = new int[30]; // TODO
+ float fltTabWidth = intNumberOfChars * CharWidth;
+
+ float totalWidth = 0.0F;
+ for (int intI = 0; intI < tabs.Length; intI++)
+ {
+ totalWidth += fltTabWidth;
+ tabs[intI] = (int)totalWidth;
+ }
+
+ SendMessage(this.Handle, EM_SETTABSTOPS, 0, null);
+ SendMessage(this.Handle, EM_SETTABSTOPS, tabs.Length, tabs);
+
+ this.SelectionTabs = tabs;
+ }
+
+ private void PaintNumbers()
+ {
+ if (OnPaintNumbers != null)
+ OnPaintNumbers(null, null);
+ }
+
+ protected override void OnVScroll(EventArgs e)
+ {
+ base.OnVScroll(e);
+ PaintNumbers();
+ }
+
+
+ private Point RTBScrollPos
+ {
+ get
+ {
+ const int EM_GETSCROLLPOS = 0x0400 + 221;
+ Point pt = new Point();
+
+ SendMessage(this.Handle, EM_GETSCROLLPOS, 0, ref pt);
+ return pt;
+ }
+ set
+ {
+ const int EM_SETSCROLLPOS = 0x0400 + 222;
+
+ SendMessage(this.Handle, EM_SETSCROLLPOS, 0, ref value);
+ }
+ }
+
+
+ public bool Dirty
+ {
+ get
+ {
+ return m_Dirty;
+ }
+ set
+ {
+ if (this.m_Dirty == value)
+ return;
+ this.m_Dirty = value;
+
+ if (OnDirtyChanged == null)
+ return;
+
+ OnDirtyChanged(this, new EventArgs());
+ }
+ }
+
+ private void SyntaxRichTextBox_Position(object sender, EventArgs e)
+ {
+ SetPosition(Screen.GetWorkingArea(this));
+ }
+
+ private void SyntaxRichTextBox_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (!ToolTipping)
+ return;
+
+ if (this.timer1 == null)
+ return;
+
+ this.timer1.Stop();
+ if (OldMouseLocation != e.Location)
+ {
+ OldMouseLocation = e.Location;
+ this.timer1.Start();
+ }
+ }
+
+ private int GetLine()
+ {
+ return 1 + this.GetLineFromCharIndex(this.SelectionStart);
+ }
+
+ private int GetChar()
+ {
+ return 1 + this.SelectionStart - this.GetFirstCharIndexOfCurrentLine();
+ }
+
+ private int GetColumn()
+ {
+ Point p1 = this.GetPositionFromCharIndex(this.GetFirstCharIndexOfCurrentLine());
+ Point p2 = this.GetPositionFromCharIndex(this.SelectionStart);
+ int intColumn = (int)((p2.X - p1.X) / this.CharWidth);
+ return 1+ intColumn;
+ }
+
+ private int GetTotal()
+ {
+ return this.Text.Length;
+ }
+
+ public void Goto(int Line, int Char)
+ {
+ BeginUpdate();
+ LineDownlighting();
+
+ try
+ {
+ int intLine = Line - 1;
+ if (intLine < 0)
+ intLine = 0;
+ if (intLine >= this.Lines.Length)
+ intLine = this.Lines.Length - 1;
+
+ if (intLine >= 0 && intLine < this.Lines.Length)
+ {
+ int intLength = this.Lines[intLine].Length;
+ int intStart = GetFirstCharIndexFromLine(intLine);
+ int intIndex = intStart + Char - 1;
+ HighLightLine = intLine;
+ this.SelectionStart = intStart;
+ this.SelectionLength = intLength;
+ this.SelectionBackColor = Color.LightBlue;
+ this.SelectionLength = 0;
+ this.SelectionStart = intIndex;
+ }
+ }
+ catch
+ {
+ }
+
+ EndUpdate(false);
+ this.Focus();
+ }
+
+ protected override void OnSelectionChanged(EventArgs e)
+ {
+ base.OnSelectionChanged(e);
+ if (!IsUpdating)
+ CursorPositionChanged(); // show cursor position
+ }
+
+ private bool IsUpdating
+ {
+ get
+ {
+ return (intUpdate > 0);
+ }
+ }
+
+ Point backupScrollPoint;
+ private void BeginUpdate()
+ {
+ ++intUpdate;
+ if (intUpdate > 1) // once is enough
+ return;
+
+ backupScrollPoint = this.RTBScrollPos;
+ // Disable redrawing
+ SendMessage(this.Handle, WM_SETREDRAW, 0, IntPtr.Zero);
+
+ // Disable generating events
+ eventMask = SendMessage(this.Handle, EM_GETEVENTMASK, 0, IntPtr.Zero);
+ }
+
+ private void EndUpdate(bool update_outline)
+ {
+ if(update_outline) doOutline();
+
+ intUpdate = Math.Max(0, intUpdate - 1);
+
+ if (intUpdate > 0) // only the last one
+ return;
+
+ // Enable events
+ SendMessage(this.Handle, EM_SETEVENTMASK, 0, eventMask);
+
+ // Enable redrawing
+ SendMessage(this.Handle, WM_SETREDRAW, 1, IntPtr.Zero);
+
+ // also draw when linenumbers are shifted
+ if (intOldLines != this.Lines.Length || backupScrollPoint != this.RTBScrollPos)
+ {
+ intOldLines = this.Lines.Length;
+ PaintNumbers();
+ }
+ Invalidate();
+ }
+
+ private bool IsAlpha(char chrC)
+ {
+ return (char.IsLetterOrDigit(chrC) || chrC == '_');
+ }
+
+ // used for F1 key, help and tooltipping, use Mouse of begin-selection
+ public string GetCurrentKeyWord(bool blnUserMousePosition, out Point PositionFirstCharacter)
+ {
+ PositionFirstCharacter = Point.Empty;
+
+ int intIndex = this.SelectionStart;
+ if (blnUserMousePosition)
+ {
+ Point mp = this.PointToClient(Control.MousePosition);
+ intIndex = this.GetCharIndexFromPosition(mp);
+
+ // check if mouse is in region of index
+ Point mpControle = this.GetPositionFromCharIndex(intIndex);
+ if (Math.Abs(mp.X - mpControle.X) > 5 || Math.Abs(mp.Y - mpControle.Y) > this.LineHeight)
+ return "";
+ }
+
+ int intLineNr = this.GetLineFromCharIndex(intIndex);
+ int intFirstChar = this.GetFirstCharIndexFromLine(intLineNr);
+ int intColumn = intIndex - intFirstChar;
+
+ string strLine = this.Lines[intLineNr];
+
+ int intStart = intColumn;
+ while ((intStart > 0) && (IsAlpha(strLine[intStart - 1])))
+ intStart--;
+
+ // 22 jun 2007
+ PositionFirstCharacter = this.GetPositionFromCharIndex(intFirstChar + intStart + 2);
+
+ int intEnd = intColumn;
+ while ((intEnd < strLine.Length) && (IsAlpha(strLine[intEnd])))
+ intEnd++;
+
+ // Calculate the length of the keyword.
+ int intLength = intEnd - intStart;
+
+ // return the keyword
+ return strLine.Substring(intStart, intLength);
+ }
+
+ private string GetCurrentFunction(out int Argument, out bool DoWild)
+ {
+ DoWild = false;
+ Argument = 0;
+ int intIndex = this.SelectionStart;
+ int intLineNumber = this.GetLineFromCharIndex(intIndex);
+ int intStartChar = this.GetFirstCharIndexFromLine(intLineNumber);
+
+ int intColumn = intIndex - intStartChar;
+
+ string strLine = this.Lines[intLineNumber];
+
+ // Find the end of the current function
+ int intEnd = intColumn - 1;
+ while (intEnd > 0 &&
+ strLine[intEnd] != '(' &&
+ strLine[intEnd] != ')' &&
+ strLine[intEnd] != '\n')
+ {
+ if (strLine[intEnd] == ',')
+ {
+ Argument++;
+ if (Argument == 1)
+ DoWild = (intColumn - intEnd) == 1;
+ }
+ intEnd--;
+ }
+ if (intEnd <= 0)
+ return "";
+
+ if (strLine[intEnd] != '(')
+ return "";
+
+ if (Argument == 0)
+ DoWild = (intColumn - intEnd) == 1;
+
+ intEnd--;
+
+ // Find the begin of the current function.
+ int intStart = intEnd;
+ while ((intStart > 0) && (IsAlpha(strLine[intStart])))
+ intStart--;
+
+ // Calculate the length of the function.
+ int intLength = intEnd - intStart;
+
+ // return the Function name
+ return strLine.Substring(intStart + 1, intLength);
+ }
+
+ private string GetNewWhiteSpace(int intOffset)
+ {
+ int intIndex = this.GetLineFromCharIndex(this.SelectionStart);
+ return AutoFormatter.GetNewWhiteSpace(this.Lines, intIndex + intOffset);
+ }
+
+ private void AutoFormatFromLineToLine(int intLineStart, int intLineEnd)
+ {
+ BeginUpdate();
+ int intStart = this.GetFirstCharIndexFromLine(intLineStart);
+ int intLength = this.GetFirstCharIndexFromLine(intLineEnd) +
+ this.Lines[intLineEnd].Length + 1 - intStart;
+ this.SelectionStart = intStart;
+ this.SelectionLength = intLength;
+ AutoFormat(true);
+ EndUpdate(true);
+ }
+
+ private void ProcessEnter()
+ {
+ BeginUpdate();
+ this.ColoredText = "\n";
+ if (ToolTipping)
+ {
+ if (Properties.Settings.Default.Indent)
+ {
+ if (Properties.Settings.Default.IndentFullAuto)
+ {
+ int intLine = this.GetLineFromCharIndex(this.SelectionStart);
+ AutoFormatFromLineToLine(intLine - 1, intLine - 1);
+ this.ColoredText = GetNewWhiteSpace(-1);
+ }
+ else if (Properties.Settings.Default.IndentCursorPlacement)
+ {
+ this.ColoredText = GetNewWhiteSpace(-1);
+ }
+ }
+ }
+ EndUpdate(true);
+ }
+
+ private void SmartIndenting()
+ {
+ int intFirstLine, intC;
+ int intLastLine = this.GetLineFromCharIndex(this.SelectionStart);
+ int intColumn = this.SelectionStart - this.GetFirstCharIndexFromLine(intLastLine);
+
+ intColumn--; // because we are at position '}'
+
+ if (MatchingBracket(intLastLine, intColumn, '}', '{', -1, out intFirstLine, out intC))
+ {
+ if ((intLastLine - intFirstLine) >= 1)
+ AutoFormatFromLineToLine(intFirstLine + 1, intLastLine);
+ }
+ }
+
+ private void ProcessBraces(char keyChar)
+ {
+ BeginUpdate();
+ int intStart = this.SelectionStart;
+
+ this.ColoredText = keyChar.ToString();
+
+ if (Properties.Settings.Default.Indent)
+ {
+ int intLength = this.Text.Length;
+
+ if (Properties.Settings.Default.IndentFullAuto)
+ {
+ if (keyChar == '}')
+ {
+ SmartIndenting();
+ }
+ else
+ {
+ int intCurrentLine = this.GetLineFromCharIndex(this.SelectionStart);
+ AutoFormatFromLineToLine(intCurrentLine, intCurrentLine);
+ }
+ }
+
+ int intDelta = 1 + this.Text.Length - intLength;
+
+ this.SelectionStart = intStart + intDelta;
+
+ BracketHighlichting();
+ }
+
+ EndUpdate(false);
+ }
+
+ public void Delete()
+ {
+ BeginUpdate();
+ if (this.SelectionLength == 0)
+ this.SelectionLength = 1;
+ this.ColoredText = "";
+ EndUpdate(true);
+ OnTextChanged(null);
+ }
+
+ public new void Cut()
+ {
+ BeginUpdate();
+ this.Copy();
+ this.ColoredText = "";
+ EndUpdate(true);
+ OnTextChanged(null);
+ }
+
+
+ private void SaveUndo(UndoElement el)
+ {
+ if (RedoStack.Count > 0)
+ RedoStack.Clear();
+ UndoStack.Push(el);
+ }
+
+ public new void Redo()
+ {
+ if (RedoStack.Count == 0)
+ return;
+
+ MakeAllInvis();
+
+ BeginUpdate();
+
+ this.Dirty = true;
+
+ UndoElement el = RedoStack.Pop();
+
+ this.SelectionStart = el.SelectionStart;
+ this.SelectionLength = el.SelectedText.Length;
+ this.SelectedText = el.RedoText;
+
+ el.RedoText = null; // dont need it anymore
+ UndoStack.Push(el);
+
+ int intStartLine = this.GetLineFromCharIndex(el.SelectionStart);
+ int intStart = this.GetFirstCharIndexFromLine(intStartLine);
+
+ int intStopLine = this.GetLineFromCharIndex(el.SelectionStart + el.SelectedText.Length);
+ if (intStopLine < this.Lines.Length)
+ {
+ int intLengthStopLine = this.Lines[intStopLine].Length;
+ int intStop = this.GetFirstCharIndexFromLine(intStopLine) + intLengthStopLine;
+
+ ColorLine(intStart, intStop - intStart);
+ }
+
+ EndUpdate(true);
+ this.Focus();
+ }
+
+ public new void Undo()
+ {
+ if (UndoStack.Count == 0)
+ return;
+
+ MakeAllInvis();
+
+ BeginUpdate();
+
+ UndoElement el = UndoStack.Pop();
+
+ this.Dirty = (UndoStack.Count != 0);
+
+ this.SelectionStart = el.SelectionStart;
+ this.SelectionLength = el.SelectionLength;
+ el.RedoText = this.SelectedText; // save redo text!!!!
+ this.SelectedText = el.SelectedText;
+
+ RedoStack.Push(el);
+
+ int intStartLine = this.GetLineFromCharIndex(el.SelectionStart);
+ int intStart = this.GetFirstCharIndexFromLine(intStartLine);
+
+ int intStopLine = this.GetLineFromCharIndex(el.SelectionStart + el.SelectedText.Length);
+ if (intStopLine < this.Lines.Length)
+ {
+ int intLengthStopLine = this.Lines[intStopLine].Length;
+ int intStop = this.GetFirstCharIndexFromLine(intStopLine) + intLengthStopLine;
+
+ ColorLine(intStart, intStop - intStart);
+ }
+
+ EndUpdate(true);
+ this.Focus();
+ }
+
+ public void ToClipBoard()
+ {
+ bool backup = Properties.Settings.Default.SL4SpacesIndent;
+ Properties.Settings.Default.SL4SpacesIndent = true;
+ string strFormattedText = AutoFormatter.ApplyFormatting(0, this.Text);
+ Properties.Settings.Default.SL4SpacesIndent = backup;
+
+ try
+ {
+ Clipboard.SetDataObject(strFormattedText, true);
+ }
+ catch(Exception exception)
+ {
+ // error
+ Console.WriteLine(exception.Message);
+ }
+ }
+
+ public void ReplaceSelectedText(string strReplacement)
+ {
+ this.blnEscape = true; // prevent windows popping up
+ this.ColoredText = strReplacement;
+ }
+
+ public void MakeAllInvis()
+ {
+ if (!ToolTipping)
+ return;
+ this.TooltipKeyboard.Visible = false;
+ this.TooltipListBox.Visible = false;
+ this.TooltipMouse.Visible = false;
+ this.GListBoxWindow.Visible = false;
+ this.Focus();
+ }
+
+ private void LineDownlighting()
+ {
+ if (this.HighLightLine < 0)
+ return;
+
+ // doof line
+ BeginUpdate();
+ int intBackupSelectionStart = this.SelectionStart;
+ int intBackupSelectionLength = this.SelectionLength;
+ this.SelectionStart = this.GetFirstCharIndexFromLine(this.HighLightLine);
+ this.SelectionLength = this.Lines[this.HighLightLine].Length;
+ this.SelectionBackColor = this.BackColor;
+ this.SelectionStart = intBackupSelectionStart;
+ this.SelectionLength = intBackupSelectionLength;
+ this.HighLightLine = -1;
+ EndUpdate(false);
+ }
+
+ private void CursorPositionChanged()
+ {
+ BracketHighlichting();
+
+ LineDownlighting();
+
+ if (OnCursorPositionChanged != null)
+ OnCursorPositionChanged(this, new CursorPositionEventArgs(this.GetLine(), this.GetColumn(), this.GetChar(), this.GetTotal(), this.blnInsert, Control.IsKeyLocked(Keys.CapsLock)));
+ }
+
+ public new void Paste()
+ {
+ ResetHighlighting();
+
+ // First try with Unicode
+ if (Clipboard.GetDataObject().GetDataPresent(DataFormats.UnicodeText, true))
+ {
+ string strTextToPaste = Clipboard.GetDataObject().GetData(DataFormats.UnicodeText, true).ToString().Replace("\r", "");
+ this.ColoredText = strTextToPaste;
+ } // failing that try ANSI text.
+ else if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text, true))
+ {
+ string strTextToPaste = Clipboard.GetDataObject().GetData(DataFormats.Text, true).ToString().Replace("\r", "");
+ this.ColoredText = strTextToPaste;
+#if DEBUG
+ // TODO Add code to show encoding used in a dialogue or the status bar.
+#endif
+ }
+ }
+
+ private void GoEnd(bool blnShift)
+ {
+ if (this.Lines.Length == 0)
+ return;
+ int intLast = this.SelectionStart + this.SelectionLength;
+ int intLine = this.GetLineFromCharIndex(intLast);
+ int intColumn = intLast - this.GetFirstCharIndexFromLine(intLine);
+ string strLine = this.Lines[intLine];
+ int intAdd = strLine.Length - intColumn;
+ if (blnShift)
+ this.SelectionLength += intAdd;
+ else
+ {
+ this.SelectionStart = intLast+intAdd;
+ this.SelectionLength = 0;
+ }
+ }
+
+ private void GoHome(bool blnShift)
+ {
+ if (this.Lines.Length == 0)
+ return;
+ int intLine = this.GetLineFromCharIndex(this.SelectionStart);
+ string strLine = this.Lines[intLine];
+ for (int intColumn = 0; intColumn <= strLine.Length; intColumn++)
+ {
+ // now we are at the front of the line, ex whitespace
+ if (intColumn == strLine.Length || strLine[intColumn] > ' ')
+ {
+ int intStart = this.GetFirstCharIndexFromLine(intLine) + intColumn;
+ if (intStart == this.SelectionStart) // already here
+ intStart = this.GetFirstCharIndexFromLine(intLine);
+ // intStart has now got the new start position
+ if (blnShift)
+ {
+ int intAddToLength = this.SelectionStart - intStart;
+ this.SelectionStart = intStart;
+ // can + of -
+ this.SelectionLength = Math.Max(0, this.SelectionLength + intAddToLength);
+ }
+ else
+ {
+ this.SelectionStart = intStart;
+ this.SelectionLength = 0;
+ }
+ return;
+ }
+ }
+ }
+
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ base.OnKeyDown(e);
+
+ if (this.TooltipMouse != null)
+ {
+ if (this.TooltipMouse.Visible)
+ {
+ this.TooltipMouse.Visible = false;
+ this.Focus();
+ }
+ }
+
+ if (this.GListBoxWindow != null && this.GListBoxWindow.Visible)
+ {
+ this.GListBoxWindow.KeyDownHandler(e);
+ }
+ else
+ {
+ if (e.KeyCode == Keys.Tab)
+ {
+ int intLineStart = this.GetLineFromCharIndex(this.SelectionStart);
+ int intLineStop = this.GetLineFromCharIndex(this.SelectionStart + this.SelectionLength);
+ if (intLineStart != intLineStop)
+ MultiLineTab(!e.Shift);
+ else
+ SingleLineTab(!e.Shift);
+ e.Handled = true;
+ }
+ }
+
+ if (e.KeyCode == Keys.Insert)
+ {
+ blnInsert = !blnInsert;
+ CursorPositionChanged();
+ }
+
+ if (e.KeyCode == Keys.Left ||
+ e.KeyCode == Keys.Right ||
+ e.KeyCode == Keys.End ||
+ e.KeyCode == Keys.Home)
+ MakeAllInvis();
+
+ if (e.KeyCode == Keys.Home)
+ {
+ if (!e.Control)
+ {
+ GoHome(e.Shift);
+ e.Handled = true;
+ }
+ }
+
+ if (e.KeyCode == Keys.End)
+ {
+ if (!e.Control)
+ {
+ GoEnd(e.Shift);
+ e.Handled = true;
+ }
+ }
+
+ if (e.KeyCode == Keys.Delete)
+ {
+ if (e.Control)
+ {
+ int intWissel = 0;
+ int intIndex = this.SelectionStart;
+ if (intIndex < this.Text.Length)
+ {
+ bool blnWhiteSpace = (this.Text[intIndex] <= ' ');
+
+ while (intIndex < this.Text.Length)
+ {
+ if (this.Text[intIndex] > ' ')
+ {
+ if (blnWhiteSpace)
+ {
+ blnWhiteSpace = false;
+ intWissel++;
+ }
+ }
+ else // whitespace
+ {
+ if (!blnWhiteSpace)
+ {
+ blnWhiteSpace = true;
+ intWissel++;
+ }
+ }
+ if (intWissel == 2)
+ break;
+ intIndex++;
+ }
+ this.SelectionLength = intIndex - this.SelectionStart;
+ }
+ } // control
+ else
+ {
+ if (e.Shift)
+ {
+ if (this.SelectionLength == 0)
+ {
+ if (this.Lines.Length > 0)
+ {
+ BeginUpdate();
+ this.SelectionStart = this.GetFirstCharIndexOfCurrentLine();
+ int intLine = this.GetLineFromCharIndex(this.SelectionStart);
+ this.SelectionLength = this.Lines[intLine].Length + 1;
+ EndUpdate(true);
+ }
+ }
+ this.Copy();
+ } // shift
+ else
+ {
+ if (this.SelectionLength == 0)
+ this.SelectionLength = 1;
+ } // no shift
+ }
+ this.Delete();
+ e.Handled = true;
+ }
+
+ if (e.KeyCode == Keys.X && e.Control)
+ {
+ this.Cut();
+ e.Handled = true;
+ }
+
+ if (this.TooltipKeyboard != null)
+ {
+ if (this.TooltipKeyboard.Visible)
+ {
+ if (e.KeyCode == Keys.Up ||
+ e.KeyCode == Keys.Down)
+ {
+ this.TooltipKeyboard.Visible = false;
+ this.Focus();
+ }
+ }
+ }
+
+ // 16 maart 2008
+ if (e.KeyCode == Keys.Back && e.Alt)
+ this.Undo();
+
+ if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Back)
+ e.Handled = true;
+
+ if (e.Control)
+ {
+ if (e.KeyCode == Keys.R)
+ {
+ e.Handled = true;
+ }
+ if (e.KeyCode == Keys.V)
+ {
+ this.Paste();
+ e.Handled = true;
+ }
+ if (e.KeyCode == Keys.C)
+ {
+ this.Copy();
+ e.Handled = true;
+ }
+ }
+
+ if (e.KeyData == Keys.CapsLock)
+ CursorPositionChanged();
+ }
+
+ private void ProcessBackSpace()
+ {
+ if (this.SelectionStart == 0 && this.SelectionLength == 0)
+ return;
+
+ BeginUpdate();
+ if (this.SelectionStart > 0 && this.SelectionLength == 0)
+ this.SelectionStart--;
+ if (this.SelectionLength == 0)
+ this.SelectionLength = 1;
+ this.ColoredText = "";
+ EndUpdate(true);
+ OnTextChanged(null);
+ CursorPositionChanged();
+ }
+
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ ResetHighlighting();
+
+ char keyChar = e.KeyChar;
+
+ switch (e.KeyChar)
+ {
+ case '\r': // Return
+ if (this.GListBoxWindow.Visible)
+ InsertSelectedWord();
+ else
+ ProcessEnter();
+ e.Handled = true;
+ break;
+ case '\t': // TAB
+ if (this.GListBoxWindow.Visible)
+ InsertSelectedWord();
+ e.Handled = true;
+ break;
+ case '{':
+ case '}':
+ ProcessBraces(keyChar);
+ e.Handled = true;
+ break;
+ case '\b':
+ ProcessBackSpace();
+ MakeAllInvis();
+ e.Handled = true;
+ break;
+ case (char)27:
+ this.blnEscape = !this.blnEscape;
+ MakeAllInvis();
+ break;
+ default:
+ if (keyChar >= 32)
+ {
+ if (this.SelectionLength != 0)
+ this.Delete();
+ SaveUndo(new UndoElement(this.SelectionStart, "", 1, null));
+ }
+ if (keyChar > 32 && !Char.IsLetterOrDigit(keyChar))
+ this.blnEscape = false;
+ break;
+ }
+ base.OnKeyPress(e);
+ }
+
+ // event generated, make list of codecompletion words
+ private void CodeCompletion(string strKeyWord, bool IsRegularExpression)
+ {
+ if (!ToolTipping)
+ return;
+
+ intKeyWordLength = strKeyWord.Length;
+
+ if (IsRegularExpression)
+ intKeyWordLength = 0; // else it would delete the word typed so far
+
+ if (strKeyWord.Length == 0 || this.blnEscape)
+ {
+ this.TooltipListBox.Visible = false;
+ this.GListBoxWindow.Visible = false;
+ this.Focus();
+ return;
+ }
+
+ List list;
+
+ if (Properties.Settings.Default.CodeCompletion)
+ list = keyWords.KeyWordSearch(strKeyWord, IsRegularExpression);
+ else
+ list = new List();
+
+ if (Properties.Settings.Default.CodeCompletionUserVar && !IsRegularExpression)
+ codeCompletion.CodeCompletionUserVar(strKeyWord, this.Text, this.SelectionStart, list);
+
+ if (list.Count == 0)
+ {
+ this.TooltipListBox.Visible = false;
+ this.GListBoxWindow.Visible = false;
+ this.Focus();
+ return;
+ }
+
+ if (list.Count == 1)
+ {
+ // single keyword has been typed, make listbox invisible
+ if (list[0].name == strKeyWord)
+ {
+ /*
+ // this autocompletes 1 word, backspace is a problem, use escape
+ this.GListBoxWindow.GListBox.Items.Clear();
+ KeyWordInfo keyWordInfo = list[0];
+ GListBoxItem glbi = new GListBoxItem(keyWordInfo.name, (int)keyWordInfo.type);
+ this.GListBoxWindow.GListBox.Items.Add(glbi);
+
+ this.GListBoxWindow.GListBox.SelectedIndex = 0;
+ InsertSelectedWord();
+ */
+
+ if (strKeyWord == "else") // else autocompletion annoys people!!! TODO
+ {
+ this.TooltipListBox.Visible = false;
+ this.GListBoxWindow.Visible = false;
+ this.Focus();
+ return;
+ }
+ }
+ }
+
+ // Hide argument typing
+ this.TooltipKeyboard.Visible = false;
+ this.Focus();
+
+ this.GListBoxWindow.GListBox.Items.Clear();
+ foreach (KeyWordInfo keyWordInfo in list)
+ {
+ GListBoxItem glbi = new GListBoxItem(keyWordInfo.name, (int)keyWordInfo.type);
+ this.GListBoxWindow.GListBox.Items.Add(glbi);
+ }
+ this.GListBoxWindow.GListBox.SelectedIndex = 0;
+ this.GListBoxWindow.GListBox.Height = Math.Min(list.Count + 1, 11) * this.GListBoxWindow.GListBox.ItemHeight;
+ this.GListBoxWindow.SetPosition(Screen.GetWorkingArea(this), this);
+
+ // Just in case it pops up
+ this.TooltipListBox.SetPosition(Screen.GetWorkingArea(this), this);
+
+ this.GListBoxWindow.Visible = true;
+ this.Focus();
+ }
+
+ private void SelectWordByDoubleClick()
+ {
+ int intSelectionStartBackup = this.SelectionStart;
+
+ int intLineNumber = this.GetLineFromCharIndex(intSelectionStartBackup);
+ int intFirstChar = this.GetFirstCharIndexFromLine(intLineNumber);
+ int intColumn = intSelectionStartBackup - intFirstChar;
+
+ string strLine = this.Lines[intLineNumber];
+
+ // start or ending in underscore then expand
+ int intStart = intColumn;
+ while ((intStart > 0) && IsAlpha(strLine[intStart - 1]))
+ intStart--;
+
+ int intEnd = intColumn;
+ while ((intEnd < strLine.Length) && IsAlpha(strLine[intEnd]))
+ intEnd++;
+
+ if (intStart != intColumn || intEnd != (intStart + this.SelectionLength))
+ {
+ this.SelectionStart = intFirstChar + intStart;
+ this.SelectionLength = intEnd - intStart;
+ }
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ base.OnMouseDown(e);
+
+ BracketHighlichting();
+
+ // this sucks!!!!
+ this.AutoWordSelection = true;
+ this.AutoWordSelection = Properties.Settings.Default.AutoWordSelection;
+
+ if (this.ToolTipping)
+ MakeAllInvis();
+
+ if (e.Clicks == 2)
+ SelectWordByDoubleClick();
+ }
+
+ private void ShowKeyBoardHint()
+ {
+ if (!ToolTipping)
+ return;
+
+ if (this.GListBoxWindow.Visible)
+ return;
+
+ if (this.blnEscape)
+ return;
+
+ int intArgument;
+ bool DoWild;
+ string strFunction = GetCurrentFunction(out intArgument, out DoWild);
+
+ if (strFunction == "")
+ {
+ this.TooltipKeyboard.Visible = false;
+ this.Focus();
+ return;
+ }
+
+ SetArgumentListOnRichLabel(this.TooltipKeyboard, strFunction, intArgument);
+ if (DoWild && this.TooltipKeyboard.Wild != "")
+ {
+ CodeCompletion(this.TooltipKeyboard.Wild , true);
+ this.Focus();
+ return;
+ }
+
+ if (this.TooltipKeyboard.Text == "")
+ {
+ this.TooltipKeyboard.Visible = false;
+ }
+ else
+ {
+ this.TooltipKeyboard.SetPosition(Screen.GetWorkingArea(this), this);
+ this.TooltipKeyboard.Visible = true;
+ //this.SelectionColor = this.ForeColor;
+ }
+ this.Focus();
+ }
+
+ private bool IsInComment(string strLine, int intIndex)
+ {
+ bool blnInString = false;
+ for (int intI = 0; intI < intIndex; intI++)
+ {
+ char chrC = strLine[intI];
+ if (chrC == '"')
+ blnInString = !blnInString;
+ if (blnInString)
+ {
+ if (chrC == '\\')
+ intI++;
+ continue;
+ }
+ if (chrC == '/')
+ {
+ if ((intI + 1) < intIndex)
+ if (strLine[intI + 1] == '/')
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private bool IsInString(string strLine, int intIndex)
+ {
+ int intQuotes = 0;
+ for (int intI = intIndex - 1; intI >= 0; intI--)
+ {
+ char chrC = strLine[intI];
+ if (chrC == '"')
+ {
+ if ((intI - 1) >= 0)
+ if (strLine[intI - 1] != '\\')
+ intQuotes++;
+ }
+ }
+ return ((intQuotes % 2) != 0);
+ }
+
+ ///
+ /// OnTextChanged
+ ///
+ protected override void OnTextChanged(EventArgs e)
+ {
+ if (IsUpdating)
+ return;
+
+ if (this.Lines.Length == 0)
+ {
+ TabStops();
+ return;
+ }
+
+ this.Dirty = true;
+
+ int intSelectionStartBackup = this.SelectionStart;
+
+ int intLineNumber = this.GetLineFromCharIndex(intSelectionStartBackup);
+ int intFirstChar = this.GetFirstCharIndexFromLine(intLineNumber);
+ int intColumn = intSelectionStartBackup - intFirstChar;
+
+ string strLine = this.Lines[intLineNumber];
+
+ ColorLine(intFirstChar, strLine.Length);
+
+ if (IsInComment(strLine, intColumn))
+ return;
+
+ if (IsInString(strLine, intColumn))
+ return;
+
+ // not in comment and not in string, find the start of a word
+ int intStart = intColumn;
+ while ((intStart > 0) && IsAlpha(strLine[intStart - 1]))
+ intStart--;
+
+ string strTypedWord = strLine.Substring(intStart, intColumn - intStart);
+
+ CodeCompletion(strTypedWord , false);
+
+ ShowKeyBoardHint();
+ }
+
+ ///
+ /// Color a line
+ ///
+ private void ColorLine(int intStart, int intLength)
+ {
+ if (!ToolTipping)
+ return;
+
+ if (intLength <= 0)
+ return;
+
+ BeginUpdate();
+
+ // Backup position
+ int SelectionStartBackup = this.SelectionStart;
+
+ // get the line
+ string strLine = this.Text.Substring(intStart, intLength);
+
+ // highlight all keywords
+ foreach (Match m in keyWords.Matches(strLine))
+ {
+ Group g = m.Groups[1];
+ string strKeyWord = g.Value;
+
+ this.SelectionStart = intStart + g.Index;
+ this.SelectionLength = g.Length;
+
+ // normal keywords
+ if (keyWords.ContainsKeyWord(strKeyWord))
+ this.SelectionColor = keyWords.GetColorFromKeyWordList(strKeyWord);
+ else
+ this.SelectionColor = keyWords.GetColorFromRegex(strKeyWord);
+ }
+
+ // Restore position
+ this.SelectionLength = 0;
+ this.SelectionStart = SelectionStartBackup;
+ this.SelectionColor = this.ForeColor;
+
+ EndUpdate(false);
+ }
+
+ private int AutoFormat(bool OnlySelectedText)
+ {
+ int intTabs;
+ if (OnlySelectedText)
+ {
+ string strW = GetNewWhiteSpace(-1);
+ intTabs = (int)(strW.Length / AutoFormatter.GetTab().Length);
+ }
+ else
+ {
+ this.SelectionStart = 0;
+ this.SelectionLength = this.Text.Length;
+ intTabs = 0;
+ }
+ string strFormattedText = AutoFormatter.ApplyFormatting(intTabs, this.SelectedText);
+
+ this.ColoredText = strFormattedText;
+
+ return strFormattedText.Length;
+ }
+
+ public void AutoFormatSelectedText()
+ {
+ BeginUpdate();
+ Point scrollPoint = this.RTBScrollPos;
+ int intBackupStart = this.SelectionStart;
+ int intSelectionLength = AutoFormat(true);
+ this.SelectionStart = intBackupStart;
+ this.SelectionLength = intSelectionLength;
+ this.RTBScrollPos = scrollPoint;
+ EndUpdate(false);
+ }
+
+ public void FormatDocument()
+ {
+ BeginUpdate();
+ Point scrollPoint = this.RTBScrollPos;
+ int intLine = this.GetLineFromCharIndex(this.SelectionStart);
+ AutoFormat(false);
+ this.SelectionStart = Math.Max(0,this.GetFirstCharIndexFromLine(intLine));
+ this.RTBScrollPos = scrollPoint;
+ EndUpdate(false);
+ }
+
+ public void ClearUndoStack()
+ {
+ UndoStack.Clear();
+ Dirty = false;
+ }
+
+ public override string Text
+ {
+ get
+ {
+ return base.Text;
+ }
+ set
+ {
+ BeginUpdate();
+ int intBackup = this.SelectionStart;
+ this.SelectionStart = 0;
+ this.SelectionLength = this.Text.Length; //TODO
+ this.ColoredText = value;
+ this.SelectionStart = intBackup;
+ EndUpdate(true);
+ }
+ }
+
+ private string GetWhiteSpaceFromCurrentLine()
+ {
+ int intIndex = this.GetLineFromCharIndex(this.SelectionStart);
+ if (intIndex < this.Lines.Length)
+ return AutoFormatter.GetWhiteSpaceFromLine(this.Lines[intIndex]);
+ return "";
+ }
+
+ // code-completion word is selected
+ // also comes from mainform (doubleclick), must be public
+ public void InsertSelectedWord()
+ {
+ this.GListBoxWindow.Visible = false;
+ this.TooltipListBox.Visible = false;
+
+ if (this.GListBoxWindow.GListBox.SelectedIndex < 0)
+ return;
+
+ int intOffset = 0;
+
+ GListBoxItem glbi = this.GListBoxWindow.Selected;
+ string strSelected = glbi.ToString();
+ if (strSelected == "")
+ {
+ this.Focus();
+ return;
+ }
+
+ if (glbi.ImageIndex == (int)KeyWordTypeEnum.Events
+ || strSelected == "default" && this.Text.IndexOf("default")<0)
+ {
+ if (strSelected != "default")
+ strSelected = keyWords.GetEvent(strSelected);
+
+ string strW = GetWhiteSpaceFromCurrentLine();
+ strSelected += "\n" + strW + "{\n" + strW + AutoFormatter.GetTab() + "\n" + strW + "}";
+ intOffset = -(strW.Length + 2);
+ }
+ else if (glbi.ImageIndex == (int)KeyWordTypeEnum.Functions)
+ {
+ if(keyWords.GetNumberOfArguments(strSelected) == 0)
+ strSelected += "()";
+ else
+ strSelected += "(";
+ }
+ else if (glbi.ImageIndex == (int)KeyWordTypeEnum.Properties)
+ {
+ strSelected = "\"" + strSelected.Trim() +"\"";
+ }
+
+ BeginUpdate();
+ this.SelectionStart -= intKeyWordLength;
+ this.SelectionLength = intKeyWordLength;
+ this.ColoredText = strSelected;
+
+ this.SelectionStart += intOffset;
+ EndUpdate(true);
+
+ // if any
+ ShowKeyBoardHint();
+
+ this.Focus();
+ }
+
+ // this comes from the main form
+ public void ShowTooltipOnListBox()
+ {
+ string strSelected = this.GListBoxWindow.Selected.ToString();
+ string strDescription = keyWords.GetDescription(strSelected);
+ if (strDescription != "")
+ {
+ this.TooltipListBox.Tag = strSelected;
+ this.TooltipListBox.Text = strDescription;
+ this.TooltipListBox.XOffset = this.GListBoxWindow.Width;
+ this.TooltipListBox.SetPosition(Screen.GetWorkingArea(this), this);
+ this.TooltipListBox.Visible = true;
+ this.Focus();
+ }
+ else
+ {
+ this.TooltipListBox.Visible = false;
+ this.Focus();
+ }
+ }
+
+ // Tooltip mouse by (Windows.Forms) timer
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ this.timer1.Stop();
+
+ if (this.Disposing || this.IsDisposed)
+ return;
+
+ if (!this.Visible)
+ return;
+
+ if (!ToolTipping)
+ return;
+
+ if (!Properties.Settings.Default.ToolTip)
+ return;
+
+ if (Control.MouseButtons != MouseButtons.None)
+ return;
+
+ Point point;
+ string strKeyWord = this.GetCurrentKeyWord(true, out point);
+
+ if (strKeyWord == "")
+ {
+ this.TooltipMouse.Visible = false;
+ return;
+ }
+
+ if (this.TooltipMouse.Tag.ToString() != strKeyWord)
+ {
+ this.TooltipMouse.Tag = strKeyWord;
+ this.TooltipMouse.Text = keyWords.GetDescription(strKeyWord);
+ }
+
+ if (this.TooltipMouse.Text == "")
+ {
+ this.TooltipMouse.Visible = false;
+ return;
+ }
+
+ this.TooltipMouse.SetPosition(this, point);
+ this.TooltipMouse.Visible = true;
+ this.Focus();
+ }
+
+ public bool ToolTipping
+ {
+ get
+ {
+ return m_blnToolTipping;
+ }
+ set
+ {
+ m_blnToolTipping = value;
+ if (m_blnToolTipping)
+ {
+ this.timer1 = new System.Windows.Forms.Timer();
+ this.timer1.Interval = Properties.Settings.Default.ToolTipDelay;
+ this.timer1.Tick += new EventHandler(timer1_Tick);
+ }
+ }
+ }
+
+ public void SetPosition(Rectangle rect)
+ {
+ if (!ToolTipping)
+ return;
+ if (this.GListBoxWindow.Visible)
+ this.GListBoxWindow.SetPosition(rect, this);
+ if (this.TooltipListBox.Visible)
+ this.TooltipListBox.SetPosition(rect, this);
+ if (this.TooltipKeyboard.Visible)
+ this.TooltipKeyboard.SetPosition(rect, this);
+ }
+
+ private void SetArgumentListOnRichLabel(TooltipWindow window, string strKeyWord, int intArgument)
+ {
+ if (window.Tag.ToString() == (strKeyWord + intArgument))
+ return; // cached information
+
+ string strWild = "";
+ window.Wild = "";
+ window.Tag = (strKeyWord + intArgument);
+ window.Text = keyWords.GetFunctionAndHiglightArgument(strKeyWord, intArgument, out strWild);
+ if(Properties.Settings.Default.CodeCompletionArguments)
+ window.Wild = strWild;
+ }
+
+
+ public void Goto(int intLine)
+ {
+ this.SelectionStart = this.GetFirstCharIndexFromLine(intLine - 1);
+ this.Focus();
+ }
+
+ public void MultiLineComment(bool blnAdd)
+ {
+ BeginUpdate();
+
+ ResetHighlighting();
+
+ string strW = GetNewWhiteSpace(-1);
+ int intTabs = (int)(strW.Length / AutoFormatter.GetTab().Length);
+
+ int intLastLine = this.GetLineFromCharIndex(this.SelectionStart + this.SelectionLength);
+
+ int intLine = this.GetLineFromCharIndex(this.SelectionStart);
+ this.SelectionStart = this.GetFirstCharIndexFromLine(intLine);
+ int intLength = 0;
+ do
+ {
+ intLength += this.Lines[intLine].Length + 1;
+ intLine++;
+ } while (intLine <= intLastLine);
+ this.SelectionLength = intLength;
+
+ string strSelectedText = AutoFormatter.MultiLineComment(blnAdd, intTabs, this.SelectedText);
+
+ int intBackup = this.SelectionStart;
+ this.ColoredText = strSelectedText;
+ this.SelectionStart = intBackup;
+ this.SelectionLength = strSelectedText.Length;
+ EndUpdate(true);
+ }
+
+ public void MultiLineTab(bool blnAdd)
+ {
+ string strSelectedText = AutoFormatter.MultiLineTab(blnAdd, this.SelectedText);
+
+ int intBackup = this.SelectionStart;
+ this.ColoredText = strSelectedText;
+ this.SelectionStart = intBackup;
+ this.SelectionLength = strSelectedText.Length;
+ }
+
+ private void SingleLineTab(bool blnAdd)
+ {
+ if (blnAdd)
+ {
+ this.SelectedText = AutoFormatter.GetTab();
+ }
+ else
+ {
+ // Shift tab on single line
+ string strTab = AutoFormatter.GetTab();
+ if (this.SelectionStart > strTab.Length)
+ {
+ string strBefore = this.Text.Substring(this.SelectionStart - strTab.Length, strTab.Length);
+ if (strBefore == strTab)
+ {
+ int intBackupLength = this.SelectionLength;
+ this.SelectionStart -= strTab.Length;
+ this.SelectionLength = strTab.Length;
+ this.SelectedText = "";
+ this.SelectionLength = intBackupLength;
+ }
+ else
+ {
+ // space remove? TODO
+ }
+ }
+ }
+ }
+
+ private void HighLightCharAt(int intIndex, Color color)
+ {
+ this.SelectionStart = intIndex;
+ this.SelectionLength = 1;
+ this.SelectionBackColor = color;
+
+ if (color != this.BackColor)
+ HighLightList.Add(intIndex);
+ }
+
+ private void HighLightCharAt(int intLine, int intColumn, Color color)
+ {
+ int intIndex = this.GetFirstCharIndexFromLine(intLine) + intColumn;
+ HighLightCharAt(intIndex, color);
+ }
+
+ private bool MatchingBracket(int intCurrentLine, int intCurrentColumn, char chrOpening, char chrClosing, int intDirection, out int intLine, out int intColumn)
+ {
+ if (this.Lines.Length == 0)
+ {
+ intLine = 0;
+ intColumn = 0;
+ return false;
+ }
+ intLine = intCurrentLine;
+ intColumn = intCurrentColumn;
+ string strLine = AutoFormatter.RemoveComment(this.Lines[intLine]);
+
+ int intNumber = 1;
+ bool blnWithinString = false;
+ while (true)
+ {
+ intColumn += intDirection;
+ while (intColumn < 0)
+ {
+ intLine--;
+ if (intLine < 0)
+ return false; // nothing to do
+ strLine = AutoFormatter.RemoveComment(this.Lines[intLine]); // get new previous line
+ intColumn = strLine.Length - 1; // place on end of line
+ }
+
+ while (intColumn >= strLine.Length)
+ {
+ intLine++;
+ if (intLine >= this.Lines.Length)
+ return false; // nothing to do
+ strLine = AutoFormatter.RemoveComment(this.Lines[intLine]); // get new previous line
+ intColumn = 0; // place on begin of line
+ }
+
+ char chrC = strLine[intColumn];
+
+ if (chrC == '"')
+ {
+ if (intDirection < 0 && intColumn > 0)
+ {
+ if (strLine[intColumn - 1] == '\\')
+ {
+ intColumn += intDirection;
+ continue;
+ }
+ }
+ blnWithinString = !blnWithinString;
+ }
+
+ if (blnWithinString)
+ {
+ if (intDirection > 0 && chrC == '\\')
+ intColumn += intDirection;
+ continue;
+ }
+
+ if (chrC == chrOpening)
+ intNumber++;
+ else if (chrC == chrClosing)
+ {
+ intNumber--;
+ if (intNumber == 0)
+ return true;
+ }
+ }
+ }
+
+ private void ResetHighlighting()
+ {
+ if (HighLightList.Count == 0)
+ return;
+
+ BeginUpdate();
+
+ Point scrollPoint = this.RTBScrollPos;
+
+ int intBackupStart = this.SelectionStart;
+ int intBackupLength = this.SelectionLength;
+ foreach (int intIndex in HighLightList)
+ HighLightCharAt(intIndex, this.BackColor);
+ HighLightList.Clear();
+ this.SelectionStart = intBackupStart;
+ this.SelectionLength = intBackupLength;
+
+ this.RTBScrollPos = scrollPoint;
+
+ EndUpdate(false);
+ }
+
+ private void BracketHighlichting()
+ {
+ if (this.TextLength == 0)
+ return;
+ if (this.SelectionLength != 0)
+ return;
+
+ BeginUpdate();
+
+ Point scrollPoint = this.RTBScrollPos;
+
+ int intSelectionStart = this.SelectionStart;
+
+ // ResetHighlichting without the overhead
+ if (HighLightList.Count > 0)
+ {
+ foreach (int intI in HighLightList)
+ HighLightCharAt(intI, this.BackColor);
+ HighLightList.Clear();
+ }
+
+ int intIndex;
+ int intType;
+
+ const string Uppers = "<({[";
+ const string Downers = ">)}]";
+
+ int intLine = this.GetLineFromCharIndex(intSelectionStart);
+ int intColumn = intSelectionStart - this.GetFirstCharIndexFromLine(intLine);
+
+ string strLine = AutoFormatter.RemoveComment(this.Lines[intLine]);
+
+ if (intColumn <= strLine.Length)
+ {
+ intIndex = intColumn - 1;
+ if (intIndex >= 0)
+ {
+ intType = Downers.IndexOf(strLine[intIndex]);
+ if (intType >= 0)
+ {
+ int intL, intC;
+ if (MatchingBracket(intLine, intIndex, Downers[intType], Uppers[intType], -1, out intL, out intC))
+ {
+ HighLightCharAt(intLine, intIndex, Properties.Settings.Default.BracketHighlight);
+ HighLightCharAt(intL, intC, Properties.Settings.Default.BracketHighlight);
+ }
+ }
+ }
+
+ intIndex = intColumn;
+ if (intIndex < strLine.Length)
+ {
+ intType = Uppers.IndexOf(strLine[intIndex]);
+ if (intType >= 0)
+ {
+ int intL, intC;
+ if (MatchingBracket(intLine, intIndex, Uppers[intType], Downers[intType], 1, out intL, out intC))
+ {
+ HighLightCharAt(intLine, intIndex, Properties.Settings.Default.BracketHighlight);
+ HighLightCharAt(intL, intC, Properties.Settings.Default.BracketHighlight);
+ }
+ }
+ }
+ }
+
+ this.SelectionStart = intSelectionStart;
+ this.SelectionLength = 0;
+
+ this.RTBScrollPos = scrollPoint;
+
+ EndUpdate(false);
+ }
+
+ public override string SelectedText
+ {
+ get
+ {
+ return base.SelectedText;
+ }
+ set
+ {
+ if (!IsUpdating)
+ SaveUndo(new UndoElement(this.SelectionStart, this.SelectedText, value.Length, null));
+ base.SelectedText = value;
+ }
+ }
+
+ private string ColoredText
+ {
+ set
+ {
+ BeginUpdate();
+ int intFirstCharOfStartLine = this.GetFirstCharIndexOfCurrentLine();
+ int intBackup = this.SelectionStart;
+ if (this.SelectedText != value)
+ {
+ this.Dirty = true;
+ string strTmp = value.Replace("\r", "");
+ SaveUndo(new UndoElement(this.SelectionStart, this.SelectedText, strTmp.Length, null));
+ this.SelectedText = strTmp;
+ if (this.Lines.Length > 0)
+ {
+ int intEndLine = this.GetLineFromCharIndex(intBackup + strTmp.Length);
+ int intLastCharOfEndLine = this.GetFirstCharIndexFromLine(intEndLine) + this.Lines[intEndLine].Length;
+ int intLength = intLastCharOfEndLine - intFirstCharOfStartLine;
+ ColorLine(intFirstCharOfStartLine, intLength);
+ this.SelectionStart = intBackup + strTmp.Length;
+ }
+ }
+ else
+ {
+ this.SelectionLength = 0;
+ this.SelectionStart += value.Length;
+ }
+ EndUpdate(true);
+ }
+ }
+ public void doOutline()
+ {
+ //TODO: finish the outline class and such
+ // still a work in progress trying to figure out exactly how i wanna do this.
+
+ int len = this.Lines.Length;
+ if (len < 1)
+ {
+ return;
+ }
+ Dictionary list = new Dictionary();
+ string ttext = this.Text;
+ ttext.Replace("\r\n", "");
+ using (StringReader reader = new StringReader(ttext))
+ {
+ string line;
+
+ int lineNumber = 0;
+ while ((line = reader.ReadLine()) != null)
+ {
+
+ line = line.Trim();
+ line = line.Split('(')[0];
+ string[] words = line.Split(' ');
+ foreach (string word in words)
+ {
+ //Debug.WriteLine("ww:" + word);
+ if (keyWords.ContainsKeyWord(word))
+ {
+ KeyWordInfo k = keyWords.GetKeyWordInfo(word);
+ // Debug.WriteLine("w:" + word);
+ //Debug.WriteLine("k:" + k.type);
+ if (!list.ContainsKey(lineNumber))
+ {
+ switch (k.type)
+ {
+
+ case KeyWordTypeEnum.Functions:
+ list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
+ // Debug.WriteLine(k);
+ break;
+ case KeyWordTypeEnum.Events:
+ list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
+ break;
+ case KeyWordTypeEnum.Constants:
+ list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
+ break;
+ case KeyWordTypeEnum.Class:
+ list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
+ break;
+ case KeyWordTypeEnum.Vars:
+ list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
+ break;
+ case KeyWordTypeEnum.States:
+ list.Add(lineNumber, new LSLEditor.Helpers.OutlineHelper(k, lineNumber));
+ break;
+ default:
+ //Debug.WriteLine(k);
+ break;
+ }
+ }
+ }
+ }
+
+ lineNumber++;
+
+ }
+ }
+ //TODO: parse dict and create the outline in the treeview
+ //WILL SOMEONE PLEASE FUCKING FINISH THIS!
+
+ if (p != null) //It gives the parent-scriptwindow as null when you try to run it
+ {
+ p.tvOutline.BeginUpdate();
+ p.tvOutline.Nodes.Clear();
+ TreeNode lastState = null;
+ TreeNode lastEvent = null;
+ TreeNode lastScope = null;
+
+ foreach (LSLEditor.Helpers.OutlineHelper k in list.Values)
+ {
+ switch (k.info.type)
+ {
+ case KeyWordTypeEnum.States:
+ lastState = createOutlineNode(k);
+ lastScope = lastState;
+ p.tvOutline.Nodes.Add(lastState);
+ break;
+ case KeyWordTypeEnum.Events:
+ if (lastState != null) //we need a state for every event!
+ {
+ lastEvent = createOutlineNode(k);
+ lastScope = lastEvent;
+ lastState.Nodes.Add(lastEvent);
+ }
+ break;
+ case KeyWordTypeEnum.Functions:
+ if (lastScope != null)
+ {
+ lastScope.Nodes.Add(createOutlineNode(k));
+ }
+ break;
+ case KeyWordTypeEnum.Class:
+ if (lastScope != null)
+ {
+ lastScope.Nodes.Add(createOutlineNode(k));
+ }
+ else
+ {
+ p.tvOutline.Nodes.Add(createOutlineNode(k));
+ }
+ break;
+ default:
+ p.tvOutline.Nodes.Add(createOutlineNode(k));
+ break;
+ }
+ }
+ p.tvOutline.EndUpdate();
+ // p.tvOutline.Nodes.Add(states);
+ p.tvOutline.ExpandAll();
+
+ }
+ }
+
+ TreeNode createOutlineNode(Helpers.OutlineHelper ohOutline)
+ {
+ TreeNode result = null;
+ int ImageKey = (int)ohOutline.info.type;
+ result = new TreeNode(string.Format("{0} [{1}]", ohOutline.info.name, ohOutline.line + 1), ImageKey, ImageKey);
+ result.Tag = ohOutline;
+ return result;
+ }
+
+ public void SaveCurrentFile(string strPath, Encoding enc)
+ {
+ try
+ {
+ //Encoding enc = null;
+ if (!Directory.Exists(Path.GetDirectoryName(strPath)))
+ Directory.CreateDirectory(Path.GetDirectoryName(strPath));
+
+ /*
+ {
+ switch (Properties.Settings.Default.OutputFormat)
+ {
+ case "UTF8":
+ enc = Encoding.UTF8;
+ break;
+ case "Unicode":
+ enc = Encoding.Unicode;
+ break;
+ case "BigEndianUnicode":
+ enc = Encoding.BigEndianUnicode;
+ break;
+ default:
+ enc = Encoding.Default;
+ break;
+ }
+ }
+ else
+ {
+ enc = Encoding.UTF8;
+ }
+ * */
+
+ StreamWriter sw;
+ if (enc != Encoding.UTF8)
+ {
+ sw = new StreamWriter(strPath, false, enc);
+ }
+ else
+ {
+ sw = new StreamWriter(strPath);
+ }
+ sw.Write(this.Text);
+ sw.Close();
+ //this.SaveFile(strPath, RichTextBoxStreamType.PlainText);
+ this.Dirty = false;
+ }
+ catch // (Exception exception)
+ {
+ MessageBox.Show("Error saving file, check pathname: " + strPath, "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ public new Encoding LoadFile(string path)
+ {
+ Encoding fileEncoding = null;
+ if (path.StartsWith("http://"))
+ {
+ System.Net.WebClient webClient = new System.Net.WebClient();
+ this.Text = webClient.DownloadString(path);
+ }
+ else
+ {
+ if (File.Exists(path))
+ {
+ // TODO needs to be refactored to read the file in once and pass the byte array to be checked.
+ fileEncoding = TextFileEncodingDetector.DetectTextFileEncoding(path, Encoding.UTF8);
+ try
+ {
+ StreamReader sr = new StreamReader(path, fileEncoding);
+ this.Text = sr.ReadToEnd();
+ sr.Close();
+ }
+ catch
+ {
+ }
+ }
+ }
+ // Fresh files can not be dirty
+ ClearUndoStack();
+ return fileEncoding;
+ }
+ }
+}
diff --git a/trunk/Editor/SyntaxRichTextBox.resx b/source/Editor/SyntaxRichTextBox.resx
similarity index 97%
rename from trunk/Editor/SyntaxRichTextBox.resx
rename to source/Editor/SyntaxRichTextBox.resx
index dd0ea4d..3f337e0 100644
--- a/trunk/Editor/SyntaxRichTextBox.resx
+++ b/source/Editor/SyntaxRichTextBox.resx
@@ -1,42 +1,42 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 1.0.0.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.0.0.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
diff --git a/trunk/Editor/TooltipWindow.cs b/source/Editor/TooltipWindow.cs
similarity index 96%
rename from trunk/Editor/TooltipWindow.cs
rename to source/Editor/TooltipWindow.cs
index 2a88243..1b7e88c 100644
--- a/trunk/Editor/TooltipWindow.cs
+++ b/source/Editor/TooltipWindow.cs
@@ -1,158 +1,158 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Drawing;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Drawing.Drawing2D;
-
-namespace LSLEditor
-{
- public partial class TooltipWindow : Form
- {
- public string Wild;
- public int XOffset = 0;
- public override string Text
- {
- get
- {
- return base.Text;
- }
- set
- {
- base.Text = value;
- this.richLabel1.Text = value;
- }
- }
-
- public TooltipWindow(Form parent)
- {
- InitializeComponent();
-
- this.Wild = "";
-
- this.Owner = parent;
- this.richLabel1.BorderStyle = BorderStyle.FixedSingle;
- //this.richLabel1.BackColor = Color.LightGoldenrodYellow;
-
- this.BackColor = Color.LightGoldenrodYellow;
- //this.richLabel1.BorderStyle = BorderStyle.None;
-
- this.richLabel1.Tag = "";
- this.richLabel1.Text = "";
- }
-
- public void SetPosition(Rectangle rect, SyntaxRichTextBox syntaxRichTextBox)
- {
- //Rectangle rect = Screen.PrimaryScreen.WorkingArea;
- Point p = syntaxRichTextBox.GetPositionFromCharIndex(syntaxRichTextBox.SelectionStart);
-
- p = new Point(p.X - 20 + this.XOffset + 2 , p.Y + 2 + syntaxRichTextBox.LineHeight);
-
- Rectangle client = Screen.PrimaryScreen.WorkingArea; // syntaxRichTextBox.ClientRectangle;
- if (p.X < client.Left || p.Y < client.Top || p.X > client.Width || p.Y > client.Height)
- {
- this.Visible = false;
- return;
- }
-
- Point screen = syntaxRichTextBox.PointToScreen(p);
-
- //if ((screen.Y + this.Height) > rect.Height)
- // screen = RichTextBox.PointToScreen(new Point(p.X - 20 + this.XOffset, p.Y - this.Height));
-
- if (screen.Y > rect.Bottom)
- {
- this.Visible = false;
- return;
- //screen.Y = rect.Bottom;
- }
-
- if (screen.X > rect.Right)
- {
- this.Visible = false;
- return;
- //screen.X = rect.Right;
- }
-
- if (screen.X < rect.Left)
- {
- this.Visible = false;
- return;
- //screen.X = rect.Left;
- }
-
- if ((screen.Y) < rect.Top)
- {
- this.Visible = false;
- return;
- //screen.Y = rect.Top;
- }
-
- this.Location = screen;
- }
-
- public void SetPosition(SyntaxRichTextBox syntaxRichTextBox, Point p)
- {
- Rectangle rect = Screen.PrimaryScreen.WorkingArea;
- Point screen = syntaxRichTextBox.PointToScreen(new Point(p.X - 20 , p.Y + syntaxRichTextBox.LineHeight));
- if ((screen.Y + this.Height) > rect.Height)
- screen = syntaxRichTextBox.PointToScreen(new Point(p.X - 20, p.Y - this.Height));
-
- if ((screen.X + this.Width) > rect.Width)
- screen.X = rect.Width - this.Width;
-
- if (screen.X < rect.Left)
- screen.X = rect.Left;
-
- if (screen.Y < rect.Top)
- screen.Y = rect.Top;
-
- this.Location = screen;
- }
-
- private void richLabel1_Resize(object sender, EventArgs e)
- {
- this.Size = this.richLabel1.Size;
-
- }
-
- }
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Drawing.Drawing2D;
+
+namespace LSLEditor
+{
+ public partial class TooltipWindow : Form
+ {
+ public string Wild;
+ public int XOffset = 0;
+ public override string Text
+ {
+ get
+ {
+ return base.Text;
+ }
+ set
+ {
+ base.Text = value;
+ this.richLabel1.Text = value;
+ }
+ }
+
+ public TooltipWindow(Form parent)
+ {
+ InitializeComponent();
+
+ this.Wild = "";
+
+ this.Owner = parent;
+ this.richLabel1.BorderStyle = BorderStyle.FixedSingle;
+ //this.richLabel1.BackColor = Color.LightGoldenrodYellow;
+
+ this.BackColor = Color.LightGoldenrodYellow;
+ //this.richLabel1.BorderStyle = BorderStyle.None;
+
+ this.richLabel1.Tag = "";
+ this.richLabel1.Text = "";
+ }
+
+ public void SetPosition(Rectangle rect, SyntaxRichTextBox syntaxRichTextBox)
+ {
+ //Rectangle rect = Screen.PrimaryScreen.WorkingArea;
+ Point p = syntaxRichTextBox.GetPositionFromCharIndex(syntaxRichTextBox.SelectionStart);
+
+ p = new Point(p.X - 20 + this.XOffset + 2 , p.Y + 2 + syntaxRichTextBox.LineHeight);
+
+ Rectangle client = Screen.PrimaryScreen.WorkingArea; // syntaxRichTextBox.ClientRectangle;
+ if (p.X < client.Left || p.Y < client.Top || p.X > client.Width || p.Y > client.Height)
+ {
+ this.Visible = false;
+ return;
+ }
+
+ Point screen = syntaxRichTextBox.PointToScreen(p);
+
+ //if ((screen.Y + this.Height) > rect.Height)
+ // screen = RichTextBox.PointToScreen(new Point(p.X - 20 + this.XOffset, p.Y - this.Height));
+
+ if (screen.Y > rect.Bottom)
+ {
+ this.Visible = false;
+ return;
+ //screen.Y = rect.Bottom;
+ }
+
+ if (screen.X > rect.Right)
+ {
+ this.Visible = false;
+ return;
+ //screen.X = rect.Right;
+ }
+
+ if (screen.X < rect.Left)
+ {
+ this.Visible = false;
+ return;
+ //screen.X = rect.Left;
+ }
+
+ if ((screen.Y) < rect.Top)
+ {
+ this.Visible = false;
+ return;
+ //screen.Y = rect.Top;
+ }
+
+ this.Location = screen;
+ }
+
+ public void SetPosition(SyntaxRichTextBox syntaxRichTextBox, Point p)
+ {
+ Rectangle rect = Screen.PrimaryScreen.WorkingArea;
+ Point screen = syntaxRichTextBox.PointToScreen(new Point(p.X - 20 , p.Y + syntaxRichTextBox.LineHeight));
+ if ((screen.Y + this.Height) > rect.Height)
+ screen = syntaxRichTextBox.PointToScreen(new Point(p.X - 20, p.Y - this.Height));
+
+ if ((screen.X + this.Width) > rect.Width)
+ screen.X = rect.Width - this.Width;
+
+ if (screen.X < rect.Left)
+ screen.X = rect.Left;
+
+ if (screen.Y < rect.Top)
+ screen.Y = rect.Top;
+
+ this.Location = screen;
+ }
+
+ private void richLabel1_Resize(object sender, EventArgs e)
+ {
+ this.Size = this.richLabel1.Size;
+
+ }
+
+ }
}
\ No newline at end of file
diff --git a/trunk/Editor/TooltipWindow.designer.cs b/source/Editor/TooltipWindow.designer.cs
similarity index 96%
rename from trunk/Editor/TooltipWindow.designer.cs
rename to source/Editor/TooltipWindow.designer.cs
index 99cc24a..32612b5 100644
--- a/trunk/Editor/TooltipWindow.designer.cs
+++ b/source/Editor/TooltipWindow.designer.cs
@@ -1,62 +1,62 @@
-namespace LSLEditor
-{
- partial class TooltipWindow
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.richLabel1 = new LSLEditor.RichLabel();
- this.SuspendLayout();
- //
- // richLabel1
- //
- this.richLabel1.BackColor = System.Drawing.Color.LightGoldenrodYellow;
- this.richLabel1.Location = new System.Drawing.Point(0, 0);
- this.richLabel1.Name = "richLabel1";
- this.richLabel1.Size = new System.Drawing.Size(52, 20);
- this.richLabel1.TabIndex = 0;
- this.richLabel1.Resize += new System.EventHandler(this.richLabel1_Resize);
- //
- // TooltipWindow
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(105, 42);
- this.Controls.Add(this.richLabel1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
- this.Name = "TooltipWindow";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- this.Text = "GListBoxWindow";
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private RichLabel richLabel1;
- }
+namespace LSLEditor
+{
+ partial class TooltipWindow
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.richLabel1 = new LSLEditor.RichLabel();
+ this.SuspendLayout();
+ //
+ // richLabel1
+ //
+ this.richLabel1.BackColor = System.Drawing.Color.LightGoldenrodYellow;
+ this.richLabel1.Location = new System.Drawing.Point(0, 0);
+ this.richLabel1.Name = "richLabel1";
+ this.richLabel1.Size = new System.Drawing.Size(52, 20);
+ this.richLabel1.TabIndex = 0;
+ this.richLabel1.Resize += new System.EventHandler(this.richLabel1_Resize);
+ //
+ // TooltipWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(105, 42);
+ this.Controls.Add(this.richLabel1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+ this.Name = "TooltipWindow";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
+ this.Text = "GListBoxWindow";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private RichLabel richLabel1;
+ }
}
\ No newline at end of file
diff --git a/trunk/Editor/TooltipWindow.resx b/source/Editor/TooltipWindow.resx
similarity index 97%
rename from trunk/Editor/TooltipWindow.resx
rename to source/Editor/TooltipWindow.resx
index ff31a6d..19dc0dd 100644
--- a/trunk/Editor/TooltipWindow.resx
+++ b/source/Editor/TooltipWindow.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/trunk/FindWindow.Designer.cs b/source/FindWindow.Designer.cs
similarity index 97%
rename from trunk/FindWindow.Designer.cs
rename to source/FindWindow.Designer.cs
index 4ad8ad3..55d8d8f 100644
--- a/trunk/FindWindow.Designer.cs
+++ b/source/FindWindow.Designer.cs
@@ -1,212 +1,212 @@
-namespace LSLEditor
-{
- partial class FindWindow
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.comboBoxFind = new System.Windows.Forms.ComboBox();
- this.FindNext = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.comboBoxReplace = new System.Windows.Forms.ComboBox();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.checkBoxWholeWord = new System.Windows.Forms.CheckBox();
- this.checkBoxReverse = new System.Windows.Forms.CheckBox();
- this.checkBoxMatchCase = new System.Windows.Forms.CheckBox();
- this.Replace = new System.Windows.Forms.Button();
- this.ReplaceAll = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.comboBoxFind);
- this.groupBox1.Location = new System.Drawing.Point(8, 8);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(240, 48);
- this.groupBox1.TabIndex = 1;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Find what:";
- //
- // comboBoxFind
- //
- this.comboBoxFind.FormattingEnabled = true;
- this.comboBoxFind.Location = new System.Drawing.Point(16, 16);
- this.comboBoxFind.Name = "comboBoxFind";
- this.comboBoxFind.Size = new System.Drawing.Size(208, 21);
- this.comboBoxFind.TabIndex = 1;
- this.comboBoxFind.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBoxFind_KeyDown);
- //
- // FindNext
- //
- this.FindNext.Location = new System.Drawing.Point(80, 184);
- this.FindNext.Name = "FindNext";
- this.FindNext.Size = new System.Drawing.Size(75, 23);
- this.FindNext.TabIndex = 6;
- this.FindNext.Text = "Find Next";
- this.FindNext.UseVisualStyleBackColor = true;
- this.FindNext.Click += new System.EventHandler(this.FindNext_Click);
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.comboBoxReplace);
- this.groupBox2.Location = new System.Drawing.Point(8, 56);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(240, 48);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "Replace with:";
- //
- // comboBoxReplace
- //
- this.comboBoxReplace.FormattingEnabled = true;
- this.comboBoxReplace.Location = new System.Drawing.Point(16, 16);
- this.comboBoxReplace.Name = "comboBoxReplace";
- this.comboBoxReplace.Size = new System.Drawing.Size(208, 21);
- this.comboBoxReplace.TabIndex = 2;
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.checkBoxWholeWord);
- this.groupBox3.Controls.Add(this.checkBoxReverse);
- this.groupBox3.Controls.Add(this.checkBoxMatchCase);
- this.groupBox3.Location = new System.Drawing.Point(8, 112);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(240, 64);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "Find options";
- //
- // checkBoxWholeWord
- //
- this.checkBoxWholeWord.AutoSize = true;
- this.checkBoxWholeWord.Location = new System.Drawing.Point(112, 24);
- this.checkBoxWholeWord.Name = "checkBoxWholeWord";
- this.checkBoxWholeWord.Size = new System.Drawing.Size(83, 17);
- this.checkBoxWholeWord.TabIndex = 4;
- this.checkBoxWholeWord.Text = "Whole word";
- this.checkBoxWholeWord.UseVisualStyleBackColor = true;
- //
- // checkBoxReverse
- //
- this.checkBoxReverse.AutoSize = true;
- this.checkBoxReverse.Location = new System.Drawing.Point(16, 40);
- this.checkBoxReverse.Name = "checkBoxReverse";
- this.checkBoxReverse.Size = new System.Drawing.Size(66, 17);
- this.checkBoxReverse.TabIndex = 5;
- this.checkBoxReverse.Text = "Reverse";
- this.checkBoxReverse.UseVisualStyleBackColor = true;
- //
- // checkBoxMatchCase
- //
- this.checkBoxMatchCase.AutoSize = true;
- this.checkBoxMatchCase.Location = new System.Drawing.Point(16, 24);
- this.checkBoxMatchCase.Name = "checkBoxMatchCase";
- this.checkBoxMatchCase.Size = new System.Drawing.Size(82, 17);
- this.checkBoxMatchCase.TabIndex = 3;
- this.checkBoxMatchCase.Text = "Match case";
- this.checkBoxMatchCase.UseVisualStyleBackColor = true;
- //
- // Replace
- //
- this.Replace.Location = new System.Drawing.Point(168, 184);
- this.Replace.Name = "Replace";
- this.Replace.Size = new System.Drawing.Size(75, 23);
- this.Replace.TabIndex = 7;
- this.Replace.Text = "Replace";
- this.Replace.UseVisualStyleBackColor = true;
- this.Replace.Click += new System.EventHandler(this.Replace_Click);
- //
- // ReplaceAll
- //
- this.ReplaceAll.Location = new System.Drawing.Point(168, 208);
- this.ReplaceAll.Name = "ReplaceAll";
- this.ReplaceAll.Size = new System.Drawing.Size(75, 23);
- this.ReplaceAll.TabIndex = 8;
- this.ReplaceAll.Text = "Replace All";
- this.ReplaceAll.UseVisualStyleBackColor = true;
- this.ReplaceAll.Click += new System.EventHandler(this.ReplaceAll_Click);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(24, 216);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 13);
- this.label1.TabIndex = 6;
- //
- // FindWindow
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(256, 238);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.ReplaceAll);
- this.Controls.Add(this.Replace);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.FindNext);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.KeyPreview = true;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "FindWindow";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = " Find";
- this.TopMost = true;
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindWindow_FormClosing);
- this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FindWindow_KeyDown);
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.ComboBox comboBoxFind;
- private System.Windows.Forms.Button FindNext;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.ComboBox comboBoxReplace;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.CheckBox checkBoxMatchCase;
- private System.Windows.Forms.Button Replace;
- private System.Windows.Forms.Button ReplaceAll;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.CheckBox checkBoxWholeWord;
- private System.Windows.Forms.CheckBox checkBoxReverse;
- }
+namespace LSLEditor
+{
+ partial class FindWindow
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.comboBoxFind = new System.Windows.Forms.ComboBox();
+ this.FindNext = new System.Windows.Forms.Button();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.comboBoxReplace = new System.Windows.Forms.ComboBox();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.checkBoxWholeWord = new System.Windows.Forms.CheckBox();
+ this.checkBoxReverse = new System.Windows.Forms.CheckBox();
+ this.checkBoxMatchCase = new System.Windows.Forms.CheckBox();
+ this.Replace = new System.Windows.Forms.Button();
+ this.ReplaceAll = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.comboBoxFind);
+ this.groupBox1.Location = new System.Drawing.Point(8, 8);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(240, 48);
+ this.groupBox1.TabIndex = 1;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Find what:";
+ //
+ // comboBoxFind
+ //
+ this.comboBoxFind.FormattingEnabled = true;
+ this.comboBoxFind.Location = new System.Drawing.Point(16, 16);
+ this.comboBoxFind.Name = "comboBoxFind";
+ this.comboBoxFind.Size = new System.Drawing.Size(208, 21);
+ this.comboBoxFind.TabIndex = 1;
+ this.comboBoxFind.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBoxFind_KeyDown);
+ //
+ // FindNext
+ //
+ this.FindNext.Location = new System.Drawing.Point(80, 184);
+ this.FindNext.Name = "FindNext";
+ this.FindNext.Size = new System.Drawing.Size(75, 23);
+ this.FindNext.TabIndex = 6;
+ this.FindNext.Text = "Find Next";
+ this.FindNext.UseVisualStyleBackColor = true;
+ this.FindNext.Click += new System.EventHandler(this.FindNext_Click);
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.comboBoxReplace);
+ this.groupBox2.Location = new System.Drawing.Point(8, 56);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(240, 48);
+ this.groupBox2.TabIndex = 2;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Replace with:";
+ //
+ // comboBoxReplace
+ //
+ this.comboBoxReplace.FormattingEnabled = true;
+ this.comboBoxReplace.Location = new System.Drawing.Point(16, 16);
+ this.comboBoxReplace.Name = "comboBoxReplace";
+ this.comboBoxReplace.Size = new System.Drawing.Size(208, 21);
+ this.comboBoxReplace.TabIndex = 2;
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.checkBoxWholeWord);
+ this.groupBox3.Controls.Add(this.checkBoxReverse);
+ this.groupBox3.Controls.Add(this.checkBoxMatchCase);
+ this.groupBox3.Location = new System.Drawing.Point(8, 112);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(240, 64);
+ this.groupBox3.TabIndex = 3;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Find options";
+ //
+ // checkBoxWholeWord
+ //
+ this.checkBoxWholeWord.AutoSize = true;
+ this.checkBoxWholeWord.Location = new System.Drawing.Point(112, 24);
+ this.checkBoxWholeWord.Name = "checkBoxWholeWord";
+ this.checkBoxWholeWord.Size = new System.Drawing.Size(83, 17);
+ this.checkBoxWholeWord.TabIndex = 4;
+ this.checkBoxWholeWord.Text = "Whole word";
+ this.checkBoxWholeWord.UseVisualStyleBackColor = true;
+ //
+ // checkBoxReverse
+ //
+ this.checkBoxReverse.AutoSize = true;
+ this.checkBoxReverse.Location = new System.Drawing.Point(16, 40);
+ this.checkBoxReverse.Name = "checkBoxReverse";
+ this.checkBoxReverse.Size = new System.Drawing.Size(66, 17);
+ this.checkBoxReverse.TabIndex = 5;
+ this.checkBoxReverse.Text = "Reverse";
+ this.checkBoxReverse.UseVisualStyleBackColor = true;
+ //
+ // checkBoxMatchCase
+ //
+ this.checkBoxMatchCase.AutoSize = true;
+ this.checkBoxMatchCase.Location = new System.Drawing.Point(16, 24);
+ this.checkBoxMatchCase.Name = "checkBoxMatchCase";
+ this.checkBoxMatchCase.Size = new System.Drawing.Size(82, 17);
+ this.checkBoxMatchCase.TabIndex = 3;
+ this.checkBoxMatchCase.Text = "Match case";
+ this.checkBoxMatchCase.UseVisualStyleBackColor = true;
+ //
+ // Replace
+ //
+ this.Replace.Location = new System.Drawing.Point(168, 184);
+ this.Replace.Name = "Replace";
+ this.Replace.Size = new System.Drawing.Size(75, 23);
+ this.Replace.TabIndex = 7;
+ this.Replace.Text = "Replace";
+ this.Replace.UseVisualStyleBackColor = true;
+ this.Replace.Click += new System.EventHandler(this.Replace_Click);
+ //
+ // ReplaceAll
+ //
+ this.ReplaceAll.Location = new System.Drawing.Point(168, 208);
+ this.ReplaceAll.Name = "ReplaceAll";
+ this.ReplaceAll.Size = new System.Drawing.Size(75, 23);
+ this.ReplaceAll.TabIndex = 8;
+ this.ReplaceAll.Text = "Replace All";
+ this.ReplaceAll.UseVisualStyleBackColor = true;
+ this.ReplaceAll.Click += new System.EventHandler(this.ReplaceAll_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(24, 216);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(0, 13);
+ this.label1.TabIndex = 6;
+ //
+ // FindWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(256, 238);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.ReplaceAll);
+ this.Controls.Add(this.Replace);
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.FindNext);
+ this.Controls.Add(this.groupBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.KeyPreview = true;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "FindWindow";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = " Find";
+ this.TopMost = true;
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindWindow_FormClosing);
+ this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FindWindow_KeyDown);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox3.ResumeLayout(false);
+ this.groupBox3.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.ComboBox comboBoxFind;
+ private System.Windows.Forms.Button FindNext;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.ComboBox comboBoxReplace;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.CheckBox checkBoxMatchCase;
+ private System.Windows.Forms.Button Replace;
+ private System.Windows.Forms.Button ReplaceAll;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.CheckBox checkBoxWholeWord;
+ private System.Windows.Forms.CheckBox checkBoxReverse;
+ }
}
\ No newline at end of file
diff --git a/trunk/FindWindow.cs b/source/FindWindow.cs
similarity index 96%
rename from trunk/FindWindow.cs
rename to source/FindWindow.cs
index 33420d5..b69594e 100644
--- a/trunk/FindWindow.cs
+++ b/source/FindWindow.cs
@@ -1,289 +1,289 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Text; // StringBuilder
-using System.Text.RegularExpressions;
-using System.Windows.Forms;
-
-namespace LSLEditor
-{
- public partial class FindWindow : Form
- {
- private LSLEditorForm lslEditForm;
- private int intStart;
- private int intEnd;
-
- private bool m_ReplaceAlso;
-
- public FindWindow(LSLEditorForm lslEditForm)
- {
- InitializeComponent();
- this.lslEditForm = lslEditForm;
- this.intStart = 0;
- this.intEnd = 0;
- }
-
- public bool ReplaceAlso
- {
- get
- {
- return m_ReplaceAlso;
- }
- set
- {
- m_ReplaceAlso = value;
- this.groupBox2.Enabled = m_ReplaceAlso;
- this.Replace.Enabled = m_ReplaceAlso;
- this.ReplaceAll.Enabled = m_ReplaceAlso;
-
- if (m_ReplaceAlso)
- this.Text = "Find and Replace";
- else
- this.Text = "Find";
- }
- }
-
- public string KeyWord
- {
- set
- {
- this.label1.Text = ""; // clear out message
- if (value != "") {
- this.comboBoxFind.Text = value;
- } else {
- if (this.comboBoxFind.Items.Count > 0) {
- this.comboBoxFind.SelectedIndex = this.comboBoxFind.Items.Count - 1;
- }
- }
- }
- }
-
- private bool UpdateComboBox(ComboBox comboBox)
- {
- string strText = comboBox.Text;
- bool Found = false;
-
- foreach (string strC in comboBox.Items) {
- if (strC == strText) {
- Found = true;
- break;
- }
- }
-
- if (!Found) {
- comboBox.Items.Add(strText);
- }
- return Found;
- }
-
- public void Find()
- {
- this.label1.Text = "";
- EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
- if (editForm != null) {
- if (!UpdateComboBox(this.comboBoxFind)) {
- editForm.TextBox.SelectionLength = 0;
- editForm.TextBox.SelectionStart = 0;
- }
-
- RichTextBoxFinds options = RichTextBoxFinds.None;
-
- if (this.checkBoxMatchCase.Checked) options |= RichTextBoxFinds.MatchCase;
- if (this.checkBoxReverse.Checked) options |= RichTextBoxFinds.Reverse;
- if (this.checkBoxWholeWord.Checked) options |= RichTextBoxFinds.WholeWord;
-
- if (this.checkBoxReverse.Checked) {
- intStart = 0; // start cant change ;-)
- intEnd = editForm.TextBox.SelectionStart;
- } else {
- intStart = editForm.TextBox.SelectionStart + editForm.TextBox.SelectionLength;
- if (intStart == editForm.TextBox.Text.Length) {
- intStart = 0;
- }
- intEnd = editForm.TextBox.Text.Length - 1; // length can change!!
- }
-
- string strFind = this.comboBoxFind.Text;
- int intIndex = editForm.Find(strFind, intStart, intEnd, options);
- if (intIndex < 0) {
- this.label1.Text = "Not found...";
- return;
- }
- }
- }
-
- private void FindNext_Click(object sender, EventArgs e)
- {
- Find();
- this.Focus();
- }
-
- private void comboBoxFind_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Return) {
- if (this.Replace.Enabled) {
- this.comboBoxReplace.Focus();
- e.SuppressKeyPress = true;
- } else {
- Find();
- e.SuppressKeyPress = true;
- }
- }
- }
-
- private void Replace_Click(object sender, EventArgs e)
- {
- EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
- if (editForm != null) {
- UpdateComboBox(this.comboBoxReplace);
-
- if (editForm.TextBox.SelectionLength > 0) {
- string strReplacement = this.comboBoxReplace.Text;
- editForm.TextBox.ReplaceSelectedText(strReplacement);
- }
-
- Find();
- this.Focus();
- }
- }
-
- // WildCardToRegex not used!!
- private string WildCardToRegex(string strWildCard)
- {
- StringBuilder sb = new StringBuilder(strWildCard.Length + 8);
- for (int intI = 0; intI < strWildCard.Length; intI++) {
- char chrC = strWildCard[intI];
- switch (chrC) {
- case '*':
- sb.Append(".*");
- break;
- case '?':
- sb.Append(".");
- break;
- case '\\':
- intI++;
- if (intI < strWildCard.Length)
- sb.Append(Regex.Escape(strWildCard[intI].ToString()));
- break;
- default:
- sb.Append(Regex.Escape(chrC.ToString()));
- break;
- }
- }
- return sb.ToString();
- }
-
- private void ReplaceAll_Click(object sender, EventArgs e)
- {
- EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
- if (editForm == null) {
- UpdateComboBox(this.comboBoxReplace);
-
- string strPattern;
- string strFind = Regex.Escape(this.comboBoxFind.Text);
- string strReplacement = this.comboBoxReplace.Text;
- string strSourceCode = editForm.SourceCode;
-
- RegexOptions regexOptions = RegexOptions.Compiled;
- if (!this.checkBoxMatchCase.Checked) {
- regexOptions |= RegexOptions.IgnoreCase;
- }
- if (this.checkBoxWholeWord.Checked) {
- strPattern = @"\b" + strFind + @"\b";
- } else {
- strPattern = strFind;
- }
-
- Regex regex = new Regex(strPattern, regexOptions);
-
- int intCount = 0;
- foreach (Match m in regex.Matches(strSourceCode)) {
- if (m.Value.Length > 0) {
- intCount++;
- }
- }
- if (intCount == 0) {
- MessageBox.Show("No matches found");
- } else {
- if (MessageBox.Show("There are " + intCount + " occurences, replace them all?", "Find and Replace", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) {
- editForm.SourceCode = regex.Replace(strSourceCode, strReplacement);
- }
- }
- this.Focus();
- }
- }
-
- private void FindWindow_FormClosing(object sender, FormClosingEventArgs e)
- {
- lslEditForm.TopMost = true; // 15 nove 2007
- this.Visible = false;
- e.Cancel = true;
- lslEditForm.TopMost = false;// 15 nove 2007
- }
-
- private void FindWindow_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyData == Keys.Escape) {
- this.Visible = false;
- e.SuppressKeyPress = true;
- e.Handled = true;
- }
-
- if (e.KeyCode == Keys.Return) {
- Find();
- e.SuppressKeyPress = true;
- this.Focus();
- }
-
- if (e.KeyCode == Keys.F3) {
- Find();
- e.SuppressKeyPress = true;
- this.Focus();
- }
-
-
- }
-
- public void FindFocus()
- {
- this.comboBoxFind.Focus();
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Text; // StringBuilder
+using System.Text.RegularExpressions;
+using System.Windows.Forms;
+
+namespace LSLEditor
+{
+ public partial class FindWindow : Form
+ {
+ private LSLEditorForm lslEditForm;
+ private int intStart;
+ private int intEnd;
+
+ private bool m_ReplaceAlso;
+
+ public FindWindow(LSLEditorForm lslEditForm)
+ {
+ InitializeComponent();
+ this.lslEditForm = lslEditForm;
+ this.intStart = 0;
+ this.intEnd = 0;
+ }
+
+ public bool ReplaceAlso
+ {
+ get
+ {
+ return m_ReplaceAlso;
+ }
+ set
+ {
+ m_ReplaceAlso = value;
+ this.groupBox2.Enabled = m_ReplaceAlso;
+ this.Replace.Enabled = m_ReplaceAlso;
+ this.ReplaceAll.Enabled = m_ReplaceAlso;
+
+ if (m_ReplaceAlso)
+ this.Text = "Find and Replace";
+ else
+ this.Text = "Find";
+ }
+ }
+
+ public string KeyWord
+ {
+ set
+ {
+ this.label1.Text = ""; // clear out message
+ if (value != "") {
+ this.comboBoxFind.Text = value;
+ } else {
+ if (this.comboBoxFind.Items.Count > 0) {
+ this.comboBoxFind.SelectedIndex = this.comboBoxFind.Items.Count - 1;
+ }
+ }
+ }
+ }
+
+ private bool UpdateComboBox(ComboBox comboBox)
+ {
+ string strText = comboBox.Text;
+ bool Found = false;
+
+ foreach (string strC in comboBox.Items) {
+ if (strC == strText) {
+ Found = true;
+ break;
+ }
+ }
+
+ if (!Found) {
+ comboBox.Items.Add(strText);
+ }
+ return Found;
+ }
+
+ public void Find()
+ {
+ this.label1.Text = "";
+ EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
+ if (editForm != null) {
+ if (!UpdateComboBox(this.comboBoxFind)) {
+ editForm.TextBox.SelectionLength = 0;
+ editForm.TextBox.SelectionStart = 0;
+ }
+
+ RichTextBoxFinds options = RichTextBoxFinds.None;
+
+ if (this.checkBoxMatchCase.Checked) options |= RichTextBoxFinds.MatchCase;
+ if (this.checkBoxReverse.Checked) options |= RichTextBoxFinds.Reverse;
+ if (this.checkBoxWholeWord.Checked) options |= RichTextBoxFinds.WholeWord;
+
+ if (this.checkBoxReverse.Checked) {
+ intStart = 0; // start cant change ;-)
+ intEnd = editForm.TextBox.SelectionStart;
+ } else {
+ intStart = editForm.TextBox.SelectionStart + editForm.TextBox.SelectionLength;
+ if (intStart == editForm.TextBox.Text.Length) {
+ intStart = 0;
+ }
+ intEnd = editForm.TextBox.Text.Length - 1; // length can change!!
+ }
+
+ string strFind = this.comboBoxFind.Text;
+ int intIndex = editForm.Find(strFind, intStart, intEnd, options);
+ if (intIndex < 0) {
+ this.label1.Text = "Not found...";
+ return;
+ }
+ }
+ }
+
+ private void FindNext_Click(object sender, EventArgs e)
+ {
+ Find();
+ this.Focus();
+ }
+
+ private void comboBoxFind_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Return) {
+ if (this.Replace.Enabled) {
+ this.comboBoxReplace.Focus();
+ e.SuppressKeyPress = true;
+ } else {
+ Find();
+ e.SuppressKeyPress = true;
+ }
+ }
+ }
+
+ private void Replace_Click(object sender, EventArgs e)
+ {
+ EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
+ if (editForm != null) {
+ UpdateComboBox(this.comboBoxReplace);
+
+ if (editForm.TextBox.SelectionLength > 0) {
+ string strReplacement = this.comboBoxReplace.Text;
+ editForm.TextBox.ReplaceSelectedText(strReplacement);
+ }
+
+ Find();
+ this.Focus();
+ }
+ }
+
+ // WildCardToRegex not used!!
+ private string WildCardToRegex(string strWildCard)
+ {
+ StringBuilder sb = new StringBuilder(strWildCard.Length + 8);
+ for (int intI = 0; intI < strWildCard.Length; intI++) {
+ char chrC = strWildCard[intI];
+ switch (chrC) {
+ case '*':
+ sb.Append(".*");
+ break;
+ case '?':
+ sb.Append(".");
+ break;
+ case '\\':
+ intI++;
+ if (intI < strWildCard.Length)
+ sb.Append(Regex.Escape(strWildCard[intI].ToString()));
+ break;
+ default:
+ sb.Append(Regex.Escape(chrC.ToString()));
+ break;
+ }
+ }
+ return sb.ToString();
+ }
+
+ private void ReplaceAll_Click(object sender, EventArgs e)
+ {
+ EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
+ if (editForm == null) {
+ UpdateComboBox(this.comboBoxReplace);
+
+ string strPattern;
+ string strFind = Regex.Escape(this.comboBoxFind.Text);
+ string strReplacement = this.comboBoxReplace.Text;
+ string strSourceCode = editForm.SourceCode;
+
+ RegexOptions regexOptions = RegexOptions.Compiled;
+ if (!this.checkBoxMatchCase.Checked) {
+ regexOptions |= RegexOptions.IgnoreCase;
+ }
+ if (this.checkBoxWholeWord.Checked) {
+ strPattern = @"\b" + strFind + @"\b";
+ } else {
+ strPattern = strFind;
+ }
+
+ Regex regex = new Regex(strPattern, regexOptions);
+
+ int intCount = 0;
+ foreach (Match m in regex.Matches(strSourceCode)) {
+ if (m.Value.Length > 0) {
+ intCount++;
+ }
+ }
+ if (intCount == 0) {
+ MessageBox.Show("No matches found");
+ } else {
+ if (MessageBox.Show("There are " + intCount + " occurences, replace them all?", "Find and Replace", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) {
+ editForm.SourceCode = regex.Replace(strSourceCode, strReplacement);
+ }
+ }
+ this.Focus();
+ }
+ }
+
+ private void FindWindow_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ lslEditForm.TopMost = true; // 15 nove 2007
+ this.Visible = false;
+ e.Cancel = true;
+ lslEditForm.TopMost = false;// 15 nove 2007
+ }
+
+ private void FindWindow_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyData == Keys.Escape) {
+ this.Visible = false;
+ e.SuppressKeyPress = true;
+ e.Handled = true;
+ }
+
+ if (e.KeyCode == Keys.Return) {
+ Find();
+ e.SuppressKeyPress = true;
+ this.Focus();
+ }
+
+ if (e.KeyCode == Keys.F3) {
+ Find();
+ e.SuppressKeyPress = true;
+ this.Focus();
+ }
+
+
+ }
+
+ public void FindFocus()
+ {
+ this.comboBoxFind.Focus();
+ }
+ }
+}
diff --git a/trunk/FindWindow.resx b/source/FindWindow.resx
similarity index 97%
rename from trunk/FindWindow.resx
rename to source/FindWindow.resx
index ff31a6d..19dc0dd 100644
--- a/trunk/FindWindow.resx
+++ b/source/FindWindow.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/trunk/Form1.cs b/source/Form1.cs
similarity index 97%
rename from trunk/Form1.cs
rename to source/Form1.cs
index bb942b3..acba0e4 100644
--- a/trunk/Form1.cs
+++ b/source/Form1.cs
@@ -1,1109 +1,1109 @@
-using System;
-using System.IO;
-using System.Drawing;
-using System.Drawing.Imaging;
-
-using System.Collections;
-
-using Microsoft.Win32;
-using System.Threading;
-using System.Reflection;
-using System.Globalization;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Drawing.Printing;
-
-
-// aximp is oude informatie, maar ik laat het er even instaan
-// aximp %WINDIR%\System32\shdocvw.dll /out:"d:\temp\AxInterop.SHDocVw.dll" /keyfile:"D:\Documents and Settings\Administrator\Mijn documenten\Mijn keys\Test.snk"
-// copieer de TWEE files AxInterop.SHDocVw.dll en SHDocVw.dll in de bin/Debug directory
-// referentie maken naar die twee files
-
-//
-// Pre build command for using a LSLEditor.rc file containing: About.htm HTML "Resource/About.htm"
-//
-// "$(DevEnvDir)..\..\SDK\v2.0\bin\rc.exe" /r "$(ProjectDir)$(TargetName).rc"
-//
-// Project properties Application, resource file
-
-namespace LSLEditor
-{
- ///
- /// Summary description for Form1.
- ///
- public class Form1 : System.Windows.Forms.Form
- {
- private System.Windows.Forms.OpenFileDialog openFileDialog1;
- private System.Windows.Forms.SaveFileDialog saveFileDialog1;
- private System.Windows.Forms.Panel panel1;
- private System.ComponentModel.IContainer components = null;
- private Compiler compiler;
- private bool FullDebug;
- private System.Windows.Forms.TabControl tabControl1;
- private System.Windows.Forms.ContextMenu contextMenu1;
-
- private System.Windows.Forms.MainMenu mainMenu1;
- private System.Windows.Forms.MenuItem menuItem1;
- private System.Windows.Forms.MenuItem menuItem2;
- private System.Windows.Forms.MenuItem menuItem3;
- private System.Windows.Forms.MenuItem menuItem4;
- private System.Windows.Forms.MenuItem menuItem5;
- private System.Windows.Forms.MenuItem menuItem6;
- private System.Windows.Forms.MenuItem menuItem7;
- private System.Windows.Forms.MenuItem menuItem8;
- private System.Windows.Forms.MenuItem menuItem9;
- private System.Windows.Forms.MenuItem menuItem10;
- private System.Windows.Forms.MenuItem menuItem11;
- private System.Windows.Forms.MenuItem menuItem12;
- private System.Windows.Forms.MenuItem menuItem13;
- private System.Windows.Forms.MenuItem menuItem14;
- private System.Windows.Forms.MenuItem menuItem15;
- private System.Windows.Forms.MenuItem menuItem16;
- private System.Windows.Forms.MenuItem menuItem17;
- private System.Windows.Forms.MenuItem menuItem18;
- private System.Windows.Forms.MenuItem menuItem19;
- private System.Windows.Forms.MenuItem menuItem20;
- private System.Windows.Forms.MenuItem menuItem21;
- private System.Windows.Forms.MenuItem menuItem22;
- private System.Windows.Forms.MenuItem menuItem23;
- private System.Windows.Forms.MenuItem menuItem24;
- private System.Windows.Forms.MenuItem menuItem25;
- private System.Windows.Forms.MenuItem menuItem26;
- private System.Windows.Forms.MenuItem menuItem27;
- private System.Windows.Forms.MenuItem menuItem28;
- private System.Windows.Forms.MenuItem menuItem29;
- private System.Windows.Forms.MenuItem menuItem30;
- private System.Windows.Forms.MenuItem menuItem31;
- private System.Windows.Forms.MenuItem menuItem32;
- private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
- private System.Windows.Forms.PrintDialog printDialog1;
- private System.Windows.Forms.MenuItem menuItem34;
- private System.Windows.Forms.MenuItem menuItem35;
- private System.Windows.Forms.MenuItem menuItem36;
- private TabPage tabPage1;
- private NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1;
- private MenuItem menuItem37;
- private MenuItem menuItem38;
- private MenuItem menuItem39;
- private MenuItem menuItem41;
- private MenuItem menuItem40;
- private MenuItem menuItem42;
- private MenuItem menuItemUploadScript;
- private StatusStrip statusStrip1;
- private ToolStripStatusLabel toolStripStatusLabel1;
- private System.Windows.Forms.MenuItem menuItem33;
-
- public Form1(string[] args)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- Start(args);
- }
-
-
-
- ///
- /// Clean up any resources being used.
- ///
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
- this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
- this.menuItem1 = new System.Windows.Forms.MenuItem();
- this.menuItem11 = new System.Windows.Forms.MenuItem();
- this.menuItem4 = new System.Windows.Forms.MenuItem();
- this.menuItem41 = new System.Windows.Forms.MenuItem();
- this.menuItem40 = new System.Windows.Forms.MenuItem();
- this.menuItem42 = new System.Windows.Forms.MenuItem();
- this.menuItemUploadScript = new System.Windows.Forms.MenuItem();
- this.menuItem15 = new System.Windows.Forms.MenuItem();
- this.menuItem13 = new System.Windows.Forms.MenuItem();
- this.menuItem5 = new System.Windows.Forms.MenuItem();
- this.menuItem7 = new System.Windows.Forms.MenuItem();
- this.menuItem35 = new System.Windows.Forms.MenuItem();
- this.menuItem34 = new System.Windows.Forms.MenuItem();
- this.menuItem36 = new System.Windows.Forms.MenuItem();
- this.menuItem31 = new System.Windows.Forms.MenuItem();
- this.menuItem32 = new System.Windows.Forms.MenuItem();
- this.menuItem6 = new System.Windows.Forms.MenuItem();
- this.menuItem8 = new System.Windows.Forms.MenuItem();
- this.menuItem24 = new System.Windows.Forms.MenuItem();
- this.menuItem23 = new System.Windows.Forms.MenuItem();
- this.menuItem25 = new System.Windows.Forms.MenuItem();
- this.menuItem22 = new System.Windows.Forms.MenuItem();
- this.menuItem21 = new System.Windows.Forms.MenuItem();
- this.menuItem20 = new System.Windows.Forms.MenuItem();
- this.menuItem26 = new System.Windows.Forms.MenuItem();
- this.menuItem28 = new System.Windows.Forms.MenuItem();
- this.menuItem27 = new System.Windows.Forms.MenuItem();
- this.menuItem37 = new System.Windows.Forms.MenuItem();
- this.menuItem38 = new System.Windows.Forms.MenuItem();
- this.menuItem39 = new System.Windows.Forms.MenuItem();
- this.menuItem9 = new System.Windows.Forms.MenuItem();
- this.menuItem12 = new System.Windows.Forms.MenuItem();
- this.menuItem14 = new System.Windows.Forms.MenuItem();
- this.menuItem33 = new System.Windows.Forms.MenuItem();
- this.menuItem29 = new System.Windows.Forms.MenuItem();
- this.menuItem30 = new System.Windows.Forms.MenuItem();
- this.menuItem2 = new System.Windows.Forms.MenuItem();
- this.menuItem16 = new System.Windows.Forms.MenuItem();
- this.menuItem17 = new System.Windows.Forms.MenuItem();
- this.menuItem18 = new System.Windows.Forms.MenuItem();
- this.menuItem19 = new System.Windows.Forms.MenuItem();
- this.menuItem3 = new System.Windows.Forms.MenuItem();
- this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
- this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
- this.panel1 = new System.Windows.Forms.Panel();
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
- this.contextMenu1 = new System.Windows.Forms.ContextMenu();
- this.menuItem10 = new System.Windows.Forms.MenuItem();
- this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
- this.printDialog1 = new System.Windows.Forms.PrintDialog();
- this.numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
- this.panel1.SuspendLayout();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.statusStrip1.SuspendLayout();
- this.SuspendLayout();
- //
- // mainMenu1
- //
- this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem1,
- this.menuItem8,
- this.menuItem12,
- this.menuItem2});
- //
- // menuItem1
- //
- this.menuItem1.Index = 0;
- this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem11,
- this.menuItem4,
- this.menuItem41,
- this.menuItem40,
- this.menuItem42,
- this.menuItemUploadScript,
- this.menuItem15,
- this.menuItem13,
- this.menuItem5,
- this.menuItem7,
- this.menuItem35,
- this.menuItem34,
- this.menuItem36,
- this.menuItem31,
- this.menuItem32,
- this.menuItem6});
- this.menuItem1.Text = "File";
- //
- // menuItem11
- //
- this.menuItem11.Index = 0;
- this.menuItem11.Text = "New";
- this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
- //
- // menuItem4
- //
- this.menuItem4.Index = 1;
- this.menuItem4.Text = "Open...";
- this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
- //
- // menuItem41
- //
- this.menuItem41.Index = 2;
- this.menuItem41.Text = "-";
- //
- // menuItem40
- //
- this.menuItem40.Index = 3;
- this.menuItem40.Text = "Import Example...";
- this.menuItem40.Click += new System.EventHandler(this.menuItem40_Click);
- //
- // menuItem42
- //
- this.menuItem42.Index = 4;
- this.menuItem42.Text = "-";
- //
- // menuItemUploadScript
- //
- this.menuItemUploadScript.Enabled = false;
- this.menuItemUploadScript.Index = 5;
- this.menuItemUploadScript.Text = "Upload Your LSL script...";
- this.menuItemUploadScript.Click += new System.EventHandler(this.menuItemUploadScript_Click);
- //
- // menuItem15
- //
- this.menuItem15.Index = 6;
- this.menuItem15.Text = "-";
- //
- // menuItem13
- //
- this.menuItem13.Index = 7;
- this.menuItem13.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
- this.menuItem13.Text = "Save";
- this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
- //
- // menuItem5
- //
- this.menuItem5.Index = 8;
- this.menuItem5.Text = "Save...";
- this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
- //
- // menuItem7
- //
- this.menuItem7.Index = 9;
- this.menuItem7.Text = "-";
- //
- // menuItem35
- //
- this.menuItem35.Index = 10;
- this.menuItem35.Text = "Page Setup...";
- this.menuItem35.Click += new System.EventHandler(this.menuItem35_Click);
- //
- // menuItem34
- //
- this.menuItem34.Index = 11;
- this.menuItem34.Shortcut = System.Windows.Forms.Shortcut.CtrlP;
- this.menuItem34.Text = "Print";
- this.menuItem34.Click += new System.EventHandler(this.menuItem34_Click);
- //
- // menuItem36
- //
- this.menuItem36.Index = 12;
- this.menuItem36.Text = "-";
- //
- // menuItem31
- //
- this.menuItem31.Index = 13;
- this.menuItem31.Text = "Copy to clipboard";
- this.menuItem31.Click += new System.EventHandler(this.menuItem31_Click);
- //
- // menuItem32
- //
- this.menuItem32.Index = 14;
- this.menuItem32.Text = "-";
- //
- // menuItem6
- //
- this.menuItem6.Index = 15;
- this.menuItem6.Text = "Exit";
- this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
- //
- // menuItem8
- //
- this.menuItem8.Index = 1;
- this.menuItem8.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem24,
- this.menuItem23,
- this.menuItem25,
- this.menuItem22,
- this.menuItem21,
- this.menuItem20,
- this.menuItem26,
- this.menuItem28,
- this.menuItem27,
- this.menuItem37,
- this.menuItem9});
- this.menuItem8.Text = "Edit";
- //
- // menuItem24
- //
- this.menuItem24.Index = 0;
- this.menuItem24.Shortcut = System.Windows.Forms.Shortcut.CtrlZ;
- this.menuItem24.Text = "Undo";
- this.menuItem24.Click += new System.EventHandler(this.menuItem24_Click);
- //
- // menuItem23
- //
- this.menuItem23.Enabled = false;
- this.menuItem23.Index = 1;
- this.menuItem23.Shortcut = System.Windows.Forms.Shortcut.CtrlY;
- this.menuItem23.Text = "Redo";
- this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
- //
- // menuItem25
- //
- this.menuItem25.Index = 2;
- this.menuItem25.Text = "-";
- //
- // menuItem22
- //
- this.menuItem22.Index = 3;
- this.menuItem22.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
- this.menuItem22.Text = "Cut";
- this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
- //
- // menuItem21
- //
- this.menuItem21.Index = 4;
- this.menuItem21.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
- this.menuItem21.Text = "Copy";
- this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
- //
- // menuItem20
- //
- this.menuItem20.Index = 5;
- this.menuItem20.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
- this.menuItem20.Text = "Paste";
- this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
- //
- // menuItem26
- //
- this.menuItem26.Index = 6;
- this.menuItem26.Shortcut = System.Windows.Forms.Shortcut.Del;
- this.menuItem26.Text = "Delete";
- this.menuItem26.Click += new System.EventHandler(this.menuItem26_Click);
- //
- // menuItem28
- //
- this.menuItem28.Index = 7;
- this.menuItem28.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
- this.menuItem28.Text = "Select All";
- this.menuItem28.Click += new System.EventHandler(this.menuItem28_Click);
- //
- // menuItem27
- //
- this.menuItem27.Index = 8;
- this.menuItem27.Text = "-";
- //
- // menuItem37
- //
- this.menuItem37.Index = 9;
- this.menuItem37.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem38,
- this.menuItem39});
- this.menuItem37.Text = "Advanced";
- //
- // menuItem38
- //
- this.menuItem38.Index = 0;
- this.menuItem38.Text = "Format Document";
- this.menuItem38.Click += new System.EventHandler(this.menuItem38_Click);
- //
- // menuItem39
- //
- this.menuItem39.Enabled = false;
- this.menuItem39.Index = 1;
- this.menuItem39.Text = "Format Selection";
- this.menuItem39.Click += new System.EventHandler(this.menuItem39_Click);
- //
- // menuItem9
- //
- this.menuItem9.Enabled = false;
- this.menuItem9.Index = 10;
- this.menuItem9.Text = "Word wrap";
- this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
- //
- // menuItem12
- //
- this.menuItem12.Index = 2;
- this.menuItem12.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem14,
- this.menuItem33,
- this.menuItem29,
- this.menuItem30});
- this.menuItem12.Text = "Compiler";
- //
- // menuItem14
- //
- this.menuItem14.Index = 0;
- this.menuItem14.Shortcut = System.Windows.Forms.Shortcut.F5;
- this.menuItem14.Text = "Start";
- this.menuItem14.Click += new System.EventHandler(this.menuItem14_Click);
- //
- // menuItem33
- //
- this.menuItem33.Index = 1;
- this.menuItem33.Text = "Compiler Window";
- this.menuItem33.Click += new System.EventHandler(this.menuItem33_Click);
- //
- // menuItem29
- //
- this.menuItem29.Index = 2;
- this.menuItem29.Text = "-";
- //
- // menuItem30
- //
- this.menuItem30.Index = 3;
- this.menuItem30.Text = "Properties...";
- this.menuItem30.Click += new System.EventHandler(this.menuItem30_Click);
- //
- // menuItem2
- //
- this.menuItem2.Index = 3;
- this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem16,
- this.menuItem17,
- this.menuItem18,
- this.menuItem19,
- this.menuItem3});
- this.menuItem2.Text = "Help";
- //
- // menuItem16
- //
- this.menuItem16.Index = 0;
- this.menuItem16.Shortcut = System.Windows.Forms.Shortcut.F1;
- this.menuItem16.Text = "Index...";
- this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click);
- //
- // menuItem17
- //
- this.menuItem17.Index = 1;
- this.menuItem17.Text = "-";
- //
- // menuItem18
- //
- this.menuItem18.Index = 2;
- this.menuItem18.Text = "Check for Updates";
- this.menuItem18.Click += new System.EventHandler(this.menuItem18_Click);
- //
- // menuItem19
- //
- this.menuItem19.Index = 3;
- this.menuItem19.Text = "-";
- //
- // menuItem3
- //
- this.menuItem3.Index = 4;
- this.menuItem3.Text = "About...";
- this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
- //
- // panel1
- //
- this.panel1.Controls.Add(this.tabControl1);
- this.panel1.Controls.Add(this.statusStrip1);
- this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(592, 353);
- this.panel1.TabIndex = 2;
- //
- // tabControl1
- //
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl1.Location = new System.Drawing.Point(0, 0);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(592, 331);
- this.tabControl1.TabIndex = 1;
- this.tabControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseDown);
- //
- // tabPage1
- //
- this.tabPage1.BackColor = System.Drawing.Color.Transparent;
- this.tabPage1.Controls.Add(this.numberedTextBoxUC1);
- this.tabPage1.Location = new System.Drawing.Point(4, 22);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(584, 305);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "New";
- this.tabPage1.UseVisualStyleBackColor = true;
- //
- // statusStrip1
- //
- this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.toolStripStatusLabel1});
- this.statusStrip1.Location = new System.Drawing.Point(0, 331);
- this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(592, 22);
- this.statusStrip1.TabIndex = 2;
- this.statusStrip1.Text = "statusStrip1";
- //
- // toolStripStatusLabel1
- //
- this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
- this.toolStripStatusLabel1.Size = new System.Drawing.Size(19, 17);
- this.toolStripStatusLabel1.Text = "...";
- //
- // contextMenu1
- //
- this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem10});
- //
- // menuItem10
- //
- this.menuItem10.Index = 0;
- this.menuItem10.Text = "Close";
- this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
- //
- // numberedTextBoxUC1
- //
- this.numberedTextBoxUC1.BackColor = System.Drawing.SystemColors.Control;
- this.numberedTextBoxUC1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.numberedTextBoxUC1.Location = new System.Drawing.Point(3, 3);
- this.numberedTextBoxUC1.Name = "numberedTextBoxUC1";
- this.numberedTextBoxUC1.Size = new System.Drawing.Size(578, 299);
- this.numberedTextBoxUC1.TabIndex = 1;
- //
- // Form1
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(592, 353);
- this.Controls.Add(this.panel1);
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.IsMdiContainer = true;
- this.Menu = this.mainMenu1;
- this.Name = "Form1";
- this.Text = "LSL-Editor";
- this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
- this.Load += new System.EventHandler(this.Form1_Load);
- this.panel1.ResumeLayout(false);
- this.panel1.PerformLayout();
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.statusStrip1.ResumeLayout(false);
- this.statusStrip1.PerformLayout();
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void Start(string[] args)
- {
- this.FullDebug = true;
-
- Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
- Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", false);
-
- string strVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
- this.Text += " " + strVersion;
-
- // load the keywords and colors, give handle to codecompletion listBox
- this.numberedTextBoxUC1.TextBox.Init("ConfLSL.xml");
-
- if (args.Length == 0)
- {
- this.numberedTextBoxUC1.TextBox.GetExampleFile();
- this.saveFileDialog1.FileName = "new.lsl";
- this.menuItem13.Text = "Save new.lsl";
- this.menuItem13.Enabled = false;
- }
- else
- {
- this.numberedTextBoxUC1.TextBox.LoadFile(args[0]);
- this.tabControl1.TabPages[0].Text = Path.GetFileName(args[0]);
- this.menuItem13.Text = "Save " + Path.GetFileName(args[0]);
- this.menuItem13.Enabled = true;
- this.saveFileDialog1.FileName = args[0];
- }
- this.numberedTextBoxUC1.TextBox.ToolTipping = true;
- this.numberedTextBoxUC1.TextBox.isDirty = false;
- }
-
- // close application
- private void menuItem6_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
-
- // reading file
- private void menuItem4_Click(object sender, System.EventArgs e)
- {
- if (this.numberedTextBoxUC1.TextBox.isDirty)
- {
- DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.tabControl1.TabPages[0].Text + @"""?", "cap", MessageBoxButtons.YesNoCancel);
- if (dialogResult == DialogResult.Yes)
- dialogResult = SaveCurrentFile();
- if (dialogResult == DialogResult.Cancel)
- return;
- }
- this.openFileDialog1.Filter = "Secondlife script files (*.lsl)|*.lsl|All files (*.*)|*.*";
- if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- if (File.Exists(this.openFileDialog1.FileName))
- {
- this.numberedTextBoxUC1.TextBox.LoadFile(this.openFileDialog1.FileName);
- this.numberedTextBoxUC1.TextBox.isDirty = false;
- this.saveFileDialog1.FileName = this.openFileDialog1.FileName;
- this.tabControl1.TabPages[0].Text = Path.GetFileName(this.openFileDialog1.FileName);
-
- this.menuItem13.Text = "Save " + Path.GetFileName(this.openFileDialog1.FileName);
- this.menuItem13.Enabled = true;
- this.saveFileDialog1.FileName = this.openFileDialog1.FileName;
- }
- }
- }
-
- // save current file
- private DialogResult SaveCurrentFile()
- {
- this.saveFileDialog1.Filter = "Secondlife script files (*.lsl)|*.lsl|All files (*.*)|*.*";
- DialogResult dialogresult = this.saveFileDialog1.ShowDialog();
- if (dialogresult == DialogResult.OK)
- {
- this.numberedTextBoxUC1.TextBox.SaveFile(this.saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
- this.tabControl1.TabPages[0].Text = Path.GetFileName(this.saveFileDialog1.FileName);
- this.menuItem13.Text = "Save " + Path.GetFileName(this.saveFileDialog1.FileName);
- this.menuItem13.Enabled = true;
- this.numberedTextBoxUC1.TextBox.isDirty = false;
- }
- return dialogresult;
- }
-
- private void menuItem5_Click(object sender, System.EventArgs e)
- {
- SaveCurrentFile();
- }
-
- // about
- private void menuItem3_Click(object sender, System.EventArgs e)
- {
- //About about = new About(this);
- //about.ShowDialog(this);
- }
-
- // toggle word wrap
- private void menuItem9_Click(object sender, System.EventArgs e)
- {
- this.menuItem9.Checked = !this.menuItem9.Checked;
- this.numberedTextBoxUC1.TextBox.WordWrap = (this.menuItem9.Checked);
- }
-
- private void StartCompiler()
- {
- compiler = new Compiler(this.FullDebug, "ConfLSL.xml", this.numberedTextBoxUC1.TextBox.Text);
- if (compiler.CompilerErrors != null)
- {
- MessageBox.Show(compiler.CompilerErrors, "compiler errors");
- return;
- }
-
- if (this.menuItem33.Checked)
- {
- compiler.ShowDialog(this);
- }
- else
- {
- TabPage tabPage = null;
- for (int intI = 0; intI < this.tabControl1.TabPages.Count; intI++)
- {
- if (this.tabControl1.TabPages[intI].Text == "Compiler")
- {
- tabPage = this.tabControl1.TabPages[intI];
- tabPage.Controls.Clear();
- this.tabControl1.SelectedIndex = intI;
- break;
- }
- }
- if (tabPage == null)
- {
- tabPage = new TabPage("Compiler");
- this.tabControl1.TabPages.Add(tabPage);
- this.tabControl1.SelectedIndex = this.tabControl1.TabCount - 1;
- }
- tabPage.Controls.Add(compiler.Controls[0]);
- }
- }
-
- // compiler
- private void menuItem14_Click(object sender, System.EventArgs e)
- {
- StartCompiler();
- }
-
- // Empty current script
- private void menuItem11_Click(object sender, System.EventArgs e)
- {
- this.tabControl1.TabPages[0].Text = "New";
- this.saveFileDialog1.FileName = "new.lsl";
- this.menuItem13.Text = "Save new.lsl";
- this.menuItem13.Enabled = false;
- this.numberedTextBoxUC1.TextBox.Clear();
- this.numberedTextBoxUC1.TextBox.SelectionStart = 0;
- this.numberedTextBoxUC1.TextBox.SelectionLength = 0;
- this.numberedTextBoxUC1.TextBox.SelectionColor = Color.Black;
- this.numberedTextBoxUC1.TextBox.isDirty = false;
- }
-
- private void Form1_Load(object sender, System.EventArgs e)
- {
- try
- {
- RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"software\hwh\lsleditor");
- if (regKey != null)
- {
- this.Width = (int)regKey.GetValue("Width");
- this.Height = (int)regKey.GetValue("Height");
- this.Left = (int)regKey.GetValue("Left");
- this.Top = (int)regKey.GetValue("Top");
- this.numberedTextBoxUC1.TextBox.WordWrap = (regKey.GetValue("WordWrap").ToString() == "True");
- this.menuItem9.Checked = this.numberedTextBoxUC1.TextBox.WordWrap;
- this.menuItem33.Checked = (regKey.GetValue("CompilerInWindow").ToString() == "True");
- regKey.GetValue("Unknown").ToString();
- this.FullDebug = true;
- this.menuItemUploadScript.Enabled = true;
- }
- }
- catch
- {
- }
- //this.Activate();
- }
-
- private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- RegistryKey regKey = Registry.CurrentUser.CreateSubKey(@"software\hwh\lsleditor");
- if (regKey != null)
- {
- regKey.SetValue("Width", this.Width);
- regKey.SetValue("Height", this.Height);
- regKey.SetValue("Top", this.Top);
- regKey.SetValue("Left", this.Left);
- regKey.SetValue("WordWrap", this.numberedTextBoxUC1.TextBox.WordWrap);
- regKey.SetValue("CompilerInWindow", this.menuItem33.Checked);
- regKey.Flush();
- regKey.Close();
- }
- if (this.numberedTextBoxUC1.TextBox.isDirty)
- {
- DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.tabControl1.TabPages[0].Text + @"""?", "cap", MessageBoxButtons.YesNoCancel);
- if (dialogResult == DialogResult.Yes)
- dialogResult = SaveCurrentFile();
- e.Cancel = (dialogResult == DialogResult.Cancel);
- }
- }
-
- // F1
- private void ShowHelp()
- {
- string strKeyWord = this.numberedTextBoxUC1.TextBox.GetCurrentKeyWord(false);
-
- string strUrl = this.numberedTextBoxUC1.TextBox.HelpUrl + "wakka.php?wakka=" + strKeyWord;
-
- if (strKeyWord == "")
- strKeyWord = "Help";
-
- ShowWebBrowser(strKeyWord, strUrl);
- }
-
- // show context menu for tab headers
- private void tabControl1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- for (int intI = 1; intI < tabControl1.TabCount; intI++)
- {
- Rectangle rt = tabControl1.GetTabRect(intI);
- if (e.X > rt.Left && e.X < rt.Right
- && e.Y > rt.Top && e.Y < rt.Bottom)
- {
- this.contextMenu1.Show(this.tabControl1, new Point(e.X, e.Y));
- }
- }
- }
- }
-
- // close tab
- private void menuItem10_Click(object sender, System.EventArgs e)
- {
- if (this.tabControl1.SelectedIndex > 0)
- this.tabControl1.TabPages.RemoveAt(this.tabControl1.SelectedIndex);
- }
-
- private void menuItem13_Click(object sender, System.EventArgs e)
- {
- // save as current file
- this.numberedTextBoxUC1.TextBox.SaveFile(this.saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
- this.numberedTextBoxUC1.TextBox.isDirty = false;
- }
-
- private void menuItem16_Click(object sender, System.EventArgs e)
- {
- ShowHelp();
- }
-
- private void menuItem18_Click(object sender, System.EventArgs e)
- {
- ShowWebBrowser("Check for Updates", this.numberedTextBoxUC1.TextBox.UpdateUrl);
- }
-
- private void menuItem22_Click(object sender, System.EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.Cut();
- }
-
- private void menuItem21_Click(object sender, System.EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.Copy();
- }
-
- private void menuItem20_Click(object sender, System.EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.Paste();
- }
-
- private void menuItem26_Click(object sender, System.EventArgs e)
- {
- if (this.numberedTextBoxUC1.TextBox.SelectedText == "")
- this.numberedTextBoxUC1.TextBox.SelectionLength = 1;
- this.numberedTextBoxUC1.TextBox.SelectedText = "";
- }
-
- private void menuItem28_Click(object sender, System.EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.SelectAll();
- }
-
- private void menuItem24_Click(object sender, System.EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.UndoPlus();
- }
-
- private void menuItem23_Click(object sender, System.EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.Redo();
- }
-
- private void menuItem30_Click(object sender, System.EventArgs e)
- {
- SimProperties props = new SimProperties();
- props.Icon = this.Icon;
- props.ShowDialog(this);
- }
-
- private void menuItem31_Click(object sender, System.EventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.ToClipBoard();
- }
-
- private void menuItem33_Click(object sender, System.EventArgs e)
- {
- this.menuItem33.Checked = !this.menuItem33.Checked;
- }
-
- private void menuItem35_Click(object sender, System.EventArgs e)
- {
- PrintDocument docPrn = new PrintDocument();
- docPrn.DocumentName = this.saveFileDialog1.FileName;
- this.pageSetupDialog1.Document = docPrn;
- this.pageSetupDialog1.ShowDialog();
- }
-
- private void menuItem34_Click(object sender, System.EventArgs e)
- {
- this.printDialog1.AllowPrintToFile = true;
- PrintDocument docPrn = new PrintDocument();
- docPrn.DocumentName = this.saveFileDialog1.FileName;
- this.printDialog1.Document = docPrn;
- if (this.printDialog1.ShowDialog() == DialogResult.OK)
- {
- try
- {
- docPrn.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
- docPrn.Print();
- }
- catch
- {
- MessageBox.Show("Error While Printing", "Print Error");
- }
- }
- }
-
- private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
- {
- this.numberedTextBoxUC1.TextBox.Print(0, this.numberedTextBoxUC1.TextBox.Text.Length, e);
- }
-
- private void menuItem38_Click(object sender, EventArgs e)
- {
- // Format Document
- AutoFormatter autoFormatter = new AutoFormatter();
- this.numberedTextBoxUC1.TextBox.Text =
- autoFormatter.ApplyFormatting(this.numberedTextBoxUC1.TextBox.Text);
- }
-
- private void menuItem39_Click(object sender, EventArgs e)
- {
- // Format Selection
- AutoFormatter autoFormatter = new AutoFormatter();
- this.numberedTextBoxUC1.TextBox.SelectedText =
- autoFormatter.ApplyFormatting(this.numberedTextBoxUC1.TextBox.SelectedText);
- }
-
- private void menuItem40_Click(object sender, EventArgs e)
- {
- ShowWebBrowser("Import Examples", this.numberedTextBoxUC1.TextBox.ExamplesUrl);
- }
-
- private void ShowWebBrowser(string strTabName, string strUrl)
- {
- TabPage tabPage = new TabPage(strTabName);
-
- WebBrowser axWebBrowser1 = new WebBrowser();
- tabPage.Controls.Add(axWebBrowser1);
- this.tabControl1.TabPages.Add(tabPage);
- this.tabControl1.SelectedIndex = this.tabControl1.TabCount - 1;
-
- axWebBrowser1.Dock = DockStyle.Fill;
- axWebBrowser1.StatusTextChanged += new EventHandler(axWebBrowser1_StatusTextChanged);
- axWebBrowser1.Navigating += new WebBrowserNavigatingEventHandler(axWebBrowser1_Navigating);
- axWebBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(axWebBrowser1_DocumentCompleted);
- axWebBrowser1.Navigate(strUrl);
- }
-
- void axWebBrowser1_StatusTextChanged(object sender, EventArgs e)
- {
- WebBrowser axWebBrowser1 = sender as WebBrowser;
- this.toolStripStatusLabel1.Text = axWebBrowser1.StatusText;
- }
-
-
- void axWebBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
- {
- string strUrl = e.Url.ToString();
- if (strUrl.EndsWith(".lsl"))
- {
- e.Cancel = true;
- if (MessageBox.Show("Import LSL script?", "Import script", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
-
- WebBrowser axWebBrowser1 = sender as WebBrowser;
- axWebBrowser1.Stop();
-
- // download the url
- this.numberedTextBoxUC1.TextBox.LoadFile(strUrl);
- this.numberedTextBoxUC1.TextBox.isDirty = true;
-
- // Delete webbrowser?
- // axWebBrowser1.Dispose();
- // this.tabControl1.TabPages.RemoveAt(this.tabControl1.TabCount - 1);
-
- int intI = strUrl.LastIndexOf("/");
- if (intI > 0)
- {
- string strName = strUrl.Substring(intI + 1);
- this.tabControl1.TabPages[0].Text = strName;
- this.menuItem13.Text = "Save " + strName;
- this.menuItem13.Enabled = false;
- this.saveFileDialog1.FileName = strName;
- }
-
- this.tabControl1.SelectedIndex = 0;
- }
- }
-
- void axWebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
- {
- WebBrowser axWebBrowser1 = sender as WebBrowser;
- if (e.Url.ToString() == this.numberedTextBoxUC1.TextBox.UploadUrl)
- {
- HtmlElement element = axWebBrowser1.Document.GetElementById("SourceCode");
- if (element != null)
- {
- //if(element.InnerText.Trim()=="")
- element.InnerText = this.numberedTextBoxUC1.TextBox.Text;
-
- // Makepictures
- Size oldSize = this.Size;
- this.Size = new Size(640, 480);
-
- Bitmap bitmap;
- ImageManipulation.GetBitmapFromControl helper = new ImageManipulation.GetBitmapFromControl();
-
- this.tabControl1.SelectedIndex = 0;
- bitmap = helper.GetOctreeQuantizedBitmap(this, false);
- bitmap.Save(@"d:\temp\test1.gif", ImageFormat.Gif);
-
- element = axWebBrowser1.Document.GetElementById("File1");
- if (element != null)
- {
- element.SetAttribute("value", @"d:\temp\test1.gif");
- element.OuterHtml = @"";
- }
-
- if (this.tabControl1.TabPages[1].Text.Contains("Compiler"))
- {
- this.tabControl1.SelectedIndex = 1;
- bitmap = helper.GetOctreeQuantizedBitmap(this, false);
- bitmap.Save(@"d:\temp\test2.gif", ImageFormat.Gif);
-
- element = axWebBrowser1.Document.GetElementById("File2");
- if (element != null)
- element.SetAttribute("value", @"d:\temp\test2.gif");
- }
-
- this.tabControl1.SelectedIndex = this.tabControl1.TabPages.Count - 1;
- this.Size = oldSize;
- }
- }
- }
-
- private void UploadScript()
- {
- //ShowWebBrowser("Upload", this.numberedTextBoxUC1.TextBox.UploadUrl);
-
- ArrayList pictures = new ArrayList();
- Size oldSize = this.Size;
- int intSelectedTab = this.tabControl1.SelectedIndex;
- this.Size = new Size(640, 480);
-
- Bitmap bitmap;
- ImageManipulation.GetBitmapFromControl helper = new ImageManipulation.GetBitmapFromControl();
-
- this.tabControl1.SelectedIndex = 0;
- bitmap = helper.GetOctreeQuantizedBitmap(this, false);
- string strTempFileName = Path.GetTempFileName() + ".gif";
- bitmap.Save(strTempFileName, ImageFormat.Gif);
- pictures.Add(strTempFileName);
-
- for (int intI = 1; intI < this.tabControl1.TabPages.Count; intI++)
- {
- if (this.tabControl1.TabPages[intI].Text.Contains("Compiler"))
- {
- this.tabControl1.SelectedIndex = intI;
- bitmap = helper.GetOctreeQuantizedBitmap(this, false);
- strTempFileName = Path.GetTempFileName() + ".gif";
- bitmap.Save(strTempFileName, ImageFormat.Gif);
- pictures.Add(strTempFileName);
- break;
- }
- }
- this.tabControl1.SelectedIndex = intSelectedTab;
- this.Size = oldSize;
-
- UploadExamle u = new UploadExamle(
- Path.GetFileName(this.saveFileDialog1.FileName),
- this.numberedTextBoxUC1.TextBox.UploadUrl,
- this.numberedTextBoxUC1.TextBox.Text,
- pictures);
- u.ShowDialog(this);
-
- // cleanup
- foreach (string strFileName in pictures)
- {
- File.Delete(strFileName);
- }
- }
-
- private void menuItemUploadScript_Click(object sender, EventArgs e)
- {
- UploadScript();
- }
- }
-}
+using System;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+
+using System.Collections;
+
+using Microsoft.Win32;
+using System.Threading;
+using System.Reflection;
+using System.Globalization;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Drawing.Printing;
+
+
+// aximp is oude informatie, maar ik laat het er even instaan
+// aximp %WINDIR%\System32\shdocvw.dll /out:"d:\temp\AxInterop.SHDocVw.dll" /keyfile:"D:\Documents and Settings\Administrator\Mijn documenten\Mijn keys\Test.snk"
+// copieer de TWEE files AxInterop.SHDocVw.dll en SHDocVw.dll in de bin/Debug directory
+// referentie maken naar die twee files
+
+//
+// Pre build command for using a LSLEditor.rc file containing: About.htm HTML "Resource/About.htm"
+//
+// "$(DevEnvDir)..\..\SDK\v2.0\bin\rc.exe" /r "$(ProjectDir)$(TargetName).rc"
+//
+// Project properties Application, resource file
+
+namespace LSLEditor
+{
+ ///
+ /// Summary description for Form1.
+ ///
+ public class Form1 : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.OpenFileDialog openFileDialog1;
+ private System.Windows.Forms.SaveFileDialog saveFileDialog1;
+ private System.Windows.Forms.Panel panel1;
+ private System.ComponentModel.IContainer components = null;
+ private Compiler compiler;
+ private bool FullDebug;
+ private System.Windows.Forms.TabControl tabControl1;
+ private System.Windows.Forms.ContextMenu contextMenu1;
+
+ private System.Windows.Forms.MainMenu mainMenu1;
+ private System.Windows.Forms.MenuItem menuItem1;
+ private System.Windows.Forms.MenuItem menuItem2;
+ private System.Windows.Forms.MenuItem menuItem3;
+ private System.Windows.Forms.MenuItem menuItem4;
+ private System.Windows.Forms.MenuItem menuItem5;
+ private System.Windows.Forms.MenuItem menuItem6;
+ private System.Windows.Forms.MenuItem menuItem7;
+ private System.Windows.Forms.MenuItem menuItem8;
+ private System.Windows.Forms.MenuItem menuItem9;
+ private System.Windows.Forms.MenuItem menuItem10;
+ private System.Windows.Forms.MenuItem menuItem11;
+ private System.Windows.Forms.MenuItem menuItem12;
+ private System.Windows.Forms.MenuItem menuItem13;
+ private System.Windows.Forms.MenuItem menuItem14;
+ private System.Windows.Forms.MenuItem menuItem15;
+ private System.Windows.Forms.MenuItem menuItem16;
+ private System.Windows.Forms.MenuItem menuItem17;
+ private System.Windows.Forms.MenuItem menuItem18;
+ private System.Windows.Forms.MenuItem menuItem19;
+ private System.Windows.Forms.MenuItem menuItem20;
+ private System.Windows.Forms.MenuItem menuItem21;
+ private System.Windows.Forms.MenuItem menuItem22;
+ private System.Windows.Forms.MenuItem menuItem23;
+ private System.Windows.Forms.MenuItem menuItem24;
+ private System.Windows.Forms.MenuItem menuItem25;
+ private System.Windows.Forms.MenuItem menuItem26;
+ private System.Windows.Forms.MenuItem menuItem27;
+ private System.Windows.Forms.MenuItem menuItem28;
+ private System.Windows.Forms.MenuItem menuItem29;
+ private System.Windows.Forms.MenuItem menuItem30;
+ private System.Windows.Forms.MenuItem menuItem31;
+ private System.Windows.Forms.MenuItem menuItem32;
+ private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
+ private System.Windows.Forms.PrintDialog printDialog1;
+ private System.Windows.Forms.MenuItem menuItem34;
+ private System.Windows.Forms.MenuItem menuItem35;
+ private System.Windows.Forms.MenuItem menuItem36;
+ private TabPage tabPage1;
+ private NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1;
+ private MenuItem menuItem37;
+ private MenuItem menuItem38;
+ private MenuItem menuItem39;
+ private MenuItem menuItem41;
+ private MenuItem menuItem40;
+ private MenuItem menuItem42;
+ private MenuItem menuItemUploadScript;
+ private StatusStrip statusStrip1;
+ private ToolStripStatusLabel toolStripStatusLabel1;
+ private System.Windows.Forms.MenuItem menuItem33;
+
+ public Form1(string[] args)
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ Start(args);
+ }
+
+
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
+ this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
+ this.menuItem1 = new System.Windows.Forms.MenuItem();
+ this.menuItem11 = new System.Windows.Forms.MenuItem();
+ this.menuItem4 = new System.Windows.Forms.MenuItem();
+ this.menuItem41 = new System.Windows.Forms.MenuItem();
+ this.menuItem40 = new System.Windows.Forms.MenuItem();
+ this.menuItem42 = new System.Windows.Forms.MenuItem();
+ this.menuItemUploadScript = new System.Windows.Forms.MenuItem();
+ this.menuItem15 = new System.Windows.Forms.MenuItem();
+ this.menuItem13 = new System.Windows.Forms.MenuItem();
+ this.menuItem5 = new System.Windows.Forms.MenuItem();
+ this.menuItem7 = new System.Windows.Forms.MenuItem();
+ this.menuItem35 = new System.Windows.Forms.MenuItem();
+ this.menuItem34 = new System.Windows.Forms.MenuItem();
+ this.menuItem36 = new System.Windows.Forms.MenuItem();
+ this.menuItem31 = new System.Windows.Forms.MenuItem();
+ this.menuItem32 = new System.Windows.Forms.MenuItem();
+ this.menuItem6 = new System.Windows.Forms.MenuItem();
+ this.menuItem8 = new System.Windows.Forms.MenuItem();
+ this.menuItem24 = new System.Windows.Forms.MenuItem();
+ this.menuItem23 = new System.Windows.Forms.MenuItem();
+ this.menuItem25 = new System.Windows.Forms.MenuItem();
+ this.menuItem22 = new System.Windows.Forms.MenuItem();
+ this.menuItem21 = new System.Windows.Forms.MenuItem();
+ this.menuItem20 = new System.Windows.Forms.MenuItem();
+ this.menuItem26 = new System.Windows.Forms.MenuItem();
+ this.menuItem28 = new System.Windows.Forms.MenuItem();
+ this.menuItem27 = new System.Windows.Forms.MenuItem();
+ this.menuItem37 = new System.Windows.Forms.MenuItem();
+ this.menuItem38 = new System.Windows.Forms.MenuItem();
+ this.menuItem39 = new System.Windows.Forms.MenuItem();
+ this.menuItem9 = new System.Windows.Forms.MenuItem();
+ this.menuItem12 = new System.Windows.Forms.MenuItem();
+ this.menuItem14 = new System.Windows.Forms.MenuItem();
+ this.menuItem33 = new System.Windows.Forms.MenuItem();
+ this.menuItem29 = new System.Windows.Forms.MenuItem();
+ this.menuItem30 = new System.Windows.Forms.MenuItem();
+ this.menuItem2 = new System.Windows.Forms.MenuItem();
+ this.menuItem16 = new System.Windows.Forms.MenuItem();
+ this.menuItem17 = new System.Windows.Forms.MenuItem();
+ this.menuItem18 = new System.Windows.Forms.MenuItem();
+ this.menuItem19 = new System.Windows.Forms.MenuItem();
+ this.menuItem3 = new System.Windows.Forms.MenuItem();
+ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
+ this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.tabControl1 = new System.Windows.Forms.TabControl();
+ this.tabPage1 = new System.Windows.Forms.TabPage();
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
+ this.contextMenu1 = new System.Windows.Forms.ContextMenu();
+ this.menuItem10 = new System.Windows.Forms.MenuItem();
+ this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
+ this.printDialog1 = new System.Windows.Forms.PrintDialog();
+ this.numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
+ this.panel1.SuspendLayout();
+ this.tabControl1.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.statusStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // mainMenu1
+ //
+ this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItem1,
+ this.menuItem8,
+ this.menuItem12,
+ this.menuItem2});
+ //
+ // menuItem1
+ //
+ this.menuItem1.Index = 0;
+ this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItem11,
+ this.menuItem4,
+ this.menuItem41,
+ this.menuItem40,
+ this.menuItem42,
+ this.menuItemUploadScript,
+ this.menuItem15,
+ this.menuItem13,
+ this.menuItem5,
+ this.menuItem7,
+ this.menuItem35,
+ this.menuItem34,
+ this.menuItem36,
+ this.menuItem31,
+ this.menuItem32,
+ this.menuItem6});
+ this.menuItem1.Text = "File";
+ //
+ // menuItem11
+ //
+ this.menuItem11.Index = 0;
+ this.menuItem11.Text = "New";
+ this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
+ //
+ // menuItem4
+ //
+ this.menuItem4.Index = 1;
+ this.menuItem4.Text = "Open...";
+ this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
+ //
+ // menuItem41
+ //
+ this.menuItem41.Index = 2;
+ this.menuItem41.Text = "-";
+ //
+ // menuItem40
+ //
+ this.menuItem40.Index = 3;
+ this.menuItem40.Text = "Import Example...";
+ this.menuItem40.Click += new System.EventHandler(this.menuItem40_Click);
+ //
+ // menuItem42
+ //
+ this.menuItem42.Index = 4;
+ this.menuItem42.Text = "-";
+ //
+ // menuItemUploadScript
+ //
+ this.menuItemUploadScript.Enabled = false;
+ this.menuItemUploadScript.Index = 5;
+ this.menuItemUploadScript.Text = "Upload Your LSL script...";
+ this.menuItemUploadScript.Click += new System.EventHandler(this.menuItemUploadScript_Click);
+ //
+ // menuItem15
+ //
+ this.menuItem15.Index = 6;
+ this.menuItem15.Text = "-";
+ //
+ // menuItem13
+ //
+ this.menuItem13.Index = 7;
+ this.menuItem13.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
+ this.menuItem13.Text = "Save";
+ this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
+ //
+ // menuItem5
+ //
+ this.menuItem5.Index = 8;
+ this.menuItem5.Text = "Save...";
+ this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
+ //
+ // menuItem7
+ //
+ this.menuItem7.Index = 9;
+ this.menuItem7.Text = "-";
+ //
+ // menuItem35
+ //
+ this.menuItem35.Index = 10;
+ this.menuItem35.Text = "Page Setup...";
+ this.menuItem35.Click += new System.EventHandler(this.menuItem35_Click);
+ //
+ // menuItem34
+ //
+ this.menuItem34.Index = 11;
+ this.menuItem34.Shortcut = System.Windows.Forms.Shortcut.CtrlP;
+ this.menuItem34.Text = "Print";
+ this.menuItem34.Click += new System.EventHandler(this.menuItem34_Click);
+ //
+ // menuItem36
+ //
+ this.menuItem36.Index = 12;
+ this.menuItem36.Text = "-";
+ //
+ // menuItem31
+ //
+ this.menuItem31.Index = 13;
+ this.menuItem31.Text = "Copy to clipboard";
+ this.menuItem31.Click += new System.EventHandler(this.menuItem31_Click);
+ //
+ // menuItem32
+ //
+ this.menuItem32.Index = 14;
+ this.menuItem32.Text = "-";
+ //
+ // menuItem6
+ //
+ this.menuItem6.Index = 15;
+ this.menuItem6.Text = "Exit";
+ this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
+ //
+ // menuItem8
+ //
+ this.menuItem8.Index = 1;
+ this.menuItem8.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItem24,
+ this.menuItem23,
+ this.menuItem25,
+ this.menuItem22,
+ this.menuItem21,
+ this.menuItem20,
+ this.menuItem26,
+ this.menuItem28,
+ this.menuItem27,
+ this.menuItem37,
+ this.menuItem9});
+ this.menuItem8.Text = "Edit";
+ //
+ // menuItem24
+ //
+ this.menuItem24.Index = 0;
+ this.menuItem24.Shortcut = System.Windows.Forms.Shortcut.CtrlZ;
+ this.menuItem24.Text = "Undo";
+ this.menuItem24.Click += new System.EventHandler(this.menuItem24_Click);
+ //
+ // menuItem23
+ //
+ this.menuItem23.Enabled = false;
+ this.menuItem23.Index = 1;
+ this.menuItem23.Shortcut = System.Windows.Forms.Shortcut.CtrlY;
+ this.menuItem23.Text = "Redo";
+ this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
+ //
+ // menuItem25
+ //
+ this.menuItem25.Index = 2;
+ this.menuItem25.Text = "-";
+ //
+ // menuItem22
+ //
+ this.menuItem22.Index = 3;
+ this.menuItem22.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
+ this.menuItem22.Text = "Cut";
+ this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
+ //
+ // menuItem21
+ //
+ this.menuItem21.Index = 4;
+ this.menuItem21.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
+ this.menuItem21.Text = "Copy";
+ this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
+ //
+ // menuItem20
+ //
+ this.menuItem20.Index = 5;
+ this.menuItem20.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
+ this.menuItem20.Text = "Paste";
+ this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
+ //
+ // menuItem26
+ //
+ this.menuItem26.Index = 6;
+ this.menuItem26.Shortcut = System.Windows.Forms.Shortcut.Del;
+ this.menuItem26.Text = "Delete";
+ this.menuItem26.Click += new System.EventHandler(this.menuItem26_Click);
+ //
+ // menuItem28
+ //
+ this.menuItem28.Index = 7;
+ this.menuItem28.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
+ this.menuItem28.Text = "Select All";
+ this.menuItem28.Click += new System.EventHandler(this.menuItem28_Click);
+ //
+ // menuItem27
+ //
+ this.menuItem27.Index = 8;
+ this.menuItem27.Text = "-";
+ //
+ // menuItem37
+ //
+ this.menuItem37.Index = 9;
+ this.menuItem37.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItem38,
+ this.menuItem39});
+ this.menuItem37.Text = "Advanced";
+ //
+ // menuItem38
+ //
+ this.menuItem38.Index = 0;
+ this.menuItem38.Text = "Format Document";
+ this.menuItem38.Click += new System.EventHandler(this.menuItem38_Click);
+ //
+ // menuItem39
+ //
+ this.menuItem39.Enabled = false;
+ this.menuItem39.Index = 1;
+ this.menuItem39.Text = "Format Selection";
+ this.menuItem39.Click += new System.EventHandler(this.menuItem39_Click);
+ //
+ // menuItem9
+ //
+ this.menuItem9.Enabled = false;
+ this.menuItem9.Index = 10;
+ this.menuItem9.Text = "Word wrap";
+ this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
+ //
+ // menuItem12
+ //
+ this.menuItem12.Index = 2;
+ this.menuItem12.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItem14,
+ this.menuItem33,
+ this.menuItem29,
+ this.menuItem30});
+ this.menuItem12.Text = "Compiler";
+ //
+ // menuItem14
+ //
+ this.menuItem14.Index = 0;
+ this.menuItem14.Shortcut = System.Windows.Forms.Shortcut.F5;
+ this.menuItem14.Text = "Start";
+ this.menuItem14.Click += new System.EventHandler(this.menuItem14_Click);
+ //
+ // menuItem33
+ //
+ this.menuItem33.Index = 1;
+ this.menuItem33.Text = "Compiler Window";
+ this.menuItem33.Click += new System.EventHandler(this.menuItem33_Click);
+ //
+ // menuItem29
+ //
+ this.menuItem29.Index = 2;
+ this.menuItem29.Text = "-";
+ //
+ // menuItem30
+ //
+ this.menuItem30.Index = 3;
+ this.menuItem30.Text = "Properties...";
+ this.menuItem30.Click += new System.EventHandler(this.menuItem30_Click);
+ //
+ // menuItem2
+ //
+ this.menuItem2.Index = 3;
+ this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItem16,
+ this.menuItem17,
+ this.menuItem18,
+ this.menuItem19,
+ this.menuItem3});
+ this.menuItem2.Text = "Help";
+ //
+ // menuItem16
+ //
+ this.menuItem16.Index = 0;
+ this.menuItem16.Shortcut = System.Windows.Forms.Shortcut.F1;
+ this.menuItem16.Text = "Index...";
+ this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click);
+ //
+ // menuItem17
+ //
+ this.menuItem17.Index = 1;
+ this.menuItem17.Text = "-";
+ //
+ // menuItem18
+ //
+ this.menuItem18.Index = 2;
+ this.menuItem18.Text = "Check for Updates";
+ this.menuItem18.Click += new System.EventHandler(this.menuItem18_Click);
+ //
+ // menuItem19
+ //
+ this.menuItem19.Index = 3;
+ this.menuItem19.Text = "-";
+ //
+ // menuItem3
+ //
+ this.menuItem3.Index = 4;
+ this.menuItem3.Text = "About...";
+ this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.tabControl1);
+ this.panel1.Controls.Add(this.statusStrip1);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel1.Location = new System.Drawing.Point(0, 0);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(592, 353);
+ this.panel1.TabIndex = 2;
+ //
+ // tabControl1
+ //
+ this.tabControl1.Controls.Add(this.tabPage1);
+ this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tabControl1.Location = new System.Drawing.Point(0, 0);
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new System.Drawing.Size(592, 331);
+ this.tabControl1.TabIndex = 1;
+ this.tabControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseDown);
+ //
+ // tabPage1
+ //
+ this.tabPage1.BackColor = System.Drawing.Color.Transparent;
+ this.tabPage1.Controls.Add(this.numberedTextBoxUC1);
+ this.tabPage1.Location = new System.Drawing.Point(4, 22);
+ this.tabPage1.Name = "tabPage1";
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage1.Size = new System.Drawing.Size(584, 305);
+ this.tabPage1.TabIndex = 0;
+ this.tabPage1.Text = "New";
+ this.tabPage1.UseVisualStyleBackColor = true;
+ //
+ // statusStrip1
+ //
+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripStatusLabel1});
+ this.statusStrip1.Location = new System.Drawing.Point(0, 331);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(592, 22);
+ this.statusStrip1.TabIndex = 2;
+ this.statusStrip1.Text = "statusStrip1";
+ //
+ // toolStripStatusLabel1
+ //
+ this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
+ this.toolStripStatusLabel1.Size = new System.Drawing.Size(19, 17);
+ this.toolStripStatusLabel1.Text = "...";
+ //
+ // contextMenu1
+ //
+ this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItem10});
+ //
+ // menuItem10
+ //
+ this.menuItem10.Index = 0;
+ this.menuItem10.Text = "Close";
+ this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
+ //
+ // numberedTextBoxUC1
+ //
+ this.numberedTextBoxUC1.BackColor = System.Drawing.SystemColors.Control;
+ this.numberedTextBoxUC1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.numberedTextBoxUC1.Location = new System.Drawing.Point(3, 3);
+ this.numberedTextBoxUC1.Name = "numberedTextBoxUC1";
+ this.numberedTextBoxUC1.Size = new System.Drawing.Size(578, 299);
+ this.numberedTextBoxUC1.TabIndex = 1;
+ //
+ // Form1
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(592, 353);
+ this.Controls.Add(this.panel1);
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.IsMdiContainer = true;
+ this.Menu = this.mainMenu1;
+ this.Name = "Form1";
+ this.Text = "LSL-Editor";
+ this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
+ this.Load += new System.EventHandler(this.Form1_Load);
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
+ this.tabControl1.ResumeLayout(false);
+ this.tabPage1.ResumeLayout(false);
+ this.statusStrip1.ResumeLayout(false);
+ this.statusStrip1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ private void Start(string[] args)
+ {
+ this.FullDebug = true;
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
+ Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", false);
+
+ string strVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ this.Text += " " + strVersion;
+
+ // load the keywords and colors, give handle to codecompletion listBox
+ this.numberedTextBoxUC1.TextBox.Init("ConfLSL.xml");
+
+ if (args.Length == 0)
+ {
+ this.numberedTextBoxUC1.TextBox.GetExampleFile();
+ this.saveFileDialog1.FileName = "new.lsl";
+ this.menuItem13.Text = "Save new.lsl";
+ this.menuItem13.Enabled = false;
+ }
+ else
+ {
+ this.numberedTextBoxUC1.TextBox.LoadFile(args[0]);
+ this.tabControl1.TabPages[0].Text = Path.GetFileName(args[0]);
+ this.menuItem13.Text = "Save " + Path.GetFileName(args[0]);
+ this.menuItem13.Enabled = true;
+ this.saveFileDialog1.FileName = args[0];
+ }
+ this.numberedTextBoxUC1.TextBox.ToolTipping = true;
+ this.numberedTextBoxUC1.TextBox.isDirty = false;
+ }
+
+ // close application
+ private void menuItem6_Click(object sender, System.EventArgs e)
+ {
+ this.Close();
+ }
+
+ // reading file
+ private void menuItem4_Click(object sender, System.EventArgs e)
+ {
+ if (this.numberedTextBoxUC1.TextBox.isDirty)
+ {
+ DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.tabControl1.TabPages[0].Text + @"""?", "cap", MessageBoxButtons.YesNoCancel);
+ if (dialogResult == DialogResult.Yes)
+ dialogResult = SaveCurrentFile();
+ if (dialogResult == DialogResult.Cancel)
+ return;
+ }
+ this.openFileDialog1.Filter = "Secondlife script files (*.lsl)|*.lsl|All files (*.*)|*.*";
+ if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
+ {
+ if (File.Exists(this.openFileDialog1.FileName))
+ {
+ this.numberedTextBoxUC1.TextBox.LoadFile(this.openFileDialog1.FileName);
+ this.numberedTextBoxUC1.TextBox.isDirty = false;
+ this.saveFileDialog1.FileName = this.openFileDialog1.FileName;
+ this.tabControl1.TabPages[0].Text = Path.GetFileName(this.openFileDialog1.FileName);
+
+ this.menuItem13.Text = "Save " + Path.GetFileName(this.openFileDialog1.FileName);
+ this.menuItem13.Enabled = true;
+ this.saveFileDialog1.FileName = this.openFileDialog1.FileName;
+ }
+ }
+ }
+
+ // save current file
+ private DialogResult SaveCurrentFile()
+ {
+ this.saveFileDialog1.Filter = "Secondlife script files (*.lsl)|*.lsl|All files (*.*)|*.*";
+ DialogResult dialogresult = this.saveFileDialog1.ShowDialog();
+ if (dialogresult == DialogResult.OK)
+ {
+ this.numberedTextBoxUC1.TextBox.SaveFile(this.saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
+ this.tabControl1.TabPages[0].Text = Path.GetFileName(this.saveFileDialog1.FileName);
+ this.menuItem13.Text = "Save " + Path.GetFileName(this.saveFileDialog1.FileName);
+ this.menuItem13.Enabled = true;
+ this.numberedTextBoxUC1.TextBox.isDirty = false;
+ }
+ return dialogresult;
+ }
+
+ private void menuItem5_Click(object sender, System.EventArgs e)
+ {
+ SaveCurrentFile();
+ }
+
+ // about
+ private void menuItem3_Click(object sender, System.EventArgs e)
+ {
+ //About about = new About(this);
+ //about.ShowDialog(this);
+ }
+
+ // toggle word wrap
+ private void menuItem9_Click(object sender, System.EventArgs e)
+ {
+ this.menuItem9.Checked = !this.menuItem9.Checked;
+ this.numberedTextBoxUC1.TextBox.WordWrap = (this.menuItem9.Checked);
+ }
+
+ private void StartCompiler()
+ {
+ compiler = new Compiler(this.FullDebug, "ConfLSL.xml", this.numberedTextBoxUC1.TextBox.Text);
+ if (compiler.CompilerErrors != null)
+ {
+ MessageBox.Show(compiler.CompilerErrors, "compiler errors");
+ return;
+ }
+
+ if (this.menuItem33.Checked)
+ {
+ compiler.ShowDialog(this);
+ }
+ else
+ {
+ TabPage tabPage = null;
+ for (int intI = 0; intI < this.tabControl1.TabPages.Count; intI++)
+ {
+ if (this.tabControl1.TabPages[intI].Text == "Compiler")
+ {
+ tabPage = this.tabControl1.TabPages[intI];
+ tabPage.Controls.Clear();
+ this.tabControl1.SelectedIndex = intI;
+ break;
+ }
+ }
+ if (tabPage == null)
+ {
+ tabPage = new TabPage("Compiler");
+ this.tabControl1.TabPages.Add(tabPage);
+ this.tabControl1.SelectedIndex = this.tabControl1.TabCount - 1;
+ }
+ tabPage.Controls.Add(compiler.Controls[0]);
+ }
+ }
+
+ // compiler
+ private void menuItem14_Click(object sender, System.EventArgs e)
+ {
+ StartCompiler();
+ }
+
+ // Empty current script
+ private void menuItem11_Click(object sender, System.EventArgs e)
+ {
+ this.tabControl1.TabPages[0].Text = "New";
+ this.saveFileDialog1.FileName = "new.lsl";
+ this.menuItem13.Text = "Save new.lsl";
+ this.menuItem13.Enabled = false;
+ this.numberedTextBoxUC1.TextBox.Clear();
+ this.numberedTextBoxUC1.TextBox.SelectionStart = 0;
+ this.numberedTextBoxUC1.TextBox.SelectionLength = 0;
+ this.numberedTextBoxUC1.TextBox.SelectionColor = Color.Black;
+ this.numberedTextBoxUC1.TextBox.isDirty = false;
+ }
+
+ private void Form1_Load(object sender, System.EventArgs e)
+ {
+ try
+ {
+ RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"software\hwh\lsleditor");
+ if (regKey != null)
+ {
+ this.Width = (int)regKey.GetValue("Width");
+ this.Height = (int)regKey.GetValue("Height");
+ this.Left = (int)regKey.GetValue("Left");
+ this.Top = (int)regKey.GetValue("Top");
+ this.numberedTextBoxUC1.TextBox.WordWrap = (regKey.GetValue("WordWrap").ToString() == "True");
+ this.menuItem9.Checked = this.numberedTextBoxUC1.TextBox.WordWrap;
+ this.menuItem33.Checked = (regKey.GetValue("CompilerInWindow").ToString() == "True");
+ regKey.GetValue("Unknown").ToString();
+ this.FullDebug = true;
+ this.menuItemUploadScript.Enabled = true;
+ }
+ }
+ catch
+ {
+ }
+ //this.Activate();
+ }
+
+ private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ RegistryKey regKey = Registry.CurrentUser.CreateSubKey(@"software\hwh\lsleditor");
+ if (regKey != null)
+ {
+ regKey.SetValue("Width", this.Width);
+ regKey.SetValue("Height", this.Height);
+ regKey.SetValue("Top", this.Top);
+ regKey.SetValue("Left", this.Left);
+ regKey.SetValue("WordWrap", this.numberedTextBoxUC1.TextBox.WordWrap);
+ regKey.SetValue("CompilerInWindow", this.menuItem33.Checked);
+ regKey.Flush();
+ regKey.Close();
+ }
+ if (this.numberedTextBoxUC1.TextBox.isDirty)
+ {
+ DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.tabControl1.TabPages[0].Text + @"""?", "cap", MessageBoxButtons.YesNoCancel);
+ if (dialogResult == DialogResult.Yes)
+ dialogResult = SaveCurrentFile();
+ e.Cancel = (dialogResult == DialogResult.Cancel);
+ }
+ }
+
+ // F1
+ private void ShowHelp()
+ {
+ string strKeyWord = this.numberedTextBoxUC1.TextBox.GetCurrentKeyWord(false);
+
+ string strUrl = this.numberedTextBoxUC1.TextBox.HelpUrl + "wakka.php?wakka=" + strKeyWord;
+
+ if (strKeyWord == "")
+ strKeyWord = "Help";
+
+ ShowWebBrowser(strKeyWord, strUrl);
+ }
+
+ // show context menu for tab headers
+ private void tabControl1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
+ {
+ if (e.Button == MouseButtons.Right)
+ {
+ for (int intI = 1; intI < tabControl1.TabCount; intI++)
+ {
+ Rectangle rt = tabControl1.GetTabRect(intI);
+ if (e.X > rt.Left && e.X < rt.Right
+ && e.Y > rt.Top && e.Y < rt.Bottom)
+ {
+ this.contextMenu1.Show(this.tabControl1, new Point(e.X, e.Y));
+ }
+ }
+ }
+ }
+
+ // close tab
+ private void menuItem10_Click(object sender, System.EventArgs e)
+ {
+ if (this.tabControl1.SelectedIndex > 0)
+ this.tabControl1.TabPages.RemoveAt(this.tabControl1.SelectedIndex);
+ }
+
+ private void menuItem13_Click(object sender, System.EventArgs e)
+ {
+ // save as current file
+ this.numberedTextBoxUC1.TextBox.SaveFile(this.saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
+ this.numberedTextBoxUC1.TextBox.isDirty = false;
+ }
+
+ private void menuItem16_Click(object sender, System.EventArgs e)
+ {
+ ShowHelp();
+ }
+
+ private void menuItem18_Click(object sender, System.EventArgs e)
+ {
+ ShowWebBrowser("Check for Updates", this.numberedTextBoxUC1.TextBox.UpdateUrl);
+ }
+
+ private void menuItem22_Click(object sender, System.EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.Cut();
+ }
+
+ private void menuItem21_Click(object sender, System.EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.Copy();
+ }
+
+ private void menuItem20_Click(object sender, System.EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.Paste();
+ }
+
+ private void menuItem26_Click(object sender, System.EventArgs e)
+ {
+ if (this.numberedTextBoxUC1.TextBox.SelectedText == "")
+ this.numberedTextBoxUC1.TextBox.SelectionLength = 1;
+ this.numberedTextBoxUC1.TextBox.SelectedText = "";
+ }
+
+ private void menuItem28_Click(object sender, System.EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.SelectAll();
+ }
+
+ private void menuItem24_Click(object sender, System.EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.UndoPlus();
+ }
+
+ private void menuItem23_Click(object sender, System.EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.Redo();
+ }
+
+ private void menuItem30_Click(object sender, System.EventArgs e)
+ {
+ SimProperties props = new SimProperties();
+ props.Icon = this.Icon;
+ props.ShowDialog(this);
+ }
+
+ private void menuItem31_Click(object sender, System.EventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.ToClipBoard();
+ }
+
+ private void menuItem33_Click(object sender, System.EventArgs e)
+ {
+ this.menuItem33.Checked = !this.menuItem33.Checked;
+ }
+
+ private void menuItem35_Click(object sender, System.EventArgs e)
+ {
+ PrintDocument docPrn = new PrintDocument();
+ docPrn.DocumentName = this.saveFileDialog1.FileName;
+ this.pageSetupDialog1.Document = docPrn;
+ this.pageSetupDialog1.ShowDialog();
+ }
+
+ private void menuItem34_Click(object sender, System.EventArgs e)
+ {
+ this.printDialog1.AllowPrintToFile = true;
+ PrintDocument docPrn = new PrintDocument();
+ docPrn.DocumentName = this.saveFileDialog1.FileName;
+ this.printDialog1.Document = docPrn;
+ if (this.printDialog1.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ docPrn.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
+ docPrn.Print();
+ }
+ catch
+ {
+ MessageBox.Show("Error While Printing", "Print Error");
+ }
+ }
+ }
+
+ private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
+ {
+ this.numberedTextBoxUC1.TextBox.Print(0, this.numberedTextBoxUC1.TextBox.Text.Length, e);
+ }
+
+ private void menuItem38_Click(object sender, EventArgs e)
+ {
+ // Format Document
+ AutoFormatter autoFormatter = new AutoFormatter();
+ this.numberedTextBoxUC1.TextBox.Text =
+ autoFormatter.ApplyFormatting(this.numberedTextBoxUC1.TextBox.Text);
+ }
+
+ private void menuItem39_Click(object sender, EventArgs e)
+ {
+ // Format Selection
+ AutoFormatter autoFormatter = new AutoFormatter();
+ this.numberedTextBoxUC1.TextBox.SelectedText =
+ autoFormatter.ApplyFormatting(this.numberedTextBoxUC1.TextBox.SelectedText);
+ }
+
+ private void menuItem40_Click(object sender, EventArgs e)
+ {
+ ShowWebBrowser("Import Examples", this.numberedTextBoxUC1.TextBox.ExamplesUrl);
+ }
+
+ private void ShowWebBrowser(string strTabName, string strUrl)
+ {
+ TabPage tabPage = new TabPage(strTabName);
+
+ WebBrowser axWebBrowser1 = new WebBrowser();
+ tabPage.Controls.Add(axWebBrowser1);
+ this.tabControl1.TabPages.Add(tabPage);
+ this.tabControl1.SelectedIndex = this.tabControl1.TabCount - 1;
+
+ axWebBrowser1.Dock = DockStyle.Fill;
+ axWebBrowser1.StatusTextChanged += new EventHandler(axWebBrowser1_StatusTextChanged);
+ axWebBrowser1.Navigating += new WebBrowserNavigatingEventHandler(axWebBrowser1_Navigating);
+ axWebBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(axWebBrowser1_DocumentCompleted);
+ axWebBrowser1.Navigate(strUrl);
+ }
+
+ void axWebBrowser1_StatusTextChanged(object sender, EventArgs e)
+ {
+ WebBrowser axWebBrowser1 = sender as WebBrowser;
+ this.toolStripStatusLabel1.Text = axWebBrowser1.StatusText;
+ }
+
+
+ void axWebBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
+ {
+ string strUrl = e.Url.ToString();
+ if (strUrl.EndsWith(".lsl"))
+ {
+ e.Cancel = true;
+ if (MessageBox.Show("Import LSL script?", "Import script", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
+ return;
+
+ WebBrowser axWebBrowser1 = sender as WebBrowser;
+ axWebBrowser1.Stop();
+
+ // download the url
+ this.numberedTextBoxUC1.TextBox.LoadFile(strUrl);
+ this.numberedTextBoxUC1.TextBox.isDirty = true;
+
+ // Delete webbrowser?
+ // axWebBrowser1.Dispose();
+ // this.tabControl1.TabPages.RemoveAt(this.tabControl1.TabCount - 1);
+
+ int intI = strUrl.LastIndexOf("/");
+ if (intI > 0)
+ {
+ string strName = strUrl.Substring(intI + 1);
+ this.tabControl1.TabPages[0].Text = strName;
+ this.menuItem13.Text = "Save " + strName;
+ this.menuItem13.Enabled = false;
+ this.saveFileDialog1.FileName = strName;
+ }
+
+ this.tabControl1.SelectedIndex = 0;
+ }
+ }
+
+ void axWebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
+ {
+ WebBrowser axWebBrowser1 = sender as WebBrowser;
+ if (e.Url.ToString() == this.numberedTextBoxUC1.TextBox.UploadUrl)
+ {
+ HtmlElement element = axWebBrowser1.Document.GetElementById("SourceCode");
+ if (element != null)
+ {
+ //if(element.InnerText.Trim()=="")
+ element.InnerText = this.numberedTextBoxUC1.TextBox.Text;
+
+ // Makepictures
+ Size oldSize = this.Size;
+ this.Size = new Size(640, 480);
+
+ Bitmap bitmap;
+ ImageManipulation.GetBitmapFromControl helper = new ImageManipulation.GetBitmapFromControl();
+
+ this.tabControl1.SelectedIndex = 0;
+ bitmap = helper.GetOctreeQuantizedBitmap(this, false);
+ bitmap.Save(@"d:\temp\test1.gif", ImageFormat.Gif);
+
+ element = axWebBrowser1.Document.GetElementById("File1");
+ if (element != null)
+ {
+ element.SetAttribute("value", @"d:\temp\test1.gif");
+ element.OuterHtml = @"";
+ }
+
+ if (this.tabControl1.TabPages[1].Text.Contains("Compiler"))
+ {
+ this.tabControl1.SelectedIndex = 1;
+ bitmap = helper.GetOctreeQuantizedBitmap(this, false);
+ bitmap.Save(@"d:\temp\test2.gif", ImageFormat.Gif);
+
+ element = axWebBrowser1.Document.GetElementById("File2");
+ if (element != null)
+ element.SetAttribute("value", @"d:\temp\test2.gif");
+ }
+
+ this.tabControl1.SelectedIndex = this.tabControl1.TabPages.Count - 1;
+ this.Size = oldSize;
+ }
+ }
+ }
+
+ private void UploadScript()
+ {
+ //ShowWebBrowser("Upload", this.numberedTextBoxUC1.TextBox.UploadUrl);
+
+ ArrayList pictures = new ArrayList();
+ Size oldSize = this.Size;
+ int intSelectedTab = this.tabControl1.SelectedIndex;
+ this.Size = new Size(640, 480);
+
+ Bitmap bitmap;
+ ImageManipulation.GetBitmapFromControl helper = new ImageManipulation.GetBitmapFromControl();
+
+ this.tabControl1.SelectedIndex = 0;
+ bitmap = helper.GetOctreeQuantizedBitmap(this, false);
+ string strTempFileName = Path.GetTempFileName() + ".gif";
+ bitmap.Save(strTempFileName, ImageFormat.Gif);
+ pictures.Add(strTempFileName);
+
+ for (int intI = 1; intI < this.tabControl1.TabPages.Count; intI++)
+ {
+ if (this.tabControl1.TabPages[intI].Text.Contains("Compiler"))
+ {
+ this.tabControl1.SelectedIndex = intI;
+ bitmap = helper.GetOctreeQuantizedBitmap(this, false);
+ strTempFileName = Path.GetTempFileName() + ".gif";
+ bitmap.Save(strTempFileName, ImageFormat.Gif);
+ pictures.Add(strTempFileName);
+ break;
+ }
+ }
+ this.tabControl1.SelectedIndex = intSelectedTab;
+ this.Size = oldSize;
+
+ UploadExamle u = new UploadExamle(
+ Path.GetFileName(this.saveFileDialog1.FileName),
+ this.numberedTextBoxUC1.TextBox.UploadUrl,
+ this.numberedTextBoxUC1.TextBox.Text,
+ pictures);
+ u.ShowDialog(this);
+
+ // cleanup
+ foreach (string strFileName in pictures)
+ {
+ File.Delete(strFileName);
+ }
+ }
+
+ private void menuItemUploadScript_Click(object sender, EventArgs e)
+ {
+ UploadScript();
+ }
+ }
+}
diff --git a/trunk/Form1.resx b/source/Form1.resx
similarity index 98%
rename from trunk/Form1.resx
rename to source/Form1.resx
index 23f3132..9ee9476 100644
--- a/trunk/Form1.resx
+++ b/source/Form1.resx
@@ -1,348 +1,348 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
- 126, 17
-
-
- 256, 17
-
-
- 17, 54
-
-
- 384, 17
-
-
- 506, 17
-
-
- 648, 17
-
-
- 42
-
-
-
-
- AAABAAcAEBAQAAAAAAAoAQAAdgAAABAQAAAAAAAAaAUAAJ4BAAAYGAAAAAAAAMgGAAAGBwAAICAQAAAA
- AADoAgAAzg0AACAgAAAAAAAAqAgAALYQAAAwMBAAAAAAAGgGAABeGQAAMDAAAAAAAACoDgAAxh8AACgA
- AAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAgAAAAACAAACA
- gACAAIAAgICAAMDAwAAA/wAA/wAAAP//AAAAAP8AAP//AAAAAAD///8AERERERERERERERERERERERER
- ERERERERERERERERERERAAAAAAABEXF//////wEREX+IiIiPgBF3F/f////wEREX+I//+PARdxf/d3d3
- +AEREX//////AXdxeqqqq7wBEREXd3d3d3ERERERERERERERERERERERERERERERERH//wAA//8AAP//
- AAD//xERwAd4iEAHiIjAA4iIIAMREeADd/8gAf//8AH//xABERH4ARf//////////////xERKAAAABAA
- AAAgAAAAAQAIAAAAAABAAQAAAAAAAAAAAAAAAAAAAAAAALJOHQDfjScAeEQoAN+QLgCGUzkAtHU7ANSU
- SQDnoEkA6KNOALF8WQBmZmYAtIprAICJiQC+oYwAlJSQAIuWlwCPlpcAmZydAKOlpAC2r6UAlKKsALay
- rAC7tq4AuLaxAM3FugDJzMwAz9DNANDQ0ADO09MAy93hANbh5ADW5OgA1+frAOLp6wDn7O0A2OrvANnq
- 7wDo8vUA6/T3APP29wAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoKCgoKCgoKCgoKCgoKCgoKCgoKCgo
- KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgKCgoKCgoKCgoKKCgoKCgAAAAAAAAAAAAAAAooKBco
- CSMjIyMjIyMjIwAKKCgoKAkgHBkZGRkZGSUNAgooFhEoCR0QKSkpKSchJAUKKCgoKAkjFBspKSkpHiYL
- CigTDigJHyMMDAwMDA8iGgUKKCgoKAkjIyMjIyMjIyMFChgVEigJAwEBAQEBCAcGBQQoKCgoKAAAAAAA
- AAAAAAAoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo//94iv//
- AAD//zMV4AdrbsADAqNAA6OjwAFvkyABAADgAQAAIABnfvAApaQQAKSk+AGYjv//NgD//zEG//9RlCgA
- AAAYAAAAMAAAAAEACAAAAAAAoAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwb+/APr5+QDQy8oA0szKAKGQ
- iQCikIgA18jBAHdEKgB3Ri4AjlY5AKp0WQB1UkAAoXFZAHRSQQBxU0QAhmdYAK+MegCykYEAopKKALqy
- rgDPy8kAe0gtAJFZOwCxeVkAtH5fAJ1uVQCeb1YAdFNBAIZmVQCGZ1YAu5mGALycigC6m4oAwKaXAJOA
- dQCmlIoA3dLMALyzrgDAubUAp25MALJ6WQDBl30Awpl/ALOPegC7nIoAupuJAMCnmADCqZoAqJeNANzS
- zADCurUArFITAL9oLgCUhHkArJuPAMrGwwChVxsAwp+DAMG3rwDEu7QA3GkAANaofgDTwK8AwLGkAMa4
- qwDebwAA3W8AANxtAADGuKoA0snAANDIwADpiiUA95w3AO+YPADgtogA37WIAN61iADftokA37eKANXL
- wADXzcEA0ci8AOWsWwDotGUA6LVlAOu5aADpuGwA67tvAOq7cQDluHMA3bV2ALa2tQChpaQA2NzbANfb
- 2gDg//8AkpubAJOZmQCgpaUAnaKiAKGvsACvuLkA3u7wANzs7gDd5eYA3vr/AOL7/wCdqqwAtbu8ALDA
- wwDg6uwA2+XnAO7z9ADd8fYAv9HVAMLT1wC/0NQA2uzwANPk6ADk8PMA5e7wANzk5gDP09QA7fHyAN32
- /QDP4ucAz+HmANvt8gDa7PEA2OrvAN/q7QDl8PMA3ff/AN73/wDd9v4A3PX9ANrw9wDc8PYAwNHWANvs
- 8QDa6/AA4/P4AODq7QDl7/IA5O7xAN31/QDg9/8A3PL6ANjq8ADb7PIA4fH3AN7m6QDY4OMA2/P9ANry
- /ADb8/4A2vL9ANfv+gDa8/8A7vL0AO3x8wD4+PkA////AP39/QDp6ekAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4eHh4eHh4eHh4eHh0Q
- NgAAAAAAAAAAAAsgIS4uLi4uLi4uLi0fCg8AAAAAAEAFEj9gfZKSkpKSkpKSkpJqaRc2AAAAAEcEByuI
- goCMdoGBgYGBgYGNhTAMAAAAAAAAAClolXCRkI+Pj4+Pj4N5l14WAAAAAEATBRFRiWVte6ChoaGhoXx6
- eIoaIwAAAEYzFSUqa25dAQKjo6Ojo6Nxb5MiDgAAAAAAAAAZZ35hXKWkpKSkpKSimI5fCDYAAEExBgUR
- UZRsYmNjY2NjY2NkZoRyGyMAAFA8JwMyKoZ/i3Nzc3Nzc3N1dHeHLxw2AAAAAAAAGJafnJycnJycnJyb
- nZ6amQk2AEU3JAUFLFNWVVRUVFRUVFVZV1hbWjk2AFI7JhQ4ADU9REJDQ0NDQ0NKSEkNKDQ2AAAAAAAA
- AAA6Pk9NTU1NTU1MTE5LS0sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAA////Kv///w7///8o////KP///yjwAB8o8AAPToAAB12AAAdD8AAHIIAA
- Az2AAAM9+AABPYAAAT2AAABV/AAAXYAAAF2CAABd/wABVf///1X///9V////Vf///1X///9dKAAAACAA
- AABAAAAAAQAEAAAAAACAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAICAAAAAAIAAAICAAIAA
- gACAgIAAwMDAAAD/AAD/AAAA//8AAAAA/wAA//8AAAAAAP///wARERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAAAAAAAAAAAAAAER
- EREREXiIiIiIiIiIiIiAERERABF3////////////8BEREX9xF/////////////cBEREXcReP////////
- ///4AREREREXf/iIiIiIiIiP/wEREQABEX/4f4//////j/9wERF/9xF4+H+I//////j/gBERF3cRd/iH
- 9//////4//ARERERERf/h/f/////+P/3ARFwAAEXj4d3d3d3d3eP+AERf//3F3+IiIiIiIiIiP8wERd3
- dxF/////////////cBEREREReP///////////4ARcAAAEXi7u7u7u7u7u7uyAX///3EXqqqqqqqqq6us
- ygEXd3dxF6qqqqqqqqqqqqoBERERERF3d3d3d3d3d3d3ERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- EREREREREREREf//////////////////////////////////////////8AAAf/AAAD8wAAA/GAAAH5gA
- AB/4AAAfHAAADwwAAA+MAAAP/gAABwYAAAcCAAADgwAAA/8AAAMDAAABAYAAAYGAAAH/wAAD////////
- ////////////////////////KAAAACAAAABAAAAAAQAIAAAAAACABAAAAAAAAAAAAAAAAAAAAAAAAJ44
- AACmQAAAsUsAANNtAADZcgAAmDcGAH4wCQB/MQoAlDoMAHAvDwCDNg8AcDEQAJ5CEwDBZRMAoEQVANN0
- FQCWQRYAl0IXAI9CHAChTCEAznQiANF4JgDzoScAXzsoAGpBKwCdUy4AnlMuAJ5VLwCiWDMAplw3AN+N
- OwCjXjwArG5PALF0VQBeXl4As3tfALCIYwBmZmYAhHNoAG5ycgBwd3cAc3h3AHV5eAB2enkAeXt6AHl8
- egB6fHoAe317AH1+ewB+f3wAvJiEALmghgCKiooAkJCMAI6RkAD/zJkApaShAKWloQCmpaEAxLKlAKqq
- qgChsLEAysG5AMC+uwDCwLwAury9AMXFwgDGxsMAvsLEANnQxQDNy8cA087JANbQyQDP0M0A4NfNAOnc
- 0ADs4NEAv9DUANLa2wDO4OQA0uToAOjo6ADg6OoA6urqANnp7QDY6u8A2ervANvr8ADv8/QA6fP2APj4
- +AD7+/sA/f39AAAAAAA0b/8A////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AABdXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
- XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
- XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
- XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dJSUlJSUlJSUl
- JSUlJSUlJSUlJSUlXV1dXV1dXV1dXR8SCgcGBgYGBgYGBgYGBgYGBgYGByUmXV1dXV1dXV1dCDtGRkZG
- RkZGRkZGRkZGRkZGRkY+BSVdXV1dXUI2XV0gM1VVVVVVVVVVVVVVVVVVVVVVVVUTJV1dXV1dQEA/XV0M
- VVVVVVVVVVVVVVVVVVVVVVVVVTILJV1dXV1dXV1dXQ5JVV9fX19fX19fX19fX19fX19VTgUlXV1dXV1d
- XV1dICRVVE1NTU1NTU1NTU1NTU1NX1ZVEyVdXV1dNS4qXV1dDFVVPShfPFFfX19fX19fX01YX1UyCyVd
- XV1FRT8/XV0OSVU9KF84PF9fX19fX19fUk1fVU4FJV1dXV1dXV1dXSAkVU89KFsiU1pfX19fX19cTV9X
- VRMlXV1dXV1dXV1dXQxVVT0oXzRTU19fX19fX19NX1lVMgslXV05MC0qJ11dDklVPSgoKCgoKCgoKCgo
- KChNX1VOBSVdXUtLSENEP10gJFVQPT09PT09PT09PT09PT1NVVUTFyVdXV1dXV1dXV0MVVVVVVVVVVVV
- VVVVVVVVVVVVVTIJJV1dXV1dXV1dXQ5JVVVVVVVVVVVVVVVVVVVVVVVVTgUlXToxLywrKV1dIw0WFhYW
- FhYWFhYWFhYWFhYWFhYWARglTExKR0NBP11dAAQEBAQEBAQEBAQEBAQ3DzcPXg8DASVdXV1dXV1dXV0d
- AhQVHh4eHh4eHh4eHh4eHh4eHgMFXV1dXV1dXV1dXV0hHBsaGRkZGRkZGRkZGRkZGRkQEV1dXV1dXV1d
- XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
- XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
- XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
- XV1dXV1d//////////////////////////////////////gAAD/wAAAf8AAAHzAAAB8YAAAP+AAAD/gA
- AA8cAAAHDAAAB/wAAAf+AAADBgAAAwIAAAH/AAAB/wAAAQMAAAABgAAA/4AAAf/AAAP/////////////
- //////////////////8oAAAAMAAAAGAAAAABAAQAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AACAAAAAgIAAAAAAgAAAgIAAgACAAICAgADAwMAAAP8AAP8AAAD//wAAAAD/AAD//wAAAAAA////ABER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAAAAAAAAAAAAAA
- AAAAAAABERERERERERd3d3d3d3d3d3d3d3d3d3cgERERERERERd///////////////////ggERERERAB
- ERc///////////////////8wEREREX/wERF4//////////////////9yARERERd3ERF3////////////
- //////+CARERERERERFz///////////////////zAREREREREREXj//////////////////3IBERERER
- EREXf/iIiIiIiIiIiIiIj//4IBERERAAAREXP/+If/h/////////j///MBEREX//8BEReP+IeP9/////
- ////iP//cgERERd3dxERd//4d/94////////+P//ggERERERERERc//4h4+H////////+P//8wERERER
- ERERF4/4h3/3////////+I//9yARERERERERF3//h3j4f///////+I//+CARERAAAAERFz//iHd3d3d3
- d3d3d4j//zAREX////AREXj/iIiIiIiIiIiIiIj//3IBERd3d3cREXf//////////////////4IBERER
- EREREXP///////////////////MBEREREREREReP//////////////////cgERERERERERd/////////
- //////////ggERAAAAABERd6qqqqqqqqqqqqqqqqqqowEX/////wERF6qqqqqqqqqqqqq7q7rMMyARd3
- d3d3ERF6qqqqqqqqqqqqqrqrp8cyAREREREREREXu7u7u7u7u7u7u7u7u7uyARERERERERERd3d3d3d3
- d3d3d3d3d3d3ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
- EREREREREREREf///////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP//
- /////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP4AAAAB/wAA/gAAAAD/
- AAD+AAAAAP8AAJ4AAAAA/wAADwAAAAB/AACPAAAAAH8AAP8AAAAAfwAA/4AAAAA/AAD/gAAAAD8AAIeA
- AAAAPwAAA8AAAAAfAACDwAAAAB8AAP/AAAAAHwAA/+AAAAAPAAD/4AAAAA8AAIHgAAAADwAAAPAAAAAH
- AACA8AAAAAcAAP/wAAAABwAA//gAAAADAAD/+AAAAAMAAIB4AAAAAwAAADwAAAABAACAPAAAAAEAAP/+
- AAAAAQAA//8AAAADAAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////
- AAD///////8AAP///////wAA////////AAD///////8AACgAAAAwAAAAYAAAAAEACAAAAAAAgAoAAAAA
- AAAAAAAAAAAAAAAAAACQMAAAmTMAAKE7AACtRwAAu1UAAMNdAADMZgAA020AAN13AAD2kAAAoz0BAIYv
- BACbNwQAzGkGAKNEDQBwMRAAnkITAHQ1FAAVFRUAaTIVAKBEFQDTdBUA4oMVAJhDGACgSh4Ao0sfAKFM
- IQCaSyMAp08jAJ1NJQClUCUAXzsoAFw9LABhQS8AvHYxANB9MQDeijcAODg4AG5LOADaiTkAvHM9AOGQ
- PwB5U0AA3I5AAKxqSQBNTU0AnWhNALN/YwBmZmYAtYRqAO+sagD1s2oAcXFxAHB3dwC4jncAdXp6APa7
- fwD6v38Ae4SEALyYhAB7aoYAh5KSAJOcnACXpaUAmaioAJqmqQCqqqoAra2rAJ+srACvr6wAq66uALSy
- rgC3tbAAvLixAL24sQDBu7MAw720AMrCtwDLwrcApra4ANXJuwDXyrwArLy9ANnLvQDczr4A4NDAAOTT
- wQDq18QA69jEAPLcxwD13sgAtMXJAM/QzQDGzc4AuszRALvN0gC/0NQAwtPWAMbV2QDJ19sA0trbANvb
- 2wDJ2t4Ay9zgANfc4ADa3eEA3uHjAPjw4wDf4uQA2OLlAPjy5QDk5uYA3uLnAOXm5wDS5OgA3OXoAOzr
- 6ADr6+kA7uzpAPn06QDq6uoA8u/rAPr16wDW6OwA9vLsAOPr7QD59O0A2OrvANnq7wDo7u8A2+vwAOvt
- 8ADt7/AA3ezxAODu8gDv8fIA7vDzAPLz8wD19PMA5fH0APf29AD69/UA6fP2APz69gDt9fcA9/f3APX3
- +ADy+PkA+fz8AAAAAAA0b/8A////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMJWVlZWVlZWVlZWVlZWV
- lQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQERMJWVlZWVlZWVlZWVlZWVlQEvNjY2NjY2NjY2
- NjY2NjY2NjY2NjY2NjY2NjY2NiwBITCVlZWVlZWVlZWVlZWVlQExf39/f39/f39/f39/f39/f39/f39/
- f39/f39/f2QBEzCVlZWVlZWVlTAwlZWVlRcQf39/f39/f39/f39/f39/f39/f39/f39/f39/f38aGDCV
- lZWVlZWVa1RJMJWVlZUBXH9/f39/f39/f39/f39/f39/f39/f39/f39/f387ASAwlZWVlZWVlXZscJWV
- lZUAMX9/f39/f39/f39/f39/f39/f39/f39/f39/f39kAQ8wlZWVlZWVlZWVlZWVlZUXEH9/f39/f39/
- f39/f39/f39/f39/f39/f39/f39/GgswlZWVlZWVlZWVlZWVlZWVAVx/f5eXl5eXl5eXl5eXl5eXl5eX
- l5eXl5eXhX9/OwEfMJWVlZWVlZWVlZWVlZWVADF/f3I/T15eXl5eXl5eXl5eXl5eXl5eXl+XkH9/ZAEP
- MJWVlZWVlTAwMDCVlZWVFxB/f38/QDVzc3Nzc3Nzc3Nzc3Nzc3NzbV6Bl39/fxoLMJWVlZWVblhRTEcw
- lZWVlQFcf39hPzVGl5cSl5eXl5eXl5eXl5eXl2Bjl4Z/fzsBHzCVlZWVlXx0b2lwlZWVlQAxf397Pz41
- eJclZZeXl5eXl5eXl5eXl21el5N/f2QBDzCVlZWVlZWVlZWVlZWVlRcQf39/Uj81RpdCNJeXl5eXl5eX
- l5eXl5JefZeAf38aGTCVlZWVlZWVlZWVlZWVlZUBXH9/Zj81N5eRLZeXl5eXl5eXl5eXl5dgYpeLf387
- AR8wlZWVlZWVlZWVlZWVlZUBMX9/fz89NUaXQkKXl5eXl5eXl5eXl5dBXpeUf39kAQ8wlZWVlTAwMDAw
- MJWVlZUdEH9/f1I/NTU1NTU1NTU1NTU1NTU1NTU6W12Xgn9/GhkwlZWVd1lWU05KRTCVlZWVAVx/f2c/
- Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/P0SXjn9/OwEfMJWVlX55dXFqaHCVlZWVATF/f39/f39/f39/f39/f39/
- f39/f39/f39/f39/ZAEPMJWVlZWVlZWVlZWVlZWVHRB/f39/f39/f39/f39/f39/f39/f39/f39/f39/
- fxoZMJWVlZWVlZWVlZWVlZWVlQFcf39/f39/f39/f39/f39/f39/f39/f39/f39/fzsBHzCVlZWVlZWV
- lZWVlZWVlQExf39/f39/f39/f39/f39/f39/f39/f39/f39/f2QBDzCVlTAwMDAwMDAwlZWVlR0CCQkJ
- CQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkDHjCVelpXVVBNS0hDMJWVlZUBBwgICAgICAgICAgICAgI
- CAgICAg5OQgzORaWliIEASYwlY+NjIqJh4SDiJWVlZUUDg0GBgYGBgYGBgYGBgYGBgYGBgYyOBUpOCku
- ljwFASowlZWVlZWVlZWVlZWVlZWVAQojKyQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCcoATCVlZWVlZWV
- lZWVlZWVlZWVlRwBAQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBG5WVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
- lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV////////AAD///////8AAP//
- /////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////
- AAD///////8AAP8AAAAA/wAA/gAAAAD/AAD+AAAAAH8AAP4AAAAAfwAAngAAAAB/AAAPAAAAAD8AAI8A
- AAAAPwAA/wAAAAA/AAD/gAAAAB8AAP+AAAAAHwAAh4AAAAAfAAADwAAAAA8AAIPAAAAADwAA/8AAAAAP
- AAD/4AAAAAcAAP/gAAAABwAAgeAAAAAHAAAA8AAAAAMAAIDwAAAAAwAA//AAAAADAAD/+AAAAAEAAP/4
- AAAAAQAAgHgAAAABAAAAPAAAAAAAAIA8AAAAAAAA//4AAAABAAD//wAAAAMAAP///////wAA////////
- AAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP//
- /////wAA
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 126, 17
+
+
+ 256, 17
+
+
+ 17, 54
+
+
+ 384, 17
+
+
+ 506, 17
+
+
+ 648, 17
+
+
+ 42
+
+
+
+
+ AAABAAcAEBAQAAAAAAAoAQAAdgAAABAQAAAAAAAAaAUAAJ4BAAAYGAAAAAAAAMgGAAAGBwAAICAQAAAA
+ AADoAgAAzg0AACAgAAAAAAAAqAgAALYQAAAwMBAAAAAAAGgGAABeGQAAMDAAAAAAAACoDgAAxh8AACgA
+ AAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAgAAAAACAAACA
+ gACAAIAAgICAAMDAwAAA/wAA/wAAAP//AAAAAP8AAP//AAAAAAD///8AERERERERERERERERERERERER
+ ERERERERERERERERERERAAAAAAABEXF//////wEREX+IiIiPgBF3F/f////wEREX+I//+PARdxf/d3d3
+ +AEREX//////AXdxeqqqq7wBEREXd3d3d3ERERERERERERERERERERERERERERERERH//wAA//8AAP//
+ AAD//xERwAd4iEAHiIjAA4iIIAMREeADd/8gAf//8AH//xABERH4ARf//////////////xERKAAAABAA
+ AAAgAAAAAQAIAAAAAABAAQAAAAAAAAAAAAAAAAAAAAAAALJOHQDfjScAeEQoAN+QLgCGUzkAtHU7ANSU
+ SQDnoEkA6KNOALF8WQBmZmYAtIprAICJiQC+oYwAlJSQAIuWlwCPlpcAmZydAKOlpAC2r6UAlKKsALay
+ rAC7tq4AuLaxAM3FugDJzMwAz9DNANDQ0ADO09MAy93hANbh5ADW5OgA1+frAOLp6wDn7O0A2OrvANnq
+ 7wDo8vUA6/T3APP29wAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoKCgoKCgoKCgoKCgoKCgoKCgoKCgo
+ KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgKCgoKCgoKCgoKKCgoKCgAAAAAAAAAAAAAAAooKBco
+ CSMjIyMjIyMjIwAKKCgoKAkgHBkZGRkZGSUNAgooFhEoCR0QKSkpKSchJAUKKCgoKAkjFBspKSkpHiYL
+ CigTDigJHyMMDAwMDA8iGgUKKCgoKAkjIyMjIyMjIyMFChgVEigJAwEBAQEBCAcGBQQoKCgoKAAAAAAA
+ AAAAAAAoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo//94iv//
+ AAD//zMV4AdrbsADAqNAA6OjwAFvkyABAADgAQAAIABnfvAApaQQAKSk+AGYjv//NgD//zEG//9RlCgA
+ AAAYAAAAMAAAAAEACAAAAAAAoAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwb+/APr5+QDQy8oA0szKAKGQ
+ iQCikIgA18jBAHdEKgB3Ri4AjlY5AKp0WQB1UkAAoXFZAHRSQQBxU0QAhmdYAK+MegCykYEAopKKALqy
+ rgDPy8kAe0gtAJFZOwCxeVkAtH5fAJ1uVQCeb1YAdFNBAIZmVQCGZ1YAu5mGALycigC6m4oAwKaXAJOA
+ dQCmlIoA3dLMALyzrgDAubUAp25MALJ6WQDBl30Awpl/ALOPegC7nIoAupuJAMCnmADCqZoAqJeNANzS
+ zADCurUArFITAL9oLgCUhHkArJuPAMrGwwChVxsAwp+DAMG3rwDEu7QA3GkAANaofgDTwK8AwLGkAMa4
+ qwDebwAA3W8AANxtAADGuKoA0snAANDIwADpiiUA95w3AO+YPADgtogA37WIAN61iADftokA37eKANXL
+ wADXzcEA0ci8AOWsWwDotGUA6LVlAOu5aADpuGwA67tvAOq7cQDluHMA3bV2ALa2tQChpaQA2NzbANfb
+ 2gDg//8AkpubAJOZmQCgpaUAnaKiAKGvsACvuLkA3u7wANzs7gDd5eYA3vr/AOL7/wCdqqwAtbu8ALDA
+ wwDg6uwA2+XnAO7z9ADd8fYAv9HVAMLT1wC/0NQA2uzwANPk6ADk8PMA5e7wANzk5gDP09QA7fHyAN32
+ /QDP4ucAz+HmANvt8gDa7PEA2OrvAN/q7QDl8PMA3ff/AN73/wDd9v4A3PX9ANrw9wDc8PYAwNHWANvs
+ 8QDa6/AA4/P4AODq7QDl7/IA5O7xAN31/QDg9/8A3PL6ANjq8ADb7PIA4fH3AN7m6QDY4OMA2/P9ANry
+ /ADb8/4A2vL9ANfv+gDa8/8A7vL0AO3x8wD4+PkA////AP39/QDp6ekAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4eHh4eHh4eHh4eHh0Q
+ NgAAAAAAAAAAAAsgIS4uLi4uLi4uLi0fCg8AAAAAAEAFEj9gfZKSkpKSkpKSkpJqaRc2AAAAAEcEByuI
+ goCMdoGBgYGBgYGNhTAMAAAAAAAAAClolXCRkI+Pj4+Pj4N5l14WAAAAAEATBRFRiWVte6ChoaGhoXx6
+ eIoaIwAAAEYzFSUqa25dAQKjo6Ojo6Nxb5MiDgAAAAAAAAAZZ35hXKWkpKSkpKSimI5fCDYAAEExBgUR
+ UZRsYmNjY2NjY2NkZoRyGyMAAFA8JwMyKoZ/i3Nzc3Nzc3N1dHeHLxw2AAAAAAAAGJafnJycnJycnJyb
+ nZ6amQk2AEU3JAUFLFNWVVRUVFRUVFVZV1hbWjk2AFI7JhQ4ADU9REJDQ0NDQ0NKSEkNKDQ2AAAAAAAA
+ AAA6Pk9NTU1NTU1MTE5LS0sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAA////Kv///w7///8o////KP///yjwAB8o8AAPToAAB12AAAdD8AAHIIAA
+ Az2AAAM9+AABPYAAAT2AAABV/AAAXYAAAF2CAABd/wABVf///1X///9V////Vf///1X///9dKAAAACAA
+ AABAAAAAAQAEAAAAAACAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAICAAAAAAIAAAICAAIAA
+ gACAgIAAwMDAAAD/AAD/AAAA//8AAAAA/wAA//8AAAAAAP///wARERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAAAAAAAAAAAAAAER
+ EREREXiIiIiIiIiIiIiAERERABF3////////////8BEREX9xF/////////////cBEREXcReP////////
+ ///4AREREREXf/iIiIiIiIiP/wEREQABEX/4f4//////j/9wERF/9xF4+H+I//////j/gBERF3cRd/iH
+ 9//////4//ARERERERf/h/f/////+P/3ARFwAAEXj4d3d3d3d3eP+AERf//3F3+IiIiIiIiIiP8wERd3
+ dxF/////////////cBEREREReP///////////4ARcAAAEXi7u7u7u7u7u7uyAX///3EXqqqqqqqqq6us
+ ygEXd3dxF6qqqqqqqqqqqqoBERERERF3d3d3d3d3d3d3ERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ EREREREREREREf//////////////////////////////////////////8AAAf/AAAD8wAAA/GAAAH5gA
+ AB/4AAAfHAAADwwAAA+MAAAP/gAABwYAAAcCAAADgwAAA/8AAAMDAAABAYAAAYGAAAH/wAAD////////
+ ////////////////////////KAAAACAAAABAAAAAAQAIAAAAAACABAAAAAAAAAAAAAAAAAAAAAAAAJ44
+ AACmQAAAsUsAANNtAADZcgAAmDcGAH4wCQB/MQoAlDoMAHAvDwCDNg8AcDEQAJ5CEwDBZRMAoEQVANN0
+ FQCWQRYAl0IXAI9CHAChTCEAznQiANF4JgDzoScAXzsoAGpBKwCdUy4AnlMuAJ5VLwCiWDMAplw3AN+N
+ OwCjXjwArG5PALF0VQBeXl4As3tfALCIYwBmZmYAhHNoAG5ycgBwd3cAc3h3AHV5eAB2enkAeXt6AHl8
+ egB6fHoAe317AH1+ewB+f3wAvJiEALmghgCKiooAkJCMAI6RkAD/zJkApaShAKWloQCmpaEAxLKlAKqq
+ qgChsLEAysG5AMC+uwDCwLwAury9AMXFwgDGxsMAvsLEANnQxQDNy8cA087JANbQyQDP0M0A4NfNAOnc
+ 0ADs4NEAv9DUANLa2wDO4OQA0uToAOjo6ADg6OoA6urqANnp7QDY6u8A2ervANvr8ADv8/QA6fP2APj4
+ +AD7+/sA/f39AAAAAAA0b/8A////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AABdXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
+ XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
+ XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
+ XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dJSUlJSUlJSUl
+ JSUlJSUlJSUlJSUlXV1dXV1dXV1dXR8SCgcGBgYGBgYGBgYGBgYGBgYGByUmXV1dXV1dXV1dCDtGRkZG
+ RkZGRkZGRkZGRkZGRkY+BSVdXV1dXUI2XV0gM1VVVVVVVVVVVVVVVVVVVVVVVVUTJV1dXV1dQEA/XV0M
+ VVVVVVVVVVVVVVVVVVVVVVVVVTILJV1dXV1dXV1dXQ5JVV9fX19fX19fX19fX19fX19VTgUlXV1dXV1d
+ XV1dICRVVE1NTU1NTU1NTU1NTU1NX1ZVEyVdXV1dNS4qXV1dDFVVPShfPFFfX19fX19fX01YX1UyCyVd
+ XV1FRT8/XV0OSVU9KF84PF9fX19fX19fUk1fVU4FJV1dXV1dXV1dXSAkVU89KFsiU1pfX19fX19cTV9X
+ VRMlXV1dXV1dXV1dXQxVVT0oXzRTU19fX19fX19NX1lVMgslXV05MC0qJ11dDklVPSgoKCgoKCgoKCgo
+ KChNX1VOBSVdXUtLSENEP10gJFVQPT09PT09PT09PT09PT1NVVUTFyVdXV1dXV1dXV0MVVVVVVVVVVVV
+ VVVVVVVVVVVVVTIJJV1dXV1dXV1dXQ5JVVVVVVVVVVVVVVVVVVVVVVVVTgUlXToxLywrKV1dIw0WFhYW
+ FhYWFhYWFhYWFhYWFhYWARglTExKR0NBP11dAAQEBAQEBAQEBAQEBAQ3DzcPXg8DASVdXV1dXV1dXV0d
+ AhQVHh4eHh4eHh4eHh4eHh4eHgMFXV1dXV1dXV1dXV0hHBsaGRkZGRkZGRkZGRkZGRkQEV1dXV1dXV1d
+ XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
+ XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
+ XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
+ XV1dXV1d//////////////////////////////////////gAAD/wAAAf8AAAHzAAAB8YAAAP+AAAD/gA
+ AA8cAAAHDAAAB/wAAAf+AAADBgAAAwIAAAH/AAAB/wAAAQMAAAABgAAA/4AAAf/AAAP/////////////
+ //////////////////8oAAAAMAAAAGAAAAABAAQAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AACAAAAAgIAAAAAAgAAAgIAAgACAAICAgADAwMAAAP8AAP8AAAD//wAAAAD/AAD//wAAAAAA////ABER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAAAAAAAAAAAAAA
+ AAAAAAABERERERERERd3d3d3d3d3d3d3d3d3d3cgERERERERERd///////////////////ggERERERAB
+ ERc///////////////////8wEREREX/wERF4//////////////////9yARERERd3ERF3////////////
+ //////+CARERERERERFz///////////////////zAREREREREREXj//////////////////3IBERERER
+ EREXf/iIiIiIiIiIiIiIj//4IBERERAAAREXP/+If/h/////////j///MBEREX//8BEReP+IeP9/////
+ ////iP//cgERERd3dxERd//4d/94////////+P//ggERERERERERc//4h4+H////////+P//8wERERER
+ ERERF4/4h3/3////////+I//9yARERERERERF3//h3j4f///////+I//+CARERAAAAERFz//iHd3d3d3
+ d3d3d4j//zAREX////AREXj/iIiIiIiIiIiIiIj//3IBERd3d3cREXf//////////////////4IBERER
+ EREREXP///////////////////MBEREREREREReP//////////////////cgERERERERERd/////////
+ //////////ggERAAAAABERd6qqqqqqqqqqqqqqqqqqowEX/////wERF6qqqqqqqqqqqqq7q7rMMyARd3
+ d3d3ERF6qqqqqqqqqqqqqrqrp8cyAREREREREREXu7u7u7u7u7u7u7u7u7uyARERERERERERd3d3d3d3
+ d3d3d3d3d3d3ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
+ EREREREREREREf///////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP//
+ /////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP4AAAAB/wAA/gAAAAD/
+ AAD+AAAAAP8AAJ4AAAAA/wAADwAAAAB/AACPAAAAAH8AAP8AAAAAfwAA/4AAAAA/AAD/gAAAAD8AAIeA
+ AAAAPwAAA8AAAAAfAACDwAAAAB8AAP/AAAAAHwAA/+AAAAAPAAD/4AAAAA8AAIHgAAAADwAAAPAAAAAH
+ AACA8AAAAAcAAP/wAAAABwAA//gAAAADAAD/+AAAAAMAAIB4AAAAAwAAADwAAAABAACAPAAAAAEAAP/+
+ AAAAAQAA//8AAAADAAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////
+ AAD///////8AAP///////wAA////////AAD///////8AACgAAAAwAAAAYAAAAAEACAAAAAAAgAoAAAAA
+ AAAAAAAAAAAAAAAAAACQMAAAmTMAAKE7AACtRwAAu1UAAMNdAADMZgAA020AAN13AAD2kAAAoz0BAIYv
+ BACbNwQAzGkGAKNEDQBwMRAAnkITAHQ1FAAVFRUAaTIVAKBEFQDTdBUA4oMVAJhDGACgSh4Ao0sfAKFM
+ IQCaSyMAp08jAJ1NJQClUCUAXzsoAFw9LABhQS8AvHYxANB9MQDeijcAODg4AG5LOADaiTkAvHM9AOGQ
+ PwB5U0AA3I5AAKxqSQBNTU0AnWhNALN/YwBmZmYAtYRqAO+sagD1s2oAcXFxAHB3dwC4jncAdXp6APa7
+ fwD6v38Ae4SEALyYhAB7aoYAh5KSAJOcnACXpaUAmaioAJqmqQCqqqoAra2rAJ+srACvr6wAq66uALSy
+ rgC3tbAAvLixAL24sQDBu7MAw720AMrCtwDLwrcApra4ANXJuwDXyrwArLy9ANnLvQDczr4A4NDAAOTT
+ wQDq18QA69jEAPLcxwD13sgAtMXJAM/QzQDGzc4AuszRALvN0gC/0NQAwtPWAMbV2QDJ19sA0trbANvb
+ 2wDJ2t4Ay9zgANfc4ADa3eEA3uHjAPjw4wDf4uQA2OLlAPjy5QDk5uYA3uLnAOXm5wDS5OgA3OXoAOzr
+ 6ADr6+kA7uzpAPn06QDq6uoA8u/rAPr16wDW6OwA9vLsAOPr7QD59O0A2OrvANnq7wDo7u8A2+vwAOvt
+ 8ADt7/AA3ezxAODu8gDv8fIA7vDzAPLz8wD19PMA5fH0APf29AD69/UA6fP2APz69gDt9fcA9/f3APX3
+ +ADy+PkA+fz8AAAAAAA0b/8A////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMJWVlZWVlZWVlZWVlZWV
+ lQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQERMJWVlZWVlZWVlZWVlZWVlQEvNjY2NjY2NjY2
+ NjY2NjY2NjY2NjY2NjY2NjY2NiwBITCVlZWVlZWVlZWVlZWVlQExf39/f39/f39/f39/f39/f39/f39/
+ f39/f39/f2QBEzCVlZWVlZWVlTAwlZWVlRcQf39/f39/f39/f39/f39/f39/f39/f39/f39/f38aGDCV
+ lZWVlZWVa1RJMJWVlZUBXH9/f39/f39/f39/f39/f39/f39/f39/f39/f387ASAwlZWVlZWVlXZscJWV
+ lZUAMX9/f39/f39/f39/f39/f39/f39/f39/f39/f39kAQ8wlZWVlZWVlZWVlZWVlZUXEH9/f39/f39/
+ f39/f39/f39/f39/f39/f39/f39/GgswlZWVlZWVlZWVlZWVlZWVAVx/f5eXl5eXl5eXl5eXl5eXl5eX
+ l5eXl5eXhX9/OwEfMJWVlZWVlZWVlZWVlZWVADF/f3I/T15eXl5eXl5eXl5eXl5eXl5eXl+XkH9/ZAEP
+ MJWVlZWVlTAwMDCVlZWVFxB/f38/QDVzc3Nzc3Nzc3Nzc3Nzc3NzbV6Bl39/fxoLMJWVlZWVblhRTEcw
+ lZWVlQFcf39hPzVGl5cSl5eXl5eXl5eXl5eXl2Bjl4Z/fzsBHzCVlZWVlXx0b2lwlZWVlQAxf397Pz41
+ eJclZZeXl5eXl5eXl5eXl21el5N/f2QBDzCVlZWVlZWVlZWVlZWVlRcQf39/Uj81RpdCNJeXl5eXl5eX
+ l5eXl5JefZeAf38aGTCVlZWVlZWVlZWVlZWVlZUBXH9/Zj81N5eRLZeXl5eXl5eXl5eXl5dgYpeLf387
+ AR8wlZWVlZWVlZWVlZWVlZUBMX9/fz89NUaXQkKXl5eXl5eXl5eXl5dBXpeUf39kAQ8wlZWVlTAwMDAw
+ MJWVlZUdEH9/f1I/NTU1NTU1NTU1NTU1NTU1NTU6W12Xgn9/GhkwlZWVd1lWU05KRTCVlZWVAVx/f2c/
+ Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/P0SXjn9/OwEfMJWVlX55dXFqaHCVlZWVATF/f39/f39/f39/f39/f39/
+ f39/f39/f39/f39/ZAEPMJWVlZWVlZWVlZWVlZWVHRB/f39/f39/f39/f39/f39/f39/f39/f39/f39/
+ fxoZMJWVlZWVlZWVlZWVlZWVlQFcf39/f39/f39/f39/f39/f39/f39/f39/f39/fzsBHzCVlZWVlZWV
+ lZWVlZWVlQExf39/f39/f39/f39/f39/f39/f39/f39/f39/f2QBDzCVlTAwMDAwMDAwlZWVlR0CCQkJ
+ CQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkDHjCVelpXVVBNS0hDMJWVlZUBBwgICAgICAgICAgICAgI
+ CAgICAg5OQgzORaWliIEASYwlY+NjIqJh4SDiJWVlZUUDg0GBgYGBgYGBgYGBgYGBgYGBgYyOBUpOCku
+ ljwFASowlZWVlZWVlZWVlZWVlZWVAQojKyQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCcoATCVlZWVlZWV
+ lZWVlZWVlZWVlRwBAQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBG5WVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
+ lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV////////AAD///////8AAP//
+ /////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////
+ AAD///////8AAP8AAAAA/wAA/gAAAAD/AAD+AAAAAH8AAP4AAAAAfwAAngAAAAB/AAAPAAAAAD8AAI8A
+ AAAAPwAA/wAAAAA/AAD/gAAAAB8AAP+AAAAAHwAAh4AAAAAfAAADwAAAAA8AAIPAAAAADwAA/8AAAAAP
+ AAD/4AAAAAcAAP/gAAAABwAAgeAAAAAHAAAA8AAAAAMAAIDwAAAAAwAA//AAAAADAAD/+AAAAAEAAP/4
+ AAAAAQAAgHgAAAABAAAAPAAAAAAAAIA8AAAAAAAA//4AAAABAAD//wAAAAMAAP///////wAA////////
+ AAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP//
+ /////wAA
+
+
\ No newline at end of file
diff --git a/trunk/GotoWindow.Designer.cs b/source/GotoWindow.Designer.cs
similarity index 96%
rename from trunk/GotoWindow.Designer.cs
rename to source/GotoWindow.Designer.cs
index a159024..9aed696 100644
--- a/trunk/GotoWindow.Designer.cs
+++ b/source/GotoWindow.Designer.cs
@@ -1,104 +1,104 @@
-namespace LSLEditor
-{
- partial class GotoWindow
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(16, 8);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(42, 13);
- this.label1.TabIndex = 0;
- this.label1.Text = "Line nr:";
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(16, 32);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(224, 20);
- this.textBox1.TabIndex = 1;
- this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(168, 56);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 2;
- this.button1.Text = "Cancel";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(80, 56);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 3;
- this.button2.Text = "Ok";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // GotoForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(254, 90);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.textBox1);
- this.Controls.Add(this.label1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "GotoForm";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Go To Line";
- this.TopMost = true;
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Button button2;
-
- }
+namespace LSLEditor
+{
+ partial class GotoWindow
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.button2 = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(16, 8);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(42, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Line nr:";
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(16, 32);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(224, 20);
+ this.textBox1.TabIndex = 1;
+ this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(168, 56);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 2;
+ this.button1.Text = "Cancel";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // button2
+ //
+ this.button2.Location = new System.Drawing.Point(80, 56);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(75, 23);
+ this.button2.TabIndex = 3;
+ this.button2.Text = "Ok";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.button2_Click);
+ //
+ // GotoForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(254, 90);
+ this.Controls.Add(this.button2);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.textBox1);
+ this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "GotoForm";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Go To Line";
+ this.TopMost = true;
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Button button2;
+
+ }
}
\ No newline at end of file
diff --git a/trunk/GotoWindow.cs b/source/GotoWindow.cs
similarity index 97%
rename from trunk/GotoWindow.cs
rename to source/GotoWindow.cs
index 2e3f932..d1225a4 100644
--- a/trunk/GotoWindow.cs
+++ b/source/GotoWindow.cs
@@ -1,89 +1,89 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Windows.Forms;
-
-namespace LSLEditor
-{
- public partial class GotoWindow : Form
- {
- private LSLEditorForm lslEditForm;
- public GotoWindow(LSLEditorForm lslEditForm)
- {
- InitializeComponent();
- this.Icon = lslEditForm.Icon;
- this.lslEditForm = lslEditForm;
-
- EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
- this.label1.Text = "Line number (1-" + editForm.TextBox.Lines.Length + ")";
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- private void Goto()
- {
- EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
- if (editForm != null) {
- try {
- int intLine = Convert.ToInt32(this.textBox1.Text);
- editForm.TextBox.Goto(intLine);
- this.Close();
- } catch { }
- }
- }
-
- private void button2_Click(object sender, EventArgs e)
- {
- Goto();
- }
-
- private void textBox1_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Return) {
- Goto();
- e.SuppressKeyPress = true;
- }
-
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Windows.Forms;
+
+namespace LSLEditor
+{
+ public partial class GotoWindow : Form
+ {
+ private LSLEditorForm lslEditForm;
+ public GotoWindow(LSLEditorForm lslEditForm)
+ {
+ InitializeComponent();
+ this.Icon = lslEditForm.Icon;
+ this.lslEditForm = lslEditForm;
+
+ EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
+ this.label1.Text = "Line number (1-" + editForm.TextBox.Lines.Length + ")";
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void Goto()
+ {
+ EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
+ if (editForm != null) {
+ try {
+ int intLine = Convert.ToInt32(this.textBox1.Text);
+ editForm.TextBox.Goto(intLine);
+ this.Close();
+ } catch { }
+ }
+ }
+
+ private void button2_Click(object sender, EventArgs e)
+ {
+ Goto();
+ }
+
+ private void textBox1_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Return) {
+ Goto();
+ e.SuppressKeyPress = true;
+ }
+
+ }
+ }
+}
diff --git a/trunk/GotoWindow.resx b/source/GotoWindow.resx
similarity index 97%
rename from trunk/GotoWindow.resx
rename to source/GotoWindow.resx
index ff31a6d..19dc0dd 100644
--- a/trunk/GotoWindow.resx
+++ b/source/GotoWindow.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/trunk/Helpers/AutoFormatter.cs b/source/Helpers/AutoFormatter.cs
similarity index 96%
rename from trunk/Helpers/AutoFormatter.cs
rename to source/Helpers/AutoFormatter.cs
index 44c3c27..eb72c13 100644
--- a/trunk/Helpers/AutoFormatter.cs
+++ b/source/Helpers/AutoFormatter.cs
@@ -1,372 +1,372 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.Text;
-
-using System.Collections.Generic;
-
-namespace LSLEditor
-{
- class AutoFormatter
- {
- public static string GetTab()
- {
- if (Properties.Settings.Default.SL4SpacesIndent)
- return " ";
- else
- return "\t";
- }
-
- private static int CountParenthesis(string strLine)
- {
- int intParenthesis=0;
- bool blnWithinString = false;
- for (int intI = 0; intI < strLine.Length; intI++)
- {
- if (strLine[intI] == '"')
- blnWithinString = !blnWithinString;
- if (blnWithinString)
- {
- if (strLine[intI] == '\\')
- intI++;
- continue;
- }
- if (strLine[intI] == '/')
- {
- if(intI<(strLine.Length-1))
- if (strLine[intI + 1] == '/')
- break;
- }
- if (strLine[intI] == '{')
- intParenthesis++;
- if (strLine[intI] == '}')
- intParenthesis--;
- }
- return intParenthesis;
- }
-
- private static int GetTabCountFromWhiteSpace(string strWhiteSpace)
- {
- int intSpaces = 0;
- for (int intI = 0; intI < strWhiteSpace.Length; intI++)
- {
- if(strWhiteSpace[intI]==' ')
- intSpaces++;
- if (strWhiteSpace[intI] == '\t')
- intSpaces = (int)(6 * (intSpaces / 6)) + 6 - (intSpaces % 6);
- }
- if (Properties.Settings.Default.SL4SpacesIndent)
- return intSpaces / 4;
- else
- return intSpaces / 6;
- }
-
- public static string GetWhiteSpaceFromLine(string strLine)
- {
- StringBuilder sb = new StringBuilder();
- for (int intI = 0; intI < strLine.Length; intI++)
- {
- if (strLine[intI] > ' ')
- break;
- sb.Append(strLine[intI]);
- }
- return sb.ToString();
- }
-
- private static int GetTabCountFromLine(string strLine, out int intOnce)
- {
- StringBuilder sb = new StringBuilder();
- int intCountParenthesis = CountParenthesis(strLine);
- if(intCountParenthesis<0)
- intCountParenthesis = 0;
- for (int intI = 0; intI < strLine.Length; intI++)
- {
- if (strLine[intI] > ' ')
- break;
- sb.Append(strLine[intI]);
- }
-
- intOnce = 0;
-
- strLine = TrimCommentTrim(strLine);
-
- int intLength = strLine.Length;
- if (intLength > 0)
- {
- char chrLastChar = strLine[intLength - 1];
- if (strLine[0] == '{' || chrLastChar == ';' || chrLastChar == '{' || chrLastChar == '}')
- intOnce = 0;
- else
- intOnce = 1;
- // this only valid for typing
- if (intCountParenthesis == 0 && chrLastChar == '{')
- intCountParenthesis++;
- }
-
- return GetTabCountFromWhiteSpace(sb.ToString()) + intCountParenthesis + intOnce;
- }
-
- public static string RemoveComment(string strLine)
- {
- bool blnWithinString = false;
- for (int intI = 0; intI < (strLine.Length - 1); intI++)
- {
- char chrC = strLine[intI];
- if (chrC == '"')
- blnWithinString = !blnWithinString;
- if (blnWithinString)
- {
- if (chrC == '\\')
- intI++;
- continue;
- }
- if (chrC != '/')
- continue;
- if (strLine[intI + 1] == '/')
- {
- //if(strLine.IndexOf("@include") != intI + 2)
- //{
- strLine = strLine.Substring(0, intI);
- //}
- break;
- }
- }
- return strLine;
- }
-
- public static string RemoveCommentsFromLines(string strLines)
- {
- StringBuilder sb = new StringBuilder();
- StringReader sr = new StringReader(strLines);
- while (true)
- {
- string strLine = sr.ReadLine();
- if (strLine == null)
- break;
- sb.AppendLine(RemoveComment(strLine));
- }
- return sb.ToString();
- }
-
- private static string TrimCommentTrim(string strLine)
- {
- return RemoveComment(strLine).Trim();
- }
-
- public static string GetNewWhiteSpace(string[] lines, int intIndex)
- {
- int intTab = 0;
- int intOnce = 0;
- string strLine = "";
- StringBuilder sb = new StringBuilder();
-
- while (intIndex>=0 && intIndex 0)
- {
- intTab = GetTabCountFromLine(strLine, out intOnce);
- break;
- }
- intIndex--;
- }
-
- if (TrimCommentTrim(strLine) != "{")
- {
- intIndex--;
- while (intIndex >= 0 && intIndex < lines.Length)
- {
- strLine = lines[intIndex];
- if (TrimCommentTrim(strLine).Length > 0)
- {
- GetTabCountFromLine(strLine, out intOnce);
- break;
- }
- intIndex--;
- }
- }
-
- for (int intI = 0; intI < (intTab - intOnce); intI++)
- sb.Append(AutoFormatter.GetTab());
-
- return sb.ToString();
- }
-
- public static string ApplyFormatting(int intTab, string strInput)
- {
- StringBuilder sb = new StringBuilder();
- StringReader sr = new StringReader(strInput);
-
- Stack stack = new Stack();
- stack.Push(intTab);
-
- int intTemp = 0;
- while (true)
- {
- string strLine = sr.ReadLine();
- if (strLine == null)
- break;
-
- // trim whitespace, this is a clean line
- strLine = strLine.Trim();
-
- // empty lines do not contain tabs
- if (strLine.Length == 0)
- {
- sb.Append('\n');
- continue;
- }
-
- // print current line, on current indent level
- int intCorrection = 0;
- if (strLine[0] == '{' || strLine[0] == '}')
- intCorrection--;
- for (int intI = 0; intI < (intTab + intTemp + intCorrection); intI++)
- sb.Append(GetTab());
- sb.Append(strLine);
- sb.Append('\n');
-
-
- // calculate next indent level
- strLine = TrimCommentTrim(strLine);
-
- int intParenthesis = CountParenthesis(strLine);
-
- if (intParenthesis > 0)
- {
- for (int intP = 0; intP < intParenthesis; intP++)
- {
- stack.Push(intTab);
- if (strLine != "{")
- intTab++;
- }
- intTab += intTemp;
- intTemp = 0;
- }
- else if (intParenthesis < 0)
- {
- if (stack.Count > 0)
- intTab = stack.Pop();
- intTemp = 0;
- }
- else
- {
- if (strLine.Length > 0)
- {
- char chrFirstChar = strLine[0];
- char chrLastChar = strLine[strLine.Length - 1];
- intTemp++;
-
- if (chrFirstChar == '|' || chrLastChar == '|')
- intTemp = 1;
- if (chrFirstChar == '+' || chrLastChar == '+')
- intTemp = 1;
- if (chrFirstChar == '-' || chrLastChar == '-')
- intTemp = 1;
- if (chrLastChar == ',' || chrLastChar == ',')
- intTemp = 1;
- if (chrLastChar == ';' || chrLastChar == '}')
- intTemp = 0;
- }
- }
- }
-
- if (!strInput.EndsWith("\n"))
- return sb.ToString().TrimEnd(new char[] { '\n' });
- else
- return sb.ToString();
- }
-
- public static string MultiLineTab(bool blnAdd, string strText)
- {
- string strPrefix = GetTab();
- StringBuilder sb = new StringBuilder();
- StringReader sr = new StringReader(strText);
- while (true)
- {
- string strLine = sr.ReadLine();
- if (strLine == null)
- break;
- if (blnAdd)
- {
- sb.Append(strPrefix);
- }
- else
- {
- if (strLine.StartsWith(strPrefix))
- strLine = strLine.Substring(strPrefix.Length);
- }
- sb.Append(strLine);
- sb.Append('\n');
- }
- return sb.ToString();
- }
-
-
- public static string MultiLineComment(bool blnAdd, int intTab, string strText)
- {
- string strPrefix = "//";
- StringBuilder sb = new StringBuilder();
- StringReader sr = new StringReader(strText);
- while (true)
- {
- string strLine = sr.ReadLine();
- if (strLine == null)
- break;
-
- if (blnAdd)
- {
- sb.Append(strPrefix);
- }
- else
- {
- strLine = strLine.Trim();
- if (strLine.StartsWith(strPrefix))
- strLine = strLine.Substring(strPrefix.Length);
- }
- sb.Append(strLine);
- sb.Append('\n');
- }
- return ApplyFormatting(intTab,sb.ToString());
- }
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.Text;
+
+using System.Collections.Generic;
+
+namespace LSLEditor
+{
+ class AutoFormatter
+ {
+ public static string GetTab()
+ {
+ if (Properties.Settings.Default.SL4SpacesIndent)
+ return " ";
+ else
+ return "\t";
+ }
+
+ private static int CountParenthesis(string strLine)
+ {
+ int intParenthesis=0;
+ bool blnWithinString = false;
+ for (int intI = 0; intI < strLine.Length; intI++)
+ {
+ if (strLine[intI] == '"')
+ blnWithinString = !blnWithinString;
+ if (blnWithinString)
+ {
+ if (strLine[intI] == '\\')
+ intI++;
+ continue;
+ }
+ if (strLine[intI] == '/')
+ {
+ if(intI<(strLine.Length-1))
+ if (strLine[intI + 1] == '/')
+ break;
+ }
+ if (strLine[intI] == '{')
+ intParenthesis++;
+ if (strLine[intI] == '}')
+ intParenthesis--;
+ }
+ return intParenthesis;
+ }
+
+ private static int GetTabCountFromWhiteSpace(string strWhiteSpace)
+ {
+ int intSpaces = 0;
+ for (int intI = 0; intI < strWhiteSpace.Length; intI++)
+ {
+ if(strWhiteSpace[intI]==' ')
+ intSpaces++;
+ if (strWhiteSpace[intI] == '\t')
+ intSpaces = (int)(6 * (intSpaces / 6)) + 6 - (intSpaces % 6);
+ }
+ if (Properties.Settings.Default.SL4SpacesIndent)
+ return intSpaces / 4;
+ else
+ return intSpaces / 6;
+ }
+
+ public static string GetWhiteSpaceFromLine(string strLine)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (int intI = 0; intI < strLine.Length; intI++)
+ {
+ if (strLine[intI] > ' ')
+ break;
+ sb.Append(strLine[intI]);
+ }
+ return sb.ToString();
+ }
+
+ private static int GetTabCountFromLine(string strLine, out int intOnce)
+ {
+ StringBuilder sb = new StringBuilder();
+ int intCountParenthesis = CountParenthesis(strLine);
+ if(intCountParenthesis<0)
+ intCountParenthesis = 0;
+ for (int intI = 0; intI < strLine.Length; intI++)
+ {
+ if (strLine[intI] > ' ')
+ break;
+ sb.Append(strLine[intI]);
+ }
+
+ intOnce = 0;
+
+ strLine = TrimCommentTrim(strLine);
+
+ int intLength = strLine.Length;
+ if (intLength > 0)
+ {
+ char chrLastChar = strLine[intLength - 1];
+ if (strLine[0] == '{' || chrLastChar == ';' || chrLastChar == '{' || chrLastChar == '}')
+ intOnce = 0;
+ else
+ intOnce = 1;
+ // this only valid for typing
+ if (intCountParenthesis == 0 && chrLastChar == '{')
+ intCountParenthesis++;
+ }
+
+ return GetTabCountFromWhiteSpace(sb.ToString()) + intCountParenthesis + intOnce;
+ }
+
+ public static string RemoveComment(string strLine)
+ {
+ bool blnWithinString = false;
+ for (int intI = 0; intI < (strLine.Length - 1); intI++)
+ {
+ char chrC = strLine[intI];
+ if (chrC == '"')
+ blnWithinString = !blnWithinString;
+ if (blnWithinString)
+ {
+ if (chrC == '\\')
+ intI++;
+ continue;
+ }
+ if (chrC != '/')
+ continue;
+ if (strLine[intI + 1] == '/')
+ {
+ //if(strLine.IndexOf("@include") != intI + 2)
+ //{
+ strLine = strLine.Substring(0, intI);
+ //}
+ break;
+ }
+ }
+ return strLine;
+ }
+
+ public static string RemoveCommentsFromLines(string strLines)
+ {
+ StringBuilder sb = new StringBuilder();
+ StringReader sr = new StringReader(strLines);
+ while (true)
+ {
+ string strLine = sr.ReadLine();
+ if (strLine == null)
+ break;
+ sb.AppendLine(RemoveComment(strLine));
+ }
+ return sb.ToString();
+ }
+
+ private static string TrimCommentTrim(string strLine)
+ {
+ return RemoveComment(strLine).Trim();
+ }
+
+ public static string GetNewWhiteSpace(string[] lines, int intIndex)
+ {
+ int intTab = 0;
+ int intOnce = 0;
+ string strLine = "";
+ StringBuilder sb = new StringBuilder();
+
+ while (intIndex>=0 && intIndex 0)
+ {
+ intTab = GetTabCountFromLine(strLine, out intOnce);
+ break;
+ }
+ intIndex--;
+ }
+
+ if (TrimCommentTrim(strLine) != "{")
+ {
+ intIndex--;
+ while (intIndex >= 0 && intIndex < lines.Length)
+ {
+ strLine = lines[intIndex];
+ if (TrimCommentTrim(strLine).Length > 0)
+ {
+ GetTabCountFromLine(strLine, out intOnce);
+ break;
+ }
+ intIndex--;
+ }
+ }
+
+ for (int intI = 0; intI < (intTab - intOnce); intI++)
+ sb.Append(AutoFormatter.GetTab());
+
+ return sb.ToString();
+ }
+
+ public static string ApplyFormatting(int intTab, string strInput)
+ {
+ StringBuilder sb = new StringBuilder();
+ StringReader sr = new StringReader(strInput);
+
+ Stack stack = new Stack();
+ stack.Push(intTab);
+
+ int intTemp = 0;
+ while (true)
+ {
+ string strLine = sr.ReadLine();
+ if (strLine == null)
+ break;
+
+ // trim whitespace, this is a clean line
+ strLine = strLine.Trim();
+
+ // empty lines do not contain tabs
+ if (strLine.Length == 0)
+ {
+ sb.Append('\n');
+ continue;
+ }
+
+ // print current line, on current indent level
+ int intCorrection = 0;
+ if (strLine[0] == '{' || strLine[0] == '}')
+ intCorrection--;
+ for (int intI = 0; intI < (intTab + intTemp + intCorrection); intI++)
+ sb.Append(GetTab());
+ sb.Append(strLine);
+ sb.Append('\n');
+
+
+ // calculate next indent level
+ strLine = TrimCommentTrim(strLine);
+
+ int intParenthesis = CountParenthesis(strLine);
+
+ if (intParenthesis > 0)
+ {
+ for (int intP = 0; intP < intParenthesis; intP++)
+ {
+ stack.Push(intTab);
+ if (strLine != "{")
+ intTab++;
+ }
+ intTab += intTemp;
+ intTemp = 0;
+ }
+ else if (intParenthesis < 0)
+ {
+ if (stack.Count > 0)
+ intTab = stack.Pop();
+ intTemp = 0;
+ }
+ else
+ {
+ if (strLine.Length > 0)
+ {
+ char chrFirstChar = strLine[0];
+ char chrLastChar = strLine[strLine.Length - 1];
+ intTemp++;
+
+ if (chrFirstChar == '|' || chrLastChar == '|')
+ intTemp = 1;
+ if (chrFirstChar == '+' || chrLastChar == '+')
+ intTemp = 1;
+ if (chrFirstChar == '-' || chrLastChar == '-')
+ intTemp = 1;
+ if (chrLastChar == ',' || chrLastChar == ',')
+ intTemp = 1;
+ if (chrLastChar == ';' || chrLastChar == '}')
+ intTemp = 0;
+ }
+ }
+ }
+
+ if (!strInput.EndsWith("\n"))
+ return sb.ToString().TrimEnd(new char[] { '\n' });
+ else
+ return sb.ToString();
+ }
+
+ public static string MultiLineTab(bool blnAdd, string strText)
+ {
+ string strPrefix = GetTab();
+ StringBuilder sb = new StringBuilder();
+ StringReader sr = new StringReader(strText);
+ while (true)
+ {
+ string strLine = sr.ReadLine();
+ if (strLine == null)
+ break;
+ if (blnAdd)
+ {
+ sb.Append(strPrefix);
+ }
+ else
+ {
+ if (strLine.StartsWith(strPrefix))
+ strLine = strLine.Substring(strPrefix.Length);
+ }
+ sb.Append(strLine);
+ sb.Append('\n');
+ }
+ return sb.ToString();
+ }
+
+
+ public static string MultiLineComment(bool blnAdd, int intTab, string strText)
+ {
+ string strPrefix = "//";
+ StringBuilder sb = new StringBuilder();
+ StringReader sr = new StringReader(strText);
+ while (true)
+ {
+ string strLine = sr.ReadLine();
+ if (strLine == null)
+ break;
+
+ if (blnAdd)
+ {
+ sb.Append(strPrefix);
+ }
+ else
+ {
+ strLine = strLine.Trim();
+ if (strLine.StartsWith(strPrefix))
+ strLine = strLine.Substring(strPrefix.Length);
+ }
+ sb.Append(strLine);
+ sb.Append('\n');
+ }
+ return ApplyFormatting(intTab,sb.ToString());
+ }
+
+ }
+}
diff --git a/trunk/Helpers/CodeCompletion.cs b/source/Helpers/CodeCompletion.cs
similarity index 97%
rename from trunk/Helpers/CodeCompletion.cs
rename to source/Helpers/CodeCompletion.cs
index d17531c..1214c51 100644
--- a/trunk/Helpers/CodeCompletion.cs
+++ b/source/Helpers/CodeCompletion.cs
@@ -1,100 +1,100 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System.Collections.Generic;
-using System.Drawing;
-using System.Text.RegularExpressions;
-
-namespace LSLEditor.Helpers
-{
- class CodeCompletion
- {
- Regex regex;
-
- public CodeCompletion()
- {
- this.regex = new Regex(
- @"
-\b(?integer|float|string|vector|rotation|state|key|list)\s
-(?>
- \s* (?[\w]*) \s*
- (?>\= \s*
- (?:
- (?>
- [^(),;]+
- | \( (?)
- | \) (?<-nr>)
- )*
- (?(nr)(?!))
- )
- \s*)? [,;)]
-)*
-"
- ,
- RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
- }
-
- public void CodeCompletionUserVar(string strKeyWord, string strTextIn, int intStart, List list)
- {
- if (intStart == 0)
- return;
- string strText = strTextIn.Substring(0, intStart);
- string strLowerCaseKeyWord = strKeyWord.ToLower();
- foreach (Match m in regex.Matches(strText))
- {
- if (m.Groups.Count == 4)
- {
- string strType = m.Groups[1].ToString();
- foreach (Capture cap in m.Groups[2].Captures)
- {
- string strName = cap.ToString();
- if (strName.ToLower().StartsWith(strLowerCaseKeyWord))
- {
- KeyWordInfo ki = new KeyWordInfo(KeyWordTypeEnum.Vars, strName, Color.Red);
- if (!list.Contains(ki))
- list.Add(ki);
- }
- if (strType == "list" || strType == "vector" || strType == "rotation")
- break;
- }
- }
- }
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text.RegularExpressions;
+
+namespace LSLEditor.Helpers
+{
+ class CodeCompletion
+ {
+ Regex regex;
+
+ public CodeCompletion()
+ {
+ this.regex = new Regex(
+ @"
+\b(?integer|float|string|vector|rotation|state|key|list)\s
+(?>
+ \s* (?[\w]*) \s*
+ (?>\= \s*
+ (?:
+ (?>
+ [^(),;]+
+ | \( (?)
+ | \) (?<-nr>)
+ )*
+ (?(nr)(?!))
+ )
+ \s*)? [,;)]
+)*
+"
+ ,
+ RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
+ }
+
+ public void CodeCompletionUserVar(string strKeyWord, string strTextIn, int intStart, List list)
+ {
+ if (intStart == 0)
+ return;
+ string strText = strTextIn.Substring(0, intStart);
+ string strLowerCaseKeyWord = strKeyWord.ToLower();
+ foreach (Match m in regex.Matches(strText))
+ {
+ if (m.Groups.Count == 4)
+ {
+ string strType = m.Groups[1].ToString();
+ foreach (Capture cap in m.Groups[2].Captures)
+ {
+ string strName = cap.ToString();
+ if (strName.ToLower().StartsWith(strLowerCaseKeyWord))
+ {
+ KeyWordInfo ki = new KeyWordInfo(KeyWordTypeEnum.Vars, strName, Color.Red);
+ if (!list.Contains(ki))
+ list.Add(ki);
+ }
+ if (strType == "list" || strType == "vector" || strType == "rotation")
+ break;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/trunk/Helpers/CompilerHelper.cs b/source/Helpers/CompilerHelper.cs
similarity index 97%
rename from trunk/Helpers/CompilerHelper.cs
rename to source/Helpers/CompilerHelper.cs
index 6e1928d..23e9589 100644
--- a/trunk/Helpers/CompilerHelper.cs
+++ b/source/Helpers/CompilerHelper.cs
@@ -1,141 +1,141 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Windows.Forms;
-using System.CodeDom.Compiler;
-using Microsoft.CSharp;
-
-namespace LSLEditor.Helpers
-{
- class CompilerHelper
- {
- private static int FindDefaultLineNumber(string strCode)
- {
- StringReader sr = new StringReader(strCode);
- int intI = 0;
- while (true)
- {
- string strLine = sr.ReadLine();
- if (strLine == null)
- break;
- if (strLine.StartsWith("class State_default"))
- return intI;
- intI++;
- }
- return intI;
- }
-
- public static Assembly CompileCSharp(EditForm editForm, string CSharpCode)
- {
- // Code compiler and provider
- CodeDomProvider cc = new CSharpCodeProvider();
-
- // Compiler parameters
- CompilerParameters cp = new CompilerParameters();
-
- // Sept 15, 2007 -> 3, 30 oct 2007 -> 4
- if(!Properties.Settings.Default.SkipWarnings)
- cp.WarningLevel = 4;
-
- // Add common assemblies
- cp.ReferencedAssemblies.Add("System.dll");
- cp.ReferencedAssemblies.Add("System.Windows.Forms.dll");
-
- // LSLEditor.exe contains all base SecondLife class stuff
- cp.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
-
- // Compiling to memory
- cp.GenerateInMemory = true;
-
- // Does this work?
- cp.IncludeDebugInformation = true;
-
- // Wrap strCSharpCode into my namespace
- string strRunTime = "namespace LSLEditor\n{\n";
- strRunTime += CSharpCode;
- strRunTime += "\n}\n";
-
- int intDefaultLineNumber = FindDefaultLineNumber(strRunTime);
-
- // Here we go
- CompilerResults cr = cc.CompileAssemblyFromSource(cp, strRunTime);
-
- // get the listview to store some errors
- ListView ListViewErrors = editForm.parent.SyntaxErrors.ListView;
-
- // Console.WriteLine(cr.Errors.HasWarnings.ToString());
- // Check for compilation errors...
- if (ListViewErrors != null && (cr.Errors.HasErrors || cr.Errors.HasWarnings))
- {
- int intNr = 1;
- foreach (CompilerError err in cr.Errors)
- {
- int intLine = err.Line;
- if (intLine < intDefaultLineNumber)
- intLine -= 4;
- else
- intLine -= 5;
- string strError = OopsFormatter.ApplyFormatting(err.ErrorText);
- int intImageIndex = 0;
- if (err.IsWarning)
- intImageIndex = 1;
- ListViewItem lvi = new ListViewItem(new string[] {
- "", // 0
- intNr.ToString(), // 1
- strError, // 2
- editForm.ScriptName, // 3
- intLine.ToString(), // 4
- err.Column.ToString(), // 5
- editForm.ProjectName , // 6
- editForm.FullPathName, // 7
- editForm.guid.ToString(),// 8
- editForm.IsScript.ToString()// 9
- } , intImageIndex);
- ListViewErrors.Items.Add(lvi);
- intNr++;
- }
- return null;
- }
- return cr.CompiledAssembly;
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Windows.Forms;
+using System.CodeDom.Compiler;
+using Microsoft.CSharp;
+
+namespace LSLEditor.Helpers
+{
+ class CompilerHelper
+ {
+ private static int FindDefaultLineNumber(string strCode)
+ {
+ StringReader sr = new StringReader(strCode);
+ int intI = 0;
+ while (true)
+ {
+ string strLine = sr.ReadLine();
+ if (strLine == null)
+ break;
+ if (strLine.StartsWith("class State_default"))
+ return intI;
+ intI++;
+ }
+ return intI;
+ }
+
+ public static Assembly CompileCSharp(EditForm editForm, string CSharpCode)
+ {
+ // Code compiler and provider
+ CodeDomProvider cc = new CSharpCodeProvider();
+
+ // Compiler parameters
+ CompilerParameters cp = new CompilerParameters();
+
+ // Sept 15, 2007 -> 3, 30 oct 2007 -> 4
+ if(!Properties.Settings.Default.SkipWarnings)
+ cp.WarningLevel = 4;
+
+ // Add common assemblies
+ cp.ReferencedAssemblies.Add("System.dll");
+ cp.ReferencedAssemblies.Add("System.Windows.Forms.dll");
+
+ // LSLEditor.exe contains all base SecondLife class stuff
+ cp.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
+
+ // Compiling to memory
+ cp.GenerateInMemory = true;
+
+ // Does this work?
+ cp.IncludeDebugInformation = true;
+
+ // Wrap strCSharpCode into my namespace
+ string strRunTime = "namespace LSLEditor\n{\n";
+ strRunTime += CSharpCode;
+ strRunTime += "\n}\n";
+
+ int intDefaultLineNumber = FindDefaultLineNumber(strRunTime);
+
+ // Here we go
+ CompilerResults cr = cc.CompileAssemblyFromSource(cp, strRunTime);
+
+ // get the listview to store some errors
+ ListView ListViewErrors = editForm.parent.SyntaxErrors.ListView;
+
+ // Console.WriteLine(cr.Errors.HasWarnings.ToString());
+ // Check for compilation errors...
+ if (ListViewErrors != null && (cr.Errors.HasErrors || cr.Errors.HasWarnings))
+ {
+ int intNr = 1;
+ foreach (CompilerError err in cr.Errors)
+ {
+ int intLine = err.Line;
+ if (intLine < intDefaultLineNumber)
+ intLine -= 4;
+ else
+ intLine -= 5;
+ string strError = OopsFormatter.ApplyFormatting(err.ErrorText);
+ int intImageIndex = 0;
+ if (err.IsWarning)
+ intImageIndex = 1;
+ ListViewItem lvi = new ListViewItem(new string[] {
+ "", // 0
+ intNr.ToString(), // 1
+ strError, // 2
+ editForm.ScriptName, // 3
+ intLine.ToString(), // 4
+ err.Column.ToString(), // 5
+ editForm.ProjectName , // 6
+ editForm.FullPathName, // 7
+ editForm.guid.ToString(),// 8
+ editForm.IsScript.ToString()// 9
+ } , intImageIndex);
+ ListViewErrors.Items.Add(lvi);
+ intNr++;
+ }
+ return null;
+ }
+ return cr.CompiledAssembly;
+ }
+ }
+}
diff --git a/trunk/Helpers/FileAssociator.cs b/source/Helpers/FileAssociator.cs
similarity index 97%
rename from trunk/Helpers/FileAssociator.cs
rename to source/Helpers/FileAssociator.cs
index a5e594b..bed426c 100644
--- a/trunk/Helpers/FileAssociator.cs
+++ b/source/Helpers/FileAssociator.cs
@@ -1,111 +1,111 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Text;
-using Microsoft.Win32;
-
-
-namespace LSLEditor.Helpers
-{
- class FileAssociator
- {
- // Associate file extension with progID, description, icon and application
- public static bool Associate(string strExtension, string strFileNameType, string strDescription, string strApplication,int intIconNr)
- {
- try
- {
- Registry.ClassesRoot.CreateSubKey(strExtension).SetValue("", strFileNameType);
- if (strFileNameType != null && strFileNameType.Length > 0)
- {
- using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(strFileNameType))
- {
- if (strDescription != null)
- key.SetValue("", strDescription);
- if (strApplication != null)
- {
- key.CreateSubKey("DefaultIcon").SetValue("", strApplication + "," + intIconNr);
- key.CreateSubKey(@"Shell\Open\Command").SetValue("", "\"" + strApplication + "\" \"%1\"");
- }
- }
- }
- return true;
- }
- catch
- {
- return false;
- }
- }
-
- public static bool DeAssociate(string strExtension, string strFileNameType)
- {
- try
- {
- Registry.ClassesRoot.DeleteSubKey(strExtension);
- Registry.ClassesRoot.DeleteSubKeyTree(strFileNameType);
- return true;
- }
- catch
- {
- return false;
- }
- }
-
- // Return true if extension already associated in registry
- public static bool IsAssociated(string strExtension)
- {
- try
- {
- return (Registry.ClassesRoot.OpenSubKey(strExtension, false) != null);
- }
- catch
- {
- return false;
- }
- }
-
- private void Test()
- {
- if (!IsAssociated(".lsl"))
- Associate(".lsl", "LSLEditorScript", "SecondLife lsl File for LSLEditor", System.Reflection.Assembly.GetExecutingAssembly().Location, 0);
- DeAssociate(".lsl", "LSLEditorScript");
- }
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Text;
+using Microsoft.Win32;
+
+
+namespace LSLEditor.Helpers
+{
+ class FileAssociator
+ {
+ // Associate file extension with progID, description, icon and application
+ public static bool Associate(string strExtension, string strFileNameType, string strDescription, string strApplication,int intIconNr)
+ {
+ try
+ {
+ Registry.ClassesRoot.CreateSubKey(strExtension).SetValue("", strFileNameType);
+ if (strFileNameType != null && strFileNameType.Length > 0)
+ {
+ using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(strFileNameType))
+ {
+ if (strDescription != null)
+ key.SetValue("", strDescription);
+ if (strApplication != null)
+ {
+ key.CreateSubKey("DefaultIcon").SetValue("", strApplication + "," + intIconNr);
+ key.CreateSubKey(@"Shell\Open\Command").SetValue("", "\"" + strApplication + "\" \"%1\"");
+ }
+ }
+ }
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ public static bool DeAssociate(string strExtension, string strFileNameType)
+ {
+ try
+ {
+ Registry.ClassesRoot.DeleteSubKey(strExtension);
+ Registry.ClassesRoot.DeleteSubKeyTree(strFileNameType);
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ // Return true if extension already associated in registry
+ public static bool IsAssociated(string strExtension)
+ {
+ try
+ {
+ return (Registry.ClassesRoot.OpenSubKey(strExtension, false) != null);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ private void Test()
+ {
+ if (!IsAssociated(".lsl"))
+ Associate(".lsl", "LSLEditorScript", "SecondLife lsl File for LSLEditor", System.Reflection.Assembly.GetExecutingAssembly().Location, 0);
+ DeAssociate(".lsl", "LSLEditorScript");
+ }
+
+ }
+}
diff --git a/trunk/Helpers/GetTemplate.cs b/source/Helpers/GetTemplate.cs
similarity index 97%
rename from trunk/Helpers/GetTemplate.cs
rename to source/Helpers/GetTemplate.cs
index 090e210..1f89262 100644
--- a/trunk/Helpers/GetTemplate.cs
+++ b/source/Helpers/GetTemplate.cs
@@ -1,67 +1,67 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Reflection;
-using System.IO;
-
-namespace LSLEditor.Helpers
-{
- class GetTemplate
- {
- public static string Source()
- {
- try
- {
- string strTemplate = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Properties.Settings.Default.ExampleTemplate);
- if (File.Exists(strTemplate))
- {
- StreamReader sr = new StreamReader(strTemplate);
- string strCode = sr.ReadToEnd();
- sr.Close();
- return strCode;
- }
- }
- catch
- {
- }
- return Properties.Settings.Default.Example;
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Reflection;
+using System.IO;
+
+namespace LSLEditor.Helpers
+{
+ class GetTemplate
+ {
+ public static string Source()
+ {
+ try
+ {
+ string strTemplate = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Properties.Settings.Default.ExampleTemplate);
+ if (File.Exists(strTemplate))
+ {
+ StreamReader sr = new StreamReader(strTemplate);
+ string strCode = sr.ReadToEnd();
+ sr.Close();
+ return strCode;
+ }
+ }
+ catch
+ {
+ }
+ return Properties.Settings.Default.Example;
+ }
+ }
+}
diff --git a/trunk/Helpers/GroupboxEvent.cs b/source/Helpers/GroupboxEvent.cs
similarity index 96%
rename from trunk/Helpers/GroupboxEvent.cs
rename to source/Helpers/GroupboxEvent.cs
index ce0da2f..ff066fe 100644
--- a/trunk/Helpers/GroupboxEvent.cs
+++ b/source/Helpers/GroupboxEvent.cs
@@ -1,186 +1,186 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace LSLEditor
-{
- ///
- /// Summary description for GroupboxTextbox.
- ///
- public class GroupboxEvent : System.Windows.Forms.GroupBox
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.Container components = null;
-
- public GroupboxEvent(Point pt,string strName,string strArgs,System.EventHandler eventHandler)
- {
- // This call is required by the Windows.Forms Form Designer.
- InitializeComponent();
- this.Location = pt;
-
- string[] args = strArgs.Trim().Split(new char[] {','});
- int intX=5;
- int intY=5;
-
- if(args.Length>0)
- intY += 5;
- for(int intArgumentNumber=0;intArgumentNumber["+strArgumentType+"]["+strArgumentName+"]");
- strArgumentValue = "unknown";
- break;
- }
-
- GroupBox groupbox = new GroupBox();
- groupbox.Name = strName+"_"+intArgumentNumber;
- groupbox.Text = strArgumentName;
- groupbox.Location = new Point(5,intY);
- groupbox.Width = this.Width - 10;
-
- Control control = null;
- if (strName == "listen" && intArgumentNumber==0)
- {
- ComboBox comboBox = new ComboBox();
- comboBox.Text = "";
- control = comboBox;
- }
- else
- {
- TextBox textBox = new TextBox();
- textBox.Text = strArgumentValue;
- control = textBox;
- }
- control.Name = "textBox_" + strName + "_" + intArgumentNumber;
- control.Location = new Point(5, 15);
- groupbox.Controls.Add(control);
- groupbox.Height = 20 + control.Height;
- this.Controls.Add(groupbox);
- intY += groupbox.Height;
- }
- else
- {
- if(strArgs!="")
- MessageBox.Show("Argument must be 'type name' ["+strArgs+"]");
- }
- }
-
- intY += 5;
-
- Button button = new Button();
- button.Text = strName;
- button.Width = 130;
- button.Location = new Point(intX,intY);
- button.Click += eventHandler;
- this.Controls.Add(button);
- this.Height = intY + button.Height + 5;
- }
-
- ///
- /// Clean up any resources being used.
- ///
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Component Designer generated code
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- //
- // GroupboxTextbox
- //
- this.Name = "GroupboxTextbox";
- this.Size = new System.Drawing.Size(152, 96);
-
- }
- #endregion
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace LSLEditor
+{
+ ///
+ /// Summary description for GroupboxTextbox.
+ ///
+ public class GroupboxEvent : System.Windows.Forms.GroupBox
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.Container components = null;
+
+ public GroupboxEvent(Point pt,string strName,string strArgs,System.EventHandler eventHandler)
+ {
+ // This call is required by the Windows.Forms Form Designer.
+ InitializeComponent();
+ this.Location = pt;
+
+ string[] args = strArgs.Trim().Split(new char[] {','});
+ int intX=5;
+ int intY=5;
+
+ if(args.Length>0)
+ intY += 5;
+ for(int intArgumentNumber=0;intArgumentNumber["+strArgumentType+"]["+strArgumentName+"]");
+ strArgumentValue = "unknown";
+ break;
+ }
+
+ GroupBox groupbox = new GroupBox();
+ groupbox.Name = strName+"_"+intArgumentNumber;
+ groupbox.Text = strArgumentName;
+ groupbox.Location = new Point(5,intY);
+ groupbox.Width = this.Width - 10;
+
+ Control control = null;
+ if (strName == "listen" && intArgumentNumber==0)
+ {
+ ComboBox comboBox = new ComboBox();
+ comboBox.Text = "";
+ control = comboBox;
+ }
+ else
+ {
+ TextBox textBox = new TextBox();
+ textBox.Text = strArgumentValue;
+ control = textBox;
+ }
+ control.Name = "textBox_" + strName + "_" + intArgumentNumber;
+ control.Location = new Point(5, 15);
+ groupbox.Controls.Add(control);
+ groupbox.Height = 20 + control.Height;
+ this.Controls.Add(groupbox);
+ intY += groupbox.Height;
+ }
+ else
+ {
+ if(strArgs!="")
+ MessageBox.Show("Argument must be 'type name' ["+strArgs+"]");
+ }
+ }
+
+ intY += 5;
+
+ Button button = new Button();
+ button.Text = strName;
+ button.Width = 130;
+ button.Location = new Point(intX,intY);
+ button.Click += eventHandler;
+ this.Controls.Add(button);
+ this.Height = intY + button.Height + 5;
+ }
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Component Designer generated code
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ //
+ // GroupboxTextbox
+ //
+ this.Name = "GroupboxTextbox";
+ this.Size = new System.Drawing.Size(152, 96);
+
+ }
+ #endregion
+ }
+}
diff --git a/trunk/Helpers/GroupboxEvent.resx b/source/Helpers/GroupboxEvent.resx
similarity index 97%
rename from trunk/Helpers/GroupboxEvent.resx
rename to source/Helpers/GroupboxEvent.resx
index b26f549..fcb2eab 100644
--- a/trunk/Helpers/GroupboxEvent.resx
+++ b/source/Helpers/GroupboxEvent.resx
@@ -1,130 +1,130 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 1.3
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- False
-
-
- False
-
-
- True
-
-
- True
-
-
- 80
-
-
- (Default)
-
-
- False
-
-
- Private
-
-
- GroupboxTextbox
-
-
- 8, 8
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ False
+
+
+ False
+
+
+ True
+
+
+ True
+
+
+ 80
+
+
+ (Default)
+
+
+ False
+
+
+ Private
+
+
+ GroupboxTextbox
+
+
+ 8, 8
+
\ No newline at end of file
diff --git a/trunk/Helpers/HTTPRequest.cs b/source/Helpers/HTTPRequest.cs
similarity index 97%
rename from trunk/Helpers/HTTPRequest.cs
rename to source/Helpers/HTTPRequest.cs
index e73f77c..6487f54 100644
--- a/trunk/Helpers/HTTPRequest.cs
+++ b/source/Helpers/HTTPRequest.cs
@@ -1,215 +1,215 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.IO.Compression;
-using System.Net;
-using System.Text;
-
-namespace LSLEditor
-{
- class HTTPRequest
- {
- private class UserState
- {
- public SecondLife secondlife;
- public SecondLife.key httpkey;
- public UserState(SecondLife.key httpkey, SecondLife secondlife)
- {
- this.secondlife = secondlife;
- this.httpkey = httpkey;
- }
- }
-
- public static void Request(WebProxy proxy, SecondLife secondlife, string strUrl, SecondLife.list parameters, string postData, SecondLife.key key)
- {
- string strMethod = "GET";
- string strContentType = "text/plain; charset=utf-8";
-
- for (int intI = 0; intI < parameters.Count; intI += 2)
- {
- int intKey;
- if (!int.TryParse(parameters[intI].ToString(), out intKey))
- continue;
- switch (intKey)
- {
- case 0:
- // get, post, put, delete
- strMethod = parameters[intI + 1].ToString().ToUpper();
- break;
- case 1:
- strContentType = parameters[intI + 1].ToString();
- break;
- case 2:
- // HTTP_BODY_MAXLENGTH
- break;
- case 3:
- // HTTP_VERIFY_CERT
- break;
- default:
- break;
- }
- }
-
- WebClient wc = new WebClient();
-
- wc.Headers.Add("Content-Type", strContentType);
- wc.Headers.Add("Accept", "text/*");
- wc.Headers.Add("Accept-Charset", "utf-8; q=1.0, *; q=0.5");
- wc.Headers.Add("Accept-Encoding", "deflate, gzip");
- wc.Headers.Add("User-Agent", "Second Life LSL/1.19.0(12345) (http://secondlife.com)");
-
- System.Drawing.Point point = Properties.Settings.Default.RegionCorner;
- SecondLife.vector RegionCorner = new SecondLife.vector(point.X, point.Y, 0);
-
- SecondLife.vector pos = secondlife.GetLocalPos;
-
- wc.Headers.Add("X-SecondLife-Shard", Properties.Settings.Default.XSecondLifeShard);
- wc.Headers.Add("X-SecondLife-Object-Name", secondlife.host.GetObjectName());
- wc.Headers.Add("X-SecondLife-Object-Key", secondlife.host.GetKey().ToString());
- wc.Headers.Add("X-SecondLife-Region", string.Format("{0} ({1}, {2})", Properties.Settings.Default.RegionName, (int)RegionCorner.x, (int)RegionCorner.y));
- wc.Headers.Add("X-SecondLife-Local-Position", string.Format("({0}, {1}, {2})", pos.x, pos.y, pos.z));
- wc.Headers.Add("X-SecondLife-Local-Rotation", "(0.000000, 0.000000, 0.000000, 1.000000)");
- wc.Headers.Add("X-SecondLife-Local-Velocity", "(0.000000, 0.000000, 0.000000)");
- wc.Headers.Add("X-SecondLife-Owner-Name", Properties.Settings.Default.AvatarName);
- wc.Headers.Add("X-SecondLife-Owner-Key", Properties.Settings.Default.AvatarKey);
- wc.Headers.Add("X-Forwarded-For", "127.0.0.1");
-
- if (proxy != null)
- wc.Proxy = proxy;
-
- Uri uri = new Uri(strUrl);
-
- // Basic Authentication scheme, added 28 mrt 2008
- if (uri.UserInfo != "")
- {
- string[] UserInfo = uri.UserInfo.Split(':');
- if (UserInfo.Length == 2)
- {
- CredentialCache mycache = new CredentialCache();
- mycache.Add(uri, "Basic",
- new NetworkCredential(UserInfo[0], UserInfo[1]));
- wc.Credentials = mycache;
- }
- }
-
-
- UserState userState = new UserState(key, secondlife);
-
- if (strMethod == "POST" || strMethod == "PUT")
- {
- wc.UploadDataCompleted += new UploadDataCompletedEventHandler(wc_UploadDataCompleted);
- wc.UploadDataAsync(uri, strMethod, Encoding.UTF8.GetBytes(postData), userState);
- }
- else
- {
- wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
- wc.DownloadDataAsync(uri, userState);
- }
- }
-
- private static void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
- {
- int intStatusCode = 200;
- UserState userState = (UserState)e.UserState;
- string strResult = "";
-
- if (e.Error != null)
- {
- WebException webException = e.Error as WebException;
- HttpWebResponse webResponse = webException.Response as HttpWebResponse;
- if (webResponse == null)
- {
- intStatusCode = 0;
- strResult = webException.Message;
- }
- else
- {
- intStatusCode = (int)webResponse.StatusCode;
- System.IO.StreamReader sr = new System.IO.StreamReader(webResponse.GetResponseStream());
- strResult = sr.ReadToEnd();
- }
- }
- else
- {
- if (e.Result != null)
- {
- strResult = Encoding.UTF8.GetString(e.Result);
- }
- }
- userState.secondlife.host.ExecuteSecondLife("http_response", userState.httpkey, (SecondLife.integer)intStatusCode, new SecondLife.list(), (SecondLife.String)strResult);
- }
-
- private static void wc_UploadDataCompleted(object sender, UploadDataCompletedEventArgs e)
- {
- int intStatusCode = 200;
- UserState userState = (UserState)e.UserState;
- string strResult = "";
-
- if (e.Error != null)
- {
- WebException webException = e.Error as WebException;
- HttpWebResponse webResponse = webException.Response as HttpWebResponse;
- intStatusCode = (int)webResponse.StatusCode;
- System.IO.StreamReader sr = new System.IO.StreamReader(webResponse.GetResponseStream());
- strResult = sr.ReadToEnd();
- }
- else
- {
- if (e.Result != null)
- {
- string strEncoding = ((System.Net.WebClient)sender).ResponseHeaders["Content-Encoding"];
- if (strEncoding == "gzip")
- {
- GZipStream tempE = new GZipStream(new System.IO.MemoryStream(e.Result), CompressionMode.Decompress);
-
- var sr = new StreamReader(tempE);
- strResult = sr.ReadToEnd();
- }
- else
- {
- strResult = Encoding.UTF8.GetString(e.Result);
- }
- }
- }
- userState.secondlife.host.ExecuteSecondLife("http_response", userState.httpkey, (SecondLife.integer)intStatusCode, new SecondLife.list(), (SecondLife.String)strResult);
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.IO.Compression;
+using System.Net;
+using System.Text;
+
+namespace LSLEditor
+{
+ class HTTPRequest
+ {
+ private class UserState
+ {
+ public SecondLife secondlife;
+ public SecondLife.key httpkey;
+ public UserState(SecondLife.key httpkey, SecondLife secondlife)
+ {
+ this.secondlife = secondlife;
+ this.httpkey = httpkey;
+ }
+ }
+
+ public static void Request(WebProxy proxy, SecondLife secondlife, string strUrl, SecondLife.list parameters, string postData, SecondLife.key key)
+ {
+ string strMethod = "GET";
+ string strContentType = "text/plain; charset=utf-8";
+
+ for (int intI = 0; intI < parameters.Count; intI += 2)
+ {
+ int intKey;
+ if (!int.TryParse(parameters[intI].ToString(), out intKey))
+ continue;
+ switch (intKey)
+ {
+ case 0:
+ // get, post, put, delete
+ strMethod = parameters[intI + 1].ToString().ToUpper();
+ break;
+ case 1:
+ strContentType = parameters[intI + 1].ToString();
+ break;
+ case 2:
+ // HTTP_BODY_MAXLENGTH
+ break;
+ case 3:
+ // HTTP_VERIFY_CERT
+ break;
+ default:
+ break;
+ }
+ }
+
+ WebClient wc = new WebClient();
+
+ wc.Headers.Add("Content-Type", strContentType);
+ wc.Headers.Add("Accept", "text/*");
+ wc.Headers.Add("Accept-Charset", "utf-8; q=1.0, *; q=0.5");
+ wc.Headers.Add("Accept-Encoding", "deflate, gzip");
+ wc.Headers.Add("User-Agent", "Second Life LSL/1.19.0(12345) (http://secondlife.com)");
+
+ System.Drawing.Point point = Properties.Settings.Default.RegionCorner;
+ SecondLife.vector RegionCorner = new SecondLife.vector(point.X, point.Y, 0);
+
+ SecondLife.vector pos = secondlife.GetLocalPos;
+
+ wc.Headers.Add("X-SecondLife-Shard", Properties.Settings.Default.XSecondLifeShard);
+ wc.Headers.Add("X-SecondLife-Object-Name", secondlife.host.GetObjectName());
+ wc.Headers.Add("X-SecondLife-Object-Key", secondlife.host.GetKey().ToString());
+ wc.Headers.Add("X-SecondLife-Region", string.Format("{0} ({1}, {2})", Properties.Settings.Default.RegionName, (int)RegionCorner.x, (int)RegionCorner.y));
+ wc.Headers.Add("X-SecondLife-Local-Position", string.Format("({0}, {1}, {2})", pos.x, pos.y, pos.z));
+ wc.Headers.Add("X-SecondLife-Local-Rotation", "(0.000000, 0.000000, 0.000000, 1.000000)");
+ wc.Headers.Add("X-SecondLife-Local-Velocity", "(0.000000, 0.000000, 0.000000)");
+ wc.Headers.Add("X-SecondLife-Owner-Name", Properties.Settings.Default.AvatarName);
+ wc.Headers.Add("X-SecondLife-Owner-Key", Properties.Settings.Default.AvatarKey);
+ wc.Headers.Add("X-Forwarded-For", "127.0.0.1");
+
+ if (proxy != null)
+ wc.Proxy = proxy;
+
+ Uri uri = new Uri(strUrl);
+
+ // Basic Authentication scheme, added 28 mrt 2008
+ if (uri.UserInfo != "")
+ {
+ string[] UserInfo = uri.UserInfo.Split(':');
+ if (UserInfo.Length == 2)
+ {
+ CredentialCache mycache = new CredentialCache();
+ mycache.Add(uri, "Basic",
+ new NetworkCredential(UserInfo[0], UserInfo[1]));
+ wc.Credentials = mycache;
+ }
+ }
+
+
+ UserState userState = new UserState(key, secondlife);
+
+ if (strMethod == "POST" || strMethod == "PUT")
+ {
+ wc.UploadDataCompleted += new UploadDataCompletedEventHandler(wc_UploadDataCompleted);
+ wc.UploadDataAsync(uri, strMethod, Encoding.UTF8.GetBytes(postData), userState);
+ }
+ else
+ {
+ wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
+ wc.DownloadDataAsync(uri, userState);
+ }
+ }
+
+ private static void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
+ {
+ int intStatusCode = 200;
+ UserState userState = (UserState)e.UserState;
+ string strResult = "";
+
+ if (e.Error != null)
+ {
+ WebException webException = e.Error as WebException;
+ HttpWebResponse webResponse = webException.Response as HttpWebResponse;
+ if (webResponse == null)
+ {
+ intStatusCode = 0;
+ strResult = webException.Message;
+ }
+ else
+ {
+ intStatusCode = (int)webResponse.StatusCode;
+ System.IO.StreamReader sr = new System.IO.StreamReader(webResponse.GetResponseStream());
+ strResult = sr.ReadToEnd();
+ }
+ }
+ else
+ {
+ if (e.Result != null)
+ {
+ strResult = Encoding.UTF8.GetString(e.Result);
+ }
+ }
+ userState.secondlife.host.ExecuteSecondLife("http_response", userState.httpkey, (SecondLife.integer)intStatusCode, new SecondLife.list(), (SecondLife.String)strResult);
+ }
+
+ private static void wc_UploadDataCompleted(object sender, UploadDataCompletedEventArgs e)
+ {
+ int intStatusCode = 200;
+ UserState userState = (UserState)e.UserState;
+ string strResult = "";
+
+ if (e.Error != null)
+ {
+ WebException webException = e.Error as WebException;
+ HttpWebResponse webResponse = webException.Response as HttpWebResponse;
+ intStatusCode = (int)webResponse.StatusCode;
+ System.IO.StreamReader sr = new System.IO.StreamReader(webResponse.GetResponseStream());
+ strResult = sr.ReadToEnd();
+ }
+ else
+ {
+ if (e.Result != null)
+ {
+ string strEncoding = ((System.Net.WebClient)sender).ResponseHeaders["Content-Encoding"];
+ if (strEncoding == "gzip")
+ {
+ GZipStream tempE = new GZipStream(new System.IO.MemoryStream(e.Result), CompressionMode.Decompress);
+
+ var sr = new StreamReader(tempE);
+ strResult = sr.ReadToEnd();
+ }
+ else
+ {
+ strResult = Encoding.UTF8.GetString(e.Result);
+ }
+ }
+ }
+ userState.secondlife.host.ExecuteSecondLife("http_response", userState.httpkey, (SecondLife.integer)intStatusCode, new SecondLife.list(), (SecondLife.String)strResult);
+ }
+ }
+}
diff --git a/trunk/Helpers/LSL2CSharp.cs b/source/Helpers/LSL2CSharp.cs
similarity index 95%
rename from trunk/Helpers/LSL2CSharp.cs
rename to source/Helpers/LSL2CSharp.cs
index e4a8350..3462cc6 100644
--- a/trunk/Helpers/LSL2CSharp.cs
+++ b/source/Helpers/LSL2CSharp.cs
@@ -1,638 +1,638 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Xml;
-using System.Text;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-
-namespace LSLEditor
-{
- class LSL2CSharp
- {
- public List States;
- private XmlDocument xml;
-
- public LSL2CSharp(XmlDocument xml)
- {
- this.xml = xml;
- this.States = new List();
- }
-
- private string CorrectGlobalEvaluator(Match m)
- {
- string strPrefix = m.Groups["prefix"].Value;
- string strPublic = m.Groups["public"].Value;
- string strPostfix = m.Groups["postfix"].Value;
- if (strPublic.EndsWith(";"))
- return strPrefix + "public static " + strPublic + strPostfix;
- // has to be static,
- // because the vars must keep their values between state changes
-
- // 22 june 2007, added
- Regex regex = new Regex(@"\w*", RegexOptions.IgnorePatternWhitespace );
- int intCount=0;
- for (Match pm = regex.Match(strPublic); pm.Success; pm = pm.NextMatch())
- {
- if (pm.Value.Length > 0)
- intCount++;
- if (intCount > 1)
- break;
- }
- if(intCount==1)
- return strPrefix + "public void " + strPublic + strPostfix;
- else
- return strPrefix + "public " + strPublic + strPostfix;
- }
-
- private string CorrectGlobal(string strC)
- {
- Regex regex = new Regex(
- @"(?\s*)
-(?:
- (?[^{};]*;)
-
-|
-
-(?[^{;(]*)
- (?
- \( [^{]* \) \s*
- \{
- (?>
- [^{}]+
- | \{ (?)
- | \} (?<-number>)
- )*
- (?(number)(?!))
-\}
-)
-)",
- RegexOptions.IgnorePatternWhitespace);
- return regex.Replace(strC, new MatchEvaluator(CorrectGlobalEvaluator));
- }
-
- private string RemoveComments(string strC)
- {
- if (Properties.Settings.Default.CommentCStyle)
- {
- int intI = strC.IndexOf("/*");
- while (intI > 0)
- {
- int intJ = strC.IndexOf("*" + "/", intI);
- if (intJ < 0)
- break;
- strC = strC.Remove(intI, intJ - intI + 2);
- intI = strC.IndexOf("/*");
- }
- }
- return AutoFormatter.RemoveCommentsFromLines(strC);
- }
-
- private string CorrectStates(string strC,string strGlobalClass)
- {
- Regex regex;
-
- // Default state
- regex = new Regex(@"^\s*(default)(\W)",
- RegexOptions.Multiline
- | RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled);
- strC = regex.Replace(strC, @"class State_$1 : " + strGlobalClass + "$2");
-
- // Other states
- regex = new Regex(
- @"^state\s+([^\s]*)(\s*\{)",
- RegexOptions.Multiline
- | RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- Match m = regex.Match(strC);
- while (m.Success)
- {
- string strStateName = m.Groups[1].ToString();
- this.States.Add(strStateName);
- m = m.NextMatch();
- }
- strC = regex.Replace(strC, "class State_$1 : " + strGlobalClass + "$2");
-
- string strGlobal = "";
-
- if (Properties.Settings.Default.StatesInGlobalFunctions)
- {
- // do nothing!
- }
- else
- {
- int intDefault = strC.IndexOf("class State_default");
- if (intDefault >= 0)
- {
- strGlobal = strC.Substring(0, intDefault);
- strC = strC.Substring(intDefault);
- }
- }
-
- // State change, excluding global functions
- regex = new Regex(
- @"(\s+)state\s+(\w+)(\s*;)",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- return strGlobal + regex.Replace(strC, @"$1state(""$2"")$3");
- }
-
- private string PreCorrectReservedWords(string strC)
- {
- #region All PreCorrect reserved C# words
- Regex regex = new Regex(@"(\b)(public
-| class
-| override
-| namespace
-| void
-| SecondLife
-| GlobalClass
-| static
-| goto
-| String
-| Float
-
-)(\b)",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- #endregion
- return regex.Replace(strC, "$1_$2$3");
- }
-
- private string CorrectReservedWords(string strC)
- {
- #region All reserved C# words
- Regex regex = new Regex(@"(\b)(new
-| abstract
-| as
-| base
-| bool
-| break
-| byte
-| case
-| catch
-| char
-| checked
-| const
-| continue
-| decimal
-| delegate
-| double
-| enum
-| event
-| explicit
-| extern
-| false
-| finally
-| fixed
-| foreach
-| implicit
-| in
-| int
-| interface
-| internal
-| is
-| lock
-| long
-| new
-| null
-| object
-| operator
-| out
-| params
-| private
-| protected
-| readonly
-| ref
-| sbyte
-| sealed
-| short
-| sizeof
-| stackalloc
-| struct
-| switch
-| this
-| throw
-| true
-| try
-| typeof
-| uint
-| ulong
-| unchecked
-| unsafe
-| ushort
-| using
-| virtual
-
-)(\b)",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- #endregion
- return regex.Replace(strC, "$1_$2$3");
- }
-
- private string CorrectEvent(string strC, string strName)
- {
- Regex regex = new Regex(
- @"([^\w_])" + strName + @"(\s*)\(",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- return regex.Replace(strC, "$1public override void " + strName + "$2(");
- }
-
- private string CorrectEvents(string strC)
- {
- XmlNode words = xml.SelectSingleNode("//Words[@name='Appendix B. Events']");
- foreach (XmlNode xmlNode in words.SelectNodes(".//Word"))
- {
- string strName = xmlNode.Attributes["name"].InnerText;
- strC = CorrectEvent(strC, strName);
- }
- return strC;
- }
-
- // old vector parser
- // <([^<>,;]*),([^<>,;]*),([^<>,;]*)>
- private string CorrectVector(string strC)
- {
- Regex regex = new Regex(@"
-<
- (?
- (?>
- [^=(),>]+
- | \( (?)
- | \) (?<-nr>)
- | ,
- )*
- (?(nr)(?!))
- )
-,
- (?
- (?>
- [^=(),>]+
- | \( (?)
- | \) (?<-nr>)
- | ,
- )*
- (?(nr)(?!))
- )
-,
- (?
- (?>
- [^=()>]+
- | \( (?)
- | \) (?<-nr>)
- | ,
- )*
- (?(nr)(?!))
- )
->
-",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- return regex.Replace(strC, "new vector(${vector_x},${vector_y},${vector_z})");
- }
-
- // old rotation
- // <([^<>,;]*),([^<>,;]*),([^<>,;]*),([^<>,;]*)>
- private string CorrectRotation(string strC)
- {
- Regex regex = new Regex(@"
-<
- (?
- (?>
- [^=(),>]+
- | \( (?)
- | \) (?<-nr>)
- | ,
- )*
- (?(nr)(?!))
- )
-,
- (?
- (?>
- [^=(),>]+
- | \( (?)
- | \) (?<-nr>)
- | ,
- )*
- (?(nr)(?!))
- )
-,
- (?
- (?>
- [^=(),>]+
- | \( (?)
- | \) (?<-nr>)
- | ,
- )*
- (?(nr)(?!))
- )
-,
- (?
- (?>
- [^=()>]+
- | \( (?)
- | \) (?<-nr>)
- | ,
- )*
- (?(nr)(?!))
- )
->
-",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled
- );
- return regex.Replace(strC, "new rotation(${rotation_x},${rotation_y},${rotation_z},${rotation_s})");
- }
-
- private string CorrectQuaternion(string strC)
- {
- Regex regex = new Regex(
- @"(\b)quaternion(\b)",
- RegexOptions.Compiled
- | RegexOptions.IgnorePatternWhitespace
- );
- return regex.Replace(strC, "$1rotation$2");
- }
-
- private string CorrectListsEvaluator(Match m)
- {
- string strValue = m.Value;
- return "new list(new object[] {" + CorrectLists(strValue.Substring(1, strValue.Length - 2)) + "})";
- }
-
- private string CorrectLists(string strC)
- {
- Regex regex = new Regex(
- @"
-\[
- (?>
- [^\[\]]+
- | \[ (?)
- | \] (?<-number>)
- )*
- (?(number)(?!))
-\]
-",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Compiled);
- return regex.Replace(strC, new MatchEvaluator(CorrectListsEvaluator));
- }
-
- // changed 16 aug 2007
- private string CorrectJump(string strC)
- {
- // jump -> goto
- Regex regex = new Regex(
- @"(\b)jump(\s+)([^;]*;)",
- RegexOptions.Compiled
- | RegexOptions.IgnorePatternWhitespace
- );
- strC = regex.Replace(strC, "$1goto$2_$3");
-
- // @label; -> label:;
- regex = new Regex(
- @"@\s*([a-z0-9_]+)\s*;",
- RegexOptions.Compiled
- | RegexOptions.IgnoreCase
- | RegexOptions.IgnorePatternWhitespace
- );
- return regex.Replace(strC, "_$1:;");
- }
-
-
- private string RemoveQuotedStrings(string strC, out List h)
- {
- h = new List();
- StringBuilder sb = new StringBuilder();
- StringBuilder QuotedString = null;
- for (int intI = 0; intI < strC.Length; intI++)
- {
- char chrC = strC[intI];
- if (chrC == '"')
- {
- if (QuotedString != null)
- {
- // end of a quoted string
- sb.Append('"');
- sb.Append(h.Count.ToString());
- sb.Append('"');
- h.Add(QuotedString.ToString());
- QuotedString = null;
- continue;
- }
- else
- {
- if (chrC == '"')
- {
- // start of a new quoted string
- QuotedString = new StringBuilder();
- continue;
- }
- // it was just a newline char, and not in a string
- }
- }
-
- if (QuotedString == null)
- sb.Append(chrC);
- else
- {
- if (chrC == '\n')
- {
- QuotedString.Append('\\');
- chrC = 'n';
- }
- if (chrC != '\\')
- {
- QuotedString.Append(chrC);
- }
- else // it is a backslash
- {
- intI++;
- chrC = strC[intI];
- if (chrC == 't') // tabs are 4 spaces in SL world!!
- {
- QuotedString.Append(" ");
- }
- else // nope, it is no tab, just output it all
- {
- QuotedString.Append('\\');
- QuotedString.Append(chrC);
- }
- }
- }
- }
- return sb.ToString();
- }
-
- private string InsertQuotedStrings(string strC, List h)
- {
- StringBuilder sb = new StringBuilder();
- StringBuilder QuotedString = null;
- for (int intI = 0; intI < strC.Length; intI++)
- {
- char chrC = strC[intI];
- if (chrC == '"')
- {
- if (QuotedString == null)
- {
- QuotedString = new StringBuilder();
- }
- else
- {
- sb.Append('"');
- int intNumber;
- // State("default") is not a number, result of 'CorrectStates'
- if (int.TryParse(QuotedString.ToString(), out intNumber))
- sb.Append(h[intNumber]);
- else
- sb.Append(QuotedString.ToString());
- sb.Append('"');
- QuotedString = null;
- }
- continue;
- }
-
- if (QuotedString == null)
- sb.Append(chrC);
- else
- QuotedString.Append(chrC);
- }
- return sb.ToString();
- }
-
- private string MakeGlobalAndLocal(string strC)
- {
- Regex regexDefault = new Regex(@"^\s*(default)\W",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Multiline
- | RegexOptions.Compiled);
-
- Match matchDefault = regexDefault.Match(strC);
-
- string strGlobal;
- int intDefaultIndex;
- if (matchDefault.Groups.Count == 2)
- {
- States.Add("default");
- intDefaultIndex = matchDefault.Groups[1].Index;
- strGlobal = CorrectGlobal(strC.Substring(0, intDefaultIndex));
- }
- else
- {
- intDefaultIndex = 0;
- strGlobal = "";
- }
- return "class GlobalClass : SecondLife\n{\n" + strGlobal + "}\n" + strC.Substring(intDefaultIndex);
- }
-
- private string Capitalize(string strC, string strName)
- {
- Regex regex = new Regex(@"(\W)"+strName+@"(\W)",
- RegexOptions.IgnorePatternWhitespace
- | RegexOptions.Multiline
- | RegexOptions.Compiled);
- string strCap = strName[0].ToString().ToUpper() + strName.Substring(1);
- return regex.Replace(strC, "$1"+strCap+"$2");
- }
-
- private string RemoveSingleQuotes(string strC)
- {
- if (Properties.Settings.Default.SingleQuote)
- return strC.Replace("'", "");
- else
- return strC;
- }
-
- ///
- /// This Class translates LSL script into CSharp code
- ///
- /// LSL scripting code
- /// CSHarp code
- public string Parse(string strLSLCode)
- {
- List quotedStrings;
-
- string strGlobalClass = "GlobalClass";
-
- string strC = strLSLCode;
-
- strC = RemoveComments(strC);
-
- strC = RemoveQuotedStrings(strC, out quotedStrings);
-
- strC = RemoveSingleQuotes(strC);
-
- strC = PreCorrectReservedWords(strC); // Experimental
-
- strC = MakeGlobalAndLocal(strC);
-
- strC = CorrectJump(strC);
- strC = CorrectEvents(strC);
-
- strC = Capitalize(strC, "float");
- strC = Capitalize(strC, "string"); // llList2string is also translated
-
- strC = CorrectStates(strC, strGlobalClass);
-
- strC = CorrectReservedWords(strC); // Experimental
-
- strC = CorrectRotation(strC);
- strC = CorrectQuaternion(strC);
- strC = CorrectVector(strC);
- strC = CorrectLists(strC);
-
- strC = InsertQuotedStrings(strC, quotedStrings);
-
- return strC;
- }
- }
-
-
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Xml;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+
+namespace LSLEditor
+{
+ class LSL2CSharp
+ {
+ public List States;
+ private XmlDocument xml;
+
+ public LSL2CSharp(XmlDocument xml)
+ {
+ this.xml = xml;
+ this.States = new List();
+ }
+
+ private string CorrectGlobalEvaluator(Match m)
+ {
+ string strPrefix = m.Groups["prefix"].Value;
+ string strPublic = m.Groups["public"].Value;
+ string strPostfix = m.Groups["postfix"].Value;
+ if (strPublic.EndsWith(";"))
+ return strPrefix + "public static " + strPublic + strPostfix;
+ // has to be static,
+ // because the vars must keep their values between state changes
+
+ // 22 june 2007, added
+ Regex regex = new Regex(@"\w*", RegexOptions.IgnorePatternWhitespace );
+ int intCount=0;
+ for (Match pm = regex.Match(strPublic); pm.Success; pm = pm.NextMatch())
+ {
+ if (pm.Value.Length > 0)
+ intCount++;
+ if (intCount > 1)
+ break;
+ }
+ if(intCount==1)
+ return strPrefix + "public void " + strPublic + strPostfix;
+ else
+ return strPrefix + "public " + strPublic + strPostfix;
+ }
+
+ private string CorrectGlobal(string strC)
+ {
+ Regex regex = new Regex(
+ @"(?\s*)
+(?:
+ (?[^{};]*;)
+
+|
+
+(?[^{;(]*)
+ (?
+ \( [^{]* \) \s*
+ \{
+ (?>
+ [^{}]+
+ | \{ (?)
+ | \} (?<-number>)
+ )*
+ (?(number)(?!))
+\}
+)
+)",
+ RegexOptions.IgnorePatternWhitespace);
+ return regex.Replace(strC, new MatchEvaluator(CorrectGlobalEvaluator));
+ }
+
+ private string RemoveComments(string strC)
+ {
+ if (Properties.Settings.Default.CommentCStyle)
+ {
+ int intI = strC.IndexOf("/*");
+ while (intI > 0)
+ {
+ int intJ = strC.IndexOf("*" + "/", intI);
+ if (intJ < 0)
+ break;
+ strC = strC.Remove(intI, intJ - intI + 2);
+ intI = strC.IndexOf("/*");
+ }
+ }
+ return AutoFormatter.RemoveCommentsFromLines(strC);
+ }
+
+ private string CorrectStates(string strC,string strGlobalClass)
+ {
+ Regex regex;
+
+ // Default state
+ regex = new Regex(@"^\s*(default)(\W)",
+ RegexOptions.Multiline
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled);
+ strC = regex.Replace(strC, @"class State_$1 : " + strGlobalClass + "$2");
+
+ // Other states
+ regex = new Regex(
+ @"^state\s+([^\s]*)(\s*\{)",
+ RegexOptions.Multiline
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ Match m = regex.Match(strC);
+ while (m.Success)
+ {
+ string strStateName = m.Groups[1].ToString();
+ this.States.Add(strStateName);
+ m = m.NextMatch();
+ }
+ strC = regex.Replace(strC, "class State_$1 : " + strGlobalClass + "$2");
+
+ string strGlobal = "";
+
+ if (Properties.Settings.Default.StatesInGlobalFunctions)
+ {
+ // do nothing!
+ }
+ else
+ {
+ int intDefault = strC.IndexOf("class State_default");
+ if (intDefault >= 0)
+ {
+ strGlobal = strC.Substring(0, intDefault);
+ strC = strC.Substring(intDefault);
+ }
+ }
+
+ // State change, excluding global functions
+ regex = new Regex(
+ @"(\s+)state\s+(\w+)(\s*;)",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ return strGlobal + regex.Replace(strC, @"$1state(""$2"")$3");
+ }
+
+ private string PreCorrectReservedWords(string strC)
+ {
+ #region All PreCorrect reserved C# words
+ Regex regex = new Regex(@"(\b)(public
+| class
+| override
+| namespace
+| void
+| SecondLife
+| GlobalClass
+| static
+| goto
+| String
+| Float
+
+)(\b)",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ #endregion
+ return regex.Replace(strC, "$1_$2$3");
+ }
+
+ private string CorrectReservedWords(string strC)
+ {
+ #region All reserved C# words
+ Regex regex = new Regex(@"(\b)(new
+| abstract
+| as
+| base
+| bool
+| break
+| byte
+| case
+| catch
+| char
+| checked
+| const
+| continue
+| decimal
+| delegate
+| double
+| enum
+| event
+| explicit
+| extern
+| false
+| finally
+| fixed
+| foreach
+| implicit
+| in
+| int
+| interface
+| internal
+| is
+| lock
+| long
+| new
+| null
+| object
+| operator
+| out
+| params
+| private
+| protected
+| readonly
+| ref
+| sbyte
+| sealed
+| short
+| sizeof
+| stackalloc
+| struct
+| switch
+| this
+| throw
+| true
+| try
+| typeof
+| uint
+| ulong
+| unchecked
+| unsafe
+| ushort
+| using
+| virtual
+
+)(\b)",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ #endregion
+ return regex.Replace(strC, "$1_$2$3");
+ }
+
+ private string CorrectEvent(string strC, string strName)
+ {
+ Regex regex = new Regex(
+ @"([^\w_])" + strName + @"(\s*)\(",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ return regex.Replace(strC, "$1public override void " + strName + "$2(");
+ }
+
+ private string CorrectEvents(string strC)
+ {
+ XmlNode words = xml.SelectSingleNode("//Words[@name='Appendix B. Events']");
+ foreach (XmlNode xmlNode in words.SelectNodes(".//Word"))
+ {
+ string strName = xmlNode.Attributes["name"].InnerText;
+ strC = CorrectEvent(strC, strName);
+ }
+ return strC;
+ }
+
+ // old vector parser
+ // <([^<>,;]*),([^<>,;]*),([^<>,;]*)>
+ private string CorrectVector(string strC)
+ {
+ Regex regex = new Regex(@"
+<
+ (?
+ (?>
+ [^=(),>]+
+ | \( (?)
+ | \) (?<-nr>)
+ | ,
+ )*
+ (?(nr)(?!))
+ )
+,
+ (?
+ (?>
+ [^=(),>]+
+ | \( (?)
+ | \) (?<-nr>)
+ | ,
+ )*
+ (?(nr)(?!))
+ )
+,
+ (?
+ (?>
+ [^=()>]+
+ | \( (?)
+ | \) (?<-nr>)
+ | ,
+ )*
+ (?(nr)(?!))
+ )
+>
+",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ return regex.Replace(strC, "new vector(${vector_x},${vector_y},${vector_z})");
+ }
+
+ // old rotation
+ // <([^<>,;]*),([^<>,;]*),([^<>,;]*),([^<>,;]*)>
+ private string CorrectRotation(string strC)
+ {
+ Regex regex = new Regex(@"
+<
+ (?
+ (?>
+ [^=(),>]+
+ | \( (?)
+ | \) (?<-nr>)
+ | ,
+ )*
+ (?(nr)(?!))
+ )
+,
+ (?
+ (?>
+ [^=(),>]+
+ | \( (?)
+ | \) (?<-nr>)
+ | ,
+ )*
+ (?(nr)(?!))
+ )
+,
+ (?
+ (?>
+ [^=(),>]+
+ | \( (?)
+ | \) (?<-nr>)
+ | ,
+ )*
+ (?(nr)(?!))
+ )
+,
+ (?
+ (?>
+ [^=()>]+
+ | \( (?)
+ | \) (?<-nr>)
+ | ,
+ )*
+ (?(nr)(?!))
+ )
+>
+",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ return regex.Replace(strC, "new rotation(${rotation_x},${rotation_y},${rotation_z},${rotation_s})");
+ }
+
+ private string CorrectQuaternion(string strC)
+ {
+ Regex regex = new Regex(
+ @"(\b)quaternion(\b)",
+ RegexOptions.Compiled
+ | RegexOptions.IgnorePatternWhitespace
+ );
+ return regex.Replace(strC, "$1rotation$2");
+ }
+
+ private string CorrectListsEvaluator(Match m)
+ {
+ string strValue = m.Value;
+ return "new list(new object[] {" + CorrectLists(strValue.Substring(1, strValue.Length - 2)) + "})";
+ }
+
+ private string CorrectLists(string strC)
+ {
+ Regex regex = new Regex(
+ @"
+\[
+ (?>
+ [^\[\]]+
+ | \[ (?)
+ | \] (?<-number>)
+ )*
+ (?(number)(?!))
+\]
+",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled);
+ return regex.Replace(strC, new MatchEvaluator(CorrectListsEvaluator));
+ }
+
+ // changed 16 aug 2007
+ private string CorrectJump(string strC)
+ {
+ // jump -> goto
+ Regex regex = new Regex(
+ @"(\b)jump(\s+)([^;]*;)",
+ RegexOptions.Compiled
+ | RegexOptions.IgnorePatternWhitespace
+ );
+ strC = regex.Replace(strC, "$1goto$2_$3");
+
+ // @label; -> label:;
+ regex = new Regex(
+ @"@\s*([a-z0-9_]+)\s*;",
+ RegexOptions.Compiled
+ | RegexOptions.IgnoreCase
+ | RegexOptions.IgnorePatternWhitespace
+ );
+ return regex.Replace(strC, "_$1:;");
+ }
+
+
+ private string RemoveQuotedStrings(string strC, out List h)
+ {
+ h = new List();
+ StringBuilder sb = new StringBuilder();
+ StringBuilder QuotedString = null;
+ for (int intI = 0; intI < strC.Length; intI++)
+ {
+ char chrC = strC[intI];
+ if (chrC == '"')
+ {
+ if (QuotedString != null)
+ {
+ // end of a quoted string
+ sb.Append('"');
+ sb.Append(h.Count.ToString());
+ sb.Append('"');
+ h.Add(QuotedString.ToString());
+ QuotedString = null;
+ continue;
+ }
+ else
+ {
+ if (chrC == '"')
+ {
+ // start of a new quoted string
+ QuotedString = new StringBuilder();
+ continue;
+ }
+ // it was just a newline char, and not in a string
+ }
+ }
+
+ if (QuotedString == null)
+ sb.Append(chrC);
+ else
+ {
+ if (chrC == '\n')
+ {
+ QuotedString.Append('\\');
+ chrC = 'n';
+ }
+ if (chrC != '\\')
+ {
+ QuotedString.Append(chrC);
+ }
+ else // it is a backslash
+ {
+ intI++;
+ chrC = strC[intI];
+ if (chrC == 't') // tabs are 4 spaces in SL world!!
+ {
+ QuotedString.Append(" ");
+ }
+ else // nope, it is no tab, just output it all
+ {
+ QuotedString.Append('\\');
+ QuotedString.Append(chrC);
+ }
+ }
+ }
+ }
+ return sb.ToString();
+ }
+
+ private string InsertQuotedStrings(string strC, List h)
+ {
+ StringBuilder sb = new StringBuilder();
+ StringBuilder QuotedString = null;
+ for (int intI = 0; intI < strC.Length; intI++)
+ {
+ char chrC = strC[intI];
+ if (chrC == '"')
+ {
+ if (QuotedString == null)
+ {
+ QuotedString = new StringBuilder();
+ }
+ else
+ {
+ sb.Append('"');
+ int intNumber;
+ // State("default") is not a number, result of 'CorrectStates'
+ if (int.TryParse(QuotedString.ToString(), out intNumber))
+ sb.Append(h[intNumber]);
+ else
+ sb.Append(QuotedString.ToString());
+ sb.Append('"');
+ QuotedString = null;
+ }
+ continue;
+ }
+
+ if (QuotedString == null)
+ sb.Append(chrC);
+ else
+ QuotedString.Append(chrC);
+ }
+ return sb.ToString();
+ }
+
+ private string MakeGlobalAndLocal(string strC)
+ {
+ Regex regexDefault = new Regex(@"^\s*(default)\W",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Multiline
+ | RegexOptions.Compiled);
+
+ Match matchDefault = regexDefault.Match(strC);
+
+ string strGlobal;
+ int intDefaultIndex;
+ if (matchDefault.Groups.Count == 2)
+ {
+ States.Add("default");
+ intDefaultIndex = matchDefault.Groups[1].Index;
+ strGlobal = CorrectGlobal(strC.Substring(0, intDefaultIndex));
+ }
+ else
+ {
+ intDefaultIndex = 0;
+ strGlobal = "";
+ }
+ return "class GlobalClass : SecondLife\n{\n" + strGlobal + "}\n" + strC.Substring(intDefaultIndex);
+ }
+
+ private string Capitalize(string strC, string strName)
+ {
+ Regex regex = new Regex(@"(\W)"+strName+@"(\W)",
+ RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Multiline
+ | RegexOptions.Compiled);
+ string strCap = strName[0].ToString().ToUpper() + strName.Substring(1);
+ return regex.Replace(strC, "$1"+strCap+"$2");
+ }
+
+ private string RemoveSingleQuotes(string strC)
+ {
+ if (Properties.Settings.Default.SingleQuote)
+ return strC.Replace("'", "");
+ else
+ return strC;
+ }
+
+ ///
+ /// This Class translates LSL script into CSharp code
+ ///
+ /// LSL scripting code
+ /// CSHarp code
+ public string Parse(string strLSLCode)
+ {
+ List quotedStrings;
+
+ string strGlobalClass = "GlobalClass";
+
+ string strC = strLSLCode;
+
+ strC = RemoveComments(strC);
+
+ strC = RemoveQuotedStrings(strC, out quotedStrings);
+
+ strC = RemoveSingleQuotes(strC);
+
+ strC = PreCorrectReservedWords(strC); // Experimental
+
+ strC = MakeGlobalAndLocal(strC);
+
+ strC = CorrectJump(strC);
+ strC = CorrectEvents(strC);
+
+ strC = Capitalize(strC, "float");
+ strC = Capitalize(strC, "string"); // llList2string is also translated
+
+ strC = CorrectStates(strC, strGlobalClass);
+
+ strC = CorrectReservedWords(strC); // Experimental
+
+ strC = CorrectRotation(strC);
+ strC = CorrectQuaternion(strC);
+ strC = CorrectVector(strC);
+ strC = CorrectLists(strC);
+
+ strC = InsertQuotedStrings(strC, quotedStrings);
+
+ return strC;
+ }
+ }
+
+
+}
diff --git a/trunk/Helpers/LSLIConverter.cs b/source/Helpers/LSLIConverter.cs
similarity index 100%
rename from trunk/Helpers/LSLIConverter.cs
rename to source/Helpers/LSLIConverter.cs
diff --git a/trunk/Helpers/LSLIPathHelper.cs b/source/Helpers/LSLIPathHelper.cs
similarity index 100%
rename from trunk/Helpers/LSLIPathHelper.cs
rename to source/Helpers/LSLIPathHelper.cs
diff --git a/trunk/Helpers/Measure.cs b/source/Helpers/Measure.cs
similarity index 97%
rename from trunk/Helpers/Measure.cs
rename to source/Helpers/Measure.cs
index 47c1666..ff9d8f0 100644
--- a/trunk/Helpers/Measure.cs
+++ b/source/Helpers/Measure.cs
@@ -1,66 +1,66 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Drawing;
-
-namespace LSLEditor.Helpers
-{
- class Measure
- {
- public static RectangleF MeasureDisplayString(System.Windows.Forms.Control control, string text, Font font)
- {
- Graphics graphics = control.CreateGraphics();
- RectangleF rect = MeasureDisplayString(graphics, text, font);
- graphics.Dispose();
- return rect;
- }
-
- public static RectangleF MeasureDisplayString(Graphics graphics, string text, Font font)
- {
- StringFormat format = new StringFormat();
- RectangleF rect = new RectangleF(0, 0, 4096, 4096);
- CharacterRange[] ranges = { new CharacterRange(0, text.Length) };
- Region[] regions = new Region[1];
- format.SetMeasurableCharacterRanges(ranges);
- regions = graphics.MeasureCharacterRanges(text, font, rect, format);
- return regions[0].GetBounds(graphics);
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Drawing;
+
+namespace LSLEditor.Helpers
+{
+ class Measure
+ {
+ public static RectangleF MeasureDisplayString(System.Windows.Forms.Control control, string text, Font font)
+ {
+ Graphics graphics = control.CreateGraphics();
+ RectangleF rect = MeasureDisplayString(graphics, text, font);
+ graphics.Dispose();
+ return rect;
+ }
+
+ public static RectangleF MeasureDisplayString(Graphics graphics, string text, Font font)
+ {
+ StringFormat format = new StringFormat();
+ RectangleF rect = new RectangleF(0, 0, 4096, 4096);
+ CharacterRange[] ranges = { new CharacterRange(0, text.Length) };
+ Region[] regions = new Region[1];
+ format.SetMeasurableCharacterRanges(ranges);
+ regions = graphics.MeasureCharacterRanges(text, font, rect, format);
+ return regions[0].GetBounds(graphics);
+ }
+ }
+}
diff --git a/trunk/Helpers/OopsFormatter.cs b/source/Helpers/OopsFormatter.cs
similarity index 97%
rename from trunk/Helpers/OopsFormatter.cs
rename to source/Helpers/OopsFormatter.cs
index 4050890..89f2e6c 100644
--- a/trunk/Helpers/OopsFormatter.cs
+++ b/source/Helpers/OopsFormatter.cs
@@ -1,65 +1,65 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.Text;
-
-namespace LSLEditor
-{
- class OopsFormatter
- {
- public static string ApplyFormatting(string strInput)
- {
- strInput = strInput.Replace("SecondLifeHost.", "");
- strInput = strInput.Replace("GlobalClass.", "");
- strInput = strInput.Replace("State_", "");
- strInput = strInput.Replace("LSLEditor.", "");
- strInput = strInput.Replace("SecondLife.", "");
- strInput = strInput.Replace("String", "string");
- strInput = strInput.Replace("Float", "float");
-
- //TODO: there was something here for removing the path (is it needed?)
- //Properties.Settings.Default.OopsRemove = @"C:\Documents and Settings\Alphons\Visual Studio 2005\Projects";
- //strInput = strInput.Replace(Properties.Settings.Default.OopsRemove, "");
-
- return strInput;
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.Text;
+
+namespace LSLEditor
+{
+ class OopsFormatter
+ {
+ public static string ApplyFormatting(string strInput)
+ {
+ strInput = strInput.Replace("SecondLifeHost.", "");
+ strInput = strInput.Replace("GlobalClass.", "");
+ strInput = strInput.Replace("State_", "");
+ strInput = strInput.Replace("LSLEditor.", "");
+ strInput = strInput.Replace("SecondLife.", "");
+ strInput = strInput.Replace("String", "string");
+ strInput = strInput.Replace("Float", "float");
+
+ //TODO: there was something here for removing the path (is it needed?)
+ //Properties.Settings.Default.OopsRemove = @"C:\Documents and Settings\Alphons\Visual Studio 2005\Projects";
+ //strInput = strInput.Replace(Properties.Settings.Default.OopsRemove, "");
+
+ return strInput;
+ }
+ }
+}
diff --git a/trunk/Helpers/OutlineHelper.cs b/source/Helpers/OutlineHelper.cs
similarity index 97%
rename from trunk/Helpers/OutlineHelper.cs
rename to source/Helpers/OutlineHelper.cs
index 2c70137..111e21f 100644
--- a/trunk/Helpers/OutlineHelper.cs
+++ b/source/Helpers/OutlineHelper.cs
@@ -1,56 +1,56 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace LSLEditor.Helpers
-{
- class OutlineHelper
- {
- public KeyWordInfo info;
- public int line;
- public OutlineHelper(KeyWordInfo i, int l)
- {
- this.info = i;
- this.line = l;
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace LSLEditor.Helpers
+{
+ class OutlineHelper
+ {
+ public KeyWordInfo info;
+ public int line;
+ public OutlineHelper(KeyWordInfo i, int l)
+ {
+ this.info = i;
+ this.line = l;
+ }
+ }
+}
diff --git a/trunk/Helpers/PrinterHelper.cs b/source/Helpers/PrinterHelper.cs
similarity index 96%
rename from trunk/Helpers/PrinterHelper.cs
rename to source/Helpers/PrinterHelper.cs
index 49a5c6c..a0cc2db 100644
--- a/trunk/Helpers/PrinterHelper.cs
+++ b/source/Helpers/PrinterHelper.cs
@@ -1,702 +1,702 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Text;
-using System.Collections;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Printing;
-using System.Globalization;
-using System.Windows.Forms;
-
-namespace LSLEditor.Helpers
-{
- ///
- /// Data Grid View Printer. Print functions for a datagridview, since MS
- /// didn't see fit to do it.
- ///
- class PrinterHelper
- {
- //---------------------------------------------------------------------
- // global variables
- //---------------------------------------------------------------------
- #region global variables
-
- // the data grid view we're printing
- EditForm editForm = null;
- int intCharFrom;
- int intCharTo;
- int intCharPrint;
-
- // print document
- PrintDocument docToPrint = null;
-
- // print dialogue
- PrintDialog pd = null;
-
- // print status items
- int fromPage = 0;
- int toPage = -1;
-
- // page formatting options
- int pageHeight = 0;
- int pageWidth = 0;
- int printWidth = 0;
- int CurrentPage = 0;
- PrintRange printRange;
-
- // calculated values
- private float footerHeight = 0;
- private float pagenumberHeight = 0;
- #endregion
-
- //---------------------------------------------------------------------
- // properties - settable by user
- //---------------------------------------------------------------------
- #region properties
-
- // Title
- #region title properties
-
- ///
- /// Title for this report. Default is empty.
- ///
- private String title;
- public String Title
- {
- get { return title; }
- set { title = value; docToPrint.DocumentName = title; }
- }
-
- ///
- /// Font for the title. Default is Tahoma, 18pt.
- ///
- private Font titlefont;
- public Font TitleFont
- {
- get { return titlefont; }
- set { titlefont = value; }
- }
-
- ///
- /// Foreground color for the title. Default is Black
- ///
- private Color titlecolor;
- public Color TitleColor
- {
- get { return titlecolor; }
- set { titlecolor = value; }
- }
-
- ///
- /// Allow the user to override the title string alignment. Default value is
- /// Alignment - Near;
- ///
- private StringAlignment titlealignment;
- public StringAlignment TitleAlignment
- {
- get { return titlealignment; }
- set { titlealignment = value; }
- }
-
- ///
- /// Allow the user to override the title string format flags. Default values
- /// are: FormatFlags - NoWrap, LineLimit, NoClip
- ///
- private StringFormatFlags titleformatflags;
- public StringFormatFlags TitleFormatFlags
- {
- get { return titleformatflags; }
- set { titleformatflags = value; }
- }
- #endregion
-
- // SubTitle
- #region subtitle properties
-
- ///
- /// SubTitle for this report. Default is empty.
- ///
- private String subtitle;
- public String SubTitle
- {
- get { return subtitle; }
- set { subtitle = value; }
- }
-
- ///
- /// Font for the subtitle. Default is Tahoma, 12pt.
- ///
- private Font subtitlefont;
- public Font SubTitleFont
- {
- get { return subtitlefont; }
- set { subtitlefont = value; }
- }
-
- ///
- /// Foreground color for the subtitle. Default is Black
- ///
- private Color subtitlecolor;
- public Color SubTitleColor
- {
- get { return subtitlecolor; }
- set { subtitlecolor = value; }
- }
-
- ///
- /// Allow the user to override the subtitle string alignment. Default value is
- /// Alignment - Near;
- ///
- private StringAlignment subtitlealignment;
- public StringAlignment SubTitleAlignment
- {
- get { return subtitlealignment; }
- set { subtitlealignment = value; }
- }
-
- ///
- /// Allow the user to override the subtitle string format flags. Default values
- /// are: FormatFlags - NoWrap, LineLimit, NoClip
- ///
- private StringFormatFlags subtitleformatflags;
- public StringFormatFlags SubTitleFormatFlags
- {
- get { return subtitleformatflags; }
- set { subtitleformatflags = value; }
- }
- #endregion
-
- // Footer
- #region footer properties
-
- ///
- /// footer for this report. Default is empty.
- ///
- private String footer;
- public String Footer
- {
- get { return footer; }
- set { footer = value; }
- }
-
- ///
- /// Font for the footer. Default is Tahoma, 10pt.
- ///
- private Font footerfont;
- public Font FooterFont
- {
- get { return footerfont; }
- set { footerfont = value; }
- }
-
- ///
- /// Foreground color for the footer. Default is Black
- ///
- private Color footercolor;
- public Color FooterColor
- {
- get { return footercolor; }
- set { footercolor = value; }
- }
-
- ///
- /// Allow the user to override the footer string alignment. Default value is
- /// Alignment - Center;
- ///
- private StringAlignment footeralignment;
- public StringAlignment FooterAlignment
- {
- get { return footeralignment; }
- set { footeralignment = value; }
- }
-
- ///
- /// Allow the user to override the footer string format flags. Default values
- /// are: FormatFlags - NoWrap, LineLimit, NoClip
- ///
- private StringFormatFlags footerformatflags;
- public StringFormatFlags FooterFormatFlags
- {
- get { return footerformatflags; }
- set { footerformatflags = value; }
- }
-
- private float footerspacing;
- public float FooterSpacing
- {
- get { return footerspacing; }
- set { footerspacing = value; }
- }
- #endregion
-
- // Page Numbering
- #region page number properties
-
- ///
- /// Include page number in the printout. Default is true.
- ///
- private bool pageno = true;
- public bool PageNumbers
- {
- get { return pageno; }
- set { pageno = value; }
- }
-
- ///
- /// Font for the page number, Default is Tahoma, 8pt.
- ///
- private Font pagenofont;
- public Font PageNumberFont
- {
- get { return pagenofont; }
- set { pagenofont = value; }
- }
-
- ///
- /// Text color (foreground) for the page number. Default is Black
- ///
- private Color pagenocolor;
- public Color PageNumberColor
- {
- get { return pagenocolor; }
- set { pagenocolor = value; }
- }
-
- ///
- /// Allow the user to override the page number string alignment. Default value is
- /// Alignment - Near;
- ///
- private StringAlignment pagenumberalignment;
- public StringAlignment PaageNumberAlignment
- {
- get { return pagenumberalignment; }
- set { pagenumberalignment = value; }
- }
-
- ///
- /// Allow the user to override the pagenumber string format flags. Default values
- /// are: FormatFlags - NoWrap, LineLimit, NoClip
- ///
- private StringFormatFlags pagenumberformatflags;
- public StringFormatFlags PageNumberFormatFlags
- {
- get { return pagenumberformatflags; }
- set { pagenumberformatflags = value; }
- }
-
- ///
- /// Allow the user to select whether to have the page number at the top or bottom
- /// of the page. Default is false: page numbers on the bottom of the page
- ///
- private bool pagenumberontop = false;
- public bool PageNumberInHeader
- {
- get { return pagenumberontop; }
- set { pagenumberontop = value; }
- }
-
- ///
- /// Should the page number be printed on a separate line, or printed on the
- /// same line as the header / footer? Default is false;
- ///
- private bool pagenumberonseparateline = false;
- public bool PaageNumberOnSeparateLine
- {
- get { return pagenumberonseparateline; }
- set { pagenumberonseparateline = value; }
- }
-
-
- #endregion
-
- // Page Level Properties
- #region page level properties
-
- ///
- /// Page margins override. Default is (60, 60, 60, 60)
- ///
- private Margins printmargins;
- public Margins PrintMargins
- {
- get { return printmargins; }
- set { printmargins = value; }
- }
-
- #endregion
-
- #endregion
-
- ///
- /// Constructor for PrinterHelper
- ///
- public PrinterHelper(PageSetupDialog pageSetupDialog)
- {
- // create print document
- docToPrint = new PrintDocument();
- docToPrint.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
-
- if (pageSetupDialog.PrinterSettings != null)
- docToPrint.PrinterSettings = pageSetupDialog.PrinterSettings;
-
- if (pageSetupDialog.PageSettings != null)
- docToPrint.DefaultPageSettings = pageSetupDialog.PageSettings;
- else
- docToPrint.DefaultPageSettings.Margins = new Margins(60, 80, 40, 40);
-
- printmargins = docToPrint.DefaultPageSettings.Margins;
-
- // set default fonts
- pagenofont = new Font("Tahoma", 10, FontStyle.Regular, GraphicsUnit.Point);
- pagenocolor = Color.Black;
- titlefont = new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point);
- titlecolor = Color.Black;
- subtitlefont = new Font("Tahoma", 10, FontStyle.Regular, GraphicsUnit.Point);
- subtitlecolor = Color.Black;
- footerfont = new Font("Tahoma", 10, FontStyle.Regular, GraphicsUnit.Point);
- footercolor = Color.Black;
-
- // set default string formats
- titlealignment = StringAlignment.Near;
- titleformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
-
- subtitlealignment = StringAlignment.Near;
- subtitleformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
-
- footeralignment = StringAlignment.Near;
- footerformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
-
- pagenumberalignment = StringAlignment.Center;
- pagenumberformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
- }
-
- ///
- /// Start the printing process, print to a printer.
- ///
- /// The EditForm to print
- /// NOTE: Any changes to this method also need to be done in PrintPreviewEditForm
- public void PrintEditForm(EditForm editForm)
- {
- saveFormData(editForm);
- setupPrintDialogue();
-
- // show print dialog
- if (pd.ShowDialog() == DialogResult.OK)
- {
- SetupPrint(pd);
- docToPrint.Print();
- }
-
- }
-
- ///
- /// Start the printing process, print to a print preview dialog
- ///
- /// The EditForm to print
- /// NOTE: Any changes to this method also need to be done in PrintDataGridView
- public void PrintPreviewEditForm(EditForm editForm)
- {
- saveFormData(editForm);
- setupPrintDialogue();
-
- // show print dialog
- if (pd.ShowDialog() == DialogResult.OK)
- {
- SetupPrint(pd);
- PrintPreviewDialog ppdialog = new PrintPreviewDialog();
- ppdialog.Document = docToPrint;
- ppdialog.ShowDialog();
- }
- }
-
- ///
- /// Set up the print job. Save information from print dialog
- /// and print document for easy access. Also sets up the rows
- /// and columns that will be printed.
- ///
- /// The print dialog the user just filled out
- void SetupPrint(PrintDialog pd)
- {
- //-----------------------------------------------------------------
- // save data from print dialog and document
- //-----------------------------------------------------------------
-
- // check to see if we're doing landscape printing
- if (docToPrint.DefaultPageSettings.Landscape)
- {
- // landscape: switch width and height
- pageHeight = docToPrint.DefaultPageSettings.PaperSize.Width;
- pageWidth = docToPrint.DefaultPageSettings.PaperSize.Height;
- }
- else
- {
- // portrait: keep width and height as expected
- pageHeight = docToPrint.DefaultPageSettings.PaperSize.Height;
- pageWidth = docToPrint.DefaultPageSettings.PaperSize.Width;
- }
-
- // save printer margins and calc print width
- printmargins = docToPrint.DefaultPageSettings.Margins;
- printWidth = pageWidth - printmargins.Left - printmargins.Right;
-
- // save print range
- printRange = pd.PrinterSettings.PrintRange;
-
- // pages to print handles "some pages" option
- if (PrintRange.SomePages == printRange)
- {
- // set limits to only print some pages
- fromPage = pd.PrinterSettings.FromPage;
- toPage = pd.PrinterSettings.ToPage;
- }
- else
- {
- // set extremes so that we'll print all pages
- fromPage = 0;
- toPage = 2147483647;
- }
-
- //-----------------------------------------------------------------
- // set up the pages to print
- //-----------------------------------------------------------------
-
- // pages (handles "selection" and "current page" options
- if (PrintRange.Selection == printRange)
- {
- intCharPrint = this.editForm.TextBox.SelectionStart;
- intCharFrom = intCharPrint;
- intCharTo = intCharFrom + this.editForm.TextBox.SelectionLength;
- }
- else if (PrintRange.CurrentPage == printRange)
- {
- }
- // this is the default for print all
- else
- {
- intCharPrint = 0;
- intCharFrom = intCharPrint;
- intCharTo = this.editForm.TextBox.Text.Length;
- }
- }
-
- ///
- /// Centralize the string format settings. Does the work of checking for user
- /// overrides, and if they're not present, setting the cell alignment to match
- /// (somewhat) the source control's string alignment.
- ///
- /// String alignment
- /// String format flags
- /// DataGridView style to apply (if available)
- /// True if user overrode alignment or flags
- ///
- private static StringFormat managestringformat(StringAlignment alignment, StringFormatFlags flags)
- {
- // start with the provided
- StringFormat format = new StringFormat();
- format.Trimming = StringTrimming.Word;
- format.Alignment = alignment;
- format.FormatFlags = flags;
-
- return format;
- }
-
- ///
- /// PrintPage event handler. This routine prints one page. It will
- /// skip non-printable pages if the user selected the "some pages" option
- /// on the print dialog.
- ///
- /// default object from windows
- /// Event info from Windows about the printing
- private void printDoc_PrintPage(object sender, PrintPageEventArgs e)
- {
- // adjust printing region, make space for headers and footers
- Rectangle rect = new Rectangle(
- e.MarginBounds.Left,
- e.MarginBounds.Top + e.MarginBounds.Top,
- e.MarginBounds.Width,
- e.MarginBounds.Height - e.MarginBounds.Top - e.MarginBounds.Top);
- PrintPageEventArgs ee = new PrintPageEventArgs(e.Graphics, rect, e.PageBounds, e.PageSettings);
- // Print the content of RichTextBox. Store the last character printed.
- intCharFrom = editForm.TextBox.Print(intCharFrom, intCharTo, ee);
-
- // increment page number & check page range
- CurrentPage++;
-
- //-----------------------------------------------------------------
- // print headers
- //-----------------------------------------------------------------
-
- // reset printpos as it may have changed during the 'skip pages' routine just above.
- float printpos = printmargins.Top;
-
- // print page number if user selected it
- if (pagenumberontop)
- {
- // if we have a page number to print
- if (pageno)
- {
- // ... then print it
- printsection(e.Graphics, ref printpos, "Page " + CurrentPage.ToString(CultureInfo.CurrentCulture),
- pagenofont, pagenocolor, pagenumberalignment, pagenumberformatflags);
-
- // if the page number is not on a separate line, don't "use up" it's vertical space
- if (!pagenumberonseparateline)
- printpos -= pagenumberHeight;
- }
- }
-
- // print title if provided
- if (!String.IsNullOrEmpty(title))
- printsection(e.Graphics, ref printpos, title, titlefont,
- titlecolor, titlealignment, titleformatflags);
-
- // print subtitle if provided
- if (!String.IsNullOrEmpty(subtitle))
- printsection(e.Graphics, ref printpos, subtitle, subtitlefont,
- subtitlecolor, subtitlealignment, subtitleformatflags);
-
- //-----------------------------------------------------------------
- // print footer
- //-----------------------------------------------------------------
- printfooter(e.Graphics, ref printpos);
-
- // Check for more pages
- if (intCharFrom < intCharTo)
- e.HasMorePages = true;
- else
- {
- intCharFrom = intCharPrint; // reset
- CurrentPage = 0;
- e.HasMorePages = false;
- }
-
- }
-
- ///
- /// Print a header or footer section. Used for page numbers and titles
- ///
- /// Graphic context to print in
- /// Track vertical space used; 'y' location
- /// String to print
- /// Font to use for printing
- /// Color to print in
- /// Alignment - print to left, center or right
- /// String format flags
- /// True if the user overrode the alignment or flags
- private void printsection(Graphics g, ref float pos, string text,
- Font font, Color color, StringAlignment alignment, StringFormatFlags flags)
- {
- // string formatting setup
- StringFormat printformat = managestringformat(alignment, flags);
-
- // measure string
- SizeF printsize = g.MeasureString(text, font, printWidth, printformat);
-
- // build area to print within
- RectangleF printarea = new RectangleF((float)printmargins.Left, pos, (float)printWidth,
- printsize.Height);
-
- // do the actual print
- g.DrawString(text, font, new SolidBrush(color), printarea, printformat);
-
- // track "used" vertical space
- pos += printsize.Height;
- }
-
- ///
- /// Print the footer. This handles the footer spacing, and printing the page number
- /// at the bottom of the page (if the page number is not in the header).
- ///
- /// Graphic context to print in
- /// Track vertical space used; 'y' location
- private void printfooter(Graphics g, ref float pos)
- {
- // print last footer. Note: need to force printpos to the bottom of the page
- // as we may have run out of data anywhere on the page
- pos = pageHeight - footerHeight - printmargins.Top - printmargins.Bottom;
-
- // add spacing
- pos += footerspacing;
-
- // print the footer
- printsection(g, ref pos, footer, footerfont,
- footercolor, footeralignment, footerformatflags);
-
- // print the page number if it's on the bottom.
- if (!pagenumberontop)
- {
- if (pageno)
- {
- pagenumberHeight = g.MeasureString("M", pagenofont).Height;
- // if the pageno is not on a separate line, push the print location up by its height.
- if (!pagenumberonseparateline)
- pos = pos - pagenumberHeight;
-
- // print the page number
- printsection(g, ref pos, "Page " + CurrentPage.ToString(CultureInfo.CurrentCulture),
- pagenofont, pagenocolor, pagenumberalignment, pagenumberformatflags);
-
- }
- }
- }
-
- private void saveFormData(EditForm editForm)
- {
- // save the datagridview we're printing
- this.editForm = editForm;
- this.intCharFrom = 0;
- this.intCharPrint = 0;
- this.intCharTo = editForm.TextBox.Text.Length;
- }
-
- private void setupPrintDialogue()
- {
- // create new print dialog
- pd = new PrintDialog();
-
- pd.Document = docToPrint;
- pd.AllowSelection = true;
- pd.AllowSomePages = false;
- pd.AllowCurrentPage = false;
- pd.AllowPrintToFile = false;
- pd.UseEXDialog = true;
- }
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Globalization;
+using System.Windows.Forms;
+
+namespace LSLEditor.Helpers
+{
+ ///
+ /// Data Grid View Printer. Print functions for a datagridview, since MS
+ /// didn't see fit to do it.
+ ///
+ class PrinterHelper
+ {
+ //---------------------------------------------------------------------
+ // global variables
+ //---------------------------------------------------------------------
+ #region global variables
+
+ // the data grid view we're printing
+ EditForm editForm = null;
+ int intCharFrom;
+ int intCharTo;
+ int intCharPrint;
+
+ // print document
+ PrintDocument docToPrint = null;
+
+ // print dialogue
+ PrintDialog pd = null;
+
+ // print status items
+ int fromPage = 0;
+ int toPage = -1;
+
+ // page formatting options
+ int pageHeight = 0;
+ int pageWidth = 0;
+ int printWidth = 0;
+ int CurrentPage = 0;
+ PrintRange printRange;
+
+ // calculated values
+ private float footerHeight = 0;
+ private float pagenumberHeight = 0;
+ #endregion
+
+ //---------------------------------------------------------------------
+ // properties - settable by user
+ //---------------------------------------------------------------------
+ #region properties
+
+ // Title
+ #region title properties
+
+ ///
+ /// Title for this report. Default is empty.
+ ///
+ private String title;
+ public String Title
+ {
+ get { return title; }
+ set { title = value; docToPrint.DocumentName = title; }
+ }
+
+ ///
+ /// Font for the title. Default is Tahoma, 18pt.
+ ///
+ private Font titlefont;
+ public Font TitleFont
+ {
+ get { return titlefont; }
+ set { titlefont = value; }
+ }
+
+ ///
+ /// Foreground color for the title. Default is Black
+ ///
+ private Color titlecolor;
+ public Color TitleColor
+ {
+ get { return titlecolor; }
+ set { titlecolor = value; }
+ }
+
+ ///
+ /// Allow the user to override the title string alignment. Default value is
+ /// Alignment - Near;
+ ///
+ private StringAlignment titlealignment;
+ public StringAlignment TitleAlignment
+ {
+ get { return titlealignment; }
+ set { titlealignment = value; }
+ }
+
+ ///
+ /// Allow the user to override the title string format flags. Default values
+ /// are: FormatFlags - NoWrap, LineLimit, NoClip
+ ///
+ private StringFormatFlags titleformatflags;
+ public StringFormatFlags TitleFormatFlags
+ {
+ get { return titleformatflags; }
+ set { titleformatflags = value; }
+ }
+ #endregion
+
+ // SubTitle
+ #region subtitle properties
+
+ ///
+ /// SubTitle for this report. Default is empty.
+ ///
+ private String subtitle;
+ public String SubTitle
+ {
+ get { return subtitle; }
+ set { subtitle = value; }
+ }
+
+ ///
+ /// Font for the subtitle. Default is Tahoma, 12pt.
+ ///
+ private Font subtitlefont;
+ public Font SubTitleFont
+ {
+ get { return subtitlefont; }
+ set { subtitlefont = value; }
+ }
+
+ ///
+ /// Foreground color for the subtitle. Default is Black
+ ///
+ private Color subtitlecolor;
+ public Color SubTitleColor
+ {
+ get { return subtitlecolor; }
+ set { subtitlecolor = value; }
+ }
+
+ ///
+ /// Allow the user to override the subtitle string alignment. Default value is
+ /// Alignment - Near;
+ ///
+ private StringAlignment subtitlealignment;
+ public StringAlignment SubTitleAlignment
+ {
+ get { return subtitlealignment; }
+ set { subtitlealignment = value; }
+ }
+
+ ///
+ /// Allow the user to override the subtitle string format flags. Default values
+ /// are: FormatFlags - NoWrap, LineLimit, NoClip
+ ///
+ private StringFormatFlags subtitleformatflags;
+ public StringFormatFlags SubTitleFormatFlags
+ {
+ get { return subtitleformatflags; }
+ set { subtitleformatflags = value; }
+ }
+ #endregion
+
+ // Footer
+ #region footer properties
+
+ ///
+ /// footer for this report. Default is empty.
+ ///
+ private String footer;
+ public String Footer
+ {
+ get { return footer; }
+ set { footer = value; }
+ }
+
+ ///
+ /// Font for the footer. Default is Tahoma, 10pt.
+ ///
+ private Font footerfont;
+ public Font FooterFont
+ {
+ get { return footerfont; }
+ set { footerfont = value; }
+ }
+
+ ///
+ /// Foreground color for the footer. Default is Black
+ ///
+ private Color footercolor;
+ public Color FooterColor
+ {
+ get { return footercolor; }
+ set { footercolor = value; }
+ }
+
+ ///
+ /// Allow the user to override the footer string alignment. Default value is
+ /// Alignment - Center;
+ ///
+ private StringAlignment footeralignment;
+ public StringAlignment FooterAlignment
+ {
+ get { return footeralignment; }
+ set { footeralignment = value; }
+ }
+
+ ///
+ /// Allow the user to override the footer string format flags. Default values
+ /// are: FormatFlags - NoWrap, LineLimit, NoClip
+ ///
+ private StringFormatFlags footerformatflags;
+ public StringFormatFlags FooterFormatFlags
+ {
+ get { return footerformatflags; }
+ set { footerformatflags = value; }
+ }
+
+ private float footerspacing;
+ public float FooterSpacing
+ {
+ get { return footerspacing; }
+ set { footerspacing = value; }
+ }
+ #endregion
+
+ // Page Numbering
+ #region page number properties
+
+ ///
+ /// Include page number in the printout. Default is true.
+ ///
+ private bool pageno = true;
+ public bool PageNumbers
+ {
+ get { return pageno; }
+ set { pageno = value; }
+ }
+
+ ///
+ /// Font for the page number, Default is Tahoma, 8pt.
+ ///
+ private Font pagenofont;
+ public Font PageNumberFont
+ {
+ get { return pagenofont; }
+ set { pagenofont = value; }
+ }
+
+ ///
+ /// Text color (foreground) for the page number. Default is Black
+ ///
+ private Color pagenocolor;
+ public Color PageNumberColor
+ {
+ get { return pagenocolor; }
+ set { pagenocolor = value; }
+ }
+
+ ///
+ /// Allow the user to override the page number string alignment. Default value is
+ /// Alignment - Near;
+ ///
+ private StringAlignment pagenumberalignment;
+ public StringAlignment PaageNumberAlignment
+ {
+ get { return pagenumberalignment; }
+ set { pagenumberalignment = value; }
+ }
+
+ ///
+ /// Allow the user to override the pagenumber string format flags. Default values
+ /// are: FormatFlags - NoWrap, LineLimit, NoClip
+ ///
+ private StringFormatFlags pagenumberformatflags;
+ public StringFormatFlags PageNumberFormatFlags
+ {
+ get { return pagenumberformatflags; }
+ set { pagenumberformatflags = value; }
+ }
+
+ ///
+ /// Allow the user to select whether to have the page number at the top or bottom
+ /// of the page. Default is false: page numbers on the bottom of the page
+ ///
+ private bool pagenumberontop = false;
+ public bool PageNumberInHeader
+ {
+ get { return pagenumberontop; }
+ set { pagenumberontop = value; }
+ }
+
+ ///
+ /// Should the page number be printed on a separate line, or printed on the
+ /// same line as the header / footer? Default is false;
+ ///
+ private bool pagenumberonseparateline = false;
+ public bool PaageNumberOnSeparateLine
+ {
+ get { return pagenumberonseparateline; }
+ set { pagenumberonseparateline = value; }
+ }
+
+
+ #endregion
+
+ // Page Level Properties
+ #region page level properties
+
+ ///
+ /// Page margins override. Default is (60, 60, 60, 60)
+ ///
+ private Margins printmargins;
+ public Margins PrintMargins
+ {
+ get { return printmargins; }
+ set { printmargins = value; }
+ }
+
+ #endregion
+
+ #endregion
+
+ ///
+ /// Constructor for PrinterHelper
+ ///
+ public PrinterHelper(PageSetupDialog pageSetupDialog)
+ {
+ // create print document
+ docToPrint = new PrintDocument();
+ docToPrint.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
+
+ if (pageSetupDialog.PrinterSettings != null)
+ docToPrint.PrinterSettings = pageSetupDialog.PrinterSettings;
+
+ if (pageSetupDialog.PageSettings != null)
+ docToPrint.DefaultPageSettings = pageSetupDialog.PageSettings;
+ else
+ docToPrint.DefaultPageSettings.Margins = new Margins(60, 80, 40, 40);
+
+ printmargins = docToPrint.DefaultPageSettings.Margins;
+
+ // set default fonts
+ pagenofont = new Font("Tahoma", 10, FontStyle.Regular, GraphicsUnit.Point);
+ pagenocolor = Color.Black;
+ titlefont = new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point);
+ titlecolor = Color.Black;
+ subtitlefont = new Font("Tahoma", 10, FontStyle.Regular, GraphicsUnit.Point);
+ subtitlecolor = Color.Black;
+ footerfont = new Font("Tahoma", 10, FontStyle.Regular, GraphicsUnit.Point);
+ footercolor = Color.Black;
+
+ // set default string formats
+ titlealignment = StringAlignment.Near;
+ titleformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
+
+ subtitlealignment = StringAlignment.Near;
+ subtitleformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
+
+ footeralignment = StringAlignment.Near;
+ footerformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
+
+ pagenumberalignment = StringAlignment.Center;
+ pagenumberformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
+ }
+
+ ///
+ /// Start the printing process, print to a printer.
+ ///
+ /// The EditForm to print
+ /// NOTE: Any changes to this method also need to be done in PrintPreviewEditForm
+ public void PrintEditForm(EditForm editForm)
+ {
+ saveFormData(editForm);
+ setupPrintDialogue();
+
+ // show print dialog
+ if (pd.ShowDialog() == DialogResult.OK)
+ {
+ SetupPrint(pd);
+ docToPrint.Print();
+ }
+
+ }
+
+ ///
+ /// Start the printing process, print to a print preview dialog
+ ///
+ /// The EditForm to print
+ /// NOTE: Any changes to this method also need to be done in PrintDataGridView
+ public void PrintPreviewEditForm(EditForm editForm)
+ {
+ saveFormData(editForm);
+ setupPrintDialogue();
+
+ // show print dialog
+ if (pd.ShowDialog() == DialogResult.OK)
+ {
+ SetupPrint(pd);
+ PrintPreviewDialog ppdialog = new PrintPreviewDialog();
+ ppdialog.Document = docToPrint;
+ ppdialog.ShowDialog();
+ }
+ }
+
+ ///
+ /// Set up the print job. Save information from print dialog
+ /// and print document for easy access. Also sets up the rows
+ /// and columns that will be printed.
+ ///
+ /// The print dialog the user just filled out
+ void SetupPrint(PrintDialog pd)
+ {
+ //-----------------------------------------------------------------
+ // save data from print dialog and document
+ //-----------------------------------------------------------------
+
+ // check to see if we're doing landscape printing
+ if (docToPrint.DefaultPageSettings.Landscape)
+ {
+ // landscape: switch width and height
+ pageHeight = docToPrint.DefaultPageSettings.PaperSize.Width;
+ pageWidth = docToPrint.DefaultPageSettings.PaperSize.Height;
+ }
+ else
+ {
+ // portrait: keep width and height as expected
+ pageHeight = docToPrint.DefaultPageSettings.PaperSize.Height;
+ pageWidth = docToPrint.DefaultPageSettings.PaperSize.Width;
+ }
+
+ // save printer margins and calc print width
+ printmargins = docToPrint.DefaultPageSettings.Margins;
+ printWidth = pageWidth - printmargins.Left - printmargins.Right;
+
+ // save print range
+ printRange = pd.PrinterSettings.PrintRange;
+
+ // pages to print handles "some pages" option
+ if (PrintRange.SomePages == printRange)
+ {
+ // set limits to only print some pages
+ fromPage = pd.PrinterSettings.FromPage;
+ toPage = pd.PrinterSettings.ToPage;
+ }
+ else
+ {
+ // set extremes so that we'll print all pages
+ fromPage = 0;
+ toPage = 2147483647;
+ }
+
+ //-----------------------------------------------------------------
+ // set up the pages to print
+ //-----------------------------------------------------------------
+
+ // pages (handles "selection" and "current page" options
+ if (PrintRange.Selection == printRange)
+ {
+ intCharPrint = this.editForm.TextBox.SelectionStart;
+ intCharFrom = intCharPrint;
+ intCharTo = intCharFrom + this.editForm.TextBox.SelectionLength;
+ }
+ else if (PrintRange.CurrentPage == printRange)
+ {
+ }
+ // this is the default for print all
+ else
+ {
+ intCharPrint = 0;
+ intCharFrom = intCharPrint;
+ intCharTo = this.editForm.TextBox.Text.Length;
+ }
+ }
+
+ ///
+ /// Centralize the string format settings. Does the work of checking for user
+ /// overrides, and if they're not present, setting the cell alignment to match
+ /// (somewhat) the source control's string alignment.
+ ///
+ /// String alignment
+ /// String format flags
+ /// DataGridView style to apply (if available)
+ /// True if user overrode alignment or flags
+ ///
+ private static StringFormat managestringformat(StringAlignment alignment, StringFormatFlags flags)
+ {
+ // start with the provided
+ StringFormat format = new StringFormat();
+ format.Trimming = StringTrimming.Word;
+ format.Alignment = alignment;
+ format.FormatFlags = flags;
+
+ return format;
+ }
+
+ ///
+ /// PrintPage event handler. This routine prints one page. It will
+ /// skip non-printable pages if the user selected the "some pages" option
+ /// on the print dialog.
+ ///
+ /// default object from windows
+ /// Event info from Windows about the printing
+ private void printDoc_PrintPage(object sender, PrintPageEventArgs e)
+ {
+ // adjust printing region, make space for headers and footers
+ Rectangle rect = new Rectangle(
+ e.MarginBounds.Left,
+ e.MarginBounds.Top + e.MarginBounds.Top,
+ e.MarginBounds.Width,
+ e.MarginBounds.Height - e.MarginBounds.Top - e.MarginBounds.Top);
+ PrintPageEventArgs ee = new PrintPageEventArgs(e.Graphics, rect, e.PageBounds, e.PageSettings);
+ // Print the content of RichTextBox. Store the last character printed.
+ intCharFrom = editForm.TextBox.Print(intCharFrom, intCharTo, ee);
+
+ // increment page number & check page range
+ CurrentPage++;
+
+ //-----------------------------------------------------------------
+ // print headers
+ //-----------------------------------------------------------------
+
+ // reset printpos as it may have changed during the 'skip pages' routine just above.
+ float printpos = printmargins.Top;
+
+ // print page number if user selected it
+ if (pagenumberontop)
+ {
+ // if we have a page number to print
+ if (pageno)
+ {
+ // ... then print it
+ printsection(e.Graphics, ref printpos, "Page " + CurrentPage.ToString(CultureInfo.CurrentCulture),
+ pagenofont, pagenocolor, pagenumberalignment, pagenumberformatflags);
+
+ // if the page number is not on a separate line, don't "use up" it's vertical space
+ if (!pagenumberonseparateline)
+ printpos -= pagenumberHeight;
+ }
+ }
+
+ // print title if provided
+ if (!String.IsNullOrEmpty(title))
+ printsection(e.Graphics, ref printpos, title, titlefont,
+ titlecolor, titlealignment, titleformatflags);
+
+ // print subtitle if provided
+ if (!String.IsNullOrEmpty(subtitle))
+ printsection(e.Graphics, ref printpos, subtitle, subtitlefont,
+ subtitlecolor, subtitlealignment, subtitleformatflags);
+
+ //-----------------------------------------------------------------
+ // print footer
+ //-----------------------------------------------------------------
+ printfooter(e.Graphics, ref printpos);
+
+ // Check for more pages
+ if (intCharFrom < intCharTo)
+ e.HasMorePages = true;
+ else
+ {
+ intCharFrom = intCharPrint; // reset
+ CurrentPage = 0;
+ e.HasMorePages = false;
+ }
+
+ }
+
+ ///
+ /// Print a header or footer section. Used for page numbers and titles
+ ///
+ /// Graphic context to print in
+ /// Track vertical space used; 'y' location
+ /// String to print
+ /// Font to use for printing
+ /// Color to print in
+ /// Alignment - print to left, center or right
+ /// String format flags
+ /// True if the user overrode the alignment or flags
+ private void printsection(Graphics g, ref float pos, string text,
+ Font font, Color color, StringAlignment alignment, StringFormatFlags flags)
+ {
+ // string formatting setup
+ StringFormat printformat = managestringformat(alignment, flags);
+
+ // measure string
+ SizeF printsize = g.MeasureString(text, font, printWidth, printformat);
+
+ // build area to print within
+ RectangleF printarea = new RectangleF((float)printmargins.Left, pos, (float)printWidth,
+ printsize.Height);
+
+ // do the actual print
+ g.DrawString(text, font, new SolidBrush(color), printarea, printformat);
+
+ // track "used" vertical space
+ pos += printsize.Height;
+ }
+
+ ///
+ /// Print the footer. This handles the footer spacing, and printing the page number
+ /// at the bottom of the page (if the page number is not in the header).
+ ///
+ /// Graphic context to print in
+ /// Track vertical space used; 'y' location
+ private void printfooter(Graphics g, ref float pos)
+ {
+ // print last footer. Note: need to force printpos to the bottom of the page
+ // as we may have run out of data anywhere on the page
+ pos = pageHeight - footerHeight - printmargins.Top - printmargins.Bottom;
+
+ // add spacing
+ pos += footerspacing;
+
+ // print the footer
+ printsection(g, ref pos, footer, footerfont,
+ footercolor, footeralignment, footerformatflags);
+
+ // print the page number if it's on the bottom.
+ if (!pagenumberontop)
+ {
+ if (pageno)
+ {
+ pagenumberHeight = g.MeasureString("M", pagenofont).Height;
+ // if the pageno is not on a separate line, push the print location up by its height.
+ if (!pagenumberonseparateline)
+ pos = pos - pagenumberHeight;
+
+ // print the page number
+ printsection(g, ref pos, "Page " + CurrentPage.ToString(CultureInfo.CurrentCulture),
+ pagenofont, pagenocolor, pagenumberalignment, pagenumberformatflags);
+
+ }
+ }
+ }
+
+ private void saveFormData(EditForm editForm)
+ {
+ // save the datagridview we're printing
+ this.editForm = editForm;
+ this.intCharFrom = 0;
+ this.intCharPrint = 0;
+ this.intCharTo = editForm.TextBox.Text.Length;
+ }
+
+ private void setupPrintDialogue()
+ {
+ // create new print dialog
+ pd = new PrintDialog();
+
+ pd.Document = docToPrint;
+ pd.AllowSelection = true;
+ pd.AllowSomePages = false;
+ pd.AllowCurrentPage = false;
+ pd.AllowPrintToFile = false;
+ pd.UseEXDialog = true;
+ }
+ }
+}
diff --git a/trunk/Helpers/SendMyKeys.cs b/source/Helpers/SendMyKeys.cs
similarity index 96%
rename from trunk/Helpers/SendMyKeys.cs
rename to source/Helpers/SendMyKeys.cs
index b38adae..3917eb8 100644
--- a/trunk/Helpers/SendMyKeys.cs
+++ b/source/Helpers/SendMyKeys.cs
@@ -1,269 +1,269 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Text;
-using System.Threading;
-using System.Diagnostics;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-
-using System.Windows.Forms;
-
-namespace NativeHelper
-{
- public class NativeWIN32
- {
- public const ushort KEYEVENTF_KEYUP = 0x0002;
-
- public struct KEYBDINPUT
- {
- public ushort wVk;
- public ushort wScan;
- public uint dwFlags;
- public long time;
- public uint dwExtraInfo;
- }
-
- [StructLayout(LayoutKind.Explicit, Size = 28)]
- public struct INPUT
- {
- [FieldOffset(0)]
- public uint type;
- [FieldOffset(4)]
- public KEYBDINPUT ki;
- }
-
- [DllImport("user32.dll")]
- public static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
-
- [DllImport("user32.dll")]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
- }
-
- public class SendMyKeys
- {
- public static void PasteTextToApp(string strText,string strAppName, string strTitle)
- {
- foreach (Process p in Process.GetProcessesByName(strAppName))
- {
- if(strTitle!=null)
- if (p.MainWindowTitle.IndexOf(strTitle) < 0)
- continue;
- NativeWIN32.SetForegroundWindow(p.MainWindowHandle);
- Thread.Sleep(5000);
- SendMyKeys.SendString(strText);
- return;
- }
- }
-
- public static void ClipBoardToApp(string strAppName, string strTitle)
- {
- foreach (Process p in Process.GetProcessesByName(strAppName))
- {
- if (strTitle != null)
- if (p.MainWindowTitle.IndexOf(strTitle) < 0)
- continue;
- NativeWIN32.SetForegroundWindow(p.MainWindowHandle);
- Thread.Sleep(1000);
- SendMyKeys.SendChar((ushort)Keys.V,false,true);
- return;
- }
- }
-
- public static void SendChar(ushort wVk, bool ShiftKey, bool ControlKey)
- {
- uint uintReturn;
-
- NativeWIN32.INPUT structInput = new NativeWIN32.INPUT();
- structInput.type = (uint)1;
- structInput.ki.wScan = 0;
- structInput.ki.time = 0;
- structInput.ki.dwFlags = 0;
- structInput.ki.dwExtraInfo = 0;
-
- if (ControlKey)
- {
- structInput.ki.wVk = (ushort)Keys.ControlKey;
- uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
- }
-
- if (ShiftKey)
- {
- structInput.ki.wVk = (ushort)Keys.ShiftKey;
- uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
- }
-
- structInput.ki.wVk = wVk;
- uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
-
- structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
- structInput.ki.wVk = wVk;
- uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
-
- if (ShiftKey)
- {
- structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
- structInput.ki.wVk = (ushort)Keys.ShiftKey;
- uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
- }
-
- if (ControlKey)
- {
- structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
- structInput.ki.wVk = (ushort)Keys.ControlKey;
- uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
- }
- }
-
- public static void SendString(string s)
- {
- ushort wVk;
- bool ShiftKey;
- foreach (Char c in s.ToCharArray())
- {
- if (Char.IsUpper(c))
- ShiftKey = true;
- else
- ShiftKey = false;
-
- wVk = (ushort)Char.ToUpper(c);
-
- string special = ")!@#$%^&*(";
-
- int intDigit = special.IndexOf(c);
- if (intDigit >= 0)
- {
- ShiftKey = true;
- wVk = (ushort)('0' + intDigit);
- }
- else
- {
- switch (c)
- {
- case ':':
- ShiftKey = true;
- wVk = (ushort)Keys.Oem1;
- break;
- case ';':
- wVk = (ushort)Keys.Oem1;
- break;
- case '-':
- wVk = (ushort)Keys.OemMinus;
- break;
- case '_':
- ShiftKey = true;
- wVk = (ushort)Keys.OemMinus;
- break;
- case '+':
- ShiftKey = true;
- wVk = (ushort)Keys.Oemplus;
- break;
- case '=':
- wVk = (ushort)Keys.Oemplus;
- break;
- case '/':
- wVk = (ushort)Keys.Oem2;
- break;
- case '?':
- ShiftKey = true;
- wVk = (ushort)Keys.OemQuestion;
- break;
- case '.':
- wVk = (ushort)Keys.OemPeriod;
- break;
- case '>':
- ShiftKey = true;
- wVk = (ushort)Keys.OemPeriod;
- break;
- case ',':
- wVk = (ushort)Keys.Oemcomma;
- break;
- case '<':
- ShiftKey = true;
- wVk = (ushort)Keys.Oemcomma;
- break;
- case '`':
- wVk = (ushort)Keys.Oemtilde;
- break;
- case '~':
- ShiftKey = true;
- wVk = (ushort)Keys.Oemtilde;
- break;
- case '|':
- ShiftKey = true;
- wVk = (ushort)Keys.Oem5;
- break;
- case '\\':
- wVk = (ushort)Keys.Oem5;
- break;
- case '[':
- wVk = (ushort)Keys.OemOpenBrackets;
- break;
- case '{':
- ShiftKey = true;
- wVk = (ushort)Keys.OemOpenBrackets;
- break;
- case ']':
- wVk = (ushort)Keys.Oem6;
- break;
- case '}':
- ShiftKey = true;
- wVk = (ushort)Keys.Oem6;
- break;
- case '\'':
- wVk = (ushort)Keys.Oem7;
- break;
- case '"':
- ShiftKey = true;
- wVk = (ushort)Keys.Oem7;
- break;
- default:
- break;
- }
- }
-
- SendChar(wVk, ShiftKey, false);
-
- }
- }
- }
-
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Text;
+using System.Threading;
+using System.Diagnostics;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+using System.Windows.Forms;
+
+namespace NativeHelper
+{
+ public class NativeWIN32
+ {
+ public const ushort KEYEVENTF_KEYUP = 0x0002;
+
+ public struct KEYBDINPUT
+ {
+ public ushort wVk;
+ public ushort wScan;
+ public uint dwFlags;
+ public long time;
+ public uint dwExtraInfo;
+ }
+
+ [StructLayout(LayoutKind.Explicit, Size = 28)]
+ public struct INPUT
+ {
+ [FieldOffset(0)]
+ public uint type;
+ [FieldOffset(4)]
+ public KEYBDINPUT ki;
+ }
+
+ [DllImport("user32.dll")]
+ public static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
+ }
+
+ public class SendMyKeys
+ {
+ public static void PasteTextToApp(string strText,string strAppName, string strTitle)
+ {
+ foreach (Process p in Process.GetProcessesByName(strAppName))
+ {
+ if(strTitle!=null)
+ if (p.MainWindowTitle.IndexOf(strTitle) < 0)
+ continue;
+ NativeWIN32.SetForegroundWindow(p.MainWindowHandle);
+ Thread.Sleep(5000);
+ SendMyKeys.SendString(strText);
+ return;
+ }
+ }
+
+ public static void ClipBoardToApp(string strAppName, string strTitle)
+ {
+ foreach (Process p in Process.GetProcessesByName(strAppName))
+ {
+ if (strTitle != null)
+ if (p.MainWindowTitle.IndexOf(strTitle) < 0)
+ continue;
+ NativeWIN32.SetForegroundWindow(p.MainWindowHandle);
+ Thread.Sleep(1000);
+ SendMyKeys.SendChar((ushort)Keys.V,false,true);
+ return;
+ }
+ }
+
+ public static void SendChar(ushort wVk, bool ShiftKey, bool ControlKey)
+ {
+ uint uintReturn;
+
+ NativeWIN32.INPUT structInput = new NativeWIN32.INPUT();
+ structInput.type = (uint)1;
+ structInput.ki.wScan = 0;
+ structInput.ki.time = 0;
+ structInput.ki.dwFlags = 0;
+ structInput.ki.dwExtraInfo = 0;
+
+ if (ControlKey)
+ {
+ structInput.ki.wVk = (ushort)Keys.ControlKey;
+ uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
+ }
+
+ if (ShiftKey)
+ {
+ structInput.ki.wVk = (ushort)Keys.ShiftKey;
+ uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
+ }
+
+ structInput.ki.wVk = wVk;
+ uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
+
+ structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
+ structInput.ki.wVk = wVk;
+ uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
+
+ if (ShiftKey)
+ {
+ structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
+ structInput.ki.wVk = (ushort)Keys.ShiftKey;
+ uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
+ }
+
+ if (ControlKey)
+ {
+ structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
+ structInput.ki.wVk = (ushort)Keys.ControlKey;
+ uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
+ }
+ }
+
+ public static void SendString(string s)
+ {
+ ushort wVk;
+ bool ShiftKey;
+ foreach (Char c in s.ToCharArray())
+ {
+ if (Char.IsUpper(c))
+ ShiftKey = true;
+ else
+ ShiftKey = false;
+
+ wVk = (ushort)Char.ToUpper(c);
+
+ string special = ")!@#$%^&*(";
+
+ int intDigit = special.IndexOf(c);
+ if (intDigit >= 0)
+ {
+ ShiftKey = true;
+ wVk = (ushort)('0' + intDigit);
+ }
+ else
+ {
+ switch (c)
+ {
+ case ':':
+ ShiftKey = true;
+ wVk = (ushort)Keys.Oem1;
+ break;
+ case ';':
+ wVk = (ushort)Keys.Oem1;
+ break;
+ case '-':
+ wVk = (ushort)Keys.OemMinus;
+ break;
+ case '_':
+ ShiftKey = true;
+ wVk = (ushort)Keys.OemMinus;
+ break;
+ case '+':
+ ShiftKey = true;
+ wVk = (ushort)Keys.Oemplus;
+ break;
+ case '=':
+ wVk = (ushort)Keys.Oemplus;
+ break;
+ case '/':
+ wVk = (ushort)Keys.Oem2;
+ break;
+ case '?':
+ ShiftKey = true;
+ wVk = (ushort)Keys.OemQuestion;
+ break;
+ case '.':
+ wVk = (ushort)Keys.OemPeriod;
+ break;
+ case '>':
+ ShiftKey = true;
+ wVk = (ushort)Keys.OemPeriod;
+ break;
+ case ',':
+ wVk = (ushort)Keys.Oemcomma;
+ break;
+ case '<':
+ ShiftKey = true;
+ wVk = (ushort)Keys.Oemcomma;
+ break;
+ case '`':
+ wVk = (ushort)Keys.Oemtilde;
+ break;
+ case '~':
+ ShiftKey = true;
+ wVk = (ushort)Keys.Oemtilde;
+ break;
+ case '|':
+ ShiftKey = true;
+ wVk = (ushort)Keys.Oem5;
+ break;
+ case '\\':
+ wVk = (ushort)Keys.Oem5;
+ break;
+ case '[':
+ wVk = (ushort)Keys.OemOpenBrackets;
+ break;
+ case '{':
+ ShiftKey = true;
+ wVk = (ushort)Keys.OemOpenBrackets;
+ break;
+ case ']':
+ wVk = (ushort)Keys.Oem6;
+ break;
+ case '}':
+ ShiftKey = true;
+ wVk = (ushort)Keys.Oem6;
+ break;
+ case '\'':
+ wVk = (ushort)Keys.Oem7;
+ break;
+ case '"':
+ ShiftKey = true;
+ wVk = (ushort)Keys.Oem7;
+ break;
+ default:
+ break;
+ }
+ }
+
+ SendChar(wVk, ShiftKey, false);
+
+ }
+ }
+ }
+
+}
diff --git a/trunk/Helpers/Settings.cs b/source/Helpers/Settings.cs
similarity index 97%
rename from trunk/Helpers/Settings.cs
rename to source/Helpers/Settings.cs
index d518eaa..112885f 100644
--- a/trunk/Helpers/Settings.cs
+++ b/source/Helpers/Settings.cs
@@ -1,70 +1,70 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-namespace LSLEditor.Properties
-{
-
-
- // This class allows you to handle specific events on the settings class:
- // The SettingChanging event is raised before a setting's value is changed.
- // The PropertyChanged event is raised after a setting's value is changed.
- // The SettingsLoaded event is raised after the setting values are loaded.
- // The SettingsSaving event is raised before the setting values are saved.
- internal sealed partial class Settings {
-
- public Settings() {
- // // To add event handlers for saving and changing settings, uncomment the lines below:
- //
- // this.SettingChanging += this.SettingChangingEventHandler;
- //
- // this.SettingsSaving += this.SettingsSavingEventHandler;
- //
- }
-
- private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
- // Add code to handle the SettingChangingEvent event here.
- }
-
- private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
- // Add code to handle the SettingsSaving event here.
- }
-
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+namespace LSLEditor.Properties
+{
+
+
+ // This class allows you to handle specific events on the settings class:
+ // The SettingChanging event is raised before a setting's value is changed.
+ // The PropertyChanged event is raised after a setting's value is changed.
+ // The SettingsLoaded event is raised after the setting values are loaded.
+ // The SettingsSaving event is raised before the setting values are saved.
+ internal sealed partial class Settings {
+
+ public Settings() {
+ // // To add event handlers for saving and changing settings, uncomment the lines below:
+ //
+ // this.SettingChanging += this.SettingChangingEventHandler;
+ //
+ // this.SettingsSaving += this.SettingsSavingEventHandler;
+ //
+ }
+
+ private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
+ // Add code to handle the SettingChangingEvent event here.
+ }
+
+ private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
+ // Add code to handle the SettingsSaving event here.
+ }
+
+
+ }
+}
diff --git a/trunk/Helpers/SmtpClient.cs b/source/Helpers/SmtpClient.cs
similarity index 96%
rename from trunk/Helpers/SmtpClient.cs
rename to source/Helpers/SmtpClient.cs
index af2094f..1dc2d78 100644
--- a/trunk/Helpers/SmtpClient.cs
+++ b/source/Helpers/SmtpClient.cs
@@ -1,351 +1,351 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.IO;
-using System.Net;
-using System.Text;
-using System.Net.Sockets;
-using System.Collections;
-
-namespace LSLEditor
-{
- public class MailAttachment
- {
- public string Filename;
- public MailAttachment(string strAttachmentFile)
- {
- this.Filename = strAttachmentFile;
- }
- }
-
- public class MailMessage
- {
- public string Body;
- public string From;
- public string To;
- public string Cc;
- public string Bcc;
- public string Subject;
- public Hashtable Headers;
- public ArrayList Attachments;
-
- public MailMessage()
- {
- this.Headers = new Hashtable();
- this.Attachments = new ArrayList();
- }
- }
-
- ///
- /// provides methods to send email via smtp direct to mail server
- /// http://www.ietf.org/rfc/rfc0821.txt
- ///
- public class SmtpClient
- {
- ///
- /// Get / Set the name of the SMTP mail server
- ///
- public string SmtpServer;
- private enum SMTPResponse: int
- {
- CONNECT_SUCCESS = 220,
- GENERIC_SUCCESS = 250,
- DATA_SUCCESS = 354,
- QUIT_SUCCESS = 221,
-
- AUTH_SUCCESS = 334,
- AUTH_GRANTED = 235
- }
-
- public string Send(MailMessage message)
- {
- string strResponse;
- byte[] data;
- IPHostEntry IPhst;
- try
- {
- IPhst = Dns.GetHostEntry(SmtpServer);
- }
- catch (Exception exception)
- {
- return "Email:Error on "+exception.Message;
- }
- IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25);
- Socket s= new Socket(endPt.AddressFamily, SocketType.Stream,ProtocolType.Tcp);
- s.Connect(endPt);
-
- if(!Check_Response(s, SMTPResponse.CONNECT_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email:Error on connection (" + strResponse + ")";
- }
-
- Senddata(s, string.Format("HELO {0}\r\n", Dns.GetHostName() ));
- if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email:Error on HELO (" + strResponse + ")";
- }
-
- // SMTP Authentication
- if (Properties.Settings.Default.SmtpUserid != "")
- {
- if (Properties.Settings.Default.SmtpAuth == "PLAIN")
- {
- Senddata(s, "AUTH PLAIN\r\n");
- if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email: Error on AUTH PLAIN (" + strResponse + ")";
- }
- data = Encoding.ASCII.GetBytes(string.Format("\0{0}\0{1}",
- Properties.Settings.Default.SmtpUserid,
- Properties.Settings.Default.SmtpPassword));
- Senddata(s, string.Format("{0}\r\n",Convert.ToBase64String(data)));
- if (!Check_Response(s, SMTPResponse.AUTH_GRANTED, out strResponse))
- {
- s.Close();
- return "Email: AUTH PLAIN not granted (" + strResponse + ")";
- }
- }
- if (Properties.Settings.Default.SmtpAuth == "LOGIN")
- {
- Senddata(s, "AUTH LOGIN\r\n");
- if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email: Error on AUTH LOGIN (" + strResponse + ")";
- }
- data = Encoding.ASCII.GetBytes(Properties.Settings.Default.SmtpUserid);
- Senddata(s, string.Format("{0}\r\n", Convert.ToBase64String(data)));
- if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email: AUTH LOGIN userid error (" + strResponse + ")";
- }
- data = Encoding.ASCII.GetBytes(Properties.Settings.Default.SmtpPassword);
- Senddata(s, string.Format("{0}\r\n", Convert.ToBase64String(data)));
- if (!Check_Response(s, SMTPResponse.AUTH_GRANTED, out strResponse))
- {
- s.Close();
- return "Email: AUTH LOGIN not granted (" + strResponse + ")";
- }
- }
- if (Properties.Settings.Default.SmtpAuth == "CRAM-MD5")
- {
- s.Close();
- return "Email: LSLEditor Not Implemented CRAM-MD5";
-
- }
- if (Properties.Settings.Default.SmtpAuth == "DIGEST-MD5")
- {
- s.Close();
- return "Email: LSLEditor Not Implemented DIGEST-MD5";
- }
- if (Properties.Settings.Default.SmtpAuth == "EXTERNAL")
- {
- s.Close();
- return "Email: LSLEditor Not Implemented EXTERNAL";
- }
- if (Properties.Settings.Default.SmtpAuth == "ANONYMOUS")
- {
- s.Close();
- return "Email: LSLEditor Not Implemented ANONYMOUS";
- }
- }
-
- Senddata(s, string.Format("MAIL From: {0}\r\n", message.From ));
- if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email: Error on MAIL From (" + strResponse + ")";
- }
-
- string _To = message.To;
- string[] Tos= _To.Split(new char[] {';'});
- foreach (string To in Tos)
- {
- Senddata(s, string.Format("RCPT TO: {0}\r\n", To));
- if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email: Error on RCPT TO (" + strResponse + ")";
- }
- }
-
- if(message.Cc!=null)
- {
- Tos= message.Cc.Split(new char[] {';'});
- foreach (string To in Tos)
- {
- Senddata(s, string.Format("RCPT TO: {0}\r\n", To));
- if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email: Error on (CC) RCPT TO (" + strResponse + ")";
- }
- }
- }
-
- StringBuilder Header=new StringBuilder();
- Header.Append("From: " + message.From + "\r\n");
- Tos= message.To.Split(new char[] {';'});
- Header.Append("To: ");
- for( int i=0; i< Tos.Length; i++)
- {
- Header.Append( i > 0 ? "," : "" );
- Header.Append(Tos[i]);
- }
- Header.Append("\r\n");
- if(message.Cc!=null)
- {
- Tos= message.Cc.Split(new char[] {';'});
- Header.Append("Cc: ");
- for( int i=0; i< Tos.Length; i++)
- {
- Header.Append( i > 0 ? "," : "" );
- Header.Append(Tos[i]);
- }
- Header.Append("\r\n");
- }
- Header.Append("Date: " + DateTime.Now.ToString("R" ) + "\r\n");
- Header.Append("Subject: " + message.Subject+ "\r\n");
- Header.Append("X-Mailer: SMTPClient v2.36 (LSL-Editor)\r\n" );
- // escape . on newline
-
- string MsgBody = message.Body.Replace("\n.","\n..");
- if(!MsgBody.EndsWith("\r\n"))
- MsgBody+="\r\n";
- if(message.Attachments.Count>0)
- {
- Header.Append( "MIME-Version: 1.0\r\n" );
- Header.Append( "Content-Type: multipart/mixed; boundary=unique-boundary-1\r\n" );
- Header.Append("\r\n");
- Header.Append( "This is a multi-part message in MIME format.\r\n" );
- StringBuilder sb = new StringBuilder();
- sb.Append("--unique-boundary-1\r\n");
- sb.Append("Content-Type: text/plain\r\n");
- sb.Append("Content-Transfer-Encoding: 7Bit\r\n");
- sb.Append("\r\n");
- sb.Append(MsgBody + "\r\n");
- sb.Append("\r\n");
-
- foreach(object o in message.Attachments)
- {
- MailAttachment a = o as MailAttachment;
- byte[] binaryData;
- if(a!=null)
- {
- FileInfo f = new FileInfo(a.Filename);
- sb.Append("--unique-boundary-1\r\n");
- sb.Append("Content-Type: application/octet-stream; file=" + f.Name + "\r\n");
- sb.Append("Content-Transfer-Encoding: base64\r\n");
- sb.Append("Content-Disposition: attachment; filename=" + f.Name + "\r\n");
- sb.Append("\r\n");
- FileStream fs = f.OpenRead();
- binaryData = new Byte[fs.Length];
- long bytesRead = fs.Read(binaryData, 0, (int)fs.Length);
- fs.Close();
- string base64String = System.Convert.ToBase64String(binaryData, 0,binaryData.Length);
-
- for(int i=0; i< base64String.Length ; )
- {
- int nextchunk=100;
- if(base64String.Length - (i + nextchunk ) <0)
- nextchunk = base64String.Length -i;
- sb.Append(base64String.Substring(i, nextchunk));
- sb.Append("\r\n");
- i+=nextchunk;
-
- }
- sb.Append("\r\n");
- }
- }
- MsgBody=sb.ToString();
- }
-
- Senddata(s, ("DATA\r\n"));
- if (!Check_Response(s, SMTPResponse.DATA_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email:Error on DATA (" + strResponse + ")";
- }
- Header.Append( "\r\n" );
- Header.Append( MsgBody);
- Header.Append("\r\n.\r\n");
- Senddata(s, Header.ToString());
- if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email:Error on message body (" + strResponse + ")";
- }
-
- Senddata(s, "QUIT\r\n");
- if (!Check_Response(s, SMTPResponse.QUIT_SUCCESS, out strResponse))
- {
- s.Close();
- return "Email:Error on QUIT (" + strResponse + ")";
- }
- s.Close();
- return "Email: Succes :-)";
- }
- private void Senddata(Socket s, string msg)
- {
- byte[] _msg = Encoding.ASCII.GetBytes(msg);
- s.Send(_msg , 0, _msg .Length, SocketFlags.None);
- }
- private bool Check_Response(Socket s, SMTPResponse response_expected, out string sResponse)
- {
- byte[] bytes = new byte[1024];
- while (s.Available==0)
- {
- System.Threading.Thread.Sleep(100);
- }
-
- int intCount = s.Receive(bytes, 0, s.Available, SocketFlags.None);
- sResponse = Encoding.ASCII.GetString(bytes,0,intCount);
- int response = Convert.ToInt32(sResponse.Substring(0,3));
- if(response != (int)response_expected)
- return false;
- return true;
- }
- }
-}
-
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Net.Sockets;
+using System.Collections;
+
+namespace LSLEditor
+{
+ public class MailAttachment
+ {
+ public string Filename;
+ public MailAttachment(string strAttachmentFile)
+ {
+ this.Filename = strAttachmentFile;
+ }
+ }
+
+ public class MailMessage
+ {
+ public string Body;
+ public string From;
+ public string To;
+ public string Cc;
+ public string Bcc;
+ public string Subject;
+ public Hashtable Headers;
+ public ArrayList Attachments;
+
+ public MailMessage()
+ {
+ this.Headers = new Hashtable();
+ this.Attachments = new ArrayList();
+ }
+ }
+
+ ///
+ /// provides methods to send email via smtp direct to mail server
+ /// http://www.ietf.org/rfc/rfc0821.txt
+ ///
+ public class SmtpClient
+ {
+ ///
+ /// Get / Set the name of the SMTP mail server
+ ///
+ public string SmtpServer;
+ private enum SMTPResponse: int
+ {
+ CONNECT_SUCCESS = 220,
+ GENERIC_SUCCESS = 250,
+ DATA_SUCCESS = 354,
+ QUIT_SUCCESS = 221,
+
+ AUTH_SUCCESS = 334,
+ AUTH_GRANTED = 235
+ }
+
+ public string Send(MailMessage message)
+ {
+ string strResponse;
+ byte[] data;
+ IPHostEntry IPhst;
+ try
+ {
+ IPhst = Dns.GetHostEntry(SmtpServer);
+ }
+ catch (Exception exception)
+ {
+ return "Email:Error on "+exception.Message;
+ }
+ IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25);
+ Socket s= new Socket(endPt.AddressFamily, SocketType.Stream,ProtocolType.Tcp);
+ s.Connect(endPt);
+
+ if(!Check_Response(s, SMTPResponse.CONNECT_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email:Error on connection (" + strResponse + ")";
+ }
+
+ Senddata(s, string.Format("HELO {0}\r\n", Dns.GetHostName() ));
+ if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email:Error on HELO (" + strResponse + ")";
+ }
+
+ // SMTP Authentication
+ if (Properties.Settings.Default.SmtpUserid != "")
+ {
+ if (Properties.Settings.Default.SmtpAuth == "PLAIN")
+ {
+ Senddata(s, "AUTH PLAIN\r\n");
+ if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email: Error on AUTH PLAIN (" + strResponse + ")";
+ }
+ data = Encoding.ASCII.GetBytes(string.Format("\0{0}\0{1}",
+ Properties.Settings.Default.SmtpUserid,
+ Properties.Settings.Default.SmtpPassword));
+ Senddata(s, string.Format("{0}\r\n",Convert.ToBase64String(data)));
+ if (!Check_Response(s, SMTPResponse.AUTH_GRANTED, out strResponse))
+ {
+ s.Close();
+ return "Email: AUTH PLAIN not granted (" + strResponse + ")";
+ }
+ }
+ if (Properties.Settings.Default.SmtpAuth == "LOGIN")
+ {
+ Senddata(s, "AUTH LOGIN\r\n");
+ if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email: Error on AUTH LOGIN (" + strResponse + ")";
+ }
+ data = Encoding.ASCII.GetBytes(Properties.Settings.Default.SmtpUserid);
+ Senddata(s, string.Format("{0}\r\n", Convert.ToBase64String(data)));
+ if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email: AUTH LOGIN userid error (" + strResponse + ")";
+ }
+ data = Encoding.ASCII.GetBytes(Properties.Settings.Default.SmtpPassword);
+ Senddata(s, string.Format("{0}\r\n", Convert.ToBase64String(data)));
+ if (!Check_Response(s, SMTPResponse.AUTH_GRANTED, out strResponse))
+ {
+ s.Close();
+ return "Email: AUTH LOGIN not granted (" + strResponse + ")";
+ }
+ }
+ if (Properties.Settings.Default.SmtpAuth == "CRAM-MD5")
+ {
+ s.Close();
+ return "Email: LSLEditor Not Implemented CRAM-MD5";
+
+ }
+ if (Properties.Settings.Default.SmtpAuth == "DIGEST-MD5")
+ {
+ s.Close();
+ return "Email: LSLEditor Not Implemented DIGEST-MD5";
+ }
+ if (Properties.Settings.Default.SmtpAuth == "EXTERNAL")
+ {
+ s.Close();
+ return "Email: LSLEditor Not Implemented EXTERNAL";
+ }
+ if (Properties.Settings.Default.SmtpAuth == "ANONYMOUS")
+ {
+ s.Close();
+ return "Email: LSLEditor Not Implemented ANONYMOUS";
+ }
+ }
+
+ Senddata(s, string.Format("MAIL From: {0}\r\n", message.From ));
+ if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email: Error on MAIL From (" + strResponse + ")";
+ }
+
+ string _To = message.To;
+ string[] Tos= _To.Split(new char[] {';'});
+ foreach (string To in Tos)
+ {
+ Senddata(s, string.Format("RCPT TO: {0}\r\n", To));
+ if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email: Error on RCPT TO (" + strResponse + ")";
+ }
+ }
+
+ if(message.Cc!=null)
+ {
+ Tos= message.Cc.Split(new char[] {';'});
+ foreach (string To in Tos)
+ {
+ Senddata(s, string.Format("RCPT TO: {0}\r\n", To));
+ if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email: Error on (CC) RCPT TO (" + strResponse + ")";
+ }
+ }
+ }
+
+ StringBuilder Header=new StringBuilder();
+ Header.Append("From: " + message.From + "\r\n");
+ Tos= message.To.Split(new char[] {';'});
+ Header.Append("To: ");
+ for( int i=0; i< Tos.Length; i++)
+ {
+ Header.Append( i > 0 ? "," : "" );
+ Header.Append(Tos[i]);
+ }
+ Header.Append("\r\n");
+ if(message.Cc!=null)
+ {
+ Tos= message.Cc.Split(new char[] {';'});
+ Header.Append("Cc: ");
+ for( int i=0; i< Tos.Length; i++)
+ {
+ Header.Append( i > 0 ? "," : "" );
+ Header.Append(Tos[i]);
+ }
+ Header.Append("\r\n");
+ }
+ Header.Append("Date: " + DateTime.Now.ToString("R" ) + "\r\n");
+ Header.Append("Subject: " + message.Subject+ "\r\n");
+ Header.Append("X-Mailer: SMTPClient v2.36 (LSL-Editor)\r\n" );
+ // escape . on newline
+
+ string MsgBody = message.Body.Replace("\n.","\n..");
+ if(!MsgBody.EndsWith("\r\n"))
+ MsgBody+="\r\n";
+ if(message.Attachments.Count>0)
+ {
+ Header.Append( "MIME-Version: 1.0\r\n" );
+ Header.Append( "Content-Type: multipart/mixed; boundary=unique-boundary-1\r\n" );
+ Header.Append("\r\n");
+ Header.Append( "This is a multi-part message in MIME format.\r\n" );
+ StringBuilder sb = new StringBuilder();
+ sb.Append("--unique-boundary-1\r\n");
+ sb.Append("Content-Type: text/plain\r\n");
+ sb.Append("Content-Transfer-Encoding: 7Bit\r\n");
+ sb.Append("\r\n");
+ sb.Append(MsgBody + "\r\n");
+ sb.Append("\r\n");
+
+ foreach(object o in message.Attachments)
+ {
+ MailAttachment a = o as MailAttachment;
+ byte[] binaryData;
+ if(a!=null)
+ {
+ FileInfo f = new FileInfo(a.Filename);
+ sb.Append("--unique-boundary-1\r\n");
+ sb.Append("Content-Type: application/octet-stream; file=" + f.Name + "\r\n");
+ sb.Append("Content-Transfer-Encoding: base64\r\n");
+ sb.Append("Content-Disposition: attachment; filename=" + f.Name + "\r\n");
+ sb.Append("\r\n");
+ FileStream fs = f.OpenRead();
+ binaryData = new Byte[fs.Length];
+ long bytesRead = fs.Read(binaryData, 0, (int)fs.Length);
+ fs.Close();
+ string base64String = System.Convert.ToBase64String(binaryData, 0,binaryData.Length);
+
+ for(int i=0; i< base64String.Length ; )
+ {
+ int nextchunk=100;
+ if(base64String.Length - (i + nextchunk ) <0)
+ nextchunk = base64String.Length -i;
+ sb.Append(base64String.Substring(i, nextchunk));
+ sb.Append("\r\n");
+ i+=nextchunk;
+
+ }
+ sb.Append("\r\n");
+ }
+ }
+ MsgBody=sb.ToString();
+ }
+
+ Senddata(s, ("DATA\r\n"));
+ if (!Check_Response(s, SMTPResponse.DATA_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email:Error on DATA (" + strResponse + ")";
+ }
+ Header.Append( "\r\n" );
+ Header.Append( MsgBody);
+ Header.Append("\r\n.\r\n");
+ Senddata(s, Header.ToString());
+ if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email:Error on message body (" + strResponse + ")";
+ }
+
+ Senddata(s, "QUIT\r\n");
+ if (!Check_Response(s, SMTPResponse.QUIT_SUCCESS, out strResponse))
+ {
+ s.Close();
+ return "Email:Error on QUIT (" + strResponse + ")";
+ }
+ s.Close();
+ return "Email: Succes :-)";
+ }
+ private void Senddata(Socket s, string msg)
+ {
+ byte[] _msg = Encoding.ASCII.GetBytes(msg);
+ s.Send(_msg , 0, _msg .Length, SocketFlags.None);
+ }
+ private bool Check_Response(Socket s, SMTPResponse response_expected, out string sResponse)
+ {
+ byte[] bytes = new byte[1024];
+ while (s.Available==0)
+ {
+ System.Threading.Thread.Sleep(100);
+ }
+
+ int intCount = s.Receive(bytes, 0, s.Available, SocketFlags.None);
+ sResponse = Encoding.ASCII.GetString(bytes,0,intCount);
+ int response = Convert.ToInt32(sResponse.Substring(0,3));
+ if(response != (int)response_expected)
+ return false;
+ return true;
+ }
+ }
+}
+
diff --git a/trunk/Helpers/TabControlExtended.Designer.cs b/source/Helpers/TabControlExtended.Designer.cs
similarity index 96%
rename from trunk/Helpers/TabControlExtended.Designer.cs
rename to source/Helpers/TabControlExtended.Designer.cs
index cae4121..9788e2a 100644
--- a/trunk/Helpers/TabControlExtended.Designer.cs
+++ b/source/Helpers/TabControlExtended.Designer.cs
@@ -1,28 +1,28 @@
-namespace System.Windows.Forms
-{
- partial class TabControlExtended
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- }
-
- #endregion
- }
-}
+namespace System.Windows.Forms
+{
+ partial class TabControlExtended
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/Helpers/TabControlExtended.cs b/source/Helpers/TabControlExtended.cs
similarity index 96%
rename from trunk/Helpers/TabControlExtended.cs
rename to source/Helpers/TabControlExtended.cs
index f01d371..967a3d6 100644
--- a/trunk/Helpers/TabControlExtended.cs
+++ b/source/Helpers/TabControlExtended.cs
@@ -1,245 +1,245 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Drawing;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Windows.Forms.VisualStyles;
-
-namespace System.Windows.Forms
-{
- public partial class TabControlExtended : System.Windows.Forms.TabControl
- {
- private int HoverIndex;
- private bool Extended;
-
- public event EventHandler OnTabClose;
-
- public TabControlExtended()
- {
- InitializeComponent();
- }
-
- public TabControlExtended(IContainer container)
- {
- InitializeComponent();
-
- container.Add(this);
- }
-
- public void SetDrawMode()
- {
- try
- {
- HoverIndex = 0;
- VisualStyleRenderer render = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
- this.DrawMode = TabDrawMode.OwnerDrawFixed;
- this.SetStyle(ControlStyles.UserPaint, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- this.SetStyle(ControlStyles.DoubleBuffer, true);
- this.SetStyle(ControlStyles.ResizeRedraw, true);
- this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
- this.Extended = true;
- }
- catch
- {
- this.Extended = false;
- this.DrawMode = TabDrawMode.Normal;
- }
- }
-
-/*
-protected override bool ProcessMnemonic(char charCode)
-{
- foreach (TabPage p in this.TabPages)
- {
- if (Control.IsMnemonic(charCode, p.Text))
- {
- this.SelectedTab = p;
- this.Focus();
- return true;
- }
- }
- return false;
-}
-*/
-
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- if (!this.Extended)
- return;
- MyPaint(e);
- }
-
- protected override void OnSelectedIndexChanged(EventArgs e)
- {
- this.HoverIndex = -1;
- base.OnSelectedIndexChanged(e);
- }
-
- private void MyPaint(PaintEventArgs e)
- {
- if (!this.Visible)
- return;
-
- Graphics g = e.Graphics;
-
- Rectangle displayRectangle = this.DisplayRectangle;
-
- Size borderSize = SystemInformation.Border3DSize;
- displayRectangle.Inflate(borderSize.Width << 1, borderSize.Height << 1);
-
- VisualStyleRenderer render = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
-
- render.DrawBackground(g, displayRectangle);
-
- for (int intI = 0; intI < this.TabCount; intI++)
- if (intI != this.SelectedIndex)
- DrawTab(g, intI);
- if (this.SelectedIndex >= 0)
- DrawTab(g, this.SelectedIndex);
- }
-
- protected override void OnMouseMove(MouseEventArgs e)
- {
- base.OnMouseMove(e);
- if (!Extended)
- return;
-
- Point p = e.Location;
- for (int intI = 0; intI < this.TabCount; intI++)
- {
- Rectangle rectangle = GetTabRect(intI);
- if (rectangle.Contains(p))
- {
- HoverIndex = intI;
- this.Invalidate();
- }
- }
- }
-
- protected override void OnMouseLeave(EventArgs e)
- {
- base.OnMouseLeave(e);
- if (!Extended)
- return;
-
- HoverIndex = this.SelectedIndex;
- this.Invalidate();
- }
-
- protected override void OnMouseUp(MouseEventArgs e)
- {
- base.OnMouseUp(e);
- if (!Extended)
- return;
-
- Point p = e.Location;
- Rectangle rectangle = this.GetTabRect(this.SelectedIndex);
- if (rectangle.Contains(p))
- {
- Rectangle closeImage = new Rectangle(rectangle.Right - 15 - 5, 5, 15, 15);
- if (closeImage.Contains(p))
- {
- if (OnTabClose != null)
- OnTabClose(this.SelectedIndex, new EventArgs());
- else
- this.TabPages.RemoveAt(this.SelectedIndex);
- }
- }
- }
-
- private void DrawTab(Graphics g, int intIndex)
- {
- Font font;
- Bitmap bitmap;
-
- Rectangle recBounds = this.GetTabRect(intIndex);
- RectangleF tabTextArea = (RectangleF)this.GetTabRect(intIndex);
-
- TabPage tabPage = this.TabPages[intIndex];
-
- Size borderSize = SystemInformation.Border3DSize;
-
- VisualStyleRenderer render;
- if (this.SelectedIndex == intIndex)
- {
- font = new Font(this.Font, FontStyle.Bold);
- Point p = this.PointToClient(Control.MousePosition);
- Rectangle closeImage = new Rectangle(recBounds.Right - 15 - 5, 5, 15, 15);
- if (closeImage.Contains(p))
- bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Active.gif");
- else
- bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Inactive.gif");
- recBounds.X -= borderSize.Width;
- recBounds.Y -= borderSize.Height;
- recBounds.Width += borderSize.Width << 1;
- recBounds.Height += borderSize.Height;
- render = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Pressed);
- Rectangle clipper = new Rectangle(recBounds.X, recBounds.Y, recBounds.Width, recBounds.Height - 1);
- render.DrawBackground(g, recBounds, clipper);
- }
- else
- {
- font = new Font(this.Font, FontStyle.Regular);
- if (this.HoverIndex == intIndex)
- {
- render = new VisualStyleRenderer(VisualStyleElement.Tab.TopTabItem.Hot);
- bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Active.gif");
- }
- else
- {
- render = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Normal);
- bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Disabled.gif");
- }
- recBounds.Height -= borderSize.Height;
- render.DrawBackground(g, recBounds);
- }
-
- SolidBrush br = new SolidBrush(tabPage.ForeColor);
- //Console.WriteLine("["+tabPage.Text+"]");
- g.DrawString(tabPage.Text, font, br, tabTextArea.Left + 2, tabTextArea.Top + 3);
- font.Dispose();
- g.DrawImage(bitmap, new Point((int)tabTextArea.Right - bitmap.Width - 5, 5));
- }
-
- }
-}
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Windows.Forms.VisualStyles;
+
+namespace System.Windows.Forms
+{
+ public partial class TabControlExtended : System.Windows.Forms.TabControl
+ {
+ private int HoverIndex;
+ private bool Extended;
+
+ public event EventHandler OnTabClose;
+
+ public TabControlExtended()
+ {
+ InitializeComponent();
+ }
+
+ public TabControlExtended(IContainer container)
+ {
+ InitializeComponent();
+
+ container.Add(this);
+ }
+
+ public void SetDrawMode()
+ {
+ try
+ {
+ HoverIndex = 0;
+ VisualStyleRenderer render = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
+ this.DrawMode = TabDrawMode.OwnerDrawFixed;
+ this.SetStyle(ControlStyles.UserPaint, true);
+ this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ this.SetStyle(ControlStyles.DoubleBuffer, true);
+ this.SetStyle(ControlStyles.ResizeRedraw, true);
+ this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
+ this.Extended = true;
+ }
+ catch
+ {
+ this.Extended = false;
+ this.DrawMode = TabDrawMode.Normal;
+ }
+ }
+
+/*
+protected override bool ProcessMnemonic(char charCode)
+{
+ foreach (TabPage p in this.TabPages)
+ {
+ if (Control.IsMnemonic(charCode, p.Text))
+ {
+ this.SelectedTab = p;
+ this.Focus();
+ return true;
+ }
+ }
+ return false;
+}
+*/
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+ if (!this.Extended)
+ return;
+ MyPaint(e);
+ }
+
+ protected override void OnSelectedIndexChanged(EventArgs e)
+ {
+ this.HoverIndex = -1;
+ base.OnSelectedIndexChanged(e);
+ }
+
+ private void MyPaint(PaintEventArgs e)
+ {
+ if (!this.Visible)
+ return;
+
+ Graphics g = e.Graphics;
+
+ Rectangle displayRectangle = this.DisplayRectangle;
+
+ Size borderSize = SystemInformation.Border3DSize;
+ displayRectangle.Inflate(borderSize.Width << 1, borderSize.Height << 1);
+
+ VisualStyleRenderer render = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
+
+ render.DrawBackground(g, displayRectangle);
+
+ for (int intI = 0; intI < this.TabCount; intI++)
+ if (intI != this.SelectedIndex)
+ DrawTab(g, intI);
+ if (this.SelectedIndex >= 0)
+ DrawTab(g, this.SelectedIndex);
+ }
+
+ protected override void OnMouseMove(MouseEventArgs e)
+ {
+ base.OnMouseMove(e);
+ if (!Extended)
+ return;
+
+ Point p = e.Location;
+ for (int intI = 0; intI < this.TabCount; intI++)
+ {
+ Rectangle rectangle = GetTabRect(intI);
+ if (rectangle.Contains(p))
+ {
+ HoverIndex = intI;
+ this.Invalidate();
+ }
+ }
+ }
+
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ base.OnMouseLeave(e);
+ if (!Extended)
+ return;
+
+ HoverIndex = this.SelectedIndex;
+ this.Invalidate();
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp(e);
+ if (!Extended)
+ return;
+
+ Point p = e.Location;
+ Rectangle rectangle = this.GetTabRect(this.SelectedIndex);
+ if (rectangle.Contains(p))
+ {
+ Rectangle closeImage = new Rectangle(rectangle.Right - 15 - 5, 5, 15, 15);
+ if (closeImage.Contains(p))
+ {
+ if (OnTabClose != null)
+ OnTabClose(this.SelectedIndex, new EventArgs());
+ else
+ this.TabPages.RemoveAt(this.SelectedIndex);
+ }
+ }
+ }
+
+ private void DrawTab(Graphics g, int intIndex)
+ {
+ Font font;
+ Bitmap bitmap;
+
+ Rectangle recBounds = this.GetTabRect(intIndex);
+ RectangleF tabTextArea = (RectangleF)this.GetTabRect(intIndex);
+
+ TabPage tabPage = this.TabPages[intIndex];
+
+ Size borderSize = SystemInformation.Border3DSize;
+
+ VisualStyleRenderer render;
+ if (this.SelectedIndex == intIndex)
+ {
+ font = new Font(this.Font, FontStyle.Bold);
+ Point p = this.PointToClient(Control.MousePosition);
+ Rectangle closeImage = new Rectangle(recBounds.Right - 15 - 5, 5, 15, 15);
+ if (closeImage.Contains(p))
+ bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Active.gif");
+ else
+ bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Inactive.gif");
+ recBounds.X -= borderSize.Width;
+ recBounds.Y -= borderSize.Height;
+ recBounds.Width += borderSize.Width << 1;
+ recBounds.Height += borderSize.Height;
+ render = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Pressed);
+ Rectangle clipper = new Rectangle(recBounds.X, recBounds.Y, recBounds.Width, recBounds.Height - 1);
+ render.DrawBackground(g, recBounds, clipper);
+ }
+ else
+ {
+ font = new Font(this.Font, FontStyle.Regular);
+ if (this.HoverIndex == intIndex)
+ {
+ render = new VisualStyleRenderer(VisualStyleElement.Tab.TopTabItem.Hot);
+ bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Active.gif");
+ }
+ else
+ {
+ render = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Normal);
+ bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Disabled.gif");
+ }
+ recBounds.Height -= borderSize.Height;
+ render.DrawBackground(g, recBounds);
+ }
+
+ SolidBrush br = new SolidBrush(tabPage.ForeColor);
+ //Console.WriteLine("["+tabPage.Text+"]");
+ g.DrawString(tabPage.Text, font, br, tabTextArea.Left + 2, tabTextArea.Top + 3);
+ font.Dispose();
+ g.DrawImage(bitmap, new Point((int)tabTextArea.Right - bitmap.Width - 5, 5));
+ }
+
+ }
+}
diff --git a/trunk/Helpers/TaskQueue.cs b/source/Helpers/TaskQueue.cs
similarity index 97%
rename from trunk/Helpers/TaskQueue.cs
rename to source/Helpers/TaskQueue.cs
index a3e09b5..6e65e50 100644
--- a/trunk/Helpers/TaskQueue.cs
+++ b/source/Helpers/TaskQueue.cs
@@ -1,236 +1,236 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Reflection;
-using System.Collections;
-using System.Diagnostics;
-using System.Threading;
-
-// http://www.codeproject.com/csharp/messageloop.asp
-
-namespace LSLEditor.Helpers
-{
- ///
- /// Represents an object that performs a certain action asynchronously, by using an internal buffer queue
- /// and one internal thread.
- ///
- public class TaskQueue : IDisposable
- {
- #region Member Variables
-
- /// Reference to the thread used to empty the queue
- private Thread WorkerThread;
- /// Internal queue that serves as buffer for required actions
- private Queue Tasks;
- /// Used to signal the thread when a new object is added to the queue
- private AutoResetEvent SignalNewTask;
- /// Flag that notifies that the object should be disposed
- private bool stop;
- #endregion Member Variables
-
- #region Constructor
-
- /// Creates a new buffered object
- public TaskQueue()
- {
- WorkerThread = null;
-
- // Make sure the queue is synchronized. This is required because items are added to the queue
- // from a different thread than the thread that empties the queue
- Tasks = Queue.Synchronized(new Queue());
-
- SignalNewTask = new AutoResetEvent(false);
-
- stop = false;
- }
- #endregion Ctor
-
- #region Public Methods
-
- public void Start()
- {
- Stop();
-
- stop = false;
- Tasks.Clear();
-
- WorkerThread = new Thread(new ThreadStart(Worker));
- WorkerThread.IsBackground = true;
- WorkerThread.Start();
- }
-
- public void Stop()
- {
- if (WorkerThread != null) {
- WorkerThread.Abort();
- if (!WorkerThread.Join(2000)) {
- // problems
- System.Windows.Forms.MessageBox.Show("TaskQueue thread not Aborted", "Oops...");
- }
- WorkerThread = null;
- }
- }
-
- public void Invoke(object ActiveObject, string MethodName, params object[] args)
- {
- if (ActiveObject == null)
- return;
- try {
- // Add the object to the internal buffer
- Tasks.Enqueue(new Task(ActiveObject, MethodName, args));
-
- // Signal the internal thread that there is some new object in the buffer
- SignalNewTask.Set();
- } catch (Exception e) {
- Trace.WriteLine(string.Format("An exception occurred in TaskQueue.Invoke: {0}", e.Message));
- // Since the exception was not actually handled and only logged - propagate it
- throw;
- }
- }
- #endregion Public Methods
-
- #region Private Methods
-
- /// Method executed by the internal thread to empty the queue
- private void Worker()
- {
- Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);
- Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US", false);
-
- while (!stop) {
- try {
- // Note: this code is safe (i.e. performing the .Count and .Dequeue not inside a lock)
- // because there is only one thread emptying the queue.
- // Even if .Count returns 0, and before Dequeue is called a new object is added to the Queue
- // then still the system will behave nicely: the next if statement will return false and
- // since this is run in an endless loop, in the next iteration we will have .Count > 0.
- if (Tasks.Count > 0) {
- (Tasks.Dequeue() as Task).Execute();
- }
-
- // Wait until new objects are received or Dispose was called
- if (Tasks.Count == 0) {
- SignalNewTask.WaitOne();
- }
- } catch (ThreadAbortException) {
- Trace.WriteLine("TaskQueue.Worker: ThreadAbortException, no problem");
- } catch (Exception e) {
- Trace.WriteLine(string.Format("TaskQueue.Worker: {0}", e.Message));
- // Since the exception was not actually handled and only logged - propagate it
- throw;
- }
- }
- }
-
- #endregion Private Methods
-
- #region IDisposable Members and Dispose Pattern
-
- private bool disposed = false;
-
- ~TaskQueue()
- {
- Dispose(false);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!this.disposed) {
- if (disposing) {
- try {
- stop = true;
- SignalNewTask.Set();
- } catch (Exception e) {
- Trace.WriteLine(string.Format("An exception occurred in MessageLoop.AddToBuffer: {0}", e.Message));
- // Since the exception was not actually handled and only logged - propagate it
- throw;
- }
- }
- this.disposed = true;
- }
- }
- #endregion IDisposable Members and Dispose Pattern
-
- #region Task
- /// The tasks being saved in the queue
- private class Task
- {
- private object ActiveObject;
- private object[] args;
- public string MethodName;
- public Task(object ActiveObject, string MethodName, params object[] args)
- {
- this.ActiveObject = ActiveObject;
- this.MethodName = MethodName;
- this.args = args;
- }
-
- public void Execute()
- {
- try {
- MethodInfo mi = ActiveObject.GetType().GetMethod(MethodName,
- BindingFlags.Public |
- BindingFlags.Instance |
- //BindingFlags.DeclaredOnly |
- BindingFlags.NonPublic
- );
- mi.Invoke(ActiveObject, args);
- } catch (ThreadAbortException) {
- Trace.WriteLine("TaskQueue.Task.Execute: ThreadAbortException, no problem");
- } catch (Exception exception) {
- Exception innerException = exception.InnerException;
- if (innerException == null)
- innerException = exception;
- string strMessage = OopsFormatter.ApplyFormatting(innerException.Message);
- string strStackTrace = OopsFormatter.ApplyFormatting(innerException.StackTrace);
-
- System.Windows.Forms.MessageBox.Show(strMessage + "\r\n" + strStackTrace, "Oops...");
- }
- }
- }
- #endregion Task
- }
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Diagnostics;
+using System.Threading;
+
+// http://www.codeproject.com/csharp/messageloop.asp
+
+namespace LSLEditor.Helpers
+{
+ ///
+ /// Represents an object that performs a certain action asynchronously, by using an internal buffer queue
+ /// and one internal thread.
+ ///
+ public class TaskQueue : IDisposable
+ {
+ #region Member Variables
+
+ /// Reference to the thread used to empty the queue
+ private Thread WorkerThread;
+ /// Internal queue that serves as buffer for required actions
+ private Queue Tasks;
+ /// Used to signal the thread when a new object is added to the queue
+ private AutoResetEvent SignalNewTask;
+ /// Flag that notifies that the object should be disposed
+ private bool stop;
+ #endregion Member Variables
+
+ #region Constructor
+
+ /// Creates a new buffered object
+ public TaskQueue()
+ {
+ WorkerThread = null;
+
+ // Make sure the queue is synchronized. This is required because items are added to the queue
+ // from a different thread than the thread that empties the queue
+ Tasks = Queue.Synchronized(new Queue());
+
+ SignalNewTask = new AutoResetEvent(false);
+
+ stop = false;
+ }
+ #endregion Ctor
+
+ #region Public Methods
+
+ public void Start()
+ {
+ Stop();
+
+ stop = false;
+ Tasks.Clear();
+
+ WorkerThread = new Thread(new ThreadStart(Worker));
+ WorkerThread.IsBackground = true;
+ WorkerThread.Start();
+ }
+
+ public void Stop()
+ {
+ if (WorkerThread != null) {
+ WorkerThread.Abort();
+ if (!WorkerThread.Join(2000)) {
+ // problems
+ System.Windows.Forms.MessageBox.Show("TaskQueue thread not Aborted", "Oops...");
+ }
+ WorkerThread = null;
+ }
+ }
+
+ public void Invoke(object ActiveObject, string MethodName, params object[] args)
+ {
+ if (ActiveObject == null)
+ return;
+ try {
+ // Add the object to the internal buffer
+ Tasks.Enqueue(new Task(ActiveObject, MethodName, args));
+
+ // Signal the internal thread that there is some new object in the buffer
+ SignalNewTask.Set();
+ } catch (Exception e) {
+ Trace.WriteLine(string.Format("An exception occurred in TaskQueue.Invoke: {0}", e.Message));
+ // Since the exception was not actually handled and only logged - propagate it
+ throw;
+ }
+ }
+ #endregion Public Methods
+
+ #region Private Methods
+
+ /// Method executed by the internal thread to empty the queue
+ private void Worker()
+ {
+ Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);
+ Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US", false);
+
+ while (!stop) {
+ try {
+ // Note: this code is safe (i.e. performing the .Count and .Dequeue not inside a lock)
+ // because there is only one thread emptying the queue.
+ // Even if .Count returns 0, and before Dequeue is called a new object is added to the Queue
+ // then still the system will behave nicely: the next if statement will return false and
+ // since this is run in an endless loop, in the next iteration we will have .Count > 0.
+ if (Tasks.Count > 0) {
+ (Tasks.Dequeue() as Task).Execute();
+ }
+
+ // Wait until new objects are received or Dispose was called
+ if (Tasks.Count == 0) {
+ SignalNewTask.WaitOne();
+ }
+ } catch (ThreadAbortException) {
+ Trace.WriteLine("TaskQueue.Worker: ThreadAbortException, no problem");
+ } catch (Exception e) {
+ Trace.WriteLine(string.Format("TaskQueue.Worker: {0}", e.Message));
+ // Since the exception was not actually handled and only logged - propagate it
+ throw;
+ }
+ }
+ }
+
+ #endregion Private Methods
+
+ #region IDisposable Members and Dispose Pattern
+
+ private bool disposed = false;
+
+ ~TaskQueue()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!this.disposed) {
+ if (disposing) {
+ try {
+ stop = true;
+ SignalNewTask.Set();
+ } catch (Exception e) {
+ Trace.WriteLine(string.Format("An exception occurred in MessageLoop.AddToBuffer: {0}", e.Message));
+ // Since the exception was not actually handled and only logged - propagate it
+ throw;
+ }
+ }
+ this.disposed = true;
+ }
+ }
+ #endregion IDisposable Members and Dispose Pattern
+
+ #region Task
+ /// The tasks being saved in the queue
+ private class Task
+ {
+ private object ActiveObject;
+ private object[] args;
+ public string MethodName;
+ public Task(object ActiveObject, string MethodName, params object[] args)
+ {
+ this.ActiveObject = ActiveObject;
+ this.MethodName = MethodName;
+ this.args = args;
+ }
+
+ public void Execute()
+ {
+ try {
+ MethodInfo mi = ActiveObject.GetType().GetMethod(MethodName,
+ BindingFlags.Public |
+ BindingFlags.Instance |
+ //BindingFlags.DeclaredOnly |
+ BindingFlags.NonPublic
+ );
+ mi.Invoke(ActiveObject, args);
+ } catch (ThreadAbortException) {
+ Trace.WriteLine("TaskQueue.Task.Execute: ThreadAbortException, no problem");
+ } catch (Exception exception) {
+ Exception innerException = exception.InnerException;
+ if (innerException == null)
+ innerException = exception;
+ string strMessage = OopsFormatter.ApplyFormatting(innerException.Message);
+ string strStackTrace = OopsFormatter.ApplyFormatting(innerException.StackTrace);
+
+ System.Windows.Forms.MessageBox.Show(strMessage + "\r\n" + strStackTrace, "Oops...");
+ }
+ }
+ }
+ #endregion Task
+ }
}
\ No newline at end of file
diff --git a/trunk/Helpers/TextFileEncodingDetector.cs b/source/Helpers/TextFileEncodingDetector.cs
similarity index 100%
rename from trunk/Helpers/TextFileEncodingDetector.cs
rename to source/Helpers/TextFileEncodingDetector.cs
diff --git a/trunk/Helpers/WebRequestClass.cs b/source/Helpers/WebRequestClass.cs
similarity index 97%
rename from trunk/Helpers/WebRequestClass.cs
rename to source/Helpers/WebRequestClass.cs
index 6788e3c..5ceecd7 100644
--- a/trunk/Helpers/WebRequestClass.cs
+++ b/source/Helpers/WebRequestClass.cs
@@ -1,247 +1,247 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Collections;
-using System.Net;
-using System.IO;
-using System.Text;
-using System.Threading;
-
-namespace LSLEditor
-{
- public class RequestState
- {
- // This class stores the state of the request.
- public SecondLife secondlife;
- public SecondLife.key httpkey;
- public byte[] postData;
- const int BUFFER_SIZE = 1024;
- public StringBuilder requestData;
- public byte[] bufferRead;
- public WebRequest request;
- public WebResponse response;
- public Stream responseStream;
- public RequestState()
- {
- bufferRead = new byte[BUFFER_SIZE];
- requestData = new StringBuilder("");
- request = null;
- responseStream = null;
- postData = null;
- }
- }
-
- class WebRequestClass
- {
- public static ManualResetEvent allDone= new ManualResetEvent(false);
- const int BUFFER_SIZE = 1024;
- public WebRequestClass(WebProxy proxy, SecondLife secondlife, string strUrl, SecondLife.list parameters, string postData, SecondLife.key key)
- {
- try
- {
- // Create a new webrequest to the mentioned URL.
- WebRequest myWebRequest = WebRequest.Create(strUrl);
-
- myWebRequest.Headers.Add("Cache-Control", "max-age=259200");
- //myWebRequest.Headers.Add("Connection", "keep-alive");
- myWebRequest.Headers.Add("Pragma", "no-cache");
- //myWebRequest.Headers.Add("Via", "1.1 sim3560.agni.lindenlab.com:3128 (squid/2.6.STABLE12)");
- //myWebRequest.Headers.Add("Content-Length", "3");
- //myWebRequest.Headers.Add("Content-Type", "text/plain;charset=utf-8");
- //myWebRequest.Headers.Add("Accept", "text/*");
- myWebRequest.Headers.Add("Accept-Charset", "utf-8;q=1.0, *;q=0.5");
- myWebRequest.Headers.Add("Accept-Encoding", "deflate, gzip");
- //myWebRequest.Headers.Add("Host", "www.lsleditor.org");
- //myWebRequest.Headers.Add("User-Agent", "LSLEditor 2.24 (http://www.lsleditor.org)");
- myWebRequest.Headers.Add("X-SecondLife-Shard", "Production");
-
- SecondLife.vector RegionCorner = secondlife.llGetRegionCorner();
- SecondLife.vector pos = secondlife.llGetPos();
-
- myWebRequest.Headers.Add("X-SecondLife-Object-Name", secondlife.host.GetObjectName());
- myWebRequest.Headers.Add("X-SecondLife-Object-Key", secondlife.host.GetKey().ToString());
- myWebRequest.Headers.Add("X-SecondLife-Region", Properties.Settings.Default.RegionName + " (" + (int)RegionCorner.x + ", " + (int)RegionCorner.y + ")");
- myWebRequest.Headers.Add("X-SecondLife-Local-Position", "("+pos.x+", "+pos.y+", "+pos.z+")");
- myWebRequest.Headers.Add("X-SecondLife-Local-Rotation", "(0.000000, 0.000000, 0.000000, 1.000000)");
- myWebRequest.Headers.Add("X-SecondLife-Local-Velocity", "(0.000000, 0.000000, 0.000000)");
- myWebRequest.Headers.Add("X-SecondLife-Owner-Name", Properties.Settings.Default.AvatarName);
- myWebRequest.Headers.Add("X-SecondLife-Owner-Key", Properties.Settings.Default.AvatarKey);
- myWebRequest.Headers.Add("X-Forwarded-For", "127.0.0.1");
-
- // Setting up paramters
- for (int intI = 0; intI < parameters.Count; intI += 2)
- {
- switch (int.Parse(parameters[intI].ToString()))
- {
- case 0:
- myWebRequest.Method = parameters[intI + 1].ToString();
- break;
- case 1:
- myWebRequest.ContentType = parameters[intI + 1].ToString();
- break;
- case 2:
- // HTTP_BODY_MAXLENGTH
- break;
- default:
- break;
- }
- }
-
- if (proxy != null)
- myWebRequest.Proxy = proxy;
-
- // Create a new instance of the RequestState.
- RequestState myRequestState = new RequestState();
-
- myRequestState.secondlife = secondlife;
- myRequestState.httpkey = key;
- myRequestState.postData = Encoding.UTF8.GetBytes(postData);
-
- // 19 sep 2007
- myWebRequest.ContentLength = myRequestState.postData.Length;
-
- // The 'WebRequest' object is associated to the 'RequestState' object.
- myRequestState.request = myWebRequest;
-
- // Start the Asynchronous call for response.
- IAsyncResult asyncResult;
- if (myWebRequest.Method == "POST" || myWebRequest.Method == "PUT")
- asyncResult = (IAsyncResult)myWebRequest.BeginGetRequestStream(new AsyncCallback(RespCallback), myRequestState);
- else
- asyncResult = (IAsyncResult)myWebRequest.BeginGetResponse(new AsyncCallback(RespCallback), myRequestState);
- }
- catch (WebException e)
- {
- secondlife.host.VerboseMessage(e.Message);
- secondlife.host.VerboseMessage(e.Status.ToString());
- }
- catch (Exception e)
- {
- Console.WriteLine("Exception raised!");
- Console.WriteLine("Source : " + e.Source);
- Console.WriteLine("Message : " + e.Message);
- secondlife.host.VerboseMessage(e.Message);
- }
- }
-
- private static void RespCallback(IAsyncResult asynchronousResult)
- {
- RequestState myRequestState=(RequestState) asynchronousResult.AsyncState;
- try
- {
- // Set the State of request to asynchronous.
- WebRequest request = myRequestState.request;
-
- if (request.Method == "POST" || request.Method == "PUT") // TODO check if this post works!!!!
- {
- // End the operation.
- Stream postStream = request.EndGetRequestStream(asynchronousResult);
- // Write to the request stream.
- postStream.Write(myRequestState.postData, 0, myRequestState.postData.Length);
- postStream.Close();
-
- myRequestState.response = (HttpWebResponse)request.GetResponse();
- }
- else
- {
- // End the Asynchronous response.
- myRequestState.response = request.EndGetResponse(asynchronousResult);
- }
-
- // Read the response into a 'Stream' object.
- Stream responseStream = myRequestState.response.GetResponseStream();
- myRequestState.responseStream = responseStream;
- // Begin the reading of the response
- IAsyncResult asynchronousResultRead = responseStream.BeginRead(myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
- }
- catch (WebException e)
- {
- myRequestState.secondlife.host.VerboseMessage(e.Message);
- myRequestState.secondlife.host.VerboseMessage(e.Status.ToString());
- }
- catch (Exception e)
- {
- Console.WriteLine("Exception raised!");
- Console.WriteLine("Source : " + e.Source);
- Console.WriteLine("Message : " + e.Message);
- myRequestState.secondlife.host.VerboseMessage(e.Message);
- }
- }
-
- private static void ReadCallBack(IAsyncResult asyncResult)
- {
- RequestState myRequestState = (RequestState)asyncResult.AsyncState;
- try
- {
- // Result state is set to AsyncState.
- Stream responseStream = myRequestState.responseStream;
- int read = responseStream.EndRead( asyncResult );
- // Read the contents of the HTML page and then print to the console.
- if (read > 0)
- {
- myRequestState.requestData.Append(Encoding.ASCII.GetString(myRequestState.bufferRead, 0, read));
- IAsyncResult asynchronousResult = responseStream.BeginRead( myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
- }
- else
- {
- responseStream.Close();
- if(myRequestState.requestData.Length>1)
- {
- myRequestState.secondlife.host.ExecuteSecondLife("http_response",myRequestState.httpkey, (SecondLife.integer)200, new SecondLife.list(), (SecondLife.String)myRequestState.requestData.ToString());
- }
- }
- }
- catch(WebException e)
- {
- myRequestState.secondlife.host.VerboseMessage(e.Message);
- myRequestState.secondlife.host.VerboseMessage(e.Status.ToString());
- }
- catch(Exception e)
- {
- Console.WriteLine("Exception raised!");
- Console.WriteLine("Source : {0}" , e.Source);
- Console.WriteLine("Message : {0}" , e.Message);
- myRequestState.secondlife.host.VerboseMessage(e.Message);
- }
-
- }
- }
-}
-
+//
+// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
+// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
+// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
+//
+// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
+// the community would be stuck with crappy editors.
+//
+// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
+// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
+// License"), formally executed by you and The LSLEditor Group.
+// Terms of the GPL can be found in the gplv2.txt document.
+//
+// GPLv2 Header
+// ************
+// LSLEditor, a External editor for the LSL Language.
+// Copyright (C) 2010 The LSLEditor Group.
+//
+// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// ********************************************************************************************************************
+// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
+// Software.
+// ********************************************************************************************************************
+//
+//
+//
+//
+//
+//
+
+using System;
+using System.Collections;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Threading;
+
+namespace LSLEditor
+{
+ public class RequestState
+ {
+ // This class stores the state of the request.
+ public SecondLife secondlife;
+ public SecondLife.key httpkey;
+ public byte[] postData;
+ const int BUFFER_SIZE = 1024;
+ public StringBuilder requestData;
+ public byte[] bufferRead;
+ public WebRequest request;
+ public WebResponse response;
+ public Stream responseStream;
+ public RequestState()
+ {
+ bufferRead = new byte[BUFFER_SIZE];
+ requestData = new StringBuilder("");
+ request = null;
+ responseStream = null;
+ postData = null;
+ }
+ }
+
+ class WebRequestClass
+ {
+ public static ManualResetEvent allDone= new ManualResetEvent(false);
+ const int BUFFER_SIZE = 1024;
+ public WebRequestClass(WebProxy proxy, SecondLife secondlife, string strUrl, SecondLife.list parameters, string postData, SecondLife.key key)
+ {
+ try
+ {
+ // Create a new webrequest to the mentioned URL.
+ WebRequest myWebRequest = WebRequest.Create(strUrl);
+
+ myWebRequest.Headers.Add("Cache-Control", "max-age=259200");
+ //myWebRequest.Headers.Add("Connection", "keep-alive");
+ myWebRequest.Headers.Add("Pragma", "no-cache");
+ //myWebRequest.Headers.Add("Via", "1.1 sim3560.agni.lindenlab.com:3128 (squid/2.6.STABLE12)");
+ //myWebRequest.Headers.Add("Content-Length", "3");
+ //myWebRequest.Headers.Add("Content-Type", "text/plain;charset=utf-8");
+ //myWebRequest.Headers.Add("Accept", "text/*");
+ myWebRequest.Headers.Add("Accept-Charset", "utf-8;q=1.0, *;q=0.5");
+ myWebRequest.Headers.Add("Accept-Encoding", "deflate, gzip");
+ //myWebRequest.Headers.Add("Host", "www.lsleditor.org");
+ //myWebRequest.Headers.Add("User-Agent", "LSLEditor 2.24 (http://www.lsleditor.org)");
+ myWebRequest.Headers.Add("X-SecondLife-Shard", "Production");
+
+ SecondLife.vector RegionCorner = secondlife.llGetRegionCorner();
+ SecondLife.vector pos = secondlife.llGetPos();
+
+ myWebRequest.Headers.Add("X-SecondLife-Object-Name", secondlife.host.GetObjectName());
+ myWebRequest.Headers.Add("X-SecondLife-Object-Key", secondlife.host.GetKey().ToString());
+ myWebRequest.Headers.Add("X-SecondLife-Region", Properties.Settings.Default.RegionName + " (" + (int)RegionCorner.x + ", " + (int)RegionCorner.y + ")");
+ myWebRequest.Headers.Add("X-SecondLife-Local-Position", "("+pos.x+", "+pos.y+", "+pos.z+")");
+ myWebRequest.Headers.Add("X-SecondLife-Local-Rotation", "(0.000000, 0.000000, 0.000000, 1.000000)");
+ myWebRequest.Headers.Add("X-SecondLife-Local-Velocity", "(0.000000, 0.000000, 0.000000)");
+ myWebRequest.Headers.Add("X-SecondLife-Owner-Name", Properties.Settings.Default.AvatarName);
+ myWebRequest.Headers.Add("X-SecondLife-Owner-Key", Properties.Settings.Default.AvatarKey);
+ myWebRequest.Headers.Add("X-Forwarded-For", "127.0.0.1");
+
+ // Setting up paramters
+ for (int intI = 0; intI < parameters.Count; intI += 2)
+ {
+ switch (int.Parse(parameters[intI].ToString()))
+ {
+ case 0:
+ myWebRequest.Method = parameters[intI + 1].ToString();
+ break;
+ case 1:
+ myWebRequest.ContentType = parameters[intI + 1].ToString();
+ break;
+ case 2:
+ // HTTP_BODY_MAXLENGTH
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (proxy != null)
+ myWebRequest.Proxy = proxy;
+
+ // Create a new instance of the RequestState.
+ RequestState myRequestState = new RequestState();
+
+ myRequestState.secondlife = secondlife;
+ myRequestState.httpkey = key;
+ myRequestState.postData = Encoding.UTF8.GetBytes(postData);
+
+ // 19 sep 2007
+ myWebRequest.ContentLength = myRequestState.postData.Length;
+
+ // The 'WebRequest' object is associated to the 'RequestState' object.
+ myRequestState.request = myWebRequest;
+
+ // Start the Asynchronous call for response.
+ IAsyncResult asyncResult;
+ if (myWebRequest.Method == "POST" || myWebRequest.Method == "PUT")
+ asyncResult = (IAsyncResult)myWebRequest.BeginGetRequestStream(new AsyncCallback(RespCallback), myRequestState);
+ else
+ asyncResult = (IAsyncResult)myWebRequest.BeginGetResponse(new AsyncCallback(RespCallback), myRequestState);
+ }
+ catch (WebException e)
+ {
+ secondlife.host.VerboseMessage(e.Message);
+ secondlife.host.VerboseMessage(e.Status.ToString());
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Exception raised!");
+ Console.WriteLine("Source : " + e.Source);
+ Console.WriteLine("Message : " + e.Message);
+ secondlife.host.VerboseMessage(e.Message);
+ }
+ }
+
+ private static void RespCallback(IAsyncResult asynchronousResult)
+ {
+ RequestState myRequestState=(RequestState) asynchronousResult.AsyncState;
+ try
+ {
+ // Set the State of request to asynchronous.
+ WebRequest request = myRequestState.request;
+
+ if (request.Method == "POST" || request.Method == "PUT") // TODO check if this post works!!!!
+ {
+ // End the operation.
+ Stream postStream = request.EndGetRequestStream(asynchronousResult);
+ // Write to the request stream.
+ postStream.Write(myRequestState.postData, 0, myRequestState.postData.Length);
+ postStream.Close();
+
+ myRequestState.response = (HttpWebResponse)request.GetResponse();
+ }
+ else
+ {
+ // End the Asynchronous response.
+ myRequestState.response = request.EndGetResponse(asynchronousResult);
+ }
+
+ // Read the response into a 'Stream' object.
+ Stream responseStream = myRequestState.response.GetResponseStream();
+ myRequestState.responseStream = responseStream;
+ // Begin the reading of the response
+ IAsyncResult asynchronousResultRead = responseStream.BeginRead(myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
+ }
+ catch (WebException e)
+ {
+ myRequestState.secondlife.host.VerboseMessage(e.Message);
+ myRequestState.secondlife.host.VerboseMessage(e.Status.ToString());
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Exception raised!");
+ Console.WriteLine("Source : " + e.Source);
+ Console.WriteLine("Message : " + e.Message);
+ myRequestState.secondlife.host.VerboseMessage(e.Message);
+ }
+ }
+
+ private static void ReadCallBack(IAsyncResult asyncResult)
+ {
+ RequestState myRequestState = (RequestState)asyncResult.AsyncState;
+ try
+ {
+ // Result state is set to AsyncState.
+ Stream responseStream = myRequestState.responseStream;
+ int read = responseStream.EndRead( asyncResult );
+ // Read the contents of the HTML page and then print to the console.
+ if (read > 0)
+ {
+ myRequestState.requestData.Append(Encoding.ASCII.GetString(myRequestState.bufferRead, 0, read));
+ IAsyncResult asynchronousResult = responseStream.BeginRead( myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
+ }
+ else
+ {
+ responseStream.Close();
+ if(myRequestState.requestData.Length>1)
+ {
+ myRequestState.secondlife.host.ExecuteSecondLife("http_response",myRequestState.httpkey, (SecondLife.integer)200, new SecondLife.list(), (SecondLife.String)myRequestState.requestData.ToString());
+ }
+ }
+ }
+ catch(WebException e)
+ {
+ myRequestState.secondlife.host.VerboseMessage(e.Message);
+ myRequestState.secondlife.host.VerboseMessage(e.Status.ToString());
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Exception raised!");
+ Console.WriteLine("Source : {0}" , e.Source);
+ Console.WriteLine("Message : {0}" , e.Message);
+ myRequestState.secondlife.host.VerboseMessage(e.Message);
+ }
+
+ }
+ }
+}
+
diff --git a/trunk/Helpers/XMLRPC.cs b/source/Helpers/XMLRPC.cs
similarity index 96%
rename from trunk/Helpers/XMLRPC.cs
rename to source/Helpers/XMLRPC.cs
index 55ce440..61fa5cb 100644
--- a/trunk/Helpers/XMLRPC.cs
+++ b/source/Helpers/XMLRPC.cs
@@ -1,318 +1,318 @@
-//
-// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
-// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
-// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
-//
-// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
-// the community would be stuck with crappy editors.
-//
-// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
-// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
-// License"), formally executed by you and The LSLEditor Group.
-// Terms of the GPL can be found in the gplv2.txt document.
-//
-// GPLv2 Header
-// ************
-// LSLEditor, a External editor for the LSL Language.
-// Copyright (C) 2010 The LSLEditor Group.
-//
-// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
-// later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
-// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// ********************************************************************************************************************
-// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
-// Software.
-// ********************************************************************************************************************
-//
-//
-//
-//
-//
-//
-
-using System;
-using System.Xml;
-using System.Net;
-using System.Threading;
-
-namespace LSLEditor.Helpers
-{
- class XmlRpcRequestEventArgs : EventArgs
- {
- public SecondLife.key channel;
- public SecondLife.key message_id;
- public SecondLife.String sData;
- public SecondLife.integer iData;
- public SecondLife.String sender;
- }
-
- class XMLRPC
- {
- private HttpListener listener;
- private Thread thread;
- private bool blnRunning;
- private WebRequest request;
-
- public SecondLife.key guid;
- public HttpListenerContext context;
- public delegate void RequestEventHandler(object sender, XmlRpcRequestEventArgs e);
- public event RequestEventHandler OnReply;
- public event RequestEventHandler OnRequest;
-
- public string Prefix;
- public XMLRPC()
- {
- this.guid = SecondLife.NULL_KEY;
- }
-
- public SecondLife.key OpenChannel(int intChannel)
- {
- if (!HttpListener.IsSupported)
- return this.guid;
-
- // Yes, it works
- this.guid = new SecondLife.key(Guid.NewGuid());
-
-
- // Create a listener.
- listener = new HttpListener();
-
- // Add the prefix.
- int intPort = 50888 + intChannel;
- Prefix = "http://localhost:" + intPort + "/";
- listener.Prefixes.Add(Prefix);
-
- listener.Start();
-
- blnRunning = true;
- thread = new Thread(new ThreadStart(Worker));
- thread.Name = "Worker";
- thread.Start();
-
- return this.guid;
- }
-
- private XmlRpcRequestEventArgs DecodeRequest(System.IO.Stream stream)
- {
- XmlRpcRequestEventArgs e = new XmlRpcRequestEventArgs();
- e.sender = "";
- e.message_id = SecondLife.NULL_KEY;
- /*
-
-
-