Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 1 commit
  • 7,021 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 21, 2010
@slluis slluis Created 2.3.1 branch.
svn path=/branches/monodevelop/extras/MonoDevelop.IPhone/2.3.1/; revision=157727
fd811ba
Showing with 0 additions and 9,186 deletions.
  1. +0 −63 ChangeLog
  2. +0 −57 Makefile
  3. +0 −6 MonoDevelop.mdw
  4. +0 −103 README
  5. +0 −251 configure
  6. +0 −400 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/DesignContainer.cs
  7. +0 −444 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/DesignerHost.cs
  8. +0 −481 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/Document.cs
  9. +0 −142 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/DocumentDirective.cs
  10. +0 −208 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/EventBindingService.cs
  11. +0 −69 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/ExtenderListService.cs
  12. +0 −128 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/MenuCommandService.cs
  13. +0 −90 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/NameCreationService.cs
  14. +0 −118 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/RootDesigner.cs
  15. +0 −148 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/SelectionService.cs
  16. +0 −95 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/TextToolboxItem.cs
  17. +0 −425 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/ToolboxService.cs
  18. +0 −65 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/Transaction.cs
  19. +0 −91 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/TypeDescriptorFilterService.cs
  20. +0 −121 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/TypeResolutionService.cs
  21. +0 −445 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/WebFormPage.cs
  22. +0 −183 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/WebFormReferenceManager.cs
  23. +0 −414 extras/AspNetEdit/AspNetEdit.Editor.Persistence/ControlPersister.cs
  24. +0 −185 extras/AspNetEdit/AspNetEdit.Editor.Persistence/DesignTimeParser.cs
  25. +0 −63 extras/AspNetEdit/AspNetEdit.Editor.Persistence/HtmlParsingObject.cs
  26. +0 −139 extras/AspNetEdit/AspNetEdit.Editor.Persistence/ParsingObject.cs
  27. +0 −82 extras/AspNetEdit/AspNetEdit.Editor.Persistence/RootParsingObject.cs
  28. +0 −268 extras/AspNetEdit/AspNetEdit.Editor.Persistence/ServerControlParsingObject.cs
  29. +0 −190 extras/AspNetEdit/AspNetEdit.Editor.UI/PropertyGrid.cs
  30. +0 −548 extras/AspNetEdit/AspNetEdit.Editor.UI/RootDesignerView.cs
  31. +0 −215 extras/AspNetEdit/AspNetEdit.Editor/EditorHost.cs
  32. +0 −70 extras/AspNetEdit/AspNetEdit.Integration/AspNetEditDisplayBinding.cs
  33. +0 −428 extras/AspNetEdit/AspNetEdit.Integration/AspNetEditViewContent.cs
  34. +0 −189 extras/AspNetEdit/AspNetEdit.Integration/EditorProcess.cs
  35. +0 −251 extras/AspNetEdit/AspNetEdit.Integration/GeckoWebBrowser.cs
  36. +0 −167 extras/AspNetEdit/AspNetEdit.Integration/MonoDevelopProxy.cs
  37. +0 −163 extras/AspNetEdit/AspNetEdit.JSCall/CommandManager.cs
  38. +0 −47 extras/AspNetEdit/AspNetEdit.JSCall/InvalidJSArgumentException.cs
  39. +0 −29 extras/AspNetEdit/AspNetEdit.addin.xml
  40. +0 −207 extras/AspNetEdit/AspNetEdit.csproj
  41. +0 −149 extras/AspNetEdit/AspNetEdit.make
  42. +0 −115 extras/AspNetEdit/AspNetEdit.mdp
  43. +0 −36 extras/AspNetEdit/AspNetEdit.sln
  44. +0 −9 extras/AspNetEdit/AssemblyInfo.cs
  45. +0 −652 extras/AspNetEdit/ChangeLog
  46. +0 −73 extras/AspNetEdit/Makefile
  47. +0 −31 extras/AspNetEdit/Makefile.include
  48. +0 −42 extras/AspNetEdit/chrome/README
  49. +0 −45 extras/AspNetEdit/chrome/content/aspdesigner/JSCall.js
  50. +0 −30 extras/AspNetEdit/chrome/content/aspdesigner/aspdesigner.xul
  51. +0 −124 extras/AspNetEdit/chrome/content/aspdesigner/clipboard.js
  52. +0 −76 extras/AspNetEdit/chrome/content/aspdesigner/constants.js
  53. +0 −16 extras/AspNetEdit/chrome/content/aspdesigner/contents.rdf
