@@ -1226,7 +1226,6 @@ TMainForm = class(TExtForm)
12261226 procedure menuCopyColumnNamesClick(Sender: TObject);
12271227 procedure menuCloseTabOnDblClickClick(Sender: TObject);
12281228 procedure TimerRefreshTimer(Sender: TObject);
1229- procedure SynCompletionProposalChange(Sender: TObject);
12301229 procedure SynMemoQuerySpecialLineColors(Sender: TObject; Line: Integer;
12311230 var Special: Boolean; var FG, BG: TColor);
12321231 procedure SynMemoSQLLogSpecialLineColors(Sender: TObject; Line: Integer;
@@ -1802,8 +1801,8 @@ procedure TMainForm.FormDestroy(Sender: TObject);
18021801 AppSettings.WriteString(asDelimiter, FDelimiter);
18031802 AppSettings.WriteInt(asQuerymemoheight, ScaleFormToDesign(pnlQueryMemo.Height));
18041803 AppSettings.WriteInt(asQueryhelperswidth, ScaleFormToDesign(pnlQueryHelpers.Width));
1805- AppSettings.WriteInt(asCompletionProposalWidth, ScaleFormToDesign(SynCompletionProposal.TheForm.Width));
1806- AppSettings.WriteInt(asCompletionProposalNbLinesInWindow, SynCompletionProposal.LinesInWindow);
1804+ AppSettings.WriteInt(asCompletionProposalWidth, SynCompletionProposal.TheForm. ScaleFormToDesign(SynCompletionProposal.TheForm.Width));
1805+ AppSettings.WriteInt(asCompletionProposalNbLinesInWindow, SynCompletionProposal.TheForm.ScaleFormToDesign(SynCompletionProposal. LinesInWindow) );
18071806 AppSettings.WriteInt(asDbtreewidth, ScaleFormToDesign(pnlLeft.width));
18081807 AppSettings.WriteBool(asGroupTreeObjects, actGroupObjects.Checked);
18091808 AppSettings.WriteInt(asDataPreviewHeight, ScaleFormToDesign(pnlPreview.Height));
@@ -2075,11 +2074,8 @@ procedure TMainForm.FormCreate(Sender: TObject);
20752074 end;
20762075
20772076 // Completion proposal window
2078- // The proposal form gets scaled a second time when it shows its form with Scaled=True.
2079- // We already store and restore the dimensions DPI aware.
2080- {SynCompletionProposal.Form.Scaled := False;}
2081- SynCompletionProposal.TheForm.Width := Max(AppSettings.ReadInt(asCompletionProposalWidth), 50);
2082- SynCompletionProposal.LinesInWindow := AppSettings.ReadInt(asCompletionProposalNbLinesInWindow);
2077+ SynCompletionProposal.TheForm.Width := Min(Max(AppSettings.ReadInt(asCompletionProposalWidth), 50), 350);
2078+ SynCompletionProposal.LinesInWindow := Min(AppSettings.ReadInt(asCompletionProposalNbLinesInWindow), 10);
20832079 FProposalItems := TProposalItemList.Create;
20842080 FProposalTriggeredByDot := False;
20852081
@@ -3598,22 +3594,26 @@ function TMainForm.SynCompletionProposalMeasureItem(const AKey: string;
35983594var
35993595 i, X, Y: Integer;
36003596 Item: TProposalItem;
3597+ ItemWidth: Integer;
36013598begin
36023599 // Calculate how much vertical and horizontal space the control reserves for this row
36033600 FProposalLeftWidth := 0;
36043601
36053602 ACanvas.Font.Style := [];
36063603 for i := 0 to SynCompletionProposal.ItemList.Count - 1 do begin
36073604 Item := FProposalItems[SynCompletionProposal.IndexFromVisibleIndex(i)];
3608- FProposalLeftWidth := Max(FProposalLeftWidth, ACanvas.TextWidth(Item.LeftText));
3605+ ItemWidth := ACanvas.TextWidth(Item.LeftText);
3606+ // Canvas is not yet scaled to the current PPI
3607+ ItemWidth := MulDiv(ItemWidth, Monitor.PixelsPerInch, ACanvas.Font.PixelsPerInch);
3608+ FProposalLeftWidth := Max(FProposalLeftWidth, ItemWidth);
36093609 end;
36103610
36113611 Item := FProposalItems[SynCompletionProposal.IndexFromVisibleIndex(Index)];
3612- X := Space + ImageListMain.WidthForPPI[16, PixelsPerInch]
3612+ X := Space + ImageListMain.WidthForPPI[16, ACanvas.Font. PixelsPerInch]
36133613 + Space + FProposalLeftWidth
36143614 + Space(2) + ACanvas.TextWidth(Item.CenterText)
36153615 + IfThen(Item.RightText.IsEmpty, 0, Space(2) + ACanvas.TextWidth(Item.RightText));
3616- Y := Max(ImageListMain.HeightForPPI[16, PixelsPerInch] + 2, ACanvas.TextHeight('Wy')) + Space;
3616+ Y := Max(ImageListMain.HeightForPPI[16, ACanvas.Font. PixelsPerInch] + 2, ACanvas.TextHeight('Wy')) + Space;
36173617 Result := Point(X, Y);
36183618end;
36193619
@@ -3626,11 +3626,11 @@ function TMainForm.SynCompletionProposalPaintItem(const AKey: string;
36263626 It := FProposalItems[SynCompletionProposal.IndexFromVisibleIndex(Index)];
36273627
36283628 if (It.ImageIndex >= 0) and (It.ImageIndex < ImageListMain.Count) then
3629- ImageListMain.Draw (ACanvas, X + Space, Y + 1, It.ImageIndex, True);
3629+ ImageListMain.DrawForControl (ACanvas, X + Space, Y + 1, It.ImageIndex, ImageListMain.Width, SynCompletionProposal.TheForm , True);
36303630
36313631 ACanvas.Brush.Style := bsClear;
36323632
3633- X1 := X + Space + ImageListMain.WidthForPPI[16, PixelsPerInch] + Space;
3633+ X1 := X + Space + ImageListMain.WidthForPPI[16, ACanvas.Font. PixelsPerInch] + Space;
36343634 ACanvas.Font.Style := [];
36353635 ACanvas.Font.Color := IfThen(Selected, clHighlightText, It.LeftColor);
36363636 ACanvas.TextOut(X1, Y + 1, It.LeftText);
@@ -6808,30 +6808,6 @@ procedure TMainForm.KillProcess(Sender: TObject);
68086808end;
68096809
68106810
6811- procedure TMainForm.SynCompletionProposalChange(Sender: TObject);
6812- {var
6813- Proposal: TSynCompletion;
6814- SelectedFuncName: String;
6815- SQLFunc: TSQLFunction;}
6816- begin
6817- {Proposal := Sender as TSynCompletionProposal;
6818- if (AIndex >= 0) and (AIndex < Proposal.ItemList.Count) then begin
6819- Proposal.Title := Proposal.InsertItem(AIndex);
6820- // Show function description in hint panel
6821- ShowStatusMsg('', 0);
6822- SelectedFuncName := RegExprGetMatch('...
6823- if not SelectedFuncName.IsEmpty then begin
6824- for SQLFunc in ActiveConnection.SQLFunctions do begin
6825- if SQLFunc.Name.ToUpper = SelectedFuncName.ToUpper then begin
6826- ShowStatusMsg(SQLFunc.Description.Replace(SLineBreak, ' '), 0);
6827- Break;
6828- end;
6829- end;
6830- end;
6831- end;}
6832- end;
6833-
6834-
68356811{ Proposal about to insert a String into synmemo }
68366812procedure TMainForm.SynCompletionProposalCodeCompletion(var Value: string;
68376813 SourceValue: string; var SourceStart, SourceEnd: TPoint; KeyChar: TUTF8Char;
0 commit comments