finished pretty colors

This commit is contained in:
codeimp 2007-10-20 10:02:20 +00:00
parent 3c4cf85a74
commit ac3e39b96d
5 changed files with 122 additions and 22 deletions

View file

@ -14,6 +14,31 @@ shortcuts
}
colors
{
background = -16777216;
vertices = -13395457;
linedefs = -1;
actions = -6815849;
sounds = -5257736;
highlight = -24576;
selection = -49152;
association = -128;
grid = -11645362;
grid64 = -13018769;
crosshair3d = -16711681;
highlight3d = -24576;
selection3d = -49152;
scriptbackground = -1;
linenumbers = -4144960;
plaintext = -16777216;
coments = -6908266;
keywords = -16776961;
literals = -16744448;
constants = -8388608;
}
mainwindow
{
positionx = 150;
@ -24,7 +49,11 @@ mainwindow
}
configurations
recentfiles
{
}
configurations
{
}

View file

@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.Interface
this.colorsgroup3 = new System.Windows.Forms.GroupBox();
this.colorconstants = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorliterals = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorControl1 = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorscriptbackground = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorkeywords = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorlinenumbers = new CodeImp.DoomBuilder.Interface.ColorControl();
this.colorcomments = new CodeImp.DoomBuilder.Interface.ColorControl();
@ -423,7 +423,7 @@ namespace CodeImp.DoomBuilder.Interface
//
this.colorsgroup3.Controls.Add(this.colorconstants);
this.colorsgroup3.Controls.Add(this.colorliterals);
this.colorsgroup3.Controls.Add(this.colorControl1);
this.colorsgroup3.Controls.Add(this.colorscriptbackground);
this.colorsgroup3.Controls.Add(this.colorkeywords);
this.colorsgroup3.Controls.Add(this.colorlinenumbers);
this.colorsgroup3.Controls.Add(this.colorcomments);
@ -458,16 +458,16 @@ namespace CodeImp.DoomBuilder.Interface
this.colorliterals.Size = new System.Drawing.Size(150, 23);
this.colorliterals.TabIndex = 15;
//
// colorControl1
// colorscriptbackground
//
this.colorControl1.BackColor = System.Drawing.SystemColors.Control;
this.colorControl1.Label = "Background:";
this.colorControl1.Location = new System.Drawing.Point(15, 27);
this.colorControl1.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorControl1.MinimumSize = new System.Drawing.Size(100, 23);
this.colorControl1.Name = "colorControl1";
this.colorControl1.Size = new System.Drawing.Size(150, 23);
this.colorControl1.TabIndex = 10;
this.colorscriptbackground.BackColor = System.Drawing.SystemColors.Control;
this.colorscriptbackground.Label = "Background:";
this.colorscriptbackground.Location = new System.Drawing.Point(15, 27);
this.colorscriptbackground.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorscriptbackground.MinimumSize = new System.Drawing.Size(100, 23);
this.colorscriptbackground.Name = "colorscriptbackground";
this.colorscriptbackground.Size = new System.Drawing.Size(150, 23);
this.colorscriptbackground.TabIndex = 10;
//
// colorkeywords
//
@ -617,7 +617,7 @@ namespace CodeImp.DoomBuilder.Interface
private ColorControl colorselection3d;
private ColorControl colorhighlight3d;
private ColorControl colorcrosshair3d;
private ColorControl colorControl1;
private ColorControl colorscriptbackground;
private ColorControl colorkeywords;
private ColorControl colorlinenumbers;
private ColorControl colorcomments;

View file

