Skip to content
Permalink
Browse files

Use up to 70 characters on a main tab caption before adding ellipsis.…

… Gives long table names more room.
  • Loading branch information
ansgarbecker committed Nov 26, 2019
1 parent 810fdc9 commit 54e05e5d2395101578e1851e977d7c43551d6f4b
Showing with 5 additions and 4 deletions.
  1. +5 −4 source/main.pas
@@ -8718,8 +8718,8 @@ procedure TMainForm.DBtreeFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualN
InvalidateVT(ListTables, VTREE_NOTLOADED, True);
if FActiveDbObj.NodeType = lntGroup then
InvalidateVT(ListTables, VTREE_NOTLOADED, True);
tabHost.Caption := _('Host')+': '+StrEllipsis(FActiveDbObj.Connection.Parameters.HostName, 20);
tabDatabase.Caption := _('Database')+': '+StrEllipsis(FActiveDbObj.Connection.Database, 20);
SetTabCaption(tabHost.PageIndex, _('Host')+': '+FActiveDbObj.Connection.Parameters.HostName);
SetTabCaption(tabDatabase.PageIndex, _('Database')+': '+FActiveDbObj.Connection.Database);
ShowStatusMsg(FActiveDbObj.Connection.Parameters.NetTypeName(False)+' '+FActiveDbObj.Connection.ServerVersionStr, 3);
end else begin
LogSQL('DBtreeFocusChanged without node.', lcDebug);
@@ -10679,7 +10679,7 @@ procedure TMainForm.UpdateEditorTab;
if ActiveObjectEditor.DBObject.Name = '' then
Cap := Cap + '['+_('Untitled')+']'
else
Cap := StrEllipsis(Cap + ActiveObjectEditor.DBObject.Name, 30);
Cap := Cap + ActiveObjectEditor.DBObject.Name;
SetTabCaption(tabEditor.PageIndex, Cap);
end;

@@ -11428,6 +11428,7 @@ procedure TMainForm.SetTabCaption(PageIndex: Integer; Text: String);
// Some cases pass -1 which triggers a "List index out of bounds" in below cast
if PageIndex = -1 then
Exit;
Text := StrEllipsis(Text, 70);
// Special case if passed text is empty: Reset query tab caption to "Query #123"
if (PageIndex = tabQuery.PageIndex) and (Text = '') then
Text := _('Query');
@@ -13345,7 +13346,7 @@ function TQueryTab.BindParamsActivated: Boolean;
procedure TQueryTab.SetMemoFilename(Value: String);
begin
FMemoFilename := Value;
MainForm.SetTabCaption(TabSheet.PageIndex, StrEllipsis(ExtractFilename(FMemoFilename), 70));
MainForm.SetTabCaption(TabSheet.PageIndex, ExtractFilename(FMemoFilename));
MainForm.ValidateQueryControls(Self);
if FMemoFilename <> '' then begin
DirectoryWatch.Directory := ExtractFilePath(FMemoFilename);

0 comments on commit 54e05e5

Please sign in to comment.
You can’t perform that action at this time.