//
// Copyright (c) jindongfang. All rights reserved.
//
using System;
using System.Windows.Forms;
using DevExpress.XtraTreeList.Nodes;
using GeoSigma.SigmaDrawerUtil;
namespace PcgDrawR
{
///
/// 全局配置窗口
///
///
public partial class FormGlobalOptions : DevExpress.XtraEditors.XtraForm
{
private DrawerGlobalConfig globalConfig = null;
///
/// Initializes a new instance of the class.
///
public FormGlobalOptions()
{
this.InitializeComponent();
this.trlDataItem.ClearNodes();
TreeListNode tnSelectConfig = this.trlDataItem.AppendNode(
new object[]
{
"范围选择",
}, -1, 0, 1, -1);
TreeListNode tnFillConfig = this.trlDataItem.AppendNode(
new object[]
{
"区域填充",
}, -1, 0, 1, -1);
// 这个功能细节有待讨论,先注释掉
// TreeListNode tnMeshColorEditor = this.trlDataItem.AppendNode(
// new object[]
// {
// "曲面颜色编辑",
// }, -1, 0, 1, -1);
this.globalConfig = DrawerGlobalConfig.Instance;
tnSelectConfig.Tag = this.globalConfig.RangSelectNode;
tnFillConfig.Tag = this.globalConfig.FillNode;
//tnMeshColorEditor.Tag = this.globalConfig.MeshColorEditNode;
}
private void FormGlobalOptions_Load(object sender, EventArgs e)
{
this.trlDataItem.FocusedNode = this.trlDataItem.Nodes[0];
this.propertyGridControl1.SelectedObject = this.trlDataItem.FocusedNode.Tag;
}
///
/// 确定事件.
///
/// The source of the event.
/// The instance containing the event data.
private void btnOK_Click(object sender, EventArgs e)
{
this.globalConfig.Save();
this.DialogResult = DialogResult.OK;
}
///
/// 取消事件.
///
/// The source of the event.
/// The instance containing the event data.
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void trlDataItem_SelectionChanged(object sender, EventArgs e)
{
}
private void trlDataItem_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
{
if (e.Node == null)
{
return;
}
object obj = e.Node.Tag;
if (obj != null)
{
this.propertyGridControl1.SelectedObject = obj;
}
else
{
this.propertyGridControl1.SelectedObject = obj;
}
}
}
}