unit dlgCategoryProperties; { [dlgCategoryProperies] [1.2] Delphi 2005 April 2008 LICENSE The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at "http://www.mozilla.org/MPL/" Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is "[dlgCategoryProperies.pas] and [dlgCategoryProperies.dfm]". The Initial Developer of the Original Code is Martin Holmes (Victoria, BC, Canada, "http://www.mholmes.com/"). Copyright (C) 2005-2008 Martin Holmes and the University of Victoria Computing and Media Centre. The code was co-developed for university and personal projects, and rights are shared by Martin Holmes and the University of Victoria. All Rights Reserved. } { Written by Martin Holmes, Spring 2006. Updated several times. This unit provides a GUI for viewing and setting the properties associated with an annotation category. These can include the shape and colour used to paint the annotation area onto the image, as well as the id and title of the category. Dependencies: TntUnicodeControls (Troy Wolbrink) FormState for saving size/position etc. } interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, TntForms, TntClasses, FormState, StdCtrls, Buttons, TntButtons, JvExStdCtrls, JvCombobox, JvColorCombo, TntStdCtrls, ImgList, IMTDocGlobals; type TufrmCategoryProperties = class(TTntForm) ilShapes: TImageList; ulbCategoryID: TTntLabel; uedCategoryID: TTntEdit; ulbCategoryDescription: TTntLabel; uedCategoryDescription: TTntEdit; ulbColour: TTntLabel; jvcolcmbCatColor: TJvColorComboBox; usbRectangle: TTntSpeedButton; usbEllipse: TTntSpeedButton; usbCross: TTntSpeedButton; usbSpiral: TTntSpeedButton; ubnCatCancel: TTntBitBtn; ubnCatOK: TTntBitBtn; ulbShape: TTntLabel; ucbTranscriptional: TTntCheckBox; procedure TntFormActivate(Sender: TObject); procedure ubnCatCancelClick(Sender: TObject); procedure ubnCatOKClick(Sender: TObject); procedure TntFormDestroy(Sender: TObject); procedure TntFormCreate(Sender: TObject); private FCatNum: integer; //The number of the category we're currently editing. FFormStateSaver: TFormStateSaver; function GetSelectedShape: integer; procedure SetSelectedShape(const Value: integer); { Private declarations } public { Public declarations } published property CatNum: integer read FCatNum write FCatNum default -1; property SelectedShape: integer read GetSelectedShape write SetSelectedShape default asRectangle; end; var ufrmCategoryProperties: TufrmCategoryProperties; implementation {$R *.dfm} uses dlgCategoryManager, Main; function TufrmCategoryProperties.GetSelectedShape: integer; begin //Get the right shape property if ufrmCategoryProperties.usbRectangle.Down then Result := asRectangle else if ufrmCategoryProperties.usbEllipse.Down then Result := asEllipse else if ufrmCategoryProperties.usbCross.Down then Result := asCross else Result := asSpiral; end; procedure TufrmCategoryProperties.SetSelectedShape(const Value: integer); begin case Value of asRectangle: usbRectangle.Down := True; asCross: usbCross.Down := True; asEllipse: usbEllipse.Down := True; asSpiral: usbSpiral.Down := True; end; end; procedure TufrmCategoryProperties.TntFormCreate(Sender: TObject); begin FFormStateSaver := TFormStateSaver.Create(Self, True, True, False, False, False, False, False, False, False); end; procedure TufrmCategoryProperties.TntFormDestroy(Sender: TObject); begin FreeAndNil(FFormStateSaver); end; procedure TufrmCategoryProperties.ubnCatOKClick(Sender: TObject); begin ufrmCategoryManager.WriteNewCatDataToDoc; end; procedure TufrmCategoryProperties.ubnCatCancelClick(Sender: TObject); begin ModalResult := mrCancel; Hide; end; procedure TufrmCategoryProperties.TntFormActivate(Sender: TObject); begin ufrmMain.LastFocusWin := lfwCatProp; end; end.