Browse Source

fix display problem in hex editor

pull/23/head
Siegfried Pammer 15 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
int underscorewidth, underscorewidth3, fontheight; int underscorewidth, underscorewidth3, fontheight;
bool insertmode, hexinputmode, selectionmode, handled, moved; bool insertmode, hexinputmode, selectionmode, handled, moved;
public bool Initializing { get; set; }
Point oldMousePos = new Point(0,0); Point oldMousePos = new Point(0,0);
Rectangle[] selregion; Rectangle[] selregion;
@ -297,7 +299,7 @@ namespace HexEditor
get { return bytesPerLine; } get { return bytesPerLine; }
set { set {
if (value < 1) value = 1; if (value < 1) value = 1;
if (value > CalculateMaxBytesPerLine()) value = CalculateMaxBytesPerLine(); if (!Initializing && value > CalculateMaxBytesPerLine()) value = CalculateMaxBytesPerLine();
bytesPerLine = value; bytesPerLine = value;
UpdateViews(); UpdateViews();

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

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

Loading…
Cancel
Save