Skip to content

Commit

Permalink
增加调试日志、适配DPI、修复一些已知的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
indiff committed Jun 23, 2022
1 parent 2cbe6a3 commit e2946c3
Show file tree
Hide file tree
Showing 49 changed files with 2,273 additions and 1,816 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -818,3 +818,4 @@ MigrationBackup/
/.sonarlint
/BandObjectLib/*.ruleset
*.ruleset
/.idea
1 change: 1 addition & 0 deletions BandObjectLib/BandObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


namespace BandObjectLib {
// Band ¶ÔÏóÀ©Õ¹×ÊÔ´¹ÜÀíÆ÷
public class BandObject : UserControl, IDeskBand, IDockingWindow, IInputObject, IObjectWithSite, IOleWindow, IPersistStream {
private Size _minSize = new Size(-1, -1);
protected IInputObjectSite BandObjectSite;
Expand Down
Binary file added ClassDiagram1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Plugins/Memo/MemoForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,10 @@ private void LoadDB() {
Opacity = store.Opacity;
}
txtDic = store.TxtDictionary;
stream.Close();
}
}
catch(Exception) {
catch(Exception e) {
}
}
else {
Expand Down
6 changes: 3 additions & 3 deletions Plugins/QTQuick/QTQuick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,9 @@ private static string getOldPath(RegistryKey envKey)
#endregion

// internal static readonly bool IsWin7 = Environment.OSVersion.Version >= new Version(6, 1);
// internal static readonly bool IsXP = Environment.OSVersion.Version.Major <= 5;

// internal static readonly bool IsXP = Environment.OSVersion.Version.Major <= 5;

#region 引入dll
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

Expand All @@ -824,7 +824,7 @@ private static string getOldPath(RegistryKey envKey)
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public const Int32 CLOSE = 0x0010;

#endregion


// 关闭资源管理器,发送关闭消息
Expand Down
3 changes: 2 additions & 1 deletion Plugins/QTViewModeButton/PInvoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ internal static class PInvoke {

[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, ref RECT lParam);



}
}
21 changes: 17 additions & 4 deletions QTTabBar/AutoLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using BandObjectLib;
using Microsoft.Win32;
using QTTabBarLib.Interop;
using SHDocVw;

namespace QTTabBarLib {
Expand All @@ -36,26 +36,37 @@ public class AutoLoader : IObjectWithSite {
public static void Register(Type t) {
string name = t.GUID.ToString("B");
using(RegistryKey key = Registry.ClassesRoot.CreateSubKey(@"CLSID\" + name)) {
key.SetValue(null, "QT TabBar AutoLoader");
key.SetValue("MenuText", "QT TabBar AutoLoader");
key.SetValue("HelpText", "QT TabBar AutoLoader");
key.SetValue(null, "QTTabBar AutoLoader");
key.SetValue("MenuText", "QTTabBar AutoLoader");
key.SetValue("HelpText", "QTTabBar AutoLoader");
}
Registry.LocalMachine.CreateSubKey(BHOKEYNAME + name);
QTUtility2.log( "AutoLoader 注册表 QTTabBar 自动加载(安装)");
}

[ComUnregisterFunction]
public static void Unregister(Type t) {
using(RegistryKey key = Registry.LocalMachine.CreateSubKey(BHOKEYNAME)) {
key.DeleteSubKey(t.GUID.ToString("B"), false);
}
QTUtility2.log( "AutoLoader 注册表 QTTabBar 自动加载(卸载)");
}

public void SetSite(object site) {

// SetProcessDPIAware是Vista以上才有的函数,这样直接调用会使得程序不兼容XP
PInvoke.SetProcessDPIAware();

QTUtility2.log("QTUtility AutoLoader SetSite SetProcessDPIAware 不兼容XP");

explorer = site as IWebBrowser2;
QTUtility2.log( "QTTabBar AutoLoader SetSite " );
if(explorer == null || Process.GetCurrentProcess().ProcessName == "iexplore") {
QTUtility2.log( "QTTabBar AutoLoader SetSite Throw Exception " );
Marshal.ThrowExceptionForHR(E_FAIL);
}
else {
QTUtility2.log( "QTTabBar AutoLoader SetSite ActivateIt " );
ActivateIt();
}
}
Expand All @@ -81,7 +92,9 @@ private void ActivateIt() {
object pvarShow = true;
object pvarSize = null;
try {
QTUtility2.log( "QTTabBar 显示标签" );
explorer.ShowBrowserBar(pvaTabBar, pvarShow, pvarSize);
QTUtility2.log( "QTTabBar 显示工具栏" );
explorer.ShowBrowserBar(pvaButtonBar, pvarShow, pvarSize);
}
catch(COMException) {
Expand Down
2 changes: 2 additions & 0 deletions QTTabBar/AutomationClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace QTTabBarLib {
// All interaction with AutomationElements MUST be done in a thread other
// than the UI thread. Use this class to execute code in the Automation
// thread.
// 与AutomationElements的所有交互必须在另一个线程中完成
// 而不是UI线程。使用此类在自动化中执行代码
// http://msdn.microsoft.com/en-us/library/ee671692%28VS.85%29.aspx

public static class AutomationManager {
Expand Down
15 changes: 12 additions & 3 deletions QTTabBar/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ public class _Misc {
public int FileHistoryCount { get; set; }
public int NetworkTimeout { get; set; }
public bool AutoUpdate { get; set; }
public bool SoundBox { get; set; }
public bool SoundBox { get; set; }
public bool EnableLog { get; set; }

public _Misc() {
TaskbarThumbnails = false;
Expand All @@ -504,6 +505,8 @@ public _Misc() {
AutoUpdate = true;
// 默认关闭声音播放
SoundBox = false;
// 默认不启用日志功能
EnableLog = false;
}
}

Expand Down Expand Up @@ -932,6 +935,7 @@ from settingProperty in categoryType.GetProperties()
var ser = new DataContractJsonSerializer(t);
value = ser.ReadObject(stream);
}
QTUtility2.Close(stream);
}
}

Expand Down Expand Up @@ -1030,10 +1034,15 @@ from settingProperty in categoryType .GetProperties()
QTUtility2.MakeErrorLog(e);
}
stream.Position = 0;
value = new StreamReader(stream).ReadToEnd();
StreamReader streamReader = new StreamReader(stream);
value = streamReader.ReadToEnd();

QTUtility2.Close(streamReader);
QTUtility2.Close(stream);
// if (streamReader != null) { streamReader.Close(); }
// if (stream != null) { stream.Close(); }
}
}

key.SetValue(setting.name,value);
}
}
Expand Down
2 changes: 1 addition & 1 deletion QTTabBar/CreateNewGroupForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void InitializeComponent() {
chkAllTabs.TabIndex = 3;
AcceptButton = buttonOK;
AutoScaleDimensions = new SizeF(6f, 13f);
AutoScaleMode = AutoScaleMode.Font;
AutoScaleMode = AutoScaleMode.Dpi ;
CancelButton = buttonCancel;
ClientSize = new Size(0x133, 0x73);
Controls.Add(chkAllTabs);
Expand Down
3 changes: 2 additions & 1 deletion QTTabBar/ExtendedListViewCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ protected bool OnSelectionActivated(Keys modKeys) {
}

protected void OnItemCountChanged() {
if(ItemCountChanged != null) {
if (ItemCountChanged != null && ShellBrowser != null)
{
ItemCountChanged(ShellBrowser.GetItemCount());
}
}
Expand Down
Loading

0 comments on commit e2946c3

Please sign in to comment.