コード例 #1
0
 public TrackerSelector()
 {
     InitializeComponent();
      this.trackingSettings = new TrackingSettings() {
     Type = TrackingType.Full,
      };
      this.windowFinder = new WindowFinder();
      // Item events
      this.tsmiWindow.Click += new EventHandler(tsmiWindow_Click);
      this.tsmiWindow.MouseDown += new MouseEventHandler(tsmiWindow_MouseDown);
      // Subscrible to move event of items in order to update window finder when user moves cursor over them...
      foreach (ToolStripItem item in this.cmsCaptureRegion.Items) {
     item.MouseMove += new MouseEventHandler(cmsCaptureRegion_ItemMouseMove);
      }
      // Load target cursor from .ico file in resources
      System.IO.MemoryStream targetCursorMs = new System.IO.MemoryStream();
      iconTarget.Save(targetCursorMs);
      targetCursorMs.Position = 0;
      this.targetCursor = new Cursor(targetCursorMs);
 }
コード例 #2
0
        private void Track(TrackingType trackingType)
        {
            TrackingSettings trackingSettings;
             TrackerChangedEventArgs ea;
             frmTrackBounds selectBoundsView;
             switch (trackingType) {
            case TrackingType.None:
            case TrackingType.Full:
               trackingSettings = new TrackingSettings() {
                  Type = trackingType,
               };
               ea = new TrackerChangedEventArgs(trackingSettings);
               this.OnTrackerChanged(ea);
               break;
            case TrackingType.Fixed:
            case TrackingType.MouseCursor:
               bool trackingMouseCursor = trackingType == TrackingType.MouseCursor;
               selectBoundsView = new frmTrackBounds();
               this.isSelectingTracker = true;
               selectBoundsView.IsFixedAroundCursor = trackingMouseCursor;
               if (this.trackingSettings.Type == trackingType) {
                  selectBoundsView.Bounds = this.TrackingSettings.Bounds;
               }
               else {
                  Rectangle screenBounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
                  selectBoundsView.Bounds = new Rectangle(
                     screenBounds.Width / 4,
                     screenBounds.Height / 4,
                     screenBounds.Width / 2,
                     screenBounds.Height / 2);
               }
               if (selectBoundsView.ShowDialog()) {
                  this.isSelectingTracker = false;
                  trackingSettings = new TrackingSettings() {
                     Bounds = selectBoundsView.Bounds,
                     Type = trackingType,
                  };
                  ea = new TrackerChangedEventArgs(trackingSettings);
                  this.OnTrackerChanged(ea);
               }
               break;

            case TrackingType.Window:
               break;
             }
        }
コード例 #3
0
 private void EndWindowFinding()
 {
     Debug.Assert(this.windowFinder.IsFinding, "Unexpected call of EndWindowFinding()");
      if (this.windowFinder.IsFinding) {
     Cursor.Current = Cursors.Default;
     IntPtr hWnd = this.windowFinder.EndFind();
     this.isSelectingTracker = false;
     if (hWnd != IntPtr.Zero) {
        this.prevTrackingWindowText = this.tsmiWindow.Text;
        this.UpdateTooltip();
        TrackingSettings trackerSettings = new TrackingSettings() {
           Hwnd = hWnd,
           Type = TrackingType.Window,
        };
        TrackerChangedEventArgs ea = new TrackerChangedEventArgs(trackerSettings);
        this.OnTrackerChanged(ea);
     }
     else {
        if (this.prevTrackingSettings.Type != TrackingType.Window) {
           this.tsmiWindow.Text = trackingTypeWindow;
        }
        else {
           this.tsmiWindow.Text = prevTrackingWindowText;
        }
        this.TrackingSettings = this.prevTrackingSettings;
     }
      }
 }
コード例 #4
0
 private void OnTrackerChanged(TrackerChangedEventArgs ea)
 {
     TrackingSettings trackingSettings = ea.TrackingSettings;
      this.TrackingSettings = trackingSettings;
      if (this.TrackerChanged != null) {
     this.TrackerChanged(this, ea);
      }
 }
コード例 #5
0
 private static string GetTrackingString(TrackingSettings trackingSettings)
 {
     switch (trackingSettings.Type) {
     case TrackingType.Fixed:
        return trackingTypeFixed;
     case TrackingType.Full:
        return trackingTypeFullScreen;
     case TrackingType.MouseCursor:
        return trackingTypeTrackMouse;
     case TrackingType.None:
        return trackingTypeNone;
     case TrackingType.Window:
        return trackingTypeWindow;
     default:
        throw new InvalidOperationException();
      }
 }
