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..16] of string = ('ListNumberVisibleAction',
38 'SelectListReloadAction',
39 'SelectThreadReloadAction',
41 'SelectReservAction');
42 //
\83u
\83\89\83E
\83U
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
43 DEF_BROWSER: array[0..16] of string = ('BrowserMaxAction',
63 ///
\83{
\83^
\83\93\83X
\83^
\83C
\83\8b\82ª"tbsCheck"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
64 CHECK_STYLE: array[0..35] of string = ('CabinetVisibleAction',
72 'StdToolBarVisibleAction',
73 'AddressBarVisibleAction',
74 'LinkBarVisibleAction',
75 'ListToolBarVisibleAction',
76 'ListNameBarVisibleAction',
77 'BrowserToolBarVisibleAction',
78 'BrowserNameBarVisibleAction',
79 'MsgBarVisibleAction',
80 'StatusBarVisibleAction',
81 'CabinetHistoryAction',
82 'CabinetFavoriteAction',
87 'BrowserTabVisibleAction',
88 'BrowserTabTopAction',
89 'BrowserTabBottomAction',
90 'BrowserTabTabStyleAction',
91 'BrowserTabButtonStyleAction',
92 'BrowserTabFlatStyleAction',
94 'ListNumberVisibleAction',
97 'OnlyAHundredResAction',
103 ///
\83{
\83^
\83\93\82Ì
\83X
\83^
\83C
\83\8b\82ª"tbsDropDown"
\83{
\83^
\83\93\82Ì
\83A
\83N
\83V
\83\87\83\93
104 /// Giko.pas : SetToolBarPopup
\82à
\8fC
\90³
\82·
\82é
\8e\96
105 DROPDOWN_STYLE: array[0..4] of string = ('IconStyle',
109 'ThreadRangeAction');
111 INI_FILENAME: string = 'ToolBar.ini';
113 //
\8bæ
\90Ø
\82è
\95¶
\8e\9a
114 SEPARATOR_TEXT = '-
\8bæ
\90Ø
\82è -';
116 function IsCheckStyle(Action: TCustomAction): Boolean;
117 function IsDropDownStyle(Action: TCustomAction): Boolean;
118 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
119 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
120 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
121 procedure SaveToolBarSetting(ToolBar: TToolBar);
122 procedure MakeDefaultINIFile();
125 function ConvertToolButton( setting : string ) : string;
128 //
\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·
129 if setting = 'OnlyAHundredRes' then
130 Result := 'ResRangeAction'
136 procedure ReadToolBarSetting(ActionList: TActionList; ToolBar: TToolBar);
142 Action: TCustomAction;
143 ToolButton: TToolButton;
145 FileName := GikoSys.GetConfigDir + INI_FILENAME;
146 if FileExists(FileName) then begin
147 for i := ToolBar.ButtonCount - 1 downto 0 do begin
148 ToolBar.RemoveControl(ToolBar.Buttons[i]);
150 ini := TMemIniFile.Create(FileName);
154 s := ini.ReadString(ToolBar.Name, 'Button' + IntToStr(i), '');
155 s := ConvertToolButton( s );
156 if s = '-' then begin
157 ToolButton := TToolButton.Create(ToolBar);
158 ToolButton.Style := tbsSeparator;
159 ToolButton.Width := 8;
160 ToolButton.Left := 10000;
161 ToolBar.InsertControl(ToolButton);
162 end else if s <> '' then begin
163 Action := GetActionItem(ActionList, s);
164 if Action <> nil then begin
165 ToolButton := TToolButton.Create(ToolBar);
166 ToolButton.Action := Action;
167 if ToolButton.ImageIndex = -1 then
168 ToolButton.ImageIndex := 51;
170 ToolButton.Left := 10000;
171 SetButtonStyle(Action, ToolButton);
172 ToolBar.InsertControl(ToolButton);
184 procedure SaveToolBarSetting(ToolBar: TToolBar);
188 Action: TBasicAction;
190 ini := TMemIniFile.Create(GikoSys.GetConfigDir + INI_FILENAME);
193 ini.EraseSection(ToolBar.Name);
194 for i := 0 to ToolBar.ButtonCount - 1 do begin
195 if ToolBar.Buttons[i].Style = tbsSeparator then begin
196 //SelectComboBox
\97p
\82Ì
\83_
\83~
\81[
\82Í
\95Û
\91¶
\82µ
\82È
\82¢
197 if not (ToolBar.Buttons[i].Name = 'SelectComboBoxDummy') then begin
198 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), '-');
202 Action := ToolBar.Buttons[i].Action;
203 if Action <> nil then
205 ini.WriteString(ToolBar.Name, 'Button' + IntToStr(j), Action.Name);
216 //ActionName
\82ÌAction
\82ð
\95Ô
\82µ
\82Ü
\82·
217 function GetActionItem(ActionList: TActionList; ActionName: string): TCustomAction;
221 for i := 0 to ActionList.ActionCount - 1 do begin
222 if ActionList.Actions[i].Name = ActionName then begin
223 Result := TCustomAction(ActionList.Actions[i]);
230 //
\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è
231 procedure SetButtonStyle(Action: TCustomAction; Button: TToolButton);
233 if IsCheckStyle(Action) then
234 Button.Style := tbsCheck
235 else if IsDropDownStyle(Action) then
236 Button.Style := tbsDropDown
238 Button.Style := tbsButton;
241 //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·
242 function IsCheckStyle(Action: TCustomAction): Boolean;
246 for i := 0 to Length(CHECK_STYLE) - 1 do begin
247 if Action.Name = CHECK_STYLE[i] then begin
255 //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·
256 function IsDropDownStyle(Action: TCustomAction): Boolean;
260 for i := 0 to Length(DROPDOWN_STYLE) - 1 do begin
261 if Action.Name = DROPDOWN_STYLE[i] then begin
269 procedure MakeDefaultINIFile();
274 //
\95W
\8f\80\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
276 //
\83\8a\83X
\83g
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
278 //
\83u
\83\89\83E
\83U
\83c
\81[
\83\8b\83o
\81[
\83f
\83t
\83H
\83\8b\83g
280 if not FileExists(GikoSys.GetConfigDir + INI_FILENAME) then begin
281 ini := TMemIniFile.Create(GikoSys.GetConfigDir + INI_FILENAME);
283 for i := 0 to Length(DEF_STANDARD) - 1 do begin
284 if DEF_STANDARD[i] <> '' then
285 ini.WriteString('StdToolBar', 'Button' + IntToStr(i), DEF_STANDARD[i])
287 ini.WriteString('StdToolBar', 'Button' + IntToStr(i), '-');
289 for i := 0 to Length(DEF_LIST) - 1 do begin
290 if DEF_LIST[i] <> '' then
291 ini.WriteString('ListToolBar', 'Button' + IntToStr(i), DEF_LIST[i])
293 ini.WriteString('ListToolBar', 'Button' + IntToStr(i), '-');
295 for i := 0 to Length(DEF_BROWSER) - 1 do begin
296 if DEF_BROWSER[i] <> '' then
297 ini.WriteString('BrowserToolBar', 'Button' + IntToStr(i), DEF_BROWSER[i])
299 ini.WriteString('BrowserToolBar', 'Button' + IntToStr(i), '-');