Tabs Studio Blog (organizing Visual Studio document tabs)

May 8, 2010

Styling tabs in a separate window

Filed under: Uncategorized — Tags: , — Sergey Vlasov @ 7:43 pm

In Visual Studio 2010 default style for tabs uses left and right margins of 1 pixel:

<Style x:Key="DefaultTabsStyle" TargetType="TabsStudio:Tabs">
  <Setter Property="Margin" Value="1,0,1,0"/>
</Style>

It makes transition between Tabs Studio tabs and Visual Studio border under the tabs in the left and right corners smooth:

Left tab margin

Left tab margin


When tabs are in a separate window, default margins create white lines to the left and to the right of the tabs:
White lines to the left and to the right of the tabs

White lines to the left and to the right of the tabs


Setting margins to 0 removes these lines:

<Style TargetType="TabsStudio:Tabs" BasedOn="{StaticResource DefaultTabsStyle}">
  <Setter Property="Margin" Value="0,0,0,0"/>
</Style>

Excessive tabs margins removed

Excessive tabs margins removed

Another useful customization for tabs in a separate window is tabs background. The default background in VS 2010 style is transparent, it results in dark blue for normal tabs placement and white for tabs in a separate window. As an example, the following style sets tabs background to dark blue:

<Style TargetType="TabsStudio:Tabs" BasedOn="{StaticResource DefaultTabsStyle}">
  <Setter Property="Background" Value="#293955"/>
</Style>

Dark blue tabs background

Dark blue tabs background


A similar style can be used to customize tabs background in VS 2008, which is by default grey control brush.

2 Comments

  1. Hi and thanks for your great program.

    I have four little problems with TabsStudio and SSMS:

    For the first one, I would like if it’s possible to have the name of the script in Bold even when there is a single script for the tab. At this moment, the current script is marked in bold only when there is more than one on its tab but when you have a combination of tabs; some with many scripts and some with only one, it makes it hard and confusing to find the name of the script for each tab or simply to find which tab is the active one; as the eyes tend to read bold names first.

    This would also be helpful when the name of the database is very long, as it’s often the case with SSMS, making it difficult to distinguish from the
    name of the script;

    The second problem if when there is an hyphen ” – ” (with a space on both side) inside the name of the script. When this happens, the second part of the name of the script is written at the beginning of the tab; before the name of the database.

    The third problem is that the program doesn’t seem to be able to compute the total length of the database name + the name of the script: when there is not enough space on the tab, the right part of the tab become hidden. If possible, the program should display these scripts on different tabs when there is not enough space for them on a single tab.

    Finally, the last problem is another suggestion: most of the time, I’m not interested to see the name of the database on the tab as it’s often the same for all scripts and also because it’s available on the status bar at the bottom of the window. So I would like to know if it’s possible to hide it or to choose to print only a part of it. It would be interesting if the program was capable of splitting the full name of the database into its components (server name, database name, process id) and give us the possibility to display what we want. For the process ID, (the number between parenthesis), this should be associated with the script name as each window is associated with a different process id.

    For the rest, thanks for your great program!

    Comment by Sylvain Lafontaine — May 9, 2010 @ 11:36 pm

    • Sylvain,
      1. It’s not currently possible to have the name of the script in Bold in a single tab, but you can customize the active tab background to stand it out.
      2. To handle a hyphen inside the script name, “Title grouping regex” needs to be slightly adjusted. Instead of
      (?<Ext>.+?) – (?<Name>.+?) \(.+\)
      use
      (?<Ext>.+) – (?<Name>.+?) \(.+\)
      so that complete “Title grouping regex” be
      (?<Ext>.+?) – (?<Name>not connected)$|(?<Ext>.+) – (?<Name>.+?) \(.+\)$|(?<Name>.+?) – (?<Ext>.+)
      3. Yes, currently script names are added to tabs as long as “Maximum number of tabs in a group” is not reached, not taking into account available tab width. So, one workaround is to reduce this maximum value.
      4. You most probably want to look at the tab text options in SSMS to selectively hide title components.

      Thank you for your feedback. If you contact me via e-mail and send your current screenshots I can give you more specific answers about background and regex customization.

      Comment by Sergey Vlasov — May 10, 2010 @ 11:49 am


RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Blog at WordPress.com.