mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-07 08:21:59 +00:00
Fixed, Visual mode: "Paste Texture Flood-Fill" action used long texture names regardless of current setting in Map Options.
Internal: "uselongtexturenames" setting is now stored in map settings file, not in the program configuration file. Fixed, Color Picker plugin: in some cases mouse movement was processed incorrectly. Fixed, Color Picker plugin: float color value output was culture settings-dependant.
This commit is contained in:
parent
321a56a850
commit
0ea022fa4e
11 changed files with 86 additions and 61 deletions
|
@ -1665,7 +1665,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
// When resetsectormarks is set to true, all sectors will first be marked false (not aligned).
|
// When resetsectormarks is set to true, all sectors will first be marked false (not aligned).
|
||||||
// Setting resetsectormarks to false is usefull to fill only within a specific selection
|
// Setting resetsectormarks to false is usefull to fill only within a specific selection
|
||||||
// (set the marked property to true for the sectors outside the selection)
|
// (set the marked property to true for the sectors outside the selection)
|
||||||
public static void FloodfillFlats(Sector start, bool fillceilings, long originalflat, ImageData fillflat, bool resetsectormarks)
|
public static void FloodfillFlats(Sector start, bool fillceilings, long originalflat, string fillflat, bool resetsectormarks)
|
||||||
{
|
{
|
||||||
Stack<Sector> todo = new Stack<Sector>(50);
|
Stack<Sector> todo = new Stack<Sector>(50);
|
||||||
|
|
||||||
|
@ -1686,10 +1686,8 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
Sector s = todo.Pop();
|
Sector s = todo.Pop();
|
||||||
|
|
||||||
// Apply new flat
|
// Apply new flat
|
||||||
if(fillceilings)
|
if(fillceilings) s.SetCeilTexture(fillflat);
|
||||||
s.SetCeilTexture(fillflat.Name);
|
else s.SetFloorTexture(fillflat);
|
||||||
else
|
|
||||||
s.SetFloorTexture(fillflat.Name);
|
|
||||||
s.Marked = true;
|
s.Marked = true;
|
||||||
|
|
||||||
// Go for all sidedefs to add neighbouring sectors
|
// Go for all sidedefs to add neighbouring sectors
|
||||||
|
@ -1720,7 +1718,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
// When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned).
|
// When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned).
|
||||||
// Setting resetsidemarks to false is usefull to fill only within a specific selection
|
// Setting resetsidemarks to false is usefull to fill only within a specific selection
|
||||||
// (set the marked property to true for the sidedefs outside the selection)
|
// (set the marked property to true for the sidedefs outside the selection)
|
||||||
public static void FloodfillTextures(Sidedef start, long originaltexture, ImageData filltexture, bool resetsidemarks)
|
public static void FloodfillTextures(Sidedef start, long originaltexture, string filltexture, bool resetsidemarks)
|
||||||
{
|
{
|
||||||
Stack<SidedefFillJob> todo = new Stack<SidedefFillJob>(50);
|
Stack<SidedefFillJob> todo = new Stack<SidedefFillJob>(50);
|
||||||
|
|
||||||
|
@ -1743,10 +1741,11 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
SidedefFillJob j = todo.Pop();
|
SidedefFillJob j = todo.Pop();
|
||||||
|
|
||||||
// Apply texturing
|
// Apply texturing
|
||||||
if(j.sidedef.HighRequired() && j.sidedef.LongHighTexture == originaltexture) j.sidedef.SetTextureHigh(filltexture.Name);
|
if(j.sidedef.HighRequired() && j.sidedef.LongHighTexture == originaltexture) j.sidedef.SetTextureHigh(filltexture);
|
||||||
if((j.sidedef.LongMiddleTexture != MapSet.EmptyLongName || j.sidedef.MiddleRequired()) &&
|
if((j.sidedef.LongMiddleTexture != MapSet.EmptyLongName || j.sidedef.MiddleRequired()) &&
|
||||||
(j.sidedef.LongMiddleTexture == originaltexture)) j.sidedef.SetTextureMid(filltexture.Name);
|
(j.sidedef.LongMiddleTexture == originaltexture)) j.sidedef.SetTextureMid(filltexture);
|
||||||
if(j.sidedef.LowRequired() && j.sidedef.LongLowTexture == originaltexture) j.sidedef.SetTextureLow(filltexture.Name);
|
if(j.sidedef.LowRequired() && j.sidedef.LongLowTexture == originaltexture) j.sidedef.SetTextureLow(filltexture);
|
||||||
|
|
||||||
j.sidedef.Marked = true;
|
j.sidedef.Marked = true;
|
||||||
|
|
||||||
if(j.forward)
|
if(j.forward)
|
||||||
|
|
|
@ -79,6 +79,9 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
private bool overridefloorheight;
|
private bool overridefloorheight;
|
||||||
private bool overrideceilheight;
|
private bool overrideceilheight;
|
||||||
private bool overridebrightness;
|
private bool overridebrightness;
|
||||||
|
|
||||||
|
//mxd.
|
||||||
|
private bool uselongtexturenames;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -130,6 +133,9 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
public bool OverrideCeilingHeight { get { return overrideceilheight; } set { overrideceilheight = value; } }
|
public bool OverrideCeilingHeight { get { return overrideceilheight; } set { overrideceilheight = value; } }
|
||||||
public bool OverrideBrightness { get { return overridebrightness; } set { overridebrightness = value; } }
|
public bool OverrideBrightness { get { return overridebrightness; } set { overridebrightness = value; } }
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
public bool UseLongTextureNames { get { return uselongtexturenames; } set { uselongtexturenames = value; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Constructor / Disposer
|
#region ================== Constructor / Disposer
|
||||||
|
@ -154,7 +160,7 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor to load from Doom Builder Map Settings Configuration
|
// Constructor to load from Doom Builder Map Settings Configuration
|
||||||
internal MapOptions(Configuration cfg, string mapname)
|
internal MapOptions(Configuration cfg, string mapname, bool longtexturenamessupported)
|
||||||
{
|
{
|
||||||
IDictionary resinfo;
|
IDictionary resinfo;
|
||||||
DataLocation res;
|
DataLocation res;
|
||||||
|
@ -213,6 +219,9 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
overrideceilheight = this.mapconfig.ReadSetting("overrideceilheight", false);
|
overrideceilheight = this.mapconfig.ReadSetting("overrideceilheight", false);
|
||||||
overridebrightness = this.mapconfig.ReadSetting("overridebrightness", false);
|
overridebrightness = this.mapconfig.ReadSetting("overridebrightness", false);
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
uselongtexturenames = longtexturenamessupported && this.mapconfig.ReadSetting("uselongtexturenames", false);
|
||||||
|
|
||||||
// Resources
|
// Resources
|
||||||
IDictionary reslist = this.mapconfig.ReadSetting("resources", new Hashtable());
|
IDictionary reslist = this.mapconfig.ReadSetting("resources", new Hashtable());
|
||||||
foreach(DictionaryEntry mp in reslist)
|
foreach(DictionaryEntry mp in reslist)
|
||||||
|
@ -334,6 +343,9 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
mapconfig.WriteSetting("overrideceilheight", overrideceilheight);
|
mapconfig.WriteSetting("overrideceilheight", overrideceilheight);
|
||||||
mapconfig.WriteSetting("overridebrightness", overridebrightness);
|
mapconfig.WriteSetting("overridebrightness", overridebrightness);
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
mapconfig.WriteSetting("uselongtexturenames", uselongtexturenames);
|
||||||
|
|
||||||
//mxd. Write script compiler
|
//mxd. Write script compiler
|
||||||
if(!string.IsNullOrEmpty(scriptcompiler))
|
if(!string.IsNullOrEmpty(scriptcompiler))
|
||||||
mapconfig.WriteSetting("scriptcompiler", scriptcompiler);
|
mapconfig.WriteSetting("scriptcompiler", scriptcompiler);
|
||||||
|
|
|
@ -193,7 +193,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
// Create new map options, pass settings which should stay unchanged
|
// Create new map options, pass settings which should stay unchanged
|
||||||
//TODO: are there other settings which should stay unchanged?..
|
//TODO: are there other settings which should stay unchanged?..
|
||||||
MapOptions newoptions = new MapOptions(mapsettings, mapslist.SelectedItems[0].Text);
|
MapOptions newoptions = new MapOptions(mapsettings, mapslist.SelectedItems[0].Text, options.UseLongTextureNames);
|
||||||
newoptions.ConfigFile = options.ConfigFile;
|
newoptions.ConfigFile = options.ConfigFile;
|
||||||
options = newoptions;
|
options = newoptions;
|
||||||
|
|
||||||
|
|
|
@ -473,8 +473,23 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
else
|
else
|
||||||
mapsettings = new Configuration(true);
|
mapsettings = new Configuration(true);
|
||||||
|
|
||||||
|
//mxd. Get proper configuration file
|
||||||
|
bool longtexturenamessupported = false;
|
||||||
|
string configfile = General.AutoLoadConfig;
|
||||||
|
if(string.IsNullOrEmpty(configfile)) configfile = mapsettings.ReadSetting("gameconfig", "");
|
||||||
|
if(configfile.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
showdialog = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TODO: test this!
|
||||||
|
Configuration gamecfg = new Configuration(configfile);
|
||||||
|
longtexturenamessupported = gamecfg.ReadSetting("longtexturenames", false);
|
||||||
|
}
|
||||||
|
|
||||||
// Set map name and other options
|
// Set map name and other options
|
||||||
options = new MapOptions(mapsettings, General.AutoLoadMap);
|
options = new MapOptions(mapsettings, General.AutoLoadMap, longtexturenamessupported);
|
||||||
|
|
||||||
// Set resource data locations
|
// Set resource data locations
|
||||||
options.CopyResources(General.AutoLoadResources);
|
options.CopyResources(General.AutoLoadResources);
|
||||||
|
@ -483,9 +498,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
options.StrictPatches = General.AutoLoadStrictPatches;
|
options.StrictPatches = General.AutoLoadStrictPatches;
|
||||||
|
|
||||||
// Set configuration file (constructor already does this, but we want this info from the cmd args if possible)
|
// Set configuration file (constructor already does this, but we want this info from the cmd args if possible)
|
||||||
options.ConfigFile = General.AutoLoadConfig;
|
options.ConfigFile = configfile;
|
||||||
if(options.ConfigFile == null) options.ConfigFile = mapsettings.ReadSetting("gameconfig", "");
|
|
||||||
if(options.ConfigFile.Trim().Length == 0) showdialog = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -283,7 +283,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. Use long texture names?
|
//mxd. Use long texture names?
|
||||||
if(longtexturenames.Enabled) General.Settings.WriteSetting("browserwindow.uselongtexturenames", longtexturenames.Checked);
|
if(longtexturenames.Enabled) options.UseLongTextureNames = longtexturenames.Checked;
|
||||||
|
|
||||||
// Hide window
|
// Hide window
|
||||||
this.DialogResult = DialogResult.OK;
|
this.DialogResult = DialogResult.OK;
|
||||||
|
@ -337,7 +337,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
// Update long texture names checkbox (mxd)
|
// Update long texture names checkbox (mxd)
|
||||||
longtexturenames.Enabled = ci.Configuration.ReadSetting("longtexturenames", false);
|
longtexturenames.Enabled = ci.Configuration.ReadSetting("longtexturenames", false);
|
||||||
longtexturenames.Checked = longtexturenames.Enabled && General.Settings.ReadSetting("browserwindow.uselongtexturenames", false);
|
longtexturenames.Checked = longtexturenames.Enabled && options.UseLongTextureNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When keys are pressed in the level name field
|
// When keys are pressed in the level name field
|
||||||
|
|
|
@ -353,7 +353,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
// Update long texture names checkbox (mxd)
|
// Update long texture names checkbox (mxd)
|
||||||
longtexturenames.Enabled = cfg.ReadSetting("longtexturenames", false);
|
longtexturenames.Enabled = cfg.ReadSetting("longtexturenames", false);
|
||||||
longtexturenames.Checked = longtexturenames.Enabled && General.Settings.ReadSetting("browserwindow.uselongtexturenames", false);
|
longtexturenames.Checked = longtexturenames.Enabled && options.UseLongTextureNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK clicked
|
// OK clicked
|
||||||
|
@ -432,7 +432,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. Use long texture names?
|
//mxd. Use long texture names?
|
||||||
if (longtexturenames.Enabled) General.Settings.WriteSetting("browserwindow.uselongtexturenames", longtexturenames.Checked);
|
if(longtexturenames.Enabled) options.UseLongTextureNames = longtexturenames.Checked;
|
||||||
|
|
||||||
// Hide window
|
// Hide window
|
||||||
wadfile.Dispose();
|
wadfile.Dispose();
|
||||||
|
@ -498,7 +498,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
// Get the map name
|
// Get the map name
|
||||||
selectedmapname = mapslist.SelectedItems[0].Text;
|
selectedmapname = mapslist.SelectedItems[0].Text;
|
||||||
options = new MapOptions(mapsettings, selectedmapname);
|
options = new MapOptions(mapsettings, selectedmapname, longtexturenames.Enabled);
|
||||||
|
|
||||||
// Get locations from previous selected map settings
|
// Get locations from previous selected map settings
|
||||||
locations = new DataLocationList(mapsettings, "maps." + selectedmapname + ".resources");
|
locations = new DataLocationList(mapsettings, "maps." + selectedmapname + ".resources");
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
// Setup texture browser
|
// Setup texture browser
|
||||||
ImageBrowserControl.ShowTextureSizes = General.Settings.ReadSetting("browserwindow.showtexturesizes", General.Settings.ShowTextureSizes);
|
ImageBrowserControl.ShowTextureSizes = General.Settings.ReadSetting("browserwindow.showtexturesizes", General.Settings.ShowTextureSizes);
|
||||||
ImageBrowserControl.UseLongTextureNames = General.Map.Config.UseLongTextureNames && General.Settings.ReadSetting("browserwindow.uselongtexturenames", true);
|
ImageBrowserControl.UseLongTextureNames = General.Map.Options.UseLongTextureNames;
|
||||||
browser.BrowseFlats = browseflats;
|
browser.BrowseFlats = browseflats;
|
||||||
browser.ApplySettings();
|
browser.ApplySettings();
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
//mxd. Save ImageBrowserControl settings
|
//mxd. Save ImageBrowserControl settings
|
||||||
General.Settings.WriteSetting("browserwindow.showtexturesizes", ImageBrowserControl.ShowTextureSizes);
|
General.Settings.WriteSetting("browserwindow.showtexturesizes", ImageBrowserControl.ShowTextureSizes);
|
||||||
if(General.Map.Config.UseLongTextureNames) General.Settings.WriteSetting("browserwindow.uselongtexturenames", ImageBrowserControl.UseLongTextureNames);
|
if(General.Map.Config.UseLongTextureNames) General.Map.Options.UseLongTextureNames = ImageBrowserControl.UseLongTextureNames;
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
browser.CleanUp();
|
browser.CleanUp();
|
||||||
|
|
|
@ -561,7 +561,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(BuilderPlug.Me.CopiedFlat != null)
|
if(BuilderPlug.Me.CopiedFlat != null)
|
||||||
{
|
{
|
||||||
string oldtexture = GetTextureName();
|
string oldtexture = GetTextureName();
|
||||||
long oldtexturelong = Lump.MakeLongName(oldtexture);
|
long oldtexturelong = Lump.MakeLongName(General.Map.Data.GetFullFlatName(oldtexture)); //mxd
|
||||||
string newtexture = BuilderPlug.Me.CopiedFlat;
|
string newtexture = BuilderPlug.Me.CopiedFlat;
|
||||||
if(newtexture != oldtexture)
|
if(newtexture != oldtexture)
|
||||||
{
|
{
|
||||||
|
@ -599,7 +599,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the fill
|
// Do the fill
|
||||||
Tools.FloodfillFlats(this.Sector.Sector, fillceilings, oldtexturelong, newtextureimage, false);
|
Tools.FloodfillFlats(this.Sector.Sector, fillceilings, oldtexturelong, newtexture, false);
|
||||||
|
|
||||||
// Get the changed sectors
|
// Get the changed sectors
|
||||||
List<Sector> changes = General.Map.Map.GetMarkedSectors(true);
|
List<Sector> changes = General.Map.Map.GetMarkedSectors(true);
|
||||||
|
@ -711,9 +711,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
// Copy texture
|
// Copy texture
|
||||||
public virtual void OnCopyTexture()
|
public virtual void OnCopyTexture()
|
||||||
{
|
{
|
||||||
BuilderPlug.Me.CopiedFlat = GetTextureName();
|
if(Texture == null) return; //mxd
|
||||||
if(General.Map.Config.MixTexturesFlats) BuilderPlug.Me.CopiedTexture = GetTextureName();
|
string texturename = (!General.Map.Options.UseLongTextureNames ? Texture.ShortName : GetTextureName()); //mxd
|
||||||
mode.SetActionResult("Copied flat '" + GetTextureName() + "'.");
|
BuilderPlug.Me.CopiedFlat = texturename;
|
||||||
|
if(General.Map.Config.MixTexturesFlats) BuilderPlug.Me.CopiedTexture = texturename;
|
||||||
|
mode.SetActionResult("Copied flat '" + texturename + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnPasteTexture() { }
|
public virtual void OnPasteTexture() { }
|
||||||
|
|
|
@ -946,7 +946,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(BuilderPlug.Me.CopiedTexture != null)
|
if(BuilderPlug.Me.CopiedTexture != null)
|
||||||
{
|
{
|
||||||
string oldtexture = GetTextureName();
|
string oldtexture = GetTextureName();
|
||||||
long oldtexturelong = Lump.MakeLongName(oldtexture);
|
long oldtexturelong = Lump.MakeLongName(General.Map.Data.GetFullTextureName(oldtexture)); //mxd
|
||||||
string newtexture = BuilderPlug.Me.CopiedTexture;
|
string newtexture = BuilderPlug.Me.CopiedTexture;
|
||||||
if(newtexture != oldtexture)
|
if(newtexture != oldtexture)
|
||||||
{
|
{
|
||||||
|
@ -974,7 +974,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the alignment
|
// Do the alignment
|
||||||
Tools.FloodfillTextures(this.Sidedef, oldtexturelong, newtextureimage, false);
|
Tools.FloodfillTextures(this.Sidedef, oldtexturelong, newtexture, false);
|
||||||
|
|
||||||
// Get the changed sidedefs
|
// Get the changed sidedefs
|
||||||
List<Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);
|
List<Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);
|
||||||
|
@ -1100,9 +1100,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
// Copy texture
|
// Copy texture
|
||||||
public virtual void OnCopyTexture()
|
public virtual void OnCopyTexture()
|
||||||
{
|
{
|
||||||
BuilderPlug.Me.CopiedTexture = GetTextureName();
|
if(Texture == null) return; //mxd
|
||||||
if(General.Map.Config.MixTexturesFlats) BuilderPlug.Me.CopiedFlat = GetTextureName();
|
string texturename = (!General.Map.Options.UseLongTextureNames ? Texture.ShortName : GetTextureName()); //mxd
|
||||||
mode.SetActionResult("Copied texture '" + GetTextureName() + "'.");
|
BuilderPlug.Me.CopiedTexture = texturename;
|
||||||
|
if(General.Map.Config.MixTexturesFlats) BuilderPlug.Me.CopiedFlat = texturename;
|
||||||
|
mode.SetActionResult("Copied texture '" + texturename + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy texture offsets
|
// Copy texture offsets
|
||||||
|
|
|
@ -95,12 +95,9 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COLOR_INFO_HEX:
|
case COLOR_INFO_HEX:
|
||||||
string r = RGB.Red.ToString("X");
|
string r = RGB.Red.ToString("X02");
|
||||||
if (r.Length == 1) r = "0" + r;
|
string g = RGB.Green.ToString("X02");
|
||||||
string g = RGB.Green.ToString("X");
|
string b = RGB.Blue.ToString("X02");
|
||||||
if (g.Length == 1) g = "0" + g;
|
|
||||||
string b = RGB.Blue.ToString("X");
|
|
||||||
if (b.Length == 1) b = "0" + b;
|
|
||||||
|
|
||||||
isInUpdate = true;
|
isInUpdate = true;
|
||||||
tbFloatVals.Text = r + g + b;
|
tbFloatVals.Text = r + g + b;
|
||||||
|
@ -108,12 +105,9 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COLOR_INFO_FLOAT:
|
case COLOR_INFO_FLOAT:
|
||||||
string r2 = ((float)Math.Round(RGB.Red / 255f, 2)).ToString();
|
string r2 = ((float)Math.Round(RGB.Red / 255f, 2)).ToString("F02", CultureInfo.InvariantCulture);
|
||||||
if (r2.Length == 1) r2 += ".0";
|
string g2 = ((float)Math.Round(RGB.Green / 255f, 2)).ToString("F02", CultureInfo.InvariantCulture);
|
||||||
string g2 = ((float)Math.Round(RGB.Green / 255f, 2)).ToString();
|
string b2 = ((float)Math.Round(RGB.Blue / 255f, 2)).ToString("F02", CultureInfo.InvariantCulture);
|
||||||
if (g2.Length == 1) g2 += ".0";
|
|
||||||
string b2 = ((float)Math.Round(RGB.Blue / 255f, 2)).ToString();
|
|
||||||
if (b2.Length == 1) b2 += ".0";
|
|
||||||
|
|
||||||
isInUpdate = true;
|
isInUpdate = true;
|
||||||
tbFloatVals.Text = r2 + " " + g2 + " " + b2;
|
tbFloatVals.Text = r2 + " " + g2 + " " + b2;
|
||||||
|
@ -181,16 +175,6 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls
|
||||||
UpdateCancelButton(RGB);
|
UpdateCancelButton(RGB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ColorPickerControl_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Button == MouseButtons.Left)
|
|
||||||
{
|
|
||||||
changeType = ChangeStyle.MouseMove;
|
|
||||||
selectedPoint = new Point(e.X, e.Y);
|
|
||||||
this.Invalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ColorChanged(object sender, ColorChangedEventArgs e)
|
private void ColorChanged(object sender, ColorChangedEventArgs e)
|
||||||
{
|
{
|
||||||
SetRGB(e.RGB);
|
SetRGB(e.RGB);
|
||||||
|
@ -211,7 +195,17 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleMouse(object sender, MouseEventArgs e)
|
private void ColorPickerControl_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if(e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
changeType = ChangeStyle.MouseMove;
|
||||||
|
selectedPoint = new Point(e.X, e.Y);
|
||||||
|
this.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
|
@ -227,10 +221,11 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls
|
||||||
changeType = ChangeStyle.None;
|
changeType = ChangeStyle.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMouseUp(object sender, EventArgs e)
|
private void OnMouseLeave(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
colorWheel.SetMouseUp();
|
colorWheel.SetMouseUp();
|
||||||
changeType = ChangeStyle.None;
|
changeType = ChangeStyle.None;
|
||||||
|
selectedPoint = Point.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOK_Click(object sender, EventArgs e)
|
private void btnOK_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace CodeImp.DoomBuilder.ColorPicker.Controls {
|
using CodeImp.DoomBuilder.Controls;
|
||||||
|
|
||||||
|
namespace CodeImp.DoomBuilder.ColorPicker.Controls {
|
||||||
partial class ColorPickerControl {
|
partial class ColorPickerControl {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Требуется переменная конструктора.
|
/// Требуется переменная конструктора.
|
||||||
|
@ -33,7 +35,7 @@
|
||||||
this.nudBlue = new System.Windows.Forms.NumericUpDown();
|
this.nudBlue = new System.Windows.Forms.NumericUpDown();
|
||||||
this.nudGreen = new System.Windows.Forms.NumericUpDown();
|
this.nudGreen = new System.Windows.Forms.NumericUpDown();
|
||||||
this.Label2 = new System.Windows.Forms.Label();
|
this.Label2 = new System.Windows.Forms.Label();
|
||||||
this.tbFloatVals = new System.Windows.Forms.TextBox();
|
this.tbFloatVals = new CodeImp.DoomBuilder.Controls.AutoSelectTextbox();
|
||||||
this.pRGB = new System.Windows.Forms.Panel();
|
this.pRGB = new System.Windows.Forms.Panel();
|
||||||
this.cbColorInfo = new System.Windows.Forms.ComboBox();
|
this.cbColorInfo = new System.Windows.Forms.ComboBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudRed)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudRed)).BeginInit();
|
||||||
|
@ -197,9 +199,9 @@
|
||||||
this.Name = "ColorPickerControl";
|
this.Name = "ColorPickerControl";
|
||||||
this.Size = new System.Drawing.Size(311, 183);
|
this.Size = new System.Drawing.Size(311, 183);
|
||||||
this.Load += new System.EventHandler(this.ColorPickerControl_Load);
|
this.Load += new System.EventHandler(this.ColorPickerControl_Load);
|
||||||
this.MouseLeave += new System.EventHandler(this.OnMouseUp);
|
this.MouseLeave += new System.EventHandler(this.OnMouseLeave);
|
||||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.OnPaint);
|
this.Paint += new System.Windows.Forms.PaintEventHandler(this.OnPaint);
|
||||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HandleMouse);
|
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove);
|
||||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ColorPickerControl_MouseDown);
|
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ColorPickerControl_MouseDown);
|
||||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnMouseUp);
|
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnMouseUp);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudRed)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudRed)).EndInit();
|
||||||
|
@ -223,7 +225,7 @@
|
||||||
internal System.Windows.Forms.NumericUpDown nudBlue;
|
internal System.Windows.Forms.NumericUpDown nudBlue;
|
||||||
internal System.Windows.Forms.NumericUpDown nudGreen;
|
internal System.Windows.Forms.NumericUpDown nudGreen;
|
||||||
internal System.Windows.Forms.Label Label2;
|
internal System.Windows.Forms.Label Label2;
|
||||||
private System.Windows.Forms.TextBox tbFloatVals;
|
private CodeImp.DoomBuilder.Controls.AutoSelectTextbox tbFloatVals;
|
||||||
private System.Windows.Forms.Panel pRGB;
|
private System.Windows.Forms.Panel pRGB;
|
||||||
private System.Windows.Forms.ComboBox cbColorInfo;
|
private System.Windows.Forms.ComboBox cbColorInfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue