Skip to content

Commit

Permalink
Bug Fixes, Restore TimerUpdateScreen, Create Menu on Presentation Form
Browse files Browse the repository at this point in the history
  • Loading branch information
reckel-jm committed Mar 28, 2024
1 parent 1d21cdb commit 82dcf5a
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 8 deletions.
17 changes: 17 additions & 0 deletions src/forms/present.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ object frmPresent: TfrmPresent
OnKeyDown = FormKeyDown
OnResize = FormResize
OnShow = FormShow
PopupMenu = PresentationMenu
Position = poScreenCenter
LCLVersion = '3.2.0.0'
WindowState = wsMaximized
Expand All @@ -33,4 +34,20 @@ object frmPresent: TfrmPresent
OnClick = imageShowerClick
Proportional = True
end
object PresentationMenu: TPopupMenu
Left = 191
Top = 85
object MenuItemToggleFullScreen: TMenuItem
Caption = 'Fullscreen'
RadioItem = True
OnClick = MenuItemToggleFullScreenClick
end
object MenuItemMoveToScreen: TMenuItem
Caption = 'Move to other screen'
end
object MenuItemQuitPresentation: TMenuItem
Caption = 'Quit Presentation'
OnClick = MenuItemQuitPresentationClick
end
end
end
5 changes: 4 additions & 1 deletion src/forms/present.lrj
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{"version":1,"strings":[
{"hash":13658014,"name":"tfrmpresent.caption","sourcebytes":[80,114,101,115,101,110,116,97,116,105,111,110],"value":"Presentation"}
{"hash":13658014,"name":"tfrmpresent.caption","sourcebytes":[80,114,101,115,101,110,116,97,116,105,111,110],"value":"Presentation"},
{"hash":60708750,"name":"tfrmpresent.menuitemtogglefullscreen.caption","sourcebytes":[70,117,108,108,115,99,114,101,101,110],"value":"Fullscreen"},
{"hash":104327086,"name":"tfrmpresent.menuitemmovetoscreen.caption","sourcebytes":[77,111,118,101,32,116,111,32,111,116,104,101,114,32,115,99,114,101,101,110],"value":"Move to other screen"},
{"hash":8955838,"name":"tfrmpresent.menuitemquitpresentation.caption","sourcebytes":[81,117,105,116,32,80,114,101,115,101,110,116,97,116,105,111,110],"value":"Quit Presentation"}
]}
20 changes: 19 additions & 1 deletion src/forms/present.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface
uses
Classes, LCLType, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Types, Themes, LCLTranslator, LCLIntf, ExtCtrls, Lyrics,
IntfGraphics,
IntfGraphics, Menus,
fpImage, StrUtils, Slides,
Math,
PresentationCanvas, bgrabitmap, presentationcontroller;
Expand All @@ -21,13 +21,19 @@ THackWinControl = class(TWinControl);
TfrmPresent = class(TForm)
imageShower: TImage;
ManipulatedBitmap: TBitmap;
MenuItemQuitPresentation: TMenuItem;
MenuItemMoveToScreen: TMenuItem;
MenuItemToggleFullScreen: TMenuItem;
PresentationMenu: TPopupMenu;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure imageShowerClick(Sender: TObject);
procedure MenuItemQuitPresentationClick(Sender: TObject);
procedure MenuItemToggleFullScreenClick(Sender: TObject);
procedure showItem(index: Integer);
procedure SwitchFullScreen;
procedure SwitchFullScreen(WantFullScreen: Boolean);
Expand Down Expand Up @@ -136,6 +142,16 @@ procedure TfrmPresent.imageShowerClick(Sender: TObject);
self.GoNext;
end;

procedure TfrmPresent.MenuItemQuitPresentationClick(Sender: TObject);
begin
Self.Hide;
end;

procedure TfrmPresent.MenuItemToggleFullScreenClick(Sender: TObject);
begin
Self.SwitchFullscreen;
end;

procedure TfrmPresent.showItem(index: Integer);
begin
cur := index;
Expand Down Expand Up @@ -221,6 +237,7 @@ procedure TfrmPresent.SwitchFullScreen;
Fullscreen := False;
end;
{$endif}
MenuItemToggleFullScreen.Checked:=Fullscreen;
end;

procedure TfrmPresent.SwitchFullScreen(WantFullScreen: Boolean);
Expand Down Expand Up @@ -260,6 +277,7 @@ procedure TfrmPresent.SwitchFullScreen(WantFullScreen: Boolean);
Fullscreen := False;
end;
{$endif}
MenuItemToggleFullScreen.Checked:=Fullscreen;
end;

