Skip to content

Commit 69f9ee6

Browse files
committed
Большой апдейт - добавлена возможность редактирования мошн марок.
1 parent 29d1943 commit 69f9ee6

File tree

13 files changed

+2020
-1144
lines changed

13 files changed

+2020
-1144
lines changed

Common.cs

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
using System;
2+
using System.Windows.Forms;
3+
4+
public class AutoClosingMessageBox
5+
{
6+
System.Threading.Timer _timeoutTimer;
7+
string _caption;
8+
AutoClosingMessageBox(string text, string caption, int timeout, MessageBoxIcon icon = 0)
9+
{
10+
_caption = caption;
11+
_timeoutTimer = new System.Threading.Timer(OnTimerElapsed,
12+
null, timeout, System.Threading.Timeout.Infinite);
13+
using (_timeoutTimer)
14+
MessageBox.Show(text, caption,0, icon);
15+
}
16+
public static void Show(string text, string caption, int timeout, MessageBoxIcon icon = 0)
17+
{
18+
new AutoClosingMessageBox(text, caption, timeout, icon);
19+
}
20+
void OnTimerElapsed(object state)
21+
{
22+
IntPtr mbWnd = FindWindow("#32770", _caption); // lpClassName is #32770 for MessageBox
23+
if (mbWnd != IntPtr.Zero)
24+
SendMessage(mbWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
25+
_timeoutTimer.Dispose();
26+
}
27+
const int WM_CLOSE = 0x0010;
28+
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
29+
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
30+
[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
31+
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
32+
}
33+
34+
namespace OMF_Editor
35+
{
36+
partial class Form1
37+
{
38+
private int BitSet(int flags, int mask, bool bvalue)
39+
{
40+
if (bvalue)
41+
return flags |= mask;
42+
else
43+
return flags &= ~mask;
44+
}
45+
46+
private void ChangeMotionMarksPanelState(bool state)
47+
{
48+
bMotMarkPanel = state;
49+
50+
foreach (Control control in groupMotomMarks.Controls)
51+
control.Enabled = state;
52+
}
53+
54+
bool bMotionMarksGroupSelected()
55+
{
56+
return listMotionMarksGroup.SelectedIndices.Count > 0 && listMotionMarksGroup.Items.Count > 0;
57+
}
58+
59+
bool bMotionMarkSelected()
60+
{
61+
return listMotionMarksParams.SelectedIndices.Count > 0 && listMotionMarksParams.Items.Count > 0;
62+
}
63+
64+
private void MotionMarkPanelReset()
65+
{
66+
ChangeMarksParamsPanelState(false);
67+
listMotionMarksParams.Items.Clear();
68+
listMotionMarksGroup.Items.Clear();
69+
ChangeMarksParamsEditState(false);
70+
}
71+
72+
private void ChangeMarksParamsPanelState(bool state)
73+
{
74+
listMotionMarksParams.Enabled = state;
75+
btnAddMark.Enabled = state;
76+
btnDelMark.Enabled = state;
77+
}
78+
79+
private void ChangeMarksParamsEditState(bool state)
80+
{
81+
boxStartMotionMark.Text = "";
82+
boxStartMotionMark.Enabled = state;
83+
84+
boxEndMotionMark.Text = "";
85+
boxEndMotionMark.Enabled = state;
86+
}
87+
88+
private void DisableInput()
89+
{
90+
bTextBoxEnabled = false;
91+
foreach (TextBox box in textBoxes)
92+
{
93+
box.Text = "";
94+
box.Enabled = false;
95+
}
96+
97+
foreach (CheckBox box in Boxes)
98+
{
99+
box.Enabled = false;
100+
box.Checked = false;
101+
}
102+
103+
groupBox2.Enabled = false;
104+
105+
ChangeMotionMarksPanelState(false);
106+
107+
MotionMarkPanelReset();
108+
}
109+
110+
private void EnableInput()
111+
{
112+
bTextBoxEnabled = true;
113+
foreach (TextBox box in textBoxes)
114+
{
115+
box.Text = "";
116+
box.Enabled = true;
117+
}
118+
119+
foreach (CheckBox box in Boxes)
120+
{
121+
box.Enabled = true;
122+
}
123+
124+
groupBox2.Enabled = true;
125+
}
126+
}
127+
}

0 commit comments

Comments
 (0)