You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RnQ/RnQ/Prefs/design_fr.pas

643 lines
19 KiB
Plaintext

{
This file is part of R&Q.
Under same license
}
unit design_fr;
{$I RnQConfig.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
ActiveX, StdCtrls, ExtCtrls, ComCtrls, RDGlobal, RnQPrefsLib, RnQSpin, VirtualTrees;
{$I NoRTTI.inc}
type
TdesignFr = class(TPrefFrame)
plBg: TPanel;
PageCtrl: TPageControl;
CommonTab: TTabSheet;
textureChk: TCheckBox;
GrBox2: TGroupBox;
Label20: TLabel;
Label22: TLabel;
blinkSlider: TTrackBar;
Label21: TLabel;
BlinkPBox: TPaintBox;
ChkMenuHeight: TCheckBox;
ShXstInMnuChk: TCheckBox;
BlnsShowChk: TCheckBox;
RstrSheet: TTabSheet;
indentChk: TCheckBox;
sortbyGrp: TRadioGroup;
TabSheet2: TTabSheet;
dockGrp: TRadioGroup;
italicGrp: TRadioGroup;
roasterbarGrp: TRadioGroup;
autosizeGrp: TRadioGroup;
TtlGrBox: TGroupBox;
roastertitleBox: TLabeledEdit;
hideoncloseChk00: TRadioButton;
TabSheet3: TTabSheet;
transpGr: TGroupBox;
Label14: TLabel;
Label15: TLabel;
Label1: TLabel;
Label2: TLabel;
roastertranspChk: TCheckBox;
chattranspChk: TCheckBox;
transpActive: TTrackBar;
transpInactive: TTrackBar;
avtTS: TTabSheet;
AvtShwChtChk: TCheckBox;
AvtShwHntChk: TCheckBox;
AvtShwTraChk: TCheckBox;
ChkExtStsMainMenu: TCheckBox;
filterbarGrp: TRadioGroup;
BlinkStsChk: TCheckBox;
ShowBrdrChk: TCheckBox;
EyeLevChk: TCheckBox;
AvtMaxSzChk: TCheckBox;
AvtMaxSzSpin: TRnQSpinEdit;
IconsGrp: TGroupBox;
RnQSpinButton1: TRnQSpinButton;
IconsList: TVirtualDrawTree;
aniroasterChk: TCheckBox;
SingleClickChk: TCheckBox;
Dock2ChatChk: TCheckBox;
Label3: TLabel;
groupsChk: TCheckBox;
onlyvisibletoChk: TCheckBox;
onlyonlineChk: TCheckBox;
UINDelimChk: TCheckBox;
CntThmChk: TCheckBox;
ontop1: TCheckBox;
showcontacttipChk: TCheckBox;
LangCBox: TComboBox;
LangLbl: TLabel;
unAuthShowChk: TCheckBox;
AutoSzUpChk: TCheckBox;
snapToEdges: TCheckBox;
ChkNewExtSts: TCheckBox;
AvtShwTaskBar: TCheckBox;
procedure transpChange(Sender: TObject);
procedure transpExit(Sender: TObject);
procedure IconsListDrawNode(Sender: TBaseVirtualTree; const PaintInfo: TVTPaintInfo);
procedure IconsListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure BlinkPBoxPaint(Sender: TObject);
procedure IconsListDragOver(Sender: TBaseVirtualTree; Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint;
Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
procedure IconsListDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
private
{ Private declarations }
procedure fillIconsGrid();
function ApplyIconsGrid: Boolean;
procedure ResetIconsGrid;
public
procedure initPage; Override; final;
procedure applyPage; Override; final;
procedure resetPage; Override; final;
{ Public declarations }
procedure resetAutosize;
procedure prefToggleShowGroups;
procedure prefToggleOnlyOnline;
end;
implementation
uses
utilLib, RQThemes, themesLib, mainDlg, RnQLangs, RnQGlobal,
roasterLib, globalLib, chatDlg,
RnQGraphics32, RnQPics
// ICQContacts
;
{$R *.dfm}
type
PIcItem = ^TIcItem;
TIcItem = TRnQCLIcons;
// TIcItem = record
// s : array[0..1] of string;
// end;
// TIcItem = string;
const
sb2index: array [TsortBy] of Integer = (0, 1, 2, 3);
procedure TdesignFr.transpChange(Sender: TObject);
begin
with (Sender as TTrackBar) do
if focused then
applyTransparency(position)
end;
procedure TdesignFr.transpExit(Sender: TObject);
begin
applyTransparency()
end;
procedure TdesignFr.resetAutosize();
begin
// if prefPages[thisPrefIdx].frame <> NIL then
// with TdesignFr(prefPages[thisPrefIdx].frame) do
if not autosizeRoster then
autosizeGrp.ItemIndex := 0
else if not autosizeFullRoster then
autosizeGrp.ItemIndex := 1
else
autosizeGrp.ItemIndex := 2;
end; // resetAutosize
procedure TdesignFr.prefToggleShowGroups;
begin
// if prefPages[thisPrefIdx].frame <> NIL then
// with TdesignFr(prefPages[thisPrefIdx].frame) do
groupsChk.checked := showGroups;
end;
procedure TdesignFr.prefToggleOnlyOnline;
begin
// if prefPages[thisPrefIdx].frame <> NIL then
// with TdesignFr(prefPages[thisPrefIdx].frame) do
onlyonlineChk.checked := showOnlyOnline;
end;
procedure TdesignFr.fillIconsGrid();
var
// i:integer;
ico: TRnQCLIconsSet;
icIt: TRnQCLIcons;
IcItem: PIcItem;
n: PVirtualNode;
begin
IconsList.Clear;
// if prefPages[thisPrefIdx].frame = NIL then exit;
IconsList.BeginUpdate;
// for i:= Low(RnQCLIcons) to High(RnQCLIcons) do
// for icIt in RnQCLIcons do
for ico in SHOW_ICONS_ORDER do
begin
icIt := RnQCLIcons[ico];
n := IconsList.AddChild(nil);
IcItem := IconsList.GetNodeData(n);
IcItem.IDX := icIt.IDX;
IcItem.Name := gettranslation(icIt.Name);
IcItem.IconName := icIt.IconName;
if icIt.IDX = CNT_TEXT then
begin
n.CheckType := ctNone;
n.CheckState := csCheckedNormal;
// Include(n.States, vsDisabled);
end
else
begin
n.CheckType := ctCheckBox;
n.CheckState := csCheckedNormal;
end;
end;
IconsList.EndUpdate;
end; // fillIconsGrid
Function TdesignFr.ApplyIconsGrid: Boolean;
var
IcItem: PIcItem;
n: PVirtualNode;
b: Boolean;
begin
Result := False;
n := IconsList.GetFirst;
while n <> NIL do
begin
IcItem := IconsList.GetNodeData(n);
if (SHOW_ICONS_ORDER[n.Index] <> IcItem.IDX) then
begin
Result := True;
SHOW_ICONS_ORDER[n.Index] := IcItem.IDX;
end;
if IcItem.IDX <> CNT_TEXT then
begin
b := (n.CheckState = csCheckedNormal);
if (TO_SHOW_ICON[IcItem.IDX] <> b) then
begin
Result := True;
TO_SHOW_ICON[IcItem.IDX] := b;
end;
end;
n := IconsList.GetNext(n);
end;
end; // ApplyIconsGrid
procedure TdesignFr.ResetIconsGrid;
const
// csBool : array[false..true] of TCheckState = (csCheckedNormal, csUncheckedNormal);
csBool: array [Boolean] of TCheckState = (csUncheckedNormal, csCheckedNormal);
var
// i:integer;
IcItem: PIcItem;
n: PVirtualNode;
begin
n := IconsList.GetFirst;
IconsList.BeginUpdate;
while n <> NIL do
begin
IcItem := IconsList.GetNodeData(n);
if IcItem.IDX <> CNT_TEXT then
n.CheckState := csBool[TO_SHOW_ICON[IcItem.IDX]];
n := IconsList.GetNext(n);
end;
IconsList.EndUpdate;
end; // ResetIconsGrid
procedure TdesignFr.initPage;
begin
with theme.GetPicSize(RQteDefault, PIC_MSG, 10) do
begin
// blinkImg.Picture.Bitmap.SetSize(cy, cx);
// theme.drawPic(blinkImg.picture.Bitmap.Canvas.Handle, 0,0,PIC_MSG);
BlinkPBox.Width := cx;
BlinkPBox.Height := cy;
end;
{$IFDEF RNQ_FULL}
{$ELSE}
ShXstChk.visible := False;
{$ENDIF}
// GrBox2.width:= CommonTab.Clientwidth - GAP_SIZE2;
sortbyGrp.Width := CommonTab.Clientwidth - GAP_SIZE2;
IconsGrp.Width := sortbyGrp.Width;
autosizeGrp.left := GAP_SIZE;
autosizeGrp.Width := 190;
// dockGrp.left:= autosizeGrp.left + autosizeGrp.width + GAP_SIZE;
dockGrp.Width := 190;
dockGrp.left := sortbyGrp.Width - dockGrp.Width + GAP_SIZE;
italicGrp.top := autosizeGrp.top + autosizeGrp.Height + GAP_SIZE;
italicGrp.left := autosizeGrp.left;
italicGrp.Width := autosizeGrp.Width;
roasterbarGrp.top := italicGrp.top;
roasterbarGrp.left := dockGrp.left;
roasterbarGrp.Width := dockGrp.Width div 2 - 2;
filterbarGrp.top := italicGrp.top;
filterbarGrp.left := roasterbarGrp.left + roasterbarGrp.Width + 4;
filterbarGrp.Width := roasterbarGrp.Width;
TtlGrBox.top := italicGrp.top + italicGrp.Height + GAP_SIZE;
TtlGrBox.left := italicGrp.left;
TtlGrBox.Width := sortbyGrp.Width;
transpGr.top := GAP_SIZE;
transpGr.left := GAP_SIZE;
transpGr.Width := sortbyGrp.Width;
IconsList.NodeDataSize := SizeOf(TIcItem);
fillIconsGrid;
// <20><> <20><> <20><> <20><>
// EnumSystemCodePages(
end;
procedure TdesignFr.applyPage;
function index2sb(i: Integer): TsortBy;
begin
Result := low(TsortBy);
while Result <= high(TsortBy) do
if i = sb2index[Result] then
exit
else
inc(Result);
Result := SB_EVENT;
end; // index2sb
var
needApplyTransp, needRebuildCL, needRepaintCL, needUpdCapt: Boolean;
begin
needApplyTransp := False;
needRebuildCL := False;
needRepaintCL := False;
rosterbarOnTop := roasterbarGrp.ItemIndex = 0;
filterBarOnTop := filterbarGrp.ItemIndex = 0;
animatedRoster := aniroasterChk.checked;
{$IFDEF RNQ_FULL}
// showXStatus := ShXstChk.Checked;
showXStatusMnu := ShXstInMnuChk.checked;
{$ENDIF}
needRepaintCL := ApplyIconsGrid or needRepaintCL;
if RnQmain.bar.visible <> (roasterbarGrp.ItemIndex <> 2) then
begin
// needRebuildCL := True;
RnQmain.bar.visible := not RnQmain.bar.visible;
end;
if RnQmain.FilterBar.visible <> (filterbarGrp.ItemIndex <> 2) then
begin
// needRebuildCL := True;
RnQmain.FilterBar.visible := not RnQmain.FilterBar.visible;
end;
if sortBy <> index2sb(sortbyGrp.ItemIndex) then
begin
needRebuildCL := True;
sortBy := index2sb(sortbyGrp.ItemIndex);
end;
needRepaintCL := needRepaintCL or (ShowUINDelimiter <> UINDelimChk.checked) or (rosterItalic <> italicGrp.ItemIndex) or
(showVisAndLevelling <> EyeLevChk.checked) or (UseContactThemes <> CntThmChk.checked) or
(XStatusAsMain <> ChkExtStsMainMenu.checked) or (indentRoster <> indentChk.checked);
needRebuildCL := needRebuildCL or (showOnlyOnline <> onlyonlineChk.checked) or (showOnlyImVisibleTo <> onlyvisibletoChk.checked)
or (showGroups <> groupsChk.checked) or (showUnkAsOffline <> unAuthShowChk.checked);
needUpdCapt := ShowUINDelimiter <> UINDelimChk.checked;
ShowUINDelimiter := UINDelimChk.checked;
rosterItalic := italicGrp.ItemIndex;
showVisAndLevelling := EyeLevChk.checked;
// UseContactThemes := CntThmChk.Checked;
SetContactsThemeUse(CntThmChk.checked);
showOnlyOnline := onlyonlineChk.checked;
showOnlyImVisibleTo := onlyvisibletoChk.checked;
showUnkAsOffline := unAuthShowChk.checked;
XStatusAsMain := ChkExtStsMainMenu.checked;
showNewXStatuses := ChkNewExtSts.checked;
showGroups := groupsChk.checked;
indentRoster := indentChk.checked;
needUpdCapt := needUpdCapt or (rosterTitle <> roastertitleBox.Text);
rosterTitle := roastertitleBox.Text;
blinkSpeed := blinkSlider.position;
RnQmain.roster.ShowHint := showcontacttipChk.checked;
texturizedWindows := textureChk.checked;
case autosizeGrp.ItemIndex of
0:
autosizeRoster := False;
1:
begin
autosizeRoster := True;
autosizeFullRoster := False;
end;
2:
begin
autosizeRoster := True;
autosizeFullRoster := True;
end;
end;
autosizeUp := AutoSzUpChk.checked;
snapToScreenEdges := snapToEdges.checked;
applySnap();
if showMainBorder <> ShowBrdrChk.checked then
begin
showMainBorder := ShowBrdrChk.checked;
toggleMainfrmBorder(True, showMainBorder);
end;
alwaysOnTop := ontop1.checked;
useSingleClickTray := SingleClickChk.checked;
needApplyTransp := needApplyTransp or (transparency.forRoster <> roastertranspChk.checked) or
(transparency.forChat <> chattranspChk.checked) or (transparency.active <> transpActive.position) or
(transparency.inactive <> transpInactive.position);
transparency.forRoster := roastertranspChk.checked;
transparency.forChat := chattranspChk.checked;
transparency.active := transpActive.position;
transparency.inactive := transpInactive.position;
MenuHeightPerm := ChkMenuHeight.checked;
// MenuDrawExt := ChkExtDrawMenu.Checked;
blinkWithStatus := BlinkStsChk.checked;
showBalloons := BlnsShowChk.checked;
avatarShowInChat := AvtShwChtChk.checked;
avatarShowInHint := AvtShwHntChk.checked;
avatarShowInTray := AvtShwTraChk.checked;
avatarShowInTaskBar := AvtShwTaskBar.checked;
TipsMaxAvtSizeUse := AvtMaxSzChk.checked;
TipsMaxAvtSize := AvtMaxSzSpin.AsInteger;
docking.enabled := dockGrp.ItemIndex > 0;
docking.appBar := dockGrp.ItemIndex = 2;
dockSet;
docking.Dock2Chat := Dock2ChatChk.checked;
applyDocking;
if needApplyTransp then
applyTransparency;
if needUpdCapt then
RnQmain.updateCaption;
setRosterAnimation(animatedRoster);
RnQmain.formresize(self);
if needRebuildCL then
rosterRebuildDelayed := True
else if needRepaintCL then
rosterRepaintDelayed := True;
if Assigned(chatFrm) then
chatFrm.RefreshTaskbarButtons;
end;
procedure TdesignFr.BlinkPBoxPaint(Sender: TObject);
begin
theme.drawPic(TPaintBox(Sender).Canvas.Handle, 0, 0, PIC_MSG);
// theme.drawPic(blinkImg.picture.Bitmap.Canvas.Handle, 0,0,PIC_MSG);
end;
procedure TdesignFr.resetPage;
begin
resetAutosize();
AutoSzUpChk.checked := autosizeUp;
snapToEdges.checked := snapToScreenEdges;
{ onlycloseChk.checked:=TRUE;
hideoncloseChk.Checked:=True;//hideOnClose;
closeandminChk.checked:=showRosterMinButton;
roundwindowsChk.Checked:=roundedWindows; }
roastertitleBox.Text := rosterTitle;
if not RnQmain.bar.visible then
roasterbarGrp.ItemIndex := 2
else if rosterbarOnTop then
roasterbarGrp.ItemIndex := 0
else
roasterbarGrp.ItemIndex := 1;
if not RnQmain.FilterBar.visible then
filterbarGrp.ItemIndex := 2
else if filterBarOnTop then
filterbarGrp.ItemIndex := 0
else
filterbarGrp.ItemIndex := 1;
showcontacttipChk.checked := RnQmain.roster.ShowHint;
aniroasterChk.checked := animatedRoster;
UINDelimChk.checked := ShowUINDelimiter;
italicGrp.ItemIndex := rosterItalic;
{$IFDEF RNQ_FULL}
ShXstInMnuChk.checked := showXStatusMnu;
{$ENDIF}
ResetIconsGrid;
EyeLevChk.checked := showVisAndLevelling;
blinkSlider.position := blinkSpeed;
BlinkStsChk.checked := blinkWithStatus;
if not docking.enabled then
dockGrp.ItemIndex := 0
else if not docking.appBar then
dockGrp.ItemIndex := 1
else
dockGrp.ItemIndex := 2;
Dock2ChatChk.checked := docking.Dock2Chat;
sortbyGrp.ItemIndex := sb2index[sortBy];
ShowBrdrChk.checked := showMainBorder;
groupsChk.checked := showGroups;
indentChk.checked := indentRoster;
onlyonlineChk.checked := showOnlyOnline;
onlyvisibletoChk.checked := showOnlyImVisibleTo;
unAuthShowChk.checked := showUnkAsOffline;
ontop1.checked := alwaysOnTop;
SingleClickChk.checked := useSingleClickTray;
roastertranspChk.checked := transparency.forRoster;
chattranspChk.checked := transparency.forChat;
transpActive.position := transparency.active;
transpInactive.position := transparency.inactive;
textureChk.checked := texturizedWindows;
ChkMenuHeight.checked := MenuHeightPerm;
// ChkExtDrawMenu.Checked := MenuDrawExt;
ChkExtStsMainMenu.checked := XStatusAsMain;
ChkNewExtSts.checked := showNewXStatuses;
BlnsShowChk.checked := showBalloons;
CntThmChk.checked := UseContactThemes;
AvtShwChtChk.checked := avatarShowInChat;
AvtShwHntChk.checked := avatarShowInHint;
AvtShwTraChk.checked := avatarShowInTray;
AvtShwTaskBar.checked := avatarShowInTaskBar;
AvtMaxSzChk.checked := TipsMaxAvtSizeUse;
AvtMaxSzSpin.AsInteger := TipsMaxAvtSize;
end;
procedure TdesignFr.IconsListDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
var
Attachmode: TVTNodeAttachMode;
Nodes: TNodeArray;
i: Integer;
begin
if Source = Sender then
Effect := DROPEFFECT_MOVE
else
exit;
Nodes := nil;
// <20><>, <20><> <20><> <20><> <20> <20><> <20><> <20><>, <20><> <20><>
// <20><> <20><>.
case Mode of
dmAbove:
Attachmode := amInsertBefore;
dmOnNode:
// AttachMode := amAddChildLast;
// <20><> <20><> <20><>!!!
Attachmode := amInsertAfter;
dmBelow:
Attachmode := amInsertAfter;
else
Attachmode := amNowhere;
end;
// if DataObject = nil then
// <20> <20><> <20><> <20><>, <20><> !!!!Source = Sender!!!!
if 1 = 1 then
begin
// <20><> <20><> <20><> <20><>, <20><> <20><> <20><> <20><> VCL <20><>
begin
// <20><> <20><> VT. <20><> <20><> <20><> <20><> <20><>
// <20><> <20> <20><>.
// DetermineEffect;
// <20><> <20><> <20><>, <20><> <20><> <20><> <20> Drag&Drop
Nodes := Sender.GetSortedSelection(True);
// <20> <20><> <20> <20><>
if Effect = DROPEFFECT_COPY then
begin
for i := 0 to High(Nodes) do
Sender.CopyTo(Nodes[i], Sender.DropTargetNode, Attachmode, False);
end
else
for i := 0 to High(Nodes) do
Sender.MoveTo(Nodes[i], Sender.DropTargetNode, Attachmode, False);
end
end
else
begin
// OLE drag&drop.
// Effect <20><> <20><> <20><> <20><> <20><> drag&drop, <20><> <20><> <20><>
// <20><> <20><> <20><> <20><> <20><> <20><> <20><> <20><>.
// <20><>, <20><> DROPEFFECT_MOVE (<28><>) <20><> <20><> <20><> <20><>,
// <20><> <20><> - <20><>.
if Source is TBaseVirtualTree then
// DetermineEffect
else
begin
if Boolean(Effect and DROPEFFECT_COPY) then
Effect := DROPEFFECT_COPY
else
Effect := DROPEFFECT_MOVE;
end;
// InsertData(Sender as TVirtualStringTree, DataObject, Formats, Effect, AttachMode);
end;
// IcItem := PIcItem(sender.getnodedata(paintinfo.node));
end;
procedure TdesignFr.IconsListDragOver(Sender: TBaseVirtualTree; Source: TObject; Shift: TShiftState; State: TDragState;
Pt: TPoint; Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
begin
Accept := Source = Sender;
if Accept then
Effect := DROPEFFECT_MOVE
end;
procedure TdesignFr.IconsListDrawNode(Sender: TBaseVirtualTree; const PaintInfo: TVTPaintInfo);
var
// x,y : Integer;
IcItem: PIcItem;
oldMode: Integer;
gR: TGPRect;
begin
// if PaintInfo.Column in [0..0] then
begin
// if vsSelected in PaintInfo.Node^.States then
// paintinfo.canvas.Font.Color := clHighlightText
// else
PaintInfo.Canvas.Font.Color := clWindowText;
gR.X := PaintInfo.ContentRect.left;
gR.Y := 0;
gR.Height := PaintInfo.ContentRect.Bottom - PaintInfo.ContentRect.top;
gR.Width := gR.Height;
IcItem := PIcItem(Sender.GetNodeData(PaintInfo.Node));
// inc(x, theme.drawPic(paintinfo.canvas.Handle, x,y+1, IcItem.IconName).cx+2);
inc(gR.X, theme.drawPic(PaintInfo.Canvas.Handle, gR, IcItem.IconName).cx + 2);
oldMode := SetBKMode(PaintInfo.Canvas.Handle, TRANSPARENT);
PaintInfo.Canvas.textout(gR.X, 2, IcItem.Name);
SetBKMode(PaintInfo.Canvas.Handle, oldMode);
end;
end;
procedure TdesignFr.IconsListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
begin
with TIcItem(PIcItem(Sender.GetNodeData(Node))^) do
begin
Name := '';
IconName := '';
end;
end;
end.