Skip to content

Commit

Permalink
-删除注释掉的代码和多余空行
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Jul 25, 2024
1 parent 96681de commit b15e744
Show file tree
Hide file tree
Showing 22 changed files with 13 additions and 198 deletions.
7 changes: 0 additions & 7 deletions App/Functions/AutoBookmarkControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,6 @@ private void ControlEvent(object sender, EventArgs e) {
}
}
else if (sender == _PasteButton) {
//var s = Clipboard.GetText ();
//if (String.IsNullOrEmpty (s) == false && s.Length < 100) {
// _LevelAdjustmentBox.AddObject (new AutoBookmarkOptions.LevelAdjustmentOption () {
// Condition = new AutoBookmarkCondition.FontNameCondition (s, false)
// });
// return;
//}
if (_copiedLevelAdjustments.HasContent() == false) {
return;
}
Expand Down
7 changes: 0 additions & 7 deletions App/Functions/BookmarkControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ namespace PDFPatcher
{
public partial class BookmarkControl : UserControl
{
//readonly string[] xmlBookmarkType = new string[] { ".xml" };
//private string[] supportedBookmarkTypes;
internal event EventHandler<EventArgs> BrowseForFile;

public BookmarkControl() {
InitializeComponent();
//supportedBookmarkTypes = defaultBookmarkTypes;
}

///<summary>获取或指定书签文件路径的下拉列表框。</summary>
Expand Down Expand Up @@ -41,7 +38,6 @@ public override string Text {
public bool UseForBookmarkExport {
get => _UseForBookmarkExport;
set =>
//supportedBookmarkTypes = value ? xmlBookmarkType : defaultBookmarkTypes;
_UseForBookmarkExport = value;
}

Expand Down Expand Up @@ -72,12 +68,10 @@ private void _BrowseSourcePdfButton_Click(object sender, EventArgs e) {
}

private void _BookmarkBox_DragEnter(object sender, DragEventArgs e) {
//Common.Form.FeedbackDragFileOver (e, supportedBookmarkTypes);
e.FeedbackDragFileOver(Constants.FileExtensions.AllBookmarkExtension);
}

private void _BookmarkBox_DragDrop(object sender, DragEventArgs e) {
//Common.Form.DropFileOver ((Control)sender, e, supportedBookmarkTypes);
((Control)sender).DropFileOver(e, Constants.FileExtensions.AllBookmarkExtension);
}

Expand All @@ -88,7 +82,6 @@ private void _BookmarkBox_TextChanged(object sender, EventArgs e) {
private void BookmarkControl_Show(object sender, EventArgs e) {
var t = _BookmarkBox.Text;
if (Visible && AppContext.MainForm != null) {
// _BookmarkBox.DataSource = new BindingList<string> (_UseForBookmarkExport ? ContextData.Recent.SavedInfoDocuments : ContextData.Recent.InfoDocuments);
_BookmarkBox.Contents = AppContext.Recent.InfoDocuments;
}
else if (Visible == false) {
Expand Down
13 changes: 2 additions & 11 deletions App/Functions/DocumentInspectorControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ void ToolbarItemClicked(object sender, ToolStripItemClickedEventArgs e) {
var cn = ci.Name;
var n = _ObjectDetailBox.GetModelObject(_ObjectDetailBox.FocusedItem.Index) as DocumentObject;
if (ci == _DeleteButton) {
//if (this.ActiveControl == _DocumentTree) {
if (n == null || n.Parent == null) {
return;
}
Expand All @@ -546,7 +545,6 @@ void ToolbarItemClicked(object sender, ToolStripItemClickedEventArgs e) {
_ObjectDetailBox.RefreshObject(n.Parent);
}
}
//}
}
else if (ci == _ViewButton) {
if (n == null) {
Expand Down Expand Up @@ -575,11 +573,6 @@ void ToolbarItemClicked(object sender, ToolStripItemClickedEventArgs e) {
using (var r = new StreamReader(ms))
using (var f = new TextViewerForm(r.ReadToEnd(), true)) {
f.ShowDialog(FindForm());
//_DescriptionBox.Text = String.Empty;
//while (r.Peek () != -1) {
// _DescriptionBox.AppendText (r.ReadLine ());
// _DescriptionBox.AppendText (Environment.NewLine);
//}
}
}
}
Expand Down Expand Up @@ -806,8 +799,6 @@ void _LoadDocumentWorker_DoWork(object sender, DoWorkEventArgs e) {
_pdf?.Close();
_pdf = d;
e.Result = path;
//Common.Form.Action ev = delegate () { _FilePathBox.Text = path; };
//_FilePathBox.Invoke (ev);
}
catch (iTextSharp.text.exceptions.BadPasswordException) {
FormHelper.ErrorBox(Messages.PasswordInvalid);
Expand Down Expand Up @@ -845,10 +836,10 @@ void _ExportButton_DropDownOpening(object sender, EventArgs e) {
= m["_ExportBinary"].Enabled
= m["_ExportUncompressedHexText"].Enabled
= m["_ExportUncompressedBinary"].Enabled
= (n.ExtensiveObject as PRStream) != null;
= n.ExtensiveObject is PRStream;
m["_ExportXml"].Enabled
= __XmlExportableTypes.Contains(n.Type);
m["_ExportToUnicode"].Visible = (n.ExtensiveObject as PRStream) != null && n.Name == "ToUnicode";
m["_ExportToUnicode"].Visible = n.ExtensiveObject is PRStream && n.Name == "ToUnicode";
}

void _AddObjectMenu_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) {
Expand Down
20 changes: 0 additions & 20 deletions App/Functions/EditorControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,6 @@ void OnLoad() {
return;
}
ScrollToSelectedBookmarkLocation();
//var bs = el.GetAttribute (Constants.BookmarkAttributes.Style);
//switch (bs) {
// case Constants.BookmarkAttributes.StyleType.Bold:
// _BookmarkBoldButton.Checked = true;
// _BookmarkItalicButton.Checked = false;
// break;
// case Constants.BookmarkAttributes.StyleType.BoldItalic:
// _BookmarkBoldButton.Checked = true;
// _BookmarkItalicButton.Checked = true;
// break;
// case Constants.BookmarkAttributes.StyleType.Italic:
// _BookmarkBoldButton.Checked = false;
// _BookmarkItalicButton.Checked = true;
// break;
// default:
// _BookmarkBoldButton.Checked = false;
// _BookmarkItalicButton.Checked = false;
// break;
//}
};
_BookmarkBox.CellEditStarting += (s, args) => {
if (args.Column.Index == 0) {
Expand Down Expand Up @@ -614,7 +595,6 @@ void _BookmarkBox_DragDrop(object sender, DragEventArgs e) {
}
}


#region Editor.IEditView
bool Editor.IEditView.AffectsDescendantBookmarks => _IncludeDecendantBox.Checked || ModifierKeys == Keys.Shift;

Expand Down
10 changes: 1 addition & 9 deletions App/Functions/ExtractImageControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ void _BrowseTargetPdfButton_Click(object sender, EventArgs e) {
_SaveImageBox.SelectedPath = Path.GetDirectoryName(sourceFile);
}
if (_SaveImageBox.ShowDialog() == DialogResult.OK) {
_TargetBox.Text =
_SaveImageBox.SelectedPath
//+ (_SaveImageBox.SelectedPath.EndsWith ("\\") ? String.Empty : "\\")
//+ Path.GetFileNameWithoutExtension (sourceFile)
;
_TargetBox.Text = _SaveImageBox.SelectedPath;
}
}

Expand Down Expand Up @@ -196,10 +192,6 @@ void Control_Show(object sender, EventArgs e) {
if (Visible && AppContext.MainForm != null) {
_TargetBox.Contents = AppContext.Recent.Folders;
}
//else if (this.Visible == false) {
// this._TargetBox.DataSource = null;
//}
}

}
}
2 changes: 0 additions & 2 deletions App/Functions/ExtractPageControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,5 @@ void IResettableControl.Reload() {
}

#endregion


}
}
1 change: 0 additions & 1 deletion App/Functions/FileListHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,5 @@ public void ResizeItemListColumns() {
}
}
}

}
}
4 changes: 0 additions & 4 deletions App/Functions/HistoryComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ internal void AddHistoryItem(string text) {
if (i == 0) {
return;
}
//Trace.WriteLine ("add history item:" + text);
if (i != -1) {
RemoveAt(i);
}
Expand All @@ -55,8 +54,6 @@ private int IndexOf(string o) {
}

private void RemoveAt(int i) {
//Trace.WriteLine ("remove item:" + i);

var l = Contents;
if (l != null) {
l.RemoveAt(i);
Expand All @@ -67,7 +64,6 @@ private void RemoveAt(int i) {
}

private void Insert(int i, string o) {
//Trace.WriteLine ("insert item:" + i + ":" + o);
var l = Contents;
if (l != null) {
l.Insert(i, o);
Expand Down
14 changes: 0 additions & 14 deletions App/Functions/InfoExchangerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ void OnLoad() {
fi.AddRange(new System.Drawing.Image[] {
Properties.Resources.OriginalPdfFile
});
//_ItemList.SelectedIndexChanged += (s, args) => {
// if (_ItemList.SelectedIndex != -1 && _TargetPdfFile.Text.Trim ().Length > 0) {
// var f = _ItemList.GetModelObject (_ItemList.SelectedIndex) as SourceItem;
// AppContext.MainForm.StatusText = "输出文件:" + f.GetTargetPdfFileName (_TargetPdfFile.Text.Trim ());
// }
// else {
// AppContext.MainForm.StatusText = String.Empty;
// }
//};
_ItemList.FixEditControlWidth();
_ItemList.ScaleColumnWidths();
_listHelper = new FileListHelper(_ItemList);
Expand Down Expand Up @@ -160,11 +151,6 @@ void _ImportButton_Click(object sender, EventArgs e) {
FormHelper.ErrorBox(Messages.TargetFileNotSpecified);
return;
}
//if (_mode == ProcessMode.Merge && Common.FileHelper.IsPathValid (targetPdfFile) == false) {
// Common.FormHelper.ErrorBox ("输出文件名无效。" + (Common.FileUtility.HasFileNameMacro (targetPdfFile) ? "\n制作 PDF 文件功能不支持替代符。" : String.Empty));
// return;
//}

var l = _ItemList.GetItemCount();
if (l == 0) {
FormHelper.InfoBox("请添加需要处理的 PDF 文件。");
Expand Down
12 changes: 0 additions & 12 deletions App/Functions/MacroMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@ internal sealed class MacroMenu : ContextMenuStrip
readonly TextBox __editOperationWrapper = new TextBox();

internal const string InsertText = "插入";
//internal const string Copy = "复制";
//internal const string Paste = "粘贴";
//internal const string Cut = "剪切";
//internal const string Delete = "删除";

//internal void LoadCopyEditMacros () {
// this.Items.AddRange (new ToolStripItem[] {
// new ToolStripMenuItem (Cut),
// new ToolStripMenuItem (Copy),
// new ToolStripMenuItem (Paste),
// new ToolStripMenuItem (Delete)
// });
//}
public MacroMenu() : base() { }
public MacroMenu(System.ComponentModel.IContainer container) : base(container) { }

Expand Down
36 changes: 1 addition & 35 deletions App/Functions/MergerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,6 @@ internal void CopyOrMoveElement(List<SourceItem> source, SourceItem target, bool
if (p == _itemsContainer) {
_ItemList.SetObjects(_itemsContainer.Items);
}
else {
//_ItemList.RefreshObject (p);
}
}
_ItemList.SelectedObjects = source;
}
Expand Down Expand Up @@ -396,26 +393,11 @@ void _ImportButton_Click(object sender, EventArgs e) {
return;
}

//for (int i = _ItemList.GetItemCount () - 1; i >= 0; i--) {
// var f = _ItemList.GetModelObject (i) as SourceItem;
// if (f.Type == SourceItem.ItemType.Pdf) {
// AppContext.Recent.AddHistoryItem (AppContext.Recent.SourcePdfFiles, f.FilePath);
// }
//}
var l = _ItemList.GetItemCount();
if (l == 0) {
FormHelper.InfoBox("请添加用于生成 PDF 文件的图片或 PDF 源文件。");
return;
}
//var si = new List<SourceItem> (l);
//for (int i = 0; i < l; i++) {
// var item = _ItemList.GetModelObject (_ItemList.GetNthItemInDisplayOrder (i).Index) as SourceItem;
// //if (item.Type == SourceFileItem.ItemType.Pdf && item.Path.EndsWith (Constants.FileExtensions.Pdf, StringComparison.OrdinalIgnoreCase)) {
// // ContextData.Recent.AddHistoryItem (ContextData.Recent.SourcePdfFiles, item.Path);
// //}
// si.Add (item);
//}

_BookmarkControl.FileList.AddHistoryItem();
_TargetPdfFile.FileList.AddHistoryItem();
var fm = _IndividualMergerModeBox.Checked;
Expand Down Expand Up @@ -846,7 +828,6 @@ void SetImageCropping() {
ListViewItem GetFocusedPdfItem() {
var vi = _ItemList.FocusedItem;
if (vi == null
//|| vi.Selected == false
|| vi.Text.EndsWith(Constants.FileExtensions.Pdf, StringComparison.OrdinalIgnoreCase) == false) {
return null;
}
Expand Down Expand Up @@ -895,22 +876,7 @@ void _AddDocumentWorker_DoWork(object sender, DoWorkEventArgs e) {

void _AddDocumentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
AppContext.MainForm.Enabled = true;
//ResizeItemListColumns ();
}

//void ResizeItemListColumns () {
// var c = _ItemList.Columns[0];
// _ItemList.AutoResizeColumns (ColumnHeaderAutoResizeStyle.ColumnContent);
// if (c.Width < 100) {
// c.Width = 100;
// }
// for (int i = 1; i < _ItemList.Columns.Count; i++) {
// c = _ItemList.Columns[i];
// if (c.Width < 50) {
// c.Width = 50;
// }
// }
//}
}

void _AddDocumentWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) {
AddItem(SourceItem.Create(e.UserState as string));
Expand Down
4 changes: 0 additions & 4 deletions App/Functions/OcrControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ void Button_Click(object sender, EventArgs e) {
return;
}
}
//else if (String.IsNullOrEmpty (_BookmarkControl.Text)) {
// Common.Form.ErrorBox (Messages.InfoDocNotSpecified);
// return;
//}

AppContext.SourceFiles = _SourceFileControl.Files;
AppContext.BookmarkFile = _BookmarkControl.Text;
Expand Down
4 changes: 0 additions & 4 deletions App/Functions/PatcherControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ void _ImportButton_Click(object sender, EventArgs e) {
Common.FormHelper.ErrorBox(Messages.TargetFileNotSpecified);
return;
}
//if (_mode == ProcessMode.Merge && Common.FileHelper.IsPathValid (targetPdfFile) == false) {
// Common.FormHelper.ErrorBox ("输出文件名无效。" + (Common.FileUtility.HasFileNameMacro (targetPdfFile) ? "\n制作 PDF 文件功能不支持替代符。" : String.Empty));
// return;
//}

var l = _ItemList.GetItemCount();
if (l == 0) {
Expand Down
1 change: 0 additions & 1 deletion App/Functions/RecentFileMenuHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public static void AddRecentHistoryFile(string path) {
case Constants.FileExtensions.Pdf:
AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, path);
break;
//case Constants.FileExtensions.Txt:
case Constants.FileExtensions.Xml:
AppContext.RecentItems.AddHistoryItem(AppContext.Recent.InfoDocuments, path);
break;
Expand Down
1 change: 0 additions & 1 deletion App/Functions/RenameControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ void _AddDocumentWorker_DoWork(object sender, DoWorkEventArgs e) {

void _AddDocumentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
AppContext.MainForm.Enabled = true;
//_listHelper.ResizeItemListColumns ();
}

void _AddDocumentWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) {
Expand Down
Loading

0 comments on commit b15e744

Please sign in to comment.