OSDN Git Service

1.58.0.759
[gikonavigoeson/gikonavi.git] / ToolBarSetting.pas
index c3b3249..1e45aa7 100644 (file)
@@ -60,6 +60,7 @@ type
                { Private \90é\8c¾ }
                FActionList: TActionList;
                FAllList: TList;
+               FToolBarIndex : Integer;        // \8f\89\8aú\95\\8e¦\82·\82é\83c\81[\83\8b\83o\81[
                procedure CreateListData(ToolBarItem: TToolBarItem);
                procedure MoveItem(Offset: Integer);
                procedure Sort;
@@ -68,6 +69,7 @@ type
                { Public \90é\8c¾ }
                constructor Create(AOwner: TComponent; ActionList: TActionList); reintroduce; overload; virtual;
                procedure AddToolBar(ToolBar: TToolBar; ToolType: TGikoToolType);
+               property        ToolBarIndex : Integer read FToolBarIndex write FToolBarIndex;
        end;
 
 var
@@ -77,9 +79,9 @@ function CompareCategory(Item1, Item2: Pointer): Integer;
 
 implementation
 
-const
-       //\8bæ\90Ø\82è\95\8e\9a
-       SEPARATOR_TEXT = '- \8bæ\90Ø\82è -';
+//const
+//     //\8bæ\90Ø\82è\95\8e\9a
+//     SEPARATOR_TEXT = '- \8bæ\90Ø\82è -';
 
 {$R *.dfm}
 
@@ -126,7 +128,7 @@ end;
 //\95\\8e¦\82µ\82½\82Æ\82«
 procedure TToolBarSettingDialog.FormShow(Sender: TObject);
 begin
-       ToolBarComboBox.ItemIndex := 0;
+       ToolBarComboBox.ItemIndex := FToolBarIndex;
        ToolBarComboBoxChange(Self);
        AllListViewChange(Sender, nil, ctState);
        CurrentListViewChange(Sender, nil, ctState);
@@ -141,8 +143,10 @@ begin
        ToolBarItem := TToolBarItem.Create;
        ToolBarItem.ToolBar := ToolBar;
        ToolBarItem.ToolType := ToolType;
-       for i := 0 to ToolBar.ButtonCount - 1 do
-               ToolBarITem.ButtonActionList.Add(ToolBar.Buttons[i].Action);
+       for i := 0 to ToolBar.ControlCount - 1 do
+               if ToolBar.Controls[ i ] is TToolButton Then
+                       if not (ToolBar.Controls[ i ].Name = 'SelectComboBoxDummy') Then
+                       ToolBarITem.ButtonActionList.Add(ToolBar.Controls[i].Action);
        ToolBarComboBox.Items.AddObject(ToolBar.Caption, ToolBarItem);
 end;
 
@@ -173,7 +177,7 @@ begin
                ToolBarItem := TToolBarItem(ToolBarComboBox.Items.Objects[i]);
 
                for j := ToolBarItem.ToolBar.ButtonCount - 1 downto 0 do
-                       ToolBarItem.ToolBar.RemoveControl(ToolBarItem.ToolBar.Buttons[j]);
+                       ToolBarItem.ToolBar.Buttons[j].HostDockSite := nil;
 
                for j := 0 to ToolBarItem.ButtonActionList.Count - 1 do begin
                        if ToolBarItem.ButtonActionList[j] = nil then begin
@@ -185,6 +189,9 @@ begin
                        end else if TObject(ToolBarItem.ButtonActionList[j]) is TCustomAction then begin
                                ToolButton := TToolButton.Create(ToolBarItem.ToolBar);
                                ToolButton.Action := TCustomAction(ToolBarItem.ButtonActionList[j]);
+                               if ToolButton.ImageIndex = -1 then
+                                       ToolButton.ImageIndex := 51;
+
                                ToolButton.Left := 10000;
                                SetButtonStyle(ToolBarItem.ButtonActionList[j], ToolButton);
                                ToolBarItem.ToolBar.InsertControl(ToolButton);