diff --git a/App/READCOM.App.Globals.dfm b/App/READCOM.App.Globals.dfm
index 004d19a..7a52add 100644
--- a/App/READCOM.App.Globals.dfm
+++ b/App/READCOM.App.Globals.dfm
@@ -68844,6 +68844,49 @@ object Globals: TGlobals
'"/>'#10' '#10' '#10'' +
'svg>'#10
Opacity = 1.000000000000000000
+ end
+ item
+ MultiResBitmap = <
+ item
+ Size = 30
+ end>
+ IconName = 'FramedPicture'
+ SVGText =
+ ''#10
+ Opacity = 1.000000000000000000
end>
Destination = <
item
@@ -69030,6 +69073,14 @@ object Globals: TGlobals
SourceRect.Bottom = 30.000000000000000000
end>
end
+ item
+ Layers = <
+ item
+ Name = 'FramedPicture'
+ SourceRect.Right = 30.000000000000000000
+ SourceRect.Bottom = 30.000000000000000000
+ end>
+ end
item
Layers = <>
end>
diff --git a/App/Views/READCOM.Views.BitmapImageStoryItem.pas b/App/Views/READCOM.Views.BitmapImageStoryItem.pas
index a342ef8..1c715e9 100644
--- a/App/Views/READCOM.Views.BitmapImageStoryItem.pas
+++ b/App/Views/READCOM.Views.BitmapImageStoryItem.pas
@@ -37,7 +37,6 @@ TBitmapImageStoryItem = class(TImageStoryItem, IBitmapImageStoryItem, IImageSt
{Clipboard}
procedure Paste(const Clipboard: IFMXExtendedClipboardService); overload; override;
procedure PasteImage(const BitmapSurface: TBitmapSurface); override;
-
{Image}
function GetImage: TImage; override;
procedure SetImage(const Value: TImage); override;
@@ -47,6 +46,7 @@ TBitmapImageStoryItem = class(TImageStoryItem, IBitmapImageStoryItem, IImageSt
procedure SetEditMode(const Value: Boolean); override;
procedure Loaded; override;
+ procedure UpdateGlyphVisibility;
public
constructor Create(AOwner: TComponent); override;
@@ -97,12 +97,19 @@ constructor TBitmapImageStoryItem.Create(AOwner: TComponent);
SendToBack;
HitTest := false;
end;
+
+ Glyph.Visible := true;
+end;
+
+procedure TBitmapImageStoryItem.UpdateGlyphVisibility;
+begin
+ Glyph.Visible := not Assigned(ImageControl.Bitmap.Image); //hide default Glyph if we have a bitmap image
end;
procedure TBitmapImageStoryItem.Loaded;
begin
inherited;
- Glyph.Visible := not Assigned(ImageControl.Bitmap.Image); //hide default Glyph if we have a bitmap image
+ UpdateGlyphVisibility;
end;
{$endregion}
@@ -127,6 +134,10 @@ procedure TBitmapImageStoryItem.Paste(const Clipboard: IFMXExtendedClipboardServ
procedure TBitmapImageStoryItem.PasteImage(const BitmapSurface: TBitmapSurface);
begin
ImageControl.Bitmap.Assign(BitmapSurface);
+ UpdateGlyphVisibility;
+
+ if FAutoSize then
+ SetSize(ImageControl.Bitmap.Width, ImageControl.Bitmap.Height); //TODO: probably not needed
end;
{$endregion}
@@ -149,6 +160,8 @@ procedure TBitmapImageStoryItem.Load(const Stream: TStream; const ContentFormat:
procedure TBitmapImageStoryItem.LoadBitmap(const Stream: TStream);
begin
ImageControl.Bitmap.LoadFromStream(Stream); //TODO: does it detect PNG and JPEG automatically?
+ UpdateGlyphVisibility;
+
if FAutoSize then
SetSize(ImageControl.Bitmap.Width, ImageControl.Bitmap.Height); //TODO: probably not needed
end;
@@ -167,6 +180,10 @@ function TBitmapImageStoryItem.GetImage: TImage;
procedure TBitmapImageStoryItem.SetImage(const Value: TImage);
begin
ImageControl.Bitmap.Assign(Value.Bitmap); //can't assign TImage directly
+ UpdateGlyphVisibility;
+
+ if FAutoSize then
+ SetSize(ImageControl.Bitmap.Width, ImageControl.Bitmap.Height); //TODO: probably not needed
end;
{$endregion}
diff --git a/App/Views/READCOM.Views.Main.fmx b/App/Views/READCOM.Views.Main.fmx
index c64cc38..87a9a6a 100644
--- a/App/Views/READCOM.Views.Main.fmx
+++ b/App/Views/READCOM.Views.Main.fmx
@@ -127,6 +127,10 @@ object MainForm: TMainForm
inherited actionHelp: TAction
ImageIndex = 16
end
+ inherited actionAddBitmapImageStoryItem: TAction
+ OnExecute = HUDactionAddBitmapImageStoryItemExecute
+ ImageIndex = 23
+ end
end
inherited MultiViewFrameStand: TFrameStand
Left = 432
diff --git a/App/Views/READCOM.Views.Main.pas b/App/Views/READCOM.Views.Main.pas
index a92439c..e5d4141 100644
--- a/App/Views/READCOM.Views.Main.pas
+++ b/App/Views/READCOM.Views.Main.pas
@@ -16,7 +16,7 @@ interface
FMX.Layouts,
READCOM.Views.AudioStoryItem,
SubjectStand,
- READCOM.App.Globals;
+ READCOM.App.Globals, System.Actions, FMX.ActnList;
type
@@ -25,25 +25,28 @@ TMainForm = class(TForm, IStory)
ZoomFrame: TZoomFrame;
StoryTimer: TTimer;
procedure FormCreate(Sender: TObject);
- procedure FormSaveState(Sender: TObject);
procedure FormDestroy(Sender: TObject);
+
+ procedure FormSaveState(Sender: TObject);
+
+ procedure FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
+
procedure HUDactionLoadExecute(Sender: TObject);
procedure HUDactionSaveExecute(Sender: TObject);
procedure HUDactionNewExecute(Sender: TObject);
procedure HUDactionHomeExecute(Sender: TObject);
procedure HUDactionPreviousExecute(Sender: TObject);
procedure HUDactionNextExecute(Sender: TObject);
- procedure FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
+ procedure HUDactionAddBitmapImageStoryItemExecute(Sender: TObject);
+ procedure HUDactionAddTextStoryItemExecute(Sender: TObject);
procedure HUDactionDeleteExecute(Sender: TObject);
procedure HUDactionCopyExecute(Sender: TObject);
procedure HUDactionPasteExecute(Sender: TObject);
procedure HUDactionFlipHorizontallyExecute(Sender: TObject);
procedure HUDactionFlipVerticallyExecute(Sender: TObject);
- procedure HUDactionAddTextStoryItemExecute(Sender: TObject);
+
procedure FormResize(Sender: TObject);
procedure StoryTimerTimer(Sender: TObject);
- private
- function GetStructureView: TStructureView;
protected
FTimerStarted: Boolean;
@@ -84,8 +87,8 @@ TMainForm = class(TForm, IStory)
procedure SetStoryMode(const Value: TStoryMode);
{StructureView}
+ function GetStructureView: TStructureView;
procedure StructureViewSelection(Sender: TObject; const Selection: TObject);
- property StructureView: TStructureView read GetStructureView stored false;
procedure UpdateStructureView;
procedure RootStoryItemViewResized(Sender: TObject);
@@ -95,7 +98,10 @@ TMainForm = class(TForm, IStory)
procedure HUDTargetsVisibleChanged(Sender: TObject; const Value: Boolean);
procedure HUDUseStoryTimerChanged(Sender: TObject; const Value: Boolean);
+ procedure AddChildStoryItem(const TheStoryItemClass: TStoryItemClass; const TheName: String);
+
public
+ property StructureView: TStructureView read GetStructureView stored false;
procedure ZoomTo(const StoryItem: IStoryItem = nil); //ZoomTo(nil) zooms to all content
published
@@ -117,7 +123,8 @@ implementation
Zoomicon.Helpers.RTL.ClassListHelpers, //for TClassList.Create(TClassArray)
Zoomicon.Helpers.FMX.Controls.ControlHelpers, //for TControl.FlipHorizontally, TControl.FlipVertically
READCOM.Views.PanelStoryItem,
- READCOM.Views.TextStoryItem; //TODO: remove
+ READCOM.Views.BitmapImageStoryItem,
+ READCOM.Views.TextStoryItem;
{$R *.fmx}
@@ -502,15 +509,25 @@ procedure TMainForm.HUDEditModeChanged(Sender: TObject; const Value: Boolean);
StoryMode := TStoryMode.InteractiveStoryMode; //TODO: should remember previous mode to restore or make EditMode a separate situation
end;
+procedure TMainForm.HUDactionAddBitmapImageStoryItemExecute(Sender: TObject);
+begin
+ //HUD.actionAddBitmapImageStoryItemExecute(Sender);
+ AddChildStoryItem(TBitmapImageStoryItem, 'BitmapImageStoryItem');
+end;
+
procedure TMainForm.HUDactionAddTextStoryItemExecute(Sender: TObject);
begin
//HUD.actionAddTextStoryItemExecute(Sender);
+ AddChildStoryItem(TTextStoryItem, 'TextStoryItem');
+end;
+procedure TMainForm.AddChildStoryItem(const TheStoryItemClass: TStoryItemClass; const TheName: String);
+begin
if not Assigned(ActiveStoryItem) then exit;
var OwnerAndParent := ActiveStoryItem.View;
- var StoryItem := TTextStoryItem.Create(OwnerAndParent, 'TextStoryItem'); //TODO: should have separate actions for adding such default items (for prototyping) for various StoryItem classes
+ var StoryItem := TheStoryItemClass.Create(OwnerAndParent, TheName); //TODO: should have separate actions for adding such default items (for prototyping) for various StoryItem classes
with StoryItem do
begin
diff --git a/App/Views/READCOM.Views.Menu.HUD.fmx b/App/Views/READCOM.Views.Menu.HUD.fmx
index cbab17c..a3b029f 100644
--- a/App/Views/READCOM.Views.Menu.HUD.fmx
+++ b/App/Views/READCOM.Views.Menu.HUD.fmx
@@ -267,11 +267,33 @@ object StoryHUD: TStoryHUD
Justify = Left
JustifyLastLine = Left
FlowDirection = LeftToRight
+ object btnAddBitmapImageStoryItem: TSpeedButton
+ Action = actionAddBitmapImageStoryItem
+ Anchors = [akTop, akRight]
+ Enabled = True
+ Hint =
+ 'Add Bitmap Image'#13#13'Adds a BitmapImageStoryItem placeholder into t' +
+ 'he edited StoryItem'
+ Images = Globals.SVGIconImageList
+ ImageIndex = 23
+ Margins.Left = 3.000000000000000000
+ Margins.Top = 3.000000000000000000
+ Margins.Right = 3.000000000000000000
+ Margins.Bottom = 6.000000000000000000
+ Position.X = 3.000000000000000000
+ Position.Y = 3.000000000000000000
+ Size.Width = 41.000000000000000000
+ Size.Height = 33.000000000000000000
+ Size.PlatformDefault = False
+ StyleLookup = 'actiontoolbutton'
+ end
object btnAddTextStoryItem: TSpeedButton
Action = actionAddTextStoryItem
Anchors = [akTop, akRight]
Enabled = True
- Hint = 'Add Text'#13#13'Adds a TextStoryItem child into the edited StoryItem'
+ Hint =
+ 'Add Text'#13#13'Adds a TextStoryItem placeholder into the edited Story' +
+ 'Item'
Images = Globals.SVGIconImageList
ImageIndex = 21
Margins.Left = 3.000000000000000000
@@ -279,7 +301,7 @@ object StoryHUD: TStoryHUD
Margins.Right = 3.000000000000000000
Margins.Bottom = 6.000000000000000000
Position.X = 3.000000000000000000
- Position.Y = 3.000000000000000000
+ Position.Y = 45.000000000000000000
Size.Width = 41.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
@@ -289,7 +311,7 @@ object StoryHUD: TStoryHUD
Action = actionDelete
Anchors = [akTop, akRight]
Enabled = True
- Hint = 'Delete'#13#13'Removes the edited StoryItem'
+ Hint = 'Delete'#13#13'Delete the edited StoryItem'
Images = Globals.SVGIconImageList
ImageIndex = 8
Margins.Left = 3.000000000000000000
@@ -297,7 +319,7 @@ object StoryHUD: TStoryHUD
Margins.Right = 3.000000000000000000
Margins.Bottom = 3.000000000000000000
Position.X = 3.000000000000000000
- Position.Y = 45.000000000000000000
+ Position.Y = 87.000000000000000000
Size.Width = 41.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
@@ -307,7 +329,7 @@ object StoryHUD: TStoryHUD
Action = actionCopy
Anchors = [akTop, akRight]
Enabled = True
- Hint = 'Copy'#13#13'Copies the edited StoryItem to the system clipboard'
+ Hint = 'Copy'#13#13'Copy the edited StoryItem to the Clipboard'
Images = Globals.SVGIconImageList
ImageIndex = 17
Margins.Left = 3.000000000000000000
@@ -315,7 +337,7 @@ object StoryHUD: TStoryHUD
Margins.Right = 3.000000000000000000
Margins.Bottom = 3.000000000000000000
Position.X = 3.000000000000000000
- Position.Y = 84.000000000000000000
+ Position.Y = 126.000000000000000000
Size.Width = 41.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
@@ -326,8 +348,8 @@ object StoryHUD: TStoryHUD
Anchors = [akTop, akRight]
Enabled = True
Hint =
- 'Paste'#13#13'Pastes a StoryItem from the system clipboard into the edi' +
- 'ted StoryItem as a new child'
+ 'Paste'#13#13'Paste content from the Clipboard into the edited StoryIte' +
+ 'm'
Images = Globals.SVGIconImageList
ImageIndex = 18
Margins.Left = 3.000000000000000000
@@ -335,7 +357,7 @@ object StoryHUD: TStoryHUD
Margins.Right = 3.000000000000000000
Margins.Bottom = 6.000000000000000000
Position.X = 3.000000000000000000
- Position.Y = 123.000000000000000000
+ Position.Y = 165.000000000000000000
Size.Width = 41.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
@@ -351,7 +373,7 @@ object StoryHUD: TStoryHUD
Margins.Right = 3.000000000000000000
Margins.Bottom = 3.000000000000000000
Position.X = 3.000000000000000000
- Position.Y = 165.000000000000000000
+ Position.Y = 207.000000000000000000
Size.Width = 41.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
@@ -359,7 +381,7 @@ object StoryHUD: TStoryHUD
end
object btnFlipVertically: TSpeedButton
Anchors = [akTop, akRight]
- Hint = 'Flip Vertically'#13#13'Mirrors the edited StoryItem vertically'
+ Hint = 'Flip Vertically'#13#13'Flips the edited StoryItem vertically'
Images = Globals.SVGIconImageList
ImageIndex = 20
Margins.Left = 3.000000000000000000
@@ -367,7 +389,7 @@ object StoryHUD: TStoryHUD
Margins.Right = 3.000000000000000000
Margins.Bottom = 3.000000000000000000
Position.X = 3.000000000000000000
- Position.Y = 204.000000000000000000
+ Position.Y = 246.000000000000000000
Size.Width = 41.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
@@ -487,6 +509,12 @@ object StoryHUD: TStoryHUD
OnExecute = actionHelpExecute
ImageIndex = 16
end
+ object actionAddBitmapImageStoryItem: TAction
+ Category = 'Edit'
+ Text = 'Add BitmapImageStoryItem'
+ ImageIndex = 23
+ ImageIndex = 23
+ end
end
object MultiViewFrameStand: TFrameStand
AnimationShow = 'OnShow*'
diff --git a/App/Views/READCOM.Views.Menu.HUD.pas b/App/Views/READCOM.Views.Menu.HUD.pas
index e1134c1..628dfe6 100644
--- a/App/Views/READCOM.Views.Menu.HUD.pas
+++ b/App/Views/READCOM.Views.Menu.HUD.pas
@@ -19,7 +19,6 @@ interface
TUseStoryTimerChangedEvent = procedure (Sender: TObject; const Value: Boolean) of object;
TStoryHUD = class(TFrame)
- btnAddTextStoryItem: TSpeedButton;
btnPrevious: TSpeedButton;
btnToggleEditMode: TSpeedButton;
BtnMenu: TSpeedButton;
@@ -52,11 +51,16 @@ TStoryHUD = class(TFrame)
btnAbout: TSpeedButton;
actionCopy: TAction;
actionPaste: TAction;
- btnCopy: TSpeedButton;
- btnPaste: TSpeedButton;
actionDelete: TAction;
- btnDelete: TSpeedButton;
btnToggleUseStoryTimer: TSpeedButton;
+ actionAddBitmapImageStoryItem: TAction;
+ btnAddTextStoryItem: TSpeedButton;
+ btnCopy: TSpeedButton;
+ btnDelete: TSpeedButton;
+ btnFlipHorizontally: TSpeedButton;
+ btnFlipVertically: TSpeedButton;
+ btnPaste: TSpeedButton;
+ btnAddBitmapImageStoryItem: TSpeedButton;
procedure actionAboutExecute(Sender: TObject);
procedure actionMenuExecute(Sender: TObject);
procedure actionHelpExecute(Sender: TObject);