Inheritance: System.MarshalByRefObject
Ejemplo n.º 1
0
        public WidgetEditSession(ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges)
        {
            this.frontend          = frontend;
            this.autoCommitChanges = autoCommitChanges;
            undoManager            = new ContainerUndoRedoManager();
            undoQueue             = new UndoQueue();
            undoManager.UndoQueue = undoQueue;

            sourceWidget       = windowName;
            this.sourceProject = sourceProject;

            if (!autoCommitChanges)
            {
                // Reuse the action groups and icon factory of the main project
                gproject = editingBackend;

                // Attach will prevent the destruction of the action group list by gproject
                gproject.AttachActionGroups(sourceProject.ActionGroups);

                gproject.IconFactory                 = sourceProject.IconFactory;
                gproject.FileName                    = sourceProject.FileName;
                gproject.ImagesRootPath              = sourceProject.ImagesRootPath;
                gproject.ResourceProvider            = sourceProject.ResourceProvider;
                gproject.WidgetLibraries             = (ArrayList)sourceProject.WidgetLibraries.Clone();
                gproject.InternalWidgetLibraries     = (ArrayList)sourceProject.InternalWidgetLibraries.Clone();
                gproject.TargetGtkVersion            = sourceProject.TargetGtkVersion;
                sourceProject.ComponentTypesChanged += OnSourceProjectLibsChanged;
                sourceProject.ProjectReloaded       += OnSourceProjectReloaded;

                rootWidget = editingBackend.GetTopLevelWrapper(sourceWidget, false);
                if (rootWidget == null)
                {
                    // Copy the widget to edit from the source project
                    // When saving the file, this project will be merged with the main project.
                    sourceProject.CopyWidgetToProject(windowName, gproject, windowName);
                    rootWidget = gproject.GetTopLevelWrapper(windowName, true);
                }

                gproject.Modified = false;
            }
            else
            {
                rootWidget = sourceProject.GetTopLevelWrapper(windowName, true);
                gproject   = sourceProject;
            }

            rootWidget.Select();
            undoManager.RootObject = rootWidget;

            gproject.ModifiedChanged  += new EventHandler(OnModifiedChanged);
            gproject.Changed          += new EventHandler(OnChanged);
            gproject.ProjectReloaded  += new EventHandler(OnProjectReloaded);
            gproject.ProjectReloading += new EventHandler(OnProjectReloading);
//			gproject.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
        }
Ejemplo n.º 2
0
		public WidgetEditSession (ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges)
		{
			this.frontend = frontend;
			this.autoCommitChanges = autoCommitChanges;
			undoManager = new ContainerUndoRedoManager ();
			undoQueue = new UndoQueue ();
			undoManager.UndoQueue = undoQueue;
			
			sourceWidget = windowName;
			this.sourceProject = sourceProject;
			
			if (!autoCommitChanges) {
				// Reuse the action groups and icon factory of the main project
				gproject = editingBackend;
				
				// Attach will prevent the destruction of the action group list by gproject
				gproject.AttachActionGroups (sourceProject.ActionGroups);
				
				gproject.IconFactory = sourceProject.IconFactory;
				gproject.FileName = sourceProject.FileName;
				gproject.ImagesRootPath = sourceProject.ImagesRootPath;
				gproject.ResourceProvider = sourceProject.ResourceProvider;
				gproject.WidgetLibraries = (ArrayList) sourceProject.WidgetLibraries.Clone ();
				gproject.InternalWidgetLibraries = (ArrayList) sourceProject.InternalWidgetLibraries.Clone ();
				gproject.TargetGtkVersion = sourceProject.TargetGtkVersion;
				sourceProject.ComponentTypesChanged += OnSourceProjectLibsChanged;
				sourceProject.ProjectReloaded += OnSourceProjectReloaded;
				
				rootWidget = editingBackend.GetTopLevelWrapper (sourceWidget, false);
				if (rootWidget == null) {
					// Copy the widget to edit from the source project
					// When saving the file, this project will be merged with the main project.
					sourceProject.CopyWidgetToProject (windowName, gproject, windowName);
					rootWidget = gproject.GetTopLevelWrapper (windowName, true);
				}
				
				gproject.Modified = false;
			}
			else {
				rootWidget = sourceProject.GetTopLevelWrapper (windowName, true);
				gproject = sourceProject;
			}
			
			rootWidget.Select ();
			undoManager.RootObject = rootWidget;
			
			gproject.ModifiedChanged += new EventHandler (OnModifiedChanged);
			gproject.Changed += new EventHandler (OnChanged);
			gproject.ProjectReloaded += new EventHandler (OnProjectReloaded);
			gproject.ProjectReloading += new EventHandler (OnProjectReloading);
//			gproject.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
		}
Ejemplo n.º 3
0
 public void RestoreState(object sessionData)
 {
     object[] status = (object[])sessionData;
     gproject.LoadStatus(status [0]);
     undoQueue = (UndoQueue)status [1];
     foreach (UndoRedoChange ch in undoQueue.Changes)
     {
         ObjectWrapperUndoRedoChange och = ch as ObjectWrapperUndoRedoChange;
         if (och != null)
         {
             och.Manager = undoManager;
         }
     }
     undoManager.UndoQueue = undoQueue;
 }
