Skip to content

Commit ce3467f

Browse files
birbilis@zoomicon.combirbilis@zoomicon.com
birbilis@zoomicon.com
authored and
birbilis@zoomicon.com
committed
Added .icns icon file for MacOS-X, Added .ico with white background color, TextStorytItem not getting mouse events when not Editable so that it can be dragged, Allow to paste SVG markup directly as new ImageStoryItem
1 parent 04da180 commit ce3467f

8 files changed

+504
-25
lines changed

App/READCOM_App.deployproj

Lines changed: 295 additions & 22 deletions
Large diffs are not rendered by default.

App/READCOM_App.dproj

Lines changed: 193 additions & 2 deletions
Large diffs are not rendered by default.

App/READCOM_App.res

-1.45 MB
Binary file not shown.

App/READCOM_App_Icns.icns

35.6 KB
Binary file not shown.

App/READCOM_App_Icon.ico

1.44 MB
Binary file not shown.

App/Views/READCOM.Views.ImageStoryItem.pas

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ function TImageStoryItem.LoadBitmap(const Stream: TStream): TObject;
270270

271271
function TImageStoryItem.Load(const Clipboard: IFMXExtendedClipboardService; const CreateNew: Boolean = false): TObject;
272272
begin
273+
//check for Bitmap image
273274
if Clipboard.HasImage then
274275
begin
275276
var BitmapSurface := Clipboard.GetImage;
@@ -279,6 +280,17 @@ function TImageStoryItem.Load(const Clipboard: IFMXExtendedClipboardService; con
279280
finally
280281
FreeAndNil(BitmapSurface); //must release the TBitmapSurface to not have memory leak
281282
end;
283+
end
284+
285+
//check for SVG markup
286+
else if Clipboard.HasText then
287+
begin
288+
var LText := TrimLeft(Clipboard.GetText); //Trimming since we may have pasted some SVG markup with extra spaces before and after
289+
if LText.StartsWith('<svg ') and LText.EndsWith('</svg>') then
290+
begin
291+
SVGText := LText;
292+
Exit(Self);
293+
end;
282294
end;
283295

284296
result := inherited; //fallback to ancestor implementation

App/Views/READCOM.Views.StoryItem.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,9 +1343,11 @@ procedure TStoryItem.Paste(const Clipboard: IFMXExtendedClipboardService);
13431343
//Check clipboard contents format
13441344
if Clipboard.HasText then
13451345
begin
1346-
var LText := TrimLeft(Clipboard.GetText); //Left-trimming since we may have pasted an indented object from a .readcom file
1346+
var LText := Trim(Clipboard.GetText); //Trimming since we may have pasted an indented object from a .readcom file or some SVG markup with extra spaces before and after
13471347
if LText.StartsWith('object ') then //ignore if not Delphi serialization format (its text-based form), handle other text at descendents like TextStoryItem //TODO: add method to check if text contains object
13481348
FileExt := '.readcom'
1349+
else if LText.StartsWith('<svg ') and LText.EndsWith('</svg>') then
1350+
FileExt := '.svg'
13491351
else
13501352
FileExt := '.txt'
13511353
end

App/Views/READCOM.Views.TextStoryItem.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ function TTextStoryItem.Load(const Clipboard: IFMXExtendedClipboardService; cons
242242
procedure TTextStoryItem.UpdateMemoReadOnly;
243243
begin
244244
Memo.ReadOnly := not (IsEditable or IsEditMode);
245+
Memo.HitTest := not Memo.ReadOnly; //TODO: should maybe have a mode that swiches between Editable, Selectable and Read-Only/Inactive (so that it's draggable)
245246
end;
246247

247248
{$endregion}

0 commit comments

Comments
 (0)