home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 October
/
Chip_2001-10_cd1.bin
/
zkuste
/
delphi
/
kompon
/
d123456
/
CHEMPLOT.ZIP
/
TPlot
/
Propedit.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2001-07-24
|
16KB
|
440 lines
unit Propedit;
{$I Plot.inc}
{-----------------------------------------------------------------------------
The contents of this file are subject to the Q Public License
("QPL"); you may not use this file except in compliance
with the QPL. You may obtain a copy of the QPL from
the file QPL.html in this distribution, derived from:
http://www.trolltech.com/products/download/freelicense/license.html
The QPL prohibits development of proprietary software.
There is a Professional Version of this software available for this.
Contact sales@chemware.hypermart.net for more information.
Software distributed under the QPL is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the QPL for
the specific language governing rights and limitations under the QPL.
The Original Code is: PropEdit.pas, released 12 September 2000.
The Initial Developer of the Original Code is Mat Ballard.
Portions created by Mat Ballard are Copyright (C) 1999 Mat Ballard.
Portions created by Microsoft are Copyright (C) 1998, 1999 Microsoft Corp.
All Rights Reserved.
Contributor(s): Mat Ballard e-mail: mat.ballard@chemware.hypermart.net.
Last Modified: 10/10/2000
Current Version: 2.00
You may retrieve the latest version of this file from:
http://Chemware.hypermart.net/
This work was created with the Project JEDI VCL guidelines:
http://www.delphi-jedi.org/Jedi:VCLVCL
in mind.
Purpose:
To edit various TPlot properties not covered by other dialogs..
Known Issues:
-----------------------------------------------------------------------------}
interface
uses
Classes, SysUtils, TypInfo,
{$IFDEF WINDOWS}
WinTypes, WinProcs,
Buttons, Controls, ComCtrls, ExtCtrls, Forms, Graphics, Printers, StdCtrls,
{$ENDIF}
{$IFDEF WIN32}
Windows,
Buttons, Controls, ComCtrls, ExtCtrls, Forms, Graphics, Printers, StdCtrls,
{$ENDIF}
{$IFDEF LINUX}
QButtons, QControls, QExtCtrls, QForms, QGraphics, QPrinters, QStdCtrls,
{$ENDIF}
Axis, Misc, Plotdefs, Nedit, Coloredt;
type
TPlotPropertyEditorForm = class(TForm)
HelpBitBtn: TBitBtn;
CancelBitBtn: TBitBtn;
OKBitBtn: TBitBtn;
PlotTypeComboBox: TComboBox;
PlotTypeLabel: TLabel;
MultiplicityLabel: TLabel;
ColorLabel: TLabel;
CreatedByEdit: TEdit;
DescriptionEdit: TEdit;
CreatedByLabel: TLabel;
DescriptionLabel: TLabel;
MultiplicityPenGroupBox: TGroupBox;
MultiplicityPenColorLabel: TLabel;
MultiplicityPenWidthLabel: TLabel;
MultiplicityPenStyleLabel: TLabel;
PenWidthComboBox: TComboBox;
PenStyleComboBox: TComboBox;
PieRowCountComboBox: TComboBox;
PieRowCountLabel: TLabel;
ClickAndDragDelayNEdit: TNEdit;
DragDelayLabel: TLabel;
ColumnGapLabel: TLabel;
ColumnGapNEdit: TNEdit;
PrintOrientLabel: TLabel;
PrintOrientationComboBox: TComboBox;
Label7: TLabel;
MultiplicityComboBox: TComboBox;
ZAxisAngleNEdit: TNEdit;
ZAxisAngleLabel: TLabel;
LinkZSeriesCheckBox: TCheckBox;
GridLabel: TLabel;
GridComboBox: TComboBox;
GridStyleComboBox: TComboBox;
GridStyleLabel: TLabel;
PenColorEdit: TColorEdit;
PolarRangeLabel: TLabel;
PolarRangeNEdit: TNEdit;
ApplyBitBtn: TBitBtn;
BubbleSizeLabel: TLabel;
BubbleSizeNEdit: TNEdit;
MultiJoinLabel: TLabel;
MultiJoinEdit: TEdit;
XYFastAtLabel: TLabel;
XYFastAtNEdit: TNEdit;
ZLengthLabel: TLabel;
ZLengthNEdit: TNEdit;
GridColorLabel: TLabel;
WallColorLabel: TLabel;
BackColorEdit: TColorEdit;
GridColorEdit: TColorEdit;
WallColorEdit: TColorEdit;
ContourGroupBox: TGroupBox;
ContourDetailLabel: TLabel;
ContourDetailComboBox: TComboBox;
ContourIntervalLabel: TLabel;
ContourIntervalNEdit: TNEdit;
ContourStartLabel: TLabel;
ContourStartNEdit: TNEdit;
ContourWireFrameCheckBox: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure PlotTypeComboBoxClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBitBtnClick(Sender: TObject);
procedure ApplyBitBtnClick(Sender: TObject);
private
public
ThePlot: TObject;
{$IFNDEF LANG_ENGLISH}
procedure DoCaptionsFromResource;
{$ENDIF}
procedure DoHintsFromResource;
end;
var
PlotPropertyEditorForm: TPlotPropertyEditorForm;
implementation
{$R *.dfm}
uses
Data, Plot;
{------------------------------------------------------------------------------
Procedure: TPointEditorForm.FormCreate
Description: standard FormCreate procedure
Author: Mat Ballard
Date created: 10/10/2000
Date modified: 10/10/2000 by Mat Ballard
Purpose: sets the position
Known Issues:
------------------------------------------------------------------------------}
procedure TPlotPropertyEditorForm.FormCreate(Sender: TObject);
var
i: TColor;
begin
{$IFNDEF LANG_ENGLISH}
DoCaptionsFromResource;
{$ENDIF}
DoHintsFromResource;
SetDialogGeometry(Self, ApplyBitBtn, PlotTypeLabel.Left);
{set combo and edit box widths:}
for i := 0 to Self.ComponentCount - 1 do
if ((Self.Components[i] is TNEdit) or
(Self.Components[i] is TColorEdit) or
(Self.Components[i] is TComboBox)) then
TControl(Self.Components[i]).Width := 88;
for i := 0 to Self.ComponentCount - 1 do
if (Self.Components[i] is TBitBtn) then
TControl(Self.Components[i]).Width := 97;
{the exceptions:}
PieRowCountComboBox.Width := 50;
ClickAndDragDelayNEdit.Width := 64;
ZAxisAngleNEdit.Width := 64;
BubbleSizeNEdit.Top := MultiplicityComboBox.Top;
BubbleSizeLabel.Top := MultiplicityLabel.Top;
ColumnGapLabel.Top := MultiplicityLabel.Top;
ColumnGapNEdit.Top := MultiplicityComboBox.Top;
ContourGroupBox.Top := MultiplicityPenGroupBox.Top;
ContourWireFrameCheckBox.Left := ContourStartNEdit.Left;
PieRowCountLabel.Top := MultiplicityLabel.Top;
PieRowCountComboBox.Top := MultiplicityComboBox.Top;
PolarRangeLabel.Top := MultiplicityLabel.Top;
PolarRangeNEdit.Top := MultiplicityComboBox.Top;
XYFastAtNEdit.Top := MultiplicityComboBox.Top;
XYFastAtLabel.Top := MultiplicityLabel.Top;
//ZAxisAngleLabel.Top := MultiJoinLabel.Top;
//ZAxisAngleNEdit.Top := MultiJoinEdit.Top;
ZLengthNEdit.Top := ZAxisAngleNEdit.Top;
ZLengthLabel.Top := ZAxisAngleLabel.Top;
{Populate the combo boxes:}
for i := 0 to Ord(High(TContourDetail)) do
ContourDetailComboBox.Items.Add(Copy(GetEnumName(TypeInfo(TContourDetail), i), 3, 99));
for i := 0 to Ord(High(TGridType)) do
GridComboBox.Items.Add(Copy(GetEnumName(TypeInfo(TGridType), i), 3, 99));
for i := 0 to Ord(High(TPenStyle)) do
GridStyleComboBox.Items.Add(Copy(GetEnumName(TypeInfo(TPenStyle), i), 3, 99));
for i := 0 to Ord(High(TPlotType)) do
PlotTypeComboBox.Items.Add(Copy(GetEnumName(TypeInfo(TPlotType), i), 3, 99));
for i := 0 to Ord(High(TPenStyle)) do
PenStyleComboBox.Items.Add(Copy(GetEnumName(TypeInfo(TPenStyle), i), 3, 99));
for i := 0 to Ord(High(TPrinterOrientation)) do
PrintOrientationComboBox.Items.Add(Copy(GetEnumName(TypeInfo(TPrinterOrientation), i), 3, 99));
for i := 0 to 20 do
PenWidthComboBox.Items.Add(IntToStr(i));
end;
{------------------------------------------------------------------------------
Procedure: TPlotPropertyEditorForm.DoCaptionsFromResource
Description: standard loading of labels from resources
Author: Mat Ballard
Date created: 06/25/2001
Date modified: 06/25/2001 by Mat Ballard
Purpose: display in different languages
Known Issues:
------------------------------------------------------------------------------}
{$IFNDEF LANG_ENGLISH}
procedure TPlotPropertyEditorForm.DoCaptionsFromResource;
begin
Self.Caption := sPlot + ' ' + sProperty + ' ' + sEditor;
PlotTypeLabel.Caption := sPlot + ' ' + sType;
ColorLabel.Caption := sColor;
GridLabel.Caption := sGrid + ' ' + sType;
GridStyleLabel.Caption := sGrid + ' ' + sStyle;
GridColorLabel.Caption := sGrid + ' ' + sColor;
WallColorLabel.Caption := sWall + ' ' + sColor;
PrintOrientLabel.Caption := sPrintOrient;
DragDelayLabel.Caption := sDragDelay;
CreatedByLabel.Caption := sCreatedBy;
DescriptionLabel.Caption := sDescription;
MultiplicityLabel.Caption := sMultiplicity;
MultiJoinLabel.Caption := sMultiJoin;
MultiplicityPenGroupBox.Caption := sMultiplicity + ' ' + sPen;
MultiplicityPenColorLabel.Caption := sColor;
MultiplicityPenWidthLabel.Caption := sWidth;
MultiplicityPenStyleLabel.Caption := sStyle;
LinkZSeriesCheckBox.Caption := sLink + ' Z ' + sSeries;
ColumnGapLabel.Caption := sColumn + ' ' + sGap;
ContourGroupBox.Caption := sContour;
ContourDetailLabel.Caption := sDetail;
ContourIntervalLabel.Caption := sInterval;
ContourStartLabel.Caption := sStart;
PolarRangeLabel.Caption := sPolarRange;
BubbleSizeLabel.Caption := sBubble + ' ' + sSize;
ZAxisAngleLabel.Caption := 'Z ' + sAxis + ' ' + sAngle;
ZLengthLabel.Caption := 'Z ' + sLength;
XYFastAtLabel.Caption := sXYFastAt;
PieRowCountLabel.Caption := sPieRowCount;
HelpBitBtn.Caption := sHelp;
OKBitBtn.Caption := sOK;
CancelBitBtn.Caption := sCancel;
ApplyBitBtn.Caption := sApply;
end;
{$ENDIF}
{------------------------------------------------------------------------------
Procedure: TPlotPropertyEditorForm.DoHintsFromResource
Description: standard loading of Hints from resources
Author: Mat Ballard
Date created: 06/25/2001
Date modified: 06/25/2001 by Mat Ballard
Purpose: display in different languages
Known Issues:
------------------------------------------------------------------------------}
procedure TPlotPropertyEditorForm.DoHintsFromResource;
begin
PlotTypeComboBox.Hint := sPlotTypeComboBoxHint;
BackColorEdit.Hint := sBackColorEditHint;
GridComboBox.Hint := sGridComboBoxHint;
GridStyleComboBox.Hint := sGridStyleComboBoxHint;
GridColorEdit.Hint := sGridColorEditHint;
WallColorEdit.Hint := sWallColorEditHint;
ClickAndDragDelayNEdit.Hint := sClickAndDragDelayNEditHint;
CreatedByEdit.Hint := sCreatedByEditHint;
MultiplicityComboBox.Hint := sMultiplicityComboBoxHint;
MultiJoinEdit.Hint := sMultiJoinEditHint;
LinkZSeriesCheckBox.Hint := sLinkZSeriesCheckBoxHint;
MultiplicityPenGroupBox.Hint := sMultiplicityPenGroupBoxHint;
ColumnGapNEdit.Hint := sColumnGapNEditHint;
ContourGroupBox.Hint := sContourGroupBoxHint;
ContourDetailComboBox.Hint := sContourDetailComboBoxHint;
ContourIntervalNEdit.Hint := sContourIntervalNEditHint;
ContourStartNEdit.Hint := sContourStartNEditHint;
PolarRangeNEdit.Hint := sPolarRangeNEditHint;
BubbleSizeNEdit.Hint := sBubbleSizeNEditHint;
ZAxisAngleNEdit.Hint := sZAxisAngleNEditHint;
ZLengthNEdit.Hint := sZLengthNEditHint;
XYFastAtNEdit.Hint := sXYFastAtNEditHint;
PieRowCountComboBox.Hint := sPieRowCountComboBoxHint;
ApplyBitBtn.Hint := sApplyHint;
end;
{------------------------------------------------------------------------------
Procedure: TPlotPropertyEditorForm.CancelBitBtnClick
Description: Standard ComboBoxChange event handler
Author: Mat Ballard
Date created: 10/10/2000
Date modified: 10/10/2000 by Mat Ballard
Purpose: Disables and enables edit and combo boxes depending on the Plot Type
Known Issues:
------------------------------------------------------------------------------}
procedure TPlotPropertyEditorForm.PlotTypeComboBoxClick(Sender: TObject);
begin
BubbleSizeNEdit.Visible := FALSE;
ContourGroupBox.Visible := FALSE;
ContourIntervalNEdit.Visible := FALSE;
ContourStartNEdit.Visible := FALSE;
ContourWireFrameCheckBox.Visible := FALSE;
ColumnGapNEdit.Visible := FALSE;
GridLabel.Enabled := FALSE;
LinkZSeriesCheckBox.Visible := FALSE;
MultiplicityComboBox.Visible := FALSE;
MultiJoinEdit.Visible := FALSE;
PieRowCountComboBox.Visible := FALSE;
PolarRangeNEdit.Visible := FALSE;
XYFastAtNEdit.Visible := FALSE;
ZAxisAngleNEdit.Visible := FALSE;
case TPlotType(PlotTypeComboBox.ItemIndex) of
ptXY:
begin
GridLabel.Enabled := TRUE;
XYFastAtNEdit.Visible := TRUE;
end;
ptError: GridLabel.Enabled := TRUE;
ptMultiple:
begin
GridLabel.Enabled := TRUE;
MultiplicityComboBox.Visible := TRUE;
MultiJoinEdit.Visible := TRUE;
end;
ptBubble:
begin
BubbleSizeNEdit.Visible := TRUE;
GridLabel.Enabled := TRUE;
end;
ptColumn, ptStack, ptNormStack: ColumnGapNEdit.Visible := TRUE;
ptPie: PieRowCountComboBox.Visible := TRUE;
ptPolar: PolarRangeNEdit.Visible := TRUE;
ptLineContour:
begin
ContourGroupBox.Visible := TRUE;
ContourIntervalNEdit.Visible := TRUE;
ContourStartNEdit.Visible := TRUE;
end;
ptContour: ContourGroupBox.Visible := TRUE;
pt3DContour:
begin
GridLabel.Enabled := TRUE;
ContourGroupBox.Visible := TRUE;
ContourWireFrameCheckBox.Visible := TRUE;
ZAxisAngleNEdit.Visible := TRUE;
end;
pt3DWire:
begin
GridLabel.Enabled := TRUE;
ZAxisAngleNEdit.Visible := TRUE;
LinkZSeriesCheckBox.Visible := TRUE;
end;
pt3DColumn:
begin
GridLabel.Enabled := TRUE;
ColumnGapNEdit.Visible := TRUE;
ZAxisAngleNEdit.Visible := TRUE;
end;
end;
ZLengthNEdit.Visible := ZAxisAngleNEdit.Visible;
BubbleSizeLabel.Visible := BubbleSizeNEdit.Visible;
ColumnGapLabel.Visible := ColumnGapNEdit.Visible;
ContourDetailLabel.Visible := ContourDetailComboBox.Visible;
ContourIntervalLabel.Visible := ContourIntervalNEdit.Visible;
ContourStartLabel.Visible := ContourStartNEdit.Visible;
GridStyleLabel.Enabled := GridLabel.Enabled;
GridComboBox.Visible := GridLabel.Enabled;
GridStyleComboBox.Visible := GridLabel.Enabled;
GridColorLabel.Enabled := GridLabel.Enabled;
GridColorEdit.Visible := GridLabel.Enabled;
MultiplicityLabel.Visible := MultiplicityComboBox.Visible;
MultiplicityPenGroupBox.Visible := MultiplicityComboBox.Visible;
MultiJoinLabel.Visible := MultiJoinEdit.Visible;
PieRowCountLabel.Visible := PieRowCountComboBox.Visible;
PolarRangeLabel.Visible := PolarRangeNEdit.Visible;
WallColorLabel.Enabled := ZAxisAngleNEdit.Visible;
WallColorEdit.Visible := ZAxisAngleNEdit.Visible;
XYFastAtLabel.Visible := XYFastAtNEdit.Visible;
ZAxisAngleLabel.Visible := ZAxisAngleNEdit.Visible;
ZLengthLabel.Visible := ZAxisAngleNEdit.Visible;
end;
procedure TPlotPropertyEditorForm.FormShow(Sender: TObject);
begin
PlotTypeComboBoxClick(Self);
end;
procedure TPlotPropertyEditorForm.HelpBitBtnClick(Sender: TObject);
{$IFDEF LINUX}
var
TheHelpFile: String;
{$ENDIF}
begin
{$IFDEF LINUX}
TheHelpFile := 'hs' + IntToStr(HelpBitBtn.HelpContext) + '.htm';
{$ENDIF}
end;
{------------------------------------------------------------------------------
Procedure: TPlotPropertyEditorForm.ApplyBitBtnClick
Description: Standard ButtonClick event handler
Author: Mat Ballard
Date created: 03/28/2001
Date modified: 03/28/2001 by Mat Ballard
Purpose: Applies the currently selected properties
Known Issues:
------------------------------------------------------------------------------}
procedure TPlotPropertyEditorForm.ApplyBitBtnClick(Sender: TObject);
begin
TPlot(ThePlot).ApplyPropertiesChange(Self);
end;
end.