6 Windows, Messages, SysUtils, Classes, Controls,
7 StdCtrls, ExtCtrls, ComCtrls, ActnList;
10 //
\95W
\8f\80\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
11 DEF_STANDARD: array[0..11] of string = ('RoundAction',
19 'CabinetHistoryAction',
20 'CabinetFavoriteAction',
23 //
\83\8a\83X
\83g
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
24 DEF_LIST: array[0..18] of string = ('ListNumberVisibleAction',
39 'SelectListReloadAction',
40 'SelectThreadReloadAction',
42 'SelectReservAction');
43 //
\83u
\83\89\83E
\83U
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
44 DEF_BROWSER: array[0..16] of string = ('BrowserMaxAction',
64 ///
\83{
\83^
\83\93\83X
\83^
\83C
\83\8b\82ª"tbsCheck"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
65 CHECK_STYLE: array[0..37] of string = ('CabinetVisibleAction',
75 'StdToolBarVisibleAction',
76 'AddressBarVisibleAction',
77 'LinkBarVisibleAction',
78 'ListToolBarVisibleAction',
79 'ListNameBarVisibleAction',
80 'BrowserToolBarVisibleAction',
81 'BrowserNameBarVisibleAction',
82 'MsgBarVisibleAction',
83 'StatusBarVisibleAction',
84 'CabinetHistoryAction',
85 'CabinetFavoriteAction',
90 'BrowserTabVisibleAction',
91 'BrowserTabTopAction',
92 'BrowserTabBottomAction',
93 'BrowserTabTabStyleAction',
94 'BrowserTabButtonStyleAction',
95 'BrowserTabFlatStyleAction',
97 'ListNumberVisibleAction',
100 'OnlyAHundredResAction',
106 ///
\83{
\83^
\83\93\82Ì
\83X
\83^
\83C
\83\8b\82ª"tbsDropDown"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
107 /// Giko.pas : SetToolBarPopup
\82à
\8fC
\90³
\82·
\82é
\8e\96
108 DROPDOWN_STYLE: array[0..4] of string = ('IconStyle',
112 'ThreadRangeAction');
114 INI_FILENAME: string = 'ToolBar.ini';
116 //
\8bæ
\90Ø
\82è
\95¶
\8e\9a
117 SEPARATOR_TEXT = '-
\8bæ
\90Ø
\82è -';
119 function IsCheckStyle(Action: TCustomAction): Boolean;
120 function IsDropDownStyle(Action: TCustomAction): Boolean;
121 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
122 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
123 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
124 procedure SaveToolBarSetting(ToolBar: TToolBar);
125 procedure MakeDefaultINIFile();
130 IniFiles, GikoSystem, MojuUtils;
132 function ConvertToolButton( setting : string ) : string;
135 //
\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·
136 if setting = 'OnlyAHundredRes' then
137 Result := 'ResRangeAction'
143 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
149 Action: TCustomAction;
150 ToolButton: TToolButton;
152 FileName := GikoSys.GetConfigDir + INI_FILENAME;
153 if FileExists(FileName) then begin
154 for i := ToolBar.ButtonCount - 1 downto 0 do begin
155 ToolBar.RemoveControl(ToolBar.Buttons[i]);
157 ini := TMemIniFile.Create(FileName);
161 s := ini.ReadString(ToolBar.Name, 'Button' + IntToStr(i), '');
162 s := ConvertToolButton( s );
163 if s = '-' then begin
164 ToolButton := TToolButton.Create(ToolBar);
165 ToolButton.Style := tbsSeparator;
166 ToolButton.Width := 8;
167 ToolButton.Left := 10000;
168 ToolBar.InsertControl(ToolButton);
169 end else if s <> '' then begin
170 Action := GetActionItem(ActionList, s);
171 if Action <> nil then begin
172 ToolButton := TToolButton.Create(ToolBar);
173 ToolButton.Action := Action;
174 if ToolButton.ImageIndex = -1 then
175 ToolButton.ImageIndex := 51;
177 ToolButton.Left := 10000;
178 SetButtonStyle(Action, ToolButton);
179 ToolBar.InsertControl(ToolButton);
191 procedure SaveToolBarSetting(ToolBar: TToolBar);
195 Action: TBasicAction;
197 ini := TMemIniFile.Create(GikoSys.GetConfigDir + INI_FILENAME);
200 ini.EraseSection(ToolBar.Name);
201 for i := 0 to ToolBar.ButtonCount - 1 do begin
202 if ToolBar.Buttons[i].Style = tbsSeparator then begin
203 //SelectComboBox
\97p
\82Ì
\83_
\83~
\81[
\82Í
\95Û
\91¶
\82µ
\82È
\82¢
204 if not (ToolBar.Buttons[i].Name = 'SelectComboBoxDummy') then begin
205 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), '-');
209 Action := ToolBar.Buttons[i].Action;
210 if Action <> nil then
212 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), Action.Name);
223 //ActionName
\82ÌAction
\82ð
\95Ô
\82µ
\82Ü
\82·
224 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
228 for i := 0 to ActionList.ActionCount - 1 do begin
229 if ActionList.Actions[i].Name = ActionName then begin
230 Result := TCustomAction(ActionList.Actions[i]);
237 //
\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è
238 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
240 if IsCheckStyle(Action) then
241 Button.Style := tbsCheck
242 else if IsDropDownStyle(Action) then
243 Button.Style := tbsDropDown
245 Button.Style := tbsButton;
248 //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·
249 function IsCheckStyle(Action: TCustomAction): Boolean;
253 for i := 0 to Length(CHECK_STYLE) - 1 do begin
254 if Action.Name = CHECK_STYLE[i] then begin
262 //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·
263 function IsDropDownStyle(Action: TCustomAction): Boolean;
267 for i := 0 to Length(DROPDOWN_STYLE) - 1 do begin
268 if Action.Name = DROPDOWN_STYLE[i] then begin
276 procedure MakeDefaultINIFile();
281 //
\95W
\8f\80\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
283 //
\83\8a\83X
\83g
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
285 //
\83u
\83\89\83E
\83U
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
287 if not FileExists(GikoSys.GetConfigDir + INI_FILENAME) then begin
288 ini := TMemIniFile.Create(GikoSys.GetConfigDir + INI_FILENAME);
290 for i := 0 to Length(DEF_STANDARD) - 1 do begin
291 if DEF_STANDARD[i] <> '' then
292 ini.WriteString('StdToolBar', 'Button' + IntToStr(i), DEF_STANDARD[i])
294 ini.WriteString('StdToolBar', 'Button' + IntToStr(i), '-');
296 for i := 0 to Length(DEF_LIST) - 1 do begin
297 if DEF_LIST[i] <> '' then
298 ini.WriteString('ListToolBar', 'Button' + IntToStr(i), DEF_LIST[i])
300 ini.WriteString('ListToolBar', 'Button' + IntToStr(i), '-');
302 for i := 0 to Length(DEF_BROWSER) - 1 do begin
303 if DEF_BROWSER[i] <> '' then
304 ini.WriteString('BrowserToolBar', 'Button' + IntToStr(i), DEF_BROWSER[i])
306 ini.WriteString('BrowserToolBar', 'Button' + IntToStr(i), '-');