-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain Form.cs
857 lines (747 loc) · 66.7 KB
/
Main Form.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
#region Header
// //////////////////////////////////////////////////////////////////////////////////////
// //
// Windows Standard Application //
// Main Form.cs : Provides Main Form //
// //
//-------------------------------------------------------------------------------------//
// //
// Copyright© 2008-2020 [email protected], Licensed under GPLv3+ //
// //
// //////////////////////////////////////////////////////////////////////////////////////
using System;
using System.IO;
using System.Drawing;
using ArdeshirV.Forms;
using ArdeshirV.Utilities;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing.Imaging;
using System.Collections.Generic;
using af=ArdeshirV.Forms.Properties;
using res= ArdeshirV.Applications.SpringAvestanEditor.Properties;
#endregion
//---------------------------------------------------------------------------------------
namespace ArdeshirV.Applications.SpringAvestanEditor
{
public partial class frmMainForm : FormBase
{
#region Variables
private const string m_strSupportMail = "[email protected]";
private const string m_strLink = "https://ardeshirv.github.io/SpringAvestanEditor/";
private int l_intSize = 50;
private bool m_blnDraw = true;
private bool m_blnDirty = false;
private Bitmap m_bmpScreen = null;
private int m_intBlinkPosition = 1;
private Button[] m_btnButtons = new Button[51];
private string m_strFilePathName = string.Empty;
private List<byte> m_lstArrCommands = new List<byte>(30);
private readonly ImageFormat m_imfImageFormat = ImageFormat.Jpeg;
private const string m_strImageFilter =
@"Jpeg (*.jpg)|*.jpg|Bitmap (*.bmp)|*.bmp|Png (*.png)|*.png|Gif
(*.gif)|*.gif|Memory Bitmap (*.memorybmp)|*.memorybmp";
#endregion
//-------------------------------------------------------------------------------
#region Contructor
public frmMainForm(string[] args)
{
InitializeComponent();
m_btnButtons = new Button[]
{
m_btnNumber1, m_btnNumber2, m_btnNumber3, m_btnNumber4,
m_btnNumber5, m_btnNumber6, m_btnNumber7, m_btnNumber8,
m_btnNumber9, m_btnNumber10, m_btnNumber11, m_btnNumber12,
m_btnNumber13, m_btnNumber14, m_btnNumber15, m_btnNumber16,
m_btnNumber17, m_btnNumber18, m_btnNumber19, m_btnNumber20,
m_btnNumber21, m_btnNumber22, m_btnNumber23, m_btnNumber24,
m_btnNumber25, m_btnNumber26, m_btnNumber27, m_btnNumber28,
m_btnNumber29, m_btnNumber30, m_btnNumber31, m_btnNumber32,
m_btnNumber33, m_btnNumber34, m_btnNumber35, m_btnNumber36,
m_btnNumber37, m_btnNumber38, m_btnNumber39, m_btnNumber40,
m_btnNumber41, m_btnNumber42, m_btnNumber43, m_btnNumber44,
m_btnNumber45, m_btnNumber46, m_btnNumber47, m_btnNumber48,
m_btnNumber49, m_btnNumber50, m_btnNumber51
};
UpdateScreen(false);
Application.Idle += new EventHandler(Application_Idle);
m_cmbImageFormats.Items.Add(System.Drawing.Imaging.ImageFormat.Jpeg);
m_cmbImageFormats.Items.Add(System.Drawing.Imaging.ImageFormat.Bmp);
m_cmbImageFormats.Items.Add(System.Drawing.Imaging.ImageFormat.Png);
m_cmbImageFormats.Items.Add(System.Drawing.Imaging.ImageFormat.Gif);
m_cmbImageFormats.Items.Add(System.Drawing.Imaging.ImageFormat.MemoryBmp);
m_cmbImageFormats.SelectedIndex = 0;
m_btnNew.KeyDown += this.frmMainForm_KeyDown;
m_btnSave.KeyDown += this.frmMainForm_KeyDown;
m_btnAbout.KeyDown += this.frmMainForm_KeyDown;
m_btnOpenFile.KeyDown += this.frmMainForm_KeyDown;
m_btnSaveImage.KeyDown += new KeyEventHandler(this.frmMainForm_KeyDown);
if (args.Length > 0)
AnalizeCommandLine(args);
BackgoundStartGradientColor = Color.White;
BackgoundInactiveStartGradientColor = Color.White;
BackgoundInactiveEndGradientColor = Color.Gray;
BackgoundEndGradientColor = Color.Lime;
}
#endregion
//-------------------------------------------------------------------------------
#region Overrided Functions
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
this.Invalidate();
this.Focus();
}
//-------------------------------------------------------------------------------
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
int l_intIndexer = 0;
m_trbScale_Scroll(null, null);
foreach (Button btn in m_btnButtons) {
btn.ImageIndex = l_intIndexer++;
btn.Click += new EventHandler(this.OnButtonClick);
}
UpdateTitleBar();
}
#endregion
//-------------------------------------------------------------------------------
#region Interface Functions
#endregion
//-------------------------------------------------------------------------------
#region Utility Functions
private string GetFileName(string strFilePathName)
{
FormMessage.Show(this, strFilePathName);
FileInfo info = new FileInfo(strFilePathName);
return info.Directory + info.Name;;
}
//-------------------------------------------------------------------------------
private bool DoYouWantToSaveAndContinue()
{
bool l_blnResultValue = false;
if (m_blnDirty)
{
DialogResult l_dlrResult = FormMessage.Show(
this, "Do you want to save changes?", Text,
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
switch (l_dlrResult)
{
case DialogResult.No:
l_blnResultValue = false;
break;
case DialogResult.Yes:
m_btnSave.PerformClick();
l_blnResultValue = false;
break;
case DialogResult.Cancel:
l_blnResultValue = true;
break;
default:
l_blnResultValue = false;
ShowError(new Exception("Unknown key in message box."));
break;
}
}
return l_blnResultValue;
}
//-------------------------------------------------------------------------------
private void ShowError(Exception exp)
{
FormErrorHandler.Show(this, exp, m_strLink);
}
//-------------------------------------------------------------------------------
private void AnalizeCommandLine(string[] strArrCommandLine)
{
OpenDocument(strArrCommandLine[0]);
}
//-------------------------------------------------------------------------------
private void UpdateScreen(bool blnDrawChars)
{
m_blnDraw = false;
Size l_sizScreen = new Size((int)m_nudW.Value * l_intSize, (int)m_nudH.Value * l_intSize);
m_bmpScreen = new Bitmap(l_sizScreen.Width, l_sizScreen.Height);
m_pnlImage.Size = l_sizScreen;
m_blnDraw = blnDrawChars;
m_pnlImage.Invalidate();
m_pnlImage.Select();
m_blnDraw = true;
}
//-------------------------------------------------------------------------------
private void UpdateTitleBar()
{
Text = "Spring Avestan Editor" + ((m_strFilePathName != string.Empty) ?
" - " + m_strFilePathName : "") + ((m_blnDirty) ? "*" : "");
}
//-------------------------------------------------------------------------------
private void SaveDocument(string strFilePathName)
{
try {
m_blnDirty = false;
m_strFilePathName = strFilePathName;
File.Create(strFilePathName).Write(m_lstArrCommands.ToArray(), 0, m_lstArrCommands.Count);
UpdateTitleBar();
} catch (Exception exp) {
ShowError(exp);
}
}
//-------------------------------------------------------------------------------
private void OpenDocument(string strFilePathName)
{
try {
m_blnDirty = false;
m_lstArrCommands.Clear();
m_strFilePathName = strFilePathName;
FileStream l_stmReader = File.Open(strFilePathName, FileMode.Open);
byte[] l_bytArrTemp = new byte[l_stmReader.Length];
l_stmReader.Read(l_bytArrTemp, 0, l_bytArrTemp.Length);
m_intBlinkPosition = l_bytArrTemp.Length + 1;
m_lstArrCommands.AddRange(l_bytArrTemp);
UpdateScreen(true);
UpdateTitleBar();
} catch (Exception exp) {
ShowError(exp);
}
}
//-------------------------------------------------------------------------------
private System.Drawing.Imaging.ImageFormat GetImageType(int intIndex)
{
switch (intIndex)
{
case 0:
return System.Drawing.Imaging.ImageFormat.Jpeg;
case 1:
return System.Drawing.Imaging.ImageFormat.Bmp;
case 2:
return System.Drawing.Imaging.ImageFormat.Png;
case 3:
return System.Drawing.Imaging.ImageFormat.Gif;
case 4:
return System.Drawing.Imaging.ImageFormat.MemoryBmp;
case -1:
default:
return null;
}
}
#endregion
//-------------------------------------------------------------------------------
#region External Methods
#endregion
//-------------------------------------------------------------------------------
#region Event Handlers
private void Application_Idle(object sender, EventArgs e)
{
}
//-------------------------------------------------------------------------------
private void OnButtonClick(object sender, EventArgs e)
{
try
{
m_blnDirty = true;
Button l_btnClicked = (Button)sender;
AddCharacter(byte.Parse((string)l_btnClicked.Tag));
UpdateScreen(true);
UpdateTitleBar();
} catch (Exception exp) {
ShowError(exp);
}
}
//-------------------------------------------------------------------------------
private void AddCharacter(byte bytData)
{
if (m_lstArrCommands.Count == 0)
{
m_intBlinkPosition = 1;
m_lstArrCommands.Add(bytData);
}
else if (m_intBlinkPosition > m_lstArrCommands.Count)
m_lstArrCommands.Add(bytData);
else if (m_lstArrCommands.Count >= 1)
m_lstArrCommands.Insert(m_intBlinkPosition - 1, bytData);
m_intBlinkPosition++;
}
//-------------------------------------------------------------------------------
private void m_btnSave_Click(object sender, EventArgs e)
{
SaveFileDialog l_sfdSave = new SaveFileDialog();
l_sfdSave.AddExtension = true;
l_sfdSave.Filter = "Avestan Files (*.avetan)|*.avestan";
l_sfdSave.FilterIndex = 1;
l_sfdSave.Title = "Save Avestan File";
if (l_sfdSave.ShowDialog(this) == DialogResult.OK)
SaveDocument(l_sfdSave.FileName);
}
//-------------------------------------------------------------------------------
private void m_btnOpenFile_Click(object sender, EventArgs e)
{
OpenFileDialog l_sfdOpen = new OpenFileDialog();
l_sfdOpen.Filter = "Avestan Files (*.avestan)|*.avestan";
l_sfdOpen.Title = "Open Avestan File";
l_sfdOpen.AddExtension = true;
l_sfdOpen.FilterIndex = 1;
if (l_sfdOpen.ShowDialog(this) == DialogResult.OK)
OpenDocument(l_sfdOpen.FileName);
}
//-------------------------------------------------------------------------------
private void m_btnSaveImage_Click(object sender, EventArgs e)
{
SaveFileDialog l_sfdSaveFile = new SaveFileDialog();
l_sfdSaveFile.AddExtension = true;
l_sfdSaveFile.Title = "Save Image";
l_sfdSaveFile.Filter = m_strImageFilter;
l_sfdSaveFile.FilterIndex = m_cmbImageFormats.SelectedIndex + 1;
if (l_sfdSaveFile.ShowDialog(this) == DialogResult.OK)
m_bmpScreen.Save(l_sfdSaveFile.FileName, GetImageType(l_sfdSaveFile.FilterIndex));
}
//-------------------------------------------------------------------------------
private void m_pnlImage_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
frmMainForm_KeyDown(sender, new KeyEventArgs(e.KeyData));
}
//-------------------------------------------------------------------------------
private void PnlImage_Paint(object sender, PaintEventArgs e)
{
try
{
ImageList l_imlTemp = m_imlLarge;
Point l_pntBlinkPosition = new Point(0, 0);
Graphics l_grpOffScreen = Graphics.FromImage(m_bmpScreen);
int l_intCounter = 1,
l_intTop = 0, l_intLeft = 0,
l_intColumnCount = (int)Math.Floor((double)(m_bmpScreen.Width / l_intSize));
if (l_intSize > 30)
l_imlTemp = m_imlLarge;
else
l_imlTemp = m_imlImages;
l_grpOffScreen.FillRectangle(Brushes.White, 0, 0, m_bmpScreen.Width, m_bmpScreen.Height);
for(int l_intIndexer = 0; l_intIndexer < m_lstArrCommands.Count; l_intIndexer++)
{
l_intTop = 0;
l_intLeft = l_intCounter;
while (l_intLeft > l_intColumnCount)
l_intLeft -= l_intColumnCount;
while (l_intTop * l_intColumnCount < l_intCounter)
l_intTop++;
l_intTop = (l_intTop - 1) * l_intSize;
l_intLeft = m_bmpScreen.Width - (l_intLeft) * l_intSize;
if (m_lstArrCommands[l_intIndexer] < 53 && m_lstArrCommands[l_intIndexer] > 0 && m_blnDraw)
l_grpOffScreen.DrawImage(l_imlTemp.Images[m_lstArrCommands[l_intIndexer] - 1], l_intLeft, l_intTop, l_intSize, l_intSize);
if (l_intCounter == m_intBlinkPosition)
l_pntBlinkPosition = new Point(l_intLeft, l_intTop + l_intSize - 1);
if (l_intCounter++ > m_lstArrCommands.Count - 1)
break;
}
e.Graphics.DrawImageUnscaled(m_bmpScreen, 0, 0);
l_intTop = 0;
l_intLeft = l_intCounter;
while (l_intLeft > l_intColumnCount)
l_intLeft -= l_intColumnCount;
while (l_intTop * l_intColumnCount < l_intCounter)
l_intTop++;
l_intTop = (l_intTop - 1) * l_intSize;
l_intLeft = m_bmpScreen.Width - (l_intLeft) * l_intSize;
if (l_intCounter == m_intBlinkPosition)
l_pntBlinkPosition = new Point(l_intLeft, l_intTop + l_intSize - 1);
if (m_intBlinkPosition > 0)
e.Graphics.DrawLine(Pens.Blue, l_pntBlinkPosition.X, l_pntBlinkPosition.Y,
l_pntBlinkPosition.X + l_intSize, l_pntBlinkPosition.Y);
} catch (Exception exp) {
ShowError(exp);
}
}
//-------------------------------------------------------------------------------
private void m_trbScale_Scroll(object sender, EventArgs e)
{
l_intSize = (m_trbScale.Value) * 10;
UpdateScreen(false);
}
//-------------------------------------------------------------------------------
private void m_nudW_ValueChanged(object sender, EventArgs e)
{
UpdateScreen(false);
}
//-------------------------------------------------------------------------------
private void m_pnlScreen_Scroll(object sender, ScrollEventArgs e)
{
m_pnlScreen.Invalidate(false);
}
//-------------------------------------------------------------------------------
private void frmMainForm_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = DoYouWantToSaveAndContinue();
}
//-------------------------------------------------------------------------------
private void frmMainForm_Activated(object sender, EventArgs e)
{
/*m_stsStatusBar.BackColor = */
m_trbScale.BackColor = this.BackgoundEndGradientColor;
}
//-------------------------------------------------------------------------------
private void frmMainForm_Deactivate(object sender, EventArgs e)
{
//m_txtOutput.Text = m_pnlImage.Size.ToString();
/*m_stsStatusBar.BackColor = */
m_trbScale.BackColor = this.BackgoundInactiveEndGradientColor;
}
//-------------------------------------------------------------------------------
private void m_btnAbout_Click(object sender, EventArgs e)
{
AssemblyAttributeAccessors aaa = new AssemblyAttributeAccessors(this);
string stringTitle = aaa.AssemblyTitle;
FormAboutData formAboutData = new FormAboutData(
this,
new Copyright[] { new Copyright(this, res.Resources.SpringAvestanEditorLogo) },
new Credits[] { new Credits(stringTitle,
new Credit[] {
new Credit(
"ArdeshirV",
@"ArdeshirV is 'Spring Avestan Editor' founder and developer.
Spring Avestan Editor: https://ardeshirv.github.io/SpringAvestanEditor/
Github: https://github.com/ArdeshirV/SpringAvestanEditor
Email: [email protected]",
af.Resources.ArdeshirV)
}) },
new Forms.License[] {
new Forms.License(stringTitle, res.Resources.LICENSE, res.Resources.GPLv3)
},
new Donations[] {
new Donations(stringTitle, DefaultDonationList.Items)
},
m_strLink,
m_strSupportMail);
FormAbout.Show(formAboutData);
}
//-------------------------------------------------------------------------------
private void m_btnNew_Click(object sender, EventArgs e)
{
if (m_blnDirty)
{
DialogResult l_dlrResult = FormMessage.Show(
this, "Do you want to save changes?",
Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
switch (l_dlrResult)
{
case DialogResult.No:
break;
case DialogResult.Yes:
m_btnSave.PerformClick();
break;
case DialogResult.Cancel:
return;
default:
ShowError(new Exception("Unknown key in message box found."));
return;
}
}
m_lstArrCommands.Clear();
m_intBlinkPosition = 1;
m_strFilePathName = "";
m_blnDirty = false;
UpdateScreen(true);
UpdateTitleBar();
}
//-------------------------------------------------------------------------------
private void m_btnButtons_Click(object sender, EventArgs e)
{
m_pnlImage.Select();
}
//-------------------------------------------------------------------------------
#region Key Analizer
private void frmMainForm_KeyDown(object sender, KeyEventArgs e)
{
int l_intColumnCount = 0, l_intTemp;
switch (e.KeyCode)
{
case Keys.Escape:
Close();
break;
case Keys.F1:
m_btnAbout.PerformClick();
break;
case Keys.Left:
if (m_lstArrCommands.Count >= m_intBlinkPosition)
{
++m_intBlinkPosition;
//m_txtOutput.Text = m_intBlinkPosition.ToString();
UpdateScreen(false);
}
break;
case Keys.Right:
if (m_intBlinkPosition > 1)
{
--m_intBlinkPosition;
UpdateScreen(false);
}
break;
case Keys.Up:
l_intColumnCount = (int)Math.Floor((double)(m_bmpScreen.Width / l_intSize));
l_intTemp = m_intBlinkPosition - l_intColumnCount;
if (l_intTemp > 0)
{
m_intBlinkPosition = l_intTemp;
UpdateScreen(false);
}
break;
case Keys.Down:
l_intColumnCount = (int)Math.Floor((double)(m_bmpScreen.Width / l_intSize));
l_intTemp = m_intBlinkPosition + l_intColumnCount;
if (l_intTemp <= m_lstArrCommands.Count + 1)
{
m_intBlinkPosition = l_intTemp;
UpdateScreen(false);
}
break;
case Keys.A:
if (e.Shift)
m_btnNumber2.PerformClick();
else
m_btnNumber1.PerformClick();
break;
case Keys.I:
if (e.Shift)
m_btnNumber4.PerformClick();
else
m_btnNumber3.PerformClick();
break;
case Keys.O:
if (e.Shift)
m_btnNumber6.PerformClick();
else
m_btnNumber5.PerformClick();
break;
case Keys.E:
if (e.Shift)
m_btnNumber8.PerformClick();
else
m_btnNumber7.PerformClick();
break;
case Keys.U:
if (e.Shift)
m_btnNumber9.PerformClick();
else
m_btnNumber21.PerformClick();
break;
case Keys.X:
if (e.Shift)
m_btnNumber11.PerformClick();
else
m_btnNumber10.PerformClick();
break;
case Keys.Q:
if (e.Shift)
m_btnNumber13.PerformClick();
else
m_btnNumber12.PerformClick();
break;
case Keys.B:
if (e.Shift)
m_btnNumber45.PerformClick();
else
m_btnNumber14.PerformClick();
break;
case Keys.Z:
if (e.Shift)
m_btnNumber46.PerformClick();
else
m_btnNumber15.PerformClick();
break;
case Keys.P:
if (e.Shift)
m_btnNumber16.PerformClick();
else
m_btnNumber26.PerformClick();
break;
case Keys.C:
if (e.Shift)
m_btnNumber17.PerformClick();
else
m_btnNumber47.PerformClick();
break;
case Keys.R:
if (e.Shift)
m_btnNumber18.PerformClick();
else
m_btnNumber29.PerformClick();
break;
case Keys.Y:
if (e.Shift)
m_btnNumber19.PerformClick();
else
m_btnNumber20.PerformClick();
break;
case Keys.J:
if (e.Shift)
m_btnNumber23.PerformClick();
else
m_btnNumber22.PerformClick();
break;
case Keys.N:
if (e.Shift)
m_btnNumber24.PerformClick();
else
m_btnNumber39.PerformClick();
break;
case Keys.W:
m_btnNumber25.PerformClick();
break;
case Keys.V:
if (e.Shift)
m_btnNumber36.PerformClick();
else
m_btnNumber27.PerformClick();
break;
case Keys.S:
if (e.Shift)
m_btnNumber48.PerformClick();
else
m_btnNumber28.PerformClick();
break;
case Keys.K:
m_btnNumber30.PerformClick();
break;
case Keys.D:
if (e.Shift)
m_btnNumber32.PerformClick();
else
m_btnNumber31.PerformClick();
break;
case Keys.H:
if (e.Shift)
m_btnNumber34.PerformClick();
else
m_btnNumber33.PerformClick();
break;
case Keys.G:
if (e.Shift)
m_btnNumber42.PerformClick();
else
m_btnNumber35.PerformClick();
break;
case Keys.M:
if (e.Shift)
m_btnNumber37.PerformClick();
else
m_btnNumber38.PerformClick();
break;
case Keys.T:
if (e.Shift)
m_btnNumber41.PerformClick();
else
m_btnNumber40.PerformClick();
break;
case Keys.F:
if (e.Shift)
m_btnNumber44.PerformClick();
else
m_btnNumber43.PerformClick();
break;
case Keys.L:
m_btnNumber49.PerformClick();
break;
case Keys.Oem1:
m_btnNumber51.PerformClick();
break;
case Keys.OemPeriod:
m_btnNumber50.PerformClick();
break;
case Keys.Back:
try
{
if (m_lstArrCommands.Count >= 1 && m_intBlinkPosition > 1)
{
m_blnDirty = true;
m_lstArrCommands.RemoveAt(--m_intBlinkPosition - 1);
if (m_intBlinkPosition < 1)
m_intBlinkPosition = 1;
UpdateScreen(false);
}
}
catch (Exception exp)
{
ShowError(exp);
}
break;
case Keys.Delete:
try
{
if (m_lstArrCommands.Count >= 1 && m_lstArrCommands.Count >= m_intBlinkPosition)
{
m_blnDirty = true;
m_lstArrCommands.RemoveAt(m_intBlinkPosition - 1);
if (m_intBlinkPosition > m_lstArrCommands.Count + 1)
m_intBlinkPosition = m_lstArrCommands.Count + 1;
UpdateScreen(false);
}
}
catch (Exception exp)
{
ShowError(exp);
}
break;
case Keys.Space:
AddCharacter(52);
UpdateScreen(false);
break;
case Keys.Enter:
l_intColumnCount = (int)Math.Floor((double)(m_bmpScreen.Width / l_intSize));
l_intTemp = m_intBlinkPosition % l_intColumnCount;
if (m_intBlinkPosition % l_intColumnCount > 0)
{
l_intTemp = l_intColumnCount - l_intTemp +1;
for (int l_intIndexer = 0; l_intIndexer < l_intTemp; l_intIndexer++)
AddCharacter(52);
}
else
AddCharacter(52);
UpdateScreen(false);
break;
case Keys.Home:
if (e.Control)
{
m_intBlinkPosition = 1;
UpdateScreen(false);
}
{
l_intColumnCount = (int)Math.Floor((double)(m_bmpScreen.Width / l_intSize));
int l_intCurrentRow = (int)Math.Floor((double)(m_intBlinkPosition / l_intColumnCount));
if (m_intBlinkPosition % l_intColumnCount != 0)
m_intBlinkPosition = l_intCurrentRow * l_intColumnCount + 1;
else
m_intBlinkPosition = (l_intCurrentRow - 1) * l_intColumnCount + 1;
UpdateScreen(false);
}
break;
case Keys.End:
if (e.Control)
{
m_intBlinkPosition = m_lstArrCommands.Count + 1;
UpdateScreen(false);
}
else
{
l_intColumnCount = (int)Math.Floor((double)(m_bmpScreen.Width / l_intSize));
int l_intCurrentRow = (int)Math.Floor((double)(m_intBlinkPosition / l_intColumnCount)) + 1;
int l_intResult = m_intBlinkPosition % l_intColumnCount;
if (l_intResult == 0)
break;
m_intBlinkPosition = l_intCurrentRow * l_intColumnCount;
if (m_intBlinkPosition > m_lstArrCommands.Count + 1)
m_intBlinkPosition = m_lstArrCommands.Count + 1;
UpdateScreen(false);
}
break;
}
UpdateTitleBar();
}
#endregion
//-------------------------------------------------------------------------------
private void m_btnClose_Click(object sender, EventArgs e)
{
Close();
}
#endregion
//-------------------------------------------------------------------------------
#region Properties
#endregion
}
}