View Issue Details

IDProjectCategoryView StatusLast Update
0034402LazarusIDEpublic2018-10-08 16:09
ReporterVojtech CihakAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformamd64OSLinuxOS VersionChakra 64-bit
Product Version1.9 (SVN)Product Build59269 
Target VersionFixed in Version 
Summary0034402: [PATCH] Proper V-Center of items in viewunit_dlg.pp
DescriptionProper vertical center of items in viewunit_dlg.pp, i.e. Project -> Forms ... and Project -> Units ...

Code is implemented to OnDrawItem. I tried to implement it in OnMeasureItem but it doesn't work with GTk2.

Patch is tested with Qt4 and GTk2. It would be nice if somebody test with hi-DPI and in Win, Cocoa and Carbon.

Steps To ReproduceLook at that dialog, apply patch and look again.
Additional InformationLazarus 2.1.0 r59269M FPC 3.3.1 x86_64-linux-qt
TagsNo tags attached.
Fixed in Revisionr59272
LazTarget-
Widgetset
Attached Files
  • viewunit_dlg.diff (948 bytes)
    Index: ide/viewunit_dlg.pp
    ===================================================================
    --- ide/viewunit_dlg.pp	(revision 59269)
    +++ ide/viewunit_dlg.pp	(working copy)
    @@ -376,13 +376,16 @@
     
     procedure TViewUnitDialog.ListboxDrawItem(Control: TWinControl; Index: Integer;
       ARect: TRect; State: TOwnerDrawState);
    +var aTop: Integer;
     begin
       if Index < 0 then Exit;
       with ListBox do
       begin
         Canvas.FillRect(ARect);
    -    IDEImages.Images_16.Draw(Canvas, 1, ARect.Top, FImageIndex);
    -    Canvas.TextRect(ARect, ARect.Left + IDEImages.Images_16.Width + Scale96ToFont(4), ARect.Top, Items[Index]);
    +    aTop := (ARect.Bottom + ARect.Top - IDEImages.Images_16.Height) div 2;
    +    IDEImages.Images_16.Draw(Canvas, 1, aTop, FImageIndex);
    +    aTop := (ARect.Bottom + ARect.Top - Canvas.TextHeight('Šj9')) div 2;
    +    Canvas.TextRect(ARect, ARect.Left + IDEImages.Images_16.Width + Scale96ToFont(4), aTop, Items[Index]);
       end;
     end;
     
    
    viewunit_dlg.diff (948 bytes)

Activities

Vojtech Cihak

2018-10-08 01:17

reporter  

viewunit_dlg.diff (948 bytes)
Index: ide/viewunit_dlg.pp
===================================================================
--- ide/viewunit_dlg.pp	(revision 59269)
+++ ide/viewunit_dlg.pp	(working copy)
@@ -376,13 +376,16 @@
 
 procedure TViewUnitDialog.ListboxDrawItem(Control: TWinControl; Index: Integer;
   ARect: TRect; State: TOwnerDrawState);
+var aTop: Integer;
 begin
   if Index < 0 then Exit;
   with ListBox do
   begin
     Canvas.FillRect(ARect);
-    IDEImages.Images_16.Draw(Canvas, 1, ARect.Top, FImageIndex);
-    Canvas.TextRect(ARect, ARect.Left + IDEImages.Images_16.Width + Scale96ToFont(4), ARect.Top, Items[Index]);
+    aTop := (ARect.Bottom + ARect.Top - IDEImages.Images_16.Height) div 2;
+    IDEImages.Images_16.Draw(Canvas, 1, aTop, FImageIndex);
+    aTop := (ARect.Bottom + ARect.Top - Canvas.TextHeight('Šj9')) div 2;
+    Canvas.TextRect(ARect, ARect.Left + IDEImages.Images_16.Width + Scale96ToFont(4), aTop, Items[Index]);
   end;
 end;
 
viewunit_dlg.diff (948 bytes)

Juha Manninen

2018-10-08 15:43

developer   ~0111322

Applied, thanks. I tested with KDE's High DPI setting and it works well, with both GTK2 and QT bindings.
Somebody should test with Windows High DPI.

Vojtech Cihak

2018-10-08 16:09

reporter   ~0111324

Thanks.

Issue History

Date Modified Username Field Change
2018-10-08 01:17 Vojtech Cihak New Issue
2018-10-08 01:17 Vojtech Cihak File Added: viewunit_dlg.diff
2018-10-08 15:40 Juha Manninen Assigned To => Juha Manninen
2018-10-08 15:40 Juha Manninen Status new => assigned
2018-10-08 15:43 Juha Manninen Fixed in Revision => r59272
2018-10-08 15:43 Juha Manninen LazTarget => -
2018-10-08 15:43 Juha Manninen Note Added: 0111322
2018-10-08 15:43 Juha Manninen Status assigned => resolved
2018-10-08 15:43 Juha Manninen Resolution open => fixed
2018-10-08 16:09 Vojtech Cihak Note Added: 0111324
2018-10-08 16:09 Vojtech Cihak Status resolved => closed