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

View file

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

View file

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

View file

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

View file

@ -185,10 +185,10 @@ namespace Greenshot.Core {
} }
/// <summary> /// <summary>
/// GrowEffect /// ResizeCanvasEffect
/// </summary> /// </summary>
public class GrowEffect : IEffect { public class ResizeCanvasEffect : IEffect {
public GrowEffect(int left, int right, int top, int bottom) { public ResizeCanvasEffect(int left, int right, int top, int bottom) {
Left = left; Left = left;
Right = right; Right = right;
Top = top; Top = top;
@ -218,7 +218,7 @@ namespace Greenshot.Core {
public Bitmap Apply(Bitmap sourceBitmap, out Point offsetChange) { public Bitmap Apply(Bitmap sourceBitmap, out Point offsetChange) {
// Make sure the elements move according to the offset the effect made the bitmap move // Make sure the elements move according to the offset the effect made the bitmap move
offsetChange = new Point(Left, Top); 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> /// <summary>
/// Grow canvas with pixel to the left, right, top and bottom /// Resize canvas with pixel to the left, right, top and bottom
/// </summary> /// </summary>
/// <param name="sourceBitmap"></param> /// <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> /// <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="top"></param>
/// <param name="bottom"></param> /// <param name="bottom"></param>
/// <returns>a new bitmap with the source copied on it</returns> /// <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); Bitmap newBitmap = CreateEmpty(sourceBitmap.Width + left + right, sourceBitmap.Height + top + bottom, sourceBitmap.PixelFormat, backgroundColor, sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution);
using (Graphics graphics = Graphics.FromImage(newBitmap)) { using (Graphics graphics = Graphics.FromImage(newBitmap)) {
graphics.DrawImageUnscaled(sourceBitmap, left, top); graphics.DrawImageUnscaled(sourceBitmap, left, top);

View file

@ -26,7 +26,7 @@ namespace Greenshot.Plugin {
/// <summary> /// <summary>
/// The capture mode for Greenshot /// The capture mode for Greenshot
/// </summary> /// </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}; public enum ScreenCaptureMode { Auto, FullScreen, Fixed};
/// <summary> /// <summary>