Skip to content

Commit 7b748f6

Browse files
committed
Merge branch 'ImageManager' of https://github.com/wise0704/flashdevelop into development
2 parents 1518aba + 13d1102 commit 7b748f6

File tree

34 files changed

+1103
-364
lines changed

34 files changed

+1103
-364
lines changed

External/Plugins/ASCompletion/PluginUI.cs

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
*/
77

88
using System;
9-
using System.Windows.Forms;
10-
using System.Text;
119
using System.Collections.Generic;
12-
using PluginCore;
13-
using PluginCore.Managers;
14-
using ASCompletion.Model;
15-
using ASCompletion.Context;
16-
using ASCompletion.Settings;
17-
using PluginCore.Localization;
1810
using System.Drawing;
1911
using System.Reflection;
12+
using System.Text;
13+
using System.Windows.Forms;
14+
using ASCompletion.Context;
15+
using ASCompletion.Model;
16+
using ASCompletion.Settings;
17+
using PluginCore;
2018
using PluginCore.Helpers;
19+
using PluginCore.Localization;
20+
using PluginCore.Managers;
2121

2222
namespace ASCompletion
2323
{
@@ -77,7 +77,7 @@ public ImageList TreeIcons
7777

7878
public ToolStripMenuItem LookupMenuItem;
7979
private System.ComponentModel.IContainer components;
80-
public System.Windows.Forms.ImageList treeIcons;
80+
public ImageListManager treeIcons;
8181
private FixedTreeView outlineTree;
8282
private System.Timers.Timer tempoClick;
8383

@@ -113,7 +113,36 @@ private void InitializeControls()
113113
InitializeComponent();
114114
treeIcons.ColorDepth = ColorDepth.Depth32Bit;
115115
treeIcons.ImageSize = ScaleHelper.Scale(new Size(16, 16));
116-
treeIcons.Images.AddRange( new Image[]
116+
treeIcons.Initialize(TreeIcons_OnInitialize);
117+
118+
toolStrip.Renderer = new DockPanelStripRenderer();
119+
toolStrip.ImageScalingSize = ScaleHelper.Scale(new Size(16, 16));
120+
toolStrip.Padding = new Padding(2, 1, 2, 2);
121+
sortDropDown.Font = PluginBase.Settings.DefaultFont;
122+
sortDropDown.Image = PluginBase.MainForm.FindImage("444");
123+
clearButton.Image = PluginBase.MainForm.FindImage("153");
124+
clearButton.Alignment = ToolStripItemAlignment.Right;
125+
clearButton.CheckOnClick = false;
126+
127+
outlineTree = new FixedTreeView();
128+
outlineTree.BorderStyle = BorderStyle.None;
129+
outlineTree.ShowRootLines = false;
130+
outlineTree.Location = new System.Drawing.Point(0, toolStrip.Bottom);
131+
outlineTree.Size = new System.Drawing.Size(198, 300);
132+
outlineTree.Dock = DockStyle.Fill;
133+
outlineTree.ImageList = treeIcons;
134+
outlineTree.HotTracking = true;
135+
outlineTree.TabIndex = 1;
136+
outlineTree.NodeClicked += new FixedTreeView.NodeClickedHandler(ClassTreeSelect);
137+
outlineTree.AfterSelect += new TreeViewEventHandler(outlineTree_AfterSelect);
138+
outlineTree.ShowNodeToolTips = true;
139+
Controls.Add(outlineTree);
140+
outlineTree.BringToFront();
141+
}
142+
143+
private void TreeIcons_OnInitialize(object sender, EventArgs e)
144+
{
145+
treeIcons.Images.AddRange(new Image[]
117146
{
118147
PluginBase.MainForm.ImageSetAdjust(Image.FromStream(GetStream("FilePlain.png"))),
119148
PluginBase.MainForm.ImageSetAdjust(Image.FromStream(GetStream("FolderClosed.png"))),
@@ -151,30 +180,6 @@ private void InitializeControls()
151180
PluginBase.MainForm.ImageSetAdjust(Image.FromStream(GetStream("Template.png"))),
152181
PluginBase.MainForm.ImageSetAdjust(Image.FromStream(GetStream("Declaration.png")))
153182
});
154-
155-
toolStrip.Renderer = new DockPanelStripRenderer();
156-
toolStrip.ImageScalingSize = ScaleHelper.Scale(new Size(16, 16));
157-
toolStrip.Padding = new Padding(2, 1, 2, 2);
158-
sortDropDown.Font = PluginBase.Settings.DefaultFont;
159-
sortDropDown.Image = PluginBase.MainForm.FindImage("444");
160-
clearButton.Image = PluginBase.MainForm.FindImage("153");
161-
clearButton.Alignment = ToolStripItemAlignment.Right;
162-
clearButton.CheckOnClick = false;
163-
164-
outlineTree = new FixedTreeView();
165-
outlineTree.BorderStyle = BorderStyle.None;
166-
outlineTree.ShowRootLines = false;
167-
outlineTree.Location = new System.Drawing.Point(0, toolStrip.Bottom);
168-
outlineTree.Size = new System.Drawing.Size(198, 300);
169-
outlineTree.Dock = DockStyle.Fill;
170-
outlineTree.ImageList = treeIcons;
171-
outlineTree.HotTracking = true;
172-
outlineTree.TabIndex = 1;
173-
outlineTree.NodeClicked += new FixedTreeView.NodeClickedHandler(ClassTreeSelect);
174-
outlineTree.AfterSelect += new TreeViewEventHandler(outlineTree_AfterSelect);
175-
outlineTree.ShowNodeToolTips = true;
176-
Controls.Add(outlineTree);
177-
outlineTree.BringToFront();
178183
}
179184

180185
public static System.IO.Stream GetStream(String name)
@@ -270,7 +275,7 @@ private void InitializeComponent()
270275
{
271276
this.components = new System.ComponentModel.Container();
272277
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PluginUI));
273-
this.treeIcons = new System.Windows.Forms.ImageList(this.components);
278+
this.treeIcons = new ImageListManager(this.components);
274279
this.toolStrip = new PluginCore.Controls.ToolStripEx();
275280
this.sortDropDown = new System.Windows.Forms.ToolStripDropDownButton();
276281
this.noneItem = new System.Windows.Forms.ToolStripMenuItem();

