@@ -263,7 +263,7 @@ procedure TPSCodeGen.CreateScript(list: TSimbaComponentList);
ResultScript.Clear;
for i := 0 to list.Count - 1 do
begin
cmp := CmpList.AddItem ;
cmp := TSimbaComponent.Create ;
with cmp do
begin
clsname := list[i].clsname;
@@ -272,11 +272,12 @@ procedure TPSCodeGen.CreateScript(list: TSimbaComponentList);
fontcolor := list[i].fontcolor;
fontname := list[i].fontname;
img := list[i].img;
heigth := list[i].heigth ;
height := list[i].height ;
width := list[i].width;
left := list[i].left;
top := list[i].top;
end ;
CmpList.Add(cmp);
end ;
GenerateFormCode(CmpList);
Stream.Position := 0 ;
@@ -285,137 +286,73 @@ procedure TPSCodeGen.CreateScript(list: TSimbaComponentList);
procedure TPSCodeGen.GetComponentCode (smbl: TSimbaComponentList);
var
i,j: integer;
smb,cmp: TSimbaComponent;
i, j: integer;
smb, cmp: TSimbaComponent;
begin
for i:=0 to smbl.count - 1 do
begin
smb:=smbl[i];
j:=GetSimbaCType(smb);
case j of
0 : begin CreateFormCode(smb,FormCode); end ;
1 : begin
SmbToCodeList(smb,LabelsCode);
cmp:=Labels.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
for i := 0 to smbl.count - 1 do
begin
smb := smbl[i];
j := GetSimbaCType(smb);
case j of
0 : CreateFormCode(smb, FormCode);
1 :
begin
SmbToCodeList(smb, LabelsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Labels.Add(cmp);
end ;
2 : begin
SmbToCodeList(smb,EditsCode);
cmp:=Edits.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
2 :
begin
SmbToCodeList(smb, EditsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Edits.Add(cmp);
end ;
3 : begin
SmbToCodeList(smb,ImagesCode);
cmp:=Images.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
3 :
begin
SmbToCodeList(smb, ImagesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Images.Add(cmp);
end ;
4 : begin
SmbToCodeList(smb,ButtonsCode);
cmp:=Buttons.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
4 :
begin
SmbToCodeList(smb, ButtonsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Buttons.Add(cmp);
end ;
5 : begin
SmbToCodeList(smb,CheckBoxesCode);
cmp:=CheckBoxes.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
5 :
begin
SmbToCodeList(smb, CheckBoxesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
CheckBoxes.Add(cmp);
end ;
6 : begin
SmbToCodeList(smb,ListBoxesCode);
cmp:=ListBoxes.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
6 :
begin
SmbToCodeList(smb, ListBoxesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
ListBoxes.Add(cmp);
end ;
7 : begin
SmbToCodeList(smb,ComboBoxesCode);
cmp:=Comboboxes.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
7 :
begin
SmbToCodeList(smb, ComboBoxesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Comboboxes.Add(cmp);
end ;
8 : begin
SmbToCodeList(smb,RadBtnsCode);
cmp:=RadBtns.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
8 :
begin
SmbToCodeList(smb, RadBtnsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
RadBtns.Add(cmp);
end ;
end ;
end ;
end ;
end ;
GenerateScriptHeader;
end ;
@@ -436,7 +373,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
list.Add(GenSpaces(6 )+' Font.Name:=' +smb.fontname+' ;' );
list.Add(GenSpaces(6 )+' Font.Color:=' +ColorToString(smb.fontcolor)+' ;' );
list.Add(GenSpaces(6 )+' Font.Size:=' +IntToStr(smb.fontsize)+' ;' );
@@ -452,7 +389,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
list.Add(GenSpaces(6 )+' Font.Name:=' +smb.fontname+' ;' );
list.Add(GenSpaces(6 )+' Font.Color:=' +ColorToString(smb.fontcolor)+' ;' );
list.Add(GenSpaces(6 )+' Font.Size:=' +IntToStr(smb.fontsize)+' ;' );
@@ -471,11 +408,11 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
if smb.img.switcher = true then
begin
s:=smb.img.imgcode;
if (smb.heigth <= 24 ) and (smb.width <=24 ) then
if (smb.height <= 24 ) and (smb.width <=24 ) then
begin
s1:=#13 #10 +GenSpaces(6 )+#39 ;
for p:=0 to Length(s)-1 do begin
@@ -507,16 +444,16 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
end ;
end ;
end ;
List.Add(GenSpaces(6 )+' bmps' +IntToStr(img)+' :=GetMufasaBitmap(BitmapFromString(' +IntToStr(smb.width)+' ,' +IntToStr(smb.Heigth )+' ,' +s1+#39 +' ));' );
List.Add(GenSpaces(6 )+' bmps' +IntToStr(img)+' :=GetMufasaBitmap(BitmapFromString(' +IntToStr(smb.width)+' ,' +IntToStr(smb.height )+' ,' +s1+#39 +' ));' );
List.Add(GenSpaces(6 )+' bmp' +IntToStr(img)+' :=bmps' +IntToStr(img)+' .ToTBitmap;' );
List.Add(GenSpaces(6 )+' Picture.Bitmap.handle:=bmp' +IntToStr(img)+' .handle;' );
end else begin
s2:=#39 +s+#39 ;
// List.Add(GenSpaces(6)+'bmp'+IntToStr(img)+':=TBitmap.Create;');
List.Add(GenSpaces(6 )+' bmps' +IntToStr(img)+' :=GetMufasaBitmap(BitmapFromString(' +IntToStr(smb.width)+' ,' +IntToStr(smb.Heigth )+' ,' +s2+' ));' );
List.Add(GenSpaces(6 )+' bmps' +IntToStr(img)+' :=GetMufasaBitmap(BitmapFromString(' +IntToStr(smb.width)+' ,' +IntToStr(smb.height )+' ,' +s2+' ));' );
List.Add(GenSpaces(6 )+' bmp' +IntToStr(img)+' :=bmps' +IntToStr(img)+' .ToTBitmap;' );
List.Add(GenSpaces(6 )+' Picture.Bitmap.handle:=bmp' +IntToStr(img)+' .handle;' );
// List.Add(GenSpaces(6)+'DrawBitmap(bmps'+IntToStr(img)+',Canvas,'+IntToStr(smb.width)+','+IntToStr(smb.Heigth )+');');
// List.Add(GenSpaces(6)+'DrawBitmap(bmps'+IntToStr(img)+',Canvas,'+IntToStr(smb.width)+','+IntToStr(smb.height )+');');
// list.Add(GenSpaces(6)+'Picture.Bitmap.LoadFromFile('+#39+smb.img.path+#39+');');
end ;
end else
@@ -534,7 +471,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
list.Add(GenSpaces(6 )+' OnClick:=@YourClickProcedure' +' ;' );
list.Add(GenSpaces(6 )+' Font.Name:=' +smb.fontname+' ;' );
list.Add(GenSpaces(6 )+' Font.Color:=' +ColorToString(smb.fontcolor)+' ;' );
@@ -553,7 +490,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
list.Add(GenSpaces(6 )+' Font.Name:=' +smb.fontname+' ;' );
list.Add(GenSpaces(6 )+' Font.Color:=' +ColorToString(smb.fontcolor)+' ;' );
list.Add(GenSpaces(6 )+' Font.Size:=' +IntToStr(smb.fontsize)+' ;' );
@@ -568,7 +505,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
list.Add(GenSpaces(6 )+' //add your items here' );
list.Add(GenSpaces(6 )+' Items.Add(' +#39 +' YourItem' +#39 +' )' +' ;' );
list.Add(GenSpaces(6 )+' //End items' );
@@ -587,7 +524,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
list.Add(GenSpaces(6 )+' //add your items here' );
list.Add(GenSpaces(6 )+' Items.Add(' +#39 +' YourItem' +#39 +' )' +' ;' );
list.Add(GenSpaces(6 )+' //End items' );
@@ -607,7 +544,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6 )+' Left:=' +IntToStr(smb.left)+' ;' );
list.Add(GenSpaces(6 )+' Top:=' +IntToStr(smb.top)+' ;' );
list.Add(GenSpaces(6 )+' Width:=' +IntToStr(smb.width)+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.heigth )+' ;' );
list.Add(GenSpaces(6 )+' Height:=' +IntToStr(smb.height )+' ;' );
list.Add(GenSpaces(6 )+' Font.Name:=' +smb.fontname+' ;' );
list.Add(GenSpaces(6 )+' Font.Color:=' +ColorToString(smb.fontcolor)+' ;' );
list.Add(GenSpaces(6 )+' Font.Size:=' +IntToStr(smb.fontsize)+' ;' );
@@ -695,7 +632,7 @@ procedure TPSCodeGen.CreateFormCode(smb: TSimbaComponent; List: TStringList);
Add(GenSpaces(6 ) + ' Left:=' + IntToStr(smb.left) + ' ;' );
Add(GenSpaces(6 ) + ' Top:=' + IntToStr(smb.top) + ' ;' );
Add(GenSpaces(6 ) + ' Width:=' + IntToStr(smb.width) + ' ;' );
Add(GenSpaces(6 ) + ' Height:=' + IntToStr(smb.heigth ) + ' ;' );
Add(GenSpaces(6 ) + ' Height:=' + IntToStr(smb.height ) + ' ;' );
Add(GenSpaces(6 ) + ' Font.Name:=' + smb.fontname + ' ;' );
Add(GenSpaces(6 ) + ' Font.Color:=' + ColorToString(smb.fontcolor) + ' ;' );
Add(GenSpaces(6 ) + ' Font.Size:=' + IntToStr(smb.fontsize) + ' ;' );