tune
This commit is contained in:
+111
-39
@@ -330,36 +330,72 @@ protected override bool IsInputKey(Keys keyData)
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert WinForms Keys to W3C KeyboardEvent.key string.
|
||||
/// </summary>
|
||||
static string WinFormsKeyToW3C(Keys key) => (key & Keys.KeyCode) switch
|
||||
{
|
||||
Keys.Home => "Home",
|
||||
Keys.End => "End",
|
||||
Keys.PageUp => "PageUp",
|
||||
Keys.PageDown => "PageDown",
|
||||
Keys.Left => "ArrowLeft",
|
||||
Keys.Right => "ArrowRight",
|
||||
Keys.Up => "ArrowUp",
|
||||
Keys.Down => "ArrowDown",
|
||||
Keys.LShiftKey or Keys.RShiftKey or Keys.ShiftKey => "Shift",
|
||||
Keys.LControlKey or Keys.RControlKey or Keys.ControlKey => "Control",
|
||||
Keys.LMenu or Keys.RMenu or Keys.Menu => "Alt",
|
||||
Keys.Return => "Enter",
|
||||
Keys.Escape => "Escape",
|
||||
Keys.Back => "Backspace",
|
||||
Keys.Tab => "Tab",
|
||||
Keys.Delete => "Delete",
|
||||
Keys.Insert => "Insert",
|
||||
Keys.Space => " ",
|
||||
Keys.F1 => "F1",
|
||||
Keys.F2 => "F2",
|
||||
Keys.F3 => "F3",
|
||||
Keys.F4 => "F4",
|
||||
Keys.F5 => "F5",
|
||||
Keys.F6 => "F6",
|
||||
Keys.F7 => "F7",
|
||||
Keys.F8 => "F8",
|
||||
Keys.F9 => "F9",
|
||||
Keys.F10 => "F10",
|
||||
Keys.F11 => "F11",
|
||||
Keys.F12 => "F12",
|
||||
>= Keys.A and <= Keys.Z => ((char)('a' + ((key & Keys.KeyCode) - Keys.A))).ToString(),
|
||||
>= Keys.D0 and <= Keys.D9 => ((char)('0' + ((key & Keys.KeyCode) - Keys.D0))).ToString(),
|
||||
_ => "Unidentified"
|
||||
};
|
||||
|
||||
private void RenderingCanvas_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
Focus();
|
||||
DispEngine.KeyDown((long)e.KeyData);
|
||||
|
||||
// Map specific keys for view transformation
|
||||
long key = (long)e.KeyData;
|
||||
if (key == (long)Keys.LShiftKey || key == (long)Keys.RShiftKey || key == (long)Keys.ShiftKey)
|
||||
key = (long)Keys.Shift;
|
||||
string key = WinFormsKeyToW3C(e.KeyData);
|
||||
DispEngine.KeyDown(key);
|
||||
|
||||
DispEngine.KeyDownTransform(key, new key_table__transform_view_by_key_pressing_t()
|
||||
{
|
||||
HOME = (long)Keys.Home,
|
||||
PAGE_UP = (long)Keys.PageUp,
|
||||
PAGE_DOWN = (long)Keys.PageDown,
|
||||
F1 = (long)Keys.F1,
|
||||
F2 = (long)Keys.F2,
|
||||
F3 = (long)Keys.F3,
|
||||
F4 = (long)Keys.F4,
|
||||
SHIFT = (long)Keys.Shift,
|
||||
ARROW_LEFT = (long)Keys.Left,
|
||||
ARROW_RIGHT = (long)Keys.Right,
|
||||
ARROW_DOWN = (long)Keys.Down,
|
||||
ARROW_UP = (long)Keys.Up
|
||||
HOME = "Home",
|
||||
PAGE_UP = "PageUp",
|
||||
PAGE_DOWN = "PageDown",
|
||||
F1 = "F1",
|
||||
F2 = "F2",
|
||||
F3 = "F3",
|
||||
F4 = "F4",
|
||||
SHIFT = "Shift",
|
||||
ARROW_LEFT = "ArrowLeft",
|
||||
ARROW_RIGHT = "ArrowRight",
|
||||
ARROW_DOWN = "ArrowDown",
|
||||
ARROW_UP = "ArrowUp"
|
||||
});
|
||||
}
|
||||
|
||||
private void RenderingCanvas_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
DispEngine.KeyUp((long)e.KeyData);
|
||||
DispEngine.KeyUp(WinFormsKeyToW3C(e.KeyData));
|
||||
}
|
||||
</code></pre><h3 id="lifecycle-management">Lifecycle Management</h3>
|
||||
<p>Window event handling ensures proper state management:</p>
|
||||
@@ -564,11 +600,51 @@ private void RenderingCanvas_MouseMove(object sender, MouseEventArgs e)
|
||||
});
|
||||
}
|
||||
</code></pre><pre><code class="lang-csharp" name="RenderingCanvas">/// <summary>
|
||||
/// Convert WPF Key to W3C KeyboardEvent.key string.
|
||||
/// </summary>
|
||||
static string WpfKeyToW3C(Key key) => key switch
|
||||
{
|
||||
Key.Home => "Home",
|
||||
Key.End => "End",
|
||||
Key.PageUp => "PageUp",
|
||||
Key.PageDown => "PageDown",
|
||||
Key.Left => "ArrowLeft",
|
||||
Key.Right => "ArrowRight",
|
||||
Key.Up => "ArrowUp",
|
||||
Key.Down => "ArrowDown",
|
||||
Key.LeftShift or Key.RightShift => "Shift",
|
||||
Key.LeftCtrl or Key.RightCtrl => "Control",
|
||||
Key.LeftAlt or Key.RightAlt => "Alt",
|
||||
Key.Return => "Enter",
|
||||
Key.Escape => "Escape",
|
||||
Key.Back => "Backspace",
|
||||
Key.Tab => "Tab",
|
||||
Key.Delete => "Delete",
|
||||
Key.Insert => "Insert",
|
||||
Key.Space => " ",
|
||||
Key.F1 => "F1",
|
||||
Key.F2 => "F2",
|
||||
Key.F3 => "F3",
|
||||
Key.F4 => "F4",
|
||||
Key.F5 => "F5",
|
||||
Key.F6 => "F6",
|
||||
Key.F7 => "F7",
|
||||
Key.F8 => "F8",
|
||||
Key.F9 => "F9",
|
||||
Key.F10 => "F10",
|
||||
Key.F11 => "F11",
|
||||
Key.F12 => "F12",
|
||||
>= Key.A and <= Key.Z => ((char)('a' + (key - Key.A))).ToString(),
|
||||
>= Key.D0 and <= Key.D9 => ((char)('0' + (key - Key.D0))).ToString(),
|
||||
_ => "Unidentified"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Handles the key up event
|
||||
/// </summary>
|
||||
private void RenderingCanvas_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
DispEngine.KeyUp((long)e.Key);
|
||||
DispEngine.KeyUp(WpfKeyToW3C(e.Key));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -576,27 +652,23 @@ private void RenderingCanvas_KeyUp(object sender, KeyEventArgs e)
|
||||
/// </summary>
|
||||
private void RenderingCanvas_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
DispEngine.KeyDown((long)e.Key);
|
||||
string key = WpfKeyToW3C(e.Key);
|
||||
DispEngine.KeyDown(key);
|
||||
|
||||
// Map specific keys for view transformation
|
||||
long key = (long)e.Key;
|
||||
if (key == (long)Key.RightShift)
|
||||
key = (long)Key.LeftShift;
|
||||
|
||||
DispEngine.KeyDownTransform(key, new key_table__transform_view_by_key_pressing_t()
|
||||
{
|
||||
HOME = (long)Key.Home,
|
||||
PAGE_UP = (long)Key.PageUp,
|
||||
PAGE_DOWN = (long)Key.PageDown,
|
||||
F1 = (long)Key.F1,
|
||||
F2 = (long)Key.F2,
|
||||
F3 = (long)Key.F3,
|
||||
F4 = (long)Key.F4,
|
||||
SHIFT = (long)Key.LeftShift,
|
||||
ARROW_LEFT = (long)Key.Left,
|
||||
ARROW_RIGHT = (long)Key.Right,
|
||||
ARROW_DOWN = (long)Key.Down,
|
||||
ARROW_UP = (long)Key.Up
|
||||
HOME = "Home",
|
||||
PAGE_UP = "PageUp",
|
||||
PAGE_DOWN = "PageDown",
|
||||
F1 = "F1",
|
||||
F2 = "F2",
|
||||
F3 = "F3",
|
||||
F4 = "F4",
|
||||
SHIFT = "Shift",
|
||||
ARROW_LEFT = "ArrowLeft",
|
||||
ARROW_RIGHT = "ArrowRight",
|
||||
ARROW_DOWN = "ArrowDown",
|
||||
ARROW_UP = "ArrowUp"
|
||||
});
|
||||
}
|
||||
</code></pre><h3 id="lifecycle-management-1">Lifecycle Management</h3>
|
||||
@@ -771,7 +843,7 @@ engine.SetViewToHomeView();
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Key press</td>
|
||||
<td><a class="xref" href="../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyDown_System_Int64_">KeyDown(long)</a> / <a class="xref" href="../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyUp_System_Int64_">KeyUp(long)</a> and <a class="xref" href="../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyDownTransform_System_Int64_Hi_Native_key_table__transform_view_by_key_pressing_t_">KeyDownTransform(long, key_table__transform_view_by_key_pressing_t)</a></td>
|
||||
<td><xref:Hi.Disp.DispEngine.KeyDown(System.Int64)> / <xref:Hi.Disp.DispEngine.KeyUp(System.Int64)> and <xref:Hi.Disp.DispEngine.KeyDownTransform(System.Int64,Hi.Native.key_table__transform_view_by_key_pressing_t)></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Touch events</td>
|
||||
|
||||
@@ -94,8 +94,8 @@
|
||||
<ol>
|
||||
<li>Normal message handling:</li>
|
||||
</ol>
|
||||
<pre><code class="lang-csharp" name="Normal Messages">MessageHost.AddMessage("Operation completed successfully.");
|
||||
MessageHost.AddWarning("Please check your input.");
|
||||
<pre><code class="lang-csharp" name="Normal Messages">MessageHost.ReportMessage("Operation completed successfully.");
|
||||
MessageHost.ReportWarning("Please check your input.");
|
||||
</code></pre>
|
||||
<ol start="2">
|
||||
<li>Exception handling in synchronous code:</li>
|
||||
|
||||
@@ -307,7 +307,7 @@ namespace HiNC_2025_win_desktop.Geom
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageHost.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
MessageHost.ReportError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
ex.ShowException(this);
|
||||
}
|
||||
finally
|
||||
@@ -398,7 +398,7 @@ namespace HiNC_2025_win_desktop.Geom
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageHost.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
MessageHost.ReportError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
ex.ShowException(this);
|
||||
}
|
||||
finally
|
||||
@@ -555,7 +555,7 @@ namespace HiNC_2025_win_desktop.Geom
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录异常但不中断用户操作
|
||||
MessageHost.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
MessageHost.ReportError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
ex.ShowException(this);
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -87,6 +87,21 @@
|
||||
<article data-uid="">
|
||||
<h1 id="release-note">Release Note</h1>
|
||||
|
||||
<h2 id="hinc-packages-version-31144">HiNc Packages Version 3.1.144</h2>
|
||||
<ul>
|
||||
<li>Enhance Siemens Sinumerik support:
|
||||
<ul>
|
||||
<li>Siemens CYCLE800 coordinate transform and reset</li>
|
||||
<li>Siemens MCALL CYCLE81() drilling cycle parsing</li>
|
||||
<li>Siemens TRAORI/TRAFOOF/SUPA flag parsing</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Fix Siemens TRAFOOF plain rotation coordinate transform issue</li>
|
||||
<li>Fix Siemens coordinate transform for successive file running</li>
|
||||
<li>Fix relief face collision floating-point precision issue</li>
|
||||
<li>Replace MongoDB with SQLite for local step data storage (significant package size reduction)</li>
|
||||
<li>Add machining and motion resolution dynamic adjustment functions</li>
|
||||
</ul>
|
||||
<h2 id="hinc-packages-version-31106">HiNc Packages Version 3.1.106</h2>
|
||||
<ul>
|
||||
<li>Rename mapping API for clearer naming:
|
||||
|
||||
Reference in New Issue
Block a user