6 Windows, Messages, SysUtils, Classes, Controls,
7 StdCtrls, ExtCtrls, ComCtrls, ActnList, IniFiles,
11 //
\95W
\8f\80\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
12 DEF_STANDARD: array[0..11] of string = ('RoundAction',
20 'CabinetHistoryAction',
21 'CabinetFavoriteAction',
24 //
\83\8a\83X
\83g
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
25 DEF_LIST: array[0..18] of string = ('ListNumberVisibleAction',
40 'SelectListReloadAction',
41 'SelectThreadReloadAction',
43 'SelectReservAction');
44 //
\83u
\83\89\83E
\83U
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
45 DEF_BROWSER: array[0..16] of string = ('BrowserMaxAction',
65 ///
\83{
\83^
\83\93\83X
\83^
\83C
\83\8b\82ª"tbsCheck"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
66 CHECK_STYLE: array[0..35] of string = ('CabinetVisibleAction',
74 'StdToolBarVisibleAction',
75 'AddressBarVisibleAction',
76 'LinkBarVisibleAction',
77 'ListToolBarVisibleAction',
78 'ListNameBarVisibleAction',
79 'BrowserToolBarVisibleAction',
80 'BrowserNameBarVisibleAction',
81 'MsgBarVisibleAction',
82 'StatusBarVisibleAction',
83 'CabinetHistoryAction',
84 'CabinetFavoriteAction',
89 'BrowserTabVisibleAction',
90 'BrowserTabTopAction',
91 'BrowserTabBottomAction',
92 'BrowserTabTabStyleAction',
93 'BrowserTabButtonStyleAction',
94 'BrowserTabFlatStyleAction',
96 'ListNumberVisibleAction',
99 'OnlyAHundredResAction',
105 ///
\83{
\83^
\83\93\82Ì
\83X
\83^
\83C
\83\8b\82ª"tbsDropDown"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
106 /// Giko.pas : SetToolBarPopup
\82à
\8fC
\90³
\82·
\82é
\8e\96
107 DROPDOWN_STYLE: array[0..4] of string = ('IconStyle',
111 'ThreadRangeAction');
113 INI_FILENAME: string = 'ToolBar.ini';
115 //
\8bæ
\90Ø
\82è
\95¶
\8e\9a
116 SEPARATOR_TEXT = '-
\8bæ
\90Ø
\82è -';
118 function IsCheckStyle(Action: TCustomAction): Boolean;
119 function IsDropDownStyle(Action: TCustomAction): Boolean;
120 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
121 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
122 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
123 procedure SaveToolBarSetting(ToolBar: TToolBar);
124 procedure MakeDefaultINIFile();
127 function ConvertToolButton( setting : string ) : string;
130 //
\8b\8c [
\8dÅ
\90V100
\83\8c\83X
\82Ì
\82Ý
\95\
\8e¦]
\82ð [
\83\8c\83X
\82Ì
\95\
\8e¦
\94Í
\88Í
\82ð
\90Ý
\92è]
\82É
\92u
\8a·
131 if setting = 'OnlyAHundredRes' then
132 Result := 'ResRangeAction'
138 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
144 Action: TCustomAction;
145 ToolButton: TToolButton;
147 FileName := GikoSys.GetConfigDir + INI_FILENAME;
148 if FileExists(FileName) then begin
149 for i := ToolBar.ButtonCount - 1 downto 0 do begin
150 ToolBar.RemoveControl(ToolBar.Buttons[i]);
152 ini := TMemIniFile.Create(FileName);
156 s := ini.ReadString(ToolBar.Name, 'Button' + IntToStr(i), '');
157 s := ConvertToolButton( s );
158 if s = '-' then begin
159 ToolButton := TToolButton.Create(ToolBar);
160 ToolButton.Style := tbsSeparator;
161 ToolButton.Width := 8;
162 ToolButton.Left := 10000;
163 ToolBar.InsertControl(ToolButton);
164 end else if s <> '' then begin
165 Action := GetActionItem(ActionList, s);
166 if Action <> nil then begin
167 ToolButton := TToolButton.Create(ToolBar);
168 ToolButton.Action := Action;
169 if ToolButton.ImageIndex = -1 then
170 ToolButton.ImageIndex := 51;
172 ToolButton.Left := 10000;
173 SetButtonStyle(Action, ToolButton);
174 ToolBar.InsertControl(ToolButton);
186 procedure SaveToolBarSetting(ToolBar: TToolBar);
190 Action: TBasicAction;
192 ini := TMemIniFile.Create(GikoSys.GetConfigDir + INI_FILENAME);
195 ini.EraseSection(ToolBar.Name);
196 for i := 0 to ToolBar.ButtonCount - 1 do begin
197 if ToolBar.Buttons[i].Style = tbsSeparator then begin
198 //SelectComboBox
\97p
\82Ì
\83_
\83~
\81[
\82Í
\95Û
\91¶
\82µ
\82È
\82¢
199 if not (ToolBar.Buttons[i].Name = 'SelectComboBoxDummy') then begin
200 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), '-');
204 Action := ToolBar.Buttons[i].Action;
205 if Action <> nil then
207 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), Action.Name);
218 //ActionName
\82ÌAction
\82ð
\95Ô
\82µ
\82Ü
\82·
219 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
223 for i := 0 to ActionList.ActionCount - 1 do begin
224 if ActionList.Actions[i].Name = ActionName then begin
225 Result := TCustomAction(ActionList.Actions[i]);
232 //
\83c
\81[
\83\8b\83{
\83^
\83\93\82Ì
\83X
\83^
\83C
\83\8b\90Ý
\92è
\82Æ
\83|
\83b
\83v
\83A
\83b
\83v
\90Ý
\92è
233 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
235 if IsCheckStyle(Action) then
236 Button.Style := tbsCheck
237 else if IsDropDownStyle(Action) then
238 Button.Style := tbsDropDown
240 Button.Style := tbsButton;
243 //Action
\82ª
\83`
\83F
\83b
\83N
\83X
\83^
\83C
\83\8b\82Ì
\83A
\83N
\83V
\83\87\83\93\82©
\82Ç
\82¤
\82©
\82ð
\95Ô
\82µ
\82Ü
\82·
244 function IsCheckStyle(Action: TCustomAction): Boolean;
248 for i := 0 to Length(CHECK_STYLE) - 1 do begin
249 if Action.Name = CHECK_STYLE[i] then begin
257 //Action
\82ª
\83h
\83\8d\83b
\83v
\83_
\83E
\83\93\83X
\83^
\83C
\83\8b\82Ì
\83A
\83N
\83V
\83\87\83\93\82©
\82Ç
\82¤
\82©
\82ð
\95Ô
\82µ
\82Ü
\82·
258 function IsDropDownStyle(Action: TCustomAction): Boolean;
262 for i := 0 to Length(DROPDOWN_STYLE) - 1 do begin
263 if Action.Name = DROPDOWN_STYLE[i] then begin
271 procedure MakeDefaultINIFile();
276 //
\95W
\8f\80\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
278 //
\83\8a\83X
\83g
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
280 //
\83u
\83\89\83E
\83U
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
282 if not FileExists(GikoSys.GetConfigDir + INI_FILENAME) then begin
283 ini := TMemIniFile.Create(GikoSys.GetConfigDir + INI_FILENAME);
285 for i := 0 to Length(DEF_STANDARD) - 1 do begin
286 if DEF_STANDARD[i] <> '' then
287 ini.WriteString('StdToolBar', 'Button' + IntToStr(i), DEF_STANDARD[i])
289 ini.WriteString('StdToolBar', 'Button' + IntToStr(i), '-');
291 for i := 0 to Length(DEF_LIST) - 1 do begin
292 if DEF_LIST[i] <> '' then
293 ini.WriteString('ListToolBar', 'Button' + IntToStr(i), DEF_LIST[i])
295 ini.WriteString('ListToolBar', 'Button' + IntToStr(i), '-');
297 for i := 0 to Length(DEF_BROWSER) - 1 do begin
298 if DEF_BROWSER[i] <> '' then
299 ini.WriteString('BrowserToolBar', 'Button' + IntToStr(i), DEF_BROWSER[i])
301 ini.WriteString('BrowserToolBar', 'Button' + IntToStr(i), '-');