Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/07/09 16:31:55 (15 years ago)
Author:
mkommend
Message:

first part of changes after discussion with SWA (ticket #716)

Location:
trunk/sources/HeuristicLab.MainForm/3.2
Files:
1 deleted
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm/3.2/DockingMainForm.cs

    r2254 r2256  
    5151        content.Activated += new EventHandler(DockFormActivated);
    5252        content.FormClosing += new FormClosingEventHandler(DockFormClosing);
    53         foreach (IToolStripItem item in viewStateChangeToolStripItems)
    54           view.StateChanged += new EventHandler(item.ViewStateChanged);
     53        foreach (IToolStripItem item in ViewChangedToolStripItems)
     54          view.StateChanged += new EventHandler(item.ViewChanged);
    5555        content.Show(dockPanel);
    5656      }
     
    5959    private void DockFormClosing(object sender, FormClosingEventArgs e) {
    6060      DockForm dockForm = (DockForm)sender;
    61       openViews.Remove(dockForm.View);
    62       if (openViews.Count == 0)
     61      views.Remove(dockForm.View);
     62      if (views.Count == 0)
    6363        ActiveView = null;
    6464      dockForm.Activated -= new EventHandler(DockFormActivated);
    6565      dockForm.FormClosing -= new FormClosingEventHandler(DockFormClosing);
    66       foreach (IToolStripItem item in viewStateChangeToolStripItems)
    67         dockForm.View.StateChanged -= new EventHandler(item.ViewStateChanged);
     66      foreach (IToolStripItem item in ViewChangedToolStripItems)
     67        dockForm.View.StateChanged -= new EventHandler(item.ViewChanged);
    6868    }
    6969
  • trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLab.MainForm-3.2.csproj

    r2253 r2256  
    108108    <Compile Include="Interfaces\IMainForm.cs" />
    109109    <Compile Include="Interfaces\IToolStripMenuItem.cs" />
    110     <Compile Include="Interfaces\IModel.cs" />
    111110    <Compile Include="Interfaces\IToolStripButtonItem.cs" />
    112111    <Compile Include="Interfaces\IToolStripItem.cs" />
  • trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IMainForm.cs

    r2254 r2256  
    3434    IView ActiveView { get; }
    3535    event EventHandler ActiveViewChanged;
    36     IEnumerable<IView> OpenViews { get; }
     36    IEnumerable<IView> Views { get; }
    3737
    3838    Type UserInterfaceItemType { get; }
    3939    void ShowView(IView view);
    40     void CloseForm();
     40    void Close();
    4141  }
    4242}
  • trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IToolStripItem.cs

    r2254 r2256  
    3939
    4040    bool ListenActiveViewChanged { get; }
    41     bool ListenViewStateChanged { get; }
     41    bool ListenViewChanged { get; }
    4242    void ActiveViewChanged(object sender, EventArgs e);
    43     void ViewStateChanged(object sender, EventArgs e);
     43    void ViewChanged(object sender, EventArgs e);
    4444  }
    4545}
  • trunk/sources/HeuristicLab.MainForm/3.2/MainFormBase.cs

    r2254 r2256  
    3636      : base() {
    3737      InitializeComponent();
    38       openViews = new List<IView>();
    39       viewStateChangeToolStripItems = new List<IToolStripItem>();
     38      views = new List<IView>();
     39      viewChangeToolStripItems = new List<IToolStripItem>();
    4040      this.userInterfaceItemType = userInterfaceItemType;
    4141      CreateGUI();
     
    4646    public string Title {
    4747      get { return this.Text; }
    48       set { this.Text = value; }
     48      set {
     49        if (InvokeRequired) {
     50          Action<string> action = delegate(string s) { this.Title = s; };
     51          Invoke(action, new object[] { value });
     52        } else
     53          this.Text = value;
     54      }
    4955    }
    5056
    5157    public string StatusStripText {
    5258      get { return this.statusStripLabel.Text; }
    53       set { this.statusStripLabel.Text = value; }
     59      set {
     60        if (InvokeRequired) {
     61          Action<string> action = delegate(string s) { this.statusStripLabel.Text = s; };
     62          Invoke(action, new object[] { value });
     63        } else
     64          this.statusStripLabel.Text = value;
     65      }
    5466    }
    5567
    56     protected Type userInterfaceItemType;
     68    private Type userInterfaceItemType;
    5769    public Type UserInterfaceItemType {
    5870      get { return this.userInterfaceItemType; }
     71      protected set { this.userInterfaceItemType = value; }
    5972    }
    6073
     
    7083    }
    7184
    72     protected List<IToolStripItem> viewStateChangeToolStripItems;
     85    private List<IToolStripItem> viewChangeToolStripItems;
     86    protected IEnumerable<IToolStripItem> ViewChangedToolStripItems {
     87      get { return this.viewChangeToolStripItems; }
     88    }
    7389
    7490    public event EventHandler ActiveViewChanged;
    7591    protected virtual void OnActiveViewChanged() {
    76       if(ActiveViewChanged != null)
    77         ActiveViewChanged(this,new EventArgs());
     92      if (ActiveViewChanged != null)
     93        ActiveViewChanged(this, new EventArgs());
    7894    }
    7995
    80     protected List<IView> openViews;
    81     public IEnumerable<IView> OpenViews {
    82       get { return openViews; }
     96    protected List<IView> views;
     97    public IEnumerable<IView> Views {
     98      get { return views; }
    8399    }
    84100
    85101    public virtual void ShowView(IView view) {
    86       view.MainForm = this;     
    87       openViews.Add(view);
     102      view.MainForm = this;
     103      views.Add(view);
    88104      ActiveView = view;
    89     }
    90 
    91     public void CloseForm() {
    92       this.Close();
    93105    }
    94106    #endregion
     
    160172      if (iToolStripItem.ListenActiveViewChanged)
    161173        this.ActiveViewChanged += new EventHandler(iToolStripItem.ActiveViewChanged);
    162       if (iToolStripItem.ListenViewStateChanged)
    163         this.viewStateChangeToolStripItems.Add(iToolStripItem);
     174      if (iToolStripItem.ListenViewChanged)
     175        this.viewChangeToolStripItems.Add(iToolStripItem);
    164176      toolStripItem.Click += new EventHandler(ToolStripItemClicked);
    165177      iToolStripItem.ToolStripItem = toolStripItem;
  • trunk/sources/HeuristicLab.MainForm/3.2/MultipleDocumentMainForm.cs

    r2255 r2256  
    2424        form.FormClosing += new FormClosingEventHandler(MultipleDocumentFormClosing);
    2525        form.MdiParent = this;
    26         foreach (IToolStripItem item in viewStateChangeToolStripItems)
    27           view.StateChanged += new EventHandler(item.ViewStateChanged);
     26        foreach (IToolStripItem item in ViewChangedToolStripItems)
     27          view.StateChanged += new EventHandler(item.ViewChanged);
    2828        form.Show();
    2929      }
     
    3737    private void MultipleDocumentFormClosing(object sender, FormClosingEventArgs e) {
    3838      MultipleDocumentForm form = (MultipleDocumentForm)sender;
    39       openViews.Remove(form.View);
    40       if (openViews.Count == 0)
     39      views.Remove(form.View);
     40      if (views.Count == 0)
    4141        ActiveView = null;
    4242      form.Activated -= new EventHandler(MultipleDocumentFormActivated);
    4343      form.FormClosing -= new FormClosingEventHandler(MultipleDocumentFormClosing);
    44       foreach (IToolStripItem item in viewStateChangeToolStripItems)
    45         form.View.StateChanged -= new EventHandler(item.ViewStateChanged);
     44      foreach (IToolStripItem item in ViewChangedToolStripItems)
     45        form.View.StateChanged -= new EventHandler(item.ViewChanged);
    4646    }
    4747  }
  • trunk/sources/HeuristicLab.MainForm/3.2/ToolStripButtonItemBase.cs

    r2249 r2256  
    3333          return ToolStripItemDisplayStyle.Image;
    3434        else
    35           return ToolStripItemDisplayStyle.ImageAndText;
     35          return ToolStripItemDisplayStyle.Text;
    3636      }
    3737    }
  • trunk/sources/HeuristicLab.MainForm/3.2/ToolStripItemBase.cs

    r2254 r2256  
    5151    }
    5252
    53     public static readonly char structureSeparator = '/';
    54     public char StructureSeparator {
     53    private static readonly char structureSeparator = '/';
     54    public virtual char StructureSeparator {
    5555      get { return ToolStripMenuItemBase.structureSeparator; }
    5656    }
     
    5959      get { return false; }
    6060    }
    61     public virtual bool ListenViewStateChanged {
     61    public virtual bool ListenViewChanged {
    6262      get { return false; }
    6363    }
     
    6666    }
    6767
    68     public virtual void ViewStateChanged(object sender, EventArgs e) {
     68    public virtual void ViewChanged(object sender, EventArgs e) {
    6969    }
    7070    #endregion
  • trunk/sources/HeuristicLab.MainForm/3.2/ToolStripMenuItemBase.cs

    r2249 r2256  
    3333
    3434    public override ToolStripItemDisplayStyle DisplayStyle {
    35       get { return ToolStripItemDisplayStyle.ImageAndText; }
     35      get { return ToolStripItemDisplayStyle.Text; }
    3636    }
    3737  }
Note: See TracChangeset for help on using the changeset viewer.