Disabled compiling of unused code for the 1.1 release

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2387 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-17 11:03:23 +00:00
parent 86dc1fa60d
commit a57fa7086f
7 changed files with 103 additions and 84 deletions

View file

@ -240,15 +240,16 @@ namespace Greenshot.Forms {
capture.CursorVisible = !capture.CursorVisible;
Invalidate();
break;
case Keys.V:
// Video
if (capture.CaptureDetails.CaptureMode != CaptureMode.Video) {
capture.CaptureDetails.CaptureMode = CaptureMode.Video;
} else {
capture.CaptureDetails.CaptureMode = captureMode;
}
Invalidate();
break;
//// TODO: Enable when the screen capture code works reliable
//case Keys.V:
// // Video
// if (capture.CaptureDetails.CaptureMode != CaptureMode.Video) {
// capture.CaptureDetails.CaptureMode = CaptureMode.Video;
// } else {
// capture.CaptureDetails.CaptureMode = captureMode;
// }
// Invalidate();
// break;
case Keys.Z:
if (captureMode == CaptureMode.Region) {
// Toggle zoom
@ -682,11 +683,12 @@ namespace Greenshot.Forms {
fixedRect = captureRect;
}
if (capture.CaptureDetails.CaptureMode == CaptureMode.Video) {
graphics.FillRectangle(RedOverlayBrush, fixedRect);
} else {
// TODO: enable when the screen capture code works reliable
//if (capture.CaptureDetails.CaptureMode == CaptureMode.Video) {
// graphics.FillRectangle(RedOverlayBrush, fixedRect);
//} else {
graphics.FillRectangle(GreenOverlayBrush, fixedRect);
}
//}
graphics.DrawRectangle(OverlayPen, fixedRect);
// rulers

View file

@ -1203,13 +1203,19 @@ namespace Greenshot {
updateUndoRedoSurfaceDependencies();
}
/// <summary>
/// This is used when the dropshadow button is used
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void AddDropshadowToolStripMenuItemClick(object sender, EventArgs e) {
DropShadowEffect dropShadowEffect= new DropShadowEffect();
DialogResult result = new DropShadowSettingsForm(dropShadowEffect).ShowDialog(this);
if (result == DialogResult.OK) {
// TODO: Use the dropshadow settings form to make it possible to change the default values
//DialogResult result = new DropShadowSettingsForm(dropShadowEffect).ShowDialog(this);
//if (result == DialogResult.OK) {
surface.ApplyBitmapEffect(dropShadowEffect);
updateUndoRedoSurfaceDependencies();
}
//}
}
/// <summary>
@ -1219,20 +1225,27 @@ namespace Greenshot {
/// <param name="e"></param>
void ResizeToolStripMenuItemClick(object sender, EventArgs e) {
ResizeEffect resizeEffect = new ResizeEffect(surface.Image.Width, surface.Image.Height, true);
DialogResult result = new ResizeSettingsForm(resizeEffect).ShowDialog(this);
if (result == DialogResult.OK) {
// TODO: Use the Resize SettingsForm to make it possible to change the default values
// DialogResult result = new ResizeSettingsForm(resizeEffect).ShowDialog(this);
// if (result == DialogResult.OK) {
surface.ApplyBitmapEffect(resizeEffect);
updateUndoRedoSurfaceDependencies();
}
//}
}
/// <summary>
/// Call the torn edge effect
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void TornEdgesToolStripMenuItemClick(object sender, EventArgs e) {
TornEdgeEffect tornEdgeEffect = new TornEdgeEffect();
DialogResult result = new TornEdgeSettingsForm(tornEdgeEffect).ShowDialog(this);
if (result == DialogResult.OK) {
surface.ApplyBitmapEffect(tornEdgeEffect);
updateUndoRedoSurfaceDependencies();
}
// TODO: Use the dropshadow settings form to make it possible to change the default values
//DialogResult result = new TornEdgeSettingsForm(tornEdgeEffect).ShowDialog(this);
//if (result == DialogResult.OK) {
surface.ApplyBitmapEffect(tornEdgeEffect);
updateUndoRedoSurfaceDependencies();
//}
}
void GrayscaleToolStripMenuItemClick(object sender, EventArgs e) {

View file

@ -134,12 +134,12 @@
<Compile Include="Forms\CaptureForm.Designer.cs">
<DependentUpon>CaptureForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\DropShadowSettingsForm.cs">
<None Include="Forms\DropShadowSettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\DropShadowSettingsForm.Designer.cs">
</None>
<None Include="Forms\DropShadowSettingsForm.Designer.cs">
<DependentUpon>DropShadowSettingsForm.cs</DependentUpon>
</Compile>
</None>
<Compile Include="Forms\ImageEditorForm.cs">
<SubType>Form</SubType>
</Compile>
@ -149,18 +149,18 @@
<Compile Include="Forms\AnimatingBaseForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\ResizeSettingsForm.cs">
<None Include="Forms\ResizeSettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\ResizeSettingsForm.Designer.cs">
</None>
<None Include="Forms\ResizeSettingsForm.Designer.cs">
<DependentUpon>ResizeSettingsForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\TornEdgeSettingsForm.cs">
</None>
<None Include="Forms\TornEdgeSettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\TornEdgeSettingsForm.Designer.cs">
</None>
<None Include="Forms\TornEdgeSettingsForm.Designer.cs">
<DependentUpon>TornEdgeSettingsForm.cs</DependentUpon>
</Compile>
</None>
<Compile Include="Forms\LanguageDialog.cs">
<SubType>Form</SubType>
</Compile>
@ -201,7 +201,7 @@
<DependentUpon>MovableShowColorForm.cs</DependentUpon>
</Compile>
<None Include="App.config" />
<Compile Include="Helpers\AviHelper.cs" />
<None Include="Helpers\AviHelper.cs" />
<Compile Include="Helpers\CaptureHelper.cs" />
<Compile Include="Helpers\Colors.cs" />
<Compile Include="Helpers\CopyData.cs" />
@ -224,7 +224,7 @@
<Compile Include="Memento\IMemento.cs" />
<Compile Include="Memento\DrawableContainerBoundsChangeMemento.cs" />
<Compile Include="Memento\SurfaceBackgroundChangeMemento.cs" />
<Compile Include="Helpers\ScreenCaptureHelper.cs" />
<None Include="Helpers\ScreenCaptureHelper.cs" />
<Compile Include="Helpers\UpdateHelper.cs" />
<Compile Include="Helpers\EnvironmentInfo.cs" />
<Compile Include="Helpers\GuiRectangle.cs" />

View file

@ -45,7 +45,8 @@ namespace Greenshot.Helpers {
public class CaptureHelper {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(CaptureHelper));
private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
private static ScreenCaptureHelper screenCapture = null;
// TODO: when we get the screen capture code working correctly, this needs to be enabled
//private static ScreenCaptureHelper screenCapture = null;
private List<WindowDetails> windows = new List<WindowDetails>();
private WindowDetails selectedCaptureWindow = null;
private Rectangle captureRect = Rectangle.Empty;
@ -173,11 +174,12 @@ namespace Greenshot.Helpers {
/// </summary>
private void MakeCapture() {
// Experimental code
if (screenCapture != null) {
screenCapture.Stop();
screenCapture = null;
return;
}
// TODO: when we get the screen capture code working correctly, this needs to be enabled
//if (screenCapture != null) {
// screenCapture.Stop();
// screenCapture = null;
// return;
//}
// This fixes a problem when a balloon is still visible and a capture needs to be taken
// forcefully removes the balloon!
if (!conf.HideTrayicon) {
@ -492,22 +494,23 @@ namespace Greenshot.Helpers {
return getWindowDetailsThread;
}
private void AddCaptureElementsForWindow(ICaptureElement parentElement, WindowDetails parentWindow, int level) {
foreach(WindowDetails childWindow in parentWindow.Children) {
// Make sure the details are retrieved once
childWindow.FreezeDetails();
Rectangle childRectangle = childWindow.WindowRectangle;
Size s1 = childRectangle.Size;
childRectangle.Intersect(parentElement.Bounds);
if (childRectangle.Width > 0 && childRectangle.Height > 0) {
CaptureElement childCaptureElement = new CaptureElement(childRectangle);
parentElement.Children.Add(childCaptureElement);
if (level > 0) {
AddCaptureElementsForWindow(childCaptureElement, childWindow, level -1);
}
}
}
}
// Code used to get the capture elements, which is not active yet
//private void AddCaptureElementsForWindow(ICaptureElement parentElement, WindowDetails parentWindow, int level) {
// foreach(WindowDetails childWindow in parentWindow.Children) {
// // Make sure the details are retrieved once
// childWindow.FreezeDetails();
// Rectangle childRectangle = childWindow.WindowRectangle;
// Size s1 = childRectangle.Size;
// childRectangle.Intersect(parentElement.Bounds);
// if (childRectangle.Width > 0 && childRectangle.Height > 0) {
// CaptureElement childCaptureElement = new CaptureElement(childRectangle);
// parentElement.Children.Add(childCaptureElement);
// if (level > 0) {
// AddCaptureElementsForWindow(childCaptureElement, childWindow, level -1);
// }
// }
// }
//}
private void AddConfiguredDestination() {
foreach(string destinationDesignation in conf.OutputDestinations) {
@ -910,23 +913,24 @@ namespace Greenshot.Helpers {
//}
// Experimental code for Video capture
if (capture.CaptureDetails.CaptureMode == CaptureMode.Video) {
if (captureForm.UsedCaptureMode == CaptureMode.Window) {
screenCapture = new ScreenCaptureHelper(selectedCaptureWindow);
} else if (captureForm.UsedCaptureMode == CaptureMode.Region) {
screenCapture = new ScreenCaptureHelper(captureRect);
}
if (screenCapture != null) {
screenCapture.RecordMouse = capture.CursorVisible;
if (screenCapture.Start(25)) {
return;
}
// User clicked cancel or a problem occured
screenCapture.Stop();
screenCapture = null;
return;
}
}
// TODO: when we get the screen capture code working correctly, this needs to be enabled
//if (capture.CaptureDetails.CaptureMode == CaptureMode.Video) {
// if (captureForm.UsedCaptureMode == CaptureMode.Window) {
// screenCapture = new ScreenCaptureHelper(selectedCaptureWindow);
// } else if (captureForm.UsedCaptureMode == CaptureMode.Region) {
// screenCapture = new ScreenCaptureHelper(captureRect);
// }
// if (screenCapture != null) {
// screenCapture.RecordMouse = capture.CursorVisible;
// if (screenCapture.Start(25)) {
// return;
// }
// // User clicked cancel or a problem occured
// screenCapture.Stop();
// screenCapture = null;
// return;
// }
//}
// Take the captureRect, this already is specified as bitmap coordinates
capture.Crop(captureRect);

View file

@ -185,10 +185,10 @@ namespace Greenshot.Core {
}
/// <summary>
/// GrowEffect
/// ResizeCanvasEffect
/// </summary>
public class GrowEffect : IEffect {
public GrowEffect(int left, int right, int top, int bottom) {
public class ResizeCanvasEffect : IEffect {
public ResizeCanvasEffect(int left, int right, int top, int bottom) {
Left = left;
Right = right;
Top = top;
@ -218,7 +218,7 @@ namespace Greenshot.Core {
public Bitmap Apply(Bitmap sourceBitmap, out Point offsetChange) {
// Make sure the elements move according to the offset the effect made the bitmap move
offsetChange = new Point(Left, Top);
return ImageHelper.GrowCanvas(sourceBitmap, BackgroundColor, Left, Right, Top, Bottom);
return ImageHelper.ResizeCanvas(sourceBitmap, BackgroundColor, Left, Right, Top, Bottom);
}
}
}

View file

@ -1234,7 +1234,7 @@ namespace GreenshotPlugin.Core {
}
/// <summary>
/// Grow canvas with pixel to the left, right, top and bottom
/// Resize canvas with pixel to the left, right, top and bottom
/// </summary>
/// <param name="sourceBitmap"></param>
/// <param name="backgroundColor">The color to fill with, or Color.Empty to take the default depending on the pixel format</param>
@ -1243,7 +1243,7 @@ namespace GreenshotPlugin.Core {
/// <param name="top"></param>
/// <param name="bottom"></param>
/// <returns>a new bitmap with the source copied on it</returns>
public static Bitmap GrowCanvas(Bitmap sourceBitmap, Color backgroundColor, int left, int right, int top, int bottom) {
public static Bitmap ResizeCanvas(Bitmap sourceBitmap, Color backgroundColor, int left, int right, int top, int bottom) {
Bitmap newBitmap = CreateEmpty(sourceBitmap.Width + left + right, sourceBitmap.Height + top + bottom, sourceBitmap.PixelFormat, backgroundColor, sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution);
using (Graphics graphics = Graphics.FromImage(newBitmap)) {
graphics.DrawImageUnscaled(sourceBitmap, left, top);

View file

@ -26,7 +26,7 @@ namespace Greenshot.Plugin {
/// <summary>
/// The capture mode for Greenshot
/// </summary>
public enum CaptureMode { None, Region, FullScreen, ActiveWindow, Window, LastRegion, Clipboard, File, IE, Import, Video };
public enum CaptureMode { None, Region, FullScreen, ActiveWindow, Window, LastRegion, Clipboard, File, IE, Import}; //, Video };
public enum ScreenCaptureMode { Auto, FullScreen, Fixed};
/// <summary>