MG: added TLabel.WordWrap for gtk-interface from Vincent

git-svn-id: trunk@3315 -
This commit is contained in:
lazarus 2002-09-10 17:30:16 +00:00
parent 0e27003d6f
commit 9d3a802e24
2 changed files with 239 additions and 10 deletions

View File

@ -44,8 +44,10 @@ uses
const
EnvOptsVersion: integer = 101;
type
//----------------------------------------------------------------------------
{ Backup }
type
TBackupType = (
bakNone, // no backup files
bakSymbolInFront, // .~pp
@ -62,6 +64,10 @@ type
SubDirectory: string;
end;
{ Debugging }
type
TDebuggerType = (dtNone, dtGnuDebugger);
const
@ -69,12 +75,18 @@ const
'(None)','GNU debugger (gdb)'
);
{ Naming }
type
TPascalExtType = (petNone, petPAS, petPP);
const
PascalExtension: array[TPascalExtType] of string = ('', '.pas', '.pp');
{ IDE Language (Human, not computer) }
type
TLazarusLanguage = (llAutomatic, llEnglish, llGerman);
@ -86,6 +98,9 @@ const
LazarusLanguageIDs: array[TLazarusLanguage] of string = (
'', 'en', 'de'
);
{ Ambigious files }
type
TAmbigiousFileAction = (
@ -106,6 +121,9 @@ const
'Ignore'
);
{ Environment Options }
type
{ class for storing environment options }
TEnvironmentOptions = class
@ -121,6 +139,7 @@ type
// window layout
FIDEWindowLayoutList: TIDEWindowLayoutList;
FIDEDialogLayoutList: TIDEDialogLayoutList;
// form editor
FShowGrid: boolean;
@ -204,6 +223,8 @@ type
// windows
property IDEWindowLayoutList: TIDEWindowLayoutList
read FIDEWindowLayoutList write FIDEWindowLayoutList;
property IDEDialogLayoutList: TIDEDialogLayoutList
read FIDEDialogLayoutList write FIDEDialogLayoutList;
// form editor
property ShowGrid: boolean read FShowGrid write FShowGrid;
@ -533,6 +554,7 @@ begin
// windows
InitLayoutList;
FIDEDialogLayoutList:=TIDEDialogLayoutList.Create;
// form editor
FShowGrid:=true;
@ -607,6 +629,7 @@ begin
FFPCSourceDirHistory.Free;
FDebuggerFileHistory.Free;
FTestBuildDirHistory.Free;
FIDEDialogLayoutList.Free;
fIDEWindowLayoutList.Free;
inherited Destroy;
end;
@ -712,6 +735,8 @@ begin
// windows
FIDEWindowLayoutList.LoadFromXMLConfig(XMLConfig,
'EnvironmentOptions/Desktop/');
FIDEDialogLayoutList.LoadFromXMLConfig(XMLConfig,
'EnvironmentOptions/Desktop/Dialogs');
// form editor
FShowGrid:=XMLConfig.GetValue(
@ -900,6 +925,8 @@ begin
// windows
FIDEWindowLayoutList.SaveToXMLConfig(XMLConfig,
'EnvironmentOptions/Desktop/');
FIDEDialogLayoutList.SaveToXMLConfig(XMLConfig,
'EnvironmentOptions/Desktop/Dialogs');
// form editor
XMLConfig.SetValue(
@ -1311,7 +1338,7 @@ begin
Name:='ShowHintsForComponentPaletteCheckBox';
Parent:=NoteBook.Page[Page];
Left:=DesktopFilesGroupBox.Left;
Top:=DesktopFilesGroupBox.Top+DesktopFilesGroupBox.Height+100;
Top:=DesktopFilesGroupBox.Top+DesktopFilesGroupBox.Height+40;
Width:=Parent.ClientWidth-Left;
Height:=20;
Caption:='Hints for component palette';
@ -1337,7 +1364,7 @@ begin
Name:='WindowPositionsGroupBox';
Parent:=NoteBook.Page[Page];
Caption:='Window Positions';
SetBounds(MaxX div 2,LanguageGroupBox.Top,(MaxX div 2)-5,290);
SetBounds(MaxX div 2,LanguageGroupBox.Top,(MaxX div 2)-5,330);
OnResize:=@WindowPositionsGroupBoxResize;
Visible:=true;
end;
@ -1366,7 +1393,7 @@ begin
Left:=5;
Top:=WindowPositionsListBox.Top+WindowPositionsListBox.Height+5;
Width:=WindowPositionsListBox.Width;
Height:=Parent.ClientHeight-Top-20;
Height:=Parent.ClientHeight-Top-2;
Visible:=true;
end;
end;
@ -2305,7 +2332,7 @@ begin
// Window Positions
with WindowPositionsGroupBox do begin
SetBounds(MaxX div 2,LanguageGroupBox.Top,(MaxX div 2)-5,290);
SetBounds(MaxX div 2,LanguageGroupBox.Top,(MaxX div 2)-5,330);
end;
end;

View File

@ -52,7 +52,9 @@ type
iwpRestoreWindowGeometry, // save window geometry at end and restore it
// at start
iwpDocked, // dock into other IDE window
iwpCustomPosition // set window to custom position
iwpCustomPosition, // set window to custom position
iwpRestoreWindowSize // save window size at end and restore it
// at start
);
TIDEWindowPlacements = set of TIDEWindowPlacement;
TIDEWindowDockMode = (iwdmDefault, iwdmLeft, iwdmRight, iwdmTop, iwdmBottom);
@ -156,7 +158,7 @@ type
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
end;
// ---------------------------------------------------------------------------
TOnApplyWindowPos = procedure(Layout: TIDEWindowLayout) of object;
@ -213,7 +215,8 @@ const
'Default',
'RestoreWindowGeometry',
'Docked',
'CustomPosition'
'CustomPosition',
'RestoreWindowSize'
);
IDEWindowStateNames: array[TIDEWindowState] of string = (
'Normal', 'Maximized', 'Minimized', 'Hidden'
@ -223,6 +226,46 @@ function StrToIDEWindowDockMode(const s: string): TIDEWindowDockMode;
function StrToIDEWindowPlacement(const s: string): TIDEWindowPlacement;
function StrToIDEWindowState(const s: string): TIDEWindowState;
//----------------------------------------------------------------------------
type
TIDEDialogLayout = class
private
FHeight: integer;
FName: string;
FWidth: integer;
procedure SetHeight(const AValue: integer);
procedure SetName(const AValue: string);
procedure SetWidth(const AValue: integer);
public
function SizeValid: boolean;
property Width: integer read FWidth write SetWidth;
property Height: integer read FHeight write SetHeight;
property Name: string read FName write SetName;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
end;
TIDEDialogLayoutList = class
private
FItems: TList;
function GetItems(Index: integer): TIDEDialogLayout;
public
constructor Create;
destructor Destroy; override;
procedure ApplyLayout(ADialog: TControl);
procedure SaveLayout(ADialog: TControl);
procedure Clear;
function Count: integer;
function Find(const DialogName: string;
CreateIfNotExists: boolean): TIDEDialogLayout;
function Find(ADialog: TObject;
CreateIfNotExists: boolean): TIDEDialogLayout;
function IndexOf(const DialogName: string): integer;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
property Items[Index: integer]: TIDEDialogLayout read GetItems;
end;
implementation
@ -481,8 +524,14 @@ end;
procedure TIDEWindowLayout.GetCurrentPosition;
begin
if WindowPlacement=iwpRestoreWindowGeometry then
case WindowPlacement of
iwpRestoreWindowGeometry:
ReadCurrentCoordinates;
iwpRestoreWindowSize:
ReadCurrentCoordinates;
end;
end;
{ TIDEWindowLayoutList }
@ -635,7 +684,8 @@ const
'Default',
'Restore window geometry',
'Docked',
'Custom position'
'Custom position',
'Restore window size'
);
begin
if AnLayout=nil then exit;
@ -814,5 +864,157 @@ begin
SaveTo(Layout);
end;
{ TIDEDialogLayout }
procedure TIDEDialogLayout.SetHeight(const AValue: integer);
begin
if FHeight=AValue then exit;
FHeight:=AValue;
end;
procedure TIDEDialogLayout.SetName(const AValue: string);
begin
if FName=AValue then exit;
FName:=AValue;
end;
procedure TIDEDialogLayout.SetWidth(const AValue: integer);
begin
if FWidth=AValue then exit;
FWidth:=AValue;
end;
function TIDEDialogLayout.SizeValid: boolean;
begin
Result:=(Width>0) and (Height>0);
end;
procedure TIDEDialogLayout.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
begin
FName:=XMLConfig.GetValue(Path+'/Name/Value','');
FWidth:=XMLConfig.GetValue(Path+'/Size/Width',0);
FHeight:=XMLConfig.GetValue(Path+'/Size/Height',0);
end;
procedure TIDEDialogLayout.SaveToXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
begin
XMLConfig.SetValue(Path+'/Name/Value',Name);
XMLConfig.SetValue(Path+'/Size/Width',Width);
XMLConfig.SetValue(Path+'/Size/Height',Height);
end;
{ TIDEDialogLayoutList }
function TIDEDialogLayoutList.GetItems(Index: integer): TIDEDialogLayout;
begin
Result:=TIDEDialogLayout(FItems[Index]);
end;
constructor TIDEDialogLayoutList.Create;
begin
inherited Create;
FItems:=TList.Create;
end;
destructor TIDEDialogLayoutList.Destroy;
begin
Clear;
FreeAndNil(FItems);
inherited Destroy;
end;
procedure TIDEDialogLayoutList.ApplyLayout(ADialog: TControl);
var
ALayout: TIDEDialogLayout;
begin
if ADialog=nil then exit;
ALayout:=Find(ADialog,true);
ADialog.SetBounds(ADialog.Left,ADialog.Top,ALayout.Width,ALayout.Height);
end;
procedure TIDEDialogLayoutList.SaveLayout(ADialog: TControl);
var
ALayout: TIDEDialogLayout;
begin
if ADialog=nil then exit;
ALayout:=Find(ADialog,true);
ALayout.Width:=ADialog.Width;
ALayout.Height:=ADialog.Height;
end;
procedure TIDEDialogLayoutList.Clear;
var i: integer;
begin
for i:=0 to FItems.Count-1 do
Items[i].Free;
FItems.Clear;
end;
function TIDEDialogLayoutList.Count: integer;
begin
Result:=FItems.Count;
end;
function TIDEDialogLayoutList.Find(const DialogName: string;
CreateIfNotExists: boolean): TIDEDialogLayout;
var i: integer;
begin
i:=IndexOf(DialogName);
if (i<0) then begin
if CreateIfNotExists then begin
Result:=TIDEDialogLayout.Create;
FItems.Add(Result);
Result.Name:=DialogName;
end else begin
Result:=nil;
end;
end else begin
Result:=Items[i];
end;
end;
function TIDEDialogLayoutList.Find(ADialog: TObject; CreateIfNotExists: boolean
): TIDEDialogLayout;
begin
if ADialog<>nil then begin
Result:=Find(ADialog.ClassName,CreateIfNotExists);
end else begin
Result:=nil;
end;
end;
function TIDEDialogLayoutList.IndexOf(const DialogName: string): integer;
begin
Result:=Count-1;
while (Result>=0) and (AnsiCompareText(DialogName,Items[Result].Name)<>0) do
dec(Result);
end;
procedure TIDEDialogLayoutList.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var
NewCount, i: integer;
NewDialogLayout: TIDEDialogLayout;
begin
Clear;
NewCount:=XMLConfig.GetValue(Path+'/Count',0);
for i:=0 to NewCount-1 do begin
NewDialogLayout:=TIDEDialogLayout.Create;
FItems.Add(NewDialogLayout);
NewDialogLayout.LoadFromXMLConfig(XMLConfig,Path+'/Dialog'+IntToStr(i+1));
end;
end;
procedure TIDEDialogLayoutList.SaveToXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var i: integer;
begin
XMLConfig.SetValue(Path+'/Count',Count);
for i:=0 to Count-1 do
Items[i].SaveToXMLConfig(XMLConfig,Path+'/Dialog'+IntToStr(i+1));
end;
end.