mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:19:16 +02:00
MG: added filters and history to TOpenDialog
git-svn-id: trunk@1713 -
This commit is contained in:
parent
d277ae8f38
commit
9217c2841c
@ -62,8 +62,8 @@ type
|
|||||||
TCommonDialog = class(TComponent)
|
TCommonDialog = class(TComponent)
|
||||||
private
|
private
|
||||||
FHandle : integer;
|
FHandle : integer;
|
||||||
FInitialHeight: integer;
|
FHeight: integer;
|
||||||
FInitialWidth: integer;
|
FWidth: integer;
|
||||||
FOnCanClose: TCloseQueryEvent;
|
FOnCanClose: TCloseQueryEvent;
|
||||||
FOnShow, FOnClose : TNotifyEvent;
|
FOnShow, FOnClose : TNotifyEvent;
|
||||||
FTitle : string;
|
FTitle : string;
|
||||||
@ -85,8 +85,8 @@ type
|
|||||||
property OnCanClose: TCloseQueryEvent read FOnCanClose write FOnCanClose;
|
property OnCanClose: TCloseQueryEvent read FOnCanClose write FOnCanClose;
|
||||||
property OnShow : TNotifyEvent read FOnShow write FOnShow;
|
property OnShow : TNotifyEvent read FOnShow write FOnShow;
|
||||||
property HelpContext: THelpContext read FHelpContext write FHelpContext default 0;
|
property HelpContext: THelpContext read FHelpContext write FHelpContext default 0;
|
||||||
property InitialWidth: integer read FInitialWidth write FInitialWidth;
|
property Width: integer read FWidth write FWidth;
|
||||||
property InitialHeight: integer read FInitialHeight write FInitialHeight;
|
property Height: integer read FHeight write FHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -305,6 +305,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2002/05/30 14:11:11 lazarus
|
||||||
|
MG: added filters and history to TOpenDialog
|
||||||
|
|
||||||
Revision 1.12 2002/05/29 21:44:37 lazarus
|
Revision 1.12 2002/05/29 21:44:37 lazarus
|
||||||
MG: improved TCommon/File/OpenDialog, fixed TListView scrolling and broder
|
MG: improved TCommon/File/OpenDialog, fixed TListView scrolling and broder
|
||||||
|
|
||||||
|
@ -77,9 +77,6 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TFileDialog.DoExecute : boolean;
|
function TFileDialog.DoExecute : boolean;
|
||||||
begin
|
begin
|
||||||
CNSendMessage(LM_SETFILTER, Self, nil);
|
|
||||||
CNSendMessage(LM_SETFILENAME, Self, nil);
|
|
||||||
|
|
||||||
Result:= inherited DoExecute;
|
Result:= inherited DoExecute;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -115,10 +112,12 @@ function TOpenDialog.DoExecute: boolean;
|
|||||||
procedure DereferenceLinks;
|
procedure DereferenceLinks;
|
||||||
var i: integer;
|
var i: integer;
|
||||||
begin
|
begin
|
||||||
Filename:=ExpandFilename(Filename);
|
if Filename<>'' then
|
||||||
|
Filename:=ExpandFilename(Filename);
|
||||||
if Files<>nil then begin
|
if Files<>nil then begin
|
||||||
for i:=0 to Files.Count-1 do begin
|
for i:=0 to Files.Count-1 do begin
|
||||||
Files[i]:=ExpandFilename(Files[i]);
|
if Files[i]<>'' then
|
||||||
|
Files[i]:=ExpandFilename(Files[i]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -128,9 +127,11 @@ begin
|
|||||||
if (not (ofNoDereferenceLinks in Options)) then begin
|
if (not (ofNoDereferenceLinks in Options)) then begin
|
||||||
DereferenceLinks;
|
DereferenceLinks;
|
||||||
end;
|
end;
|
||||||
if (not (ofNoChangeDir in Options)) and (ExtractFilePath(Filename)<>'') then
|
if (not (ofNoChangeDir in Options)) then begin
|
||||||
begin
|
if (ExtractFilePath(Filename)<>'') then
|
||||||
InitialDir:=ExtractFilePath(Filename);
|
InitialDir:=ExtractFilePath(Filename)
|
||||||
|
else if (Files.Count>0) and (ExtractFilePath(Files[0])<>'') then
|
||||||
|
InitialDir:=ExtractFilePath(Files[0]);
|
||||||
end;
|
end;
|
||||||
if Result then begin
|
if Result then begin
|
||||||
if (DefaultExt<>'') and (ExtractFileExt(Filename)='')
|
if (DefaultExt<>'') and (ExtractFileExt(Filename)='')
|
||||||
@ -202,6 +203,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.6 2002/05/30 14:11:11 lazarus
|
||||||
|
MG: added filters and history to TOpenDialog
|
||||||
|
|
||||||
Revision 1.5 2002/05/29 21:44:38 lazarus
|
Revision 1.5 2002/05/29 21:44:38 lazarus
|
||||||
MG: improved TCommon/File/OpenDialog, fixed TListView scrolling and broder
|
MG: improved TCommon/File/OpenDialog, fixed TListView scrolling and broder
|
||||||
|
|
||||||
|
@ -860,7 +860,10 @@ begin
|
|||||||
CanClose:=True;
|
CanClose:=True;
|
||||||
theDialog.OnCanClose(theDialog,CanClose);
|
theDialog.OnCanClose(theDialog,CanClose);
|
||||||
Result:=not CanClose;
|
Result:=not CanClose;
|
||||||
if CanClose then StoreCommonDialogSetup(theDialog);
|
end;
|
||||||
|
if not Result then begin
|
||||||
|
StoreCommonDialogSetup(theDialog);
|
||||||
|
DestroyCommonDialogAddOns(theDialog);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -894,7 +897,7 @@ begin
|
|||||||
if FileExists(Filename) then begin
|
if FileExists(Filename) then begin
|
||||||
Details:=GetFileDescription(Filename);
|
Details:=GetFileDescription(Filename);
|
||||||
end else begin
|
end else begin
|
||||||
Details:='(file does not exist)';
|
Details:='(file not found: "'+Filename+'")';
|
||||||
end;
|
end;
|
||||||
gtk_label_set_text(PGtkLabel(FileDetailLabel),PChar(Details));
|
gtk_label_set_text(PGtkLabel(FileDetailLabel),PChar(Details));
|
||||||
end;
|
end;
|
||||||
@ -991,16 +994,48 @@ function GTKDialogMenuActivateCB(widget: PGtkWidget; data: gPointer): GBoolean;
|
|||||||
cdecl;
|
cdecl;
|
||||||
var
|
var
|
||||||
theDialog: TCommonDialog;
|
theDialog: TCommonDialog;
|
||||||
//NewFilename: string;
|
|
||||||
|
procedure CheckFilterActivated(FilterWidget: PGtkWidget);
|
||||||
|
var AFilterEntry: PFileSelFilterEntry;
|
||||||
|
begin
|
||||||
|
if FilterWidget=nil then exit;
|
||||||
|
AFilterEntry:=gtk_object_get_data(PGtkObject(FilterWidget),
|
||||||
|
'LCLIsFilterMenuItem');
|
||||||
|
if (AFilterEntry<>nil) and (AFilterEntry^.Mask<>nil) then begin
|
||||||
|
gtk_file_selection_complete(GTK_FILE_SELECTION(theDialog.Handle),
|
||||||
|
AFilterEntry^.Mask);
|
||||||
|
UpdateDetailView(TOpenDialog(theDialog));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
AHistoryEntry: PFileSelHistoryEntry;
|
||||||
|
FilterMenu, ActiveFilterMenuItem: PGtkWidget;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
theDialog:=TCommonDialog(GetLCLObject(Widget));
|
theDialog:=TCommonDialog(GetLCLObject(Widget));
|
||||||
if (theDialog is TOpenDialog) then begin
|
if (theDialog is TOpenDialog) then begin
|
||||||
if gtk_object_get_data(PGtkObject(Widget), 'IsHistoryMenuItem')<>nil then
|
// check if history activated
|
||||||
begin
|
AHistoryEntry:=gtk_object_get_data(PGtkObject(Widget),
|
||||||
|
'LCLIsHistoryMenuItem');
|
||||||
//UpdateDetailView(TOpenDialog(theDialog));
|
if (AHistoryEntry<>nil) and (AHistoryEntry^.Filename<>nil) then begin
|
||||||
|
// use has choosen a history file
|
||||||
|
// -> select it in the filedialog
|
||||||
|
gtk_file_selection_complete(GTK_FILE_SELECTION(theDialog.Handle),
|
||||||
|
AHistoryEntry^.Filename);
|
||||||
|
// restore filter
|
||||||
|
if DirectoryExists(AHistoryEntry^.Filename) then begin
|
||||||
|
FilterMenu:=gtk_object_get_data(PGtkObject(theDialog.Handle),
|
||||||
|
'LCLFilterMenu');
|
||||||
|
if FilterMenu<>nil then begin
|
||||||
|
ActiveFilterMenuItem:=gtk_menu_get_active(GTK_MENU(FilterMenu));
|
||||||
|
CheckFilterActivated(ActiveFilterMenuItem);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
UpdateDetailView(TOpenDialog(theDialog));
|
||||||
end;
|
end;
|
||||||
|
// check if filter activated
|
||||||
|
CheckFilterActivated(Widget);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1946,6 +1981,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.77 2002/05/30 14:11:12 lazarus
|
||||||
|
MG: added filters and history to TOpenDialog
|
||||||
|
|
||||||
Revision 1.76 2002/05/29 21:44:38 lazarus
|
Revision 1.76 2002/05/29 21:44:38 lazarus
|
||||||
MG: improved TCommon/File/OpenDialog, fixed TListView scrolling and broder
|
MG: improved TCommon/File/OpenDialog, fixed TListView scrolling and broder
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user