Browse Source

fix display problem in hex editor

pull/23/head
Siegfried Pammer 14 years ago
parent
commit
891d09ae30
  1. 4
      src/AddIns/DisplayBindings/HexEditor/Project/Src/Editor.cs
  2. 51
      src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditContainer.cs

4
src/AddIns/DisplayBindings/HexEditor/Project/Src/Editor.cs

@ -40,6 +40,8 @@ namespace HexEditor @@ -40,6 +40,8 @@ namespace HexEditor
int underscorewidth, underscorewidth3, fontheight;
bool insertmode, hexinputmode, selectionmode, handled, moved;
public bool Initializing { get; set; }
Point oldMousePos = new Point(0,0);
Rectangle[] selregion;
@ -297,7 +299,7 @@ namespace HexEditor @@ -297,7 +299,7 @@ namespace HexEditor
get { return bytesPerLine; }
set {
if (value < 1) value = 1;
if (value > CalculateMaxBytesPerLine()) value = CalculateMaxBytesPerLine();
if (!Initializing && value > CalculateMaxBytesPerLine()) value = CalculateMaxBytesPerLine();
bytesPerLine = value;
UpdateViews();

51
src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditContainer.cs

@ -39,29 +39,34 @@ namespace HexEditor.View @@ -39,29 +39,34 @@ namespace HexEditor.View
void Init(object sender, EventArgs e)
{
if (loaded)
return;
loaded = true;
tbSizeToFit.Text = StringParser.Parse(tbSizeToFit.Text);
ToolStripControlHost bytesPerLine = new ToolStripControlHost(tSTBCharsPerLine);
this.toolStrip1.Items.Insert(1, bytesPerLine);
ToolStripControlHost viewMode = new ToolStripControlHost(tCBViewMode);
this.toolStrip1.Items.Insert(3, viewMode);
hexEditControl.BytesPerLine = Settings.BytesPerLine;
tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString();
this.hexEditControl.ContextMenuStrip = MenuService.CreateContextMenu(this.hexEditControl, "/AddIns/HexEditor/Editor/ContextMenu");
tCBViewMode.SelectedIndex = 0;
tCBViewMode.SelectedItem = Settings.ViewMode.ToString();
hexEditControl.ViewMode = Settings.ViewMode;
tbSizeToFit.Checked = hexEditControl.FitToWindowWidth = Settings.FitToWidth;
tSTBCharsPerLine.Enabled = !Settings.FitToWidth;
hexEditControl.Invalidate();
try {
hexEditControl.Initializing = true;
if (loaded)
return;
loaded = true;
tbSizeToFit.Text = StringParser.Parse(tbSizeToFit.Text);
ToolStripControlHost bytesPerLine = new ToolStripControlHost(tSTBCharsPerLine);
this.toolStrip1.Items.Insert(1, bytesPerLine);
ToolStripControlHost viewMode = new ToolStripControlHost(tCBViewMode);
this.toolStrip1.Items.Insert(3, viewMode);
hexEditControl.BytesPerLine = Settings.BytesPerLine;
tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString();
this.hexEditControl.ContextMenuStrip = MenuService.CreateContextMenu(this.hexEditControl, "/AddIns/HexEditor/Editor/ContextMenu");
tCBViewMode.SelectedIndex = 0;
tCBViewMode.SelectedItem = Settings.ViewMode.ToString();
hexEditControl.ViewMode = Settings.ViewMode;
tbSizeToFit.Checked = hexEditControl.FitToWindowWidth = Settings.FitToWidth;
tSTBCharsPerLine.Enabled = !Settings.FitToWidth;
hexEditControl.Invalidate();
} finally {
hexEditControl.Initializing = false;
}
}
void TbSizeToFitClick(object sender, EventArgs e)

Loading…
Cancel
Save