Changeset 829 for cprs/trunk/CPRS-Lib/ORFn.pas
- Timestamp:
- Jul 7, 2010, 4:31:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Lib/ORFn.pas
r456 r829 6 6 7 7 uses SysUtils, Windows, Messages, Classes, Controls, StdCtrls, ExtCtrls, ComCtrls, Forms, 8 Graphics, Menus, RichEdit ;8 Graphics, Menus, RichEdit, Buttons; 9 9 10 10 const … … 13 13 BOOLCHAR: array[Boolean] of Char = ('0', '1'); 14 14 UM_STATUSTEXT = (WM_USER + 302); // used to send update status msg to main form 15 COLOR_CREAM = $F0FBFF; 15 16 var 17 ScrollBarHeight: integer = 0; 16 18 17 19 type … … 66 68 function DelimCount(const Str, Delim: string): integer; 67 69 procedure QuickCopy(AFrom, ATo: TObject); 70 procedure QuickAdd(AFrom, ATo: TObject); 71 procedure FastAssign(source, destination: TStrings); 72 procedure FastAddStrings(source, destination: TStrings); 68 73 function ValidFileName(const InitialFileName: string): string; 69 74 … … 84 89 procedure ResizeFormToFont(AForm: TForm); 85 90 procedure ResizeAnchoredFormToFont( AForm: TForm); 91 procedure AdjustForWindowsXPStyleTitleBar(AForm: TForm); 86 92 function ResizeWidth( OldFont: TFont; NewFont: TFont; OldWidth: integer): integer; 87 93 function ResizeHeight( OldFont: TFont; NewFont: TFont; OldHeight: integer): integer; … … 96 102 function PopupComponent(Sender: TObject; PopupMenu: TPopupMenu): TComponent; 97 103 procedure ReformatMemoParagraph(AMemo: TCustomMemo); 98 function ReadOnlyColor: TColor; 104 105 function BlackColorScheme: Boolean; 106 function NormalColorScheme: Boolean; 107 function Get508CompliantColor(Color: TColor): TColor; 108 procedure UpdateColorsFor508Compliance(control: TControl; InputEditControl: boolean = FALSE); 109 procedure UpdateReadOnlyColorScheme(Control: TControl; ReadOnly: boolean); 99 110 100 111 { ListBox Grid functions } … … 116 127 function TabIsPressed : Boolean; 117 128 function ShiftTabIsPressed : Boolean; 129 function EnterIsPressed : Boolean; 118 130 119 131 implementation // --------------------------------------------------------------------------- 120 132 121 133 uses 122 ORCtrls, Grids, Chart, CheckLst ;134 ORCtrls, Grids, Chart, CheckLst, VAUtils; 123 135 124 136 const … … 606 618 function Piece(const S: string; Delim: char; PieceNum: Integer): string; 607 619 { returns the Nth piece (PieceNum) of a string delimited by Delim } 608 var 609 i: Integer; 610 Strt, Next: PChar; 611 begin 612 i := 1; 613 Strt := PChar(S); 614 Next := StrScan(Strt, Delim); 615 while (i < PieceNum) and (Next <> nil) do 616 begin 617 Inc(i); 618 Strt := Next + 1; 619 Next := StrScan(Strt, Delim); 620 end; 621 if Next = nil then Next := StrEnd(Strt); 622 if i < PieceNum then Result := '' else SetString(Result, Strt, Next - Strt); 620 begin 621 Result := VAUtils.Piece(S, Delim, PieceNum); 623 622 end; 624 623 625 624 function Pieces(const S: string; Delim: char; FirstNum, LastNum: Integer): string; 626 { returns several contiguous pieces } 627 var 628 PieceNum: Integer; 629 begin 630 Result := ''; 631 for PieceNum := FirstNum to LastNum do Result := Result + Piece(S, Delim, PieceNum) + Delim; 632 if Length(Result) > 0 then Delete(Result, Length(Result), 1); 625 begin 626 Result := VAUtils.Pieces(S, Delim, FirstNum, LastNum); 633 627 end; 634 628 … … 779 773 if obj is TListBox then 780 774 str[idx] := TListBox(obj).Items 775 else 776 if obj is TORComboBox then 777 str[idx] := TORComboBox(obj).Items 778 else 779 if obj is TComboBox then 780 str[idx] := TComboBox(obj).Items 781 781 else 782 782 if obj is TRichEdit then … … 815 815 if fix[0] then TRichEdit(AFrom).PlainText := FALSE; 816 816 if fix[1] then TRichEdit(ATo).PlainText := FALSE; 817 if ATo is TRichEdit then 818 TRichEdit(ATo).SelStart := Length(TRichEdit(ATo).Lines.Text); //CQ: 16461 819 end; 820 821 type 822 QuickAddError = class(Exception); 823 824 procedure QuickAdd(AFrom, ATo: TObject); 825 var 826 ms: TMemoryStream; 827 idx: integer; 828 str: array[0..1] of TStrings; 829 fix: array[0..1] of boolean; 830 831 procedure GetStrings(obj: TObject); 832 begin 833 if (CompareText(obj.ClassName, 'TRichEditStrings') = 0) then 834 raise QuickCopyError.Create('You must pass the TRichEdit object into QuickAdd, NOT it''s Lines property.'); 835 if obj is TStrings then 836 str[idx] := TStrings(obj) 837 else 838 if obj is TMemo then 839 str[idx] := TMemo(obj).Lines 840 else 841 if obj is TORListBox then 842 str[idx] := TORListBox(obj).Items 843 else 844 if obj is TListBox then 845 str[idx] := TListBox(obj).Items 846 else 847 if obj is TORComboBox then 848 str[idx] := TORComboBox(obj).Items 849 else 850 if obj is TComboBox then 851 str[idx] := TComboBox(obj).Items 852 else 853 if obj is TRichEdit then 854 begin 855 with TRichEdit(obj) do 856 begin 857 str[idx] := Lines; 858 if not PlainText then 859 begin 860 fix[idx] := TRUE; 861 PlainText := TRUE; 862 end; 863 end; 864 end 865 else 866 raise QuickAddError.Create('Unsupported object type (' + obj.ClassName + 867 ') passed into QuickAdd.'); 868 inc(idx); 869 end; 870 871 872 begin 873 fix[0] := FALSE; 874 fix[1] := FALSE; 875 idx := 0; 876 GetStrings(AFrom); 877 GetStrings(ATo); 878 ms := TMemoryStream.Create; 879 try 880 str[1].SaveToStream(ms); 881 ms.Seek(0, soFromEnd); 882 str[0].SaveToStream(ms); 883 ms.Seek(0, soFromBeginning); 884 str[1].Clear; 885 str[1].LoadFromStream(ms); 886 finally 887 ms.Free; 888 end; 889 if fix[0] then TRichEdit(AFrom).PlainText := FALSE; 890 if fix[1] then TRichEdit(ATo).PlainText := FALSE; 891 end; 892 893 procedure FastAssign(source, destination: TStrings); 894 // do not use this with RichEdit Lines unless source is RichEdit with PlainText 895 var 896 ms: TMemoryStream; 897 begin 898 destination.Clear; 899 if (source is TStringList) and (destination is TStringList) then 900 destination.Assign(source) 901 else 902 if (CompareText(source.ClassName, 'TRichEditStrings') = 0) then 903 destination.Assign(source) 904 else 905 begin 906 ms := TMemoryStream.Create; 907 try 908 source.SaveToStream(ms); 909 ms.Seek(0, soFromBeginning); 910 destination.LoadFromStream(ms); 911 finally 912 ms.Free; 913 end; 914 end; 915 end; 916 917 procedure FastAddStrings(source, destination: TStrings); 918 // do not use this with RichEdit Lines unless source and destination are RichEdit with PlainText 919 var 920 ms: TMemoryStream; 921 begin 922 if (source is TStringList) and (destination is TStringList) then 923 destination.AddStrings(source) 924 else 925 begin 926 ms := TMemoryStream.Create; 927 try 928 destination.SaveToStream(ms); 929 ms.Seek(0, soFromEnd); 930 source.SaveToStream(ms); 931 ms.Seek(0, soFromBeginning); 932 destination.Clear; 933 destination.LoadFromStream(ms); 934 finally 935 ms.Free; 936 end; 937 end; 817 938 end; 818 939 … … 861 982 end; {for i} 862 983 AList.Clear; 863 AList.Assign(NewList);984 FastAssign(NewList, AList); 864 985 finally 865 986 NewList.Free; … … 1248 1369 end; 1249 1370 1371 var 1372 AlignList, AnchorList: TStringList; 1373 1374 function AnchorsToStr(Control: TControl): string; 1375 var 1376 j: TAnchorKind; 1377 1378 begin 1379 Result := ''; 1380 for j := low(TAnchorKind) to high(TAnchorKind) do 1381 if j in Control.Anchors then 1382 Result := result + '1' 1383 else 1384 Result := result + '0' 1385 end; 1386 1387 function StrToAnchors(i: integer): TAnchors; 1388 var 1389 j: TAnchorKind; 1390 value: string; 1391 idx : integer; 1392 begin 1393 Result := []; 1394 value := AnchorList[i]; 1395 idx := 1; 1396 for j := low(TAnchorKind) to high(TAnchorKind) do 1397 begin 1398 if copy(value,idx,1) = '1' then 1399 include(Result, j); 1400 inc(idx); 1401 end; 1402 end; 1403 1404 procedure SuspendAlign(AForm: TForm); 1405 var 1406 i: integer; 1407 control: TControl; 1408 begin 1409 AForm.DisableAlign; 1410 AlignList.Clear; 1411 AnchorList.Clear; 1412 for i := 0 to AForm.ControlCount-1 do 1413 begin 1414 control := AForm.Controls[i]; 1415 AlignList.Add(IntToStr(ord(control.align))); 1416 control.Align := alNone; 1417 AnchorList.Add(AnchorsToStr(control)); 1418 control.Anchors := []; 1419 end; 1420 end; 1421 1422 procedure RestoreAlign(AForm: TForm); 1423 var 1424 i: integer; 1425 control: TControl; 1426 begin 1427 try 1428 for i := 0 to AForm.ControlCount-1 do 1429 begin 1430 control := AForm.Controls[i]; 1431 control.Align := TAlign(StrToIntDef(AlignList[i],0)); 1432 control.Anchors := StrToAnchors(i); 1433 end; 1434 AlignList.Clear; 1435 AnchorList.Clear; 1436 finally 1437 AForm.EnableAlign; 1438 end; 1439 end; 1440 1250 1441 procedure ResizeFormToFont(AForm: TForm); 1251 1442 var 1252 1443 Rect: TRect; 1253 begin 1444 OldResize: TNotifyEvent; 1445 begin 1446 // CQ# 11481 apply size changes to form all at once, instead of piece by piece. Otherwise, 1447 // multiple calls to fAutoSz.FormResize, even if the form has not resized, can distort 1448 // the controls beyond the size of the form. 1254 1449 with AForm do begin 1255 ClientWidth := ResizeWidth( Font, MainFont, ClientWidth); 1256 ClientHeight := ResizeHeight( Font, MainFont, ClientHeight); 1257 HorzScrollBar.Range := ResizeWidth( Font, MainFont, HorzScrollBar.Range); 1258 VertScrollBar.Range := ResizeHeight( Font, MainFont, VertScrollBar.Range); 1259 Rect := BoundsRect; 1260 ForceInsideWorkArea(Rect); 1261 BoundsRect := Rect; 1262 ResizeFontsInDescendants( Font, MainFont, AForm); 1263 //Important: We are using the font to calculate everything, so don't 1264 //change font until now. 1265 Font.Size := MainFont.Size; 1450 OldResize := AForm.OnResize; 1451 AForm.OnResize := nil; 1452 try 1453 SuspendAlign(AForm); 1454 try 1455 HorzScrollBar.Range := ResizeWidth( Font, MainFont, HorzScrollBar.Range); 1456 VertScrollBar.Range := ResizeHeight( Font, MainFont, VertScrollBar.Range); 1457 ClientWidth := ResizeWidth( Font, MainFont, ClientWidth); 1458 ClientHeight := ResizeHeight( Font, MainFont, ClientHeight); 1459 Rect := BoundsRect; 1460 ForceInsideWorkArea(Rect); 1461 BoundsRect := Rect; 1462 finally 1463 RestoreAlign(AForm); 1464 end; 1465 ResizeFontsInDescendants( Font, MainFont, AForm); 1466 //Important: We are using the font to calculate everything, so don't 1467 //change font until now. 1468 Font.Size := MainFont.Size; 1469 finally 1470 if(Assigned(OldResize)) then 1471 begin 1472 AForm.OnResize := OldResize; 1473 OldResize(AForm); 1474 end; 1475 end; 1266 1476 end; 1267 1477 end; … … 1270 1480 var 1271 1481 Rect: TRect; 1482 OldResize: TNotifyEvent; 1483 1272 1484 begin 1273 1485 with AForm do begin 1274 ClientWidth := ResizeWidth( Font, MainFont, ClientWidth); 1275 ClientHeight := ResizeHeight( Font, MainFont, ClientHeight); 1276 HorzScrollBar.Range := ResizeWidth( Font, MainFont, HorzScrollBar.Range); 1277 VertScrollBar.Range := ResizeHeight( Font, MainFont, VertScrollBar.Range); 1278 Rect := BoundsRect; 1279 ForceInsideWorkArea(Rect); 1280 BoundsRect := Rect; 1281 ResizeDescendants( Font, MainFont, AForm); 1282 ResizeFontsInDescendants( Font, MainFont, AForm); 1283 //Important: We are using the font to calculate everything, so don't 1284 //change font until now. 1285 Font.Size := MainFont.Size; 1486 // CQ# 11481 - see ResizeFormToFont 1487 OldResize := AForm.OnResize; 1488 AForm.OnResize := nil; 1489 try 1490 HorzScrollBar.Range := ResizeWidth( Font, MainFont, HorzScrollBar.Range); 1491 VertScrollBar.Range := ResizeHeight( Font, MainFont, VertScrollBar.Range); 1492 ClientWidth := ResizeWidth( Font, MainFont, ClientWidth); 1493 ClientHeight := ResizeHeight( Font, MainFont, ClientHeight); 1494 Rect := BoundsRect; 1495 ForceInsideWorkArea(Rect); 1496 BoundsRect := Rect; 1497 ResizeDescendants( Font, MainFont, AForm); 1498 ResizeFontsInDescendants( Font, MainFont, AForm); 1499 //Important: We are using the font to calculate everything, so don't 1500 //change font until now. 1501 Font.Size := MainFont.Size; 1502 finally 1503 if(Assigned(OldResize)) then 1504 begin 1505 AForm.OnResize := OldResize; 1506 OldResize(AForm); 1507 end; 1508 end; 1509 end; 1510 end; 1511 1512 // CQ 11485 - Adjusts all forms - adds additional height to the form to 1513 // adjust for Windows XP style title bars, and for large fonts in title bar 1514 procedure AdjustForWindowsXPStyleTitleBar(AForm: TForm); 1515 const 1516 DEFAULT_CAPTION_HEIGHT = 19; 1517 DEFAULT_MENU_HEIGHT = 19; 1518 1519 var 1520 dxsb, dysb, dy, menuDY: integer; 1521 1522 begin 1523 // Call GetSystemMetrics each time because values can change between calls 1524 dy := GetSystemMetrics(SM_CYCAPTION) - DEFAULT_CAPTION_HEIGHT; 1525 if (AForm.Menu <> nil) then 1526 begin 1527 menuDY := GetSystemMetrics(SM_CYMENU) - DEFAULT_MENU_HEIGHT; 1528 inc(dy, menuDY); 1529 end; 1530 if dy <> 0 then 1531 begin 1532 SuspendAlign(AForm); 1533 try 1534 // Assitional adjustment to allow scroll bars to dissappear 1535 dxsb := GetSystemMetrics(SM_CXVSCROLL); 1536 dysb := GetSystemMetrics(SM_CYHSCROLL); 1537 AForm.Height := AForm.Height + dy + dysb; 1538 AForm.Width := AForm.Width + dxsb; 1539 AForm.Height := AForm.Height - dysb; 1540 AForm.Width := AForm.Width - dxsb; 1541 finally 1542 RestoreAlign(AForm); 1543 end; 1286 1544 end; 1287 1545 end; … … 1329 1587 begin 1330 1588 DC := GetDC(0); 1331 SaveFont := SelectObject(DC, AFontHandle); 1332 GetTextExtentPoint32(DC, PChar(x), Length(x), TextSize); 1333 Result := TextSize.cx; 1334 SelectObject(DC, SaveFont); 1335 ReleaseDC(0, DC); 1589 try 1590 SaveFont := SelectObject(DC, AFontHandle); 1591 try 1592 GetTextExtentPoint32(DC, PChar(x), Length(x), TextSize); 1593 Result := TextSize.cx; 1594 finally 1595 SelectObject(DC, SaveFont); 1596 end; 1597 finally 1598 ReleaseDC(0, DC); 1599 end; 1336 1600 end; 1337 1601 … … 1344 1608 begin 1345 1609 DC := GetDC(0); 1346 SaveFont := SelectObject(DC, AFontHandle); 1347 GetTextExtentPoint32(DC, PChar(x), Length(x), TextSize); 1348 Result := TextSize.cy; 1349 SelectObject(DC, SaveFont); 1350 ReleaseDC(0, DC); 1610 try 1611 SaveFont := SelectObject(DC, AFontHandle); 1612 try 1613 GetTextExtentPoint32(DC, PChar(x), Length(x), TextSize); 1614 Result := TextSize.cy; 1615 finally 1616 SelectObject(DC, SaveFont); 1617 end; 1618 finally 1619 ReleaseDC(0, DC); 1620 end; 1621 if Result > 255 then // CQ 11493 1622 Result := 255; // This is maximum allowed by a Windows 1351 1623 end; 1352 1624 … … 1393 1665 end; 1394 1666 end; 1667 if Result > 255 then // CQ 11492 1668 Result := 255; // This is maximum allowed by a Windows 1395 1669 end; 1396 1670 … … 1471 1745 1472 1746 var 1473 uReadOnlyColor: TColor; 1474 uHaveReadOnlyColor: boolean = FALSE; 1475 1476 function ReadOnlyColor: TColor; 1477 begin 1478 if not uHaveReadOnlyColor then 1479 begin 1480 uHaveReadOnlyColor := TRUE; 1481 if ColorToRGB(clWindow) = ColorToRGB(clWhite) then 1482 uReadOnlyColor := $00F0FBFF 1747 uNormalColorScheme: boolean = false; 1748 uBlackColorScheme: boolean = false; 1749 uWhiteColorScheme: boolean = false; 1750 uMaroonColorWhenBlack: TColor = clMaroon; 1751 uCheckColorScheme: boolean = true; 1752 PURE_BLACK: longint = 0; 1753 1754 const 1755 uBorderlessWindowColorWhenBlack: TColor = clNavy; 1756 1757 1758 procedure CheckColorScheme; 1759 begin 1760 if uCheckColorScheme then 1761 begin 1762 uNormalColorScheme := 1763 ((ColorToRGB(clWindow) = ColorToRGB(clWhite)) and 1764 (ColorToRGB(clWindowText) = ColorToRGB(clBlack)) and 1765 (ColorToRGB(clInfoText) = ColorToRGB(clBlack)) and 1766 (ColorToRGB(clInfoBk) <> ColorToRGB(clWhite))); 1767 1768 uBlackColorScheme := ((ColorToRGB(clBtnFace) = ColorToRGB(clBlack)) and 1769 (ColorToRGB(clWindow) = ColorToRGB(clBlack))); 1770 uWhiteColorScheme := ((ColorToRGB(clBtnFace) = ColorToRGB(clWhite)) and 1771 (ColorToRGB(clWindow) = ColorToRGB(clWhite))); 1772 1773 if uBlackColorScheme then 1774 begin 1775 if(ColorToRGB(clGrayText) = ColorToRGB(clWindowText)) then 1776 uMaroonColorWhenBlack := clHighlightText 1777 else 1778 uMaroonColorWhenBlack := clGrayText; 1779 end; 1780 1781 uCheckColorScheme := FALSE; 1782 end; 1783 end; 1784 1785 function BlackColorScheme: Boolean; 1786 begin 1787 if uCheckColorScheme then CheckColorScheme; 1788 Result := uBlackColorScheme; 1789 end; 1790 1791 function NormalColorScheme: Boolean; 1792 begin 1793 if uCheckColorScheme then CheckColorScheme; 1794 Result := uNormalColorScheme; 1795 end; 1796 1797 function Get508CompliantColor(Color: TColor): TColor; 1798 begin 1799 Result := Color; 1800 if NormalColorScheme then exit; 1801 1802 case Color of 1803 clCream: Result := clInfoBk; 1804 clBlack: Result := clWindowText; 1805 clWhite: Result := clWindow; 1806 end; 1807 1808 if uBlackColorScheme then 1809 begin 1810 case Color of 1811 clBlue: Result := clAqua; 1812 clMaroon: Result := uMaroonColorWhenBlack; 1813 // clRed: Result := clFuchsia; 1814 end; 1815 end; 1816 1817 if uWhiteColorScheme then 1818 begin 1819 case Color of 1820 clGrayText: Result := clGray; 1821 end; 1822 end; 1823 end; 1824 1825 type 1826 TExposedControl = class(TControl) 1827 public 1828 property Color; 1829 property Font; 1830 end; 1831 1832 TExposedCustomEdit = class(TCustomEdit) 1833 public 1834 property BorderStyle; 1835 property ReadOnly; 1836 end; 1837 1838 procedure UpdateColorsFor508Compliance(control: TControl; InputEditControl: boolean = FALSE); 1839 var 1840 BitMapLevelCheck: integer; 1841 Level: integer; 1842 1843 1844 procedure BlackColorSchemeUpdate(control: TControl); 1845 var 1846 bitmap: TBitMap; 1847 edit: TExposedCustomEdit; 1848 x,y: integer; 1849 cbmCtrl: IORBlackColorModeCompatible; 1850 1851 begin 1852 if uBlackColorScheme then 1853 begin 1854 if Level < BitMapLevelCheck then 1855 begin 1856 if control.GetInterface(IORBlackColorModeCompatible, cbmCtrl) then 1857 begin 1858 cbmCtrl.SetBlackColorMode(TRUE); 1859 BitMapLevelCheck := Level; 1860 cbmCtrl := nil; 1861 end 1862 else 1863 begin 1864 if (control is TBitBtn) then 1865 begin 1866 bitmap := TBitBtn(control).Glyph; 1867 for x := 0 to bitmap.Width-1 do 1868 begin 1869 for y := 0 to bitmap.Height-1 do 1870 begin 1871 if ColorToRGB(bitmap.Canvas.Pixels[x,y]) = PURE_BLACK then 1872 bitmap.Canvas.Pixels[x,y] := clWindowText; 1873 end; 1874 end; 1875 end; 1876 end; 1877 end; 1878 1879 if (control is TCustomEdit) and InputEditControl then 1880 begin 1881 edit := TExposedCustomEdit(control); 1882 if (edit.BorderStyle = bsNone) then 1883 edit.Color := uBorderlessWindowColorWhenBlack; 1884 end; 1885 1886 end; 1887 end; 1888 1889 procedure ComponentUpdateColorsFor508Compliance(control: TControl); 1890 var 1891 OldComponentColor, OldFontColor, NewComponentColor, NewFontColor: TColor; 1892 begin 1893 OldComponentColor := TExposedControl(control).Color; 1894 OldFontColor := TExposedControl(control).Font.Color; 1895 NewComponentColor := Get508CompliantColor(OldComponentColor); 1896 if NewComponentColor = clInfoBk then 1897 begin 1898 if (OldFontColor = clInfoBk) or (OldFontColor = clCream) then 1899 NewFontColor := clInfoBk // used for hiding text 1900 else 1901 NewFontColor := clInfoText; 1902 end 1483 1903 else 1484 uReadOnlyColor := clWindow; 1485 end; 1486 Result := uReadOnlyColor; 1904 NewFontColor := Get508CompliantColor(OldFontColor); 1905 if NewComponentColor <> OldComponentColor then 1906 TExposedControl(control).Color := NewComponentColor; 1907 if NewFontColor <> OldFontColor then 1908 TExposedControl(control).Font.Color := NewFontColor; 1909 BlackColorSchemeUpdate(control); 1910 end; 1911 1912 procedure ScanAllComponents(control: TControl); 1913 var 1914 i: integer; 1915 1916 begin 1917 ComponentUpdateColorsFor508Compliance(Control); 1918 if control is TWinControl then 1919 begin 1920 inc(Level); 1921 try 1922 for i := 0 to TWinControl(Control).ControlCount-1 do 1923 begin 1924 ScanAllComponents(TWinControl(Control).Controls[i]); 1925 end; 1926 finally 1927 dec(Level); 1928 if BitMapLevelCheck = Level then 1929 BitMapLevelCheck := MaxInt; 1930 end; 1931 end; 1932 end; 1933 1934 begin 1935 if NormalColorScheme then exit; 1936 BitMapLevelCheck := MaxInt; 1937 Level := 0; 1938 ScanAllComponents(control); 1939 end; 1940 1941 procedure UpdateReadOnlyColorScheme(Control: TControl; ReadOnly: boolean); 1942 begin 1943 with TExposedControl(Control) do 1944 begin 1945 if ReadOnly then 1946 begin 1947 Color := Get508CompliantColor(clCream); 1948 Font.Color := clInfoText; 1949 end 1950 else 1951 begin 1952 Color := clWindow; 1953 Font.Color := clWindowText; 1954 end; 1955 end; 1487 1956 end; 1488 1957 … … 1521 1990 end; 1522 1991 Canvas.FillRect(ARect); 1523 Canvas.Pen.Color := clSilver;1992 Canvas.Pen.Color := Get508CompliantColor(clSilver); 1524 1993 Canvas.MoveTo(ARect.Left, ARect.Bottom - 1); 1525 1994 Canvas.LineTo(ARect.Right, ARect.Bottom - 1); … … 1714 2183 begin 1715 2184 Result := Boolean(Hi(GetKeyState(VK_TAB))) and not Boolean(Hi(GetKeyState(VK_SHIFT))); 2185 Result := Result and not Boolean(Hi(GetKeyState(VK_CONTROL))); 1716 2186 end; 1717 2187 … … 1719 2189 begin 1720 2190 Result := Boolean(Hi(GetKeyState(VK_TAB))) and Boolean(Hi(GetKeyState(VK_SHIFT))); 1721 end; 1722 2191 Result := Result and not Boolean(Hi(GetKeyState(VK_CONTROL))); 2192 end; 2193 2194 function EnterIsPressed : Boolean; 2195 begin 2196 Result := Boolean(Hi(GetKeyState(VK_RETURN))); 2197 end; 1723 2198 1724 2199 initialization … … 1726 2201 FBaseFont.Name := BaseFontName; 1727 2202 FBaseFont.Size := BaseFontSize; 2203 ScrollBarHeight := GetSystemMetrics(SM_CYHSCROLL); 2204 AlignList := TStringList.Create; 2205 AnchorList := TStringList.Create; 2206 PURE_BLACK := ColorToRGB(clBlack); 1728 2207 1729 2208 finalization 1730 2209 FBaseFont.Free; 1731 2210 KillObj(@IdleCaller); 2211 FreeAndNil(AlignList); 2212 FreeAndNil(AnchorList); 1732 2213 1733 2214 end.
Note:
See TracChangeset
for help on using the changeset viewer.