[Qttabbar-Commit] SF.net SVN: qttabbar:[355] branches/options/QTTabBar
Status: Beta
Brought to you by:
masamunexgp
From: <mas...@us...> - 2011-12-07 00:22:39
|
Revision: 355 http://qttabbar.svn.sourceforge.net/qttabbar/?rev=355&view=rev Author: masamunexgp Date: 2011-12-07 00:22:32 +0000 (Wed, 07 Dec 2011) Log Message: ----------- Fixed alternate row background/foreground color selection on the Tweaks tab. Modified Paths: -------------- branches/options/QTTabBar/Config.cs branches/options/QTTabBar/ExtendedSysListView32.cs branches/options/QTTabBar/OptionsDialog.xaml branches/options/QTTabBar/OptionsDialog.xaml.cs branches/options/QTTabBar/OptionsDialog_OLD.cs branches/options/QTTabBar/QTTabBarClass.cs branches/options/QTTabBar/QTUtility.cs Modified: branches/options/QTTabBar/Config.cs =================================================================== --- branches/options/QTTabBar/Config.cs 2011-12-06 20:43:33 UTC (rev 354) +++ branches/options/QTTabBar/Config.cs 2011-12-07 00:22:32 UTC (rev 355) @@ -302,10 +302,9 @@ public bool ToggleFullRowSelect { get; set; } public bool DetailsGridLines { get; set; } public bool AlternateRowColors { get; set; } - public Color BackgroundColor { get; set; } - public Color TextColor { get; set; } + public Color AltRowBackgroundColor { get; set; } + public Color AltRowForegroundColor { get; set; } - public _Tweaks() { AlwaysShowHeaders = false; KillExtWhileRenaming = true; @@ -318,8 +317,8 @@ ToggleFullRowSelect = false; DetailsGridLines = false; AlternateRowColors = false; - TextColor = new Color(); - BackgroundColor = new Color(); + AltRowForegroundColor = SystemColors.WindowText; + AltRowBackgroundColor = QTUtility2.MakeColor(0xfaf5f1); } } Modified: branches/options/QTTabBar/ExtendedSysListView32.cs =================================================================== --- branches/options/QTTabBar/ExtendedSysListView32.cs 2011-12-06 20:43:33 UTC (rev 354) +++ branches/options/QTTabBar/ExtendedSysListView32.cs 2011-12-07 00:22:32 UTC (rev 355) @@ -455,8 +455,8 @@ if(!QTUtility.IsXP) { int num4 = lstColumnFMT[structure.iSubItem]; - structure.clrTextBk = QTUtility.ShellViewRowCOLORREF_Background; - structure.clrText = QTUtility.ShellViewRowCOLORREF_Text; + structure.clrTextBk = QTUtility2.MakeCOLORREF(Config.Tweaks.AltRowBackgroundColor); + structure.clrText = QTUtility2.MakeCOLORREF(Config.Tweaks.AltRowForegroundColor); Marshal.StructureToPtr(structure, msg.LParam, false); bool drawingHotItem = (dwItemSpec == GetHotItem()); bool fullRowSel = !Config.Tweaks.ToggleFullRowSelect; @@ -475,7 +475,7 @@ if(!fullRowSel || (iListViewItemState & (LVIS.SELECTED | LVIS.DROPHILITED)) == 0) { using(Graphics graphics = Graphics.FromHdc(structure.nmcd.hdc)) { if(QTUtility.sbAlternate == null) { - QTUtility.sbAlternate = new SolidBrush(QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background)); + QTUtility.sbAlternate = new SolidBrush(Config.Tweaks.AltRowBackgroundColor); } graphics.FillRectangle(QTUtility.sbAlternate, structure.nmcd.rc.ToRectangle()); } @@ -513,7 +513,7 @@ Marshal.StructureToPtr(lvitem, ptr3, false); PInvoke.SendMessage(ListViewController.Handle, LVM.GETITEM, IntPtr.Zero, ptr3); if(QTUtility.sbAlternate == null) { - QTUtility.sbAlternate = new SolidBrush(QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background)); + QTUtility.sbAlternate = new SolidBrush(Config.Tweaks.AltRowBackgroundColor); } using(Graphics graphics2 = Graphics.FromHdc(structure.nmcd.hdc)) { Rectangle rect = rc.ToRectangle(); @@ -601,7 +601,7 @@ PInvoke.SetTextColor(structure.nmcd.hdc, QTUtility2.MakeCOLORREF((fListViewHasFocus || flag4) ? SystemColors.HighlightText : SystemColors.WindowText)); } else { - PInvoke.SetTextColor(structure.nmcd.hdc, QTUtility.ShellViewRowCOLORREF_Text); + PInvoke.SetTextColor(structure.nmcd.hdc, QTUtility2.MakeCOLORREF(Config.Tweaks.AltRowForegroundColor)); } PInvoke.DrawTextExW(structure.nmcd.hdc, lvitem.pszText, -1, ref rc, dwDTFormat, IntPtr.Zero); Marshal.FreeHGlobal(lvitem.pszText); Modified: branches/options/QTTabBar/OptionsDialog.xaml =================================================================== --- branches/options/QTTabBar/OptionsDialog.xaml 2011-12-06 20:43:33 UTC (rev 354) +++ branches/options/QTTabBar/OptionsDialog.xaml 2011-12-07 00:22:32 UTC (rev 355) @@ -1041,7 +1041,7 @@ <TabItem x:Name="tabTweaks" DataContext="{Binding Path=tweaks}" Header="Tweaks" - Width="0" Loaded="tabTweaks_Loaded"> + Width="0"> <StackPanel Margin="14,5,10,0" Orientation="Vertical"> @@ -1109,35 +1109,46 @@ IsChecked="{Binding Path=AlternateRowColors}" IsEnabled="{Binding Path=IsChecked, ElementName=chkForceSysListView}" Style="{StaticResource CheckStyle}"/> - <StackPanel - Orientation="Horizontal"> - <Button x:Name="btnBackgroundColor" - Click="btnBackgroundColor_Click" - Content="Background Color" - Height="23" - Margin="31,2,5,2" - Width="120"> - <Button.IsEnabled> - <MultiBinding Converter="{StaticResource LogicalAndMultiConverter}"> - <Binding Path="IsChecked" ElementName="chkAlternateRowColors"/> - <Binding Path="IsEnabled" ElementName="chkAlternateRowColors"/> - </MultiBinding> - </Button.IsEnabled> - </Button> - <Button x:Name="btnTextColor" - Click="btnTextColor_Click" - Content="Text Color" - Height="23" - Margin="5,2" - Width="120"> - <Button.IsEnabled> - <MultiBinding Converter="{StaticResource LogicalAndMultiConverter}"> - <Binding Path="IsChecked" ElementName="chkAlternateRowColors"/> - <Binding Path="IsEnabled" ElementName="chkAlternateRowColors"/> - </MultiBinding> - </Button.IsEnabled> - </Button> - </StackPanel> + <Grid Margin="31,2,5,2"> + <Grid.IsEnabled> + <MultiBinding Converter="{StaticResource LogicalAndMultiConverter}"> + <Binding Path="IsChecked" ElementName="chkAlternateRowColors"/> + <Binding Path="IsEnabled" ElementName="chkAlternateRowColors"/> + </MultiBinding> + </Grid.IsEnabled> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Label + Content="Foreground color: " + Grid.Column="0" + Grid.Row="0"/> + <Label + Content="Background color: " + Grid.Column="0" + Grid.Row="1"/> + <Button x:Name="btnAltRowForeground" + Background="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}" + Click="btnAltRowColor_Click" + Grid.Column="1" + Grid.Row="0" + Height="22" + Tag="{Binding Path=AltRowForegroundColor, Mode=TwoWay}" + Width="22"/> + <Button x:Name="btnAltRowBackground" + Background="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}" + Click="btnAltRowColor_Click" + Grid.Column="1" + Grid.Row="1" + Height="22" + Tag="{Binding Path=AltRowBackgroundColor, Mode=TwoWay}" + Width="22" /> + </Grid> </StackPanel> </TabItem> <TabItem x:Name="tabTooltips" Modified: branches/options/QTTabBar/OptionsDialog.xaml.cs =================================================================== --- branches/options/QTTabBar/OptionsDialog.xaml.cs 2011-12-06 20:43:33 UTC (rev 354) +++ branches/options/QTTabBar/OptionsDialog.xaml.cs 2011-12-07 00:22:32 UTC (rev 355) @@ -461,34 +461,15 @@ #region ---------- Tweaks ---------- - // TODO: rethink this - private void btnBackgroundColor_Click(object sender, RoutedEventArgs e) { - ColorDialogEx cd = new ColorDialogEx(); + private void btnAltRowColor_Click(object sender, RoutedEventArgs e) { + // Works for both buttons. Each button's Tag is bound to the corresponding property. + var button = (Button)sender; + ColorDialogEx cd = new ColorDialogEx { Color = (System.Drawing.Color)button.Tag }; if(System.Windows.Forms.DialogResult.OK == cd.ShowDialog()) { - Config.Tweaks.BackgroundColor = cd.Color; - btnBackgroundColor.Background = new SolidColorBrush(Color.FromArgb( - cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B)); + button.Tag = cd.Color; } } - private void btnTextColor_Click(object sender, RoutedEventArgs e) { - ColorDialogEx cd = new ColorDialogEx(); - if(System.Windows.Forms.DialogResult.OK == cd.ShowDialog()) { - Config.Tweaks.TextColor = cd.Color; - btnTextColor.Foreground = new SolidColorBrush(Color.FromArgb( - cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B)); - } - } - - private void tabTweaks_Loaded(object sender, RoutedEventArgs e) { - System.Drawing.Color bg = Config.Tweaks.BackgroundColor; - System.Drawing.Color txt = Config.Tweaks.TextColor; - btnTextColor.Foreground = new SolidColorBrush(Color.FromArgb( - txt.A, txt.R, txt.G, txt.B)); - btnBackgroundColor.Background = new SolidColorBrush(Color.FromArgb( - bg.A, bg.R, bg.G, bg.B)); - } - #endregion #region ---------- Tooltips ---------- Modified: branches/options/QTTabBar/OptionsDialog_OLD.cs =================================================================== --- branches/options/QTTabBar/OptionsDialog_OLD.cs 2011-12-06 20:43:33 UTC (rev 354) +++ branches/options/QTTabBar/OptionsDialog_OLD.cs 2011-12-07 00:22:32 UTC (rev 355) @@ -631,10 +631,10 @@ private void btnAlternateColor_Click(object sender, EventArgs e) { if(sender == btnAlternate_Default) { - QTUtility.ShellViewRowCOLORREF_Background = 0xfaf5f1; + //QTUtility.ShellViewRowCOLORREF_Background = 0xfaf5f1; Color windowText = SystemColors.WindowText; - QTUtility.ShellViewRowCOLORREF_Text = QTUtility2.MakeCOLORREF(windowText); - btnAlternateColor.BackColor = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background); + //QTUtility.ShellViewRowCOLORREF_Text = QTUtility2.MakeCOLORREF(windowText); + //btnAlternateColor.BackColor = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background); btnAlternateColor_Text.ForeColor = windowText; } else { @@ -4196,8 +4196,8 @@ chbGridLine.Checked = (QTUtility.ConfigValues[8] & 0x80) == 0x80; chbNoFulRowSelect.Checked = ((QTUtility.ConfigValues[8] & 0x40) == 0x40) ^ !QTUtility.IsXP; chbAlternateColor.Checked = (QTUtility.ConfigValues[8] & 8) == 8; - btnAlternateColor.BackColor = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background); - btnAlternateColor_Text.ForeColor = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Text); + //btnAlternateColor.BackColor = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background); + //btnAlternateColor_Text.ForeColor = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Text); btnAlternate_Default.Enabled = btnAlternateColor.Enabled = btnAlternateColor_Text.Enabled = chbAlternateColor.Checked; if(isSupported) { chbRebarBGImage.Checked = (QTUtility.ConfigValues[11] & 0x80) == 0x80; @@ -4666,8 +4666,8 @@ //key.SetValue("TitleColorShadowActive", QTUtility.TabTextColor_ActivShdw.ToArgb()); //key.SetValue("TitleColorShadowInActv", QTUtility.TabTextColor_InAtvShdw.ToArgb()); //key.SetValue("ToolbarBGColor", QTUtility.RebarBGColor.ToArgb()); - key.SetValue("AlternateColor_Bk", QTUtility.ShellViewRowCOLORREF_Background); - key.SetValue("AlternateColor_Text", QTUtility.ShellViewRowCOLORREF_Text); + //key.SetValue("AlternateColor_Bk", QTUtility.ShellViewRowCOLORREF_Background); + //key.SetValue("AlternateColor_Text", QTUtility.ShellViewRowCOLORREF_Text); key.SetValue("Max_Undo", QTUtility.MaxCount_History); key.SetValue("Max_RecentFile", QTUtility.MaxCount_Executed); key.SetValue("PreviewMaxWidth", QTUtility.PreviewMaxWidth); Modified: branches/options/QTTabBar/QTTabBarClass.cs =================================================================== --- branches/options/QTTabBar/QTTabBarClass.cs 2011-12-06 20:43:33 UTC (rev 354) +++ branches/options/QTTabBar/QTTabBarClass.cs 2011-12-07 00:22:32 UTC (rev 355) @@ -4832,7 +4832,7 @@ SetBarRows(tabControl1.SetTabRowType(iType)); rebarController.RefreshBG(); if(Config.Tweaks.AlternateRowColors) { - Color color = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background); + Color color = Config.Tweaks.AltRowBackgroundColor; if(QTUtility.sbAlternate == null) { QTUtility.sbAlternate = new SolidBrush(color); } Modified: branches/options/QTTabBar/QTUtility.cs =================================================================== --- branches/options/QTTabBar/QTUtility.cs 2011-12-06 20:43:33 UTC (rev 354) +++ branches/options/QTTabBar/QTUtility.cs 2011-12-07 00:22:32 UTC (rev 355) @@ -92,8 +92,6 @@ internal static SolidBrush sbAlternate; internal static readonly char[] SEPARATOR_CHAR = new char[] { ';' }; internal const string SEPARATOR_PATH_HASH_SESSION = "*?*?*"; - internal static int ShellViewRowCOLORREF_Background; - internal static int ShellViewRowCOLORREF_Text; internal static List<string> StartUpGroupList = new List<string>(); internal static string StartUpGroupNameNowOpening = string.Empty; internal static Font StartUpTabFont; @@ -139,8 +137,6 @@ Path_LanguageFile = string.Empty; } ValidateTextResources(); - ShellViewRowCOLORREF_Background = QTUtility2.GetRegistryValueSafe(key, "AlternateColor_Bk", 0xfaf5f1); - ShellViewRowCOLORREF_Text = QTUtility2.GetRegistryValueSafe(key, "AlternateColor_Text", QTUtility2.MakeCOLORREF(SystemColors.WindowText)); Action_BarDblClick = (string)key.GetValue("Action_BarDblClick", string.Empty); MaxCount_History = QTUtility2.GetRegistryValueSafe(key, "Max_Undo", 0x10); using(RegistryKey key2 = key.CreateSubKey("RecentlyClosed")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |