FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
flashdevelop/FlashDevelop/Docking/TabbedDocument.cs at master · SandersAlex/flashdevelop · GitHub
SandersAlex
flashdevelop
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
flashdevelop
/
FlashDevelop
/
Docking
/
TabbedDocument.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
578 lines (542 loc) · 20.8 KB
Breadcrumbs
flashdevelop
/
FlashDevelop
/
Docking
/
TabbedDocument.cs
Copy path
File metadata and controls
578 lines (542 loc) · 20.8 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
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
using
System
;
using
System
.
IO
;
using
System
.
Text
;
using
System
.
Drawing
;
using
System
.
Windows
.
Forms
;
using
System
.
Collections
.
Generic
;
using
WeifenLuo
.
WinFormsUI
.
Docking
;
using
PluginCore
.
Localization
;
using
FlashDevelop
.
Managers
;
using
FlashDevelop
.
Controls
;
using
PluginCore
.
Utilities
;
using
PluginCore
.
Managers
;
using
PluginCore
.
Helpers
;
using
PluginCore
.
Controls
;
using
ScintillaNet
;
using
PluginCore
;
namespace
FlashDevelop
.
Docking
{
public
class
TabbedDocument
:
DockContent
,
ITabbedDocument
{
private
Timer
focusTimer
;
private
Timer
backupTimer
;
private
String
previousText
;
private
List
<
Int32
>
bookmarks
;
private
ScintillaControl
editor
;
private
ScintillaControl
editor2
;
private
ScintillaControl
lastEditor
;
private
SplitContainer
splitContainer
;
private
Boolean
useCustomIcon
;
private
Boolean
isModified
;
private
FileInfo
fileInfo
;
public
TabbedDocument
(
)
{
this
.
focusTimer
=
new
Timer
(
)
;
this
.
focusTimer
.
Interval
=
100
;
this
.
bookmarks
=
new
List
<
Int32
>
(
)
;
this
.
focusTimer
.
Tick
+=
new
EventHandler
(
this
.
OnFocusTimer
)
;
this
.
ControlAdded
+=
new
ControlEventHandler
(
this
.
DocumentControlAdded
)
;
UITools
.
Manager
.
OnMarkerChanged
+=
new
UITools
.
LineEventHandler
(
this
.
OnMarkerChanged
)
;
this
.
DockPanel
=
Globals
.
MainForm
.
DockPanel
;
this
.
Font
=
Globals
.
Settings
.
DefaultFont
;
this
.
DockAreas
=
DockAreas
.
Document
;
this
.
BackColor
=
Color
.
White
;
this
.
useCustomIcon
=
false
;
this
.
StartBackupTiming
(
)
;
}
/// <summary>
/// Disables the automatic update of the icon
/// </summary>
public
Boolean
UseCustomIcon
{
get
{
return
this
.
useCustomIcon
;
}
set
{
this
.
useCustomIcon
=
value
;
}
}
/// <summary>
/// Path of the document
/// </summary>
public
String
FileName
{
get
{
if
(
this
.
IsEditable
)
return
this
.
SciControl
.
FileName
;
else
return
null
;
}
}
/// <summary>
/// Do we contain a Browser control?
/// </summary>
public
Boolean
IsBrowsable
{
get
{
foreach
(
Control
ctrl
in
this
.
Controls
)
{
if
(
ctrl
is
Browser
)
return
true
;
}
return
false
;
}
}
/// <summary>
/// Do we contain a ScintillaControl?
/// </summary>
public
Boolean
IsEditable
=>
this
.
SciControl
!=
null
;
/// <summary>
/// Are we splitted in to two sci controls?
/// </summary>
public
Boolean
IsSplitted
{
get
{
if
(
!
this
.
IsEditable
||
this
.
splitContainer
.
Panel2Collapsed
)
return
false
;
else
return
true
;
}
set
{
if
(
this
.
IsEditable
)
{
this
.
splitContainer
.
Panel2Collapsed
=
!
value
;
if
(
value
)
this
.
splitContainer
.
Panel2
.
Show
(
)
;
else
this
.
splitContainer
.
Panel2
.
Hide
(
)
;
}
}
}
/// <summary>
/// Does this document have any bookmarks?
/// </summary>
public
Boolean
HasBookmarks
=>
bookmarks
.
Count
>
0
;
/// <summary>
/// Does this document's pane have any other documents?
/// </summary>
public
Boolean
IsAloneInPane
{
get
{
int
count
=
0
;
foreach
(
ITabbedDocument
document
in
Globals
.
MainForm
.
Documents
)
{
if
(
document
.
DockHandler
.
PanelPane
==
DockHandler
.
PanelPane
)
count
++
;
}
return
count
<=
1
;
}
}
/// <summary>
/// Current ScintillaControl of the document
/// </summary>
public
ScintillaControl
SciControl
{
get
{
foreach
(
Control
ctrl
in
this
.
Controls
)
{
if
(
ctrl
is
ScintillaControl
&&
!
this
.
Disposing
&&
!
this
.
IsDisposed
)
return
ctrl
as
ScintillaControl
;
else
if
(
ctrl
is
SplitContainer
&&
ctrl
.
Name
==
"fdSplitView"
&&
!
this
.
Disposing
&&
!
this
.
IsDisposed
)
{
SplitContainer
casted
=
ctrl
as
SplitContainer
;
ScintillaControl
sci1
=
casted
.
Panel1
.
Controls
[
0
]
as
ScintillaControl
;
ScintillaControl
sci2
=
casted
.
Panel2
.
Controls
[
0
]
as
ScintillaControl
;
if
(
sci2
.
IsFocus
)
return
sci2
;
else
if
(
sci1
.
IsFocus
)
return
sci1
;
else
if
(
this
.
lastEditor
!=
null
&&
this
.
lastEditor
.
Visible
)
{
return
this
.
lastEditor
;
}
else
return
sci1
;
}
}
return
null
;
}
}
/// <summary>
/// First splitted ScintillaControl
/// </summary>
public
ScintillaControl
SplitSci1
=>
editor
;
/// <summary>
/// Second splitted ScintillaControl
/// </summary>
public
ScintillaControl
SplitSci2
=>
editor2
;
/// <summary>
/// SplitContainer of the document
/// </summary>
public
SplitContainer
SplitContainer
=>
splitContainer
;
/// <summary>
/// Gets if the file is untitled
/// </summary>
public
Boolean
IsUntitled
{
get
{
String
untitledFileStart
=
TextHelper
.
GetString
(
"Info.UntitledFileStart"
)
;
if
(
this
.
IsEditable
)
return
this
.
FileName
.
StartsWithOrdinal
(
untitledFileStart
)
;
else
return
false
;
}
}
/// <summary>
/// Sets or gets if the file is modified
/// </summary>
public
Boolean
IsModified
{
get
{
return
this
.
isModified
;
}
set
{
if
(
!
this
.
IsEditable
)
return
;
if
(
this
.
isModified
!=
value
)
{
this
.
isModified
=
value
;
ButtonManager
.
UpdateFlaggedButtons
(
)
;
this
.
RefreshTexts
(
)
;
}
}
}
/// <summary>
/// Activates the scintilla control after a delay
/// </summary>
public
new
void
Activate
(
)
{
base
.
Activate
(
)
;
if
(
this
.
IsEditable
)
{
this
.
focusTimer
.
Stop
(
)
;
this
.
focusTimer
.
Start
(
)
;
}
ButtonManager
.
UpdateFlaggedButtons
(
)
;
}
private
void
OnFocusTimer
(
Object
sender
,
EventArgs
e
)
{
this
.
focusTimer
.
Stop
(
)
;
if
(
this
.
SciControl
!=
null
&&
this
.
DockPanel
.
ActiveContent
!=
null
&&
this
.
DockPanel
.
ActiveContent
==
this
)
{
this
.
SciControl
.
Focus
(
)
;
this
.
InitBookmarks
(
)
;
}
}
/// <summary>
///
/// </summary>
private
void
OnMarkerChanged
(
ScintillaControl
sci
,
Int32
line
)
{
if
(
sci
!=
this
.
editor
&&
sci
!=
this
.
editor2
)
return
;
if
(
line
==
-
1
)
// all markers cleared
{
this
.
bookmarks
.
Clear
(
)
;
ButtonManager
.
UpdateFlaggedButtons
(
)
;
return
;
}
Boolean
hadBookmark
=
this
.
bookmarks
.
Contains
(
line
)
;
Boolean
hasBookmark
=
MarkerManager
.
HasMarker
(
sci
,
0
,
line
)
;
if
(
hadBookmark
!=
hasBookmark
)
// any change?
{
if
(
!
hadBookmark
&&
hasBookmark
)
this
.
bookmarks
.
Add
(
line
)
;
else
if
(
hadBookmark
&&
!
hasBookmark
)
this
.
bookmarks
.
Remove
(
line
)
;
ButtonManager
.
UpdateFlaggedButtons
(
)
;
}
}
/// <summary>
/// Adds a new scintilla control to the document
/// </summary>
public
void
AddEditorControls
(
String
file
,
String
text
,
Int32
codepage
)
{
this
.
editor
=
ScintillaManager
.
CreateControl
(
file
,
text
,
codepage
)
;
this
.
editor
.
Dock
=
DockStyle
.
Fill
;
this
.
editor2
=
ScintillaManager
.
CreateControl
(
file
,
text
,
codepage
)
;
this
.
editor2
.
Dock
=
DockStyle
.
Fill
;
this
.
splitContainer
=
new
SplitContainer
(
)
;
this
.
splitContainer
.
Name
=
"fdSplitView"
;
this
.
splitContainer
.
SplitterWidth
=
ScaleHelper
.
Scale
(
this
.
splitContainer
.
SplitterWidth
)
;
this
.
splitContainer
.
Orientation
=
Orientation
.
Horizontal
;
this
.
splitContainer
.
BackColor
=
SystemColors
.
Control
;
this
.
splitContainer
.
Panel1
.
Controls
.
Add
(
this
.
editor
)
;
this
.
splitContainer
.
Panel2
.
Controls
.
Add
(
this
.
editor2
)
;
this
.
splitContainer
.
Dock
=
DockStyle
.
Fill
;
this
.
splitContainer
.
Panel2Collapsed
=
true
;
Int32
oldDoc
=
this
.
editor
.
DocPointer
;
this
.
editor2
.
DocPointer
=
oldDoc
;
this
.
editor
.
SavePointLeft
+=
delegate
{
Globals
.
MainForm
.
OnDocumentModify
(
this
)
;
}
;
this
.
editor
.
SavePointReached
+=
delegate
{
this
.
editor
.
MarkerDeleteAll
(
2
)
;
this
.
IsModified
=
false
;
}
;
this
.
editor
.
FocusChanged
+=
new
FocusHandler
(
this
.
EditorFocusChanged
)
;
this
.
editor2
.
FocusChanged
+=
new
FocusHandler
(
this
.
EditorFocusChanged
)
;
this
.
editor
.
UpdateSync
+=
new
UpdateSyncHandler
(
this
.
EditorUpdateSync
)
;
this
.
editor2
.
UpdateSync
+=
new
UpdateSyncHandler
(
this
.
EditorUpdateSync
)
;
this
.
Controls
.
Add
(
this
.
splitContainer
)
;
}
/// <summary>
/// Syncs both of the scintilla editors
/// </summary>
private
void
EditorUpdateSync
(
ScintillaControl
sender
)
{
if
(
!
this
.
IsEditable
)
return
;
ScintillaControl
e1
=
editor
;
ScintillaControl
e2
=
editor2
;
if
(
sender
==
editor2
)
{
e1
=
editor2
;
e2
=
editor
;
}
e2
.
UpdateSync
-=
new
UpdateSyncHandler
(
this
.
EditorUpdateSync
)
;
ScintillaManager
.
UpdateSyncProps
(
e1
,
e2
)
;
ScintillaManager
.
ApplySciSettings
(
e2
)
;
e2
.
UpdateSync
+=
new
UpdateSyncHandler
(
this
.
EditorUpdateSync
)
;
Globals
.
MainForm
.
RefreshUI
(
)
;
}
/// <summary>
/// When the user changes to sci, block events from inactive sci
/// </summary>
private
void
EditorFocusChanged
(
ScintillaControl
sender
)
{
if
(
sender
.
IsFocus
)
{
this
.
lastEditor
=
sender
;
this
.
editor
.
DisableAllSciEvents
=
(
sender
==
editor2
)
;
this
.
editor2
.
DisableAllSciEvents
=
(
sender
==
editor
)
;
}
}
/// <summary>
/// Checks if the the file is changed outside of fd
/// </summary>
public
Boolean
CheckFileChange
(
)
{
if
(
this
.
fileInfo
==
null
)
{
this
.
fileInfo
=
new
FileInfo
(
this
.
FileName
)
;
}
if
(
!
Globals
.
MainForm
.
ClosingEntirely
&&
File
.
Exists
(
this
.
FileName
)
)
{
FileInfo
fi
=
new
FileInfo
(
this
.
FileName
)
;
if
(
this
.
fileInfo
.
IsReadOnly
!=
fi
.
IsReadOnly
)
return
true
;
if
(
this
.
fileInfo
.
LastWriteTime
!=
fi
.
LastWriteTime
)
return
true
;
}
return
false
;
}
/// <summary>
/// Updates the file info after user dismisses the change notification
/// </summary>
public
void
RefreshFileInfo
(
)
{
if
(
!
Globals
.
MainForm
.
ClosingEntirely
&&
File
.
Exists
(
this
.
FileName
)
)
{
this
.
fileInfo
=
new
FileInfo
(
this
.
FileName
)
;
}
}
/// <summary>
/// Saves an editable document
/// </summary>
/// <param name="file"></param>
/// <param name="reason">is passed on when raising the FileSave event</param>
public
void
Save
(
string
file
,
string
reason
)
{
if
(
!
this
.
IsEditable
)
return
;
if
(
!
this
.
IsUntitled
&&
FileHelper
.
FileIsReadOnly
(
this
.
FileName
)
)
{
String
dlgTitle
=
TextHelper
.
GetString
(
"Title.ConfirmDialog"
)
;
String
message
=
TextHelper
.
GetString
(
"Info.MakeReadOnlyWritable"
)
;
if
(
MessageBox
.
Show
(
Globals
.
MainForm
,
message
,
dlgTitle
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
)
==
DialogResult
.
Yes
)
{
ScintillaManager
.
MakeFileWritable
(
this
.
SciControl
)
;
}
else
return
;
}
String
oldFile
=
this
.
SciControl
.
FileName
;
Boolean
otherFile
=
(
this
.
SciControl
.
FileName
!=
file
)
;
if
(
otherFile
)
{
String
args
=
this
.
FileName
+
";"
+
file
;
RecoveryManager
.
RemoveTemporaryFile
(
this
.
FileName
)
;
TextEvent
renaming
=
new
TextEvent
(
EventType
.
FileRenaming
,
args
)
;
EventManager
.
DispatchEvent
(
this
,
renaming
)
;
TextEvent
close
=
new
TextEvent
(
EventType
.
FileClose
,
this
.
FileName
)
;
EventManager
.
DispatchEvent
(
this
,
close
)
;
}
TextEvent
saving
=
new
TextEvent
(
EventType
.
FileSaving
,
file
)
;
EventManager
.
DispatchEvent
(
this
,
saving
)
;
if
(
!
saving
.
Handled
)
{
if
(
otherFile
)
{
this
.
UpdateDocumentIcon
(
file
)
;
this
.
SciControl
.
FileName
=
file
;
}
ScintillaManager
.
CleanUpCode
(
this
.
SciControl
)
;
DataEvent
de
=
new
DataEvent
(
EventType
.
FileEncode
,
file
,
this
.
SciControl
.
Text
)
;
EventManager
.
DispatchEvent
(
this
,
de
)
;
// Lets ask if a plugin wants to encode and save the data..
if
(
!
de
.
Handled
)
FileHelper
.
WriteFile
(
file
,
this
.
SciControl
.
Text
,
this
.
SciControl
.
Encoding
,
this
.
SciControl
.
SaveBOM
)
;
this
.
IsModified
=
false
;
this
.
SciControl
.
SetSavePoint
(
)
;
RecoveryManager
.
RemoveTemporaryFile
(
this
.
FileName
)
;
this
.
fileInfo
=
new
FileInfo
(
this
.
FileName
)
;
if
(
otherFile
)
{
ScintillaManager
.
UpdateControlSyntax
(
this
.
SciControl
)
;
Globals
.
MainForm
.
OnFileSave
(
this
,
oldFile
,
reason
)
;
}
else
Globals
.
MainForm
.
OnFileSave
(
this
,
null
,
reason
)
;
}
this
.
RefreshTexts
(
)
;
}
/// <summary>
/// Saves an editable document
/// </summary>
public
void
Save
(
String
file
)
{
this
.
Save
(
file
,
null
)
;
}
public
void
Save
(
)
{
if
(
!
this
.
IsEditable
)
return
;
this
.
Save
(
this
.
FileName
)
;
}
/// <summary>
/// Reloads an editable document
/// </summary>
public
void
Reload
(
Boolean
showQuestion
)
{
if
(
!
this
.
IsEditable
)
return
;
if
(
showQuestion
)
{
String
dlgTitle
=
TextHelper
.
GetString
(
"Title.ConfirmDialog"
)
;
String
message
=
TextHelper
.
GetString
(
"Info.AreYouSureToReload"
)
;
if
(
MessageBox
.
Show
(
Globals
.
MainForm
,
message
,
" "
+
dlgTitle
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
)
==
DialogResult
.
No
)
return
;
}
Globals
.
MainForm
.
ReloadingDocument
=
true
;
Int32
position
=
this
.
SciControl
.
CurrentPos
;
TextEvent
te
=
new
TextEvent
(
EventType
.
FileReload
,
this
.
FileName
)
;
EventManager
.
DispatchEvent
(
Globals
.
MainForm
,
te
)
;
if
(
!
te
.
Handled
)
{
EncodingFileInfo
info
=
FileHelper
.
GetEncodingFileInfo
(
this
.
FileName
)
;
if
(
info
.
CodePage
==
-
1
)
{
Globals
.
MainForm
.
ReloadingDocument
=
false
;
return
;
// If the files is locked, stop.
}
Encoding
encoding
=
Encoding
.
GetEncoding
(
info
.
CodePage
)
;
this
.
SciControl
.
IsReadOnly
=
false
;
this
.
SciControl
.
Encoding
=
encoding
;
this
.
SciControl
.
Text
=
info
.
Contents
;
this
.
SciControl
.
IsReadOnly
=
FileHelper
.
FileIsReadOnly
(
this
.
FileName
)
;
this
.
SciControl
.
SetSel
(
position
,
position
)
;
this
.
SciControl
.
EmptyUndoBuffer
(
)
;
int
lineCount
=
SciControl
.
LineCount
;
foreach
(
var
lineNum
in
this
.
bookmarks
)
{
if
(
lineNum
<
0
)
continue
;
if
(
lineNum
>=
lineCount
)
{
if
(
!
MarkerManager
.
HasMarker
(
SciControl
,
0
,
lineCount
-
1
)
)
{
MarkerManager
.
ToggleMarker
(
SciControl
,
0
,
lineCount
-
1
)
;
}
}
else
MarkerManager
.
ToggleMarker
(
SciControl
,
0
,
lineNum
)
;
}
this
.
InitBookmarks
(
)
;
this
.
fileInfo
=
new
FileInfo
(
this
.
FileName
)
;
}
Globals
.
MainForm
.
OnDocumentReload
(
this
)
;
}
/// <summary>
/// Reverts the document to the orginal state
/// </summary>
public
void
Revert
(
Boolean
showQuestion
)
{
if
(
!
this
.
IsEditable
)
return
;
if
(
showQuestion
)
{
String
dlgTitle
=
TextHelper
.
GetString
(
"Title.ConfirmDialog"
)
;
String
message
=
TextHelper
.
GetString
(
"Info.AreYouSureToRevert"
)
;
if
(
MessageBox
.
Show
(
Globals
.
MainForm
,
message
,
" "
+
dlgTitle
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
)
==
DialogResult
.
No
)
return
;
}
TextEvent
te
=
new
TextEvent
(
EventType
.
FileRevert
,
Globals
.
SciControl
.
FileName
)
;
EventManager
.
DispatchEvent
(
this
,
te
)
;
if
(
!
te
.
Handled
)
{
while
(
this
.
SciControl
.
CanUndo
)
this
.
SciControl
.
Undo
(
)
;
ButtonManager
.
UpdateFlaggedButtons
(
)
;
}
}
/// <summary>
/// Starts the backup process timing
/// </summary>
private
void
StartBackupTiming
(
)
{
this
.
backupTimer
=
new
Timer
(
)
;
this
.
backupTimer
.
Tick
+=
new
EventHandler
(
this
.
BackupTimerTick
)
;
this
.
backupTimer
.
Interval
=
Globals
.
Settings
.
BackupInterval
;
this
.
backupTimer
.
Start
(
)
;
}
/// <summary>
/// Saves a backup file after an interval
/// </summary>
private
void
BackupTimerTick
(
Object
sender
,
EventArgs
e
)
{
if
(
this
.
IsEditable
&&
!
this
.
IsUntitled
&&
this
.
IsModified
&&
this
.
previousText
!=
this
.
SciControl
.
Text
)
{
RecoveryManager
.
SaveTemporaryFile
(
this
.
FileName
,
this
.
SciControl
.
Text
,
this
.
SciControl
.
Encoding
)
;
this
.
previousText
=
this
.
SciControl
.
Text
;
}
}
/// <summary>
/// Automatically updates the document icon
/// </summary>
private
void
UpdateDocumentIcon
(
String
file
)
{
if
(
this
.
useCustomIcon
)
return
;
if
(
Win32
.
ShouldUseWin32
(
)
&&
!
this
.
IsBrowsable
)
this
.
Icon
=
IconExtractor
.
GetFileIcon
(
file
,
true
)
;
else
{
Image
image
=
Globals
.
MainForm
.
FindImage
(
"480"
,
false
)
;
this
.
Icon
=
ImageKonverter
.
ImageToIcon
(
image
)
;
this
.
useCustomIcon
=
true
;
}
}
/// <summary>
/// Refreshes the tab and tooltip texts
/// </summary>
public
void
RefreshTexts
(
)
{
TabTextManager
.
UpdateTabTexts
(
)
;
this
.
UpdateToolTipText
(
)
;
}
/// <summary>
/// Checks the bookmarks when document is active.
/// </summary>
public
void
InitBookmarks
(
)
{
this
.
bookmarks
.
Clear
(
)
;
for
(
Int32
i
=
0
;
i
<
editor
.
LineCount
;
i
++
)
{
if
(
MarkerManager
.
HasMarker
(
SciControl
,
0
,
i
)
)
this
.
bookmarks
.
Add
(
i
)
;
}
}
/// <summary>
/// Updates the document's tooltip
/// </summary>
private
void
UpdateToolTipText
(
)
{
if
(
!
this
.
IsEditable
)
this
.
ToolTipText
=
""
;
else
this
.
ToolTipText
=
this
.
FileName
;
}
/// <summary>
/// Updates the document icon when a control is added
/// </summary>
private
void
DocumentControlAdded
(
Object
sender
,
ControlEventArgs
e
)
{
this
.
UpdateToolTipText
(
)
;
this
.
UpdateDocumentIcon
(
this
.
FileName
)
;
}
/// <summary>
/// Close the document and update buttons
/// </summary>
public
new
void
Close
(
)
{
base
.
Close
(
)
;
ButtonManager
.
UpdateFlaggedButtons
(
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL