@ fixed some bugs with the undo / redo list scrollbars

This commit is contained in:
codeimp 2009-07-23 05:09:53 +00:00
parent 1cc018f974
commit b68ae937eb
4 changed files with 31 additions and 6 deletions

View file

@ -78,7 +78,12 @@ namespace CodeImp.DoomBuilder.Windows
void ResumeExclusiveMouseInput();
void SetCursor(Cursor cursor);
void MessageBeep(MessageBeepType type);
/// <summary>
/// This moves the focus to the editing display.
/// </summary>
bool FocusDisplay();
/// <summary>
/// This browses the lindef types
/// </summary>

View file

@ -20,6 +20,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using System.IO;
@ -43,12 +44,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
public class BuilderPlug : Plug
{
#region ================== API Declarations
[DllImport("user32.dll")]
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
#endregion
#region ================== Constants
internal const int WS_HSCROLL = 0x100000;
internal const int WS_VSCROLL = 0x200000;
internal const int GWL_STYLE = -16;
#endregion
#region ================== Variables
// Static instance
private static BuilderPlug me;

View file

@ -28,7 +28,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
/// </summary>
private void InitializeComponent()
{
this.list = new System.Windows.Forms.ListView();
this.list = new CodeImp.DoomBuilder.Controls.OptimizedListView();
this.coldescription = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
@ -70,7 +70,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#endregion
private System.Windows.Forms.ListView list;
private CodeImp.DoomBuilder.Controls.OptimizedListView list;
private System.Windows.Forms.ColumnHeader coldescription;
}
}

View file

@ -204,8 +204,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This updates the list column size
private void UpdateColumnSizes()
{
// Adjust the column in the listbox accordingly
coldescription.Width = list.ClientRectangle.Width - 2;
// Check if a vertical scrollbar exists and adjust the column in the listbox accordingly
if((BuilderPlug.GetWindowLong(list.Handle, BuilderPlug.GWL_STYLE) & BuilderPlug.WS_VSCROLL) != 0)
coldescription.Width = list.ClientRectangle.Width - 2;
else
coldescription.Width = list.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth - 2;
}
#endregion
@ -265,6 +268,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
list.EndUpdate();
}
}
General.Interface.FocusDisplay();
ignoreevents = false;
}
@ -293,6 +298,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
list.SelectedIndices.Clear();
}
}
General.Interface.FocusDisplay();
ignoreevents = false;
}
@ -303,6 +310,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
ignoreevents = true;
list.SelectedIndices.Clear();
General.Interface.FocusDisplay();
ignoreevents = false;
}