Skip to content

Commit e7b8e9f

Browse files
committed
Merge branch 'development' into refactor_interface
2 parents 5495e84 + 77a41e2 commit e7b8e9f

File tree

19 files changed

+711
-378
lines changed

19 files changed

+711
-378
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ PluginCore/Bin
2323
/FlashDevelop/Bin/Debug/Settings/Recovery
2424
/FlashDevelop/Bin/Debug/Exceptions.log
2525
/FlashDevelop/Bin/Debug/Tools/fdbuild/fdbuild.exe
26+
FlashDevelop/Bin/Debug/Settings/Themes/CURRENT

CONTRIBUTING.md

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,52 @@ If you want to add your plugin, theme or extension to AppMan, you need to do a p
88

99
# Coding style
1010

11-
##### Naming should be in English and clear
11+
##### Use spaces instead of tabs with a width of 4
1212

13+
```c#
14+
public bool IsMember()
15+
{
16+
if (this.value > 2)
17+
{
18+
return false;
19+
}
20+
else return true;
21+
}
1322
```
14-
private Int32 memberProperty = 0;
23+
24+
##### Naming should be in English and clear
25+
26+
```c#
27+
private int memberProperty = 0;
1528
```
1629

1730
##### Use camelCase for private members and uppercase for public properties, methods and types:
1831

19-
```
20-
private Int32 memberProperty = 0;
32+
```c#
33+
private int memberProperty = 0;
2134

22-
public String MemberName = "MemberName";
35+
public string MemberName = "MemberName";
2336

24-
public Boolean IsMember()
37+
public bool IsMember()
2538
{
2639
return true;
2740
}
2841
```
2942

3043
##### Use types without explicit path:
3144

32-
```
33-
private void OnFormActivate(Object sender, /*System.*/EventArgs e)
45+
```c#
46+
private void OnFormActivate(object sender, /*System.*/EventArgs e)
3447
{
3548
// Do something...
3649
}
3750
```
3851

3952
##### Do not use extensive extra empty lines and keep the code clean, not like:
4053

