5
5
using System . IO ;
6
6
using System . Text ;
7
7
using System . Drawing ;
8
- using System . Threading ;
9
8
using System . Reflection ;
10
9
using System . Collections ;
11
10
using System . Diagnostics ;
12
11
using System . Windows . Forms ;
13
12
using System . ComponentModel ;
14
13
using System . Collections . Generic ;
15
14
using System . Text . RegularExpressions ;
16
- using System . Runtime . InteropServices ;
17
15
using ScintillaNet . Configuration ;
18
16
using PluginCore . Localization ;
19
17
using FlashDevelop . Controls ;
23
21
using FlashDevelop . Helpers ;
24
22
using FlashDevelop . Dialogs ;
25
23
using FlashDevelop . Settings ;
26
- using WeifenLuo . WinFormsUI ;
27
24
using WeifenLuo . WinFormsUI . Docking ;
28
25
using ICSharpCode . SharpZipLib . Zip ;
29
26
using PluginCore . Utilities ;
@@ -291,7 +288,7 @@ public Boolean ClosingEntirely
291
288
/// </summary>
292
289
public Boolean IsFirstInstance
293
290
{
294
- get { return MainForm . IsFirst ; }
291
+ get { return IsFirst ; }
295
292
}
296
293
297
294
/// <summary>
@@ -322,7 +319,7 @@ public ITabbedDocument[] Documents
322
319
get
323
320
{
324
321
List < ITabbedDocument > documents = new List < ITabbedDocument > ( ) ;
325
- foreach ( DockPane pane in Globals . MainForm . DockPanel . Panes )
322
+ foreach ( DockPane pane in DockPanel . Panes )
326
323
{
327
324
if ( pane . DockState == DockState . Document )
328
325
{
@@ -462,7 +459,7 @@ public Boolean RefreshConfig
462
459
/// </summary>
463
460
public String [ ] StartArguments
464
461
{
465
- get { return MainForm . Arguments ; }
462
+ get { return Arguments ; }
466
463
}
467
464
468
465
/// <summary>
@@ -758,7 +755,7 @@ public void InitializeSmartDialogs()
758
755
/// </summary>
759
756
private DialogResult InitializeFirstRun ( )
760
757
{
761
- if ( ! this . StandaloneMode && MainForm . IsFirst && FirstRunDialog . ShouldProcessCommands ( ) )
758
+ if ( ! this . StandaloneMode && IsFirst && FirstRunDialog . ShouldProcessCommands ( ) )
762
759
{
763
760
return FirstRunDialog . Show ( ) ;
764
761
}
@@ -1180,7 +1177,7 @@ public void OnMainFormClosing(Object sender, System.ComponentModel.CancelEventAr
1180
1177
{
1181
1178
String title = TextHelper . GetString ( "Title.ConfirmDialog" ) ;
1182
1179
String message = TextHelper . GetString ( "Info.AreYouSureToExit" ) ;
1183
- DialogResult result = MessageBox . Show ( Globals . MainForm , message , " " + title , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) ;
1180
+ DialogResult result = MessageBox . Show ( this , message , " " + title , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) ;
1184
1181
if ( result == DialogResult . No ) e . Cancel = true ;
1185
1182
}
1186
1183
if ( ! e . Cancel ) this . CloseAllDocuments ( false ) ;
@@ -1335,7 +1332,7 @@ public void OnDocumentClosing(Object sender, System.ComponentModel.CancelEventAr
1335
1332
{
1336
1333
String saveChanges = TextHelper . GetString ( "Info.SaveChanges" ) ;
1337
1334
String saveChangesTitle = TextHelper . GetString ( "Title.SaveChanges" ) ;
1338
- DialogResult result = MessageBox . Show ( Globals . MainForm , saveChanges , saveChangesTitle + " " + document . Text , MessageBoxButtons . YesNoCancel , MessageBoxIcon . Question ) ;
1335
+ DialogResult result = MessageBox . Show ( this , saveChanges , saveChangesTitle + " " + document . Text , MessageBoxButtons . YesNoCancel , MessageBoxIcon . Question ) ;
1339
1336
if ( result == DialogResult . Yes )
1340
1337
{
1341
1338
if ( document . IsUntitled )
@@ -1467,7 +1464,7 @@ public void OnScintillaControlModifyRO(ScintillaControl sci)
1467
1464
if ( te . Handled ) return ; // Let plugin handle this...
1468
1465
String dlgTitle = TextHelper . GetString ( "Title.ConfirmDialog" ) ;
1469
1466
String message = TextHelper . GetString ( "Info.MakeReadOnlyWritable" ) ;
1470
- if ( MessageBox . Show ( Globals . MainForm , message , dlgTitle , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) == DialogResult . Yes )
1467
+ if ( MessageBox . Show ( this , message , dlgTitle , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) == DialogResult . Yes )
1471
1468
{
1472
1469
ScintillaManager . MakeFileWritable ( sci ) ;
1473
1470
}
@@ -2683,7 +2680,10 @@ public void PrintPreview(Object sender, System.EventArgs e)
2683
2680
/// </summary>
2684
2681
public void GoTo ( Object sender , System . EventArgs e )
2685
2682
{
2686
- this . gotoDialog . Show ( ) ;
2683
+ if ( ! this . gotoDialog . Visible )
2684
+ this . gotoDialog . Show ( ) ;
2685
+ else
2686
+ this . gotoDialog . Activate ( ) ;
2687
2687
}
2688
2688
2689
2689
/// <summary>
@@ -2711,7 +2711,10 @@ public void FindPrevious(Object sender, System.EventArgs e)
2711
2711
/// </summary>
2712
2712
public void FindAndReplace ( Object sender , System . EventArgs e )
2713
2713
{
2714
- this . frInDocDialog . Show ( ) ;
2714
+ if ( ! this . frInDocDialog . Visible )
2715
+ this . frInDocDialog . Show ( ) ;
2716
+ else
2717
+ this . frInDocDialog . Activate ( ) ;
2715
2718
}
2716
2719
2717
2720
/// <summary>
@@ -2721,19 +2724,25 @@ public void FindAndReplaceFrom(Object sender, System.EventArgs e)
2721
2724
{
2722
2725
ToolStripItem button = ( ToolStripItem ) sender ;
2723
2726
String file = ( ( ItemData ) button . Tag ) . Tag ;
2724
- ( ( Form ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) delegate
2727
+ this . BeginInvoke ( ( MethodInvoker ) delegate
2725
2728
{
2726
2729
OpenEditableDocument ( file ) ;
2727
2730
} ) ;
2728
- this . frInDocDialog . Show ( ) ;
2731
+ if ( ! this . frInDocDialog . Visible )
2732
+ this . frInDocDialog . Show ( ) ;
2733
+ else
2734
+ this . frInDocDialog . Activate ( ) ;
2729
2735
}
2730
2736
2731
2737
/// <summary>
2732
2738
/// Opens a find and replace in files dialog
2733
2739
/// </summary>
2734
2740
public void FindAndReplaceInFiles ( Object sender , System . EventArgs e )
2735
2741
{
2736
- this . frInFilesDialog . Show ( ) ;
2742
+ if ( ! this . frInFilesDialog . Visible )
2743
+ this . frInFilesDialog . Show ( ) ;
2744
+ else
2745
+ this . frInFilesDialog . Activate ( ) ;
2737
2746
}
2738
2747
2739
2748
/// <summary>
@@ -2743,7 +2752,10 @@ public void FindAndReplaceInFilesFrom(Object sender, System.EventArgs e)
2743
2752
{
2744
2753
ToolStripItem button = ( ToolStripItem ) sender ;
2745
2754
String path = ( ( ItemData ) button . Tag ) . Tag ;
2746
- this . frInFilesDialog . Show ( ) ; // Show first..
2755
+ if ( ! this . frInFilesDialog . Visible )
2756
+ this . frInFilesDialog . Show ( ) ; // Show first..
2757
+ else
2758
+ this . frInFilesDialog . Activate ( ) ;
2747
2759
this . frInFilesDialog . SetFindPath ( path ) ;
2748
2760
}
2749
2761
@@ -2852,7 +2864,7 @@ public void ExtractZip(Object sender, System.EventArgs e)
2852
2864
String zipLog = String . Empty ;
2853
2865
String zipFile = String . Empty ;
2854
2866
Boolean requiresRestart = false ;
2855
- Boolean silentInstall = MainForm . Silent ;
2867
+ Boolean silentInstall = Silent ;
2856
2868
ToolStripItem button = ( ToolStripItem ) sender ;
2857
2869
String [ ] chunks = ( ( ( ItemData ) button . Tag ) . Tag ) . Split ( ';' ) ;
2858
2870
if ( chunks . Length > 1 )
@@ -2934,7 +2946,7 @@ public void RemoveZip(Object sender, System.EventArgs e)
2934
2946
String zipLog = String . Empty ;
2935
2947
String zipFile = String . Empty ;
2936
2948
Boolean requiresRestart = false ;
2937
- Boolean silentRemove = MainForm . Silent ;
2949
+ Boolean silentRemove = Silent ;
2938
2950
List < String > removeDirs = new List < String > ( ) ;
2939
2951
ToolStripItem button = ( ToolStripItem ) sender ;
2940
2952
String [ ] chunks = ( ( ( ItemData ) button . Tag ) . Tag ) . Split ( ';' ) ;
0 commit comments