diff --git a/MarkDownSharpEditor/Form1.cs b/MarkDownSharpEditor/Form1.cs index d175537..0190fc4 100644 --- a/MarkDownSharpEditor/Form1.cs +++ b/MarkDownSharpEditor/Form1.cs @@ -79,6 +79,8 @@ public Form1() //WebBrowserClickSoundOFF(); CoInternetSetFeatureEnabled(FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, true); + //ちらつき防止(ビューアモード)→Shown()で戻す + this.splitContainer1.Visible = false; } //---------------------------------------------------------------------- @@ -226,13 +228,28 @@ private void Form1_Shown(object sender, EventArgs e) ArrayList FileArray = new ArrayList(); - //TODO: 「新しいウィンドウで開く」="/new"などの引数も含まれるので、 - // その辺りの処理も将来的に入れる。 - //コマンドラインでファイルが投げ込まれてきている //Launch with arguments string[] cmds = System.Environment.GetCommandLineArgs(); - for (int i = 1; i < cmds.Count(); i++) + int i; + for (i = 1; i < cmds.Count(); i++) + { + if (cmds[i][0] != '/' && cmds[i][0] != '-') break; + + switch (cmds[i].Substring(1)) + { + case "r": + case "readonly": + //読み取り専用=ビューアモード + changeToViewerMode(); + break; + + //TODO: 「新しいウィンドウで開く」="/new"などの引数も含まれるので、 + // その辺りの処理も将来的に入れる。 + } + } + this.splitContainer1.Visible = true; + for (; i < cmds.Count(); i++) { if (File.Exists(cmds[i]) == true) { @@ -332,6 +349,19 @@ private void Form1_Shown(object sender, EventArgs e) } } + //---------------------------------------------------------------------- + // ビューアモードへ変更 + //---------------------------------------------------------------------- + private void changeToViewerMode() { + this.richTextBox1.ScrollBars = RichTextBoxScrollBars.None; + this.splitContainer1.SplitterWidth = 1; + this.splitContainer1.SplitterDistance = this.splitContainer1.Panel1MinSize = 0; + this.splitContainer1.IsSplitterFixed = true; + + this.menuSaveFile.Enabled = this.menuSaveAsFile.Enabled = false; + this.menuEdit.Enabled = this.menuViewToolBar.Enabled = this.menuViewWidthEvenly.Enabled = false; + } + //---------------------------------------------------------------------- // フォームタイトルの表示(更新) // Refresh form caption diff --git a/MarkDownSharpEditor/MarkDownSharpEditor.csproj b/MarkDownSharpEditor/MarkDownSharpEditor.csproj index 18395d6..2f334c4 100644 --- a/MarkDownSharpEditor/MarkDownSharpEditor.csproj +++ b/MarkDownSharpEditor/MarkDownSharpEditor.csproj @@ -65,7 +65,7 @@ LocalIntranet - true + false