FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
flashdevelop/FlashDevelop/Controls/Browser.cs at feature/solutions · SandersAlex/flashdevelop · GitHub
SandersAlex
flashdevelop
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
flashdevelop
/
FlashDevelop
/
Controls
/
Browser.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
323 lines (295 loc) · 13.4 KB
Breadcrumbs
flashdevelop
/
FlashDevelop
/
Controls
/
Browser.cs
Copy path
File metadata and controls
323 lines (295 loc) · 13.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
using
System
;
using
System
.
Text
;
using
System
.
Data
;
using
System
.
Drawing
;
using
System
.
Windows
.
Forms
;
using
System
.
ComponentModel
;
using
System
.
Collections
.
Generic
;
using
PluginCore
.
Localization
;
using
PluginCore
.
Controls
;
using
PluginCore
.
Helpers
;
using
PluginCore
;
namespace
FlashDevelop
.
Controls
{
public
class
Browser
:
UserControl
{
private
System
.
Windows
.
Forms
.
ToolStrip
toolStrip
;
private
System
.
Windows
.
Forms
.
ToolStripButton
goButton
;
private
System
.
Windows
.
Forms
.
ToolStripButton
backButton
;
private
System
.
Windows
.
Forms
.
ToolStripButton
forwardButton
;
private
System
.
Windows
.
Forms
.
ToolStripButton
refreshButton
;
private
System
.
Windows
.
Forms
.
ToolStripSpringComboBox
addressComboBox
;
private
FlashDevelop
.
Controls
.
WebBrowserEx
webBrowser
;
public
Browser
(
)
{
this
.
Font
=
Globals
.
Settings
.
DefaultFont
;
this
.
InitializeComponent
(
)
;
this
.
InitializeLocalization
(
)
;
this
.
InitializeInterface
(
)
;
}
#region Windows Forms Designer Generated Code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private
void
InitializeComponent
(
)
{
System
.
ComponentModel
.
ComponentResourceManager
resources
=
new
System
.
ComponentModel
.
ComponentResourceManager
(
typeof
(
Browser
)
)
;
this
.
toolStrip
=
new
PluginCore
.
Controls
.
ToolStripEx
(
)
;
this
.
backButton
=
new
System
.
Windows
.
Forms
.
ToolStripButton
(
)
;
this
.
forwardButton
=
new
System
.
Windows
.
Forms
.
ToolStripButton
(
)
;
this
.
refreshButton
=
new
System
.
Windows
.
Forms
.
ToolStripButton
(
)
;
this
.
addressComboBox
=
new
System
.
Windows
.
Forms
.
ToolStripSpringComboBox
(
)
;
this
.
goButton
=
new
System
.
Windows
.
Forms
.
ToolStripButton
(
)
;
this
.
webBrowser
=
new
FlashDevelop
.
Controls
.
WebBrowserEx
(
)
;
this
.
toolStrip
.
SuspendLayout
(
)
;
this
.
SuspendLayout
(
)
;
//
// toolStrip
//
this
.
toolStrip
.
CanOverflow
=
false
;
this
.
toolStrip
.
GripStyle
=
System
.
Windows
.
Forms
.
ToolStripGripStyle
.
Hidden
;
this
.
toolStrip
.
Items
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[
]
{
this
.
backButton
,
this
.
forwardButton
,
this
.
refreshButton
,
this
.
addressComboBox
,
this
.
goButton
}
)
;
this
.
toolStrip
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
)
;
this
.
toolStrip
.
Name
=
"toolStrip"
;
this
.
toolStrip
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
2
,
1
,
2
,
2
)
;
this
.
toolStrip
.
Size
=
new
System
.
Drawing
.
Size
(
620
,
25
)
;
this
.
toolStrip
.
TabIndex
=
3
;
//
// backButton
//
this
.
backButton
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
,
1
,
0
,
1
)
;
this
.
backButton
.
DisplayStyle
=
System
.
Windows
.
Forms
.
ToolStripItemDisplayStyle
.
Image
;
this
.
backButton
.
Enabled
=
false
;
this
.
backButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"backButton.Image"
)
)
)
;
this
.
backButton
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
backButton
.
Name
=
"backButton"
;
this
.
backButton
.
Size
=
new
System
.
Drawing
.
Size
(
23
,
22
)
;
this
.
backButton
.
Text
=
"Back"
;
this
.
backButton
.
Click
+=
new
System
.
EventHandler
(
this
.
BackButtonClick
)
;
//
// forwardButton
//
this
.
forwardButton
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
,
1
,
0
,
1
)
;
this
.
forwardButton
.
DisplayStyle
=
System
.
Windows
.
Forms
.
ToolStripItemDisplayStyle
.
Image
;
this
.
forwardButton
.
Enabled
=
false
;
this
.
forwardButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"forwardButton.Image"
)
)
)
;
this
.
forwardButton
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
forwardButton
.
Name
=
"forwardButton"
;
this
.
forwardButton
.
Size
=
new
System
.
Drawing
.
Size
(
23
,
22
)
;
this
.
forwardButton
.
Text
=
"Forward"
;
this
.
forwardButton
.
Click
+=
new
System
.
EventHandler
(
this
.
ForwardButtonClick
)
;
//
// refreshButton
//
this
.
refreshButton
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
,
1
,
1
,
1
)
;
this
.
refreshButton
.
DisplayStyle
=
System
.
Windows
.
Forms
.
ToolStripItemDisplayStyle
.
Image
;
this
.
refreshButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"refreshButton.Image"
)
)
)
;
this
.
refreshButton
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
refreshButton
.
Name
=
"refreshButton"
;
this
.
refreshButton
.
Size
=
new
System
.
Drawing
.
Size
(
23
,
22
)
;
this
.
refreshButton
.
Text
=
"Refresh"
;
this
.
refreshButton
.
Click
+=
new
System
.
EventHandler
(
this
.
RefreshButtonClick
)
;
//
// addressComboBox
//
this
.
addressComboBox
.
Name
=
"addressComboBox"
;
this
.
addressComboBox
.
Size
=
new
System
.
Drawing
.
Size
(
450
,
21
)
;
this
.
addressComboBox
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
0
,
0
,
1
,
0
)
;
this
.
addressComboBox
.
KeyPress
+=
new
System
.
Windows
.
Forms
.
KeyPressEventHandler
(
this
.
AddressComboBoxKeyPress
)
;
this
.
addressComboBox
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
AddressComboBoxSelectedIndexChanged
)
;
//
// goButton
//
this
.
goButton
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
,
1
,
0
,
1
)
;
this
.
goButton
.
Alignment
=
System
.
Windows
.
Forms
.
ToolStripItemAlignment
.
Right
;
this
.
goButton
.
DisplayStyle
=
System
.
Windows
.
Forms
.
ToolStripItemDisplayStyle
.
Image
;
this
.
goButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"goButton.Image"
)
)
)
;
this
.
goButton
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
goButton
.
Name
=
"goButton"
;
this
.
goButton
.
Size
=
new
System
.
Drawing
.
Size
(
23
,
22
)
;
this
.
goButton
.
Text
=
"Go"
;
this
.
goButton
.
Click
+=
new
System
.
EventHandler
(
this
.
BrowseButtonClick
)
;
//
// webBrowser
//
this
.
webBrowser
.
AllowWebBrowserDrop
=
true
;
this
.
webBrowser
.
ScriptErrorsSuppressed
=
true
;
this
.
webBrowser
.
WebBrowserShortcutsEnabled
=
false
;
this
.
webBrowser
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
webBrowser
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
25
)
;
this
.
webBrowser
.
Name
=
"webBrowser"
;
this
.
webBrowser
.
Size
=
new
System
.
Drawing
.
Size
(
620
,
375
)
;
this
.
webBrowser
.
TabIndex
=
2
;
this
.
webBrowser
.
CanGoForwardChanged
+=
new
System
.
EventHandler
(
this
.
WebBrowserPropertyUpdated
)
;
this
.
webBrowser
.
CanGoBackChanged
+=
new
System
.
EventHandler
(
this
.
WebBrowserPropertyUpdated
)
;
this
.
webBrowser
.
Navigated
+=
new
System
.
Windows
.
Forms
.
WebBrowserNavigatedEventHandler
(
this
.
WebBrowserNavigated
)
;
this
.
webBrowser
.
DocumentTitleChanged
+=
new
System
.
EventHandler
(
this
.
WebBrowserDocumentTitleChanged
)
;
this
.
webBrowser
.
NewWindow
+=
new
System
.
ComponentModel
.
CancelEventHandler
(
this
.
WebBrowserNewWindow
)
;
//
// Browser
//
this
.
Controls
.
Add
(
this
.
webBrowser
)
;
this
.
Controls
.
Add
(
this
.
toolStrip
)
;
this
.
Name
=
"Browser"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
620
,
400
)
;
this
.
toolStrip
.
ResumeLayout
(
false
)
;
this
.
toolStrip
.
PerformLayout
(
)
;
this
.
ResumeLayout
(
false
)
;
this
.
PerformLayout
(
)
;
}
#endregion
#region Methods And Event Handlers
/// <summary>
/// Accessor for the webBrowser
/// </summary>
public
WebBrowser
WebBrowser
{
get
{
return
this
.
webBrowser
;
}
}
/// <summary>
/// Accessor for the addressComboBox
/// </summary>
public
ToolStripComboBox
AddressBox
{
get
{
return
this
.
addressComboBox
;
}
}
/// <summary>
/// Initializes localized texts to the controls
/// </summary>
private
void
InitializeLocalization
(
)
{
this
.
goButton
.
Text
=
TextHelper
.
GetString
(
"Label.Go"
)
;
this
.
backButton
.
Text
=
TextHelper
.
GetString
(
"Label.Back"
)
;
this
.
forwardButton
.
Text
=
TextHelper
.
GetString
(
"Label.Forward"
)
;
this
.
refreshButton
.
Text
=
TextHelper
.
GetString
(
"Label.Refresh"
)
;
}
/// <summary>
/// Initializes the ui based on settings
/// </summary>
private
void
InitializeInterface
(
)
{
this
.
toolStrip
.
Renderer
=
new
DockPanelStripRenderer
(
true
)
;
this
.
addressComboBox
.
FlatStyle
=
Globals
.
Settings
.
ComboBoxFlatStyle
;
this
.
toolStrip
.
ImageScalingSize
=
ScaleHelper
.
Scale
(
new
Size
(
16
,
16
)
)
;
if
(
ScaleHelper
.
GetScale
(
)
>=
1.5
)
{
ComponentResourceManager
resources
=
new
ComponentResourceManager
(
typeof
(
Browser
)
)
;
this
.
goButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"goButton.Image32"
)
)
)
;
this
.
forwardButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"forwardButton.Image32"
)
)
)
;
this
.
refreshButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"refreshButton.Image32"
)
)
)
;
this
.
backButton
.
Image
=
(
(
System
.
Drawing
.
Image
)
(
resources
.
GetObject
(
"backButton.Image32"
)
)
)
;
this
.
Refresh
(
)
;
}
}
/// <summary>
/// If the page tries to open a new window use a fd tab instead
/// </summary>
private
void
WebBrowserNewWindow
(
Object
sender
,
CancelEventArgs
e
)
{
Globals
.
MainForm
.
CallCommand
(
"Browse"
,
this
.
webBrowser
.
StatusText
)
;
e
.
Cancel
=
true
;
}
/// <summary>
/// Handles the web browser property changed event
/// </summary>
private
void
WebBrowserPropertyUpdated
(
Object
sender
,
EventArgs
e
)
{
this
.
backButton
.
Enabled
=
this
.
webBrowser
.
CanGoBack
;
this
.
forwardButton
.
Enabled
=
this
.
webBrowser
.
CanGoForward
;
}
/// <summary>
/// Handles the web browser navigated event
/// </summary>
private
void
WebBrowserNavigated
(
Object
sender
,
WebBrowserNavigatedEventArgs
e
)
{
this
.
addressComboBox
.
Text
=
this
.
webBrowser
.
Url
.
ToString
(
)
;
Globals
.
MainForm
.
OnScintillaControlUpdateControl
(
Globals
.
SciControl
)
;
}
/// <summary>
/// Handles the web browser title changed event
/// </summary>
private
void
WebBrowserDocumentTitleChanged
(
Object
sender
,
EventArgs
e
)
{
if
(
this
.
webBrowser
.
DocumentTitle
.
Trim
(
)
==
""
)
{
String
domain
=
this
.
webBrowser
.
Document
.
Domain
.
Trim
(
)
;
if
(
!
String
.
IsNullOrEmpty
(
domain
)
)
this
.
Parent
.
Text
=
domain
;
else
this
.
Parent
.
Text
=
TextHelper
.
GetString
(
"Info.UntitledFileStart"
)
;
}
else
this
.
Parent
.
Text
=
this
.
webBrowser
.
DocumentTitle
;
}
/// <summary>
/// Handles the combo box index changed event
/// </summary>
private
void
AddressComboBoxSelectedIndexChanged
(
Object
sender
,
EventArgs
e
)
{
if
(
this
.
addressComboBox
.
SelectedItem
!=
null
)
{
String
url
=
this
.
addressComboBox
.
SelectedItem
.
ToString
(
)
;
this
.
webBrowser
.
Navigate
(
url
)
;
}
}
/// <summary>
/// Browses to the previous page in history
/// </summary>
private
void
BackButtonClick
(
Object
sender
,
EventArgs
e
)
{
this
.
webBrowser
.
GoBack
(
)
;
}
/// <summary>
/// Browses to the next page in history
/// </summary>
private
void
ForwardButtonClick
(
Object
sender
,
EventArgs
e
)
{
this
.
webBrowser
.
GoForward
(
)
;
}
/// <summary>
/// Reloads the current pages contents
/// </summary>
private
void
RefreshButtonClick
(
Object
sender
,
EventArgs
e
)
{
this
.
webBrowser
.
Refresh
(
)
;
}
/// <summary>
/// Browses to the specified url on click
/// </summary>
private
void
BrowseButtonClick
(
Object
sender
,
EventArgs
e
)
{
String
url
=
this
.
addressComboBox
.
Text
;
if
(
!
this
.
addressComboBox
.
Items
.
Contains
(
url
)
)
{
this
.
addressComboBox
.
Items
.
Insert
(
0
,
url
)
;
}
this
.
webBrowser
.
Navigate
(
url
)
;
}
/// <summary>
/// Handles the combo box key press event
/// </summary>
private
void
AddressComboBoxKeyPress
(
Object
sender
,
KeyPressEventArgs
e
)
{
if
(
e
.
KeyChar
==
(
Char
)
Keys
.
Enter
)
{
String
url
=
this
.
addressComboBox
.
Text
;
if
(
!
this
.
addressComboBox
.
Items
.
Contains
(
url
)
)
{
this
.
addressComboBox
.
Items
.
Insert
(
0
,
url
)
;
}
this
.
webBrowser
.
Navigate
(
url
)
;
}
}
#endregion
}
#region WebBrowserEx
class
WebBrowserEx
:
WebBrowser
{
/// <summary>
/// Redirect events to MainForm.
/// </summary>
public
override
Boolean
PreProcessMessage
(
ref
Message
msg
)
{
return
Globals
.
MainForm
.
PreProcessMessage
(
ref
msg
)
;
}
}
#endregion
}
Back
|
FazBrowse Home
|
New Git URL