1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
|
/*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2019 Dominik Reichl <dominik.reichl@t-online.de>
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using KeePass.UI;
namespace KeePass.App.Configuration
{
[Flags]
public enum AceKeyUIFlags : ulong
{
None = 0,
EnablePassword = 0x1,
EnableKeyFile = 0x2,
EnableUserAccount = 0x4,
EnableHidePassword = 0x8,
DisablePassword = 0x100,
DisableKeyFile = 0x200,
DisableUserAccount = 0x400,
DisableHidePassword = 0x800,
CheckPassword = 0x10000,
CheckKeyFile = 0x20000,
CheckUserAccount = 0x40000,
CheckHidePassword = 0x80000,
UncheckPassword = 0x1000000,
UncheckKeyFile = 0x2000000,
UncheckUserAccount = 0x4000000,
UncheckHidePassword = 0x8000000
}
[Flags]
public enum AceUIFlags : ulong
{
None = 0,
DisableOptions = 0x1,
DisablePlugins = 0x2,
DisableTriggers = 0x4,
DisableKeyChangeDays = 0x8,
HidePwQuality = 0x10,
DisableUpdateCheck = 0x20,
DisableXmlReplace = 0x40,
DisableDbSettings = 0x80,
HideBuiltInPwGenPrfInEntryDlg = 0x10000,
ShowLastAccessTime = 0x20000,
HideNewDbInfoDialogs = 0x40000,
HideAutoTypeObfInfo = 0x80000
}
[Flags]
public enum AceAutoTypeCtxFlags : long
{
None = 0,
ColTitle = 0x1,
ColUserName = 0x2,
ColPassword = 0x4,
ColUrl = 0x8,
ColNotes = 0x10,
ColSequence = 0x20,
ColSequenceComments = 0x40,
Default = (ColTitle | ColUserName | ColUrl | ColSequence)
}
public sealed class AceUI
{
public AceUI()
{
}
private AceTrayIcon m_tray = new AceTrayIcon();
public AceTrayIcon TrayIcon
{
get { return m_tray; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_tray = value;
}
}
private AceHiding m_uiHiding = new AceHiding();
public AceHiding Hiding
{
get { return m_uiHiding; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_uiHiding = value;
}
}
private bool m_bRepeatPwOnlyWhenHidden = true;
[DefaultValue(true)]
public bool RepeatPasswordOnlyWhenHidden
{
get { return m_bRepeatPwOnlyWhenHidden; }
set { m_bRepeatPwOnlyWhenHidden = value; }
}
private AceFont m_font = new AceFont();
public AceFont StandardFont
{
get { return m_font; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_font = value;
}
}
private AceFont m_fontPasswords = new AceFont(true);
public AceFont PasswordFont
{
get { return m_fontPasswords; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_fontPasswords = value;
}
}
private bool m_bForceSysFont = true;
[DefaultValue(true)]
public bool ForceSystemFontUnix
{
get { return m_bForceSysFont; }
set { m_bForceSysFont = value; }
}
private BannerStyle m_bannerStyle = BannerStyle.WinVistaBlack;
public BannerStyle BannerStyle
{
get { return m_bannerStyle; }
set { m_bannerStyle = value; }
}
private bool m_bShowImportStatusDlg = false;
[DefaultValue(false)]
public bool ShowImportStatusDialog
{
get { return m_bShowImportStatusDlg; }
set { m_bShowImportStatusDlg = value; }
}
private bool m_bShowDbMntncResDlg = true;
[DefaultValue(true)]
public bool ShowDbMntncResultsDialog
{
get { return m_bShowDbMntncResDlg; }
set { m_bShowDbMntncResDlg = value; }
}
private bool m_bShowRecycleDlg = true;
[DefaultValue(true)]
public bool ShowRecycleConfirmDialog
{
get { return m_bShowRecycleDlg; }
set { m_bShowRecycleDlg = value; }
}
private bool m_bShowEmSheetDlg = true;
[DefaultValue(true)]
public bool ShowEmSheetDialog
{
get { return m_bShowEmSheetDlg; }
set { m_bShowEmSheetDlg = value; }
}
// private bool m_bUseCustomTsRenderer = true;
// [DefaultValue(true)]
// public bool UseCustomToolStripRenderer
// {
// get { return m_bUseCustomTsRenderer; }
// set { m_bUseCustomTsRenderer = value; }
// }
private string m_strToolStripRenderer = string.Empty;
[DefaultValue("")]
public string ToolStripRenderer
{
get { return m_strToolStripRenderer; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_strToolStripRenderer = value;
}
}
private bool m_bTreeViewShowLines = false;
[DefaultValue(false)]
public bool TreeViewShowLines
{
get { return m_bTreeViewShowLines; }
set { m_bTreeViewShowLines = value; }
}
private bool m_bOptScreenReader = false;
[DefaultValue(false)]
public bool OptimizeForScreenReader
{
get { return m_bOptScreenReader; }
set { m_bOptScreenReader = value; }
}
private string m_strDataViewerRect = string.Empty;
[DefaultValue("")]
public string DataViewerRect
{
get { return m_strDataViewerRect; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_strDataViewerRect = value;
}
}
private string m_strDataEditorRect = string.Empty;
[DefaultValue("")]
public string DataEditorRect
{
get { return m_strDataEditorRect; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_strDataEditorRect = value;
}
}
private AceFont m_deFont = new AceFont();
public AceFont DataEditorFont
{
get { return m_deFont; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_deFont = value;
}
}
private bool m_bDeWordWrap = true;
[DefaultValue(true)]
public bool DataEditorWordWrap
{
get { return m_bDeWordWrap; }
set { m_bDeWordWrap = value; }
}
private string m_strCharPickerRect = string.Empty;
[DefaultValue("")]
public string CharPickerRect
{
get { return m_strCharPickerRect; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_strCharPickerRect = value;
}
}
private string m_strAutoTypeCtxRect = string.Empty;
[DefaultValue("")]
public string AutoTypeCtxRect
{
get { return m_strAutoTypeCtxRect; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_strAutoTypeCtxRect = value;
}
}
private long m_lAutoTypeCtxFlags = (long)AceAutoTypeCtxFlags.Default;
[DefaultValue((long)AceAutoTypeCtxFlags.Default)]
public long AutoTypeCtxFlags
{
get { return m_lAutoTypeCtxFlags; }
set { m_lAutoTypeCtxFlags = value; }
}
private string m_strAutoTypeCtxColWidths = string.Empty;
[DefaultValue("")]
public string AutoTypeCtxColumnWidths
{
get { return m_strAutoTypeCtxColWidths; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_strAutoTypeCtxColWidths = value;
}
}
private ulong m_uUIFlags = (ulong)AceUIFlags.None;
public ulong UIFlags
{
get { return m_uUIFlags; }
set { m_uUIFlags = value; }
}
private ulong m_uKeyCreationFlags = (ulong)AceKeyUIFlags.None;
public ulong KeyCreationFlags
{
get { return m_uKeyCreationFlags; }
set { m_uKeyCreationFlags = value; }
}
private ulong m_uKeyPromptFlags = (ulong)AceKeyUIFlags.None;
public ulong KeyPromptFlags
{
get { return m_uKeyPromptFlags; }
set { m_uKeyPromptFlags = value; }
}
// private bool m_bEditCancelConfirmation = true;
// public bool EntryEditCancelConfirmation
// {
// get { return m_bEditCancelConfirmation; }
// set { m_bEditCancelConfirmation = value; }
// }
private bool m_bAdvATCmds = false;
[DefaultValue(false)]
public bool ShowAdvAutoTypeCommands
{
get { return m_bAdvATCmds; }
set { m_bAdvATCmds = value; }
}
private bool m_bSecDeskSound = true;
[DefaultValue(true)]
public bool SecureDesktopPlaySound
{
get { return m_bSecDeskSound; }
set { m_bSecDeskSound = value; }
}
}
public sealed class AceHiding
{
public AceHiding()
{
}
private bool m_bSepHiding = false;
[DefaultValue(false)]
public bool SeparateHidingSettings
{
get { return m_bSepHiding; }
set { m_bSepHiding = value; }
}
private bool m_bHideInEntryDialog = true;
[DefaultValue(true)]
public bool HideInEntryWindow
{
get { return m_bHideInEntryDialog; }
set { m_bHideInEntryDialog = value; }
}
private bool m_bUnhideBtnAlsoUnhidesSec = false;
[DefaultValue(false)]
public bool UnhideButtonAlsoUnhidesSource
{
get { return m_bUnhideBtnAlsoUnhidesSec; }
set { m_bUnhideBtnAlsoUnhidesSec = value; }
}
}
public sealed class AceFont
{
private Font m_fCached = null;
private bool m_bCacheValid = false;
private string m_strFamily = "Microsoft Sans Serif";
public string Family
{
get { return m_strFamily; }
set
{
if(value == null) throw new ArgumentNullException("value");
m_strFamily = value;
m_bCacheValid = false;
}
}
private float m_fSize = 8.25f;
public float Size
{
get { return m_fSize; }
set { m_fSize = value; m_bCacheValid = false; }
}
private GraphicsUnit m_gu = GraphicsUnit.Point;
public GraphicsUnit GraphicsUnit
{
get { return m_gu; }
set { m_gu = value; m_bCacheValid = false; }
}
private FontStyle m_fStyle = FontStyle.Regular;
public FontStyle Style
{
get { return m_fStyle; }
set { m_fStyle = value; m_bCacheValid = false; }
}
private bool m_bOverrideUIDefault = false;
public bool OverrideUIDefault
{
get { return m_bOverrideUIDefault; }
set { m_bOverrideUIDefault = value; }
}
public AceFont()
{
}
public AceFont(Font f)
{
if(f == null) throw new ArgumentNullException("f");
this.Family = f.FontFamily.Name;
m_fSize = f.Size;
m_fStyle = f.Style;
m_gu = f.Unit;
}
public AceFont(bool bMonospace)
{
if(bMonospace) m_strFamily = "Courier New";
}
public Font ToFont()
{
if(m_bCacheValid) return m_fCached;
m_fCached = FontUtil.CreateFont(m_strFamily, m_fSize, m_fStyle, m_gu);
m_bCacheValid = true;
return m_fCached;
}
}
}
|