Skip to content

Commit

Permalink
Merge pull request #1269 from sillsdev/ImageGalleryControl-api-fixes
Browse files Browse the repository at this point in the history
ImageGalleryControl API corrections (#1269)
  • Loading branch information
tombogle authored Jul 3, 2023
2 parents a1e39ec + 6b41e3a commit c723e7c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed

- [SIL.Media] Changed the FrameRate reported in VideoInfo from FrameRate to AvgFrameRate.
- [SIL.Windows.Forms] Fixed spelling error in ImageGalleryControl, renaming SetIntialSearchTerm to SetInitialSearchTerm.

### Fixed

- [SIL.Core] Make RetryUtility retry for exceptions that are subclasses of the ones listed to try. For example, by default (IOException) it will now retry for FileNotFoundException.

### Removed
- [SIL.Windows.Forms] ImageGalleryControl.InSomeoneElesesDesignMode (seemingly unused and misspelled)

## [12.0.1] - 2023-05-26

### Fixed
Expand Down
29 changes: 24 additions & 5 deletions SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public partial class ImageGalleryControl : UserControl, IImageToolboxControl
{
private ImageCollectionManager _imageCollectionManager;
private PalasoImage _previousImage;
public bool InSomeoneElesesDesignMode;

public ImageGalleryControl()
{
Expand Down Expand Up @@ -55,11 +54,21 @@ public ImageGalleryControl()
/// use if the calling app already has some notion of what the user might be looking for (e.g. the definition in a dictionary program)
/// </summary>
/// <param name="searchTerm"></param>
public void SetIntialSearchTerm(string searchTerm)
public void SetInitialSearchTerm(string searchTerm)
{
_searchTermsBox.Text = searchTerm;
}

/// <summary>
/// use if the calling app already has some notion of what the user might be looking for (e.g. the definition in a dictionary program)
/// </summary>
/// <param name="searchTerm"></param>
[Obsolete("Use SetInitialSearchTerm (spelling corrected)")]
public void SetIntialSearchTerm(string searchTerm)
{
SetInitialSearchTerm(searchTerm);
}

/// <summary>
/// Gets or sets the language used in searching for an image by words.
/// </summary>
Expand Down Expand Up @@ -99,9 +108,19 @@ private void _searchButton_Click(object sender, EventArgs e)
_messageLabel.Visible = false;
_downloadInstallerLink.Visible = false;
_thumbnailViewer.LoadItems(results);
var fmt = "Found {0} images".Localize("ImageToolbox.MatchingImages", "The {0} will be replaced by the number of matching images");
var fmt = results.Count == 1 ?
"Found 1 image".Localize("ImageToolbox.MatchingImageSingle") :
"Found {0} images".Localize("ImageToolbox.MatchingImages", "The {0} will be replaced by the number of matching images");
if (!foundExactMatches)
fmt = "Found {0} images with names close to \u201C{1}\u201D".Localize("ImageToolbox.AlmostMatchingImages", "The {0} will be replaced by the number of images found. The {1} will be replaced with the search string.");
{
fmt = results.Count == 1 ?
"Found 1 image with a name close to \u201C{1}\u201D".Localize("ImageToolbox.AlmostMatchingImageSingle",
"The {1} will be replaced with the search string.") :
"Found {0} images with names close to \u201C{1}\u201D".Localize(
"ImageToolbox.AlmostMatchingImages",
"The {0} will be replaced by the number of images found. The {1} will be replaced with the search string.");
}

_searchResultStats.Text = string.Format(fmt, results.Count, _searchTermsBox.Text);
_searchResultStats.ForeColor = foundExactMatches ? Color.Black : Color.FromArgb(0x34, 0x65, 0xA4); //#3465A4
_searchResultStats.Font = new Font("Segoe UI", 9F, foundExactMatches ? FontStyle.Regular : FontStyle.Bold);
Expand Down Expand Up @@ -226,7 +245,7 @@ private void ArtOfReadingChooser_Load(object sender, EventArgs e)
_collectionDropDown.Visible = true;
_collectionDropDown.Text =
"Galleries".Localize("ImageToolbox.Galleries");
if(ImageToolboxSettings.Default.DisabledImageCollections == null)
if (ImageToolboxSettings.Default.DisabledImageCollections == null)
{
ImageToolboxSettings.Default.DisabledImageCollections = new StringCollection();
}
Expand Down

0 comments on commit c723e7c

Please sign in to comment.