Ejemplo n.º 4
0
        public ActionGroupEditSession(ActionGroupDesignerFrontend frontend, ProjectBackend project, string containerName, string groupToEdit, bool autoCommitChanges)
        {
            this.groupToEdit       = groupToEdit;
            this.containerName     = containerName;
            this.frontend          = frontend;
            this.project           = project;
            this.autoCommitChanges = autoCommitChanges;

            if (groupToEdit != null)
            {
                group = project.ActionGroups [groupToEdit];
                if (group == null)
                {
                    throw new InvalidOperationException("Unknown action group: " + groupToEdit);
                }
                Load(group);
                undoManager            = new UndoRedoManager();
                undoQueue              = new UndoQueue();
                undoManager.UndoQueue  = undoQueue;
                undoManager.RootObject = groupCopy;

                groupToolbar = new ActionGroupToolbar(frontend, groupCopy);
            }
            else
            {
                if (!autoCommitChanges)
                {
                    throw new System.NotSupportedException();
                }

                Stetic.Wrapper.Container container = project.GetTopLevelWrapper(containerName, true);
                groupToolbar = new ActionGroupToolbar(frontend, container.LocalActionGroups);
            }

            // Don't delay the creation of the designer because when used in combination with the
            // widget designer, change events are subscribed since the begining

            designer = UserInterface.CreateActionGroupDesigner(project, groupToolbar);
            designer.Editor.GroupModified      += OnModified;
            designer.Toolbar.AllowActionBinding = allowActionBinding;
            designer.Destroyed += delegate
            {
                designer = null;
                Dispose();
            };
        }
Ejemplo n.º 5
0
        public WidgetEditSession(ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName)
        {
            this.frontend         = frontend;
            undoManager           = new ContainerUndoRedoManager();
            undoQueue             = new UndoQueue();
            undoManager.UndoQueue = undoQueue;

            sourceWidget = windowName;
            this.project = sourceProject;

            rootWidget = sourceProject.GetTopLevelWrapper(windowName, true);
            rootWidget.Select();
            undoManager.RootObject = rootWidget;

            this.project.Changed          += new ProjectChangedEventHandler(OnChanged);
            this.project.ProjectReloaded  += new EventHandler(OnProjectReloaded);
            this.project.ProjectReloading += new EventHandler(OnProjectReloading);
//			this.project.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
        }
Ejemplo n.º 6
0
		public WidgetEditSession (ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName)
		{
			this.frontend = frontend;
			undoManager = new ContainerUndoRedoManager ();
			undoQueue = new UndoQueue ();
			undoManager.UndoQueue = undoQueue;
			
			sourceWidget = windowName;
			this.project = sourceProject;
						
			rootWidget = sourceProject.GetTopLevelWrapper (windowName, true);
			rootWidget.Select ();
			undoManager.RootObject = rootWidget;
			
			this.project.Changed += new ProjectChangedEventHandler (OnChanged);
			this.project.ProjectReloaded += new EventHandler (OnProjectReloaded);
			this.project.ProjectReloading += new EventHandler (OnProjectReloading);
//			this.project.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
		}
Ejemplo n.º 7
0
		public ActionGroupEditSession (ActionGroupDesignerFrontend frontend, ProjectBackend project, string containerName, string groupToEdit, bool autoCommitChanges)
		{
			this.groupToEdit = groupToEdit;
			this.containerName = containerName;
			this.frontend = frontend;
			this.project = project;
			this.autoCommitChanges = autoCommitChanges;
			
			if (groupToEdit != null) {
				group = project.ActionGroups [groupToEdit];
				if (group == null)
					throw new InvalidOperationException ("Unknown action group: " + groupToEdit);
				Load (group);
				undoManager = new UndoRedoManager ();
				undoQueue = new UndoQueue ();
				undoManager.UndoQueue = undoQueue;
				undoManager.RootObject = groupCopy;
				
				groupToolbar = new ActionGroupToolbar (frontend, groupCopy);
			}
			else {
				if (!autoCommitChanges)
					throw new System.NotSupportedException ();
				
				Stetic.Wrapper.Container container = project.GetTopLevelWrapper (containerName, true);
				groupToolbar = new ActionGroupToolbar (frontend, container.LocalActionGroups);
			}
			
			// Don't delay the creation of the designer because when used in combination with the
			// widget designer, change events are subscribed since the begining
			
			designer = UserInterface.CreateActionGroupDesigner (project, groupToolbar);
			designer.Editor.GroupModified += OnModified;
			designer.Toolbar.AllowActionBinding = allowActionBinding;
			designer.Destroyed += delegate { designer = null; Dispose (); };
		}
Ejemplo n.º 8
0
		public void RestoreState (object sessionData)
		{
			object[] status = (object[]) sessionData;
			gproject.LoadStatus (status [0]);
			undoQueue = (UndoQueue) status [1];
			foreach (UndoRedoChange ch in undoQueue.Changes) {
				ObjectWrapperUndoRedoChange och = ch as ObjectWrapperUndoRedoChange;
				if (och != null)
					och.Manager = undoManager;
			}
			undoManager.UndoQueue = undoQueue;
		}