mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-06 18:40:33 +02:00
activated new TToolbar, old can be activated with -dOldToolBar
git-svn-id: trunk@5697 -
This commit is contained in:
parent
fe3c2b2ab2
commit
855139542f
@ -780,7 +780,7 @@ type
|
||||
end;
|
||||
|
||||
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
|
||||
{ TToolButton }
|
||||
|
||||
@ -1059,7 +1059,7 @@ type
|
||||
property OnStartDrag;
|
||||
end;
|
||||
|
||||
{$ELSE NewToolBar}
|
||||
{$ELSE OldToolBar}
|
||||
|
||||
{ TToolBar }
|
||||
|
||||
@ -1341,7 +1341,7 @@ type
|
||||
property OnStartDrag;
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
{$ENDIF OldToolBar}
|
||||
|
||||
|
||||
{ TCustomTrackBar }
|
||||
@ -2304,6 +2304,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.138 2004/07/23 16:44:27 mattias
|
||||
activated new TToolbar, old can be activated with -dOldToolBar
|
||||
|
||||
Revision 1.137 2004/07/14 15:57:53 mattias
|
||||
fixed 1.0.10 compilation from Vincent
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
}
|
||||
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
|
||||
function CompareToolBarControl(Control1, Control2: TControl): integer;
|
||||
var
|
||||
@ -85,6 +85,9 @@ begin
|
||||
TToolButton(FButtons[I]).FToolBar := nil;
|
||||
|
||||
FreeThenNil(FButtons);
|
||||
FreeThenNil(FHotImageChangeLink);
|
||||
FreeThenNil(FImageChangeLink);
|
||||
FreeThenNil(FDisabledImageChangeLink);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -612,7 +615,7 @@ begin
|
||||
Button.Click;
|
||||
end;
|
||||
|
||||
{$ELSE NewToolBar}
|
||||
{$ELSE OldToolBar}
|
||||
|
||||
var
|
||||
StillModal: boolean;
|
||||
@ -2089,11 +2092,14 @@ begin
|
||||
Result := FMenuResult;
|
||||
end;
|
||||
|
||||
{$ENDIF NewToolBar}
|
||||
{$ENDIF OldToolBar}
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.28 2004/07/23 16:44:27 mattias
|
||||
activated new TToolbar, old can be activated with -dOldToolBar
|
||||
|
||||
Revision 1.27 2004/05/11 12:16:47 mattias
|
||||
replaced writeln by debugln
|
||||
|
||||
|
@ -48,7 +48,7 @@ begin
|
||||
if IsImageIndexLinked then TToolButton(FClient).ImageIndex := Value;
|
||||
end;
|
||||
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
|
||||
{ TToolButton }
|
||||
|
||||
@ -731,7 +731,7 @@ begin
|
||||
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
end;
|
||||
|
||||
{$ELSE NewToolBar}
|
||||
{$ELSE OldToolBar}
|
||||
|
||||
const
|
||||
ButtonStates: array[TToolButtonState] of Word = (TBSTATE_CHECKED,
|
||||
@ -1200,12 +1200,15 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{$ENDIF}
|
||||
{$ENDIF OldToolBar}
|
||||
|
||||
// included by comctrls.pp
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.21 2004/07/23 16:44:27 mattias
|
||||
activated new TToolbar, old can be activated with -dOldToolBar
|
||||
|
||||
Revision 1.20 2004/06/17 20:52:19 mattias
|
||||
fixed setting ImageIndex when TMenuItem.ActionChange
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
ToDo:
|
||||
- Editing
|
||||
- Columns
|
||||
- create FTopLvlItems only on demand and update only if easy
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +34,7 @@
|
||||
const
|
||||
TTreeNodeStreamVersion : word = 1;
|
||||
TVAutoHeightString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789|\()^';
|
||||
MinNodeCapacity = 10;
|
||||
|
||||
// maximum scroll range
|
||||
//MAX_SCROLL = 32767;
|
||||
@ -2092,9 +2094,10 @@ begin
|
||||
FTopLvlCapacity:=FTopLvlCapacity shl 1;
|
||||
ReAllocMem(FTopLvlItems,SizeOf(Pointer)*FTopLvlCapacity);
|
||||
end else begin
|
||||
FTopLvlCapacity:=10;
|
||||
FTopLvlCapacity:=MinNodeCapacity;
|
||||
GetMem(FTopLvlItems,SizeOf(Pointer)*FTopLvlCapacity);
|
||||
end;
|
||||
//debugln('TTreeNodes.GrowTopLvlItems END FTopLvlCapacity=',FTopLvlCapacity,' FTopLvlCount=',FTopLvlCount,' ',FTopLvlItems<>nil);
|
||||
end;
|
||||
|
||||
function TTreeNodes.GetTopLvlItems(Index: integer): TTreeNode;
|
||||
@ -2103,33 +2106,47 @@ begin
|
||||
end;
|
||||
|
||||
procedure TTreeNodes.ShrinkTopLvlItems;
|
||||
var
|
||||
OldCapacity: LongInt;
|
||||
begin
|
||||
if FTopLvlCount>0 then begin
|
||||
if FTopLvlItems<>nil then begin
|
||||
OldCapacity:=FTopLvlCapacity;
|
||||
FTopLvlCapacity:=FTopLvlCapacity shr 1;
|
||||
if FTopLvlCapacity<FTopLvlCount then FTopLvlCapacity:=FTopLvlCount;
|
||||
if (FTopLvlCapacity<MinNodeCapacity) then begin
|
||||
if (FTopLvlCount>0) then
|
||||
FTopLvlCapacity:=MinNodeCapacity
|
||||
else
|
||||
FTopLvlCapacity:=0;
|
||||
end;
|
||||
if OldCapacity=FTopLvlCapacity then exit;
|
||||
//debugln('TTreeNodes.ShrinkTopLvlItems A FTopLvlCapacity=',FTopLvlCapacity,' FTopLvlCount=',FTopLvlCount,' ',FTopLvlItems<>nil);
|
||||
ReAllocMem(FTopLvlItems,SizeOf(Pointer)*FTopLvlCapacity);
|
||||
//debugln('TTreeNodes.ShrinkTopLvlItems B FTopLvlCapacity=',FTopLvlCapacity,' FTopLvlCount=',FTopLvlCount,' ',FTopLvlItems<>nil);
|
||||
end else begin
|
||||
FTopLvlCapacity:=0;
|
||||
FreeMem(FTopLvlItems);
|
||||
FTopLvlItems:=nil;
|
||||
if (FTopLvlCapacity>0) then
|
||||
TreeNodeError('TTreeNodes.ShrinkTopLvlItems FTopLvlCapacity>0');
|
||||
end;
|
||||
end;
|
||||
|
||||
function TTreeNodes.IndexOfTopLvlItem(Node: TTreeNode): integer;
|
||||
begin
|
||||
if (FTopLvlCount>0) and (FTopLvlItems[0]=Node) then exit(0);
|
||||
if (FTopLvlItems<>nil) and (FTopLvlItems[0]=Node) then exit(0);
|
||||
Result:=FTopLvlCount-1;
|
||||
while (Result>=0) and (FTopLvlItems[Result]<>Node) do dec(Result);
|
||||
end;
|
||||
|
||||
procedure TTreeNodes.MoveTopLvlNode(TopLvlFromIndex, TopLvlToIndex: integer;
|
||||
Node: TTreeNode);
|
||||
// TopLvlFromIndex = -1 and is insert
|
||||
// TopLvlToIndex = -1 is remove
|
||||
var i: integer;
|
||||
begin
|
||||
{$IFDEF TREEVIEW_DEBUG}
|
||||
DebugLn('[TTreeNodes.MoveTopLvlNode] TopLvlFromIndex=',TopLvlFromIndex,
|
||||
' TopLvlToIndex=',TopLvlToIndex,' Node.Text=',Node.Text);
|
||||
{$ENDIF}
|
||||
if TopLvlFromIndex=TopLvlToIndex then exit;
|
||||
if (TopLvlFromIndex>=FTopLvlCount) then
|
||||
TreeNodeError('TTreeNodes.MoveTopLvlNode TopLvlFromIndex>FTopLvlCount');
|
||||
if (TopLvlToIndex>FTopLvlCount) then
|
||||
@ -2138,7 +2155,6 @@ begin
|
||||
Node:=FTopLvlItems[TopLvlFromIndex];
|
||||
if (TopLvlToIndex>=0) then begin
|
||||
// move node
|
||||
if TopLvlToIndex=TopLvlFromIndex then exit;
|
||||
if TopLvlFromIndex<TopLvlToIndex then begin
|
||||
// move forward
|
||||
for i:=TopLvlFromIndex to TopLvlToIndex-1 do
|
||||
@ -2151,9 +2167,13 @@ begin
|
||||
FTopLvlItems[TopLvlToIndex]:=Node;
|
||||
end else begin
|
||||
// remove node
|
||||
for i:=TopLvlFromIndex to FTopLvlCount-2 do
|
||||
FTopLvlItems[i]:=FTopLvlItems[i+1];
|
||||
if FTopLvlItems<>nil then begin
|
||||
for i:=TopLvlFromIndex to FTopLvlCount-2 do
|
||||
FTopLvlItems[i]:=FTopLvlItems[i+1];
|
||||
end;
|
||||
Dec(FTopLvlCount);
|
||||
if FTopLvlCount<0 then
|
||||
TreeNodeError('TTreeNodes.MoveTopLvlNode FTopLvlCount<0');
|
||||
if FTopLvlCount<(FTopLvlCapacity shr 2) then ShrinkTopLvlItems;
|
||||
end;
|
||||
end else begin
|
||||
@ -2161,11 +2181,13 @@ begin
|
||||
if Node=nil then
|
||||
TreeNodeError('TTreeNodes.MoveTopLvlNode inserting nil');
|
||||
// insert node
|
||||
if FTopLvlCount=FTopLvlCapacity then GrowTopLvlItems;
|
||||
if (FTopLvlCount=FTopLvlCapacity) then GrowTopLvlItems;
|
||||
inc(FTopLvlCount);
|
||||
for i:=FTopLvlCount-1 downto TopLvlToIndex+1 do
|
||||
FTopLvlItems[i]:=FTopLvlItems[i-1];
|
||||
FTopLvlItems[TopLvlToIndex]:=Node;
|
||||
if FTopLvlItems<>nil then begin
|
||||
for i:=FTopLvlCount-1 downto TopLvlToIndex+1 do
|
||||
FTopLvlItems[i]:=FTopLvlItems[i-1];
|
||||
FTopLvlItems[TopLvlToIndex]:=Node;
|
||||
end;
|
||||
end else begin
|
||||
// nothing to do
|
||||
end;
|
||||
|
@ -1128,9 +1128,7 @@ procedure TGtkWidgetSet.RealizeWidgetSize(Widget: PGtkWidget; NewWidth,
|
||||
NewHeight: integer);
|
||||
var
|
||||
Requisition: TGtkRequisition;
|
||||
{$IFDEF NewToolBar}
|
||||
FixedWidget: Pointer;
|
||||
{$ENDIF}
|
||||
{$IFDEF VerboseSizeMsg}
|
||||
LCLObject: TObject;
|
||||
{$ENDIF}
|
||||
@ -1173,7 +1171,7 @@ begin
|
||||
PGtkCombo(Widget)^.entry^.allocation.width, NewHeight);
|
||||
end;
|
||||
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
if GtkWidgetIsA(Widget,gtk_toolbar_get_type) then begin
|
||||
FixedWidget:=GetFixedWidget(Widget);
|
||||
if (FixedWidget<>nil) and (FixedWidget<>Widget) then begin
|
||||
@ -3060,14 +3058,16 @@ var
|
||||
Widget : PGtkWidget; // pointer to gtk-widget (local use when neccessary)
|
||||
ChildWidget : PGtkWidget; // generic pointer to a child gtk-widget (local use when neccessary)
|
||||
AParent : TWinControl; // only used twice, replace with typecasts!
|
||||
Num : Integer; // currently only used for LM_INSERTTOOLBUTTON and LM_ADDITEM
|
||||
pStr2 : PChar; // currently only used for LM_INSERTTOOLBUTTON
|
||||
GList : pGList; // Only used for listboxes, replace with widget!!!!!
|
||||
ListItem : PGtkListItem; // currently only used for listboxes
|
||||
Rect : TRect;
|
||||
FormIconGdiObject: PGdiObject; // currently only used by LM_SETFORMICON
|
||||
Geometry : TGdkGeometry;
|
||||
AWindow : PGdkWindow;
|
||||
{$IFDEF OldToolBar}
|
||||
Num : Integer; // currently only used for LM_INSERTTOOLBUTTON and LM_ADDITEM
|
||||
pStr2 : PChar; // currently only used for LM_INSERTTOOLBUTTON
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := 0; //default value just in case nothing sets it
|
||||
|
||||
@ -3132,7 +3132,7 @@ begin
|
||||
LM_AddChild :
|
||||
begin
|
||||
Assert(False, 'Trace:Adding a child to Parent');
|
||||
{$IFNDEF NewToolBar}
|
||||
{$IFDEF OldToolBar}
|
||||
If (TControl(Sender).Parent is TToolbar) then Begin
|
||||
exit;
|
||||
end;
|
||||
@ -3333,13 +3333,14 @@ begin
|
||||
|
||||
LM_TB_BUTTONCOUNT:
|
||||
begin
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
DebugLn('Obsolete: TGtkWidgetSet.IntSendMessage3 LM_TB_BUTTONCOUNT');
|
||||
exit;
|
||||
{$ENDIF}
|
||||
{$ELSE OldToolBar}
|
||||
if (Sender is TToolbar)
|
||||
then Result := pgtkToolbar(Handle)^.num_Children
|
||||
else Result := -1;
|
||||
{$ENDIF OldToolBar}
|
||||
end;
|
||||
|
||||
//SH: think of TCanvas.handle!!!!
|
||||
@ -3393,10 +3394,10 @@ begin
|
||||
|
||||
LM_INSERTTOOLBUTTON:
|
||||
begin
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
DebugLn('Obsolete: TGtkWidgetSet.IntSendMessage3 LM_INSERTTOOLBUTTON');
|
||||
exit;
|
||||
{$ENDIF}
|
||||
{$ELSE OldToolBar}
|
||||
If (SENDER is TToolbutton) Then
|
||||
Begin
|
||||
pStr := StrAlloc(Length(TToolbutton(SENDER).Caption)+1);
|
||||
@ -3420,20 +3421,22 @@ begin
|
||||
pgtkwidget(handle),pstr,pStr2,Num);
|
||||
StrDispose(pStr);
|
||||
StrDispose(pStr2);
|
||||
{$ENDIF OldToolBar}
|
||||
end;
|
||||
|
||||
LM_DELETETOOLBUTTON:
|
||||
Begin
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
DebugLn('Obsolete: TGtkWidgetSet.IntSendMessage3 LM_DELETETOOLBUTTON');
|
||||
exit;
|
||||
{$ENDIF}
|
||||
{$ELSE OldToolBar}
|
||||
with pgtkToolbar(TToolbar(TWinControl(Sender).parent).handle)^ do
|
||||
children := g_list_remove(pgList(children), sender);
|
||||
// Next 3 lines: should be same as above, remove when above lines are proofed
|
||||
// pgtkToolbar(TToolbar(TWinControl(Sender).parent).handle)^.children :=
|
||||
// g_list_remove(pgList(pgtkToolbar(TToolbar(TWinControl(Sender).parent).handle)^.children),
|
||||
// sender);
|
||||
{$ENDIF OldToolBar}
|
||||
end;
|
||||
|
||||
LM_Invalidate :
|
||||
@ -4223,7 +4226,7 @@ begin
|
||||
csBitBtn,
|
||||
csButton: DebugLn('[WARNING] Obsolete call to TGTKOBject.SetLabel for ', Sender.ClassName);
|
||||
|
||||
{$IFNDEF NewToolBar}
|
||||
{$IFDEF OldToolBar}
|
||||
csToolButton:
|
||||
with PgtkButton(P)^ do
|
||||
begin
|
||||
@ -4248,7 +4251,7 @@ begin
|
||||
StrDispose(aLabel);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
{$ENDIF OldToolBar}
|
||||
|
||||
csForm,
|
||||
csFileDialog, csOpenFileDialog, csSaveFileDialog, csSelectDirectoryDialog,
|
||||
@ -6263,13 +6266,11 @@ end;
|
||||
child and get all LCL TControl abilities.
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtkWidgetSet.CreateToolBar(ToolBarObject: TObject): PGtkWidget;
|
||||
{$IFDEF NewToolBar}
|
||||
var
|
||||
ClientWidget: PGtkWidget;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := gtk_toolbar_new();
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
ClientWidget := gtk_fixed_new();
|
||||
gtk_toolbar_insert_widget(PGTKToolbar(Result),ClientWidget,nil,nil,0);
|
||||
gtk_widget_show(ClientWidget);
|
||||
@ -6304,7 +6305,7 @@ var
|
||||
AccelKey : guint;
|
||||
SetupProps : boolean;
|
||||
AWindow: PGdkWindow;
|
||||
{$IFNDEF NewToolBar}
|
||||
{$IFDEF OldToolBar}
|
||||
WidgetInfo: PWinWidgetInfo;
|
||||
{$ENDIF}
|
||||
begin
|
||||
@ -6697,9 +6698,9 @@ begin
|
||||
|
||||
csToolButton:
|
||||
begin
|
||||
{$IFDEF NewToolBar}
|
||||
{$IFNDEF OldToolBar}
|
||||
p := gtk_fixed_new();
|
||||
{$ELSE}
|
||||
{$ELSE OldToolBar}
|
||||
AccelText := Ampersands2Underscore(StrTemp);
|
||||
//p := gtk_button_new_with_label(StrTemp);
|
||||
p := gtk_button_new_with_label(AccelText);
|
||||
@ -6713,7 +6714,7 @@ begin
|
||||
WidgetInfo:=GetWidgetInfo(P,true);
|
||||
Include(WidgetInfo^.Flags,wwiNotOnParentsClientArea);
|
||||
gtk_widget_show (P);
|
||||
{$ENDIF}
|
||||
{$ENDIF OldToolBar}
|
||||
end;
|
||||
|
||||
csTrackBar:
|
||||
@ -9210,6 +9211,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.516 2004/07/23 16:44:27 mattias
|
||||
activated new TToolbar, old can be activated with -dOldToolBar
|
||||
|
||||
Revision 1.515 2004/07/16 21:49:00 mattias
|
||||
added RTTI controls
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user