External/Plugins/AirProperties/PluginMain.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ public void AddEventHandlers()
173173
/// </summary>
174174
private void CreateMenuItems()
175175
{
176-
this.pluginMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.ProjectMenuItem"), GetImage("blockdevice_small.png"), new EventHandler(this.OpenWizard), null);
176+
Image image = PluginBase.MainForm.GetAutoAdjustedImage(GetImage("blockdevice_small.png"));
177+
this.pluginMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.ProjectMenuItem"), image, new EventHandler(this.OpenWizard), null);
177178
PluginBase.MainForm.RegisterShortcutItem("ProjectMenu.AirApplicationProperties", this.pluginMenuItem);
178179
this.pluginMenuItem.Enabled = false;
179180
}
@@ -192,7 +193,7 @@ private void AddMenuItems(ToolStripMenuItem projectMenu)
192193
private void AddToolBarItems(ToolStrip toolStrip)
193194
{
194195
this.pmMenuButton = new ToolStripButton();
195-
this.pmMenuButton.Image = GetImage("blockdevice_small.png");
196+
this.pmMenuButton.Image = this.pluginMenuItem.Image;
196197
this.pmMenuButton.Text = TextHelper.GetString("Label.ProjectMenuItem").Replace("&", "").Replace("...", "");
197198
this.pmMenuButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
198199
this.pmMenuButton.Click += new EventHandler(this.OpenWizard);

External/Plugins/BookmarkPanel/PluginUI.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class PluginUI : DockPanelControl
3030
private System.Windows.Forms.ToolStripStatusLabel statusLabel;
3131
private System.Windows.Forms.ToolStripMenuItem removeBookmarksItem;
3232
private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
33-
private System.Windows.Forms.ImageList imageList;
33+
private ImageListManager imageList;
3434
private System.Windows.Forms.Timer updateTimer;
3535
private TimeoutManager timeoutManager;
3636
private PluginMain pluginMain;
@@ -228,20 +228,22 @@ private void InitializeTexts()
228228
/// </summary>
229229
private void InitializeGraphics()
230230
{
231-
this.imageList = new ImageList();
231+
this.imageList = new ImageListManager();
232232
this.imageList.ImageSize = ScaleHelper.Scale(new Size(16, 16));
233233
this.imageList.ColorDepth = ColorDepth.Depth32Bit;
234-
this.imageList.Images.Add(PluginBase.MainForm.FindImage("559|26|0|1"));
235-
this.imageList.Images.Add(PluginBase.MainForm.FindImage("229"));
236-
this.imageList.Images.Add(PluginBase.MainForm.FindImage("197"));
237-
this.imageList.Images.SetKeyName(0, "Bookmark");
238-
this.imageList.Images.SetKeyName(1, "Info");
239-
this.imageList.Images.SetKeyName(2, "Error");
234+
this.imageList.Initialize(ImageList_OnInitialize);
240235
this.listView.SmallImageList = this.imageList;
241236
this.removeBookmarksItem.Image = PluginBase.MainForm.FindImage("402|4|4|4");
242237
this.searchButton.Image = PluginBase.MainForm.FindImage("484|26|-4|4");
243238
}
244239

240+
private void ImageList_OnInitialize(object sender, EventArgs e)
241+
{
242+
this.imageList.Images.Add("Bookmark", PluginBase.MainForm.FindImageAndSetAdjust("559|26|0|1"));
243+
this.imageList.Images.Add("Info", PluginBase.MainForm.FindImageAndSetAdjust("229"));
244+
this.imageList.Images.Add("Error", PluginBase.MainForm.FindImageAndSetAdjust("197"));
245+
}
246+
245247
/// <summary>
246248
/// Updates the UI with the settings
247249
/// </summary>

External/Plugins/FileExplorer/PluginUI.cs

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
using System;
2+
using System.Collections.Specialized;
3+
using System.Drawing;
24
using System.IO;
35
using System.Text;
4-
using System.Drawing;
5-
using System.Security;
6-
using System.Diagnostics;
7-
using System.Collections;
86
using System.Windows.Forms;
9-
using System.ComponentModel;
10-
using System.Collections.Specialized;
11-
using PluginCore.Localization;
12-
using PluginCore.Utilities;
13-
using PluginCore.Managers;
7+
using PluginCore;
148
using PluginCore.Controls;
159
using PluginCore.Helpers;
16-
using PluginCore;
10+
using PluginCore.Localization;
11+
using PluginCore.Managers;
12+
using PluginCore.Utilities;
1713

1814
namespace FileExplorer
1915
{
@@ -39,7 +35,7 @@ public class PluginUI : DockPanelControl
3935
private System.Windows.Forms.ColumnHeader modifiedHeader;
4036
private Ookii.Dialogs.VistaFolderBrowserDialog folderBrowserDialog;
4137
private System.Windows.Forms.ListViewItem highlightedItem;
42-
private System.Windows.Forms.ImageList imageList;
38+
private ImageListManager imageList;
4339
private System.Boolean updateInProgress;
4440
private System.String previousItemLabel;
4541
private System.String autoSelectItem;
@@ -293,14 +289,21 @@ private void InitializeContextMenu()
293289
/// </summary>
294290
private void InitializeGraphics()
295291
{
296-
this.imageList = new ImageList();
292+
this.imageList = new ImageListManager();
297293
this.imageList.ImageSize = ScaleHelper.Scale(new Size(16, 16));
298294
this.imageList.ColorDepth = ColorDepth.Depth32Bit;
295+
this.imageList.OnInitialize += ImageList_Initialize;
296+
this.AddNonWin32Images();
299297
this.syncronizeButton.Image = PluginBase.MainForm.FindImage("203|9|-3|-3");
300298
this.browseButton.Image = PluginBase.MainForm.FindImage("203");
301299
this.fileView.SmallImageList = this.imageList;
302300
}
303301

302+
private void ImageList_Initialize(object sender, EventArgs e)
303+
{
304+
RefreshFileView(null, null);
305+
}
306+
304307
/// <summary>
305308
/// Applies localized texts to the control
306309
/// </summary>
@@ -424,7 +427,7 @@ private void UpdateUI(string path, DirectoryInfo directory, FileSystemInfo[] inf
424427
ListViewItem item;
425428
if (directory.Parent != null)
426429
{
427-
item = new ListViewItem("[..]", ExtractIconIfNecessary("/Folder/"));
430+
item = new ListViewItem("[..]", ExtractIconIfNecessary("/Folder/", false));
428431
item.Tag = directory.Parent.FullName;
429432
item.SubItems.Add("-");
430433
item.SubItems.Add("-");
@@ -436,7 +439,7 @@ private void UpdateUI(string path, DirectoryInfo directory, FileSystemInfo[] inf
436439
DirectoryInfo subDir = info as DirectoryInfo;
437440
if (subDir != null && (subDir.Attributes & FileAttributes.Hidden) == 0)
438441
{
439-
item = new ListViewItem(subDir.Name, ExtractIconIfNecessary(subDir.FullName));
442+
item = new ListViewItem(subDir.Name, ExtractIconIfNecessary(subDir.FullName, false));
440443
item.Tag = subDir.FullName;
441444
item.SubItems.Add("-");
442445
item.SubItems.Add("-");
@@ -450,7 +453,7 @@ private void UpdateUI(string path, DirectoryInfo directory, FileSystemInfo[] inf
450453
if (file != null && (file.Attributes & FileAttributes.Hidden) == 0)
451454
{
452455
String kbs = TextHelper.GetString("Info.Kilobytes");
453-
item = new ListViewItem(file.Name, ExtractIconIfNecessary(file.FullName));
456+
item = new ListViewItem(file.Name, ExtractIconIfNecessary(file.FullName, true));
454457
item.Tag = file.FullName;
455458
if (file.Length / 1024 < 1) item.SubItems.Add("1 " + kbs);
456459
else item.SubItems.Add((file.Length / 1024) + " " + kbs);
@@ -1128,25 +1131,22 @@ private void WatcherRenamed(Object sender, RenamedEventArgs e)
11281131
/// Ask the shell to feed us the appropriate icon for the given file, but
11291132
/// first try looking in our cache to see if we've already loaded it.
11301133
/// </summary>
1131-
private int ExtractIconIfNecessary(String path)
1134+
private int ExtractIconIfNecessary(String path, bool isFile)
11321135
{
11331136
Icon icon; Image image;
11341137
Size size = ScaleHelper.Scale(new Size(16, 16));
11351138
if (Win32.ShouldUseWin32())
11361139
{
1137-
if (File.Exists(path)) icon = IconExtractor.GetFileIcon(path, false, true);
1140+
if (isFile) icon = IconExtractor.GetFileIcon(path, false, true);
11381141
else icon = IconExtractor.GetFolderIcon(path, false, true);
11391142
image = ImageKonverter.ImageResize(icon.ToBitmap(), size.Width, size.Height);
11401143
image = PluginBase.MainForm.ImageSetAdjust(image);
11411144
icon.Dispose();
1145+
this.imageList.Images.Add(image);
1146+
return this.imageList.Images.Count - 1;
11421147
}
1143-
else
1144-
{
1145-
if (File.Exists(path)) image = PluginBase.MainForm.FindImage("526");
1146-
else image = PluginBase.MainForm.FindImage("203");
1147-
}
1148-
this.imageList.Images.Add(image);
1149-
return this.imageList.Images.Count - 1;
1148+
1149+
return isFile ? 0 : 1;
11501150
}
11511151

11521152
/// <summary>
@@ -1155,11 +1155,14 @@ private int ExtractIconIfNecessary(String path)
11551155
private void ClearImageList()
11561156
{
11571157
this.imageList.Images.Clear();
1158-
this.imageList.Dispose();
1159-
this.imageList = new ImageList();
1160-
this.imageList.ImageSize = ScaleHelper.Scale(new Size(16, 16));
1161-
this.imageList.ColorDepth = ColorDepth.Depth32Bit;
1162-
this.fileView.SmallImageList = this.imageList;
1158+
AddNonWin32Images();
1159+
}
1160+
1161+
private void AddNonWin32Images()
1162+
{
1163+
if (Win32.ShouldUseWin32()) return;
1164+
this.imageList.Images.Add(PluginBase.MainForm.FindImageAndSetAdjust("526"));
1165+
this.imageList.Images.Add(PluginBase.MainForm.FindImageAndSetAdjust("203"));
11631166
}
11641167

11651168
#endregion

External/Plugins/FlashDebugger/Controls/BreakPointUI.cs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ namespace FlashDebugger
1717
{
1818
class BreakPointUI : DockPanelControl
1919
{
20-
private static ImageList imageList;
21-
2220
private DataGridView dgv;
2321
private PluginMain pluginMain;
2422
private BreakPointManager breakPointManager;
@@ -65,17 +63,6 @@ void breakPointManager_ChangeBreakPointEvent(object sender, BreakPointArgs e)
6563

6664
private void init()
6765
{
68-
if (imageList == null)
69-
{
70-
imageList = new ImageList();
71-
imageList.ColorDepth = ColorDepth.Depth32Bit;
72-
imageList.ImageSize = ScaleHelper.Scale(new Size(16, 16));
73-
imageList.Images.Add("DeleteBreakpoint", PluginBase.MainForm.FindImage("548|27|5|5"));
74-
imageList.Images.Add("DeleteBreakpoints", PluginBase.MainForm.FindImage("549|27|5|5"));
75-
imageList.Images.Add("ToggleBreakpoints", PluginBase.MainForm.FindImage("136|23|5|5"));
76-
imageList.Images.Add("ExportBreakpoints", PluginBase.MainForm.FindImage("549|22|4|4"));
77-
imageList.Images.Add("ImportBreakpoints", PluginBase.MainForm.FindImage("549|8|4|4"));
78-
}
7966
this.AutoKeyHandling = true;
8067
this.dgv = new DataGridViewEx();
8168
this.dgv.Dock = DockStyle.Fill;
@@ -132,11 +119,11 @@ private void init()
132119
this.dgv.CellDoubleClick += new DataGridViewCellEventHandler(dgv_CellDoubleClick);
133120
this.Controls.Add(this.dgv);
134121
InitializeComponent();
135-
tsbRemoveSelected.Image = imageList.Images["DeleteBreakpoint"];
136-
tsbRemoveFiltered.Image = imageList.Images["DeleteBreakpoints"];
137-
tsbAlternateFiltered.Image = imageList.Images["ToggleBreakpoints"];
138-
tsbExportFiltered.Image = imageList.Images["ExportBreakpoints"];
139-
tsbImport.Image = imageList.Images["ImportBreakpoints"];
122+
tsbRemoveSelected.Image = PluginBase.MainForm.FindImage("548|27|5|5");
123+
tsbRemoveFiltered.Image = PluginBase.MainForm.FindImage("549|27|5|5");
124+
tsbAlternateFiltered.Image = PluginBase.MainForm.FindImage("136|23|5|5");
125+
tsbExportFiltered.Image = PluginBase.MainForm.FindImage("549|22|4|4");
126+
tsbImport.Image = PluginBase.MainForm.FindImage("549|8|4|4");
140127
this.tscbFilterColumns.FlatStyle = PluginBase.Settings.ComboBoxFlatStyle;
141128
this.tsActions.Renderer = new DockPanelStripRenderer(false);
142129
}

0 commit comments

Comments
 (0)