Thumbnail info line - displaying shapes in v2

Post Reply
David Grundy
Posts: 241
Joined: 13 May 07 16:40
Location: Hong Kong

Thumbnail info line - displaying shapes in v2

Post by David Grundy » 31 Jan 14 16:33

In v2, the display of shapes in the thumbnail info seems to have changed from v1. Specifically, shapes which were previously displayed in full now have the bottom chopped off.

For example
Missing bottom.JPG
Missing bottom.JPG (13.18 KiB) Viewed 1564 times
These shapes displayed in v1 as partially filled octagons, but now the bottom is missing. The clearest example is that the 3rd image (rated as 2 stars) should be symmetrical top-to-bottom

Does this code need an update to display correctly in v2?

Code: Select all

%code
// 2014-01-05 v7e Take out VUTs
// 2013-08-03 v7d Add the version count to the start of the line
// 2013-07-31 v7c Change colour of Version triangles to agree with the Main version VUT colour
// 2013-07-29 v7b Show VUTs (add Camera, HDR, BW, XNoFunction)
// 2013-07-27 v7 Show VUTs (implemented using the Custom Input Fields)
// 2013-07-27 v6d Replace stars with a part-filled square
// 2013-07-13 v5b, modified colours
// 2013-06-30 v5a, split version indicator from rating stars
// 2013-06 early versions based on code by Hert

// Note to self: Colours seem to be specified as ARGB Hex

var
  ACatItem: TCatalogItem;
  AVersionColor: String;
  AVersionShape: String;
  ARatingColor: String;
  ASetRatingColor: String;
  ANumVersions: Integer;
  i: Integer;
begin
  result := '';

  ARatingColor := '#FFCCCC00'; //#### Yellow colour for rating shapes
  ASetRatingColor := '" pathfillcolor="' + ARatingColor + '" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '">';

  ARatingShape1 := 'M 0,0 '; //#### First part of rating shape
  ARatingShape2 := ' L 5,5 L 0,5 L 0,0 Z'; //#### Second part of rating shape

  AVersionShape := 'M 0,0 L 1,1 L 0,1 L 0,0 Z'; //#### Triangle shape for the version indicator

  ACatItem := TCatalogItem.Create(nil);
  if Catalog.FindImageCombined (ImageItem, ACatItem, False, vptNone) then
  begin

// Number of versions

    ANumVersions := ACatItem.VersionCount+1;
    if ANumVersions = 1 then
      result := result + '<font color="#FF0000FF">';
    else
      result := result + '<font color="#FFFFFFFF">';
    result := result + IntToStr(ANumVersions);
    result := result + '</font>';

// Show a shape coloured to indicated versions

    AVersionColor := '#FF0000CC'; //#### Blue colour for Solo (unVersioned) files
    if ACatItem.IsVersion then
      AVersionColor := '#FFCC0000'; //#### Red colour for non-Main Versions
    if (ACatItem._MainVersionGUID = ACatItem.GUID) and (ACatItem.VersionCount > 0) then
      AVersionColor := '#FF00CC00'; //#### Green colour for Main Versions

    result := result + '<font color="'+ AVersionColor +'"><ind y="2">';
    result := result + '<img size="22" path="' + AVersionShape + '" pathfillcolor="' + AVersionColor + '">';
    result := result + ''; //####This line adds extra space after the version symbol
    result := result + '</ind></font>';


// Show a shape to indicate the rating
    result := result + '<font color="'+ ARatingColor +'"><ind y="2">';
    result := result + '<img size="22" path="';
    Case ACatItem.Rating of
    //#### Specify the shape to indicate the number of stars
      0: result := result + ' M 0,4 L 0,0 L -4,0 L 0,0 L 0,-4 L 0,0 L 4,0 L 0,0 L 0,4 Z ';
      1: result := result + ' M 0,4 L -3,3 L -4,0 L 0,0 L 0,-4 L 0,0 L 4,0 L 0,0 L 0,4 Z ';
      2: result := result + ' M 0,4 L -3,3 L -4,0 L -3,-3 L 0,-4 L 0,0 L 4,0 L 0,0 L 0,4 Z ';
      3: result := result + ' M 0,4 L -3,3 L -4,0 L -3,-3 L 0,-4 L 3,-3 L 4,0 L 0,0 L 0,4 Z ';
      4: result := result + ' M 0,4 L -3,3 L -4,0 L -3,-3 L 0,-4 L 3,-3 L 4,0 L 3,3 L 0,4 Z ';
      5: result := result + ' M 0,4 L -4,4 L -4,0 L -4,-4 L 0,-4 L 4,-4 L 4,0 L 4,4 L 0,4 Z';
    end;
    result := result + ASetRatingColor;
    result := result + ' '; //This line adds extra space
    result := result + '</ind></font>';

  end;
  ACatItem.Free;