procedure TfrmPresent.Refresh;
Expand Down
5 changes: 5 additions & 0 deletions src/forms/songselection.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,9 @@ object frmSongs: TfrmSongs
OnClick = itemOpenInEditorClick
end
end
object TimerUpdateScreen: TTimer
OnTimer = TimerUpdateScreenTimer
Left = 399
Top = 147
end
end
38 changes: 34 additions & 4 deletions src/forms/songselection.pas
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ TfrmSongs = class(TForm, IPresentationController)
SongPopupMenu: TPopupMenu;
SaveDialog: TSaveDialog;
SplitterContentImage: TSplitter;
TimerUpdateScreen: TTimer;
procedure btnAddClick(Sender: TObject);
procedure btnClearClick(Sender: TObject);
procedure btnDownClick(Sender: TObject);
Expand Down Expand Up @@ -1106,10 +1107,17 @@ procedure TfrmSongs.SlideTextListBoxDrawItem(Control: TWinControl;
var
TextColor: TColor;
ABitmap:TBgraBitmap;
{Determines whether the part is at the edge (the first or last part of a song }
Edge: Boolean;
begin
Edge := False;
if Index > SlideTextListBox.Count then Exit;

ABitmap := TBgraBitmap.Create(ARect.Width, ARect.Height, clAppWorkspace);

ABitmap.CanvasBGRA.TextStyle.Wordbreak:=True;
ABitmap.CanvasBGRA.TextStyle.SingleLine:=False;

ABitmap.FontHeight:=Round(Screen.SystemFont.Height/0.75);
ABitmap.FontName:=Screen.SystemFont.Name;
ABitmap.FontQuality:=fqSystem;
Expand All @@ -1123,25 +1131,45 @@ procedure TfrmSongs.SlideTextListBoxDrawItem(Control: TWinControl;
TextColor := clBtnText;
end;

if (Index = 0) or
(frmPresent.SlideList.Items[Index].Song <> frmPresent.SlideList.Items[Index-1].Song) then
begin
ABitmap.DrawLine(1,1,ARect.Width,1,clBlack,true);
Edge := True;
end;

if frmPresent.SlideList.Items[Index].SlideType = TitleSlide then
begin
ABitmap.FontStyle+=[fsBold];
ABitmap.DrawLine(1,1,ARect.Width,1,clBlack,true);
end;

ABitmap.DrawLine(1,1,1,ARect.Height-1,clBlack,True);
ABitmap.DrawLine(ARect.Width-1,1,ARect.Width-1,ARect.Height-1,clBlack,True);
ABitmap.TextRect(Rect(5,5,ABitmap.Width-5, ABitmap.Height-5),
SlideTextListBox.Items[Index], taLeftJustify, tlTop,
ColorToRGB(TextColor)
);
try
{ This savely checks if we are on the last slide -> Edge }
if (Index >= frmPresent.SlideList.Count-1) or
(frmPresent.SlideList[Index].Song.FileNameWithoutEnding <>
frmPresent.SlideList[Index+1].Song.FileNameWithoutEnding)
then
begin
Edge := True;
ABitmap.DrawLine(1,ARect.Height-1,ARect.Width-1,ARect.Height-1,clBlack,true);

ABitmap.DrawLine(1,0,1,ARect.Height-1,clBlack,True);
ABitmap.DrawLine(ARect.Width-1,0,ARect.Width-1,ARect.Height-1,clBlack,True);
end;

if not Edge then
begin
ABitmap.DrawLine(1,0,1,ARect.Height,clBlack,True);
ABitmap.DrawLine(ARect.Width-1,0,ARect.Width-1,ARect.Height,clBlack,True);
end else
begin
ABitmap.DrawLine(1,1,1,ARect.Height-1,clBlack,True);
ABitmap.DrawLine(ARect.Width-1,1,ARect.Width-1,ARect.Height-1,clBlack,True);
end;

ABitmap.Draw(SlideTextListBox.Canvas, ARect.Left, ARect.Top, true);
finally
ABitmap.Destroy;
Expand All @@ -1165,6 +1193,8 @@ procedure TfrmSongs.SlideTextListBoxMeasureItem(Control: TWinControl;
ABitmap.FontName:=Screen.SystemFont.Name;
ABitmap.FontHeight:=Round(Screen.SystemFont.Height/0.75);
ABitmap.SetSize(SlideTextListBox.Width, SlideTextListBox.Height);
ABitmap.CanvasBGRA.TextStyle.Wordbreak:=True;
ABitmap.CanvasBGRA.TextStyle.SingleLine:=False;
AHeight:=ABitmap.TextSize(SlideTextListBox.Items[Index],SlideTextListBox.Width).Height;
AHeight += 10;
ABitmap.Destroy;
Expand Down
6 changes: 4 additions & 2 deletions src/generics/presentationcanvas.pas
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ constructor TPresentationCanvasHandler.Create; overload;
begin
inherited;
Bitmap := TBGRABitmap.Create;
Bitmap.CanvasBGRA.TextStyle.Wordbreak:=True;
Bitmap.CanvasBGRA.TextStyle.SingleLine:=False;

BackgroundPicture := TBGRABitmap.Create;
AdjustedBackgroundPicture := TBGRABitmap.Create;
ResizedBackgroundBitmap := TBGRABitmap.Create;
Expand Down Expand Up @@ -367,8 +370,7 @@ procedure TPresentationCanvasHandler.AssignBGRAFont(Font: TFont);
begin
Bitmap.FontName := Font.Name;
Bitmap.FontStyle := Font.Style;
Bitmap.FontQuality:=TBGRAFontQuality.fqSystemClearType;
Bitmap.FontHeight:= Round(Font.Height/0.75);
Bitmap.FontHeight:= Round(Font.Height/0.85);
end;

end.
12 changes: 12 additions & 0 deletions src/locals/cantara.de.po
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,18 @@ msgstr "Vorlage"
msgid "Presentation"
msgstr "Präsentation"

#: tfrmpresent.menuitemmovetoscreen.caption
msgid "Move to other screen"
msgstr ""

#: tfrmpresent.menuitemquitpresentation.caption
msgid "Quit Presentation"
msgstr ""

#: tfrmpresent.menuitemtogglefullscreen.caption
msgid "Fullscreen"
msgstr ""

#: tfrmsettings.bgcolordialog.title
msgid "Select background color"
msgstr "Hintergrundfarbe auswählen"
Expand Down
12 changes: 12 additions & 0 deletions src/locals/cantara.es.po
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,18 @@ msgstr "Modelo"
msgid "Presentation"
msgstr "Presentación"

#: tfrmpresent.menuitemmovetoscreen.caption
msgid "Move to other screen"
msgstr ""

#: tfrmpresent.menuitemquitpresentation.caption
msgid "Quit Presentation"
msgstr ""

#: tfrmpresent.menuitemtogglefullscreen.caption
msgid "Fullscreen"
msgstr ""

#: tfrmsettings.bgcolordialog.title
msgid "Select background color"
msgstr "Seleccione el color de fondo"
Expand Down
12 changes: 12 additions & 0 deletions src/locals/cantara.it.po
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,18 @@ msgstr "Modello"
msgid "Presentation"
msgstr "Presentazione"

#: tfrmpresent.menuitemmovetoscreen.caption
msgid "Move to other screen"
msgstr ""

#: tfrmpresent.menuitemquitpresentation.caption
msgid "Quit Presentation"
msgstr ""

#: tfrmpresent.menuitemtogglefullscreen.caption
msgid "Fullscreen"
msgstr ""

#: tfrmsettings.bgcolordialog.title
msgid "Select background color"
msgstr "Seleziona il colore di sfondo"
Expand Down
12 changes: 12 additions & 0 deletions src/locals/cantara.nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,18 @@ msgstr "Sjabloon"
msgid "Presentation"
msgstr "Presentatie"

#: tfrmpresent.menuitemmovetoscreen.caption
msgid "Move to other screen"
msgstr ""

#: tfrmpresent.menuitemquitpresentation.caption
msgid "Quit Presentation"
msgstr ""

#: tfrmpresent.menuitemtogglefullscreen.caption
msgid "Fullscreen"
msgstr ""

#: tfrmsettings.bgcolordialog.title
msgid "Select background color"
msgstr "Kies een achtergrondkleur"
Expand Down
12 changes: 12 additions & 0 deletions src/locals/cantara.pot
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,18 @@ msgstr ""
msgid "Presentation"
msgstr ""

#: tfrmpresent.menuitemmovetoscreen.caption
msgid "Move to other screen"
msgstr ""

#: tfrmpresent.menuitemquitpresentation.caption
msgid "Quit Presentation"
msgstr ""

#: tfrmpresent.menuitemtogglefullscreen.caption
msgid "Fullscreen"
msgstr ""

#: tfrmsettings.bgcolordialog.title
msgid "Select background color"
msgstr ""
Expand Down
12 changes: 12 additions & 0 deletions src/locals/cantara.zh.po
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,18 @@ msgstr "模板"
msgid "Presentation"
msgstr "投影片"

#: tfrmpresent.menuitemmovetoscreen.caption
msgid "Move to other screen"
msgstr ""

#: tfrmpresent.menuitemquitpresentation.caption
msgid "Quit Presentation"
msgstr ""

#: tfrmpresent.menuitemtogglefullscreen.caption
msgid "Fullscreen"
msgstr ""

#: tfrmsettings.bgcolordialog.title
msgid "Select background color"
msgstr "選擇背景顏色"
Expand Down

0 comments on commit 82dcf5a

Please sign in to comment.