RxFPC:rewrite RxToolBar - support scaling

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6752 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2018-12-13 11:42:18 +00:00
parent a0367219ee
commit 588c248c82
28 changed files with 1552 additions and 1317 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<Version Value="11"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
@ -26,15 +26,19 @@
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default">
<local>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</Mode0>
</Modes>
</RunParams>
<RequiredPackages Count="2">
<Item1>

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ type
TMainForm = class(TForm)
actExit: TAction;
actSysMenu: TAction;
actOpen: TAction;
BitBtn1: TBitBtn;
MenuItem10: TMenuItem;
MenuItem11: TMenuItem;

View File

@ -40,7 +40,8 @@
<element name="TToolPanel.ToolBarStyle"/>
<element name="TToolPanel.Options">
<descr>Свойство определяет поведение панели инструментов согласно типа
<link id="TToolPanelOption">TToolPanelOption</link>.</descr>
<link id="TToolPanelOption">TToolPanelOption</link>.
</descr>
</element>
<element name="TToolPanel.Version"/>
<element name="TToolPanel.ButtonAllign">
@ -150,29 +151,14 @@
</element>
<element name="TToolButtonAllign">
<short>Выравнивание кнопок на панели инструментов</short>
<descr>
<p>Выравнивание кнопок на панели инструментов</p>
<table>
<th>
<td>Выравнивание</td>
<td>Описание</td>
</th>
<tr>
<td>tbaNone</td>
<td>Нет автоматического выравнивания кнопок</td>
</tr>
<tr>
<td>tbaLeft</td>
<td>Выравнивани по левому краю</td>
</tr>
<tr>
<td>tbaRignt</td>
<td>Выравнивание по правому краю</td>
<descr><p>Выравнивание кнопок на панели инструментов</p><table><th><td>Выравнивание</td><td>Описание</td>
</th><tr><td>tbaNone</td><td>Нет автоматического выравнивания кнопок</td>
</tr><tr><td>tbaLeft</td><td>Выравнивани по левому краю</td>
</tr><tr><td>tbaRignt</td><td>Выравнивание по правому краю</td>
</tr>
</table>
</descr>
<seealso>
<link id="TToolPanel.ButtonAllign"/>
<seealso><link id="TToolPanel.ButtonAllign"/>
</seealso>
</element>
<element name="TToolPanelOption">
@ -211,7 +197,8 @@
</descr>
</element>
<element name="TToolPanelOptions">
<descr>Комплексное тип, содержащий в себе множество элементов типа <link id="TToolPanelOption">TToolPanelOption</link>.</descr>
<descr>Комплексное тип, содержащий в себе множество элементов типа <link id="TToolPanelOption">TToolPanelOption</link>.
</descr>
</element>
<element name="DefButtonWidth">
<short>Ширина кнопки по умолчанию</short>

View File

@ -16,7 +16,10 @@ rm rxDice.res
/usr/local/share/lazarus/tools/lazres rxdbgrid.res rx_markerdown.png rx_markerup.png rx_DropDown.png rx_Ellipsis.png rx_Glyph.png rx_minus.png rx_plus.png rx_UpDown.png rx_menu_grid.png
/usr/local/share/lazarus/tools/lazres rx_lcl.res picDateEdit.png rxbtn_downarrow.png rx_range_h_back.png rx_range_h_sel.png rx_slader_bottom.png rx_slader_top.png rx_range_v_back.png rx_range_v_sel.png rx_slader_left.png rx_slader_right.png
/usr/local/share/lazarus/tools/lazres rx_lcl.res picDateEdit.png rxbtn_downarrow.png rx_range_h_back.png rx_range_h_sel.png rx_slader_bottom.png \
rx_slader_top.png rx_range_v_back.png rx_range_v_sel.png rx_slader_left.png rx_slader_right.png rx_down.png rx_left.png rx_left2.png \
rx_right.png rx_right2.png rx_up.png
/usr/local/share/lazarus/tools/lazres pickdate.res rx_next1.png rx_next2.png rx_prev1.png rx_prev2.png
/usr/local/share/lazarus/tools/lazres rxswitch.res rxswitch_off.png rxswitch_on.png rx_ButtonOffHor.png rx_ButtonOffVertDown.png rx_ButtonOffVertUp.png rx_ButtonOnHor.png rx_ButtonOnVertDown.png rx_ButtonOnVertUp.png
@ -24,3 +27,4 @@ rm rxDice.res
cp rxswitch.res ../../rxcontrols
cp rxDice.res ../../rxcontrols
cp rx_lcl.res ../../rxcontrols

View File

@ -132,6 +132,10 @@ msgstr ""
msgid "General"
msgstr ""
#: rxconst.sgrabkey
msgid "Grab key"
msgstr ""
#: rxconst.shistorydesc
msgid "History - \"%s\""
msgstr ""
@ -168,6 +172,10 @@ msgstr "Opciones"
msgid "Out of range %d %d %d %d"
msgstr ""
#: rxconst.spressthekey
msgid "Press the key"
msgstr ""
#: rxconst.sprevmonth
msgid "Previous Month|"
msgstr "Anterior Mes|"
@ -254,6 +262,10 @@ msgstr ""
msgid "Second quarter"
msgstr ""
#: rxconst.sshortcut
msgid "ShortCut"
msgstr ""
#: rxconst.sshowcaption
msgid "Show caption"
msgstr "Mostrar titulo"

View File

@ -130,6 +130,10 @@ msgstr ""
msgid "General"
msgstr ""
#: rxconst.sgrabkey
msgid "Grab key"
msgstr ""
#: rxconst.shistorydesc
msgid "History - \"%s\""
msgstr ""
@ -166,6 +170,10 @@ msgstr ""
msgid "Out of range %d %d %d %d"
msgstr ""
#: rxconst.spressthekey
msgid "Press the key"
msgstr ""
#: rxconst.sprevmonth
msgid "Previous Month|"
msgstr ""
@ -251,6 +259,10 @@ msgstr ""
msgid "Second quarter"
msgstr ""
#: rxconst.sshortcut
msgid "ShortCut"
msgstr ""
#: rxconst.sshowcaption
msgid "Show caption"
msgstr ""

View File

@ -140,6 +140,10 @@ msgstr "Версия FPC : "
msgid "General"
msgstr "Общее"
#: rxconst.sgrabkey
msgid "Grab key"
msgstr ""
#: rxconst.shistorydesc
msgid "History - \"%s\""
msgstr "История - \"%s\""
@ -176,6 +180,10 @@ msgstr "Параметры"
msgid "Out of range %d %d %d %d"
msgstr "За границами диапазона %d %d %d %d"
#: rxconst.spressthekey
msgid "Press the key"
msgstr ""
#: rxconst.sprevmonth
msgid "Previous Month|"
msgstr "Превыдущий месяц|"
@ -261,6 +269,10 @@ msgstr "Вторая половина года"
msgid "Second quarter"
msgstr "Второй квартал"
#: rxconst.sshortcut
msgid "ShortCut"
msgstr ""
#: rxconst.sshowcaption
msgid "Show caption"
msgstr "Отображать заголовок"
@ -340,3 +352,4 @@ msgstr "Интерфейс : "
#: rxconst.swindowsicofiles
msgid "Windows Ico files (*.ico)|*.ico|All files (*.*)|*.*"
msgstr "Файлы иконок Windows (*.ico)|*.ico|Все файлы (*.*)|*.*"