41-
```
54+
```c#
4255
// Comment...
43-
private Int32 memberMethod(Int32 value)
56+
private int MemberMethod(int value)
4457
{
4558

4659

@@ -75,7 +88,7 @@ private Int32 memberMethod(Int32 value)
7588

7689
##### Use brackets and parenthesis for easier readability:
7790

78-
```
91+
```c#
7992
if ((val1 > val2) && (val1 > val3))
8093
{
8194
if (val2 > val3)
@@ -87,7 +100,7 @@ if ((val1 > val2) && (val1 > val3))
87100

88101
##### Do not nest expressions without brackets:
89102

90-
```
103+
```c#
91104
if (val1 > val2 && val1 > val3)
92105

93106
if (val2 > val3)
@@ -98,7 +111,7 @@ if (val1 > val2 && val1 > val3)
98111

99112
##### Use can use one liners to shorten the code:
100113

101-
```
114+
```c#
102115
if (val1 > val2 && val1 > val3)
103116
{
104117
if (val2 > val3) doThing();
@@ -107,8 +120,8 @@ if (val1 > val2 && val1 > val3)
107120

108121
##### Use explicit types:
109122

110-
```
111-
Int32 myValue = 0;
123+
```c#
124+
int myValue = 0;
112125
Point[] myPoints = new Point[]
113126
{
114127
new Point(1, 1),
@@ -118,42 +131,42 @@ Point[] myPoints = new Point[]
118131

119132
##### Code example:
120133

121-
```
134+
```c#
122135
import System;
123136

124137
namespace MyNameSpace
125138
{
126139
class MyClass
127140
{
128141
// Comment here...
129-
private Int32 memberProperty = 0;
130-
private Int32 memberProperty2 = 1;
131-
private Int32 memberProperty3 = 2;
142+
private int memberProperty = 0;
143+
private int memberProperty2 = 1;
144+
private int memberProperty3 = 2;
132145

133146
// Comment here...
134-
public String MemberName = "MemberName";
147+
public string MemberName = "MemberName";
135148

136149
// Comment here...
137-
public static Boolean IsMemberProperty = false;
150+
public static bool IsMemberProperty = false;
138151

139152
// Comment here...
140-
public const Int32 CONSTANT = 1;
153+
public const int CONSTANT = 1;
141154

142155
/// <summary>
143156
/// Comment here...
144157
/// </summary>
145-
public Boolean IsMember()
158+
public bool IsMember()
146159
{
147160
return true;
148161
}
149162

150163
/// <summary>
151164
/// Comment here...
152165
/// </summary>
153-
public void MemberMethod(Int32 value)
166+
public void MemberMethod(int value)
154167
{
155-
Int32 temp = MyClass.CONSTANT;
156-
if (value > 2))
168+
int temp = CONSTANT;
169+
if (value > 2)
157170
{
158171
this.memberProperty2 = temp;
159172
this.memberProperty3 = temp;
@@ -164,9 +177,9 @@ namespace MyNameSpace
164177
/// <summary>
165178
/// Comment here...
166179
/// </summary>
167-
private Int32 MemberMethodEx(Int32 value)
180+
private int MemberMethodEx(int value)
168181
{
169-
Int32 temp = MyClass.CONSTANT;
182+
int temp = CONSTANT;
170183
this.memberProperty3 = temp;
171184
switch (value)
172185
{
@@ -182,7 +195,7 @@ namespace MyNameSpace
182195
/// <summary>
183196
/// Comment here...
184197
/// </summary>
185-
private void OnFormActivate(Object sender, EventArgs e)
198+
private void OnFormActivate(object sender, EventArgs e)
186199
{
187200
this.MemberMethod(null, null);
188201
}

External/Plugins/AS3Context/PluginMain.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -265,25 +265,23 @@ public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
265265
else if (inMXML)
266266
{
267267
DataEvent de = e as DataEvent;
268-
if (de.Action == "XMLCompletion.Element")
268+
switch (de.Action)
269269
{
270-
de.Handled = MxmlComplete.HandleElement(de.Data);
271-
}
272-
if (de.Action == "XMLCompletion.Namespace")
273-
{
274-
de.Handled = MxmlComplete.HandleNamespace(de.Data);
275-
}
276-
else if (de.Action == "XMLCompletion.CloseElement")
277-
{
278-
de.Handled = MxmlComplete.HandleElementClose(de.Data);
279-
}
280-
else if (de.Action == "XMLCompletion.Attribute")
281-
{
282-
de.Handled = MxmlComplete.HandleAttribute(de.Data);
283-
}
284-
else if (de.Action == "XMLCompletion.AttributeValue")
285-
{
286-
de.Handled = MxmlComplete.HandleAttributeValue(de.Data);
270+
case "XMLCompletion.Element":
271+
de.Handled = MxmlComplete.HandleElement(de.Data);
272+
break;
273+
case "XMLCompletion.Namespace":
274+
de.Handled = MxmlComplete.HandleNamespace(de.Data);
275+
break;
276+
case "XMLCompletion.CloseElement":
277+
de.Handled = MxmlComplete.HandleElementClose(de.Data);
278+
break;
279+
case "XMLCompletion.Attribute":
280+
de.Handled = MxmlComplete.HandleAttribute(de.Data);
281+
break;
282+
case "XMLCompletion.AttributeValue":
283+
de.Handled = MxmlComplete.HandleAttributeValue(de.Data);
284+
break;
287285
}
288286
}
289287
}

External/Plugins/ASCompletion/Completion/ASGenerator.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,10 @@ public static List<ICompletionListItem> ContextualGenerator(ScintillaControl Sci
7777
string text = Sci.GetLine(line);
7878
bool suggestItemDeclaration = false;
7979

80-
if (isNotInterface)
80+
if (isNotInterface && ASComplete.IsLiteralStyle(style))
8181
{
82-
if (style == 4 || style == 6 || style == 7)
83-
{
84-
ShowConvertToConst(found);
85-
return known;
86-
}
82+
ShowConvertToConst(found);
83+
return known;
8784
}
8885

8986
ASResult resolve = ASComplete.GetExpressionType(Sci, Sci.WordEndPosition(position, true));

External/Plugins/ProjectManager/Helpers/LineEntryDialog.cs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Drawing;
33
using System.Collections;
4+
using System.Collections.Generic;
45
using System.ComponentModel;
56
using System.Windows.Forms;
67
using PluginCore;
@@ -13,13 +14,12 @@ namespace ProjectManager.Helpers
1314
/// </summary>
1415
public class LineEntryDialog : Form
1516
{
16-
readonly Keys shortcutToLowercase;
17-
readonly Keys shortcutToUppercase;
1817
string line;
18+
readonly Dictionary<Keys, string> shortcuts;
1919

2020
#region Form Designer Components
2121

22-
protected System.Windows.Forms.TextBox lineBox;
22+
private System.Windows.Forms.TextBox lineBox;
2323
private System.Windows.Forms.Button btnOK;
2424
private System.Windows.Forms.Button btnCancel;
2525
/// <summary>
@@ -40,17 +40,15 @@ public string Line
4040

4141
public LineEntryDialog(string captionText, string labelText, string defaultLine)
4242
{
43-
shortcutToLowercase = PluginBase.MainForm.GetShortcutItemKeys("EditMenu.ToLowercase");
44-
shortcutToUppercase = PluginBase.MainForm.GetShortcutItemKeys("EditMenu.ToUppercase");
4543
InitializeComponent();
4644
InititalizeLocalization();
4745
this.Font = PluginBase.Settings.DefaultFont;
4846
this.Text = " " + captionText;
4947
titleLabel.Text = labelText;
50-
lineBox.KeyDown += OnLineBoxOnKeyDown;
51-
lineBox.Text = (defaultLine != null) ? defaultLine : string.Empty;
48+
lineBox.Text = defaultLine ?? string.Empty;
5249
lineBox.SelectAll();
5350
lineBox.Focus();
51+
shortcuts = PluginBase.MainForm.GetShortcutItemsByKeys();
5452
}
5553

5654
#region Dispose
@@ -100,6 +98,7 @@ private void InitializeComponent()
10098
this.lineBox.Name = "lineBox";
10199
this.lineBox.Size = new System.Drawing.Size(260, 20);
102100
this.lineBox.TabIndex = 0;
101+
this.lineBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.LineBox_KeyDown);
103102
//
104103
// btnOK
105104
//
@@ -172,18 +171,22 @@ private void btnCancel_Click(object sender, System.EventArgs e)
172171
this.Close();
173172
}
174173

175-
void OnLineBoxOnKeyDown(object sender, KeyEventArgs args)
174+
void LineBox_KeyDown(object sender, KeyEventArgs e)
176175
{
177-
string selectedText = lineBox.SelectedText;
178-
if (string.IsNullOrEmpty(selectedText)) return;
179-
Keys keys = args.KeyData;
180-
if (keys == shortcutToLowercase) selectedText = selectedText.ToLower();
181-
else if (keys == shortcutToUppercase) selectedText = selectedText.ToUpper();
182-
else return;
183-
int selectionStart = lineBox.SelectionStart;
184-
int selectionLength = lineBox.SelectionLength;
185-
lineBox.Paste(selectedText);
186-
SelectRange(selectionStart, selectionLength);
176+
string shortcutId;
177+
if (!shortcuts.TryGetValue(e.KeyData, out shortcutId)) return;
178+
switch (shortcutId)
179+
{
180+
case "EditMenu.ToLowercase":
181+
case "EditMenu.ToUppercase":
182+
string text = lineBox.SelectedText;
183+
if (string.IsNullOrEmpty(text)) break;
184+
text = shortcutId == "EditMenu.ToLowercase" ? text.ToLower() : text.ToUpper();
185+
int selectionStart = lineBox.SelectionStart;
186+
lineBox.Paste(text);
187+
SelectRange(selectionStart, text.Length);
188+
break;
189+
}
187190
}
188191

189192
public void SelectRange(int start, int length)

External/Plugins/ProjectManager/PluginMain.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -561,38 +561,38 @@ private bool HandleKeyEvent(KeyEvent ke)
561561
{
562562
if (activeProject == null) return false;
563563

564-
if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys("ProjectMenu.ConfigurationSelector"))
564+
switch (PluginBase.MainForm.GetShortcutItemId(ke.Value))
565565
{
566-
pluginUI.menus.ConfigurationSelector.Focus();
567-
}
568-
else if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys("ProjectMenu.ConfigurationSelectorToggle"))
569-
{
570-
pluginUI.menus.ToggleDebugRelease();
571-
}
572-
else if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys("ProjectMenu.TargetBuildSelector"))
573-
{
574-
pluginUI.menus.TargetBuildSelector.Focus();
575-
}
576-
else if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys("ProjectTree.LocateActiveFile"))
577-
{
578-
ToggleTrackActiveDocument();
566+
case "ProjectMenu.ConfigurationSelector":
567+
pluginUI.menus.ConfigurationSelector.Focus();
568+
break;
569+
case "ProjectMenu.ConfigurationSelectorToggle":
570+
pluginUI.menus.ToggleDebugRelease();
571+
break;
572+
case "ProjectMenu.TargetBuildSelector":
573+
pluginUI.menus.TargetBuildSelector.Focus();
574+
break;
575+
case "ProjectTree.LocateActiveFile":
576+
ToggleTrackActiveDocument();
577+
break;
578+
default:
579+
if (Tree.Focused && !pluginUI.IsEditingLabel)
580+
{
581+
if (ke.Value == (Keys.Control | Keys.C) && pluginUI.Menu.Contains(pluginUI.Menu.Copy)) TreeCopyItems();
582+
else if (ke.Value == (Keys.Control | Keys.X) && pluginUI.Menu.Contains(pluginUI.Menu.Cut)) TreeCutItems();
583+
else if (ke.Value == (Keys.Control | Keys.V) && pluginUI.Menu.Contains(pluginUI.Menu.Paste)) TreePasteItems();
584+
else if (ke.Value == Keys.Delete && pluginUI.Menu.Contains(pluginUI.Menu.Delete)) TreeDeleteItems();
585+
else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Open)) TreeOpenItems();
586+
else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Insert)) TreeInsertItem();
587+
else return false;
588+
}
589+
else return false;
590+
break;
579591
}
580592

581-
// Handle tree-level simple shortcuts like copy/paste/del
582-
else if (Tree.Focused && !pluginUI.IsEditingLabel && ke != null)
583-
{
584-
if (ke.Value == (Keys.Control | Keys.C) && pluginUI.Menu.Contains(pluginUI.Menu.Copy)) TreeCopyItems();
585-
else if (ke.Value == (Keys.Control | Keys.X) && pluginUI.Menu.Contains(pluginUI.Menu.Cut)) TreeCutItems();
586-
else if (ke.Value == (Keys.Control | Keys.V) && pluginUI.Menu.Contains(pluginUI.Menu.Paste)) TreePasteItems();
587-
else if (ke.Value == Keys.Delete && pluginUI.Menu.Contains(pluginUI.Menu.Delete)) TreeDeleteItems();
588-
else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Open)) TreeOpenItems();
589-
else if (ke.Value == Keys.Enter && pluginUI.Menu.Contains(pluginUI.Menu.Insert)) TreeInsertItem();
590-
else return false;
591-
}
592-
else return false;
593593
return true;
594594
}
595-
595+
596596
#endregion
597597

598598
#region Custom Methods

0 commit comments

Comments
 (0)