end;
%/code

... David

Hert
Posts: 5806
Joined: 13 Sep 03 7:24

Re: Thumbnail info line - displaying shapes in v2

Post by Hert » 03 Feb 14 13:59

V2 has improved precision when painting custom thumb lines.

You're using vertical (y) indenting. Just remove that

Code: Select all

%code
// 2014-01-05 v7e Take out VUTs
// 2013-08-03 v7d Add the version count to the start of the line
// 2013-07-31 v7c Change colour of Version triangles to agree with the Main version VUT colour
// 2013-07-29 v7b Show VUTs (add Camera, HDR, BW, XNoFunction)
// 2013-07-27 v7 Show VUTs (implemented using the Custom Input Fields)
// 2013-07-27 v6d Replace stars with a part-filled square
// 2013-07-13 v5b, modified colours
// 2013-06-30 v5a, split version indicator from rating stars
// 2013-06 early versions based on code by Hert

// Note to self: Colours seem to be specified as ARGB Hex

var
  ACatItem: TCatalogItem;
  AVersionColor: String;
  AVersionShape: String;
  ARatingColor: String;
  ASetRatingColor: String;
  ANumVersions: Integer;
  i: Integer;
begin
  result := '';

  ARatingColor := '#FFCCCC00'; //#### Yellow colour for rating shapes
  ASetRatingColor := '" pathfillcolor="' + ARatingColor + '" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '">';

  ARatingShape1 := 'M 0,0 '; //#### First part of rating shape
  ARatingShape2 := ' L 5,5 L 0,5 L 0,0 Z'; //#### Second part of rating shape

  AVersionShape := 'M 0,0 L 1,1 L 0,1 L 0,0 Z'; //#### Triangle shape for the version indicator

  ACatItem := TCatalogItem.Create(nil);
  if Catalog.FindImageCombined (ImageItem, ACatItem, False, vptNone) then
  begin

// Number of versions

    ANumVersions := ACatItem.VersionCount+1;
    if ANumVersions = 1 then
      result := result + '<font color="#FF0000FF">';
    else
      result := result + '<font color="#FFFFFFFF">';
    result := result + IntToStr(ANumVersions);
    result := result + '</font>';

// Show a shape coloured to indicated versions

    AVersionColor := '#FF0000CC'; //#### Blue colour for Solo (unVersioned) files
    if ACatItem.IsVersion then
      AVersionColor := '#FFCC0000'; //#### Red colour for non-Main Versions
    if (ACatItem._MainVersionGUID = ACatItem.GUID) and (ACatItem.VersionCount > 0) then
      AVersionColor := '#FF00CC00'; //#### Green colour for Main Versions

    result := result + '<font color="'+ AVersionColor +'">';
    result := result + '<img size="22" path="' + AVersionShape + '" pathfillcolor="' + AVersionColor + '">';
    result := result + ''; //####This line adds extra space after the version symbol
    result := result + '</font>';


// Show a shape to indicate the rating
    result := result + '<font color="'+ ARatingColor +'">';
    result := result + '<img size="22" path="';
    Case ACatItem.Rating of
    //#### Specify the shape to indicate the number of stars
      0: result := result + ' M 0,4 L 0,0 L -4,0 L 0,0 L 0,-4 L 0,0 L 4,0 L 0,0 L 0,4 Z ';
      1: result := result + ' M 0,4 L -3,3 L -4,0 L 0,0 L 0,-4 L 0,0 L 4,0 L 0,0 L 0,4 Z ';
      2: result := result + ' M 0,4 L -3,3 L -4,0 L -3,-3 L 0,-4 L 0,0 L 4,0 L 0,0 L 0,4 Z ';
      3: result := result + ' M 0,4 L -3,3 L -4,0 L -3,-3 L 0,-4 L 3,-3 L 4,0 L 0,0 L 0,4 Z ';
      4: result := result + ' M 0,4 L -3,3 L -4,0 L -3,-3 L 0,-4 L 3,-3 L 4,0 L 3,3 L 0,4 Z ';
      5: result := result + ' M 0,4 L -4,4 L -4,0 L -4,-4 L 0,-4 L 4,-4 L 4,0 L 4,4 L 0,4 Z';
    end;
    result := result + ASetRatingColor;
    result := result + ' '; //This line adds extra space
    result := result + '</font>';

  end;
  ACatItem.Free;
end;
%/code
Hert
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

David Grundy
Posts: 241
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Thumbnail info line - displaying shapes in v2

Post by David Grundy » 03 Feb 14 14:55

Thanks Hert, that works.
(Easy when you know how.) :)

Post Reply