📄 file.cs
字号:
// File.cs
// Copyright (C) 2000 Mike Krueger
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using Microsoft.Win32;
using System;
using System.Collections;
using System.IO;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Printing;
using System.Diagnostics;
using System.CodeDom.Compiler;
using System.Xml;
using System.Reflection;
using SharpDevelop.Actions;
using SharpDevelop.Gui;
using SharpDevelop.Gui.Dialogs;
using SharpDevelop.Gui.Window;
using SharpDevelop.Tool.Data;
using SharpDevelop.Internal.Project;
using SharpDevelop.Internal.Messages;
namespace SharpDevelop.Actions.Menu {
public class NewFile : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
new NewFileDialog(executor.Main).ShowDialog();
}
}
public class OpenFile : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
OpenFileDialog fdiag = new OpenFileDialog();
fdiag.AddExtension = true;
fdiag.Filter = Option.GetProperty("SharpDevelop.Action.MenuAction.OpenFile.FileFilter", "").ToString();
fdiag.Multiselect = true;
fdiag.CheckFileExists = true;
if (fdiag.ShowDialog() == DialogResult.OK) {
foreach (string name in fdiag.FileNames) {
executor.Main.OpenWindow(name);
}
}
fdiag.Dispose();
}
}
public class CloseFile : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
executor.Main.ShouldRecompile = true;
ContentWindow window = executor.Main.ActiveContentWindow;
if (window != null)
window.Close();
}
}
public class CloseAll : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
executor.Main.ShouldRecompile = true;
foreach (ContentWindow window in executor.Main.MdiChildren) {
window.Close();
}
}
}
public class SaveFile : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
executor.Main.ShouldRecompile = true;
ContentWindow window = executor.Main.ActiveContentWindow;
if (window != null) {
if (window.Untitled) {
SaveFileAs sfa = new SaveFileAs();
sfa.Execute(executor);
}
else
window.SaveContent();
}
}
}
public class SaveFileAs : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
ContentWindow window = executor.Main.ActiveContentWindow;
if (window != null)
window.SaveContentAs();
}
}
public class SaveAll : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
executor.Main.ShouldRecompile = true;
foreach (ContentWindow window in executor.Main.MdiChildren) {
if (window.Untitled) {
SaveFileAs sfa = new SaveFileAs();
sfa.Execute(executor);
} else
window.SaveContent();
}
}
}
public class ExitProgram : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
executor.Main.CloseWithoutAsk = true;
executor.Main.Close();
executor.Main.CloseWithoutAsk = false;
}
}
public class Print : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
ContentWindow window = executor.Main.ActiveContentWindow;
if (window != null) {
PrintDocument pdoc = window.ISdEditable.PrintDocument;
if (pdoc != null) {
PrintDialog ppd = new PrintDialog();
ppd.Document = pdoc;
ppd.AllowSomePages = true;
ppd.ShowDialog();
pdoc.Print();
}
}
}
}
public class PrintPreview : ISdPlugin
{
public ISdMessageHandler MessageHandler {
get {
return null;
}
}
public void Execute(ISdPluginExecutor executor)
{
ContentWindow window = executor.Main.ActiveContentWindow;
if (window != null) {
PrintDocument pdoc = window.ISdEditable.PrintDocument;
if (pdoc != null) {
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Owner = executor.Main;
ppd.TopMost = true;
ppd.Document = pdoc;
ppd.Show();
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -