Code quality fixes (NullReference checks, unused variables etc)

This commit is contained in:
RKrom 2014-04-26 00:34:06 +02:00
parent 6ab6033f85
commit ac08533727
99 changed files with 1252 additions and 1312 deletions

View file

@ -88,7 +88,7 @@ namespace Greenshot.Drawing {
stringFormat.Trimming = StringTrimming.EllipsisWord;
}
[OnDeserializedAttribute]
[OnDeserialized]
private void OnDeserialized(StreamingContext context) {
stringFormat = new StringFormat();
Init();
@ -115,8 +115,8 @@ namespace Greenshot.Drawing {
private void Init() {
CreateTextBox();
this.PropertyChanged += new PropertyChangedEventHandler(TextContainer_PropertyChanged);
this.FieldChanged += new FieldChangedEventHandler(TextContainer_FieldChanged);
PropertyChanged += TextContainer_PropertyChanged;
FieldChanged += TextContainer_FieldChanged;
}
public void FitToText() {
@ -168,8 +168,8 @@ namespace Greenshot.Drawing {
textBox.AcceptsTab = true;
textBox.AcceptsReturn = true;
textBox.DataBindings.Add("Text", this, "Text", false, DataSourceUpdateMode.OnPropertyChanged);
textBox.LostFocus += new EventHandler(textBox_LostFocus);
textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
textBox.LostFocus += textBox_LostFocus;
textBox.KeyDown += textBox_KeyDown;
textBox.BorderStyle = BorderStyle.FixedSingle;
textBox.Visible = false;
}
@ -186,7 +186,7 @@ namespace Greenshot.Drawing {
/// Makes textbox background dark if text color is very bright
/// </summary>
private void EnsureTextBoxContrast() {
Color lc = this.GetFieldValueAsColor(FieldType.LINE_COLOR);
Color lc = GetFieldValueAsColor(FieldType.LINE_COLOR);
if (lc.R > 203 && lc.G > 203 && lc.B > 203) {
textBox.BackColor = Color.FromArgb(51, 51, 51);
} else {
@ -253,10 +253,10 @@ namespace Greenshot.Drawing {
}
private void UpdateTextBoxPosition() {
textBox.Left = this.Left;
textBox.Top = this.Top;
textBox.Width = this.Width;
textBox.Height = this.Height;
textBox.Left = Left;
textBox.Top = Top;
textBox.Width = Width;
textBox.Height = Height;
}
public override void ApplyBounds(RectangleF newBounds) {
@ -294,7 +294,7 @@ namespace Greenshot.Drawing {
graphics.PixelOffsetMode = PixelOffsetMode.None;
graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
Rectangle rect = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height);
Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
if (Selected && rm == RenderMode.EDIT) {
DrawSelectionBorder(graphics, rect);
}