Sorry, we could not display the entire diff because too many files (7,021) changed.
View
63 ChangeLog
@@ -1,63 +0,0 @@
-2009-06-03 Michael Hutchinson <mhutchinson@novell.com>
-
- * configure: Don't generate a .addins file for main.
-
-2009-02-03 Michael Hutchinson <mhutchinson@novell.com>
-
- * Makefile: Re-run configure when it changes.
- * configure: Update version number.
-
-2009-01-26 Michael Hutchinson <mhutchinson@novell.com>
-
- * Makefile: Add distclean target.
-
-2008-06-12 Aaron Bockover <abock@gnome.org>
-
- * configure: Support CONFIG_SITE (BNC #350629)
-
-2008-05-21 Lluis Sanchez Gual <lluis@novell.com>
-
- * Makefile: Added test target.
-
-2008-04-20 Geoff Norton <gnorton@novell.com>
-
- * profiles/mac: Remove gtksourceview2 from the mac trunk build.
-
-2007-12-20 Michael Hutchinson <mhutchinson@novell.com>
-
- * configure: Add a more verbose help message explaining the new
- build layout.
-
- * profiles/mac: Remove unneeded options.
-
-2007-12-13 Lluis Sanchez Gual <lluis@novell.com>
-
- * MonoDevelop.mds: API cleanup.
-
-2007-12-05 Lluis Sanchez Gual <lluis@novell.com>
-
- * README: Add mono-addins dependency.
-
-2007-12-05 Lluis Sanchez Gual <lluis@novell.com>
-
- * configure: Stop if one of the configuration scripts fails.
-
-2007-12-04 Jeffrey Stedfast <fejj@novell.com>
-
- * configure (profile): Fixed a typo (s/--prfile/--profile/) and
- also fixed to allow --prefix /path/to/install in addition to the
- already supported --prefix=/path/to/install
-
-2007-12-05 Lluis Sanchez Gual <lluis@novell.com>
-
- * README: Flush.
-
-2007-12-04 Lluis Sanchez Gual <lluis@novell.com>
-
- * configure: Use bash to run the script.
-
-2007-12-04 Lluis Sanchez Gual <lluis@novell.com>
-
- * configure, profiles, MonoDevelop.mds, Makefile: Directory
- reorganization.
-
View
57 Makefile
@@ -1,57 +0,0 @@
-
-EXTRA_DIST = configure
-
-all: all-recursive
-
-top_srcdir=.
-include $(top_srcdir)/config.make
-
-CONFIG_MAKE=$(top_srcdir)/config.make
-
-%-recursive: $(CONFIG_MAKE)
- @set . $$MAKEFLAGS; final_exit=:; \
- case $$2 in --unix) shift ;; esac; \
- case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
- for dir in $(SUBDIRS); do \
- case $$dir in \
- .) make $*-local || { final_exit="exit 1"; $$dk; };;\
- *) (cd $$dir && make $*) || { final_exit="exit 1"; $$dk; };;\
- esac \
- done
- $$final_exit
-
-$(CONFIG_MAKE): $(top_srcdir)/configure
- @if test -e "$(CONFIG_MAKE)"; then exec $(top_srcdir)/configure; \
- else \
- echo "You must run configure first"; \
- exit 1; \
- fi
-
-clean: clean-recursive
-install: install-recursive
-uninstall: uninstall-recursive
-distcheck: distcheck-recursive
-
-distclean: distclean-recursive
- rm -rf config.make local-config
-
-
-dist: dist-recursive
- mkdir -p tarballs
- for t in $(SUBDIRS); do \
- if test -a $$t/*.tar.gz; then \
- mv -f $$t/*.tar.gz tarballs ;\
- fi \
- done
-
-run:
- cd main && make run
-
-test:
- cd main/tests/UnitTests && make test fixture=$(fixture)
-
-check-addins:
- cd main && make check-addins
-
-app-dir:
- cd main && make app-dir
View
6 MonoDevelop.mdw
@@ -1,6 +0,0 @@
-<WorkspaceItem name="MonoDevelop" ctype="Workspace">
- <Items>
- <Item>extras/extras.mdw</Item>
- <Item>main/Main.sln</Item>
- </Items>
-</WorkspaceItem>
View
103 README
@@ -1,103 +0,0 @@
-
-MonoDevelop is a full-featured integrated development environment (IDE) for mono
-and Gtk#. See http://www.monodevelop.com for more info.
-
-Directory organization
-----------------------
-
- There are two main directories:
-
- * main: The core MonoDevelop assemblies and add-ins (all in a single
- tarball/package).
- * extras: Additional add-ins (each add-in has its own
- tarball/package).
-
-Compiling
----------
-
- To compile execute:
-
- ./configure
- make
-
- There are two variables you can set when running 'configure':
-
- --prefix=/path/to/prefix: To set the install prefix.
-
- you can use --prefix=`pkg-config --variable=prefix mono` to get MD
- installed with the rest of mono/gtk-sharp/etc.
-
- --profile=profile-name: To choose one build profile.
-
- There are some predefined profiles:
-
- * stable: builds the MonoDevelop core and some stable extra add-ins.
- * core: builds the MonoDevelop core only.
- * all: builds everything
-
- You can create your own profiles if you need to. To create a profile you
- only have to add a file to the profiles directory containing a list
- of the directories to build.
-
- You can run MonoDevelop from the build directory without having to
- install it by executing:
-
- make run
-
-Installing
-----------
-
- Installing is currently optional.
- (Use make run to use MonoDevelop without installing.)
-
- make install
-
- (It's possible that you need to install for your locale to be
- correctly set.)
-
-Packaging for OSX
------------------
-
- To package MonoDevelop for OSX in a convenient MonoDevelop.app
- file, just do this after MonoDevelop has finished building (with
- make):
-
- cd main/build/MacOSX
- make MonoDevelop.app
-
-Dependencies
-------------
-
- Mono >= 1.1.10
- Gtk# >= 2.8.0
- monodoc >= 1.0
- gtksourceview-sharp >= 0.10
- mono-addins >= 0.3
-
-References
-----------
-
- MonoDevelop web site
- http://www.monodevelop.com
-
- Gnome Human Interface Guidelines (HIG)
- http://developer.gnome.org/projects/gup/hig/1.0/
-
- freedesktop.org standards
- http://freedesktop.org/Standards/
-
- Integrating with GNOME (a little out of date)
- http://developers.sun.com/solaris/articles/integrating_gnome.html
-
- Bugzilla
- http://bugzilla.mozilla.org/bugwritinghelp.html
- http://bugzilla.mozilla.org/page.cgi?id=etiquette.html
-
-Discussion, Bugs, Patches
--------------------------
-
- monodevelop-list@lists.ximian.com (questions and discussion)
- monodevelop-patches-list@lists.ximian.com (track commits to MonoDevelop)
- monodevelop-bugs@lists.ximian.com (track MonoDevelop bugzilla component)
- http://bugzilla.novell.com (submit bugs and patches here)
-
View
251 configure
@@ -1,251 +0,0 @@
-#!/bin/bash
-VERSION=2.1.0
-profile=default
-
-prefix=NONE
-test -e "$CONFIG_SITE" && . "$CONFIG_SITE"
-test "$prefix" = NONE && prefix=/usr/local
-
-usage ()
-{
- echo ""
- echo "Usage : configure [--prefix=PREFIX] [--select] [--profile=PROFILE]"
- echo ""
- echo "This script allows selecting and configuring a set of MonoDevelop"
- echo "modules to be included in an integrated build."
- echo ""
- echo "The MonoDevelop build system consists of a 'main' module, which "
- echo "contains the main distribution, and a number of additional add-ins"
- echo "in subdirectories of 'extras'. "
- echo ""
- echo "The 'extras' add-ins are designed to be built and distributed separately,"
- echo "and therefore build against your system-installed MonoDevelop by default."
- echo "However, this script sets them up to build against the MonoDevelop in"
- echo "'main', and ensures that they will be loaded when MonoDevelop is launched"
- echo "with 'make run' in this top-level directory. This is very useful for"
- echo "development and testing."
- echo ""
- echo "The first time the configure script is executed, it will ask you"
- echo "to select the add-ins to be included in the build. Further executions"
- echo "will configure only the selected add-ins. To select a new list of"
- echo "add-ins, run this script using the --select option."
- echo ""
- echo "You can also configure a predefined list of modules by specifying"
- echo "a build profile using the --profile option."
- echo ""
- echo "Options:"
- echo ""
- echo "--prefix=PREFIX"
- echo ""
- echo " Select the install directory prefix."
- echo ""
- echo "--select"
- echo ""
- echo " Shows a list of add-ins and allows selecting which ones should be"
- echo " included in the build. It can be used in combination with --profile"
- echo " to select the add-ins to be built for a specific profile."
- echo ""
- echo "--profile=PROFILE"
- echo ""
- echo " Configure the build system using the provided profile."
- echo " A 'profile' is a list of 'extras' directories and arguments for their "
- echo " configure scripts, and arguments for the 'main' configure script. To "
- echo " add a profile, simply create a file in the 'profiles' directory."
- echo " The 'default' profile is used when none is specified."
- echo ""
- echo " Profiles available:" `ls --format=commas profiles | sed -e "s/ChangeLog, //"`
- echo ""
-}
-
-validate_profile ()
-{
- test -z "$1" && return 0
- for c in `ls profiles`; do
- if [ "$c" = "$1" ]; then
- return 1
- fi
- done
- return 0
-}
-
-select_packages ()
-{
- if [[ ! -a profiles/$profile ]] ; then
- cp profiles/stable profiles/$profile
- fi
- n=1
- for p in `sed -e /#/d -e 's/ /,/g' < profiles/all` ; do
- packages[$n]=$p
- if test x1 == x`grep -c -s $p profiles/$profile`; then
- sel=X
- else
- sel=" "
- fi
- selection[$n]=$sel
- let "n=n+1"
- done
- pcount=$n
- while [[ 1 ]]
- do
- echo Select the packages to include in the build for the profile \'$profile\':
- echo
- n=1
- for p in ${packages[*]} ; do
- echo $n. [${selection[n]}] $p
- let "n=n+1"
- done
- echo
- echo "Enter the number of an add-in to enable/disable,"
- read -a response -p"(q) quit, (c) clear all, (s) select all, or ENTER to continue: "
- echo
- if [ -z $response ] ; then
- break
- elif [ $response == q -o $response == Q ] ; then
- exit 1
- elif [ $response == c -o $response == C ] ; then
- for ((n=1; n < pcount; n++))
- do
- selection[$n]=" "
- done
- elif [ $response == s -o $response == S ] ; then
- for ((n=1; n < pcount; n++))
- do
- selection[$n]=X
- done
- elif [ x${selection[response]} = xX ] ; then
- selection[$response]=" "
- else
- selection[$response]=X
- fi
- done
- n=1
- rm -f profiles/$profile
- for p in ${packages[*]} ; do
- if [ x${selection[n]} == xX ]; then
- echo ${packages[n]} >> profiles/$profile
- fi
- let "n=n+1"
- done
-}
-
-configure_packages ()
-{
- rm -f local-config/*
- localconf=`pwd`/local-config
- for p in `sed -e /#/d -e 's/ /,/g' < profiles/$profile` ; do
- path=`echo $p | cut -d ',' -f 1`
- ops=`echo $p | sed -e s,$path,, -e 's/,/ /'g`
- title="Configuring package: $path"
- nc=`echo $title | wc -m`
- echo $title
- for ((n=1; n < nc; n++)); do echo -n "-"; done
- echo
- echo "Configuration options: $ops"
- if test -a $path/autogen.sh; then
- sct=./autogen.sh
- elif test -a $path/configure; then
- sct=./configure
- else
- echo Configuration script not found in directory: $p
- exit 1
- fi
- pushd $path > /dev/null
- PKG_CONFIG_PATH=$localconf:$PKG_CONFIG_PATH $sct --prefix=$prefix $ops || exit 1
- popd > /dev/null
- create_local_config $path
- packages="$packages $path"
- done
- rm -f local-config/main.addins
- return 0
-}
-
-create_local_config ()
-{
- # Get the version from configure.in, if it exists
- if test -a $path/configure.in; then
- ver=`grep AC_INIT $path/configure.in | cut -d "," -f 2 | sed "s/ //"`
- elif test -a $path/configure; then
- ver=`grep ^VERSION= $path/configure | cut -d "=" -f 2 | sed "s/ //"`
- else
- ver=VERSION
- fi
-
- # Copy the .pc file to local-config, and set the base lib directory
- mkdir -p local-config
- builddir=`pwd`/$path/build
- for f in `ls $1/*.pc.in` ; do
- pcfile=`echo $f | sed s,.*/,, | sed s/\.in$//`
- sed -e s,libdir=.*,libdir=$builddir, -e s/@VERSION@/$ver/g $f> local-config/$pcfile
- done
-
- # Generate the .addins file for the package
- addins=local-config/`echo $path | sed s,/,_,`.addins
- echo "<Addins>" > $addins
- echo " <Directory include-subdirs=\"true\">$builddir</Directory>" >> $addins
- echo "</Addins>" >> $addins
-}
-
-echo
-
-while test x$1 != x; do
- case $1 in
- --prefix=*)
- prefix=`echo $1 | sed 's/--prefix=//'`
- ;;
- --prefix)
- shift
- prefix=$1
- ;;
- --select)
- select=yes
- ;;
- --profile=*)
- prof=`echo $1 | sed 's/--profile=//'`
- profile=$prof
- ;;
- --profile)
- shift
- profile=$1
- ;;
- --help)
- usage
- exit
- ;;
- *)
- echo Unknown argument $1 >&2
- usage
- exit 1
- ;;
- esac
- shift
-done
-
-validate_profile "$profile"
-if [ ! $? -eq 1 ]; then
- echo "The build profile '$profile' does not exist. A new profile will be created."
-fi
-if [ x$select == xyes -o ! -a profiles/$profile ]; then
- select_packages
-fi
-
-configure_packages
-[ $? -eq 1 ] && exit 1
-
-echo -n "SUBDIRS = " > config.make
-
-echo Configuration Summary
-echo ---------------------
-echo
-echo "MonoDevelop has been configured with "
-echo " prefix = $prefix"
-echo " profile = $profile"
-echo
-echo "Packages included in the build:"
-for p in $packages; do
- echo "\\" >> config.make
- echo -n " $p" >> config.make
- echo " $p"
-done
-echo >> config.make
-echo
-
View
400 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/DesignContainer.cs
@@ -1,400 +0,0 @@
- /*
- * DesignContainer.cs - Tracks ASP.NET controls in the DesignerHost
- *
- * Authors:
- * Michael Hutchinson <m.j.hutchinson@gmail.com>
- *
- * Copyright (C) 2005 Michael Hutchinson
- *
- * This sourcecode is licenced under The MIT License:
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-using System;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.ComponentModel.Design.Serialization;
-using System.Collections;
-using System.Web.UI;
-
-namespace AspNetEdit.Editor.ComponentModel
-{
-
- internal class DesignContainer : IContainer, IComponentChangeService
- {
- public DesignContainer (DesignerHost host)
- {
- this.host = host;
- this.designers = new Hashtable ();
- this.components = new ArrayList ();
- }
-
- #region IContainer Members
-
- private DesignerHost host;
- private Hashtable designers;
- private ArrayList components;
-
- public void Add (IComponent component)
- {
- Add (component, null);
- }
-
- public void Add (IComponent component, string name)
- {
- IDesigner designer = null;
-
- //input checks
- if (component == null)
- throw new ArgumentException ("Cannot add null component to container", "component");
- if (!(component is Control))
- throw new ArgumentException ("This Container only accepts System.Web.UI.Control-derived components", "component");
- if (component.Site != null && component.Site.Container != this)
- component.Site.Container.Remove (component);
-
- //Check the name and create one if necessary
- INameCreationService nameService = host.GetService (typeof (INameCreationService)) as INameCreationService;
- if (nameService == null)
- throw new Exception ("The container must have access to a INameCreationService implementation");
-
- if (name == null || !nameService.IsValidName (name)) {
- name = nameService.CreateName (this, component.GetType ());
- System.Diagnostics.Trace.WriteLine("Generated name for component: "+name);
- }
-
- //check we don't already have component with same name
- if (GetComponent (name) != null)
- throw new ArgumentException ("There is already a component with this name in the container", "name");
-
- //we're definately adding it now, so broadcast
- OnComponentAdding (component);
-
- //get a site and set ID property
- //this way (not PropertyDescriptor.SetValue) won't fire change events
- ((Control) component).ID = name;
- component.Site = new DesignSite (component, this);
-
- //Get designer. If first component, designer must be an IRootDesigner
- if (components.Count == 0)
- {
- host.SetRootComponent (component);
- designer = new RootDesigner (component);
- }
-
- //FIXME: Give Mono some base designers to find! We should never encounter this!
- //else
- // designer = TypeDescriptor.CreateDesigner (component, typeof(System.ComponentModel.Design.IDesigner));
-
-
- if (designer == null) {
- //component.Site = null;
- //throw new Exception ("Designer could not be obtained for this component.");
- }
- else
- {
- //track and initialise it
- designers.Add (component, designer);
- designer.Initialize (component);
- }
-
- //add references to referenceManager, unless root component
- if (components.Count != 1)
- host.WebFormReferenceManager.AddReference (component.GetType ());
-
- //Finally put in container
- components.Add (component);
-
- //and broadcast completion
- OnComponentAdded (component);
- }
-
- internal IDesigner GetDesigner (IComponent component)
- {
- if (GetComponent (component.Site.Name) == null)
- return null;
- //throw new ArgumentException ("That component is not in the container", "component");
- return designers[component] as IDesigner;
- }
-
- public IComponent GetComponent (string name)
- {
- foreach (IComponent component in components)
- if (component.Site.Name == name)
- return component;
- return null;
- }
-
-
- protected System.Object GetService (System.Type service)
- {
- return host.GetService (service);
- }
-
- public void Remove (System.ComponentModel.IComponent component)
- {
- //safety checks
- if (component == null)
- throw new ArgumentNullException ("component");
- if (component.Site == null || component.Site.Container != this)
- throw new ArgumentException ("Component is not sited in this container");
-
- //broadcast start of removal process
- OnComponentRemoving (component);
-
- //clean up component and designer
- components.Remove (component);
- IDesigner designer = GetDesigner (component);
- if (designer != null)
- {
- designers.Remove (component);
- designer.Dispose ();
- }
- component.Site = null;
-
- //if someone tries to kill root component, must destroy all children too
- if (component == host.RootComponent)
- {
- //clean everything up
- foreach (System.Web.UI.Control control in Components)
- host.DestroyComponent (control);
- host.SetRootComponent (null);
- host.Reset ();
- }
-
- //TODO: remove references from referenceManager
-
- //clean up selection service
- ISelectionService sel = (ISelectionService) this.GetService (typeof (ISelectionService));
- if (sel != null && sel.GetComponentSelected (component))
- sel.SetSelectedComponents (new IComponent[] {});
-
- //broadcast completion of removal process
- OnComponentRemoved (component);
- }
-
- public ComponentCollection Components {
- get { return new ComponentCollection ((IComponent[]) components.ToArray(typeof (IComponent))); }
- }
-
- #endregion
-
- #region IComponentChangeService Members
-
- public event ComponentEventHandler ComponentAdded;
-
- public event ComponentEventHandler ComponentAdding;
-
- public event ComponentChangedEventHandler ComponentChanged;
-
- public event ComponentChangingEventHandler ComponentChanging;
-
- public event ComponentEventHandler ComponentRemoved;
-
- public event ComponentEventHandler ComponentRemoving;
-
- public event ComponentRenameEventHandler ComponentRename;
-
- public void OnComponentChanged(object component, MemberDescriptor member, object oldValue, object newValue)
- {
- if (oldValue == newValue)
- return;
-
- //the names of components in this container are actually the same as their IDs
- //so if a change to the ID occurs, we hook in and change it back if not valid
- if(component is Control && ((Control) component).Site.Container == this && member.Name == "ID") {
- //check name is valid
- bool goodVal = true;
- if (newValue == null || !(newValue is String))
- goodVal = false;
- else
- foreach (IComponent Comp in this.Components)
- if (Comp != component && Comp.Site != null && Comp.Site.Name == ((string) newValue))
- goodVal = false;
-
- if (goodVal)
- //success, raise change event
- OnComponentRename (component, (string) oldValue, (string) newValue);
- else
- //bad value, change back
- ((PropertyDescriptor) member).SetValue (component, oldValue);
- }
-
- if (ComponentChanged != null)
- ComponentChanged (this, new ComponentChangedEventArgs (component, member, oldValue, newValue));
-
- }
-
- public void OnComponentChanging (object component, MemberDescriptor member)
- {
- if (ComponentChanging != null)
- ComponentChanging (this, new ComponentChangingEventArgs (component, member));
- }
-
- protected void OnComponentAdded(IComponent component)
- {
- if (ComponentAdded != null)
- ComponentAdded (this, new ComponentEventArgs(component));
- }
-
- protected void OnComponentAdding(IComponent component)
- {
- if (ComponentAdding != null)
- ComponentAdding (this, new ComponentEventArgs(component));
- }
-
- protected void OnComponentRemoved(IComponent component)
- {
- if (ComponentRemoved != null)
- ComponentRemoved (this, new ComponentEventArgs(component));
- }
-
- protected void OnComponentRemoving (IComponent component)
- {
- if (ComponentRemoving != null)
- ComponentRemoving (this, new ComponentEventArgs(component));
- }
-
- protected void OnComponentRename(object component, string oldName, string newName)
- {
- host.RootDocument.RenameControl (oldName, newName);
-
- if (ComponentRename != null)
- ComponentRename (this, new ComponentRenameEventArgs (component, oldName, newName));
- }
-
- #endregion
-
- //the ISite implementation we use to site the components in this container
- //IDictionaryService is site-specific, so why not implement in site
- private class DesignSite : ISite, IDictionaryService
- {
- private DesignContainer container;
- private IComponent component;
-
- public DesignSite (IComponent component, DesignContainer container)
- {
- this.container = container;
- this.component = component;
- }
-
- #region ISite Members
-
- public IComponent Component {
- get { return component; }
- }
-
- public IContainer Container {
- get { return container; }
- }
-
- public bool DesignMode {
- get { return true; }
- }
-
- public string Name {
- get { return ((Control) component).ID; }
- set { ((Control) component).ID = value; }
- }
-
- #endregion
-
- #region IServiceProvider Members
-
- public object GetService (Type serviceType) {
- if (serviceType == typeof (IDictionaryService)) {
- if (dict == null)
- dict = new Hashtable ();
- return this;
- }
- return container.GetService (serviceType);
- }
-
- #endregion
-
- #region IDictionaryService members
-
- private Hashtable dict = null;
-
- public void SetValue (object key, object value)
- {
- //TODO: more efficient, but is behaviour as expected?
- //if ((value == null) && (dict.ContainsKey (key)))
- // dict.Remove (key);
- //else
- dict[key] = value;
- }
-
- public object GetValue (object key)
- {
- return dict[key];
- }
-
- public object GetKey (object value)
- {
- foreach (DictionaryEntry entry in dict)
- if (entry.Value == value)
- return entry.Key;
- return null;
- }
-
-
- #endregion
- }
-
- #region IDisposable Members
-
- private bool disposed = false;
-
- public void Dispose ()
- {
- this.Dispose (true);
- }
-
- public void Dispose (bool disposing)
- {
- if (disposed)
- return;
- disposed = true;
-
- if (disposing)
- {
- foreach (IComponent comp in components)
- comp.Dispose ();
- components.Clear ();
-
- foreach (IDesigner des in designers)
- des.Dispose ();
- designers.Clear ();
-
- this.components = null;
- this.designers = null;
- }
- }
-
- ~DesignContainer ()
- {
- this.Dispose (false);
- }
-
- #endregion
-}
-}
View
444 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/DesignerHost.cs
@@ -1,444 +0,0 @@
- /*
- * DesignerHost.cs - IDesignerHost implementation. Designer transactions
- * and service host. One level up from DesignContainer, tracks RootComponent.
- *
- * Authors:
- * Michael Hutchinson <m.j.hutchinson@gmail.com>
- *
- * Copyright (C) 2005 Michael Hutchinson
- *
- * This sourcecode is licenced under The MIT License:
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-using System;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Reflection;
-using System.Collections;
-using System.Drawing.Design;
-using System.IO;
-using System.Web.UI;
-using System.Web.UI.Design;
-using AspNetEdit.Editor.Persistence;
-
-namespace AspNetEdit.Editor.ComponentModel
-{
- public class DesignerHost : IDesignerHost, IDisposable
- {
- private ServiceContainer parentServices;
- private WebFormReferenceManager referenceManager;
-
- public DesignerHost (ServiceContainer parentServices)
- {
- this.parentServices = parentServices;
- container = new DesignContainer (this);
- referenceManager = new WebFormReferenceManager (this);
-
- //register services
- parentServices.AddService (typeof (IDesignerHost), this);
- parentServices.AddService (typeof (IComponentChangeService), container);
- parentServices.AddService (typeof (IWebFormReferenceManager), referenceManager);
- }
-
- public WebFormReferenceManager WebFormReferenceManager
- {
- get { return referenceManager; }
- }
-
- #region Component management
-
- private DesignContainer container;
- private IComponent rootComponent = null;
- private Document rootDocument;
-
- public IContainer Container
- {
- get { return container; }
- }
-
- public IComponent CreateComponent (Type componentClass, string name)
- {
- //add to document, unless loading
- bool addToDoc = (this.RootDocument != null);
- return CreateComponent (componentClass, name, addToDoc);
- }
-
- internal IComponent CreateComponent (Type componentClass, string name, bool addToDoc)
- {
- System.Diagnostics.Trace.WriteLine("Attempting to create component "+name);
- //check arguments
- if (componentClass == null)
- throw new ArgumentNullException ("componentClass");
- if (!componentClass.IsSubclassOf (typeof (System.Web.UI.Control)) && componentClass != typeof (System.Web.UI.Control))
- throw new ArgumentException ("componentClass must be a subclass of System.Web.UI.Control, but is a " + componentClass.ToString (), "componentClass");
-
- if (componentClass.IsSubclassOf (typeof (System.Web.UI.Page)))
- throw new InvalidOperationException ("You cannot directly add a page to the host. Use NewFile() instead");
-
- //create the object
- IComponent component = (IComponent) Activator.CreateInstance (componentClass);
-
- //and add to container
- container.Add (component, name);
-
- if (addToDoc) {
- ((Control)RootComponent).Controls.Add ((Control) component);
- RootDocument.AddControl ((Control)component);
-
- //select it
- ISelectionService sel = this.GetService (typeof (ISelectionService)) as ISelectionService;
- if (sel != null)
- sel.SetSelectedComponents (new IComponent[] {component});
- }
-
- System.Diagnostics.Trace.WriteLine("Created component "+name);
- return component;
- }
-
- public IComponent CreateComponent (Type componentClass)
- {
- return CreateComponent (componentClass, null);
- }
-
- public void DestroyComponent (IComponent component)
- {
- //deselect it if selected
- ISelectionService sel = this.GetService (typeof (ISelectionService)) as ISelectionService;
- bool found = false;
- if (sel != null)
- foreach (IComponent c in sel.GetSelectedComponents ())
- if (c == component) {
- found = true;
- break;
- }
- //can't modify selection in loop
- if (found) sel.SetSelectedComponents (null);
-
- if (component != RootComponent) {
- //remove from component and document
- ((Control) RootComponent).Controls.Remove ((Control) component);
- RootDocument.RemoveControl ((Control)component);
- }
-
- //remove from container if still sited
- if (component.Site != null)
- container.Remove (component);
-
- component.Dispose ();
- }
-
- public IDesigner GetDesigner (IComponent component)
- {
- if (component == null)
- throw new ArgumentNullException ("component");
- else
- return container.GetDesigner (component);
- }
-
- public Type GetType (string typeName)
- {
- //use ITypeResolutionService if we have it, else Type.GetType();
- object typeResSvc = GetService (typeof (ITypeResolutionService));
- if (typeResSvc != null)
- return (typeResSvc as ITypeResolutionService).GetType (typeName);
- else
- return Type.GetType (typeName);
- }
-
- public IComponent RootComponent {
- get { return rootComponent; }
- }
-
- public Document RootDocument
- {
- get { return rootDocument; }
- }
-
- internal void SetRootComponent (IComponent rootComponent)
- {
- this.rootComponent = rootComponent;
- if (rootComponent == null) {
- rootDocument = null;
- return;
- }
-
- if (!(rootComponent is Control))
- throw new InvalidOperationException ("The root component must be a Control");
- }
-
- public string RootComponentClassName {
- get { return RootComponent.GetType ().Name; }
- }
-
- #endregion
-
- #region Transaction stuff
-
- private Stack transactionStack = new Stack ();
-
- public DesignerTransaction CreateTransaction (string description)
- {
- OnTransactionOpening ();
- Transaction trans = new Transaction (this, description);
- transactionStack.Push (trans);
- OnTransactionOpened ();
-
- return trans;
- }
-
- public DesignerTransaction CreateTransaction ()
- {
- return CreateTransaction (null);
- }
-
- public bool InTransaction
- {
- get { return (transactionStack.Count > 0); }
- }
-
- public string TransactionDescription
- {
- get {
- if (transactionStack.Count == 0)
- return null;
- else
- return (transactionStack.Peek () as DesignerTransaction).Description;
- }
- }
-
- public event DesignerTransactionCloseEventHandler TransactionClosed;
- public event DesignerTransactionCloseEventHandler TransactionClosing;
- public event EventHandler TransactionOpened;
- public event EventHandler TransactionOpening;
-
- internal void OnTransactionClosed (bool commit, DesignerTransaction trans)
- {
- DesignerTransaction t = (DesignerTransaction) transactionStack.Pop();
- if (t != trans)
- throw new Exception ("Transactions cannot be closed out of order");
-
- if (TransactionClosed != null)
- TransactionClosed (this, new DesignerTransactionCloseEventArgs(commit));
- }
-
- internal void OnTransactionClosing (bool commit)
- {
- if (TransactionClosing != null)
- TransactionClosing (this, new DesignerTransactionCloseEventArgs(commit));
- }
-
- protected void OnTransactionOpening()
- {
- if (TransactionOpening != null)
- TransactionOpening (this, EventArgs.Empty);
- }
-
- protected void OnTransactionOpened ()
- {
- if (TransactionOpened != null)
- TransactionOpened (this, EventArgs.Empty);
- }
-
- #endregion
-
- #region Loading etc
-
- private bool loading = false;
- private bool activated = false;
-
- public event EventHandler Activated;
- public event EventHandler Deactivated;
- public event EventHandler LoadComplete;
-
- public void Activate ()
- {
- if (activated)
- throw new InvalidOperationException ("The host is already activated");
-
- //select the root component
- ISelectionService sel = GetService (typeof (ISelectionService)) as ISelectionService;
- if (sel == null)
- throw new Exception ("Could not obtain ISelectionService.");
- if (this.RootComponent == null)
- throw new InvalidOperationException ("The document must be loaded before the host can be activated");
- sel.SetSelectedComponents (new object[] {this.RootComponent});
-
- activated = true;
- OnActivated ();
- }
-
- public bool Loading {
- get { return loading; }
- }
-
- protected void OnLoadComplete ()
- {
- if (LoadComplete != null)
- LoadComplete (this, EventArgs.Empty);
- }
-
- protected void OnActivated ()
- {
- if (Activated != null)
- Activated (this, EventArgs.Empty);
- }
-
- protected void OnDeactivated ()
- {
- if (Deactivated != null)
- Deactivated (this, EventArgs.Empty);
- }
-
- #endregion
-
- #region Wrapping parent ServiceContainer
-
- public void AddService (Type serviceType, ServiceCreatorCallback callback, bool promote)
- {
- parentServices.AddService (serviceType, callback, promote);
- }
-
- public void AddService (Type serviceType, object serviceInstance, bool promote)
- {
- parentServices.AddService (serviceType, serviceInstance, promote);
- }
-
- public void AddService (Type serviceType, ServiceCreatorCallback callback)
- {
- parentServices.AddService (serviceType, callback);
- }
-
- public void AddService (Type serviceType, object serviceInstance)
- {
- parentServices.AddService (serviceType, serviceInstance);
- }
-
- public void RemoveService (Type serviceType, bool promote)
- {
- parentServices.RemoveService (serviceType, promote);
- }
-
- public void RemoveService (Type serviceType)
- {
- parentServices.RemoveService (serviceType);
- }
-
- public object GetService (Type serviceType)
- {
- object service = parentServices.GetService (serviceType);
- if (service != null)
- return service;
- else
- return null;
- }
-
- #endregion
-
- #region IDisposable Members
-
- private bool disposed = false;
-
- public void Dispose ()
- {
- if (!this.disposed) {
- //clean up the services we've registered
- parentServices.RemoveService (typeof (IComponentChangeService));
- parentServices.RemoveService (typeof (IDesignerHost));
-
- //and the container
- container.Dispose ();
-
- disposed = true;
- }
- }
-
- #endregion
-
-
- public void NewFile ()
- {
- if (activated || RootComponent != null)
- throw new InvalidOperationException ("You must reset the host before loading another file.");
- loading = true;
-
- this.Container.Add (new WebFormPage ());
- this.rootDocument = new Document ((Control)rootComponent, this, "New Document");
-
- loading = false;
- OnLoadComplete ();
- }
-
- public void Load (Stream file, string fileName)
- {
- using (TextReader reader = new StreamReader (file))
- {
- Load (reader.ReadToEnd (), fileName);
- }
- }
-
- public void Load (string document, string fileName)
- {
- if (activated || RootComponent != null)
- throw new InvalidOperationException ("You must reset the host before loading another file.");
- loading = true;
-
- this.Container.Add (new WebFormPage());
- this.rootDocument = new Document ((Control)rootComponent, this, document, fileName);
-
- loading = false;
- OnLoadComplete ();
- }
-
- public void Reset ()
- {
- //container automatically destroys all children when this happens
- if (rootComponent != null)
- DestroyComponent (rootComponent);
-
- if (activated) {
- OnDeactivated ();
- this.activated = false;
- }
- }
-
- public void SaveDocumentToFile (Stream file)
- {
- StreamWriter writer = new StreamWriter (file);
-
- writer.Write(RootDocument.PersistDocument ());
- writer.Flush ();
- }
-
- public string PersistDocument ()
- {
- return RootDocument.PersistDocument ();
- }
-
- /*TODO: Some .NET 2.0 System.Web.UI.Design.WebFormsRootDesigner methods
- public abstract void RemoveControlFromDocument(Control control);
- public virtual void SetControlID(Control control, string id);
- public abstract string AddControlToDocument(Control newControl, Control referenceControl, ControlLocation location);
- public virtual string GenerateEmptyDesignTimeHtml(Control control);
- public virtual string GenerateErrorDesignTimeHtml(Control control, Exception e, string errorMessage);
- */
- }
-}
View
481 extras/AspNetEdit/AspNetEdit.Editor.ComponentModel/Document.cs
<
@@ -1,481 +0,0 @@
-/*
-* Document.cs - Represents the DesignerHost's document
-*
-* Authors:
-* Michael Hutchinson <m.j.hutchinson@gmail.com>
-*
-* Copyright (C) 2005 Michael Hutchinson
-*
-* This sourcecode is licenced under The MIT License:
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to permit
-* persons to whom the Software is furnished to do so, subject to the
-* following conditions:
-*
-* The above copyright notice and this permission notice shall be included in
-* all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-* USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-using System;
-using System.Text;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.IO;
-using System.ComponentModel.Design;
-using System.Collections;
-using AspNetEdit.Editor.Persistence;
-using System.ComponentModel;
-using AspNetEdit.Editor.ComponentModel;
-using System.Globalization;
-using AspNetEdit.Editor.UI;
-using System.Reflection;
-
-namespace AspNetEdit.Editor.ComponentModel
-{
- public class Document
- {
- public static readonly string newDocument = "<html>\n<head>\n\t<title>{0}</title>\n</head>\n<body>\n<form runat=\"server\">\n\n</form></body>\n</html>";
- public static readonly string ControlSubstituteStructure = "<aspcontrol id=\"{0}\" width=\"{1}\" height=\"{2}\" -md-can-drop=\"{3}\" -md-can-resize=\"{4}\">{5}</aspcontrol>";
- public static readonly string DirectivePlaceholderStructure = "<directiveplaceholder id=\"{0}\" />";
-
- string document;
- Hashtable directives;
- private int directivePlaceholderKey = 0;
-
- private Control parent;
- private DesignerHost host;
- private RootDesignerView view;
- private DesignTimeParser aspParser;
-
- ///<summary>Creates a new document</summary>
- public Document (Control parent, DesignerHost host, string documentName)
- {
- initDocument (parent, host);
- this.document = String.Format (newDocument, documentName);
- GetView ();
- }
-
- ///<summary>Creates a document from an existing file</summary>
- public Document (Control parent, DesignerHost host, string document, string fileName)
- {
- initDocument (parent, host);
-
- Control[] controls;
- aspParser.ProcessFragment (document, out controls, out this.document);
- GetView ();
- }
-
- private void initDocument (Control parent, DesignerHost host)
- {
- System.Diagnostics.Trace.WriteLine ("Creating document...");
- if (!(parent is WebFormPage))
- throw new NotImplementedException ("Only WebFormsPages can have a document for now");
- this.parent = parent;
- this.host = host;
-
- if (!host.Loading)
- throw new InvalidOperationException ("The document cannot be initialised or loaded unless the host is loading");
-
- CaseInsensitiveHashCodeProvider provider = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture);
- CaseInsensitiveComparer comparer = new CaseInsensitiveComparer(CultureInfo.InvariantCulture);
- directives = new Hashtable (provider, comparer);
-
- this.aspParser = new DesignTimeParser (host, this);
- }
-
- private void GetView ()
- {
- IRootDesigner rd = (IRootDesigner) host.GetDesigner (host.RootComponent);
- this.view = (RootDesignerView) rd.GetView (ViewTechnology.Passthrough);
-
- view.BeginLoad ();
- System.Diagnostics.Trace.WriteLine ("Document created.");
- }
-
- #region Some Gecko communication stuff
-
- //we don't want to have the document lying around forever, but we
- //want the RootDesignerview to be able to get it when Gecko XUL loads
- public string GetLoadedDocument ()
- {
- if (document == null)
- throw new Exception ("The document has already been retrieved");
- //TODO: substitute all components
- string doc = document;
- document = null;
- return doc;
- }
-
- ///<summary>Serialises the entire document to ASP.NET code</summary>
- public string PersistDocument ()
- {
- StringBuilder builder = new StringBuilder(this.Serialize (view.GetDocument ()));
-
- //insert all remaining directives
- for (int i = 0; i <= directivePlaceholderKey; i++)
- {
- builder.Insert (0, RemoveDirective(i));
- }
-
- return builder.ToString ();
- }
-
- public void DoCommand (string editorCommand)
- {
- view.DoCommand (editorCommand);
- }
-
- #endregion
-
- #region Serialisation stuff
-
- ///<summary>Converts a designer document fragment to ASP.NET code</summary>
- public string Serialize (string designerDocumentFragment)
- {
- if (host == null)
- throw new Exception("The document cannot be persisted without a host");
-
- string serializedDoc = string.Empty;
- StringWriter writer = new StringWriter ();
-
- //keep method argument meaningfully named, but keep code readable!
- string frag = designerDocumentFragment;
- int length = frag.Length;
-
- int pos = 0;
- SMode mode = SMode.Free;
-
- while (pos < length)
- {
- char c = frag [pos];
-
- switch (mode)
- {
- //it's freely copying to output, but watching for a directive or control placeholder
- case SMode.Free:
- if (c == '<')
- {
- if ((pos + 10 < length) && frag.Substring (pos + 1, 10) == "aspcontrol") {
- mode = SMode.ControlId;
- pos += 10;
- break;
- }
- else if ((pos + 20 < length) && frag.Substring (pos + 1, 20) == "directiveplaceholder") {
- mode = SMode.DirectiveId;
- pos += 20;
- break;
- }
- }
-
- writer.Write (c);
- break;
-
- //it's found a directive placeholder and is scanning for the ID
- case SMode.DirectiveId:
- if (c == 'i' && (pos + 4 < length) && frag.Substring (pos, 4) == "id=\"") {
- int idEnd = frag.IndexOf ('"', pos + 4 + 1);
- if (idEnd == -1) throw new Exception ("Identifier was unterminated");
- int id = Int32.Parse (frag.Substring (pos + 4, (idEnd - pos - 4)));
-
- //TODO: more intelligent removal/copying of directives in case of fragments
- //works fine with whole document.
- string directive = RemoveDirective (id);
- writer.Write (directive);
-
- mode = SMode.DirectiveEnd;
- pos = idEnd;
- }
- break;
-
- //it's found a control placeholder and is scanning for the ID
- case SMode.ControlId:
- if (c == 'i' && (pos + 4 < length) && frag.Substring (pos, 4) == "id=\"") {
- int idEnd = frag.IndexOf("\"", pos + 4);
- if (idEnd == -1) throw new Exception ("Identifier was unterminated");
- string id = frag.Substring (pos + 4, (idEnd - pos - 4));
-
- DesignContainer dc = (DesignContainer) host.Container;
- Control control = dc.GetComponent (id) as Control;
- if (control == null) throw new Exception ("Could not retrieve control "+id);
- ControlPersister.PersistControl (writer, control);
-
- mode = SMode.ControlEnd;
- pos = idEnd;
- }
- break;
-
- //it's found the control's ID and is looking for the end
- case SMode.ControlEnd:
- if (c == '<' && (pos + 13 < length) && frag.Substring (pos, 13) == "</aspcontrol>") {
- pos += 12;
- mode = SMode.Free;
- }