let's hide this functions bar until I implemented this feature (not required for first release)

This commit is contained in:
codeimp 2008-11-04 18:40:04 +00:00
parent f18c544675
commit 0dbb3bc505
3 changed files with 41 additions and 14 deletions

View file

@ -57,6 +57,7 @@ namespace CodeImp.DoomBuilder.Config
private string functionclose;
private string argumentdelimiter;
private string terminator;
private string functionregex;
// Collections
private Dictionary<string, string> keywords;
@ -82,6 +83,7 @@ namespace CodeImp.DoomBuilder.Config
public string FunctionClose { get { return functionclose; } }
public string ArgumentDelimiter { get { return argumentdelimiter; } }
public string Terminator { get { return terminator; } }
public string FunctionRegEx { get { return functionregex; } }
// Collections
public ICollection<string> Keywords { get { return keywords.Keys; } }
@ -116,6 +118,7 @@ namespace CodeImp.DoomBuilder.Config
functionclose = cfg.ReadSetting("functionclose", "");
argumentdelimiter = cfg.ReadSetting("argumentdelimiter", "");
terminator = cfg.ReadSetting("terminator", "");
functionregex = cfg.ReadSetting("functionregex", "");
// Load keywords
dic = cfg.ReadSetting("keywords", new Hashtable());

View file

@ -28,26 +28,26 @@ namespace CodeImp.DoomBuilder.Controls
/// </summary>
private void InitializeComponent()
{
this.functionslist = new System.Windows.Forms.ComboBox();
this.functionbar = new System.Windows.Forms.ComboBox();
this.scriptedit = new CodeImp.DoomBuilder.Controls.ScriptEditControl();
this.scriptpanel = new System.Windows.Forms.Panel();
this.scriptpanel.SuspendLayout();
this.SuspendLayout();
//
// functionslist
// functionbar
//
this.functionslist.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.functionbar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.functionslist.FormattingEnabled = true;
this.functionslist.Items.AddRange(new object[] {
this.functionbar.FormattingEnabled = true;
this.functionbar.Items.AddRange(new object[] {
"Function1",
"Function2",
"Function3"});
this.functionslist.Location = new System.Drawing.Point(0, 0);
this.functionslist.Name = "functionslist";
this.functionslist.Size = new System.Drawing.Size(474, 21);
this.functionslist.TabIndex = 1;
this.functionslist.TabStop = false;
this.functionbar.Location = new System.Drawing.Point(0, 0);
this.functionbar.Name = "functionbar";
this.functionbar.Size = new System.Drawing.Size(474, 21);
this.functionbar.TabIndex = 1;
this.functionbar.TabStop = false;
//
// scriptedit
//
@ -146,7 +146,7 @@ namespace CodeImp.DoomBuilder.Controls
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.scriptpanel);
this.Controls.Add(this.functionslist);
this.Controls.Add(this.functionbar);
this.Name = "BuilderScriptControl";
this.Size = new System.Drawing.Size(474, 408);
this.scriptpanel.ResumeLayout(false);
@ -157,7 +157,7 @@ namespace CodeImp.DoomBuilder.Controls
#endregion
private ScriptEditControl scriptedit;
private System.Windows.Forms.ComboBox functionslist;
private System.Windows.Forms.ComboBox functionbar;
private System.Windows.Forms.Panel scriptpanel;
}
}

View file

@ -133,7 +133,7 @@ namespace CodeImp.DoomBuilder.Controls
// Keep script configuration
scriptconfig = config;
// Find a resource named Actions.cfg
// Find a resource named Lexers.cfg
resnames = General.ThisAssembly.GetManifestResourceNames();
foreach(string rn in resnames)
{
@ -249,6 +249,12 @@ namespace CodeImp.DoomBuilder.Controls
// Sort the autocomplete list
autocompletelist.Sort(StringComparer.CurrentCultureIgnoreCase);
autocompletestring = string.Join(" ", autocompletelist.ToArray());
// Show/hide the functions bar
functionbar.Visible = (scriptconfig.FunctionRegEx.Length > 0);
// Rearrange the layout
this.PerformLayout();
}
@ -401,7 +407,25 @@ namespace CodeImp.DoomBuilder.Controls
#endregion
#region ================== Events
// Layout needs to be re-organized
protected override void OnLayout(LayoutEventArgs e)
{
base.OnLayout(e);
// With or without functions bar?
if(functionbar.Visible)
{
scriptpanel.Top = functionbar.Bottom + 6;
scriptpanel.Height = this.ClientSize.Height - scriptpanel.Top;
}
else
{
scriptpanel.Top = 0;
scriptpanel.Height = this.ClientSize.Height;
}
}
// Key pressed down
private void scriptedit_KeyDown(object sender, KeyEventArgs e)
{