Changeset 2616


Ignore:
Timestamp:
Feb 7, 2011, 9:48:25 PM (11 years ago)
Author:
kopal
Message:
  • created sub directories for the model
  • added first version of UndoRedoManager
Location:
trunk/CrypPlugins/WorkspaceManager
Files:
13 added
10 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/WorkspaceManager/View/Container/WorkSpaceEditorView.xaml.cs

    r2598 r2616  
    3333    /// </summary>
    3434    ///
    35     public partial class WorkSpaceEditorView : UserControl
     35    public partial class WorkSpaceEditorView : UserControl,IUpdateableView
    3636    {
    3737
     
    4545        private CryptoLineView dummyLine = new CryptoLineView();
    4646        private PluginContainerView currentFullViewContainer;
    47         private Panel root { get { return (this.scrollViewer.Content as Panel); } }
     47        public Panel root { get { return (this.scrollViewer.Content as Panel); } }
    4848        private BottomBox bottomBox { get { return (BottomBoxParent.Child as BottomBox); } }
    4949        public bool IsCtrlToggled { get; set; }
     
    342342        }
    343343
    344         void PluginDelete(object sender, PluginContainerViewDeleteViewEventArgs e)
     344        public void PluginDelete(object sender, PluginContainerViewDeleteViewEventArgs e)
    345345        {
    346346            if (this.State == EditorState.READY)
     
    382382
    383383
    384         void shape_FullScreen(object sender, PluginContainerViewFullScreenViewEventArgs e)
     384        public void shape_FullScreen(object sender, PluginContainerViewFullScreenViewEventArgs e)
    385385        {
    386386            this.InformationPanel.Visibility = Visibility.Visible;
     
    435435        }
    436436
    437         private MultiBinding CreateConnectorBinding(ConnectorView connectable)
     437        public MultiBinding CreateConnectorBinding(ConnectorView connectable)
    438438        {
    439439            MultiBinding multiBinding = new MultiBinding();
     
    494494        //}
    495495
    496         void shape_OnConnectorMouseLeftButtonDown(object sender, ConnectorViewEventArgs e)
     496        public void shape_OnConnectorMouseLeftButtonDown(object sender, ConnectorViewEventArgs e)
    497497        {
    498498            if (this.State == EditorState.READY)
     
    525525        }
    526526
    527         void WorkSpaceEditorView_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
     527        public void WorkSpaceEditorView_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
    528528        {
    529529            UserContentWrapper.SelectedItem = null;
     
    531531        }
    532532
    533         void WorkSpaceEditorView_MouseLeave(object sender, MouseEventArgs e)
     533        public void WorkSpaceEditorView_MouseLeave(object sender, MouseEventArgs e)
    534534        {
    535535            if (this.State == EditorState.READY)
     
    548548        }
    549549
    550         void shape_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
     550        public void shape_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    551551        {
    552552            Canvas.SetZIndex(sender as PluginContainerView, 100);
     
    712712        {
    713713        }
     714
     715        #region IUpdateableView Members
     716
     717        public void update()
     718        {
     719       
     720        }
     721
     722        #endregion
    714723    }
    715724
  • trunk/CrypPlugins/WorkspaceManager/WorkspaceManager.cs

    r2598 r2616  
    4343using System.Windows.Documents;
    4444using System.Windows.Markup;
     45using WorkspaceManager.Model.Tools;
    4546
    4647//Disable warnings for unused or unassigned fields and events:
     
    6970            WorkspaceModel.WorkspaceManagerEditor = this;
    7071            WorkspaceSpaceEditorView = new WorkSpaceEditorView(WorkspaceModel);
    71             HasChanges = false;                               
     72            HasChanges = false;
     73            UndoRedoManager = new UndoRedoManager();
    7274        }
    7375
     
    8890        private volatile bool executing = false;
    8991        private volatile bool stopping = false;
     92        private UndoRedoManager UndoRedoManager = null;
    9093
    9194        #endregion
     
    141144                this.OnProjectTitleChanged.BeginInvoke(this, "unnamed project", null, null);
    142145            }
     146            UndoRedoManager.ClearStacks();
     147            WorkspaceModel.UndoRedoManager = UndoRedoManager;
     148            WorkspaceModel.UpdateableView = this.WorkspaceSpaceEditorView;
    143149        }
    144150
     
    154160                WorkspaceSpaceEditorView.Load(model);
    155161                WorkspaceModel = model;
     162                WorkspaceModel.UndoRedoManager = UndoRedoManager;
     163                WorkspaceModel.UpdateableView = this.WorkspaceSpaceEditorView;
    156164            }
    157165            catch (Exception ex)
     
    174182                WorkspaceModel = ModelPersistance.loadModel(fileName,this);               
    175183                WorkspaceSpaceEditorView.Load(WorkspaceModel);
     184                WorkspaceModel.UndoRedoManager = UndoRedoManager;
     185                WorkspaceModel.UpdateableView = this.WorkspaceSpaceEditorView;
    176186                HasChanges = false;
    177187                this.OnProjectTitleChanged.BeginInvoke(this, System.IO.Path.GetFileName(fileName), null, null);
     
    244254        public void Undo()
    245255        {
    246             //to be implemented
     256            if (UndoRedoManager != null)
     257            {
     258                try
     259                {
     260                    UndoRedoManager.Undo();
     261                }
     262                catch (Exception ex)
     263                {
     264                    GuiLogMessage("Can not undo:" + ex.Message,NotificationLevel.Error);
     265                }
     266            }
    247267        }
    248268
     
    252272        public void Redo()
    253273        {
    254             //to be implemented
     274            if (UndoRedoManager != null)
     275            {
     276                try
     277                {
     278                    UndoRedoManager.Redo();
     279                }
     280                catch (Exception ex)
     281                {
     282                    GuiLogMessage("Can not redo:" + ex.Message, NotificationLevel.Error);
     283                }
     284            }
    255285        }
    256286
     
    363393        public bool CanUndo
    364394        {
    365             get;
    366             set;
     395            get
     396            {
     397                if (UndoRedoManager != null)
     398                {
     399                    return UndoRedoManager.CanUndo();
     400                }
     401                else
     402                {
     403                    return false;
     404                }
     405            }
    367406        }
    368407
     
    372411        public bool CanRedo
    373412        {
    374             get;
    375             set;
     413            get
     414            {
     415                if (UndoRedoManager != null)
     416                {
     417                    return UndoRedoManager.CanRedo();
     418                }
     419                else
     420                {
     421                    return false;
     422                }
     423            }
    376424        }
    377425
  • trunk/CrypPlugins/WorkspaceManager/WorkspaceManager.csproj

    r2589 r2616  
    6161  </ItemGroup>
    6262  <ItemGroup>
    63     <Compile Include="Model\ImageModel.cs" />
    64     <Compile Include="Model\TextModel.cs" />
     63    <Compile Include="Model\Elements\ImageModel.cs" />
     64    <Compile Include="Model\Elements\TextModel.cs" />
    6565    <Compile Include="Execution\ExecutionEngine.cs" />
    66     <Compile Include="Model\ColorHelper.cs" />
    67     <Compile Include="Model\ConnectionModel.cs" />
    68     <Compile Include="Model\ConnectorModel.cs" />
    69     <Compile Include="Model\ModelPersistance.cs" />
    70     <Compile Include="Model\PluginModel.cs" />
    71     <Compile Include="Model\VisualElementModel.cs" />
    72     <Compile Include="Model\WorkspaceModel.cs" />
    73     <Compile Include="Model\XMLSerialization.cs" />
     66    <Compile Include="Model\Tools\ColorHelper.cs" />
     67    <Compile Include="Model\Elements\ConnectionModel.cs" />
     68    <Compile Include="Model\Elements\ConnectorModel.cs" />
     69    <Compile Include="Model\Tools\ModelPersistance.cs" />
     70    <Compile Include="Model\Elements\PluginModel.cs" />
     71    <Compile Include="Model\Elements\VisualElementModel.cs" />
     72    <Compile Include="Model\Elements\WorkspaceModel.cs" />
     73    <Compile Include="Model\Tools\UndoRedoManager.cs" />
     74    <Compile Include="Model\Tools\XMLSerialization.cs" />
    7475    <Compile Include="Properties\AssemblyInfo.cs" />
    7576    <Compile Include="Properties\Resources.de-DE.Designer.cs">
Note: See TracChangeset for help on using the changeset viewer.