@ -89,6 +89,29 @@ namespace CodeImp.DoomBuilder.Interface
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift | (int)Keys.Control, "Ctrl+Shift+ScrollUp"));
actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift | (int)Keys.Control, "Ctrl+Shift+ScrollDown"));
// Set the colors
// TODO: Make this automated by using the collection
colorbackcolor.Color = General.Colors.Background;
colorvertices.Color = General.Colors.Vertices;
colorlinedefs.Color = General.Colors.Linedefs;
colorspeciallinedefs.Color = General.Colors.Actions;
colorsoundlinedefs.Color = General.Colors.Sounds;
colorhighlight.Color = General.Colors.Highlight;
colorselection.Color = General.Colors.Selection;
colorassociations.Color = General.Colors.Association;
colorgrid.Color = General.Colors.Grid;
colorgrid64.Color = General.Colors.Grid64;
colorcrosshair3d.Color = General.Colors.Crosshair3D;
colorhighlight3d.Color = General.Colors.Highlight3D;
colorselection3d.Color = General.Colors.Selection3D;
colorscriptbackground.Color = General.Colors.ScriptBackground;
colorlinenumbers.Color = General.Colors.LineNumbers;
colorplaintext.Color = General.Colors.PlainText;
colorcomments.Color = General.Colors.Comments;
colorkeywords.Color = General.Colors.Keywords;
colorliterals.Color = General.Colors.Literals;
colorconstants.Color = General.Colors.Constants;
// Done
allowapplycontrol = true;
}
@ -265,6 +288,29 @@ namespace CodeImp.DoomBuilder.Interface
foreach(ListViewItem item in listactions.Items)
General.Actions[item.Name].SetShortcutKey((int)item.SubItems[1].Tag);
// Apply the colors
// TODO: Make this automated by using the collection
General.Colors.Background.PixelColor = colorbackcolor.Color;
General.Colors.Vertices.PixelColor = colorvertices.Color;
General.Colors.Linedefs.PixelColor = colorlinedefs.Color;
General.Colors.Actions.PixelColor = colorspeciallinedefs.Color;
General.Colors.Sounds.PixelColor = colorsoundlinedefs.Color;
General.Colors.Highlight.PixelColor = colorhighlight.Color;
General.Colors.Selection.PixelColor = colorselection.Color;
General.Colors.Association.PixelColor = colorassociations.Color;
General.Colors.Grid.PixelColor = colorgrid.Color;
General.Colors.Grid64.PixelColor = colorgrid64.Color;
General.Colors.Crosshair3D.PixelColor = colorcrosshair3d.Color;
General.Colors.Highlight3D.PixelColor = colorhighlight3d.Color;
General.Colors.Selection3D.PixelColor = colorselection3d.Color;
General.Colors.ScriptBackground.PixelColor = colorscriptbackground.Color;
General.Colors.LineNumbers.PixelColor = colorlinenumbers.Color;
General.Colors.PlainText.PixelColor = colorplaintext.Color;
General.Colors.Comments.PixelColor = colorcomments.Color;
General.Colors.Keywords.PixelColor = colorkeywords.Color;
General.Colors.Literals.PixelColor = colorliterals.Color;
General.Colors.Constants.PixelColor = colorconstants.Color;
// Close
this.DialogResult = DialogResult.OK;
this.Close();
@ -285,6 +331,7 @@ namespace CodeImp.DoomBuilder.Interface
// Tab changes
private void tabs_SelectedIndexChanged(object sender, EventArgs e)
{
// Enable/disable stuff with tabs
if(tabs.SelectedTab != tabkeys) this.AcceptButton = apply; else this.AcceptButton = null;
if(tabs.SelectedTab != tabkeys) this.CancelButton = cancel; else this.CancelButton = null;
colorsgroup1.Visible = (tabs.SelectedTab == tabcolors);

View file

@ -44,11 +44,28 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Properties
private ColorSetting Background { get { return colors["background"]; } }
private ColorSetting Vertex { get { return colors["vertex"]; } }
private ColorSetting Linedef { get { return colors["linedef"]; } }
private ColorSetting Highlight { get { return colors["highlight"]; } }
private ColorSetting Selection { get { return colors["selection"]; } }
public ColorSetting Background { get { return colors["background"]; } }
public ColorSetting Vertices { get { return colors["vertices"]; } }
public ColorSetting Linedefs { get { return colors["linedefs"]; } }
public ColorSetting Actions { get { return colors["actions"]; } }
public ColorSetting Sounds { get { return colors["sounds"]; } }
public ColorSetting Highlight { get { return colors["highlight"]; } }
public ColorSetting Selection { get { return colors["selection"]; } }
public ColorSetting Association { get { return colors["association"]; } }
public ColorSetting Grid { get { return colors["grid"]; } }
public ColorSetting Grid64 { get { return colors["grid64"]; } }
public ColorSetting Crosshair3D { get { return colors["crosshair3d"]; } }
public ColorSetting Highlight3D { get { return colors["highlight3d"]; } }
public ColorSetting Selection3D { get { return colors["selection3d"]; } }
public ColorSetting ScriptBackground { get { return colors["scriptbackground"]; } }
public ColorSetting LineNumbers { get { return colors["linenumbers"]; } }
public ColorSetting PlainText { get { return colors["plaintext"]; } }
public ColorSetting Comments { get { return colors["coments"]; } }
public ColorSetting Keywords { get { return colors["keywords"]; } }
public ColorSetting Literals { get { return colors["literals"]; } }
public ColorSetting Constants { get { return colors["constants"]; } }
#endregion
@ -85,7 +102,7 @@ namespace CodeImp.DoomBuilder.Rendering
foreach(KeyValuePair<string, ColorSetting> c in collection.colors)
{
// Copy
colors.Add(c.Key, new ColorSetting(c.Key, c.Value.Color));
colors.Add(c.Key, new ColorSetting(c.Key, c.Value.PixelColor));
}
// We have no destructor
@ -103,7 +120,7 @@ namespace CodeImp.DoomBuilder.Rendering
foreach(KeyValuePair<string, ColorSetting> c in collection.colors)
{
// Add or update
colors[c.Key] = new ColorSetting(c.Key, c.Value.Color);
colors[c.Key] = new ColorSetting(c.Key, c.Value.PixelColor);
}
}
@ -114,7 +131,7 @@ namespace CodeImp.DoomBuilder.Rendering
foreach(KeyValuePair<string, ColorSetting> c in colors)
{
// Write to configuration
cfg.WriteSetting("colors." + c.Key, c.Value.Color.ToInt());
cfg.WriteSetting("colors." + c.Key, c.Value.PixelColor.ToInt());
}
}

View file

@ -43,7 +43,8 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Properties
public PixelColor Color { get { return color; } }
public Color Color { get { return Color.FromArgb(color.ToInt()); } set { color = PixelColor.FromColor(value); } }
public PixelColor PixelColor { get { return color; } set { color = value; } }
public string Name { get { return name; } }
#endregion
@ -76,6 +77,12 @@ namespace CodeImp.DoomBuilder.Rendering
{
return c.color;
}
// To Color
public static implicit operator Color(ColorSetting c)
{
return Color.FromArgb(c.color.ToInt());
}
#endregion
}