Skip to content

Add improvments in Designer #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
*.dcu
*.lib

# SVN Database
*.svn

# Delphi autogenerated files (duplicated info)
*.cfg
*Resource.rc
Expand All @@ -57,3 +60,4 @@ __recovery/

# Castalia statistics file
*.stat

Binary file modified Designer/Bin/RibbonDesigner.exe
Binary file not shown.
28 changes: 25 additions & 3 deletions Designer/Classes/RibbonCompiler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ TRibbonCompiler = class
procedure CreateDelphiProject(const Filename: String);
{$ENDREGION 'Internal Declarations'}
public
function Compile(const Document: TRibbonDocument; ResourceName: string = 'APPLICATION'; const pCreateDLL: Boolean = False): TRibbonCompileResult;
function Compile(const Document: TRibbonDocument; ResourceName: string = 'APPLICATION'; const pCreateDLL: Boolean = False): TRibbonCompileResult; overload;
function Compile(const Document: TRibbonDocument; const IncludeXML: Boolean = False; ResourceName: string = 'APPLICATION'; const pCreateDLL: Boolean = False): TRibbonCompileResult; overload;


property OutputDllPath: String read FOutputDllPath;
property OnMessage: TRibbonCompilerMessageEvent read FOnMessage write FOnMessage;
Expand Down Expand Up @@ -63,6 +65,11 @@ implementation
{ TRibbonCompiler }

function TRibbonCompiler.Compile(const Document: TRibbonDocument; ResourceName: string = 'APPLICATION'; const pCreateDLL: Boolean = False): TRibbonCompileResult;
begin
Result := Compile( Document, False, ResourceName, pCreateDLL);
end;

