mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-26 11:22:00 +01:00
* Patch from wp to improve mrumenu (long delayed)
git-svn-id: trunk@51210 -
This commit is contained in:
parent
76243ff0f4
commit
8663e9c084
@ -4,7 +4,7 @@ object Form1: TForm1
|
|||||||
Top = 281
|
Top = 281
|
||||||
Width = 320
|
Width = 320
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 218
|
ClientHeight = 220
|
||||||
ClientWidth = 320
|
ClientWidth = 320
|
||||||
Menu = MainMenu1
|
Menu = MainMenu1
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
@ -12,12 +12,31 @@ object Form1: TForm1
|
|||||||
LCLVersion = '0.9.31'
|
LCLVersion = '0.9.31'
|
||||||
object PCFiles: TPageControl
|
object PCFiles: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 218
|
Height = 196
|
||||||
Top = 0
|
Top = 24
|
||||||
Width = 320
|
Width = 320
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
|
object ToolBar1: TToolBar
|
||||||
|
Left = 0
|
||||||
|
Height = 24
|
||||||
|
Top = 0
|
||||||
|
Width = 320
|
||||||
|
AutoSize = True
|
||||||
|
Caption = 'ToolBar1'
|
||||||
|
Images = ImageList1
|
||||||
|
TabOrder = 1
|
||||||
|
object ToolButton1: TToolButton
|
||||||
|
Left = 1
|
||||||
|
Top = 2
|
||||||
|
Caption = 'ToolButton1'
|
||||||
|
DropdownMenu = PopupMenu1
|
||||||
|
ImageIndex = 0
|
||||||
|
OnClick = ToolButton1Click
|
||||||
|
Style = tbsDropDown
|
||||||
|
end
|
||||||
|
end
|
||||||
object MainMenu1: TMainMenu
|
object MainMenu1: TMainMenu
|
||||||
left = 57
|
left = 57
|
||||||
top = 37
|
top = 37
|
||||||
@ -54,13 +73,6 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object MRUMenuManager1: TMRUMenuManager
|
|
||||||
MaxRecent = 5
|
|
||||||
MenuItem = MIRecent
|
|
||||||
OnRecentFile = MRUMenuManager1RecentFile
|
|
||||||
left = 176
|
|
||||||
top = 40
|
|
||||||
end
|
|
||||||
object ODFile: TOpenDialog
|
object ODFile: TOpenDialog
|
||||||
DefaultExt = '.txt'
|
DefaultExt = '.txt'
|
||||||
Filter = 'Text files|*.txt|All files|*.*'
|
Filter = 'Text files|*.txt|All files|*.*'
|
||||||
@ -75,4 +87,47 @@ object Form1: TForm1
|
|||||||
left = 121
|
left = 121
|
||||||
top = 115
|
top = 115
|
||||||
end
|
end
|
||||||
|
object ImageList1: TImageList
|
||||||
|
left = 177
|
||||||
|
top = 53
|
||||||
|
Bitmap = {
|
||||||
|
4C69010000001000000010000000FFFFFF00FFFFFF000088CC610088CC810088
|
||||||
|
CC810088CC810088CC810088CC810088CC810088CC810088CC810088CC810088
|
||||||
|
CC810088CC610087CB00FFFFFF00FFFFFF00FFFFFF000087CA8388DCF4FF60C0
|
||||||
|
E9FF5FBFEAFF80D3F4FF9CE3FDFFA2E6FFFFA2E6FFFFA2E6FFFFA2E6FFFFA6EA
|
||||||
|
FFFF0087CA830087CA00FFFFFF00FFFFFF00FFFFFF000085C885ACF1FFFFABEF
|
||||||
|
FEFF95E2F8FF6EC9EDFF48A8D9FF98DCFEFF98DCFEFF98DCFEFF98DCFEFFA1E5
|
||||||
|
FFFF0085C8850085C800FFFFFF00FFFFFF00FFFFFF000084C587A9EEFDFFA4E9
|
||||||
|
FCFFA4E9FCFFAAEEFDFF42A1D1FF97DBFDFF97DBFDFF97DBFDFF97DBFDFF9FE3
|
||||||
|
FEFF0084C5870084C500FFFFFF00FFFFFF00FFFFFF000082C28AA6EBFCFFA1E6
|
||||||
|
FBFFA1E6FBFFA6EBFCFF3C9DCFFF96DAFCFF96DAFCFF96DAFCFF96DAFCFF9EE2
|
||||||
|
FDFF0082C28A0082C200FFFFFF00FFFFFF00FFFFFF00007FBF8DA3E8FBFF9DE3
|
||||||
|
F9FF9DE3F9FFA3E8FBFF3594C5FF94D8FAFF94D8FAFF94D8FAFF94D8FAFF9BDF
|
||||||
|
FCFF007FBF8D007FBE00FFFFFF00FFFFFF00FFFFFF00007DBB909EE5F9FF98DF
|
||||||
|
F6FF98DFF6FF9EE5F9FF3290C0FF92D6F8FF92D6F8FF92D6F8FF92D6F8FF99DD
|
||||||
|
FAFF007DBB90007DBB33FFFFFF00FFFFFF00FFFFFF00007BB8949BE1F7FF94DB
|
||||||
|
F4FF94DBF4FF9BE1F7FF308DBCFF90D4F6FF90D4F6FF90D4F6FF90D4F6FF97DB
|
||||||
|
F9FFFEFEFDFF007BB894FFFFFF00FFFFFF00FFFFFF000078B49797DEF6FF90D8
|
||||||
|
F2FF90D8F2FF97DEF6FF2D89B7FF8FD3F5FF8FD3F5FF8FD3F5FF8FD3F5FF95D9
|
||||||
|
F8FFF5F5EEFF0078B497FFFFFF00FFFFFF00FFFFFF000076B09B92DAF4FF8BD4
|
||||||
|
F0FF8BD4F0FF92DAF4FF2B85B3FF8DD1F3FF8DD1F3FF8DD1F3FF8DD1F3FF93D7
|
||||||
|
F6FFEBEBDDFF0076B09BFFFFFF00FFFFFF00FFFFFF000073AC9E8ED6F2FF87D0
|
||||||
|
EDFF87D0EDFF8ED6F2FF2882AFFF8BCFF1FF8BCFF1FF8BCFF1FF8BCFF1FF91D5
|
||||||
|
F5FFFEC941FF0073AC9EFFFFFF00FFFFFF00FFFFFF00006FA7A48AD3F0FF82CD
|
||||||
|
EBFF82CDEBFF8AD3F0FF267EABFF8ACEF0FF8ACEF0FF8ACEF0FF8ACEF0FF8FD3
|
||||||
|
F4FFF4B62EFF006FA7A4FFFFFF00FFFFFF00FFFFFF00006699B287D1EFFF7FCA
|
||||||
|
E9FF7FCAE9FF87D0EFFF267DA9FF8DD1F3FF8DD1F3FF8DD1F3FF8DD1F3FF90D4
|
||||||
|
F5FF006699B200679B3EFFFFFF00FFFFFF00FFFFFF00005E8D8E3591BDF169B8
|
||||||
|
DDFA81CBECFF84CEEEFF005C8BEF005D8CBE005D8CBE005D8CBE005D8CBE005D
|
||||||
|
8CBE005E8D8E00669900FFFFFF00FFFFFF00FFFFFF00005D8C00006599500064
|
||||||
|
97991C7AA9C052A5CDE0005B89C1005B8900005B8900005B8900005B8900005B
|
||||||
|
8900005D8C0000669900FFFFFF00FFFFFF00FFFFFF00005D8C00006497000062
|
||||||
|
9300005E8E30005C8C7C0059879200598700005B8900005B8900005B8900005B
|
||||||
|
8900005D8C0000669900FFFFFF00
|
||||||
|
}
|
||||||
|
end
|
||||||
|
object PopupMenu1: TPopupMenu
|
||||||
|
left = 207
|
||||||
|
top = 133
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -17,6 +17,7 @@ Type
|
|||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
|
ImageList1: TImageList;
|
||||||
MainMenu1: TMainMenu;
|
MainMenu1: TMainMenu;
|
||||||
MIRecent: TMenuItem;
|
MIRecent: TMenuItem;
|
||||||
MenuItem2: TMenuItem;
|
MenuItem2: TMenuItem;
|
||||||
@ -26,10 +27,12 @@ Type
|
|||||||
MIOpen: TMenuItem;
|
MIOpen: TMenuItem;
|
||||||
MINew: TMenuItem;
|
MINew: TMenuItem;
|
||||||
MFile: TMenuItem;
|
MFile: TMenuItem;
|
||||||
MRUMenuManager1: TMRUMenuManager;
|
|
||||||
ODFile: TOpenDialog;
|
ODFile: TOpenDialog;
|
||||||
PCFiles: TPageControl;
|
PCFiles: TPageControl;
|
||||||
|
PopupMenu1: TPopupMenu;
|
||||||
SDFile: TSaveDialog;
|
SDFile: TSaveDialog;
|
||||||
|
ToolBar1: TToolBar;
|
||||||
|
ToolButton1: TToolButton;
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure MINewClick(Sender: TObject);
|
procedure MINewClick(Sender: TObject);
|
||||||
@ -38,7 +41,9 @@ Type
|
|||||||
procedure MISaveClick(Sender: TObject);
|
procedure MISaveClick(Sender: TObject);
|
||||||
procedure MRUMenuManager1RecentFile(Sender: TObject; const AFileName: String
|
procedure MRUMenuManager1RecentFile(Sender: TObject; const AFileName: String
|
||||||
);
|
);
|
||||||
|
procedure ToolButton1Click(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
MRUMenuManager1: TMRUMenuManager;
|
||||||
function CurrentFileName: string;
|
function CurrentFileName: string;
|
||||||
procedure OpenFile(AFileName: String);
|
procedure OpenFile(AFileName: String);
|
||||||
procedure SaveFile(const AFileName: String);
|
procedure SaveFile(const AFileName: String);
|
||||||
@ -78,6 +83,12 @@ begin
|
|||||||
OpenFile(AFileName);
|
OpenFile(AFileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.ToolButton1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
If ODFIle.Execute then
|
||||||
|
OpenFile(ODFile.FileName);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.SaveFile(Const AFileName : String);
|
procedure TForm1.SaveFile(Const AFileName : String);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
@ -120,12 +131,22 @@ end;
|
|||||||
|
|
||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MRUMenuManager1.LoadRecentFilesFromIni;
|
MRUMenuManager1 := TMRUMenuManager.Create(self);
|
||||||
|
with MRUMenuManager1 do begin
|
||||||
|
maxRecent := 5;
|
||||||
|
IniFileName := ChangeFileExt(ParamStr(0), '.ini');
|
||||||
|
MenuItem := MIRecent;
|
||||||
|
PopupMenu := PopupMenu1;
|
||||||
|
MaxItemLength := 80;
|
||||||
|
MenuCaptionMask := '(%d) %s';
|
||||||
|
OnRecentFile := @MRUMenuManager1RecentFile;
|
||||||
|
// LoadRecentFilesFromIni;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormDestroy(Sender: TObject);
|
procedure TForm1.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MRUMenuManager1.SaveRecentFilesToIni;
|
// MRUMenuManager1.SaveRecentFilesToIni;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -29,24 +29,26 @@
|
|||||||
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="3">
|
<RequiredPackages Count="2">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="lazmrumenu"/>
|
|
||||||
</Item1>
|
|
||||||
<Item2>
|
|
||||||
<PackageName Value="LCLBase"/>
|
<PackageName Value="LCLBase"/>
|
||||||
<MinVersion Valid="True"/>
|
<MinVersion Valid="True"/>
|
||||||
</Item2>
|
</Item1>
|
||||||
<Item3>
|
<Item2>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item3>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="7">
|
<Units Count="19">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="mrudemo.lpr"/>
|
<Filename Value="mrudemo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="mrudemo"/>
|
<UnitName Value="mrudemo"/>
|
||||||
<UsageCount Value="22"/>
|
<EditorIndex Value="4"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<CursorPos X="1" Y="14"/>
|
||||||
|
<UsageCount Value="26"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="frmmain.pp"/>
|
||||||
@ -56,9 +58,9 @@
|
|||||||
<UnitName Value="frmmain"/>
|
<UnitName Value="frmmain"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="124"/>
|
<TopLine Value="127"/>
|
||||||
<CursorPos X="44" Y="138"/>
|
<CursorPos X="39" Y="133"/>
|
||||||
<UsageCount Value="22"/>
|
<UsageCount Value="26"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
@ -66,31 +68,27 @@
|
|||||||
<Filename Value="../mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<UnitName Value="mrumanager"/>
|
<UnitName Value="mrumanager"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="3"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="53"/>
|
||||||
<CursorPos X="1" Y="14"/>
|
<CursorPos X="1" Y="93"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="12"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="../regmru.lrs"/>
|
<Filename Value="../regmru.lrs"/>
|
||||||
<EditorIndex Value="4"/>
|
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="17" Y="1"/>
|
<CursorPos X="17" Y="1"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="11"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="../reglazmru.pp"/>
|
<Filename Value="../reglazmru.pp"/>
|
||||||
<UnitName Value="reglazmru"/>
|
<UnitName Value="reglazmru"/>
|
||||||
<EditorIndex Value="3"/>
|
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="44" Y="8"/>
|
<CursorPos X="44" Y="8"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="11"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/demo/frmmain.pp"/>
|
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/demo/frmmain.pp"/>
|
||||||
@ -103,92 +101,253 @@
|
|||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/mrumanager.pp"/>
|
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/mrumanager.pp"/>
|
||||||
<UnitName Value="mrumanager"/>
|
<UnitName Value="mrumanager"/>
|
||||||
<EditorIndex Value="1"/>
|
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="85"/>
|
<TopLine Value="85"/>
|
||||||
<CursorPos X="1" Y="113"/>
|
<CursorPos X="1" Y="113"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="11"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit6>
|
</Unit6>
|
||||||
|
<Unit7>
|
||||||
|
<Filename Value="../../../../lazarus/lcl/include/control.inc"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="3200"/>
|
||||||
|
<CursorPos X="53" Y="3216"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit7>
|
||||||
|
<Unit8>
|
||||||
|
<Filename Value="../../../../lazarus/lcl/filectrl.pp"/>
|
||||||
|
<UnitName Value="FileCtrl"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="215"/>
|
||||||
|
<CursorPos X="17" Y="240"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
</Unit8>
|
||||||
|
<Unit9>
|
||||||
|
<Filename Value="../../../../lazarus/lcl/menus.pp"/>
|
||||||
|
<UnitName Value="Menus"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="106"/>
|
||||||
|
<CursorPos X="34" Y="38"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
</Unit9>
|
||||||
|
<Unit10>
|
||||||
|
<Filename Value="../../../../lazarus/lcl/graphics.pp"/>
|
||||||
|
<UnitName Value="Graphics"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<CursorPos X="1" Y="1"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
</Unit10>
|
||||||
|
<Unit11>
|
||||||
|
<Filename Value="../../../../lazarus/fpc/2.5.1/source/rtl/objpas/sysutils/sysutilh.inc"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="234"/>
|
||||||
|
<CursorPos X="47" Y="237"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit11>
|
||||||
|
<Unit12>
|
||||||
|
<Filename Value="../../../../lazarus/fpc/2.5.1/source/rtl/win32/system.pp"/>
|
||||||
|
<UnitName Value="System"/>
|
||||||
|
<EditorIndex Value="2"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="23"/>
|
||||||
|
<CursorPos X="2" Y="41"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit12>
|
||||||
|
<Unit13>
|
||||||
|
<Filename Value="../../../../lazarus/fpc/2.5.1/source/packages/fcl-fpcunit/src/digesttestreport.pp"/>
|
||||||
|
<UnitName Value="DigestTestReport"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="142"/>
|
||||||
|
<CursorPos X="10" Y="157"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
</Unit13>
|
||||||
|
<Unit14>
|
||||||
|
<Filename Value="../../../../lazarus/fpc/2.5.1/source/rtl/netware/nwnit.pp"/>
|
||||||
|
<UnitName Value="nwnit"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="850"/>
|
||||||
|
<CursorPos X="12" Y="865"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
</Unit14>
|
||||||
|
<Unit15>
|
||||||
|
<Filename Value="../../../../lazarus/fpc/2.5.1/source/rtl/netware/nwserv.pp"/>
|
||||||
|
<UnitName Value="nwserv"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="2093"/>
|
||||||
|
<CursorPos X="12" Y="2108"/>
|
||||||
|
<UsageCount Value="11"/>
|
||||||
|
</Unit15>
|
||||||
|
<Unit16>
|
||||||
|
<Filename Value="../../../../lazarus/fpc/2.5.1/source/rtl/objpas/sysutils/sysstrh.inc"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="116"/>
|
||||||
|
<CursorPos X="10" Y="131"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit16>
|
||||||
|
<Unit17>
|
||||||
|
<Filename Value="../../../../lazarus/fpc/2.5.1/source/rtl/objpas/sysutils/sysstr.inc"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="904"/>
|
||||||
|
<CursorPos X="30" Y="904"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit17>
|
||||||
|
<Unit18>
|
||||||
|
<Filename Value="../lazmrumenu.pas"/>
|
||||||
|
<UnitName Value="lazmrumenu"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<CursorPos X="1" Y="1"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit18>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="16" HistoryIndex="15">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="84" Column="37" TopLine="68"/>
|
<Caret Line="100" Column="24" TopLine="73"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="94" Column="21" TopLine="76"/>
|
<Caret Line="253" Column="3" TopLine="246"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="103" Column="21" TopLine="86"/>
|
<Caret Line="98" Column="15" TopLine="85"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="93" Column="10" TopLine="85"/>
|
<Caret Line="204" Column="3" TopLine="197"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="115" Column="41" TopLine="111"/>
|
<Caret Line="91" Column="15" TopLine="83"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="128" Column="36" TopLine="122"/>
|
<Caret Line="314" Column="3" TopLine="307"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="148" Column="21" TopLine="124"/>
|
<Caret Line="86" Column="27" TopLine="79"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="101" Column="1" TopLine="84"/>
|
<Caret Line="229" Column="3" TopLine="229"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="102" Column="1" TopLine="84"/>
|
<Caret Line="76" Column="1" TopLine="76"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="103" Column="1" TopLine="84"/>
|
<Caret Line="243" Column="25" TopLine="223"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="105" Column="1" TopLine="84"/>
|
<Caret Line="88" Column="14" TopLine="71"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="/data/wisa/projects/fpcpackages/wisawebdb/menueditor/mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="106" Column="1" TopLine="84"/>
|
<Caret Line="428" Column="36" TopLine="423"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="../mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="69" Column="19" TopLine="54"/>
|
<Caret Line="115" Column="99" TopLine="86"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="../mrumanager.pp"/>
|
<Filename Value="../mrumanager.pp"/>
|
||||||
<Caret Line="283" Column="27" TopLine="279"/>
|
<Caret Line="114" Column="12" TopLine="100"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="../mrumanager.pp"/>
|
<Filename Value="frmmain.pp"/>
|
||||||
<Caret Line="72" Column="89" TopLine="65"/>
|
<Caret Line="48" Column="19" TopLine="25"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="frmmain.pp"/>
|
||||||
<Caret Line="138" Column="44" TopLine="124"/>
|
<Caret Line="161" Column="3" TopLine="133"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
|
<Position17>
|
||||||
|
<Filename Value="frmmain.pp"/>
|
||||||
|
<Caret Line="49" Column="15" TopLine="33"/>
|
||||||
|
</Position17>
|
||||||
|
<Position18>
|
||||||
|
<Filename Value="frmmain.pp"/>
|
||||||
|
<Caret Line="99" Column="17" TopLine="92"/>
|
||||||
|
</Position18>
|
||||||
|
<Position19>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="88" Column="22" TopLine="85"/>
|
||||||
|
</Position19>
|
||||||
|
<Position20>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="425" Column="3" TopLine="423"/>
|
||||||
|
</Position20>
|
||||||
|
<Position21>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="89" Column="17" TopLine="73"/>
|
||||||
|
</Position21>
|
||||||
|
<Position22>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="433" Column="51" TopLine="427"/>
|
||||||
|
</Position22>
|
||||||
|
<Position23>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="89" Column="16" TopLine="74"/>
|
||||||
|
</Position23>
|
||||||
|
<Position24>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="362" Column="76" TopLine="362"/>
|
||||||
|
</Position24>
|
||||||
|
<Position25>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="67" Column="42" TopLine="63"/>
|
||||||
|
</Position25>
|
||||||
|
<Position26>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="312" Column="21" TopLine="298"/>
|
||||||
|
</Position26>
|
||||||
|
<Position27>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="93" Column="15" TopLine="78"/>
|
||||||
|
</Position27>
|
||||||
|
<Position28>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="319" Column="3" TopLine="312"/>
|
||||||
|
</Position28>
|
||||||
|
<Position29>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="66" Column="15" TopLine="63"/>
|
||||||
|
</Position29>
|
||||||
|
<Position30>
|
||||||
|
<Filename Value="../mrumanager.pp"/>
|
||||||
|
<Caret Line="437" Column="1" TopLine="414"/>
|
||||||
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="10"/>
|
<Version Value="10"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<OtherUnitFiles Value=".."/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
<SyntaxOptions>
|
<SyntaxOptions>
|
||||||
<UseAnsiStrings Value="False"/>
|
<UseAnsiStrings Value="False"/>
|
||||||
</SyntaxOptions>
|
</SyntaxOptions>
|
||||||
</Parsing>
|
</Parsing>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="True"/>
|
||||||
|
<DebugInfoType Value="dsAuto"/>
|
||||||
|
<StripSymbols Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<UseMsgFile Value="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
|
|||||||
@ -7,8 +7,7 @@ uses
|
|||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, alllclunits, frmmain, lazmrumenu
|
Forms, alllclunits, frmmain;
|
||||||
{ you can add units after this };
|
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -1,6 +1,7 @@
|
|||||||
{ MRU (Most Recent Used) menu item manager
|
{ MRU (Most Recent Used) menu item manager
|
||||||
|
|
||||||
Copyright (C) 2011 Michael Van Canneyt (michael@freepascal.org)
|
Copyright (C) 2011 Michael Van Canneyt (michael@freepascal.org)
|
||||||
|
Modifications by Werner Pamler
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or modify it
|
This library is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Library General Public License as published by
|
under the terms of the GNU Library General Public License as published by
|
||||||
@ -58,12 +59,20 @@ Type
|
|||||||
FOnRecent: TOnRecentFileEvent;
|
FOnRecent: TOnRecentFileEvent;
|
||||||
FRecent : TStrings;
|
FRecent : TStrings;
|
||||||
FMaxRecent : Integer;
|
FMaxRecent : Integer;
|
||||||
|
FMenuCaptionMask : string;
|
||||||
FMIRecent : TMenuItem;
|
FMIRecent : TMenuItem;
|
||||||
|
FPMRecent : TPopupMenu;
|
||||||
|
FMaxItemLength : integer;
|
||||||
|
procedure SetIniFileName(const AValue:string);
|
||||||
|
procedure SetIniSection(const AValue:string);
|
||||||
|
procedure SetMaxItemLength(const AValue:integer);
|
||||||
|
procedure SetMenuCaptionMask(const AValue:string);
|
||||||
procedure SetMIRecent(const AValue: TMenuItem);
|
procedure SetMIRecent(const AValue: TMenuItem);
|
||||||
|
procedure SetPMRecent(const AValue: TPopupMenu);
|
||||||
procedure SetRecent(const AValue: TStrings);
|
procedure SetRecent(const AValue: TStrings);
|
||||||
protected
|
protected
|
||||||
// Overrides.
|
// Overrides.
|
||||||
procedure loaded; override;
|
procedure Loaded; override;
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
// Return default name and section if either is empty.
|
// Return default name and section if either is empty.
|
||||||
procedure GetFileNameAndSection(Var AFileName,ASection : String); virtual;
|
procedure GetFileNameAndSection(Var AFileName,ASection : String); virtual;
|
||||||
@ -82,6 +91,7 @@ Type
|
|||||||
Constructor Create(AOwner : TComponent);override;
|
Constructor Create(AOwner : TComponent);override;
|
||||||
Destructor Destroy; override;
|
Destructor Destroy; override;
|
||||||
// Load files from ini file AFileName in section ASection. Calls ShowRecentFiles
|
// Load files from ini file AFileName in section ASection. Calls ShowRecentFiles
|
||||||
|
// Need for explicit call only when IniFileName='' and IniSection='' and class created at run-time
|
||||||
procedure LoadRecentFilesFromIni(const AFileName: string=''; const ASection: String='');
|
procedure LoadRecentFilesFromIni(const AFileName: string=''; const ASection: String='');
|
||||||
// Saves files to ini file AFileName in section ASection.
|
// Saves files to ini file AFileName in section ASection.
|
||||||
procedure SaveRecentFilesToIni(const AFileName: string=''; const ASection: String='');
|
procedure SaveRecentFilesToIni(const AFileName: string=''; const ASection: String='');
|
||||||
@ -97,10 +107,16 @@ Type
|
|||||||
Property MaxRecent : Integer Read FMaxRecent write FMaxRecent;
|
Property MaxRecent : Integer Read FMaxRecent write FMaxRecent;
|
||||||
// Menu item to create a submenu under. Existing items will be removed.
|
// Menu item to create a submenu under. Existing items will be removed.
|
||||||
Property MenuItem : TMenuItem Read FMIRecent Write SetMIRecent;
|
Property MenuItem : TMenuItem Read FMIRecent Write SetMIRecent;
|
||||||
|
// Popupmenu attached to a toolbar button. Existing items will be removed.
|
||||||
|
Property PopupMenu : TPopupMenu Read FPMRecent Write SetPMRecent;
|
||||||
// Default ini filename.
|
// Default ini filename.
|
||||||
Property IniFileName : String Read FIniFileName Write FIniFileName;
|
Property IniFileName : String Read FIniFileName Write SetIniFileName;
|
||||||
// Default ini section.
|
// Default ini section.
|
||||||
Property IniSection : String Read FIniSection Write FIniSection;
|
Property IniSection : String Read FIniSection Write SetIniSection;
|
||||||
|
// Maximum length of recent menu item
|
||||||
|
Property MaxItemLength : integer Read FMaxItemLength Write SetMaxItemLength default 80;
|
||||||
|
// Format mask for MenuCaption: first placeholder must be %d, second %s, e.g. '%d - %s'
|
||||||
|
Property MenuCaptionMask : string read FMenuCaptionMask Write SetMenuCaptionMask;
|
||||||
// Recent items. If adding manually to the list, ShowRecentFiles must be called manually.
|
// Recent items. If adding manually to the list, ShowRecentFiles must be called manually.
|
||||||
Property Recent : TStrings Read FRecent Write SetRecent;
|
Property Recent : TStrings Read FRecent Write SetRecent;
|
||||||
// Called when the user clicks an recent meu item.
|
// Called when the user clicks an recent meu item.
|
||||||
@ -120,6 +136,70 @@ implementation
|
|||||||
Resourcestring
|
Resourcestring
|
||||||
SErrFailedToCreateDir = 'Failed to create directory "%s"';
|
SErrFailedToCreateDir = 'Failed to create directory "%s"';
|
||||||
|
|
||||||
|
const
|
||||||
|
DEFAULT_MASK = '%d. %s';
|
||||||
|
|
||||||
|
function MinimizeFileName(const AFileName:string; AMaxLen:integer) : string;
|
||||||
|
|
||||||
|
procedure SplitPath(const APath:String; Parts: TStrings);
|
||||||
|
{ Splits the provided path into constituent folder names }
|
||||||
|
var
|
||||||
|
i, j : Integer;
|
||||||
|
begin
|
||||||
|
if APath = '' then exit;
|
||||||
|
if not Assigned(Parts) then exit;
|
||||||
|
|
||||||
|
i := Length(APath);
|
||||||
|
j := i;
|
||||||
|
while (i >= 1) do begin
|
||||||
|
if APath[i] = DirectorySeparator then begin
|
||||||
|
Parts.Insert(0, copy(APath, i+1, j-i));
|
||||||
|
j := i;
|
||||||
|
end;
|
||||||
|
dec(i);
|
||||||
|
end;
|
||||||
|
Parts.Insert(0, copy(APath, 1, j));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function AddStringsFromTo(AList:TStrings; FromIndex,ToIndex:integer) : string;
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
begin
|
||||||
|
result := '';
|
||||||
|
for i:=FromIndex to ToIndex do
|
||||||
|
result := result + AList[i];
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Parts : TStringList;
|
||||||
|
i : integer;
|
||||||
|
tmp : string;
|
||||||
|
begin
|
||||||
|
result := AFileName;
|
||||||
|
if Length(AFileName) > AMaxLen then begin
|
||||||
|
Parts := TStringList.Create;
|
||||||
|
try
|
||||||
|
SplitPath(AFileName, Parts);
|
||||||
|
i := Parts.Count div 2;
|
||||||
|
while (i < Parts.Count) do begin
|
||||||
|
tmp := Format('%s...%s%s', [
|
||||||
|
AddStringsFromTo(Parts, 0, i-1),
|
||||||
|
DirectorySeparator,
|
||||||
|
AddStringsFromTo(Parts, i+1, Parts.Count-1)
|
||||||
|
]);
|
||||||
|
if Length(tmp) < AMaxLen then begin
|
||||||
|
result := tmp;
|
||||||
|
exit;
|
||||||
|
end else
|
||||||
|
Parts.Delete(i);
|
||||||
|
i := Parts.Count div 2;
|
||||||
|
end;
|
||||||
|
result := ExtractFileName(AFileName);
|
||||||
|
finally
|
||||||
|
Parts.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMRUMenuManager.AddToRecent(AFileName : String);
|
procedure TMRUMenuManager.AddToRecent(AFileName : String);
|
||||||
|
|
||||||
@ -155,8 +235,19 @@ end;
|
|||||||
|
|
||||||
function TMRUMenuManager.CreateMenuCaption(AIndex: Integer;
|
function TMRUMenuManager.CreateMenuCaption(AIndex: Integer;
|
||||||
const AFileName: String): String;
|
const AFileName: String): String;
|
||||||
|
var
|
||||||
|
fn : string;
|
||||||
|
mask : string;
|
||||||
begin
|
begin
|
||||||
Result:=Format('%d. %s',[AIndex+1,AFileName]);
|
if FMaxItemLength > 0 then
|
||||||
|
fn := MinimizeFileName(AFileName, FMaxItemLength)
|
||||||
|
else
|
||||||
|
fn := AFileName;
|
||||||
|
if FMenuCaptionMask = '' then
|
||||||
|
mask := DEFAULT_MASK
|
||||||
|
else
|
||||||
|
mask := FMenuCaptionMask;
|
||||||
|
Result:=Format(mask, [AIndex+1,fn]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMRUMenuManager.ShowRecentFiles;
|
procedure TMRUMenuManager.ShowRecentFiles;
|
||||||
@ -166,17 +257,28 @@ Var
|
|||||||
M : TRecentMenuItem;
|
M : TRecentMenuItem;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Not Assigned(FMIRecent) then
|
if Assigned(FMIRecent) then begin
|
||||||
Exit;
|
FMIRecent.clear;
|
||||||
FMIRecent.clear;
|
For I:=0 to FRecent.Count-1 do
|
||||||
For I:=0 to FRecent.Count-1 do
|
|
||||||
begin
|
begin
|
||||||
M:=CreateMenuItem(Self.Owner);
|
M:=CreateMenuItem(Self.Owner);
|
||||||
M.Caption:=CreateMenuCaption(I,FRecent[i]);
|
M.Caption:=CreateMenuCaption(I,FRecent[i]);
|
||||||
M.FFileName:=FRecent[i];
|
M.FFileName:=FRecent[i];
|
||||||
M.OnClick:=@DoOnRecentClick;
|
M.OnClick:=@DoOnRecentClick;
|
||||||
FMIRecent.Add(M);
|
FMIRecent.Add(M);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
if Assigned(FPMRecent) then begin
|
||||||
|
FPMRecent.Items.Clear;
|
||||||
|
for i:=0 to FRecent.Count-1 do
|
||||||
|
begin
|
||||||
|
M := CreateMenuItem(Self.Owner);
|
||||||
|
M.Caption := CreateMenuCaption(I, Recent[i]);
|
||||||
|
M.FFileName := FRecent[i];
|
||||||
|
M.OnClick := @DoOnRecentClick;
|
||||||
|
FPMRecent.Items.Add(M);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMRUMenuManager.LoadFromIni(Ini : TCustomIniFile; ASection : String);
|
procedure TMRUMenuManager.LoadFromIni(Ini : TCustomIniFile; ASection : String);
|
||||||
@ -269,6 +371,38 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMRUMenuManager.SetIniFileName(const AValue:string);
|
||||||
|
begin
|
||||||
|
if AValue <> FIniFileName then begin
|
||||||
|
FIniFileName := AValue;
|
||||||
|
LoadRecentFilesFromIni(FIniFileName, FIniSection);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMRUMenuManager.SetIniSection(const AValue:string);
|
||||||
|
begin
|
||||||
|
if AValue <> FIniSection then begin
|
||||||
|
FIniSection := AValue;
|
||||||
|
LoadRecentFilesFromini(FIniFileName, FIniSection);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMRUMenuManager.SetMaxItemLength(const AValue:integer);
|
||||||
|
begin
|
||||||
|
if FMaxItemLength <> AValue then begin
|
||||||
|
FMaxItemLength := AValue;
|
||||||
|
ShowRecentFiles;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMRUMenuManager.SetMenuCaptionMask(const AValue:string);
|
||||||
|
begin
|
||||||
|
if FMenuCaptionMask <> AValue then begin
|
||||||
|
FMenuCaptionMask := AValue;
|
||||||
|
ShowRecentFiles;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMRUMenuManager.SetMIRecent(const AValue: TMenuItem);
|
procedure TMRUMenuManager.SetMIRecent(const AValue: TMenuItem);
|
||||||
begin
|
begin
|
||||||
if FMIRecent=AValue then exit;
|
if FMIRecent=AValue then exit;
|
||||||
@ -280,6 +414,17 @@ begin
|
|||||||
ShowRecentFiles;
|
ShowRecentFiles;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMRUMenuManager.SetPMRecent(const AValue: TPopupMenu);
|
||||||
|
begin
|
||||||
|
if FPMRecent=AValue then exit;
|
||||||
|
if Assigned(FPMRecent) then
|
||||||
|
FPMRecent.RemoveFreeNotification(self);
|
||||||
|
FPMRecent := AValue;
|
||||||
|
if Assigned(FPMRecent) then
|
||||||
|
FPMRecent.FreeNotification(self);
|
||||||
|
ShowRecentFiles;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMRUMenuManager.SetRecent(const AValue: TStrings);
|
procedure TMRUMenuManager.SetRecent(const AValue: TStrings);
|
||||||
begin
|
begin
|
||||||
if FRecent=AValue then exit;
|
if FRecent=AValue then exit;
|
||||||
@ -290,19 +435,21 @@ end;
|
|||||||
procedure TMRUMenuManager.loaded;
|
procedure TMRUMenuManager.loaded;
|
||||||
begin
|
begin
|
||||||
inherited loaded;
|
inherited loaded;
|
||||||
if (FRecent.Count>0) and assigned(FMIRecent) then
|
if (FRecent.Count>0) and (assigned(FMIRecent) or assigned(FPMRecent))then
|
||||||
ShowRecentFiles;
|
LoadRecentFilesFromIni(FIniFileName, FIniSection);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
constructor TMRUMenuManager.Create(AOwner: TComponent);
|
constructor TMRUMenuManager.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FRecent:=TStringList.Create;
|
FRecent:=TStringList.Create;
|
||||||
|
FMaxItemLength := 80;
|
||||||
|
FMenuCaptionMask := DEFAULT_MASK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TMRUMenuManager.Destroy;
|
destructor TMRUMenuManager.Destroy;
|
||||||
begin
|
begin
|
||||||
|
SaveRecentFilesToIni(FIniFileName, FIniSection);
|
||||||
FreeAndNil(FRecent);
|
FreeAndNil(FRecent);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -311,15 +458,20 @@ procedure TMRUMenuManager.Notification(AComponent: TComponent;
|
|||||||
Operation: TOperation);
|
Operation: TOperation);
|
||||||
begin
|
begin
|
||||||
inherited Notification(AComponent, Operation);
|
inherited Notification(AComponent, Operation);
|
||||||
if (Operation=opRemove) and (AComponent=FMIrecent) then
|
if (Operation = opRemove) then begin
|
||||||
|
if AComponent = FMIRecent then FMIRecent := nil;
|
||||||
|
if AComponent = FPMRecent then FPMRecent := nil;
|
||||||
|
end;
|
||||||
|
{ original code - I think this is not correct:
|
||||||
|
inherited Notification(AComponent, Operation);
|
||||||
|
if (Operation=opRemove) and ((AComponent=FMIRecent) or (AComponent=FPMRecent)) then
|
||||||
exit;
|
exit;
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMRUMenuManager.DoOnRecentClick(Sender: TObject);
|
procedure TMRUMenuManager.DoOnRecentClick(Sender: TObject);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
FN : String;
|
FN : String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
With (Sender as TRecentMenuItem) do
|
With (Sender as TRecentMenuItem) do
|
||||||
FN:=FileName;
|
FN:=FileName;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user