1- using System ;
1+ using System . Windows . Input ;
2+ using System ;
23using System . Collections . Generic ;
34using System . Drawing ;
45using System . IO ;
@@ -12,6 +13,7 @@ public partial class MainForm : Form
1213 {
1314 String lastModKey ;
1415 String [ ] currXY = new String [ 4 ] ;
16+ String selectedSpecialKey ;
1517 int topTab = 71 ;
1618 int selectedTab = 0 ;
1719 int activeLoops = 0 ;
@@ -22,13 +24,49 @@ public partial class MainForm : Form
2224 bool insertAtCursor = false ;
2325 bool newLine = false ;
2426 bool useSend = false ;
25-
27+ bool checkForSend = true ;
28+ bool checkForNewLine = true ;
29+ bool checkForInsert = false ;
2630
2731 public MainForm ( )
2832 {
2933 InitializeComponent ( ) ;
3034 }
3135
36+ //Right Click Menu Start
37+
38+ private void moveInsertionPorintToolStripMenuItem_Click ( object sender , EventArgs e )
39+ {
40+ checkForInsert = ! checkForInsert ;
41+ CheckForMoveInsertionPoint . Checked = ! CheckForMoveInsertionPoint . Checked ;
42+ }
43+
44+ private void useSendToolStripMenuItem_Click ( object sender , EventArgs e )
45+ {
46+ checkForSend = ! checkForSend ;
47+ CheckForSend . Checked = ! CheckForSend . Checked ;
48+ }
49+
50+ private void useNewLineToolStripMenuItem_Click ( object sender , EventArgs e )
51+ {
52+ checkForNewLine = ! checkForNewLine ;
53+ CheckForNewLine . Checked = ! CheckForNewLine . Checked ;
54+ }
55+
56+ private void insertAtCursorToolStripMenuItem_Click ( object sender , EventArgs e )
57+ {
58+ checkForInsert = ! checkForInsert ;
59+ CheckToInsertAtCursor . Checked = ! CheckToInsertAtCursor . Checked ;
60+ }
61+
62+ private void saveFileToolStripMenuItem_Click ( object sender , EventArgs e )
63+ {
64+ ExportButton_Click ( null , null ) ;
65+ }
66+
67+ //Right Click Menu Stop
68+
69+
3270 private void CreateFile ( string path , string dataToWrite )
3371 {
3472 try
@@ -92,7 +130,7 @@ private void modifierKeyInput_TextChanged(object sender, EventArgs e)
92130 lastModKey = modifierKeyInput . Text ;
93131 }
94132
95- private void modifierKeyInput_KeyDown ( Object sender , KeyEventArgs e )
133+ private void modifierKeyInput_KeyDown ( Object sender , System . Windows . Forms . KeyEventArgs e )
96134 {
97135 if ( e . KeyCode == Keys . Back )
98136 {
@@ -233,32 +271,51 @@ private void ButtonForSaveVariableHelp_Click(object sender, EventArgs e)
233271
234272 private void hotKeyAssignButton_Click ( object sender , EventArgs e )
235273 {
274+ String text ;
236275 hotKeySet = true ;
237276 if ( ! CheckForTopOfCode . Checked )
238277 {
239- MainCode . AppendText ( savedModifierInput . Text + "::\r \n " ) ;
278+ text = savedModifierInput . Text + "::\r \n " ;
279+
280+ CheckForSend . Checked = false ;
281+
282+ Helper . WriteToBox ( CheckToInsertAtCursor , CheckForNewLine , CheckForSend , text , MainCode , selectedTab ) ;
283+ Helper . Indent ( MainCode , activeLoops , indent ) ;
284+
285+ CheckForSend . Checked = checkForSend ;
240286 return ;
241287 }
288+ else
289+ {
290+ MainCode . Text = MainCode . Text . Insert ( 70 , "\r \n " + savedModifierInput . Text + "::\r \n " ) ;
291+ topTab += savedModifierInput . TextLength + 3 ;
292+ }
242293
243- MainCode . Text = MainCode . Text . Insert ( 70 , "\r \n " + savedModifierInput . Text + "::\r \n " ) ;
244- topTab += savedModifierInput . TextLength + 3 ;
245294 }
246295
247- private void FileNameInput_KeyDown ( object sender , KeyEventArgs e )
296+ private void FileNameInput_TextChanged ( object sender , EventArgs e )
248297 {
249- if ( e . KeyCode == Keys . Enter )
298+ if ( FileNameInput . TextLength <= 0 )
299+ {
300+ ExportButton . Enabled = false ;
301+ ChangeNameButton . Enabled = false ;
302+ ToolStripButtonExport . Enabled = false ;
303+ TextBoxForFileNameGlobal . Text = "" ;
304+ ButtonForFileExportGlobal . Enabled = false ;
305+ }
306+ else
250307 {
251308 ExportButton . Enabled = true ;
252- FileNameInput . Enabled = false ;
253309 ChangeNameButton . Enabled = true ;
254310 ToolStripButtonExport . Enabled = true ;
311+ TextBoxForFileNameGlobal . Text = FileNameInput . Text + ".ahk" ;
312+ ButtonForFileExportGlobal . Enabled = true ;
255313 }
256314 }
257315
258316 private void FileNameInput_KeyDown ( )
259317 {
260318 ExportButton . Enabled = true ;
261- FileNameInput . Enabled = false ;
262319 ChangeNameButton . Enabled = true ;
263320 ToolStripButtonExport . Enabled = true ;
264321 }
@@ -299,7 +356,16 @@ private void ModkeyButton_Click(object sender, EventArgs e)
299356
300357 private void SpecialKeyInput_SelectedIndexChanged ( object sender , EventArgs e )
301358 {
302- TextInput . AppendText ( SpecialKeyInput . Text ) ;
359+ if ( CheckForDontAdd . Checked )
360+ {
361+ TextInput . AppendText ( SpecialKeyInput . Text ) ;
362+ selectedSpecialKey = SpecialKeyInput . Text ;
363+ ButtonForSpecialKeyUp . Enabled = true ;
364+ }
365+ else
366+ {
367+ ButtonForSpecialKeyUp . Enabled = true ;
368+ }
303369 }
304370
305371 private void AddToMainCode_Click ( object sender , EventArgs e )
@@ -413,18 +479,25 @@ private void ButtonToSendMsgBoxToCode_Click(object sender, EventArgs e)
413479 private void CheckToInsertAtCursor_CheckedChanged ( object sender , EventArgs e )
414480 {
415481 insertAtCursor = ! insertAtCursor ;
482+ checkForInsert = ! checkForInsert ;
416483 }
417484
418485 private void CheckForNewLine_CheckedChanged ( object sender , EventArgs e )
419486 {
420487 newLine = ! newLine ;
488+ checkForNewLine = ! checkForNewLine ;
421489 }
422490
423491 private void CheckForSend_CheckedChanged ( object sender , EventArgs e )
424492 {
425493 useSend = ! useSend ;
426494 }
427495
496+ private void CheckForSend_Click ( object sender , EventArgs e )
497+ {
498+ checkForSend = ! checkForSend ;
499+ }
500+
428501 private void ButtonForVarEqualTo_Click ( object sender , EventArgs e )
429502 {
430503 String text = ComboForEqualVarOne . Text + " := " + ComboForEqualVarTwo . Text ;
@@ -460,6 +533,27 @@ private void CheckForLargeTextBox_CheckedChanged(object sender, EventArgs e)
460533 }
461534 }
462535
536+ private void ButtonForSpecialKeyDown_Click ( object sender , EventArgs e )
537+ {
538+ if ( SpecialKeyInput . Text . Length == 0 )
539+ {
540+ return ;
541+ }
542+
543+ String text = "{" + SpecialKeyInput . Text . Substring ( 1 , SpecialKeyInput . Text . Length - 3 ) + " Down}" ;
544+
545+ Helper . WriteToBox ( CheckToInsertAtCursor , CheckForNewLine , CheckForSend , text , MainCode , selectedTab ) ;
546+ Helper . Indent ( MainCode , activeLoops , indent ) ;
547+ }
548+
549+ private void ButtonForSpecialKeyUp_Click ( object sender , EventArgs e )
550+ {
551+ String text = "{" + SpecialKeyInput . Text . Substring ( 1 , SpecialKeyInput . Text . Length - 3 ) + " Up}" ;
552+
553+ Helper . WriteToBox ( CheckToInsertAtCursor , CheckForNewLine , CheckForSend , text , MainCode , selectedTab ) ;
554+ Helper . Indent ( MainCode , activeLoops , indent ) ;
555+ }
556+
463557 //Text Tab End
464558
465559
@@ -710,6 +804,7 @@ private void ImportFile_Click(object sender, EventArgs e)
710804
711805 hotKeySet = true ;
712806 FileNameInput . Text = Path . GetFileNameWithoutExtension ( fileName ) ;
807+ TextBoxForFileNameGlobal . Text = Path . GetFileName ( fileName ) ;
713808 FileNameInput_KeyDown ( ) ;
714809 }
715810
@@ -718,6 +813,28 @@ private void MainCode_Leave(object sender, EventArgs e)
718813 selectedTab = MainCode . SelectionStart ;
719814 }
720815
816+ private void ButtonForFileExportGlobal_Click ( object sender , EventArgs e )
817+ {
818+ ExportButton_Click ( null , null ) ;
819+ }
820+
821+
822+ private void MainForm_KeyDown ( object sender , System . Windows . Forms . KeyEventArgs e )
823+ {
824+ if ( e . KeyCode == Keys . S && e . Modifiers == Keys . Control )
825+ {
826+
827+ if ( FileNameInput . TextLength == 0 )
828+ {
829+ MessageBox . Show ( "Enter a name for the file before saving" , "File Name Needed" ) ;
830+ }
831+ else
832+ {
833+ ExportButton_Click ( null , null ) ;
834+ }
835+ }
836+ }
837+
721838 //Tool Strip End
722839
723840 }
0 commit comments