function TRibbonCompiler.Compile(const Document: TRibbonDocument; const IncludeXML: Boolean = False; ResourceName: string = 'APPLICATION'; const pCreateDLL: Boolean = False): TRibbonCompileResult;
var
DocDir, DprFilename: String;
lMarkupGenerator: TMarkupGenerator;
Expand All @@ -71,6 +78,7 @@ function TRibbonCompiler.Compile(const Document: TRibbonDocument; ResourceName:
lRcFilePath: string;
lRcFileParam: string;
lNameParam: string;
lXML: string;
begin
try
if (Document.Filename = '') or (not TFile.Exists(Document.Filename)) then
Expand All @@ -97,9 +105,23 @@ function TRibbonCompiler.Compile(const Document: TRibbonDocument; ResourceName:
lNameParam := Format('"/name:%s"', [ResourceName]);

// Run ribbon compiler UICC.exe to convert the markup XML to a header, a resource and a bml file.
if not Execute(TSettings.Instance.RibbonCompilerPath, DocDir, ['"/W0"', Document.Filename.QuotedString('"'), lBmlFileParam, lHeaderFileParam, lRcFileParam, lNameParam]) then
if not Execute(TSettings.Instance.RibbonCompilerPath, DocDir, ['"/W0"', Document.Filename.QuotedString('"'), lBmlFileParam,
lHeaderFileParam, lRcFileParam, lNameParam]) then
Exit(crRibbonCompilerError);

// LC2L Informatique 2021-04-19 Add the possibility to include the XML file into the ressources file
if IncludeXML then begin
var RcFile := TStringList.Create;
try
RcFile.LoadFromFile(lRcFilePath);
RcFile.Add('');
RcFile.Add(Format('APPLICATION_RIBBON_XML RCDATA "%s"', [Document.Filename.Replace('\', '\\')]));
RcFile.SaveToFile(lRcFilePath);
finally
RcFile.Free;
end;
end;

// Run the resource compiler, so that we can include the file into a .pas file
if not Execute(TSettings.Instance.ResourceCompilerPath, DocDir, [lRcFilePath.QuotedString('"')]) then
Exit(crResourceCompilerError);
Expand Down Expand Up @@ -312,7 +334,7 @@ class procedure TRibbonCompiler.HandleCommandLine;
if not ParamStr(2).IsEmpty then
lSuccess := lRibbonCompiler.Compile(lRibbonDocument, ParamStr(2)) = crOk
else
lSuccess := lRibbonCompiler.Compile(lRibbonDocument) = crOk;
lSuccess := lRibbonCompiler.Compile(lRibbonDocument, '') = crOk;

if lSuccess then
ExitCode := 0;
Expand Down
19 changes: 16 additions & 3 deletions Designer/DMShared.dfm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
object DataModuleShared: TDataModuleShared
OldCreateOrder = False
Height = 150
Width = 215
Height = 351
Width = 555
object ImageListAppModes: TImageList
Left = 48
Top = 16
Bitmap = {
494C010103000800300010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
494C010103000800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
Expand Down Expand Up @@ -145,4 +145,17 @@ object DataModuleShared: TDataModuleShared
FFFFFFFFFFFF0000FFFFFFFFFFFF000000000000000000000000000000000000
000000000000}
end
object JvAppIniFileStorage: TJvAppIniFileStorage
StorageOptions.BooleanStringTrueValues = 'TRUE, YES, Y'
StorageOptions.BooleanStringFalseValues = 'FALSE, NO, N'
AutoFlush = True
Location = flCustom
SubStorages = <>
Left = 260
Top = 160
end
object JvComputerInfoEx: TJvComputerInfoEx
Left = 400
Top = 44
end
end
16 changes: 14 additions & 2 deletions Designer/DMShared.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,34 @@
interface

uses
SysUtils, Classes, ImgList, Controls;
SysUtils, Classes, ImgList, Controls, JvComputerInfoEx, JvComponentBase, JvAppStorage, JvAppIniStorage, System.ImageList;

type
TDataModuleShared = class(TDataModule)
ImageListAppModes: TImageList;
JvAppIniFileStorage: TJvAppIniFileStorage;
JvComputerInfoEx: TJvComputerInfoEx;
private
{ Private declarations }
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
end;

var
DataModuleShared: TDataModuleShared;

implementation
uses
Vcl.Forms;

{$R *.dfm}

constructor TDataModuleShared.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
var IniFilePath := IncludeTrailingPathDelimiter(JvComputerInfoEx.Folders.AppData) + ChangeFileExt(ExtractFileName(Application.ExeName), '');
ForceDirectories(IniFilePath);
JvAppIniFileStorage.FileName := IncludeTrailingPathDelimiter(IniFilePath) + ChangeFileExt(ExtractFileName(Application.ExeName), '.ini');
end;

end.
11 changes: 10 additions & 1 deletion Designer/FEditImage.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ object FormEditImage: TFormEditImage
Left = 24
Top = 20
Bitmap = {
494C0101020008002C0010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
494C010102000800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
Expand Down Expand Up @@ -374,4 +374,13 @@ object FormEditImage: TFormEditImage
Left = 148
Top = 61
end
object JvFormStorage: TJvFormStorage
AppStorage = DataModuleShared.JvAppIniFileStorage
AppStoragePath = '%FORM_NAME%'
StoredProps.Strings = (
'OpenDialog.InitialDir')
StoredValues = <>
Left = 392
Top = 76
end
end
3 changes: 2 additions & 1 deletion Designer/FEditImage.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface
ImgList,
RibbonMarkup,
UIRibbonCommands,
FImageList;
FImageList, System.ImageList, JvComponentBase, JvFormPlacement, DmShared;

type
TFormEditImage = class(TForm)
Expand All @@ -40,6 +40,7 @@ TFormEditImage = class(TForm)
ButtonOk: TButton;
ButtonCancel: TButton;
OpenDialog: TOpenDialog;
JvFormStorage: TJvFormStorage;
procedure PaintBoxPaint(Sender: TObject);
procedure EditImageFileChange(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
Expand Down
6 changes: 3 additions & 3 deletions Designer/FImageList.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object FrameImageList: TFrameImageList
Height = 30
AutoSize = True
ButtonHeight = 30
ButtonWidth = 64
ButtonWidth = 78
Caption = 'ToolBarSmallImages'
Images = ImageListToolbars
List = True
Expand All @@ -37,7 +37,7 @@ object FrameImageList: TFrameImageList
Action = ActionDeleteAllImages
end
object ButtonEditSmallImage: TToolButton
Left = 135
Left = 227
Top = 0
Action = ActionEditImage
end
Expand Down Expand Up @@ -80,7 +80,7 @@ object FrameImageList: TFrameImageList
Left = 32
Top = 68
Bitmap = {
494C0101030008003C0010001000FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
494C010103000800040010001000FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000000000000000000000000000000
00000000000004590ABC07A612FF07A612FF07A612FF07A612FF04590ABC0000
Expand Down
5 changes: 3 additions & 2 deletions Designer/FImageList.pas
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface
CommCtrl,
ToolWin,
RibbonMarkup,
UIRibbonCommands;
UIRibbonCommands, JvComponentBase, JvFormPlacement, System.ImageList;

type
TImageFlag = (ifLarge, ifHighContrast);
Expand Down Expand Up @@ -80,7 +80,8 @@ implementation
IOUtils,
Math,
FMain,
FEditImage;
FEditImage,
DMShared;

{ TFrameImageList }

Expand Down
63 changes: 55 additions & 8 deletions Designer/FMain.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ object FormMain: TFormMain
Left = 0
Top = 0
Width = 955
Height = 24
AutoSize = True
ButtonWidth = 65
ButtonHeight = 30
ButtonWidth = 71
Caption = 'ToolBar'
EdgeBorders = [ebBottom]
Images = Images
Expand All @@ -45,29 +45,31 @@ object FormMain: TFormMain
Top = 0
Action = ActionOpen
AutoSize = True
DropdownMenu = PopupMenuButtonOpen
Style = tbsDropDown
end
object ButtonSave: TToolButton
Left = 57
Left = 78
Top = 0
Action = ActionSave
AutoSize = True
end
object ToolButton1: TToolButton
Left = 112
Left = 133
Top = 0
Width = 8
Caption = 'ToolButton1'
ImageIndex = 4
Style = tbsSeparator
end
object ButtonBuild: TToolButton
Left = 120
Left = 141
Top = 0
Action = ActionBuild
AutoSize = True
end
object ButtonPreview: TToolButton
Left = 173
Left = 194
Top = 0
Action = ActionPreview
AutoSize = True
Expand All @@ -86,9 +88,9 @@ object FormMain: TFormMain
end
object PageControl: TPageControl
Left = 0
Top = 24
Top = 32
Width = 955
Height = 418
Height = 410
ActivePage = TabSheetCommands
Align = alClient
TabOrder = 2
Expand Down Expand Up @@ -231,6 +233,12 @@ object FormMain: TFormMain
ShortCut = 16455
OnExecute = ActionGenerateResourceIDsExecute
end
object ActionOpenLastUsedFileAtStartup: TAction
Category = 'File'
Caption = 'Open last used file at startup'
Hint = 'Open last used file at startup'
OnExecute = ActionOpenLastUsedFileAtStartupExecute
end
end
object ApplicationEvents: TApplicationEvents
OnException = ApplicationEventsException
Expand Down Expand Up @@ -673,6 +681,16 @@ object FormMain: TFormMain
object MenuOpen: TMenuItem
Action = ActionOpen
end
object MenuRecents: TMenuItem
Caption = 'Recents'
Enabled = False
end
object N5: TMenuItem
Caption = '-'
end
object Openlastusedfileatstartup1: TMenuItem
Action = ActionOpenLastUsedFileAtStartup
end
object N1: TMenuItem
Caption = '-'
end
Expand Down Expand Up @@ -736,4 +754,33 @@ object FormMain: TFormMain
Left = 368
Top = 480
end
object JvFormStorage: TJvFormStorage
AppStorage = DataModuleShared.JvAppIniFileStorage
AppStoragePath = '%FORM_NAME%\'
BeforeSavePlacement = JvFormStorageBeforeSavePlacement
OnRestorePlacement = JvFormStorageRestorePlacement
StoredProps.Strings = (
'OpenDialog.InitialDir'
'ActionOpenLastUsedFileAtStartup.Checked')
StoredValues = <>
Left = 332
Top = 280
end
object JvMRUManager: TJvMRUManager
Duplicates = dupIgnore
Capacity = 8
IniStorage = JvFormStorage
RecentMenu = MenuRecents
OnClick = JvMRUManagerClick
OnAfterUpdate = JvMRUManagerAfterUpdate
Left = 472
Top = 300
end
object PopupMenuButtonOpen: TPopupMenu
Left = 52
Top = 64
object tesst1: TMenuItem
Caption = 'tesst'
end
end
end
Loading