mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 04:19:47 +02:00
Desktop manager form.
git-svn-id: trunk@49455 -
This commit is contained in:
parent
80cf99ea16
commit
c53fe9aebc
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -5589,6 +5589,8 @@ ide/customformeditor.pp svneol=native#text/pascal
|
||||
ide/debugmanager.pas svneol=native#text/pascal
|
||||
ide/definesgui.lfm svneol=native#text/plain
|
||||
ide/definesgui.pas svneol=native#text/pascal
|
||||
ide/desktopmanager.lfm svneol=native#text/plain
|
||||
ide/desktopmanager.pas svneol=native#text/pascal
|
||||
ide/dialogprocs.pas svneol=native#text/pascal
|
||||
ide/diffdialog.lfm svneol=native#text/plain
|
||||
ide/diffdialog.pas svneol=native#text/pascal
|
||||
|
53
ide/desktopmanager.lfm
Normal file
53
ide/desktopmanager.lfm
Normal file
@ -0,0 +1,53 @@
|
||||
object DesktopForm: TDesktopForm
|
||||
Left = 463
|
||||
Height = 159
|
||||
Top = 670
|
||||
Width = 394
|
||||
Caption = 'DesktopForm'
|
||||
ClientHeight = 159
|
||||
ClientWidth = 394
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.5'
|
||||
object DesktopComboBox: TComboBox
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 12
|
||||
Width = 212
|
||||
ItemHeight = 17
|
||||
OnSelect = DesktopComboBoxSelect
|
||||
TabOrder = 0
|
||||
Text = 'DesktopComboBox'
|
||||
end
|
||||
object SaveBitBtn: TBitBtn
|
||||
AnchorSideLeft.Control = DesktopComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = DesktopComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 229
|
||||
Height = 29
|
||||
Top = 9
|
||||
Width = 133
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 11
|
||||
Caption = 'Save current desktop'
|
||||
OnClick = SaveBitBtnClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 37
|
||||
Top = 116
|
||||
Width = 382
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
HelpButton.DefaultCaption = True
|
||||
CloseButton.Name = 'CloseButton'
|
||||
CloseButton.DefaultCaption = True
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.DefaultCaption = True
|
||||
TabOrder = 2
|
||||
ShowButtons = [pbOK, pbCancel]
|
||||
end
|
||||
end
|
100
ide/desktopmanager.pas
Normal file
100
ide/desktopmanager.pas
Normal file
@ -0,0 +1,100 @@
|
||||
unit DesktopManager;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Buttons, ButtonPanel,
|
||||
LazarusIDEStrConsts, LCLProc, EnvironmentOpts;
|
||||
|
||||
type
|
||||
|
||||
{ TDesktopForm }
|
||||
|
||||
TDesktopForm = class(TForm)
|
||||
ButtonPanel1: TButtonPanel;
|
||||
DesktopComboBox: TComboBox;
|
||||
SaveBitBtn: TBitBtn;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure DesktopComboBoxSelect(Sender: TObject);
|
||||
procedure SaveBitBtnClick(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
function ShowDesktopManagerDlg: TModalResult;
|
||||
|
||||
//var DesktopForm: TDesktopForm;
|
||||
|
||||
implementation
|
||||
|
||||
function ShowDesktopManagerDlg: TModalResult;
|
||||
var
|
||||
theForm: TDesktopForm;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
theForm:=TDesktopForm.Create(Nil);
|
||||
try
|
||||
Result:=theForm.ShowModal;
|
||||
if Result=mrYes then begin
|
||||
debugln(['ShowDesktopManagerDlg: Selecting ', theForm.DesktopComboBox.Text]);
|
||||
EnvironmentOptions.Desktops.Select(theForm.DesktopComboBox.Text);
|
||||
end;
|
||||
finally
|
||||
theForm.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TDesktopForm }
|
||||
|
||||
procedure TDesktopForm.FormCreate(Sender: TObject);
|
||||
var
|
||||
i, ActiveInd: Integer;
|
||||
begin
|
||||
// Saved desktops
|
||||
ActiveInd := 0;
|
||||
with EnvironmentOptions do
|
||||
for i:=0 to Desktops.Count-1 do
|
||||
begin
|
||||
if Desktops[i] = Desktop then
|
||||
ActiveInd := i;
|
||||
DesktopComboBox.Items.Add(Desktops[i].Name);
|
||||
end;
|
||||
DesktopComboBox.ItemIndex := ActiveInd;
|
||||
// Save button
|
||||
SaveBitBtn.Caption := dlgSaveCurrentDesktop;
|
||||
SaveBitBtn.LoadGlyphFromResourceName(HInstance, 'laz_save');
|
||||
end;
|
||||
|
||||
procedure TDesktopForm.DesktopComboBoxSelect(Sender: TObject);
|
||||
begin
|
||||
debugln(['TDesktopForm.DesktopComboBoxSelect: ', DesktopComboBox.Text]);
|
||||
end;
|
||||
|
||||
procedure TDesktopForm.SaveBitBtnClick(Sender: TObject);
|
||||
var
|
||||
dsk: TDesktopOpt;
|
||||
begin
|
||||
with EnvironmentOptions do
|
||||
begin
|
||||
dsk := Desktops.Find(DesktopComboBox.Text);
|
||||
if not Assigned(dsk) then
|
||||
begin
|
||||
debugln(['TDesktopForm.SaveBitBtnClick: Adding ', DesktopComboBox.Text]);
|
||||
dsk := TDesktopOpt.Create(DesktopComboBox.Text);
|
||||
Desktops.Add(dsk);
|
||||
end;
|
||||
debugln(['TDesktopForm.SaveBitBtnClick: Assign from ', Desktop.Name, ' to ', dsk.Name]);
|
||||
dsk.Assign(Desktop);
|
||||
Desktops.Select(DesktopComboBox.Text);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user