mirror of https://gitlab.com/basile.b/dexed.git
added support for in session window layout save/load
This commit is contained in:
parent
f162a4f2ed
commit
34804e4541
113
src/ce_main.lfm
113
src/ce_main.lfm
|
@ -1826,14 +1826,17 @@ object CEMainForm: TCEMainForm
|
|||
end
|
||||
end
|
||||
object mnuItemWin: TMenuItem
|
||||
Caption = 'Window'
|
||||
Caption = 'Windows'
|
||||
object mnuLayout: TMenuItem
|
||||
Caption = 'Layout'
|
||||
ImageIndex = 31
|
||||
end
|
||||
end
|
||||
end
|
||||
object Actions: TActionList
|
||||
Images = imgList
|
||||
OnUpdate = ActionsUpdate
|
||||
left = 32
|
||||
top = 1
|
||||
object actEdCopy: TAction
|
||||
Category = 'Edit'
|
||||
Caption = 'Copy'
|
||||
|
@ -2072,11 +2075,17 @@ object CEMainForm: TCEMainForm
|
|||
ImageIndex = 29
|
||||
OnExecute = actProjOpenContFoldExecute
|
||||
end
|
||||
object actLayoutSave: TAction
|
||||
Category = 'Misc'
|
||||
Caption = 'Save layout to...'
|
||||
ImageIndex = 30
|
||||
OnExecute = actLayoutSaveExecute
|
||||
end
|
||||
end
|
||||
object imgList: TImageList
|
||||
left = 64
|
||||
Bitmap = {
|
||||
4C691E0000001000000010000000008F4E00008C4AB000965DFF00935AFF0093
|
||||
4C69210000001000000010000000008F4E00008C4AB000965DFF00935AFF0093
|
||||
59FF009359FF009359FF009359FF009359FF00945AFF008743FF008945FF008A
|
||||
49A8FFFFFF00008F4E00008F4F00008E4E00008A47FF66E2D0FF62DDCAFF62DD
|
||||
C8FF62DDC8FF62DDC8FF62DDC8FF62DDC8FF62DDC9FF61E0CAFF62DEC8FF3ABA
|
||||
|
@ -3036,7 +3045,103 @@ object CEMainForm: TCEMainForm
|
|||
93FFB6A392FFB6A393FFB6A393FFB5A393FFB5A293FFB6A394FFB7A596FFB7A4
|
||||
95FFB7A494FFB7A596FFB7A495F2000000000000003300000033000000330000
|
||||
0033000000330000003300000033000000330000003300000033000000330000
|
||||
0033000000330000003300000030
|
||||
0033000000330000003300000030FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00CE935F71CE935F90CE935FCCCE93
|
||||
5FFFCD935FFECD925FFFCC905FFFCD9261FFCD9363FFCB9161FFCB8E5FEFCA92
|
||||
64CBD8AE8BFFD7AC8BFFFFFFFF00FFFFFF00CE935F9BFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFD6AA89FFFFFFFF00FFFFFF00CE935FD8FFFFFFFFEDC49CFFEDC4
|
||||
9CFFEDC49CFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC4
|
||||
9BFFFFFFFFFFC68C61F8FFFFFF00FFFFFF00CD915FF0FFFFFFFFEDC49CFFF4DA
|
||||
C1FFF4DAC1FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFEDC4
|
||||
9BFFFFFFFFFFC18458FEFFFFFF00FFFFFF00CC905EFAFFFFFFFFEDC49BFFEDC4
|
||||
9BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC4
|
||||
9BFFFFFFFFFFBE8157FFFFFFFF00FFFFFF00CB8E5DFEFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFBC7E55FFFFFFFF00FFFFFF00CA8C5CFFFFFFFFFFBC7F54FFBA7D
|
||||
4CFFBA7C4AFFFFFFFFFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5
|
||||
DEFFFFFFFFFFB97C54FFFFFFFF00FFFFFF00C88A5BFFFFFFFFFFB77640FFD1A6
|
||||
83FFB67338FFFFFFFFFFF0E5DEFFF6EFEBFFF6EFEBFFF6EFEBFFF6EFEBFFF0E5
|
||||
DEFFFFFFFFFFB67853FFFFFFFF00FFFFFF00C7885AFFFFFFFFFFB46E33FFD0A5
|
||||
7EFFB26C2EFFFFFFFFFFF0E5DEFFF6EFEBFFF5ECE6FFA9C1ACFF609974FF4F8E
|
||||
66FF4A8A61FF72774DFFFFFFFF00FFFFFF00C5865BFFFFFFFFFFAF672CFFCDA0
|
||||
75FFAD642BFFFFFFFFFFF0E5DEFFF6EFEBFFA3BDA7FF61AB81FF95D4B4FFBAE6
|
||||
D0FF6ABB8FFF2D8F57FF196B378CFFFFFF00C4865AFFFFFFFFFFAF672CFFCD9F
|
||||
74FFAD642BFFFFFFFFFFF0E5DEFFF6EFEBFF4A8A61FF90D3B1FF92D6B1FFFFFF
|
||||
FFFF65BC8CFF67BC8FFF196B37F7FFFFFF00C28258FEFFFFFFFFAF672CFFAD64
|
||||
2BFFAD642BFFFFFFFFFFF0E5DEFFF0E5DEFF317B4CFF9CD4B6FFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFF95D2B2FF196B37FFFFFFFF00C08055DEFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF22713FFF62BA8BFF60BA87FFFFFF
|
||||
FFFF60B987FF67BC8FFF196B37F7FFFFFF00BE7D558FBD7C54B5BC7B53EEBA79
|
||||
53FFB67751FFB47651FFB17450FFAD724FFF5F6E43FF288C53FF64BA8DFF95D2
|
||||
B2FF64BA8DFF288C53FF196B378CFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00196B3788196B37F2196B
|
||||
37FF196B37F2196B3788FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00CE935F71CE935F90CE935FCCCE93
|
||||
5FFFCD935FFECD925FFFCC905FFFCD9261FFCD9363FFCB9161FFCB8E5FEFCA92
|
||||
64CBD8AE8BFFD7AC8BFFFFFFFF00FFFFFF00CE935F9BFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFD6AA89FFFFFFFF00FFFFFF00CE935FD8FFFFFFFFEDC49CFFEDC4
|
||||
9CFFEDC49CFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC4
|
||||
9BFFFFFFFFFFC68C61F8FFFFFF00FFFFFF00CD915FF0FFFFFFFFEDC49CFFF4DA
|
||||
C1FFF4DAC1FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFEDC4
|
||||
9BFFFFFFFFFFC18458FEFFFFFF00FFFFFF00CC905EFAFFFFFFFFEDC49BFFEDC4
|
||||
9BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC4
|
||||
9BFFFFFFFFFFBE8157FFFFFFFF00FFFFFF00CB8E5DFEFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFBC7E55FFFFFFFF00FFFFFF00CA8C5CFFFFFFFFFFBC7F54FFBA7D
|
||||
4CFFBA7C4AFFFFFFFFFF469B4CFF53A859FF51A657FF4FA455FF4DA253FF4A9F
|
||||
50FFFFFFFFFFB97C54FFFFFFFF00FFFFFF00C88A5BFFFFFFFFFFB77640FFD1A6
|
||||
83FFB67338FFFFFFFFFF52A859FF73CB7DFF73CB7DFF72CA7CFF70C97BFF479C
|
||||
4DFFFFFFFFFFB67853FFFFFFFF00FFFFFF00C7885AFFFFFFFFFFB46E33FFD0A5
|
||||
7EFFB26C2EFFFFFFFFFF50A556FF74CB7EFF73CB7DFF72CA7CFF70C97BFF4499
|
||||
49FFFFFFFFFFB27651FFFFFFFF00FFFFFF00C5865BFFFFFFFFFFAF672CFFCDA0
|
||||
75FFAD642BFFFFFFFFFF4EA354FF73CA7DFF72CA7DFF71C97CFF6FC87AFF4195
|
||||
46FFFFFFFFFFAC7250FFFFFFFF00FFFFFF00C4865AFFFFFFFFFFAF672CFFCD9F
|
||||
74FFAD642BFFFFFFFFFF4B9F50FF70C97BFF70C97BFF6FC87AFF6EC778FF3E93
|
||||
43FFFFFFFFFFA8714FFFFFFFFF00FFFFFF00C28258FEFFFFFFFFAF672CFFAD64
|
||||
2BFFAD642BFFFFFFFFFF56AB5DFF51A657FF4CA152FF479C4CFF449849FF4094
|
||||
45FFFFFFFFFFA76F4EFEFFFFFF00FFFFFF00C08055DEFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFA66E4DEDFFFFFF00FFFFFF00BE7D558FBD7C54B5BC7B53EEBA79
|
||||
53FFB67751FFB47651FFB17450FFAD724FFFAA714FFFA86F4EFFA76E4DFFA66E
|
||||
4DFEA46E4DF1A66E4DC4FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00CE935F71CE935F90CE935FCCCE93
|
||||
5FFFCD935FFECD925FFFCC905FFFCD9261FFCD9363FFCB9161FFCB8E5FEFCA92
|
||||
64CBD8AE8BFFD7AC8BFFFFFFFF00FFFFFF00CE935F9BFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFD6AA89FFFFFFFF00FFFFFF00CE935FD8FFFFFFFFEDC49CFFEDC4
|
||||
9CFFEDC49CFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC4
|
||||
9BFFFFFFFFFFC68C61F8FFFFFF00FFFFFF00CD915FF0FFFFFFFFEDC49CFFF4DA
|
||||
C1FFF4DAC1FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFF4DBC2FFEDC4
|
||||
9BFFFFFFFFFFC18458FEFFFFFF00FFFFFF00CC905EFAFFFFFFFFEDC49BFFEDC4
|
||||
9BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC49BFFEDC4
|
||||
9BFFFFFFFFFFBE8157FFFFFFFF00FFFFFF00CB8E5DFEFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFBC7E55FFFFFFFF00FFFFFF00CA8C5CFFFFFFFFFFBC7F54FFBA7D
|
||||
4CFFBA7C4AFFFFFFFFFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5
|
||||
DEFFFFFFFFFFB97C54FFFFFFFF00FFFFFF00C88A5BFFFFFFFFFFB77640FFD1A6
|
||||
83FFB67338FFFFFFFFFFF0E5DEFFF6EFEBFFF6EFEBFFF6EFEBFFF6EFEBFFF0E5
|
||||
DEFFFFFFFFFFB67853FFFFFFFF00FFFFFF00C7885AFFFFFFFFFFB46E33FFD0A5
|
||||
7EFFB26C2EFFFFFFFFFFF0E5DEFFF6EFEBFFF5ECE6FFF5ECE6FFF6EFEBFFF0E5
|
||||
DEFFFFFFFFFFB27651FFFFFFFF00FFFFFF00C5865BFFFFFFFFFFAF672CFFCDA0
|
||||
75FFAD642BFFFFFFFFFFF0E5DEFFF6EFEBFFF5ECE6FFF5ECE6FFF6EFEBFFF0E5
|
||||
DEFFFFFFFFFFAC7250FFFFFFFF00FFFFFF00C4865AFFFFFFFFFFAF672CFFCD9F
|
||||
74FFAD642BFFFFFFFFFFF0E5DEFFF6EFEBFFF6EFEBFFF6EFEBFFF6EFEBFFF0E5
|
||||
DEFFFFFFFFFFA8714FFFFFFFFF00FFFFFF00C28258FEFFFFFFFFAF672CFFAD64
|
||||
2BFFAD642BFFFFFFFFFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5DEFFF0E5
|
||||
DEFFFFFFFFFFA76F4EFEFFFFFF00FFFFFF00C08055DEFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFA66E4DEDFFFFFF00FFFFFF00BE7D558FBD7C54B5BC7B53EEBA79
|
||||
53FFB67751FFB47651FFB17450FFAD724FFFAA714FFFA86F4EFFA76E4DFFA66E
|
||||
4DFEA46E4DF1A66E4DC4FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00
|
||||
}
|
||||
end
|
||||
object ApplicationProperties1: TApplicationProperties
|
||||
|
|
|
@ -34,6 +34,7 @@ type
|
|||
actEdFind: TAction;
|
||||
actEdFindNext: TAction;
|
||||
actFileOpenContFold: TAction;
|
||||
actLayoutSave: TAction;
|
||||
actProjOpenContFold: TAction;
|
||||
actProjOptView: TAction;
|
||||
actProjSource: TAction;
|
||||
|
@ -116,6 +117,7 @@ type
|
|||
MenuItem59: TMenuItem;
|
||||
MenuItem60: TMenuItem;
|
||||
MenuItem61: TMenuItem;
|
||||
mnuLayout: TMenuItem;
|
||||
mnuItemMruFile: TMenuItem;
|
||||
mnuItemMruProj: TMenuItem;
|
||||
mnuItemWin: TMenuItem;
|
||||
|
@ -134,6 +136,7 @@ type
|
|||
procedure actFileOpenContFoldExecute(Sender: TObject);
|
||||
procedure actFileSaveAllExecute(Sender: TObject);
|
||||
procedure actEdIndentExecute(Sender: TObject);
|
||||
procedure actLayoutSaveExecute(Sender: TObject);
|
||||
procedure actProjCompAndRunWithArgsExecute(Sender: TObject);
|
||||
procedure actProjCompileAndRunExecute(Sender: TObject);
|
||||
procedure actProjCompileExecute(Sender: TObject);
|
||||
|
@ -253,6 +256,12 @@ type
|
|||
procedure mruProjItemClick(Sender: TObject);
|
||||
procedure mruClearClick(Sender: TObject);
|
||||
|
||||
// layout
|
||||
procedure layoutMnuItemClick(sender: TObject);
|
||||
procedure layoutLoadFromFile(const aFilename: string);
|
||||
procedure layoutSaveToFile(const aFilename: string);
|
||||
procedure layoutUpdateMenu;
|
||||
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
|
@ -291,6 +300,7 @@ begin
|
|||
InitWidgets;
|
||||
InitDocking;
|
||||
InitSettings;
|
||||
layoutUpdateMenu;
|
||||
//
|
||||
newProj;
|
||||
checkCompilo;
|
||||
|
@ -561,11 +571,7 @@ begin
|
|||
if WindowState = wsMinimized then
|
||||
WindowState := wsNormal;
|
||||
for i:= 0 to fWidgList.Count-1 do
|
||||
begin
|
||||
if DockMaster.GetAnchorSite(fWidgList.widget[i]).WindowState = wsMinimized then
|
||||
DockMaster.GetAnchorSite(fWidgList.widget[i]).WindowState := wsNormal;
|
||||
DockMaster.GetAnchorSite(fWidgList.widget[i]).Show;
|
||||
end;
|
||||
if not Visible then exit;
|
||||
//
|
||||
forceDirectory(getDocPath);
|
||||
|
@ -1529,6 +1535,90 @@ begin
|
|||
win.Show;
|
||||
win.BringToFront;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.layoutLoadFromFile(const aFilename: string);
|
||||
var
|
||||
xcfg: TXMLConfigStorage;
|
||||
begin
|
||||
if not fileExists(aFilename) then
|
||||
exit;
|
||||
//
|
||||
xcfg := TXMLConfigStorage.Create(aFilename, true);
|
||||
try
|
||||
DockMaster.LoadLayoutFromConfig(xcfg, false);
|
||||
finally
|
||||
xcfg.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.layoutSaveToFile(const aFilename: string);
|
||||
var
|
||||
xcfg: TXMLConfigStorage;
|
||||
i: NativeInt;
|
||||
begin
|
||||
// TODO-cbugfix: possible loading AV, xml saved after undocking some widgets, xml file abnormal size.
|
||||
for i:= 0 to fWidgList.Count-1 do
|
||||
DockMaster.GetAnchorSite(fWidgList.widget[i]).Show;
|
||||
//
|
||||
forceDirectory(extractFilePath(aFilename));
|
||||
xcfg := TXMLConfigStorage.Create(aFilename, false);
|
||||
try
|
||||
DockMaster.SaveLayoutToConfig(xcfg);
|
||||
xcfg.WriteToDisk;
|
||||
finally
|
||||
xcfg.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.layoutUpdateMenu;
|
||||
var
|
||||
lst: TStringList;
|
||||
itm: TMenuItem;
|
||||
i: NativeInt;
|
||||
begin
|
||||
mnuLayout.Clear;
|
||||
//
|
||||
itm := TMenuItem.Create(self);
|
||||
itm.Action := actLayoutSave;
|
||||
mnuLayout.Add(itm);
|
||||
mnuLayout.AddSeparator;
|
||||
//
|
||||
lst := TStringList.Create;
|
||||
try
|
||||
listFiles(lst, getDocPath + 'layouts' + DirectorySeparator);
|
||||
for i := 0 to lst.Count-1 do
|
||||
begin
|
||||
itm := TMenuItem.Create(self);
|
||||
itm.Caption := extractFileName(lst.Strings[i]);
|
||||
itm.Caption := itm.Caption[1..length(itm.Caption) - length(extractFileExt(itm.Caption))];
|
||||
itm.OnClick := @layoutMnuItemClick;
|
||||
itm.ImageIndex := 32;
|
||||
mnuLayout.Add(itm);
|
||||
end;
|
||||
finally
|
||||
lst.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.layoutMnuItemClick(sender: TObject);
|
||||
begin
|
||||
layoutLoadFromFile(getDocPath + 'layouts' + DirectorySeparator +
|
||||
TMenuItem(sender).Caption + '.xml');
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actLayoutSaveExecute(Sender: TObject);
|
||||
var
|
||||
fname: string;
|
||||
begin
|
||||
if not InputQuery('New layout name', '', fname) then
|
||||
exit;
|
||||
//
|
||||
fname := extractFileName(fname);
|
||||
if extractFileExt(fname) <> '.xml' then
|
||||
fname += '.xml';
|
||||
layoutSaveToFile(getDocPath + 'layouts' + DirectorySeparator + fname);
|
||||
layoutUpdateMenu;
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION project ---------------------------------------------------------------}
|
||||
|
|
Loading…
Reference in New Issue