Skip to content

Commit

Permalink
Improving keyboard-based working
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankBijnen committed Jan 25, 2025
1 parent 3d1cab1 commit dd5d270
Show file tree
Hide file tree
Showing 25 changed files with 4,734 additions and 4,532 deletions.
11 changes: 6 additions & 5 deletions Source/BreadcrumbBar/BreadcrumbBar.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface
TOnBreadcrumbBarGetText = procedure(Sender: TObject; var Text: string) of object;
TCustomBreadcrumbBar = class;

TPopupMenu = class(Vcl.Menus.TPopupMenu)
TBreadCrumbPopupMenu = class(Vcl.Menus.TPopupMenu)
private
FOnClose: TNotifyEvent;
public
Expand Down Expand Up @@ -122,7 +122,7 @@ TCustomBreadcrumbBar = class(TCustomControl)
FEdit: TEdit;
FOnBreadcrumbBarGetText: TOnBreadcrumbBarGetText;
FCrumbDown: Integer;
FBarPopup: TPopupMenu;
FBarPopup: TBreadCrumbPopupMenu;
FHome: string;
FStyleServices: TCustomStyleServices;
FStyle: string;
Expand Down Expand Up @@ -275,7 +275,7 @@ constructor TCustomBreadcrumbBar.Create(AOwner: TComponent);
FEdit.OnKeyPress := EditKeyPress;
FEdit.OnExit := EditExit;
FEditable := true;
FBarPopup := TPopupMenu.Create(Self);
FBarPopup := TBreadCrumbPopupMenu.Create(Self);
MenuItem := TMenuItem.Create(FBarPopup);
MenuItem.Caption := SCopyText;
MenuItem.OnClick := CopyTextClick;
Expand Down Expand Up @@ -870,14 +870,15 @@ procedure TCustomBreadcrumbBar.WndProc(var Message: TMessage);

{ TPopupMenu }

procedure TPopupMenu.Popup(X, Y: Integer);
procedure TBreadCrumbPopupMenu.Popup(X, Y: Integer);
begin
inherited;

if Assigned(FOnClose) then
FOnClose(Self);
end;

procedure TPopupMenu.PopupAtPoint(Point: TPoint);
procedure TBreadCrumbPopupMenu.PopupAtPoint(Point: TPoint);
begin
with Point do Popup(X, Y);
end;
Expand Down
62 changes: 60 additions & 2 deletions Source/ExifToolsGui_ValEdit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@

interface

uses System.Classes, Winapi.Messages, Vcl.ValEdit, Vcl.Controls;
uses
System.Classes, Winapi.Messages, Vcl.ValEdit, Vcl.Controls, Vcl.Grids;

type
TValueListEditor = class;

TETGuiInplaceEdit = class(Vcl.Grids.TInplaceEdit)
private
procedure OwnerPoint(var X, Y: integer);
function ValueListEditor: TValueListEditor;
protected
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
end;

TValueListEditor = class(Vcl.ValEdit.TValueListEditor)
private
FProportionalVScroll: boolean;
FDataRows: integer;
FRowsPossible: integer;
FOnCtrlKeyDown: TkeyEvent;
FInplaceEdit: TETGuiInplaceEdit;
protected
function CreateEditor: TInplaceEdit; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
function GetRowsPossible: integer;
procedure SetProportionalVScroll(Value: boolean);
Expand All @@ -28,21 +41,66 @@ TValueListEditor = class(Vcl.ValEdit.TValueListEditor)
constructor Create(AOwner: TComponent); override;
property OnCtrlKeyDown: TkeyEvent read FOnCtrlKeyDown write FOnCtrlKeyDown;
property ProportionalVScroll: boolean read FProportionalVScroll write SetProportionalVScroll default false;
property FixedRows;
end;

implementation

uses Winapi.Windows, System.UITypes, Vcl.Grids;
uses
System.UITypes, Winapi.Windows;

procedure TETGuiInplaceEdit.OwnerPoint(var X, Y: integer);
var
Pt: TPoint;
begin
Pt := Self.ClientToScreen(Point(X, Y));
Pt := Grid.ScreenToClient(Pt);
X := Pt.X;
Y := Pt.Y;
end;

function TETGuiInplaceEdit.ValueListEditor: TValueListEditor;
begin
result := TValueListEditor(Grid);
end;

procedure TETGuiInplaceEdit.KeyDown(var Key: Word; Shift: TShiftState);
begin
if (Shift = [ssCtrl]) then
ValueListEditor.KeyDown(Key, Shift);

inherited KeyDown(Key, Shift);
end;

procedure TETGuiInplaceEdit.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer);
begin
if (Button = TMouseButton.mbRight) then
begin
OwnerPoint(X, Y);
ValueListEditor.MouseDown(Button, Shift, X, Y);
end;

inherited MouseDown(Button, Shift, X, Y);
end;

constructor TValueListEditor.Create(AOwner: TComponent);
begin
inherited Create(AOwner);

{$IFNDEF VER350}
DoubleBufferedMode := TDoubleBufferedMode.dbmRequested;
{$ENDIF}
FProportionalVScroll := false;
FDataRows := 0;
FRowsPossible := 0;
end;

function TValueListEditor.CreateEditor: TInplaceEdit;
begin
FInplaceEdit := TETGuiInplaceEdit.Create(Self);
result := FInplaceEdit;
end;

procedure TValueListEditor.KeyDown(var Key: Word; Shift: TShiftState);
begin

Expand Down
5 changes: 4 additions & 1 deletion Source/Main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ object FMain: TFMain
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goRowSelect, goThumbTracking]
ParentFont = False
ParentShowHint = False
PopupMenu = QuickPopUpMenu
Expand All @@ -364,7 +363,9 @@ object FMain: TFMain
OnKeyDown = MetadataListKeyDown
OnMouseDown = MetadataListMouseDown
OnMouseMove = MetadataListMouseMove
OnMouseUp = MetadataListMouseUp
OnSelectCell = MetadataListSelectCell
OnStringsChange = MetadataListStringsChange
ColWidths = (
150
160)
Expand Down Expand Up @@ -772,6 +773,8 @@ object FMain: TFMain
DropDownCount = 16
TabOrder = 1
OnChange = CBoxETdirectChange
OnCloseUp = CBoxETdirectCloseUp
OnKeyPress = CBoxETdirectKeyPress
end
object EditETcmdName: TLabeledEdit
Left = 1
Expand Down
Loading

0 comments on commit dd5d270

Please sign in to comment.