[JEDI.NET-commits] main/run Jedi.Collections.pas,NONE,1.1 Jedi.Drawing.pas,NONE,1.1 Jedi.System.pas,
Status: Pre-Alpha
Brought to you by:
jedi_mbe
From: Marcel B. <jed...@us...> - 2004-06-16 14:30:02
|
Update of /cvsroot/jedidotnet/main/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24089/main/run Added Files: Jedi.Collections.pas Jedi.Drawing.pas Jedi.System.pas Jedi.Windows.Forms.Hmi.Leds.pas Log Message: Final location and structure --- NEW FILE: Jedi.System.pas --- {--------------------------------------------------------------------------------------------------- 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/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: Jedi.System.pas, released on 2004-06-13. The Initial Developer of the Original Code is Marcel Bestebroer Portions created by Marcel Bestebroer are Copyright (C) 2004 Marcel Bestebroer All Rights Reserved. Contributor(s): You may retrieve the latest version of this file at the JEDI.NET home page, located at http://sf.net/projects/jedidotnet Known Issues: ---------------------------------------------------------------------------------------------------} // $Id: Jedi.System.pas,v 1.1 2004/06/16 14:29:53 jedi_mbe Exp $ unit Jedi.System; interface {$REGION 'interface uses'} uses System.Collections, System.ComponentModel; {$ENDREGION} {$REGION 'Attributes'} type AttributeArray = array of Attribute; type AttributeUtils = class (System.Object) strict protected class function IndexOf(attrList: ArrayList; attr: System.Object): Integer; static; class function OverrideAttrList(attrList, overrideList: ArrayList; mustExist: Boolean): ArrayList; static; public class function OverrideAttributes(attributes, overrides, replacements: AttributeArray): AttributeArray; overload; static; class function OverrideAttributes(attributes: AttributeCollection; overrides, replacements: AttributeArray): AttributeCollection; overload; static; end; {$ENDREGION} implementation {$REGION 'AttributeUtils'} class function AttributeUtils.IndexOf(attrList: ArrayList; attr: System.Object): Integer; var attrType: System.Type; begin if attr is System.Type then attrType := System.Type(attr) else attrType := attr.GetType; Result := attrList.Count - 1; while (Result >= 0) and not attrType.IsAssignableFrom(attrList[Result].GetType) do Dec(Result); end; class function AttributeUtils.OverrideAttrList(attrList, overrideList: ArrayList; mustExist: Boolean): ArrayList; var i: Integer; attrIndex: Integer; begin Result := attrList; for i := 0 to overrideList.Count - 1 do begin attrIndex := AttributeUtils.IndexOf(Result, overrideList[i]); if attrIndex > -1 then Result[attrIndex] := overrideList[i] else if not mustExist then Result.Add(overrideList[i]); end; end; class function AttributeUtils.OverrideAttributes(attributes, overrides, replacements: AttributeArray): AttributeArray; var attrList: ArrayList; overrideList: ArrayList; replaceList: ArrayList; begin attrList := ArrayList.Create(System.Array(attributes)); if Assigned(overrides) then overrideList := ArrayList.Create(System.Array(overrides)) else overrideList := ArrayList.Create; if Assigned(replacements) then replaceList := ArrayList.Create(System.Array(replacements)) else replaceList := ArrayList.Create; Result := AttributeArray(OverrideAttrList(OverrideAttrList(attrList, replaceList, True), overrideList, False).ToArray(TypeOf(Attribute))); end; class function AttributeUtils.OverrideAttributes(attributes: AttributeCollection; overrides, replacements: AttributeArray): AttributeCollection; var attrList: ArrayList; overrideList: ArrayList; replaceList: ArrayList; begin attrList := ArrayList.Create(attributes); if Assigned(overrides) then overrideList := ArrayList.Create(System.Array(overrides)) else overrideList := ArrayList.Create; if Assigned(replacements) then replaceList := ArrayList.Create(System.Array(replacements)) else replaceList := ArrayList.Create; Result := AttributeCollection.Create(AttributeArray(OverrideAttrList(OverrideAttrList(attrList, replaceList, True), overrideList, False).ToArray(TypeOf(Attribute)))); end; {$ENDREGION} end. --- NEW FILE: Jedi.Drawing.pas --- {--------------------------------------------------------------------------------------------------- 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/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: Jedi.Drawing.pas, released on 2004-05-16. The Initial Developer of the Original Code is Marcel Bestebroer Portions created by Marcel Bestebroer are Copyright (C) 2004 Marcel Bestebroer All Rights Reserved. Contributor(s): You may retrieve the latest version of this file at the JEDI.NET home page, located at http://sf.net/projects/jedidotnet Known Issues: ---------------------------------------------------------------------------------------------------} // $Id: Jedi.Drawing.pas,v 1.1 2004/06/16 14:29:53 jedi_mbe Exp $ unit Jedi.Drawing; interface {$REGION 'interface uses'} uses System.Drawing; {$ENDREGION} {$REGION 'Color related'} type ColorUtils = class sealed (System.Object) public { Blends two colors. The resulting color will be a mix of the two colors. The percentage parameter determines how much of the second color will be present. } class function Blend(firstColor, secondColor: Color; percentage: Integer): Color; static; { Brightens a color. The resulting color will be a mix of the base color and pure white. The percentage parameter determines how much white will be present. } class function Brighten(baseColor: Color; percentage: Integer): Color; static; { Darkens a color. The resulting color will be a mix of the base color and pure black. The percentage parameter determines how much black will be present. } class function Darken(baseColor: Color; percentage: Integer): Color; static; end; {$ENDREGION} implementation {$REGION 'ColorUtils'} class function ColorUtils.Blend(firstColor, secondColor: Color; percentage: Integer): Color; begin Result := Color.FromArgb( firstColor.R + (secondColor.R - firstColor.R) * percentage div 100, firstColor.G + (secondColor.G - firstColor.G) * percentage div 100, firstColor.B + (secondColor.B - firstColor.B) * percentage div 100 ); end; class function ColorUtils.Brighten(baseColor: Color; percentage: Integer): Color; begin Result := ColorUtils.Blend(baseColor, Color.White, percentage); end; class function ColorUtils.Darken(baseColor: Color; percentage: Integer): Color; begin Result := ColorUtils.Blend(baseColor, Color.Black, percentage); end; {$ENDREGION} end. --- NEW FILE: Jedi.Windows.Forms.Hmi.Leds.pas --- {--------------------------------------------------------------------------------------------------- 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/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: Jedi.Windows.Forms.Hmi.Leds.pas, released on 2004-05-16. The Initial Developer of the Original Code is Marcel Bestebroer Portions created by Marcel Bestebroer are Copyright (C) 2004 Marcel Bestebroer All Rights Reserved. Contributor(s): You may retrieve the latest version of this file at the JEDI.NET home page, located at http://sf.net/projects/jedidotnet [...1494 lines suppressed...] i: Integer; begin if not ReferenceEquals(FLedStyle, value) then begin FLedStyle.Free; FLedStyle := value; Include(FLedStyle.SettingsChanged, Style_SettingsChanged); Include(FLedStyle.SizeChanged, Style_SizeChanged); Include(FLedStyle.StateAdded, Style_StateAdded); Include(FLedStyle.StateRemoved, Style_StateRemoved); for i := 0 to FInitializeCount - 1 do FLedStyle.BeginInit; if not IsInitializing and (FLedStateIdx >= FLedStyle.States.Count) then FLedStateIdx := FLedStyle.States.Count - 1; FLedStyle.InvalidateSize; end; end; {$ENDREGION} end. --- NEW FILE: Jedi.Collections.pas --- {--------------------------------------------------------------------------------------------------- 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/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: Jedi.Collections.pas, released on 2004-06-13. The Initial Developer of the Original Code is Marcel Bestebroer Portions created by Marcel Bestebroer are Copyright (C) 2004 Marcel Bestebroer All Rights Reserved. Contributor(s): You may retrieve the latest version of this file at the JEDI.NET home page, located at http://sf.net/projects/jedidotnet [...1121 lines suppressed...] end; function InlineDictionaryBase.GetItemDescription(key: System.Object): string; begin Result := ''; end; function InlineDictionaryBase.GetItemEmptyValue(key: System.Object): System.Object; begin Result := nil; end; function InlineDictionaryBase.GetItemProperty(key, value: System.Object): PropertyDescriptor; begin Result := InlineCollectionUtils.CreateItemProperty(value.GetType, AttributeArray.Create(), Self, key.ToString, GetItemDescription(key), key, GetItemEmptyValue(key)); end; {$ENDREGION} end. |