View File

@ -143,6 +143,10 @@ msgstr "Версія FPC : "
msgid "General"
msgstr "Загальне"
#: rxconst.sgrabkey
msgid "Grab key"
msgstr ""
#: rxconst.shistorydesc
msgid "History - \"%s\""
msgstr "Історія - \"%s\""
@ -179,6 +183,10 @@ msgstr "Параметри"
msgid "Out of range %d %d %d %d"
msgstr ""
#: rxconst.spressthekey
msgid "Press the key"
msgstr ""
#: rxconst.sprevmonth
msgid "Previous Month|"
msgstr "Попередній місяць|"
@ -267,6 +275,10 @@ msgstr ""
msgid "Second quarter"
msgstr ""
#: rxconst.sshortcut
msgid "ShortCut"
msgstr ""
#: rxconst.sshowcaption
msgid "Show caption"
msgstr "Показати заголовок"

View File

@ -53,14 +53,15 @@ function BoxCanDropItem(List: TWinControl; X, Y: Integer;
implementation
uses LCLIntf, Graphics;
uses LCLIntf, Graphics, CheckLst;
function BoxItems(List: TWinControl): TStrings;
begin
if List is TCustomListBox then
Result := TCustomListBox(List).Items
{ else if List is TRxCustomListBox then
Result := TRxCustomListBox(List).Items}
else
if List is TCheckListBox then
Result := TCheckListBox(List).Items
else Result := nil;
end;
@ -73,63 +74,73 @@ begin
else
Result := TCustomListBox(List).ItemIndex = Index
end
{ else if List is TRxCustomListBox then
Result := TRxCustomListBox(List).Selected[Index]}
else Result := False;
else
if List is TCheckListBox then
Result := TCheckListBox(List).Selected[Index]
else
Result := False;
end;
procedure BoxSetSelected(List: TWinControl; Index: Integer; Value: Boolean);
begin
if List is TCustomListBox then
TCustomListBox(List).Selected[Index] := Value
{ else if List is TRxCustomListBox then
TRxCustomListBox(List).Selected[Index] := Value;}
else
if List is TCheckListBox then
TCheckListBox(List).Selected[Index] := Value;
end;
function BoxGetItemIndex(List: TWinControl): Integer;
begin
if List is TCustomListBox then
Result := TCustomListBox(List).ItemIndex
{ else if List is TRxCustomListBox then
Result := TRxCustomListBox(List).ItemIndex}
else Result := -1;
else
if List is TCheckListBox then
Result := TCheckListBox(List).ItemIndex
else
Result := -1;
end;
{.$IFNDEF WIN32}
function BoxGetCanvas(List: TWinControl): TCanvas;
begin
if List is TCustomListBox then
Result := TCustomListBox(List).Canvas
{ else if List is TRxCustomListBox then
Result := TRxCustomListBox(List).Canvas }
else
if List is TCheckListBox then
Result := TCheckListBox(List).Canvas
else Result := nil;
end;
{.$ENDIF}
procedure BoxSetItemIndex(List: TWinControl; Index: Integer);
begin
if List is TCustomListBox then
TCustomListBox(List).ItemIndex := Index
{ else if List is TRxCustomListBox then
TRxCustomListBox(List).ItemIndex := Index;}
else
if List is TCheckListBox then
TCheckListBox(List).ItemIndex := Index;
end;
function BoxMultiSelect(List: TWinControl): Boolean;
begin
if List is TCustomListBox then
Result := TListBox(List).MultiSelect
{ else if List is TRxCustomListBox then
Result := TRxCheckListBox(List).MultiSelect}
else Result := False;
else
if List is TCheckListBox then
Result := TCheckListBox(List).MultiSelect
else
Result := False;
end;
function BoxSelCount(List: TWinControl): Integer;
begin
if List is TCustomListBox then
Result := TCustomListBox(List).SelCount
{ else if List is TRxCustomListBox then
Result := TRxCustomListBox(List).SelCount}
else Result := 0;
else
if List is TCheckListBox then
Result := TCheckListBox(List).SelCount
else
Result := 0;
end;
function BoxItemAtPos(List: TWinControl; Pos: TPoint;
@ -137,18 +148,22 @@ function BoxItemAtPos(List: TWinControl; Pos: TPoint;
begin
if List is TCustomListBox then
Result := TCustomListBox(List).ItemAtPos(Pos, Existing)
{ else if List is TRxCustomListBox then
Result := TRxCustomListBox(List).ItemAtPos(Pos, Existing)}
else Result := LB_ERR;
else
if List is TCheckListBox then
Result := TCheckListBox(List).ItemAtPos(Pos, Existing)
else
Result := LB_ERR;
end;
function BoxItemRect(List: TWinControl; Index: Integer): TRect;
begin
if List is TCustomListBox then
Result := TCustomListBox(List).ItemRect(Index)
{ else if List is TRxCustomListBox then
Result := TRxCustomListBox(List).ItemRect(Index)}
else FillChar(Result, SizeOf(Result), 0);
else
if List is TCheckListBox then
Result := TCheckListBox(List).ItemRect(Index)
else
FillChar(Result, SizeOf(Result), 0);
end;
procedure BoxMoveSelected(List: TWinControl; Items: TStrings);
@ -157,12 +172,15 @@ var
begin
if BoxItems(List) = nil then Exit;
I := 0;
while I < BoxItems(List).Count do begin
if BoxGetSelected(List, I) then begin
while I < BoxItems(List).Count do
begin
if BoxGetSelected(List, I) then
begin
Items.AddObject(BoxItems(List).Strings[I], BoxItems(List).Objects[I]);
BoxItems(List).Delete(I);
end
else Inc(I);
else
Inc(I);
end;
end;
@ -213,16 +231,13 @@ begin
begin
if BoxGetSelected(SrcList, I) then
begin
NewIndex := BoxItems(DstList).AddObject(BoxItems(SrcList).Strings[I],
BoxItems(SrcList).Objects[I]);
{ if (SrcList is TRxCheckListBox) and (DstList is TRxCheckListBox) then
begin
TRxCheckListBox(DstList).State[NewIndex] :=
TRxCheckListBox(SrcList).State[I];
end;}
NewIndex := BoxItems(DstList).AddObject(BoxItems(SrcList).Strings[I], BoxItems(SrcList).Objects[I]);
if (SrcList is TCheckListBox) and (DstList is TCheckListBox) then
TCheckListBox(DstList).State[NewIndex] := TCheckListBox(SrcList).State[I];
BoxItems(SrcList).Delete(I);
end
else Inc(I);
else
Inc(I);
end;
BoxSetItem(SrcList, Index);
finally
@ -236,14 +251,11 @@ procedure BoxMoveAllItems(SrcList, DstList: TWinControl);
var
I, NewIndex: Integer;
begin
for I := 0 to BoxItems(SrcList).Count - 1 do begin
NewIndex := BoxItems(DstList).AddObject(BoxItems(SrcList)[I],
BoxItems(SrcList).Objects[I]);
{ if (SrcList is TRxCheckListBox) and (DstList is TRxCheckListBox) then
begin
TRxCheckListBox(DstList).State[NewIndex] :=
TRxCheckListBox(SrcList).State[I];
end;}
for I := 0 to BoxItems(SrcList).Count - 1 do
begin
NewIndex := BoxItems(DstList).AddObject(BoxItems(SrcList)[I], BoxItems(SrcList).Objects[I]);
if (SrcList is TCheckListBox) and (DstList is TCheckListBox) then
TCheckListBox(DstList).State[NewIndex] := TCheckListBox(SrcList).State[I];
end;
BoxItems(SrcList).Clear;
BoxSetItem(SrcList, 0);

View File

@ -223,18 +223,10 @@ begin
end;
procedure TRxDice.CreateBitmap;
var
B: TBitmap;
S: String;
begin
if FBitmap = nil then FBitmap := TBitmap.Create;
if FValue in [1..6] then
begin
S:=Format('rxDice%d', [FValue]);
B:=CreateResBitmap(S);
FBitmap.Assign(B);
B.Free;
end;
RxAssignBitmap(FBitmap, Format('rxDice%d', [FValue]));
end;
procedure TRxDice.AdjustSize;

View File

@ -87,18 +87,14 @@ procedure OutTextXY90(Canvas:TCanvas; X,Y:integer; Text:string; Orientation:TTex
function IsForegroundTask: Boolean;
function ValidParentForm(Control: TControl): TCustomForm;
function CreateArrowBitmap:TBitmap;
function CreateResBitmap(const AResName:string):TBitmap;
function LoadLazResBitmapImage(const ResName: string): TBitmap;
function RxCreateResBitmap(const AResName:string):TCustomBitmap;
procedure RxAssignBitmap(const AGlyph: TBitmap; const AResName:string);
//function LoadLazResBitmapImage(const ResName: string): TBitmap;
{functions from DBGrid}
function GetWorkingCanvas(const Canvas: TCanvas): TCanvas;
procedure FreeWorkingCanvas(canvas: TCanvas);
{
function AllocMemo(Size: Longint): Pointer;
function ReallocMemo(fpBlock: Pointer; Size: Longint): Pointer;
procedure FreeMemo(var fpBlock: Pointer);
}
procedure RaiseIndexOutOfBounds(Control: TControl; Items:TStrings; Index: integer);
@ -381,28 +377,7 @@ begin
end;
{$ENDIF}
{
function AllocMemo(Size: Longint): Pointer;
begin
if Size > 0 then
Result := GlobalAllocPtr(HeapAllocFlags or GMEM_ZEROINIT, Size)
else Result := nil;
end;
function ReallocMemo(fpBlock: Pointer; Size: Longint): Pointer;
begin
Result := GlobalReallocPtr(fpBlock, Size,
HeapAllocFlags or GMEM_ZEROINIT);
end;
procedure FreeMemo(var fpBlock: Pointer);
begin
if fpBlock <> nil then begin
GlobalFreePtr(fpBlock);
fpBlock := nil;
end;
end;
}
{$IFDEF WIN32}
function CreateIcon(hInstance: HINST; nWidth, nHeight: Integer;
cPlanes, cBitsPixel: Byte; lpbANDbits, lpbXORbits: Pointer): HICON; stdcall; external user32 name 'CreateIcon';
@ -657,60 +632,33 @@ end;
{$ENDIF}
function CreateArrowBitmap:TBitmap;
begin
{$IFNDEF RX_USE_LAZARUS_RESOURCE}
Result:=CreateResBitmap('rxbtn_downarrow');
(* Result := TBitmap.Create;
try
try
C := TPortableNetworkGraphic.Create;
C.LoadFromResourceName(hInstance, 'rxbtn_downarrow');
Result.Assign(C);
finally
C.Free;
end;
except
Result.Free;
raise;
end; *)
{$ELSE}
Result:=LoadLazResBitmapImage('rxbtn_downarrow')
{$ENDIF}
end;
function CreateResBitmap(const AResName: string): TBitmap;
var
C : TCustomBitmap;
begin
Result := TBitmap.Create;
try
try
C := TPortableNetworkGraphic.Create;
C.LoadFromResourceName(hInstance, AResName);
Result.Assign(C);
finally
C.Free;
end;
except
Result.Free;
raise;
end;
end;
//Code from DBGrid
function LoadLazResBitmapImage(const ResName: string): TBitmap;
var
C: TCustomBitmap;
begin
C := CreateBitmapFromLazarusResource(ResName);
if C<>nil then
begin
Result := TBitmap.Create;
Result.Assign(C);
C.Free;
end
Result:=TBitmap.Create;
C:=RxCreateResBitmap('rxbtn_downarrow');
Result.Assign(C);
C.Free;
end;
function RxCreateResBitmap(const AResName: string): TCustomBitmap;
var
ResHandle: TLResource;
begin
ResHandle := LazarusResources.Find(AResName);
if ResHandle <> nil then
Result := CreateBitmapFromLazarusResource(ResHandle)
else
Result:=nil;
Result := CreateBitmapFromResourceName(HInstance, AResName);
end;
procedure RxAssignBitmap(const AGlyph: TBitmap; const AResName: string);
var
C: TCustomBitmap;
begin
C:=RxCreateResBitmap(AResName);
AGlyph.Assign(C);
C.Free;
end;
function GetWorkingCanvas(const Canvas: TCanvas): TCanvas;

View File

@ -274,17 +274,12 @@ begin
end;
constructor TRxMDICloseButton.Create(AOwner: TComponent);
var
D: TBitmap;
begin
inherited Create(AOwner);
// FLabelPosition := lpAbove;
FLabelSpacing := 6;
FShowInfoLabel:=true;
CreateInternalLabel;
D:=LoadLazResBitmapImage('RxMDICloseIcon');
Glyph:=D;
D.Free;
RxAssignBitmap(Glyph, 'RxMDICloseIcon');
end;
{ TRxMDIPanel }

View File

@ -936,7 +936,6 @@ var
BackPanel: TWinControl;
MI:TMenuItem;
i:integer;
TmpBitmap:TBitmap;
begin
inherited CreateNew(AOwner);
@ -1008,64 +1007,36 @@ begin
BackPanel.Height:=Height - 4;
FBtns[0] := TRxTimerSpeedButton.Create(Self);
with FBtns[0] do
begin
Parent := FControlPanel;
SetBounds(-1, -1, BtnSide, BtnSide);
//loaded bitmap should be freed as Glyph just takes a copy of it
//TmpBitmap:=LoadBitmapFromLazarusResource('prev2');
TmpBitmap:=CreateResBitmap('rx_prev2');
Glyph := TmpBitmap;
FreeAndNil(TmpBitmap);
OnClick := @PrevYearBtnClick;
Hint := sPrevYear;
Align:=alLeft;
end;
FBtns[0].Parent := FControlPanel;
FBtns[0].SetBounds(-1, -1, BtnSide, BtnSide);
FBtns[0].OnClick := @PrevYearBtnClick;
FBtns[0].Hint := sPrevYear;
FBtns[0].Align:=alLeft;
RxAssignBitmap(FBtns[0].Glyph, 'rx_prev2');
FBtns[1] := TRxTimerSpeedButton.Create(Self);
with FBtns[1] do
begin
Parent := FControlPanel;
SetBounds(BtnSide - 2, -1, BtnSide, BtnSide);
//TmpBitmap:=LoadBitmapFromLazarusResource('prev1');
TmpBitmap:=CreateResBitmap('rx_prev1');
Glyph := TmpBitmap;
FreeAndNil(TmpBitmap);
OnClick := @PrevMonthBtnClick;
Hint := sPrevMonth;
Align:=alLeft;
end;
FBtns[1].Parent := FControlPanel;
FBtns[1].SetBounds(BtnSide - 2, -1, BtnSide, BtnSide);
FBtns[1].OnClick := @PrevMonthBtnClick;
FBtns[1].Hint := sPrevMonth;
FBtns[1].Align:=alLeft;
RxAssignBitmap(FBtns[1].Glyph, 'rx_prev1');
FBtns[2] := TRxTimerSpeedButton.Create(Self);
with FBtns[2] do
begin
Parent := FControlPanel;
SetBounds(FControlPanel.Width - 2 * BtnSide + 2, -1, BtnSide, BtnSide);
//TmpBitmap:=LoadBitmapFromLazarusResource('next1');
TmpBitmap:=CreateResBitmap('rx_next1');
Glyph := TmpBitmap;
FreeAndNil(TmpBitmap);
OnClick := @NextMonthBtnClick;
Hint := sNextMonth;
Align:=alRight;
end;
FBtns[2].Parent := FControlPanel;
FBtns[2].SetBounds(FControlPanel.Width - 2 * BtnSide + 2, -1, BtnSide, BtnSide);
FBtns[2].OnClick := @NextMonthBtnClick;
FBtns[2].Hint := sNextMonth;
FBtns[2].Align:=alRight;
RxAssignBitmap(FBtns[2].Glyph, 'rx_next1');
FBtns[3] := TRxTimerSpeedButton.Create(Self);
with FBtns[3] do
begin
Parent := FControlPanel;
SetBounds(FControlPanel.Width - BtnSide + 1, -1, BtnSide, BtnSide);
//TmpBitmap:=LoadBitmapFromLazarusResource('next2');
TmpBitmap:=CreateResBitmap('rx_next2');
Glyph := TmpBitmap;
FreeAndNil(TmpBitmap);
OnClick := @NextYearBtnClick;
Hint := sNextYear;
Align:=alRight;
end;
FBtns[3].Parent := FControlPanel;
FBtns[3].SetBounds(FControlPanel.Width - BtnSide + 1, -1, BtnSide, BtnSide);
FBtns[3].OnClick := @NextYearBtnClick;
FBtns[3].Hint := sNextYear;
FBtns[3].Align:=alRight;
RxAssignBitmap(FBtns[3].Glyph, 'rx_next2');
FTitleLabel := TLabel.Create(Self);
with FTitleLabel do

View File

@ -238,8 +238,6 @@ end;
{ TRxNotifierForm }
procedure TRxNotifierForm.CreateCloseButton;
var
D: TBitmap;
begin
FCloseButton:=TSpeedButton.Create(Self);
FCloseButton.Parent:=Self;
@ -247,9 +245,7 @@ begin
FCloseButton.Width:=26;
FCloseButton.Height:=26;
D:=LoadLazResBitmapImage('RxMDICloseIcon');
FCloseButton.Glyph:=D;
D.Free;
RxAssignBitmap(FCloseButton.Glyph, 'RxMDICloseIcon');
FCloseButton.Hint:=FOwnerItem.CloseButton.Hint;
FCloseButton.Flat:=FOwnerItem.CloseButton.Flat;

View File

@ -467,19 +467,17 @@ procedure TRxCustomRangeSelector.InitImages(AOrient: TTrackBarOrientation);
begin
if AOrient = trHorizontal then
begin
FSelectedGlyph := CreateResBitmap(sRX_RANGE_H_SEL);
FBackgroudGlyph := CreateResBitmap(sRX_RANGE_H_BACK);
FThumbTopGlyph:=CreateResBitmap(sRX_SLADER_TOP);
FThumbBottomGlyph:=CreateResBitmap(sRX_SLADER_BOTTOM);
RxAssignBitmap(FSelectedGlyph, sRX_RANGE_H_SEL);
RxAssignBitmap(FBackgroudGlyph, sRX_RANGE_H_BACK);
RxAssignBitmap(FThumbTopGlyph, sRX_SLADER_TOP);
RxAssignBitmap(FThumbBottomGlyph, sRX_SLADER_BOTTOM);
end
else
begin
FSelectedGlyph := CreateResBitmap(sRX_RANGE_V_SEL);
FBackgroudGlyph := CreateResBitmap(sRX_RANGE_V_BACK);
FThumbTopGlyph:=CreateResBitmap(sRX_SLADER_LEFT);
FThumbBottomGlyph:=CreateResBitmap(sRX_SLADER_RIGHT);
RxAssignBitmap(FSelectedGlyph, sRX_RANGE_V_SEL);
RxAssignBitmap(FBackgroudGlyph, sRX_RANGE_V_BACK);
RxAssignBitmap(FThumbTopGlyph, sRX_SLADER_LEFT);
RxAssignBitmap(FThumbBottomGlyph, sRX_SLADER_RIGHT);
end;
end;
@ -690,11 +688,11 @@ constructor TRxCustomRangeSelector.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
// FThumbTopGlyph:=TBitmap.Create;
// FThumbBottomGlyph:=TBitmap.Create;
FThumbTopGlyph:=TBitmap.Create;
FThumbBottomGlyph:=TBitmap.Create;
FSelectedGlyph:=TBitmap.Create;
FBackgroudGlyph:=TBitmap.Create;
// FSelectedGlyph:=TBitmap.Create;
// FBackgroudGlyph:=TBitmap.Create;
InitImages(trHorizontal);
with GetControlClassDefaultSize do

View File

@ -8,11 +8,11 @@ object rxShortCutForm: TrxShortCutForm
ClientWidth = 463
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.7'
LCLVersion = '2.1.0.0'
object ButtonPanel1: TButtonPanel
Left = 6
Height = 42
Top = 56
Height = 46
Top = 52
Width = 451
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
@ -30,8 +30,8 @@ object rxShortCutForm: TrxShortCutForm
AnchorSideTop.Control = ComboBox1
AnchorSideTop.Side = asrCenter
Left = 6
Height = 24
Top = 10
Height = 23
Top = 12
Width = 55
BorderSpacing.Left = 6
BorderSpacing.Right = 6
@ -44,9 +44,9 @@ object rxShortCutForm: TrxShortCutForm
AnchorSideTop.Control = ComboBox1
AnchorSideTop.Side = asrCenter
Left = 67
Height = 24
Top = 10
Width = 43
Height = 23
Top = 12
Width = 44
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'Alt'
@ -57,9 +57,9 @@ object rxShortCutForm: TrxShortCutForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ComboBox1
AnchorSideTop.Side = asrCenter
Left = 116
Height = 24
Top = 10
Left = 117
Height = 23
Top = 12
Width = 49
BorderSpacing.Left = 6
BorderSpacing.Right = 6
@ -71,10 +71,10 @@ object rxShortCutForm: TrxShortCutForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Button1
Left = 171
Height = 32
Left = 172
Height = 34
Top = 6
Width = 211
Width = 210
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ItemHeight = 0
@ -86,7 +86,7 @@ object rxShortCutForm: TrxShortCutForm
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 388
Height = 32
Height = 33
Top = 6
Width = 69
Anchors = [akTop, akRight]

View File

@ -31,7 +31,7 @@
unit rxShortCutUnit;
{$mode objfpc}{$H+}
{$I rx.inc}
interface
@ -55,6 +55,7 @@ type
private
function GetShortCut: TShortCut;
procedure SetShortCut(AValue: TShortCut);
procedure Localize;
public
property ShortCut:TShortCut read GetShortCut write SetShortCut;
end;
@ -63,7 +64,7 @@ type
function RxSelectShortCut(var AShortCut:TShortCut):boolean;
implementation
uses LCLProc, LCLType, LCLStrConsts;
uses LCLProc, LCLType, LCLStrConsts, rxconst;
{$R *.lfm}
@ -73,7 +74,8 @@ var
begin
rxShortCutForm:=TrxShortCutForm.Create(Application);
rxShortCutForm.ShortCut:=AShortCut;
if rxShortCutForm.ShowModal = mrOk then
Result:=rxShortCutForm.ShowModal = mrOk;
if Result then
AShortCut:=rxShortCutForm.ShortCut;
rxShortCutForm.Free;
end;
@ -113,9 +115,11 @@ var
begin
inherited CreateNew(AOwner, Num);
Position:=poScreenCenter;
{ TODO -oalexs : add code for alow scaling }
Width:=200;
Height:=80;
Caption:='Press the key';
Caption:=sPressTheKey;
BorderStyle:=bsDialog;
KeyPreview:=true;
@ -136,6 +140,7 @@ var
S: String;
i:Word;
begin
Localize;
for i:=0 to $FF do
begin
S:=ShortCutToText(i);
@ -163,6 +168,12 @@ begin
///if ShortCut and scMeta <> 0 then Result := Result + MenuKeyCaps[mkcMeta];
end;
procedure TrxShortCutForm.Localize;
begin
Button1.Caption:=sGrabKey;
Caption:=sShortCut;
end;
function TrxShortCutForm.GetShortCut: TShortCut;
var
S: String;

View File

@ -302,7 +302,6 @@ const
procedure TRxSwitch.SetSwitchGlyph(Index: TSwithState; Value: TBitmap);
var
S: String;
B: TBitmap;
begin
FBitmaps[Index].Clear;
if Value <> nil then
@ -324,11 +323,7 @@ begin
Exit;
end;
if S<>'' then
begin
B:=CreateResBitmap(S);
FBitmaps[Index].Assign(B);
B.Free;
end;
RxAssignBitmap(FBitmaps[Index], S);
Exclude(FUserBitmaps, Index);
end;
end;

View File

@ -7,15 +7,13 @@ object ToolPanelSetupForm: TToolPanelSetupForm
Caption = 'Tool panel setup'
ClientHeight = 487
ClientWidth = 657
FormStyle = fsStayOnTop
OnClose = FormClose
OnDestroy = FormDestroy
OnResize = FormResize
Position = poScreenCenter
LCLVersion = '1.7'
LCLVersion = '2.1.0.0'
object PageControl1: TPageControl
Left = 0
Height = 433
Height = 429
Top = 0
Width = 657
ActivePage = TabSheet1
@ -24,16 +22,16 @@ object ToolPanelSetupForm: TToolPanelSetupForm
TabOrder = 0
object TabSheet1: TTabSheet
Caption = 'Visible buttons'
ClientHeight = 395
ClientWidth = 651
ClientHeight = 398
ClientWidth = 647
object Label1: TLabel
AnchorSideLeft.Control = BitBtn3
AnchorSideLeft.Control = btnLeft2
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = TabSheet1
Left = 347
Height = 20
Left = 339
Height = 17
Top = 6
Width = 112
Width = 105
BorderSpacing.Around = 6
Caption = 'Avaliable buttons'
FocusControl = ListBtnAvaliable
@ -42,92 +40,88 @@ object ToolPanelSetupForm: TToolPanelSetupForm
object Label2: TLabel
AnchorSideTop.Control = TabSheet1
Left = 8
Height = 20
Height = 17
Top = 6
Width = 97
Width = 90
BorderSpacing.Around = 6
Caption = 'Visible buttons'
FocusControl = ListBtnVisible
ParentColor = False
end
object BitBtn3: TBitBtn
AnchorSideLeft.Control = BitBtn6
AnchorSideTop.Control = BitBtn4
object btnLeft2: TBitBtn
AnchorSideLeft.Control = btnRight2
AnchorSideTop.Control = btnLeft
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BitBtn6
AnchorSideRight.Control = btnRight2
AnchorSideRight.Side = asrBottom
Left = 309
Left = 313
Height = 30
Top = 160
Width = 32
Top = 125
Width = 20
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.InnerBorder = 2
Caption = '<<'
OnClick = BitBtn3Click
OnClick = btnLeft2Click
TabOrder = 0
end
object BitBtn4: TBitBtn
AnchorSideLeft.Control = BitBtn6
AnchorSideTop.Control = BitBtn5
object btnLeft: TBitBtn
AnchorSideLeft.Control = btnRight2
AnchorSideTop.Control = btnRight
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BitBtn6
AnchorSideRight.Control = btnRight2
AnchorSideRight.Side = asrBottom
Left = 309
Height = 36
Top = 118
Width = 32
Left = 313
Height = 20
Top = 99
Width = 20
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
BorderSpacing.InnerBorder = 2
Caption = '<'
OnClick = BitBtn4Click
OnClick = btnLeftClick
TabOrder = 1
end
object BitBtn5: TBitBtn
AnchorSideLeft.Control = BitBtn6
AnchorSideTop.Control = BitBtn6
object btnRight: TBitBtn
AnchorSideLeft.Control = btnRight2
AnchorSideTop.Control = btnRight2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BitBtn6
AnchorSideRight.Control = btnRight2
AnchorSideRight.Side = asrBottom
Left = 309
Left = 313
Height = 38
Top = 74
Width = 32
Top = 55
Width = 20
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.InnerBorder = 2
Caption = '>'
OnClick = BitBtn5Click
OnClick = btnRightClick
TabOrder = 2
end
object BitBtn6: TBitBtn
object btnRight2: TBitBtn
AnchorSideLeft.Control = TabSheet1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = ListBtnAvaliable
Left = 309
Height = 36
Top = 32
Width = 32
Left = 313
Height = 20
Top = 29
Width = 20
AutoSize = True
BorderSpacing.InnerBorder = 2
Caption = '>>'
OnClick = BitBtn6Click
OnClick = btnRight2Click
TabOrder = 3
end
object ListBtnAvaliable: TListBox
AnchorSideLeft.Control = BitBtn3
AnchorSideLeft.Control = btnLeft2
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TabSheet1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = cbShowCaption
Left = 347
Height = 259
Top = 32
Width = 298
Left = 339
Height = 266
Top = 29
Width = 302
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
IntegralHeight = True
@ -144,27 +138,28 @@ object ToolPanelSetupForm: TToolPanelSetupForm
OnClick = ListBtnAvaliableClick
OnDblClick = ListBtnVisibleDblClick
OnDrawItem = ListBox1DrawItem
ScrollWidth = 296
ScrollWidth = 300
Style = lbOwnerDrawFixed
TabOrder = 4
end
object ListBtnVisible: TListBox
AnchorSideLeft.Control = Label2
AnchorSideLeft.Control = btnUp
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BitBtn6
AnchorSideRight.Control = btnRight2
AnchorSideBottom.Control = cbShowCaption
Left = 14
Height = 259
Top = 32
Width = 289
Left = 32
Height = 266
Top = 29
Width = 275
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
ItemHeight = 0
OnClick = ListBtnAvaliableClick
OnDblClick = ListBtnVisibleDblClick
OnDrawItem = ListBox1DrawItem
ScrollWidth = 287
ScrollWidth = 273
Style = lbOwnerDrawFixed
TabOrder = 5
TopIndex = -1
@ -174,8 +169,8 @@ object ToolPanelSetupForm: TToolPanelSetupForm
AnchorSideBottom.Side = asrBottom
Left = 3
Height = 62
Top = 327
Width = 639
Top = 330
Width = 635
Alignment = taLeftJustify
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Around = 6
@ -187,28 +182,62 @@ object ToolPanelSetupForm: TToolPanelSetupForm
AnchorSideLeft.Control = TabSheet1
AnchorSideBottom.Control = Panel1
Left = 6
Height = 24
Top = 297
Width = 112
Height = 23
Top = 301
Width = 108
Anchors = [akLeft, akBottom]
BorderSpacing.Around = 6
Caption = 'Show caption'
OnChange = cbShowCaptionChange
TabOrder = 7
end
object btnUp: TBitBtn
Tag = -1
AnchorSideLeft.Control = TabSheet1
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = btnRight2
AnchorSideRight.Side = asrBottom
Left = 6
Height = 20
Top = 29
Width = 20
AutoSize = True
BorderSpacing.Around = 6
BorderSpacing.InnerBorder = 2
OnClick = btnUpClick
TabOrder = 8
end
object btnDown: TBitBtn
Tag = 1
AnchorSideLeft.Control = TabSheet1
AnchorSideTop.Control = btnUp
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = btnRight2
AnchorSideRight.Side = asrBottom
Left = 6
Height = 20
Top = 55
Width = 20
AutoSize = True
BorderSpacing.Around = 6
BorderSpacing.InnerBorder = 2
OnClick = btnUpClick
TabOrder = 9
end
end
object TabSheet2: TTabSheet
Caption = 'Options'
ClientHeight = 395
ClientWidth = 651
ClientHeight = 398
ClientWidth = 647
object cbShowHint: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = cbTransp
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 178
Width = 90
Height = 23
Top = 169
Width = 87
BorderSpacing.Around = 6
Caption = 'Show hint'
TabOrder = 0
@ -218,9 +247,9 @@ object ToolPanelSetupForm: TToolPanelSetupForm
AnchorSideTop.Control = cbFlatBtn
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 148
Width = 101
Height = 23
Top = 140
Width = 100
BorderSpacing.Around = 6
Caption = 'Transparent'
TabOrder = 1
@ -230,9 +259,9 @@ object ToolPanelSetupForm: TToolPanelSetupForm
AnchorSideTop.Control = RadioGroup1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 118
Width = 104
Height = 23
Top = 111
Width = 100
BorderSpacing.Around = 6
Caption = 'Flat buttons'
TabOrder = 2
@ -243,10 +272,10 @@ object ToolPanelSetupForm: TToolPanelSetupForm
AnchorSideTop.Control = TabSheet2
AnchorSideRight.Control = TabSheet2
AnchorSideRight.Side = asrBottom
Left = 333
Height = 106
Left = 331
Height = 99
Top = 6
Width = 312
Width = 310
Anchors = [akTop, akLeft, akRight]
AutoFill = False
AutoSize = True
@ -258,7 +287,7 @@ object ToolPanelSetupForm: TToolPanelSetupForm
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 84
ClientHeight = 81
ClientWidth = 308
Items.Strings = (
'None'
@ -273,9 +302,9 @@ object ToolPanelSetupForm: TToolPanelSetupForm
AnchorSideTop.Control = TabSheet2
AnchorSideRight.Control = Panel2
Left = 6
Height = 106
Height = 99
Top = 6
Width = 312
Width = 310
Anchors = [akTop, akLeft, akRight]
AutoFill = True
AutoSize = True
@ -289,7 +318,7 @@ object ToolPanelSetupForm: TToolPanelSetupForm
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 84
ClientHeight = 81
ClientWidth = 308
Items.Strings = (
'Standart'
@ -305,8 +334,8 @@ object ToolPanelSetupForm: TToolPanelSetupForm
AnchorSideTop.Control = TabSheet2
AnchorSideBottom.Control = TabSheet2
AnchorSideBottom.Side = asrBottom
Left = 324
Height = 383
Left = 322
Height = 386
Top = 6
Width = 3
Anchors = [akTop, akLeft, akBottom]
@ -317,8 +346,8 @@ object ToolPanelSetupForm: TToolPanelSetupForm
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 42
Top = 439
Height = 46
Top = 435
Width = 645
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True

View File

@ -44,10 +44,12 @@ type
{ TToolPanelSetupForm }
TToolPanelSetupForm = class(TForm)
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
BitBtn6: TBitBtn;
btnLeft2: TBitBtn;
btnLeft: TBitBtn;
btnRight: TBitBtn;
btnRight2: TBitBtn;
btnUp: TBitBtn;
btnDown: TBitBtn;
ButtonPanel1: TButtonPanel;
cbShowHint: TCheckBox;
cbTransp: TCheckBox;
@ -64,13 +66,13 @@ type
RadioGroup2: TRadioGroup;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
procedure btnLeft2Click(Sender: TObject);
procedure btnLeftClick(Sender: TObject);
procedure btnRightClick(Sender: TObject);
procedure btnRight2Click(Sender: TObject);
procedure btnUpClick(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure ListBox1DrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
@ -81,6 +83,7 @@ type
procedure FillItems(List:TStrings; AVisible:boolean);
procedure UpdateStates;
procedure Localize;
procedure UpdateToolbarOrder;
public
FToolPanel:TToolPanel;
constructor CreateSetupForm(AToolPanel:TToolPanel);
@ -94,23 +97,12 @@ uses rxlclutils, ActnList, rxboxprocs, rxconst, LCLProc, rxShortCutUnit;
{$R *.lfm}
type
THackToolPanel = class(TToolPanel);
{ TToolPanelSetupForm }
procedure TToolPanelSetupForm.FormDestroy(Sender: TObject);
begin
if Assigned(FToolPanel) then
begin
THackToolPanel(FToolPanel).SetCustomizing(false);
THackToolPanel(FToolPanel).FCustomizer:=nil;
end;
end;
procedure TToolPanelSetupForm.FormResize(Sender: TObject);
begin
ListBtnVisible.Width:=BitBtn6.Left - 4 - ListBtnVisible.Left;
ListBtnAvaliable.Left:=BitBtn6.Left + BitBtn6.Width + 4;
ListBtnVisible.Width:=btnRight2.Left - 4 - ListBtnVisible.Left;
ListBtnAvaliable.Left:=btnRight2.Left + btnRight2.Width + 4;
ListBtnAvaliable.Width:=Width - ListBtnAvaliable.Left - 4;
Label1.Left:=ListBtnAvaliable.Left;
end;
@ -118,17 +110,20 @@ end;
procedure TToolPanelSetupForm.ListBox1DrawItem(Control: TWinControl;
Index: Integer; ARect: TRect; State: TOwnerDrawState);
var
Offset:integer;
Offset, TW:integer;
P:TToolbarItem;
BtnRect:TRect;
Cnv:TCanvas;
C: TColor;
S: String;
S, SText: String;
begin
Cnv:=(Control as TListBox).Canvas;
C:=Cnv.Brush.Color;
TW:=Cnv.TextHeight('Wg');
Cnv.FillRect(ARect); { clear the rectangle }
P:=TToolbarItem((Control as TListBox).Items.Objects[Index]);
SText:=(Control as TListBox).Items[Index];
if Assigned(P) then
begin
if Assigned(FToolPanel.ImageList) and Assigned(P.Action) then
@ -140,27 +135,28 @@ begin
Offset := 2;
BtnRect.Top:=ARect.Top + 2;
BtnRect.Left:=ARect.Left + Offset;
BtnRect.Right:=BtnRect.Left + FToolPanel.BtnWidth;
BtnRect.Bottom:=BtnRect.Top + FToolPanel.BtnHeight;
BtnRect.Right:=BtnRect.Left + FToolPanel.DefImgWidth * 2;
BtnRect.Bottom:=BtnRect.Top + FToolPanel.DefImgHeight * 2;
Cnv.Brush.Color := clBtnFace;
Cnv.FillRect(BtnRect);
DrawButtonFrame(Cnv, BtnRect, false, false);
FToolPanel.ImageList.Draw(Cnv, BtnRect.Left + (FToolPanel.BtnWidth - FToolPanel.ImageList.Width) div 2,
BtnRect.Top + (FToolPanel.BtnHeight - FToolPanel.ImageList.Height) div 2,
FToolPanel.ImageList.Draw(Cnv, BtnRect.Left + FToolPanel.DefImgWidth div 2,
BtnRect.Top + FToolPanel.DefImgHeight div 2,
TCustomAction(P.Action).ImageIndex, True);
Offset:=BtnRect.Right;
end;
Offset := Offset + 6;
Cnv.Brush.Color:=C;
Cnv.TextOut(ARect.Left + Offset, (ARect.Top + ARect.Bottom - Cnv.TextHeight('Wg')) div 2, TCustomAction(P.Action).Caption); { display the text }
if (P.Action is TAction) then
if TAction(P.Action).ShortCut <> 0 then
begin
S:=ShortCutToText(TAction(P.Action).ShortCut);
if S<> '' then
Cnv.TextOut(ARect.Right - Cnv.TextWidth(S) - 2, (ARect.Top + ARect.Bottom - Cnv.TextHeight('Wg')) div 2, S); { display the shortut caption }
end;
end;
Offset := Offset + 6;
Cnv.Brush.Color:=C;
Cnv.TextOut(ARect.Left + Offset, (ARect.Top + ARect.Bottom - TW) div 2, SText); { display the text }
if (P.Action is TAction) then
if TAction(P.Action).ShortCut <> 0 then
begin
S:=ShortCutToText(TAction(P.Action).ShortCut);
if S<> '' then
Cnv.TextOut(ARect.Right - Cnv.TextWidth(S) - 2, (ARect.Top + ARect.Bottom - TW) div 2, S); { display the shortut caption }
end;
end;
end;
@ -170,7 +166,10 @@ begin
begin
if (ItemIndex>-1) and (ItemIndex<Items.Count) then
begin
Panel1.Caption:=TCustomAction(TToolbarItem(Items.Objects[ItemIndex]).Action).Hint;
if Assigned(TToolbarItem(Items.Objects[ItemIndex]).Action) then
Panel1.Caption:=TCustomAction(TToolbarItem(Items.Objects[ItemIndex]).Action).Hint
else
Panel1.Caption:='';
if Sender = ListBtnVisible then
cbShowCaption.Checked:=TToolbarItem(Items.Objects[ItemIndex]).ShowCaption;
end;
@ -196,30 +195,28 @@ begin
if Act is TCustomAction then
begin
A:=TCustomAction(Act).ShortCut;
Hide;
// Hide;
if RxSelectShortCut(A) then
begin
TCustomAction(Act).ShortCut:=A;
TListBox(Sender).Invalidate;
end;
Show;
// Show;
end;
end;
end;
procedure TToolPanelSetupForm.FillItems(List: TStrings; AVisible: boolean);
var
i, p:integer;
TI: TToolbarItem;
begin
List.Clear;
for i:=0 to FToolPanel.Items.Count - 1 do
begin
if (FToolPanel.Items[i].Visible = AVisible) and Assigned(FToolPanel.Items[i].Action) then
begin
P:=List.Add(FToolPanel.Items[i].Action.Name);
List.Objects[P]:=FToolPanel.Items[i];
end;
end;
for TI in FToolPanel.Items do
if (TI.Visible = AVisible) then
if Assigned(TI.Action) then
List.AddObject(TI.Action.Name, TI)
else
List.AddObject('Separator', TI);
end;
procedure TToolPanelSetupForm.UpdateStates;
@ -232,14 +229,21 @@ begin
for I:=0 to ListBtnAvaliable.Items.Count - 1 do
TToolbarItem(ListBtnAvaliable.Items.Objects[i]).Visible:=false;
BitBtn6.Enabled:=ListBtnVisible.Items.Count>0;
BitBtn5.Enabled:=ListBtnVisible.Items.Count>0;
cbShowCaption.Enabled:=(ListBtnVisible.Items.Count>0) and (ListBtnVisible.ItemIndex>=0);
btnRight2.Enabled:=ListBtnVisible.Items.Count>0;
btnRight.Enabled:=ListBtnVisible.Items.Count>0;
BitBtn4.Enabled:=ListBtnAvaliable.Items.Count>0;
BitBtn3.Enabled:=ListBtnAvaliable.Items.Count>0;
btnLeft.Enabled:=ListBtnAvaliable.Items.Count>0;
btnLeft2.Enabled:=ListBtnAvaliable.Items.Count>0;
cbFlatBtn.Checked:=tpFlatBtns in FToolPanel.Options;
btnUp.Enabled:=(ListBtnVisible.Items.Count>0) and (ListBtnVisible.ItemIndex>0);
btnDown.Enabled:=(ListBtnVisible.Items.Count>0) and (ListBtnVisible.ItemIndex < ListBtnVisible.Items.Count-1);
if (ListBtnVisible.ItemIndex>=0) and (ListBtnVisible.ItemIndex<ListBtnVisible.Items.Count) then
cbShowCaption.Enabled:=not (TToolbarItem(ListBtnVisible.Items.Objects[ListBtnVisible.ItemIndex]).ButtonStyle in [tbrSeparator, tbrDivider])
else
cbShowCaption.Enabled:=false;
end;
procedure TToolPanelSetupForm.Localize;
@ -266,6 +270,29 @@ begin
RadioGroup1.Items.Add(sButtonAlign3);
end;
procedure TToolPanelSetupForm.UpdateToolbarOrder;
var
P, P1: TToolbarItem;
i, j: Integer;
begin
FToolPanel.DisableAlign;
FToolPanel.Items.BeginUpdate;
for i:=0 to ListBtnVisible.Count-1 do
begin
P:=ListBtnVisible.Items.Objects[i] as TToolbarItem;
P1:=FToolPanel.Items[i];
if P <> P1 then
begin
j:=FToolPanel.Items.IndexOf(P);
if j>-1 then
FToolPanel.Items.Exchange(i, j);
end;
end;
FToolPanel.Items.EndUpdate;
FToolPanel.ReAlign;
FToolPanel.EnableAlign;
end;
procedure TToolPanelSetupForm.FormClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
@ -296,31 +323,63 @@ begin
cbFlatBtn.Checked:=tpFlatBtns in FToolPanel.Options;
end;
procedure TToolPanelSetupForm.BitBtn4Click(Sender: TObject);
procedure TToolPanelSetupForm.btnLeftClick(Sender: TObject);
begin
BoxMoveSelectedItems(ListBtnAvaliable, ListBtnVisible);
UpdateStates;
UpdateToolbarOrder;
end;
procedure TToolPanelSetupForm.BitBtn3Click(Sender: TObject);
procedure TToolPanelSetupForm.btnLeft2Click(Sender: TObject);
begin
BoxMoveAllItems(ListBtnAvaliable, ListBtnVisible);
UpdateStates;
UpdateToolbarOrder;
end;
procedure TToolPanelSetupForm.BitBtn5Click(Sender: TObject);
procedure TToolPanelSetupForm.btnRightClick(Sender: TObject);
begin
BoxMoveSelectedItems(ListBtnVisible, ListBtnAvaliable);
UpdateStates;
UpdateToolbarOrder;
end;
procedure TToolPanelSetupForm.BitBtn6Click(Sender: TObject);
procedure TToolPanelSetupForm.btnRight2Click(Sender: TObject);
begin
BoxMoveAllItems(ListBtnVisible, ListBtnAvaliable);
UpdateStates;
UpdateToolbarOrder;
end;
procedure TToolPanelSetupForm.btnUpClick(Sender: TObject);
var
I, J: Integer;
S: String;
P: TObject;
begin
ListBtnVisible.Items.BeginUpdate;
I:=ListBtnVisible.ItemIndex;
J:=I + TComponent(Sender).Tag;
S:=ListBtnVisible.Items[I];
P:=ListBtnVisible.Items.Objects[I];
ListBtnVisible.Items[I]:=ListBtnVisible.Items[J];
ListBtnVisible.Items.Objects[I]:=ListBtnVisible.Items.Objects[J];
ListBtnVisible.Items[J]:=S;
ListBtnVisible.Items.Objects[J]:=P;
ListBtnVisible.ItemIndex:=J;
ListBtnVisible.Items.EndUpdate;
UpdateStates;
UpdateToolbarOrder;
end;
constructor TToolPanelSetupForm.CreateSetupForm(AToolPanel: TToolPanel);
var
C: TCustomBitmap;
begin
inherited Create(AToolPanel);
Localize;
@ -328,13 +387,19 @@ begin
FormResize(nil);
FToolPanel:=AToolPanel;
RxAssignBitmap(btnUp.Glyph, 'rx_up');
RxAssignBitmap(btnDown.Glyph, 'rx_down');
RxAssignBitmap(btnRight.Glyph, 'rx_right');
RxAssignBitmap(btnRight2.Glyph, 'rx_right2');
RxAssignBitmap(btnLeft.Glyph, 'rx_left');
RxAssignBitmap(btnLeft2.Glyph, 'rx_left2');
cbFlatBtn.Checked:=tpFlatBtns in FToolPanel.Options;
cbTransp.Checked:=tpTransparentBtns in FToolPanel.Options;
cbShowHint.Checked:=FToolPanel.ShowHint;
ListBtnAvaliable.ItemHeight:=FToolPanel.BtnHeight + 4;
ListBtnVisible.ItemHeight:=FToolPanel.BtnHeight + 4;
ListBtnAvaliable.ItemHeight:=FToolPanel.DefImgHeight*2 + 4;
ListBtnVisible.ItemHeight:=FToolPanel.DefImgHeight*2 + 4;
FillItems(ListBtnVisible.Items, true);
FillItems(ListBtnAvaliable.Items, false);

File diff suppressed because it is too large Load Diff

View File

@ -7038,8 +7038,8 @@ begin
FSortColumns:=TRxDbGridColumnsSortList.Create;
FGroupItems:=TColumnGroupItems.Create(Self);
F_MenuBMP := CreateResBitmap('rx_menu_grid');
F_MenuBMP := TBitmap.Create;
RxAssignBitmap(F_MenuBMP, 'rx_menu_grid');
Options := Options - [dgTabs];
@ -7787,13 +7787,21 @@ initialization
RxDBGridSortEngineList := TStringList.Create;
RxDBGridSortEngineList.Sorted := True;
FMarkerUp := CreateResBitmap('rx_markerup');
FMarkerDown := CreateResBitmap('rx_markerdown');
FEllipsisRxBMP:=CreateResBitmap('rx_Ellipsis');
FGlyphRxBMP:=CreateResBitmap('rx_Glyph');
FUpDownRxBMP:=CreateResBitmap('rx_UpDown');
FPlusRxBMP:=CreateResBitmap('rx_plus');
FMinusRxBMP:=CreateResBitmap('rx_minus');
FMarkerUp := TBitmap.Create;
FMarkerDown := TBitmap.Create;
FEllipsisRxBMP:=TBitmap.Create;
FGlyphRxBMP:=TBitmap.Create;
FUpDownRxBMP:=TBitmap.Create;
FPlusRxBMP:=TBitmap.Create;
FMinusRxBMP:=TBitmap.Create;
RxAssignBitmap(FMarkerUp, 'rx_markerup');
RxAssignBitmap(FMarkerDown, 'rx_markerdown');
RxAssignBitmap(FEllipsisRxBMP, 'rx_Ellipsis');
RxAssignBitmap(FGlyphRxBMP, 'rx_Glyph');
RxAssignBitmap(FUpDownRxBMP, 'rx_UpDown');
RxAssignBitmap(FPlusRxBMP, 'rx_plus');
RxAssignBitmap(FMinusRxBMP, 'rx_minus');
finalization

View File

@ -25,7 +25,7 @@
Copyright (c) 1998 Master-Bank
translate to Lazarus by alexs in 2005 - 2018"/>
<License Value="LGPL"/>
<Version Major="3" Minor="2" Release="2" Build="215"/>
<Version Major="3" Minor="3" Release="1" Build="220"/>
<Files Count="71">
<Item1>
<Filename Value="registerrx.pas"/>

View File

@ -146,6 +146,12 @@ resourcestring
sRxLoginDlgBtnMore = 'More >>';
sRxLoginDlgDatabase = 'Database';
{ rxShortCutUnit }
sGrabKey = 'Grab key';
sPressTheKey = 'Press the key';
sShortCut = 'ShortCut';
implementation
end.

View File

@ -257,8 +257,9 @@ const
sVisible = '.Visible';
sItem = '.Item';
sWidth = '.Width';
sTop = '.Top';
// sTop = '.Top';
sVersion = '.Version';
sVersion2 = '.Version2';
sLeft = '.Left';
sShowHint = '.ShowHint';
sShowCaption = '.ShowCaption';