mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-25 12:09:16 +02:00
MG: fixed mouse msg, added filedialog initialdir
git-svn-id: trunk@241 -
This commit is contained in:
parent
0b8e9b01d6
commit
3416b940e1
@ -532,6 +532,16 @@ end;
|
||||
{ TEditorOptions }
|
||||
|
||||
constructor TEditorOptions.Create;
|
||||
|
||||
function CreateConfigPath(Path: string): boolean;
|
||||
begin
|
||||
// ToDo: use ForceDirectory
|
||||
if not DirectoryExists(Path) then
|
||||
Result:=CreateDir(Path)
|
||||
else
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
var ConfFileName,SecConfFileName:string;
|
||||
begin
|
||||
inherited Create;
|
||||
@ -546,6 +556,10 @@ begin
|
||||
ConfFileName:=SecConfFileName;
|
||||
end;
|
||||
end;
|
||||
|
||||
if not CreateConfigPath(ExtractFilePath(ConfFilename)) then
|
||||
writeln('WARNING: config path "'+ExtractFilePath(ConfFilename)
|
||||
+'" does not exist');
|
||||
XMLConfig:=TXMLConfig.Create(ConfFileName);
|
||||
|
||||
// set defaults
|
||||
|
@ -76,6 +76,7 @@ type
|
||||
|
||||
// recent files and directories
|
||||
// ToDo
|
||||
FLastOpenDialogDir: string;
|
||||
|
||||
procedure SetFileName(NewFilename: string);
|
||||
public
|
||||
@ -129,6 +130,10 @@ type
|
||||
read FBackupInfoRepositoryFiles write FBackupInfoRepositoryFiles;
|
||||
property BackupInfoOtherFiles: TBackupInfo
|
||||
read FBackupInfoOtherFiles write FBackupInfoOtherFiles;
|
||||
|
||||
// recent files and directories
|
||||
property LastOpenDialogDir: string
|
||||
read FLastOpenDialogDir write FLastOpenDialogDir;
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -259,6 +264,9 @@ begin
|
||||
MaxCounter:=9; // for bakCounter
|
||||
SubDirectory:='backup';
|
||||
end;
|
||||
|
||||
// recent files and directories
|
||||
FLastOpenDialogDir:='';
|
||||
end;
|
||||
|
||||
destructor TEnvironmentOptions.Destroy;
|
||||
@ -380,6 +388,10 @@ begin
|
||||
,'EnvironmentOptions/BackupOtherFiles/');
|
||||
end;
|
||||
|
||||
// recent files and directories
|
||||
FLastOpenDialogDir:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/Recent/LastOpenDialogDir/Value',FLastOpenDialogDir);
|
||||
|
||||
XMLConfig.Free;
|
||||
|
||||
// object inspector
|
||||
@ -472,6 +484,10 @@ begin
|
||||
,'EnvironmentOptions/BackupOtherFiles/');
|
||||
end;
|
||||
|
||||
// recent files and directories
|
||||
XMLConfig.SetValue('EnvironmentOptions/Recent/LastOpenDialogDir/Value'
|
||||
,FLastOpenDialogDir);
|
||||
|
||||
XMLConfig.Flush;
|
||||
XMLConfig.Free;
|
||||
|
||||
|
25
ide/main.pp
25
ide/main.pp
@ -277,8 +277,8 @@ var
|
||||
|
||||
ObjectInspector1 : TObjectInspector;
|
||||
PropertyEditorHook1 : TPropertyEditorHook;
|
||||
// ...>
|
||||
SourceNotebook : TSourceNotebook;
|
||||
|
||||
TagInc : Integer;
|
||||
|
||||
|
||||
@ -1160,12 +1160,16 @@ end;
|
||||
|
||||
procedure TMainIDE.mnuOpenClicked(Sender : TObject);
|
||||
var OpenDialog:TOpenDialog;
|
||||
AFilename: string;
|
||||
begin
|
||||
OpenDialog:=TOpenDialog.Create(Application);
|
||||
try
|
||||
OpenDialog.Title:='Open file';
|
||||
OpenDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
||||
if OpenDialog.Execute then begin
|
||||
DoOpenEditorFile(ExpandFilename(OpenDialog.Filename),false);
|
||||
AFilename:=ExpandFilename(OpenDialog.Filename);
|
||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(AFilename);
|
||||
DoOpenEditorFile(AFilename,false);
|
||||
end;
|
||||
finally
|
||||
OpenDialog.Free;
|
||||
@ -1398,12 +1402,16 @@ end;
|
||||
|
||||
Procedure TMainIDE.mnuOpenProjectClicked(Sender : TObject);
|
||||
var OpenDialog:TOpenDialog;
|
||||
AFileName: string;
|
||||
begin
|
||||
OpenDialog:=TOpenDialog.Create(Application);
|
||||
try
|
||||
OpenDialog.Title:='Open Project File (*.lpi)';
|
||||
OpenDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
||||
if OpenDialog.Execute then begin
|
||||
DoOpenProjectFile(ExpandFilename(OpenDialog.Filename));
|
||||
AFilename:=ExpandFilename(OpenDialog.Filename);
|
||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(AFilename);
|
||||
DoOpenProjectFile(AFilename);
|
||||
end;
|
||||
finally
|
||||
OpenDialog.Free;
|
||||
@ -1700,8 +1708,10 @@ writeln('TMainIDE.DoSaveCurUnit 1');
|
||||
try
|
||||
SaveDialog.Title:='Save '+ActiveUnitInfo.UnitName;
|
||||
SaveDialog.FileName:=lowercase(ActiveUnitInfo.UnitName)+'.pp';
|
||||
SaveDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
||||
if SaveDialog.Execute then begin
|
||||
NewFilename:=ExpandFilename(SaveDialog.Filename);
|
||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(NewFilename);
|
||||
if ExtractFileExt(NewFilename)='' then
|
||||
NewFilename:=NewFilename+'.pp';
|
||||
if FileExists(NewFilename) then begin
|
||||
@ -2323,8 +2333,10 @@ writeln('TMainIDE.DoSaveProject 1');
|
||||
else if SaveDialog.Filename='' then
|
||||
SaveDialog.Filename:='Project1.lpi';
|
||||
repeat
|
||||
SaveDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
||||
if SaveDialog.Execute then begin
|
||||
NewFilename:=ExpandFilename(SaveDialog.Filename);
|
||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(NewFilename);
|
||||
if ExtractFileExt(NewFilename)='' then
|
||||
NewFilename:=NewFilename+'.lpi';
|
||||
NewProgramFilename:=ChangeFileExt(
|
||||
@ -2842,8 +2854,8 @@ function TMainIDE.DoJumpToCompilerMessage(Index:integer;
|
||||
Result:=(TheFilename<>'') and (TheFilename[1]='/');
|
||||
{$ELSE}
|
||||
// windows
|
||||
Result:=(length(TheFilename)<3) or (copy(TheFilename,1,2)='\\')
|
||||
or ((upcase(TheFilename[1]) in ['A'..'Z']) and (copy(TheFilename,2,2)=':\'));
|
||||
Result:=(copy(TheFilename,1,2)='\\') or ((length(TheFilename)>3) and
|
||||
(upcase(TheFilename[1]) in ['A'..'Z']) and (copy(TheFilename,2,2)=':\'));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -3022,6 +3034,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.82 2001/03/27 11:11:13 lazarus
|
||||
MG: fixed mouse msg, added filedialog initialdir
|
||||
|
||||
Revision 1.81 2001/03/26 14:52:30 lazarus
|
||||
MG: TSourceLog + compiling bugfixes
|
||||
|
||||
|
@ -58,10 +58,10 @@ type
|
||||
FTitle : string;
|
||||
FUserChoice: integer;
|
||||
protected
|
||||
function DoExecute : boolean; virtual;
|
||||
public
|
||||
FCompStyle : LongInt;
|
||||
constructor Create (AOwner : TComponent); override;
|
||||
function DoExecute : boolean; virtual;
|
||||
function Execute : boolean; virtual;
|
||||
property Handle : integer read FHandle write FHandle;
|
||||
property Title : string read FTitle write FTitle;
|
||||
@ -72,15 +72,19 @@ type
|
||||
|
||||
TFileDialog = class(TCommonDialog)
|
||||
private
|
||||
FFileName : String;
|
||||
FFilter: String;
|
||||
FFileName : String;
|
||||
FFilter: String;
|
||||
FInitialDir: string;
|
||||
FOldWorkingDir: string;
|
||||
protected
|
||||
procedure SetFileName(value :String);
|
||||
procedure SetFilter(value :String);
|
||||
function DoExecute : boolean; override;
|
||||
procedure SetFileName(value :String);
|
||||
procedure SetFilter(value :String);
|
||||
public
|
||||
function DoExecute : boolean; override;
|
||||
property FileName : String read FFileName write SetFileName;
|
||||
property Filter : String read FFilter write SetFilter;
|
||||
function Execute : boolean; override;
|
||||
property FileName : String read FFileName write SetFileName;
|
||||
property Filter : String read FFilter write SetFilter;
|
||||
property InitialDir: string read FInitialDir write FInitialDir;
|
||||
end;
|
||||
|
||||
TOpenDialog = class(TFileDialog)
|
||||
@ -199,6 +203,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.5 2001/03/27 11:11:13 lazarus
|
||||
MG: fixed mouse msg, added filedialog initialdir
|
||||
|
||||
Revision 1.4 2001/03/03 00:48:03 lazarus
|
||||
+ added support for message dialogs
|
||||
stoppok
|
||||
|
@ -5,13 +5,29 @@
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TFileDialog Execute }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TFileDialog.Execute : boolean;
|
||||
begin
|
||||
FOldWorkingDir:=GetCurrentDir;
|
||||
if FInitialDir<>'' then SetCurrentDir(FInitialDir);
|
||||
try
|
||||
FUserChoice := mrNone;
|
||||
CNSendMessage(LM_CREATE, Self, nil);
|
||||
Result:= DoExecute;
|
||||
CNSendMessage(LM_DESTROY, Self, nil);
|
||||
FHandle := 0;
|
||||
finally
|
||||
SetCurrentDir(FOldWorkingDir);
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TFileDialog DoExecute }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TFileDialog.DoExecute : boolean;
|
||||
begin
|
||||
|
||||
CNSendMessage(LM_SETFILTER, Self, nil);
|
||||
CNSendMessage(LM_SETFILENAME, Self, nil);
|
||||
Result:= inherited DoExecute;
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -59,14 +75,17 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
constructor TSaveDialog.Create (AOwner : TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
fCompStyle := csFileDialog;
|
||||
FTitle:= 'Save file as:';
|
||||
inherited Create(AOwner);
|
||||
fCompStyle := csFileDialog;
|
||||
FTitle:= 'Save file as:';
|
||||
end;
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.2 2001/03/27 11:11:13 lazarus
|
||||
MG: fixed mouse msg, added filedialog initialdir
|
||||
|
||||
Revision 1.1 2000/07/13 10:28:25 michael
|
||||
+ Initial import
|
||||
|
||||
|
@ -379,23 +379,34 @@ begin
|
||||
MessE.UserData := Data;
|
||||
Result := DeliverPostMessage(Data, MessE);
|
||||
end
|
||||
else
|
||||
begin
|
||||
case event^.Button of
|
||||
1 : if event^.thetype = gdk_button_press then MessI.Msg := LM_LBUTTONDOWN
|
||||
else
|
||||
MessI.Msg := LM_LBUTTONDBLCLK;
|
||||
2 : if event^.thetype = gdk_button_press then MessI.Msg := LM_MBUTTONDOWN
|
||||
else
|
||||
MessI.Msg := LM_MBUTTONDBLCLK;
|
||||
3 : if event^.thetype = gdk_button_press then MessI.Msg := LM_RBUTTONDOWN
|
||||
else
|
||||
MessI.Msg := LM_RBUTTONDBLCLK;
|
||||
else begin
|
||||
MessI.Keys := 0;
|
||||
case event^.Button of
|
||||
1 : begin
|
||||
MessI.Keys := MessI.Keys or MK_LBUTTON;
|
||||
if event^.thetype = gdk_button_press then begin
|
||||
MessI.Msg := LM_LBUTTONDOWN;
|
||||
end else
|
||||
MessI.Msg := LM_LBUTTONDBLCLK;
|
||||
end;
|
||||
2 : begin
|
||||
MessI.Keys := MessI.Keys or MK_MBUTTON;
|
||||
if event^.thetype = gdk_button_press then
|
||||
MessI.Msg := LM_MBUTTONDOWN
|
||||
else
|
||||
MessI.Msg := LM_MBUTTONDBLCLK;
|
||||
end;
|
||||
3 : begin
|
||||
MessI.Keys := MessI.Keys or MK_RBUTTON;
|
||||
if event^.thetype = gdk_button_press then
|
||||
MessI.Msg := LM_RBUTTONDOWN
|
||||
else
|
||||
MessI.Msg := LM_RBUTTONDBLCLK;
|
||||
end;
|
||||
else MessI.Msg := LM_NULL;
|
||||
end; //case
|
||||
end; //case
|
||||
MessI.XPos := Trunc(Event^.X);
|
||||
MessI.YPos := Trunc(Event^.Y);
|
||||
MessI.Keys := 0;
|
||||
if ssShift in ShiftState then MessI.Keys := MessI.Keys or MK_SHIFT;
|
||||
if ssCtrl in ShiftState then MessI.Keys := MessI.Keys or MK_CONTROL;
|
||||
if ssLeft in ShiftState then MessI.Keys := MessI.Keys or MK_LBUTTON;
|
||||
@ -1105,6 +1116,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.29 2001/03/27 11:11:13 lazarus
|
||||
MG: fixed mouse msg, added filedialog initialdir
|
||||
|
||||
Revision 1.28 2001/03/26 14:58:31 lazarus
|
||||
MG: setwindowpos + bugfixes
|
||||
|
||||
|
@ -316,18 +316,19 @@ begin
|
||||
if BackPixmap = nil
|
||||
then BackPixmap := gdk_pixmap_new(Widget^.Window, Width, Height, -1);
|
||||
|
||||
if BackPixmap <> nil
|
||||
if (BackPixmap <> nil) and (Widget<>nil) and (PGTKStyle(Widget^.theStyle)<>nil)
|
||||
then gdk_draw_pixmap(
|
||||
BackPixmap,
|
||||
PGTKStyle(Widget^.theStyle)^.bg_gc[GTK_STATE_NORMAL],
|
||||
Widget^.Window, X, Y, 0, 0, Width, Height
|
||||
);
|
||||
|
||||
gdk_draw_rectangle(
|
||||
PGTKWidget(Client)^.Window,
|
||||
PGTKStyle(PGTKWidget(Client)^.theStyle)^.fg_gc[GC_STATE[Integer(Pixmap) <> 1]],
|
||||
1, X, Y, Width, Height
|
||||
);
|
||||
if PGTKStyle(PGTKWidget(Client)^.theStyle)<>nil then
|
||||
gdk_draw_rectangle(
|
||||
PGTKWidget(Client)^.Window,
|
||||
PGTKStyle(PGTKWidget(Client)^.theStyle)^.fg_gc[GC_STATE[Integer(Pixmap) <> 1]],
|
||||
1, X, Y, Width, Height
|
||||
);
|
||||
IsDrawn := True;
|
||||
|
||||
if Timer = 0 then Timer := gtk_timeout_add(500, @GTKAPIWidgetClient_Timer, Client);
|
||||
@ -545,6 +546,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.6 2001/03/27 11:11:13 lazarus
|
||||
MG: fixed mouse msg, added filedialog initialdir
|
||||
|
||||
Revision 1.5 2001/03/26 14:58:32 lazarus
|
||||
MG: setwindowpos + bugfixes
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user