316 lines
10 KiB
C#
316 lines
10 KiB
C#
/*********************************************************************************************
|
|
* Copyright 2004 - Volian Enterprises, Inc. All rights reserved.
|
|
* Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
|
* ------------------------------------------------------------------------------
|
|
* $Workfile: LDProperties.cs $ $Revision: 3 $
|
|
* $Author: Kathy $ $Date: 2/10/05 12:36p $
|
|
*
|
|
* $History: LDProperties.cs $
|
|
*
|
|
* ***************** Version 3 *****************
|
|
* User: Kathy Date: 2/10/05 Time: 12:36p
|
|
* Updated in $/LibSource/VEObject
|
|
* B2005-012: No apply button for new
|
|
*
|
|
* ***************** Version 2 *****************
|
|
* User: Kathy Date: 8/04/04 Time: 10:25a
|
|
* Updated in $/LibSource/VEObject
|
|
* No usage on New Lib Doc
|
|
*
|
|
* ***************** Version 1 *****************
|
|
* User: Kathy Date: 7/27/04 Time: 8:53a
|
|
* Created in $/LibSource/VEObject
|
|
*********************************************************************************************/
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
using System.Text;
|
|
using Utils;
|
|
|
|
|
|
namespace VEObject
|
|
{
|
|
/// <summary>
|
|
/// NOTE: cmbType (the combo box that contains the document types) must match
|
|
/// the order of document types given in the ProcTypeOptions for this dialog
|
|
/// to work correctly
|
|
/// </summary>
|
|
public class LDProperties : System.Windows.Forms.Form
|
|
{
|
|
private System.Windows.Forms.Button btnOK;
|
|
private System.Windows.Forms.Button btnCancel;
|
|
private System.Windows.Forms.Button btnApply;
|
|
private VEO_Base _ParentObj;
|
|
private VEO_Base _CurObj;
|
|
private bool isnew;
|
|
private System.Windows.Forms.TabControl tabControl1;
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
private System.ComponentModel.Container components = null;
|
|
private System.Windows.Forms.TabPage tbPageUsage;
|
|
private System.Windows.Forms.PropertyGrid myPropertyGrid;
|
|
private System.Windows.Forms.TabPage tbGeneral;
|
|
private System.Windows.Forms.Label lblUsage;
|
|
private System.Windows.Forms.ListBox lbUsage;
|
|
private bool canedit;
|
|
|
|
public LDProperties(Object parent, Object curobj)
|
|
{
|
|
//
|
|
// Required for Windows Form Designer support
|
|
//
|
|
_ParentObj = (VEO_Base) parent;
|
|
_CurObj = (VEO_Base) curobj;
|
|
VEO_LibDoc ld = (VEO_LibDoc) curobj;
|
|
if (ld.isNew == true)
|
|
isnew=true;
|
|
else
|
|
isnew=false;
|
|
|
|
InitializeComponent();
|
|
|
|
this.myPropertyGrid.SelectedObject=curobj;
|
|
if (isnew == true)
|
|
{
|
|
this.tabControl1.TabPages.Remove(this.tbPageUsage);
|
|
canedit=true;
|
|
}
|
|
else
|
|
{
|
|
if (this.tabControl1.TabPages.Contains(this.tbPageUsage)==false)
|
|
this.tabControl1.TabPages.Add(this.tbPageUsage);
|
|
ld.GetUsages();
|
|
foreach (string usg in ld.usages)
|
|
{
|
|
this.lbUsage.Items.Add(usg);
|
|
}
|
|
}
|
|
|
|
if((_CurObj.canEdit()==false)&&!isnew)
|
|
{
|
|
canedit=false;
|
|
this.myPropertyGrid.Enabled=false;
|
|
}
|
|
else if (!isnew)
|
|
{
|
|
canedit=true;
|
|
this.myPropertyGrid.Enabled=true;
|
|
}
|
|
this.lblUsage.Text = "'" + ld.Title + "' is used in...";
|
|
btnApply.Enabled = false;
|
|
// make apply button visible if modify
|
|
this.btnApply.Visible = !isnew;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
protected override void Dispose( bool disposing )
|
|
{
|
|
if( disposing )
|
|
{
|
|
if(components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
}
|
|
base.Dispose( disposing );
|
|
}
|
|
|
|
#region Windows Form Designer generated code
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(LDProperties));
|
|
this.btnOK = new System.Windows.Forms.Button();
|
|
this.btnCancel = new System.Windows.Forms.Button();
|
|
this.btnApply = new System.Windows.Forms.Button();
|
|
this.tabControl1 = new System.Windows.Forms.TabControl();
|
|
this.tbGeneral = new System.Windows.Forms.TabPage();
|
|
this.myPropertyGrid = new System.Windows.Forms.PropertyGrid();
|
|
this.tbPageUsage = new System.Windows.Forms.TabPage();
|
|
this.lblUsage = new System.Windows.Forms.Label();
|
|
this.lbUsage = new System.Windows.Forms.ListBox();
|
|
this.tabControl1.SuspendLayout();
|
|
this.tbGeneral.SuspendLayout();
|
|
this.tbPageUsage.SuspendLayout();
|
|
this.SuspendLayout();
|
|
//
|
|
// btnOK
|
|
//
|
|
this.btnOK.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.btnOK.Location = new System.Drawing.Point(424, 296);
|
|
this.btnOK.Name = "btnOK";
|
|
this.btnOK.Size = new System.Drawing.Size(64, 24);
|
|
this.btnOK.TabIndex = 8;
|
|
this.btnOK.Text = "OK";
|
|
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
|
//
|
|
// btnCancel
|
|
//
|
|
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.btnCancel.Location = new System.Drawing.Point(504, 296);
|
|
this.btnCancel.Name = "btnCancel";
|
|
this.btnCancel.Size = new System.Drawing.Size(64, 24);
|
|
this.btnCancel.TabIndex = 9;
|
|
this.btnCancel.Text = "Cancel";
|
|
this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
|
//
|
|
// btnApply
|
|
//
|
|
this.btnApply.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.btnApply.Location = new System.Drawing.Point(584, 296);
|
|
this.btnApply.Name = "btnApply";
|
|
this.btnApply.Size = new System.Drawing.Size(56, 24);
|
|
this.btnApply.TabIndex = 10;
|
|
this.btnApply.Text = "Apply";
|
|
this.btnApply.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
|
|
//
|
|
// tabControl1
|
|
//
|
|
this.tabControl1.Controls.Add(this.tbGeneral);
|
|
this.tabControl1.Controls.Add(this.tbPageUsage);
|
|
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
|
this.tabControl1.Name = "tabControl1";
|
|
this.tabControl1.SelectedIndex = 0;
|
|
this.tabControl1.Size = new System.Drawing.Size(784, 280);
|
|
this.tabControl1.TabIndex = 17;
|
|
//
|
|
// tbGeneral
|
|
//
|
|
this.tbGeneral.Controls.Add(this.myPropertyGrid);
|
|
this.tbGeneral.Location = new System.Drawing.Point(4, 22);
|
|
this.tbGeneral.Name = "tbGeneral";
|
|
this.tbGeneral.Size = new System.Drawing.Size(776, 254);
|
|
this.tbGeneral.TabIndex = 0;
|
|
this.tbGeneral.Text = "General";
|
|
//
|
|
// myPropertyGrid
|
|
//
|
|
this.myPropertyGrid.CommandsVisibleIfAvailable = true;
|
|
this.myPropertyGrid.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.myPropertyGrid.HelpVisible = false;
|
|
this.myPropertyGrid.LargeButtons = false;
|
|
this.myPropertyGrid.LineColor = System.Drawing.SystemColors.ScrollBar;
|
|
this.myPropertyGrid.Location = new System.Drawing.Point(8, 39);
|
|
this.myPropertyGrid.Name = "myPropertyGrid";
|
|
this.myPropertyGrid.Size = new System.Drawing.Size(736, 94);
|
|
this.myPropertyGrid.TabIndex = 16;
|
|
this.myPropertyGrid.Text = "Properties";
|
|
this.myPropertyGrid.ToolbarVisible = false;
|
|
this.myPropertyGrid.ViewBackColor = System.Drawing.SystemColors.Window;
|
|
this.myPropertyGrid.ViewForeColor = System.Drawing.SystemColors.WindowText;
|
|
this.myPropertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.myPropertyGrid_PropertyValueChanged);
|
|
//
|
|
// tbPageUsage
|
|
//
|
|
this.tbPageUsage.Controls.Add(this.lblUsage);
|
|
this.tbPageUsage.Controls.Add(this.lbUsage);
|
|
this.tbPageUsage.Location = new System.Drawing.Point(4, 22);
|
|
this.tbPageUsage.Name = "tbPageUsage";
|
|
this.tbPageUsage.Size = new System.Drawing.Size(776, 254);
|
|
this.tbPageUsage.TabIndex = 1;
|
|
this.tbPageUsage.Text = "Usages";
|
|
//
|
|
// lblUsage
|
|
//
|
|
this.lblUsage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.lblUsage.Location = new System.Drawing.Point(16, 8);
|
|
this.lblUsage.Name = "lblUsage";
|
|
this.lblUsage.Size = new System.Drawing.Size(624, 24);
|
|
this.lblUsage.TabIndex = 22;
|
|
//
|
|
// lbUsage
|
|
//
|
|
this.lbUsage.Location = new System.Drawing.Point(16, 40);
|
|
this.lbUsage.Name = "lbUsage";
|
|
this.lbUsage.Size = new System.Drawing.Size(624, 199);
|
|
this.lbUsage.TabIndex = 21;
|
|
//
|
|
// LDProperties
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
this.ClientSize = new System.Drawing.Size(768, 326);
|
|
this.Controls.Add(this.tabControl1);
|
|
this.Controls.Add(this.btnApply);
|
|
this.Controls.Add(this.btnCancel);
|
|
this.Controls.Add(this.btnOK);
|
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|
this.Name = "LDProperties";
|
|
this.Text = "Library Document Properties";
|
|
this.tabControl1.ResumeLayout(false);
|
|
this.tbGeneral.ResumeLayout(false);
|
|
this.tbPageUsage.ResumeLayout(false);
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
// save was clicked, use the objects save methods.
|
|
private bool saveclick()
|
|
{
|
|
bool success = true;
|
|
|
|
if (isnew)
|
|
{
|
|
if(_ParentObj==null)
|
|
{
|
|
DialogResult=DialogResult.Cancel;
|
|
return true;
|
|
}
|
|
|
|
success=_ParentObj.SaveChild(_CurObj);
|
|
}
|
|
else
|
|
{
|
|
success=_CurObj.Write();
|
|
}
|
|
return success;
|
|
|
|
}
|
|
// save was clicked, use the objects save methods.
|
|
private void btnOK_Click(object sender, System.EventArgs e)
|
|
{
|
|
bool success = true;
|
|
if(canedit)success = saveclick();
|
|
if (success==true)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void btnApply_Click(object sender, System.EventArgs e)
|
|
{
|
|
if(canedit)return;
|
|
bool success = saveclick();
|
|
if(success==true)btnApply.Enabled=false;
|
|
Refresh();
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, System.EventArgs e)
|
|
{
|
|
if(!canedit)return;
|
|
_CurObj.Restore();
|
|
}
|
|
|
|
private void myPropertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e)
|
|
{
|
|
btnApply.Enabled = true;
|
|
}
|
|
}
|
|
}
|