コード例 #6
0
 private void BeginWindowFinding()
 {
     Debug.Assert(!this.windowFinder.IsFinding, "Unexpected call of BeginWindowFinding()");
      if (!this.windowFinder.IsFinding) {
     this.windowFinder.BeginFind();
     // Keep current tracking type in case of cancellation.
     this.prevTrackingSettings = this.TrackingSettings.Clone();
     // Update radio buttons state
     this.TrackingSettings = new TrackingSettings() {
        Type = TrackingType.Window,
     };
     // Change cursor
     Cursor.Current = this.targetCursor;
     this.isSelectingTracker = true;
     cmsCaptureRegion.Capture = true;
     this.UpdateWindowFinder();
      }
 }
コード例 #7
0
 private static Image GetTrackingImage(TrackingSettings trackingSettings)
 {
     switch (trackingSettings.Type) {
     case TrackingType.None:
        return imageNoDisplay;
     case TrackingType.Fixed:
        return imageFixed;
     case TrackingType.Full:
        return imageFullScreen;
     case TrackingType.MouseCursor:
        return imageTrackMouse;
     case TrackingType.Window:
        return imageWindow;
     default:
        throw new InvalidOperationException();
      }
 }
コード例 #8
0
 private void ResetTracker()
 {
     TrackingSettings trackingSettings = new TrackingSettings() {
     Type = TrackingType.Full,
      };
      this.configuration.Tracking = trackingSettings;
      DisplaySettings displaySettings = this.DisplaySettings;
      displaySettings.Tracking = trackingSettings;
      this.DisplaySettings = displaySettings;
      this.configuration.Tracking = trackingSettings;
 }
コード例 #9
0
 private void ChangeTracker(TrackingSettings trackerSettings)
 {
     // Check recording state
      RecordingState state = this.recorder.State;
      // Debug.Assert(state == RecordingState.Idle);
      if (state != RecordingState.Idle) {
     return;
      }
      DisplaySettings displaySettings = this.DisplaySettings;
      displaySettings.Tracking = trackerSettings;
      this.DisplaySettings = displaySettings;
      this.configuration.Tracking = trackerSettings;
 }
コード例 #10
0
 public TrackerChangedEventArgs(TrackingSettings trackerSettings)
 {
     this.trackerSettings = trackerSettings;
 }
コード例 #11
0
 private Configuration()
 {
     var properties = Properties.Settings.Default;
      // Read configuration section elements
      // General
      string outputDir = properties.General_OutputDirectory;
      if (string.IsNullOrEmpty(outputDir)) {
     string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
     try {
        outputDir = Path.Combine(myDocuments, outputDirInMyDocs);
     }
     catch (ArgumentException) {
        outputDir = myDocuments;
     }
      }
      GeneralSettings general = new GeneralSettings();
      general.MinimizeOnRecord = properties.General_MinimizeOnRecord;
      general.HideFromTaskbar = properties.General_HideFromTaskbarIfMinimized;
      general.OutputDirectory = outputDir;
      // Hot Keys
      HotKeySettings hotKeys = new HotKeySettings();
      hotKeys.Cancel = properties.HotKeys_Cancel;
      hotKeys.Global = properties.HotKeys_Global;
      hotKeys.Pause = properties.HotKeys_Pause;
      hotKeys.Record = properties.HotKeys_Record;
      hotKeys.Stop = properties.HotKeys_Stop;
      // Mouse
      MouseSettings mouse = new MouseSettings();
      mouse.HighlightCursor = properties.Mouse_HighlightCursor;
      mouse.HighlightCursorColor = properties.Mouse_HighlightCursorColor;
      mouse.HighlightCursorRadious = properties.Mouse_HighlightCursorRadious;
      mouse.RecordCursor = properties.Mouse_RecordCursor;
      // Sound
      SoundSettings sound = new SoundSettings();
      sound.DeviceId = properties.Sound_DeviceId;
      sound.Format = properties.Sound_Format;
      // Tracking
      TrackingSettings tracking = new TrackingSettings();
      tracking.Bounds = properties.Tracking_Bounds;
      tracking.Type = properties.Tracking_Type;
      // Video
      VideoSettings video = new VideoSettings();
      video.Compressor = properties.Video_Compressor;
      video.Fps = properties.Video_Fps;
      video.Quality = properties.Video_Quality;
      // Watermark
      WatermarkSettings waterMark = new WatermarkSettings();
      waterMark.Alignment = properties.Watermark_Alignment;
      waterMark.Color = properties.Watermark_Color;
      waterMark.Display = properties.Watermark_Display;
      waterMark.Font = properties.Watermark_Font;
      waterMark.Margin = properties.Watermark_Margin;
      waterMark.Outline = properties.Watermark_Outline;
      waterMark.OutlineColor = properties.Watermark_OutlineColor;
      waterMark.RightToLeft = properties.Watermark_RightToLeft;
      waterMark.Text = properties.Watermark_Text;
      // Set properties
      this.General = general;
      this.HotKeys = hotKeys;
      this.Mouse = mouse;
      this.Sound = sound;
      this.Tracking = tracking;
      this.Video = video;
      this.Watermark = waterMark;
 }