C2026-043-Tech-Debt_v1 - Stash 1
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -16,23 +12,14 @@ namespace Volian.Controls.Library
|
||||
|
||||
public partial class ImageItem : EditItem
|
||||
{
|
||||
#region IEditItem
|
||||
// set this for the imageitem so that other code (menuing/ribbons/treeview, etc) will continue to work. Include the MyItemInfo
|
||||
public override StepRTB MyStepRTB
|
||||
{
|
||||
get { return _MyStepRTB; }
|
||||
}
|
||||
public override int TableWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)_MyPictureBox.Width + ImageMargin;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The left edge of the Tab
|
||||
/// </summary>
|
||||
public override int ItemLeft
|
||||
#region IEditItem
|
||||
// set this for the imageitem so that other code (menuing/ribbons/treeview, etc) will continue to work. Include the MyItemInfo
|
||||
public override StepRTB MyStepRTB => _MyStepRTB;
|
||||
public override int TableWidth => (int)_MyPictureBox.Width + ImageMargin;
|
||||
/// <summary>
|
||||
/// The left edge of the Tab
|
||||
/// </summary>
|
||||
public override int ItemLeft
|
||||
{
|
||||
get { return Left + lblTab.Left; }
|
||||
set { Left = value - lblTab.Left; }
|
||||
@@ -109,11 +96,8 @@ namespace Volian.Controls.Library
|
||||
RefreshDisplay(false);
|
||||
SetExpandAndExpander(MyItemInfo);
|
||||
}
|
||||
public override void RefreshOrdinal()
|
||||
{
|
||||
TabFormat = null;
|
||||
}
|
||||
public override void HandleResize() {}
|
||||
public override void RefreshOrdinal() => TabFormat = null;
|
||||
public override void HandleResize() {}
|
||||
public override void MatchExpanded() {}
|
||||
/// <summary>
|
||||
/// Sets the focus to this ImageItem
|
||||
@@ -176,7 +160,7 @@ namespace Volian.Controls.Library
|
||||
SetWidthsAndHeights(img);
|
||||
//need this to trigger update of steptabribbonbuttons:
|
||||
// B2020-083: crash after approve of procedure when no edit window displayed - check for nulls
|
||||
if (MyStepPanel != null && MyStepPanel.MyStepTabPanel != null) MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling(true);
|
||||
if (MyStepPanel != null && MyStepPanel.MyStepTabPanel != null) MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling();
|
||||
}
|
||||
public override void ToggleEditView(E_ViewMode vwMode) {}
|
||||
public override string TabFormat
|
||||
@@ -200,15 +184,9 @@ namespace Volian.Controls.Library
|
||||
public override Point TabLocation { get { return lblTab.Location; } }
|
||||
public override Font ContentFont { get { return MyStepRTB.Font; } set { /*MyStepRTB.Font = value*/; } }
|
||||
public override float ContentTop { get { return MyPictureBox.Top; } }
|
||||
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg)
|
||||
{
|
||||
return DialogResult.OK;
|
||||
}
|
||||
public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override void PositionToEnd()
|
||||
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) => DialogResult.OK;
|
||||
public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) => false;
|
||||
public override void PositionToEnd()
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -216,15 +194,9 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
return;
|
||||
}
|
||||
public override string SelectedTextForFind
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
public override bool SpellCheckNext()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool Empty
|
||||
public override string SelectedTextForFind => null;
|
||||
public override bool SpellCheckNext() => true;
|
||||
public override bool Empty
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -249,22 +221,17 @@ namespace Volian.Controls.Library
|
||||
get { return _MyPictureBox; }
|
||||
}
|
||||
private string FileName = null;
|
||||
private static int _ImageMargin = 18;
|
||||
/// <summary>
|
||||
/// Margin between the EditItem and the ImageItem. Appears on the Right.
|
||||
/// Will allow space to draw a Change Bar on the right side of the EditItem.
|
||||
/// </summary>
|
||||
public static int ImageMargin
|
||||
{
|
||||
get { return _ImageMargin; }
|
||||
set { _ImageMargin = value; }
|
||||
}
|
||||
private bool _IsDirty = false;
|
||||
|
||||
/// <summary>
|
||||
/// Margin between the EditItem and the ImageItem. Appears on the Right.
|
||||
/// Will allow space to draw a Change Bar on the right side of the EditItem.
|
||||
/// </summary>
|
||||
public static int ImageMargin { get; set; } = 18;
|
||||
private bool _IsDirty = false;
|
||||
private int _origCfgHt = 0; // keep track if original size was stored in cfg
|
||||
private int _origCfgWd = 0;
|
||||
private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg)
|
||||
private DisplayTags _displayTags = new DisplayTags();
|
||||
//House myhouse = new House();
|
||||
|
||||
#endregion
|
||||
#region Constructors
|
||||
@@ -390,10 +357,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
InsType = insType;
|
||||
FileName = null;
|
||||
//InitializeComponent();
|
||||
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
|
||||
//MyPictureBox.Width = 100;
|
||||
//MyPictureBox.Height = 100;
|
||||
this.Width = 100 + ImageMargin;
|
||||
this.Height = 100;
|
||||
if (insType == ImageItem.E_ImageSource.File)
|
||||
@@ -409,7 +373,7 @@ namespace Volian.Controls.Library
|
||||
MyPictureBox.Image = img;
|
||||
SetWidthsAndHeights(img);
|
||||
string ext = GetImageFormatExtension(img);
|
||||
FileName = "paste." + ext;
|
||||
FileName = $"paste.{ext}";
|
||||
_IsDirty = true;
|
||||
}
|
||||
}
|
||||
@@ -455,54 +419,10 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
//public static System.Drawing.Imaging.ImageFormat GetImageFormat(this System.Drawing.Image img)
|
||||
//{
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))
|
||||
// return System.Drawing.Imaging.ImageFormat.Jpeg;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp))
|
||||
// return System.Drawing.Imaging.ImageFormat.Bmp;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))
|
||||
// return System.Drawing.Imaging.ImageFormat.Png;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Emf))
|
||||
// return System.Drawing.Imaging.ImageFormat.Emf;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Exif))
|
||||
// return System.Drawing.Imaging.ImageFormat.Exif;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))
|
||||
// return System.Drawing.Imaging.ImageFormat.Gif;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Icon))
|
||||
// return System.Drawing.Imaging.ImageFormat.Icon;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.MemoryBmp))
|
||||
// return System.Drawing.Imaging.ImageFormat.MemoryBmp;
|
||||
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Tiff))
|
||||
// return System.Drawing.Imaging.ImageFormat.Tiff;
|
||||
// else
|
||||
// return System.Drawing.Imaging.ImageFormat.Wmf;
|
||||
//}
|
||||
private static string GetImageFormatExtension(System.Drawing.Image img)
|
||||
{
|
||||
return ("jpg"); // seems that this is the only one that works.
|
||||
/*
|
||||
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))
|
||||
return "jpg";
|
||||
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp))
|
||||
return "bmp";
|
||||
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))
|
||||
return "png";
|
||||
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Emf))
|
||||
return "emf";
|
||||
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))
|
||||
return "gif";
|
||||
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Icon))
|
||||
return "ico";
|
||||
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Tiff))
|
||||
return "tif";
|
||||
else
|
||||
return "wmf";
|
||||
*/
|
||||
}
|
||||
#endregion
|
||||
#region RO_Images
|
||||
public void HandleRoImage()
|
||||
private static string GetImageFormatExtension(System.Drawing.Image img) => ("jpg"); // seems that this is the only one that works.
|
||||
#endregion
|
||||
#region RO_Images
|
||||
public void HandleRoImage()
|
||||
{
|
||||
string imageText = null;
|
||||
ProcedureInfo proc = MyItemInfo.MyProcedure;
|
||||
@@ -750,7 +670,7 @@ namespace Volian.Controls.Library
|
||||
MyPictureBox.Image = img;
|
||||
SetWidthsAndHeights(img);
|
||||
string ext = GetImageFormatExtension(img);
|
||||
FileName = "paste." + ext;
|
||||
FileName = $"paste.{ext}";
|
||||
}
|
||||
}
|
||||
void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args)
|
||||
@@ -964,7 +884,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
|
||||
string ext = ImageItem.GetImageFormatExtension(img);
|
||||
filename = "paste." + ext;
|
||||
filename = $"paste.{ext}";
|
||||
}
|
||||
else
|
||||
img = null;
|
||||
|
||||
Reference in New Issue
Block a user