ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.ScratchPad/ScratchPadPlugin.cs
Revision: 762
Committed: Thu Jun 20 20:25:55 2013 UTC (10 years, 3 months ago) by william
File size: 3110 byte(s)
Log Message:
move Scratchpad to it's own plugin

File Contents

# Content
1 #region Logging Defines
2 // include this any class or method that required logging, and comment-out what is not needed
3 #define LOGGING_ENABLED // this is only valid within the logger class
4 #region Enabled logging levels
5 #define LOGGING_ENABLE_INFO
6 #define LOGGING_ENABLE_WARN
7 #define LOGGING_ENABLE_DEBUG
8 #define LOGGING_ENABLE_VERBOSEDEBUG
9 #define LOGGING_ENABLE_ERROR
10 #define LOGGING_ENABLE_VERBOSEERROR
11 #define LOGGING_ENABLE_PROFILER
12 #endregion
13 #endregion
14
15 #define PLUGIN_ENABLED // when defined the plugin is enabled, otherwise it will not be shown
16 using System;
17 using System.Collections.Generic;
18 using System.Linq;
19 using System.Text;
20 using RomCheater.PluginFramework.Core;
21 using WeifenLuo.WinFormsUI.Docking;
22
23 namespace RomCheater.ScratchPad
24 {
25 public class ScratchPadPlugin : UserControlPlugin
26 {
27 ScratchPad t;
28 const string name = "ScratchPad Plugin";
29 const string description = "A simple plugin to scratch crap down on";
30 public ScratchPadPlugin() : base() { t = new ScratchPad(this); }
31 public override Guid ID
32 {
33 get { return AssemblyGuid.GetGuid(typeof(ScratchPadPlugin)); }
34 //get { return new Guid(); }
35 }
36 public override string Name
37 {
38 get
39 {
40 return name;
41 }
42 }
43 public override string Description
44 {
45 get
46 {
47 return description;
48 }
49 }
50 public override void Reload(bool silent)
51 {
52 }
53
54 public override void Config()
55 {
56 Logging.logger.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - has no configurable settings", name, ID);
57 }
58
59 public override void Show() { Show(null); }
60 public override void Show(DockPanel dockPanel) { Show(dockPanel, DockState.Document); }
61 public override void Show(DockPanel dockPanel, DockState dockState) { InternalShow(dockPanel, dockState); }
62 private void InternalShow(DockPanel dockPanel, DockState dockState)
63 {
64 #if PLUGIN_ENABLED
65 if (dockPanel == null)
66 {
67 t.Show();
68 }
69 else
70 {
71 t.Show(dockPanel, dockState);
72 }
73 #else
74 Logging.logger.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - is currently disabled", name, ID);
75 #endif
76 }
77
78 public override void Activate()
79 {
80 DockContentHandler handler = this.DockHandler;
81 if (handler != null)
82 handler.Activate();
83 }
84 public override void Close()
85 {
86 DockContentHandler handler = this.DockHandler;
87 if (handler != null)
88 handler.Close();
89 }
90 public override DockContentHandler DockHandler
91 {
92 get
93 {
94 if (t == null || t.DockHandler == null) return null;
95 return t.DockHandler;
96 }
97 }
98 }
99 }