summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-02-11 15:21:55 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-02-11 15:21:55 +0200
commit46bbcc4747e345766b479a8299f3b7183fb67869 (patch)
tree49f599d7416be6c0d6ad5f68faf93efc00091e8b
parentdd179b84fb8eca1658fd95f8b166ddb81e32c6fd (diff)
downloadfpGUI-46bbcc4747e345766b479a8299f3b7183fb67869.tar.xz
Cross-build script for personal use
* Created a Linux 64bit to 32bit cross-compile script for quick testing. This is only meant for me really. * Enabled C-style syntax. eg: += -= etc.. This reduces typing and is easy to read.
-rwxr-xr-xsrc/buildcrosslinux32.sh51
-rw-r--r--src/corelib/fpg_main.pas28
-rw-r--r--src/corelib/gdi/fpgui_toolkit.lpk1
-rw-r--r--src/corelib/x11/fpgui_toolkit.lpk1
-rw-r--r--src/extrafpc.cfg7
-rw-r--r--src/frm_configuration.pas376
6 files changed, 70 insertions, 394 deletions
diff --git a/src/buildcrosslinux32.sh b/src/buildcrosslinux32.sh
new file mode 100755
index 00000000..1c900532
--- /dev/null
+++ b/src/buildcrosslinux32.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+###########################################################################
+# NOTE:
+# Cross compiling is from Linux 64-bit to Linux 32-bit only.
+#
+# This is really only for my testing purposes so I can quickly test
+# other platforms and targets
+#
+###########################################################################
+
+CROSSFPC=/opt/fpc_2.4.1/i386-linux/bin/fpc
+
+#fpctarget=`$CROSSFPC -iTP`-`fpc -iTO`
+#echo $fpctarget
+
+#libpath='../lib/'$fpctarget
+unitpath='../lib/i386-linux'
+# Must we create the output directory?
+if [ ! -d $unitpath ]; then
+ echo 'creating directory: '$unitpath
+ mkdir $unitpath
+ echo ' '
+fi
+# compile fpGUI Toolkit itself
+echo 'compiling fpGUI Toolkit library'
+$CROSSFPC -Tlinux -Pi386 -dRELEASE -dX11 @extrafpc.cfg corelib/x11/fpgui_toolkit.pas
+echo ' '
+
+unitpath='../docview/src/units/i386-linux'
+# Must we create the output directory for DocView?
+if [ ! -d $unitpath ]; then
+ echo 'creating directory: '$unitpath
+ mkdir $unitpath
+ echo ' '
+fi
+# compile the DocView (documentation viewer) application
+echo 'compiling DocView'
+$CROSSFPC -Tlinux -Pi386 -dRELEASE -dX11 @extrafpc.cfg -Fu../docview/components/richtext/ -FE$unitpath ../docview/src/docview.lpr
+echo ' '
+
+unitpath='../uidesigner/units/i386-linux'
+# Must we create the output directory for DocView?
+if [ ! -d $unitpath ]; then
+ echo 'creating directory: '$unitpath
+ mkdir $unitpath
+ echo ' '
+fi
+# compile the UI Designer (visual form designer) application
+echo 'compiling UIDesigner'
+$CROSSFPC -Tlinux -Pi386 -dRELEASE -dX11 @extrafpc.cfg -FE$unitpath ../uidesigner/uidesigner.lpr
+echo ' '
diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas
index dc9d7f4c..1bb68e22 100644
--- a/src/corelib/fpg_main.pas
+++ b/src/corelib/fpg_main.pas
@@ -692,7 +692,7 @@ begin
spacing := '';
inc(iCallTrace);
for i := 0 to iCallTrace do
- spacing := spacing + ' ';
+ spacing += ' ';
FClassName := AClassName;
FMethodName := AMethodName;
{$IFDEF DEBUG}
@@ -721,14 +721,14 @@ var
begin
s := '';
for i := 0 to iCallTrace+1 do
- s := s + ' ';
+ s += ' ';
writeln(s + AMessage);
end;
procedure DumpStack;
-Var
- Message : String;
- i : longint;
+var
+ lMessage: String;
+ i: longint;
begin
writeln(' Stack trace:');
// Dump_Stack(StdOut, get_frame);
@@ -736,15 +736,15 @@ begin
Writeln(stdout,'An unhandled exception occurred at $',HexStr(Ptrint(ExceptAddr),sizeof(PtrInt)*2),' :');
if ExceptObject is exception then
begin
- Message:=Exception(ExceptObject).ClassName+' : '+Exception(ExceptObject).Message;
- Writeln(stdout,Message);
+ lMessage := Exception(ExceptObject).ClassName+' : '+Exception(ExceptObject).Message;
+ Writeln(stdout,lMessage);
end
else
Writeln(stdout,'Exception object ',ExceptObject.ClassName,' is not of class Exception.');
Writeln(stdout,BackTraceStrFunc(ExceptAddr));
if (ExceptFrameCount>0) then
begin
- for i:=0 to ExceptFrameCount-1 do
+ for i := 0 to ExceptFrameCount-1 do
Writeln(stdout,BackTraceStrFunc(ExceptFrames[i]));
end;
Writeln(stdout,'');
@@ -788,21 +788,21 @@ end;
procedure TfpgTimer.SetEnabled(const AValue: boolean);
begin
if (not FEnabled) and AValue then
- FNextAlarm := now + interval * ONE_MILISEC;
+ FNextAlarm := now + (interval * ONE_MILISEC);
FEnabled := AValue;
end;
procedure TfpgTimer.SetInterval(const AValue: integer);
begin
FInterval := AValue;
- FNextAlarm := now + FInterval * ONE_MILISEC;
+ FNextAlarm := now + (FInterval * ONE_MILISEC);
end;
constructor TfpgTimer.Create(ainterval: integer);
begin
FInterval := ainterval;
- OnTimer := nil;
- FEnabled := False;
+ OnTimer := nil;
+ FEnabled := False;
fpgTimers.Add(self);
end;
@@ -826,7 +826,7 @@ begin
// set the next alarm point
if interval > 0 then
while FNextAlarm <= ctime do
- FNextAlarm := FNextAlarm + (interval * ONE_MILISEC);
+ FNextAlarm += (interval * ONE_MILISEC);
if Assigned(FOnTimer) then
FOnTimer(self);
@@ -1425,7 +1425,7 @@ begin
Result := TrimRight(Result) + sLineBreak;
end else
Inc(lw, tw);
- Result := Result + sub;
+ Result += sub;
end;
end;
diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk
index 11a0a382..8b661e62 100644
--- a/src/corelib/gdi/fpgui_toolkit.lpk
+++ b/src/corelib/gdi/fpgui_toolkit.lpk
@@ -13,7 +13,6 @@
</SearchPaths>
<Parsing>
<SyntaxOptions>
- <CStyleOperator Value="False"/>
<AllowLabel Value="False"/>
<CPPInline Value="False"/>
</SyntaxOptions>
diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk
index a07d90fd..1303fabf 100644
--- a/src/corelib/x11/fpgui_toolkit.lpk
+++ b/src/corelib/x11/fpgui_toolkit.lpk
@@ -12,7 +12,6 @@
</SearchPaths>
<Parsing>
<SyntaxOptions>
- <CStyleOperator Value="False"/>
<AllowLabel Value="False"/>
<CPPInline Value="False"/>
</SyntaxOptions>
diff --git a/src/extrafpc.cfg b/src/extrafpc.cfg
index 8757773c..d7e110cb 100644
--- a/src/extrafpc.cfg
+++ b/src/extrafpc.cfg
@@ -43,6 +43,9 @@
# Allow inline and use ansistrings.
-Sih
+# Allows C-style assignment += -= etc.
+-Sc
+
# Optimize always for Size
#-O2s
@@ -99,8 +102,8 @@
#-viwn
#
# If you don't want so much verbosity use
--vw
+#-vw
#
# Show only errors
-#-ve
+-ve
diff --git a/src/frm_configuration.pas b/src/frm_configuration.pas
deleted file mode 100644
index 490c2596..00000000
--- a/src/frm_configuration.pas
+++ /dev/null
@@ -1,376 +0,0 @@
-unit frm_configuration;
-
-{$mode objfpc}{$H+}
-
-interface
-
-uses
- SysUtils, Classes, fpg_base, fpg_main, fpg_form, fpg_tab, fpg_button,
- fpg_label, fpg_edit, fpg_panel, fpg_combobox, fpg_listbox;
-
-type
-
- TConfigurationForm = class(TfpgForm)
- private
- {@VFD_HEAD_BEGIN: ConfigurationForm}
- PageControl1: TfpgPageControl;
- btnSave: TfpgButton;
- btnCancel: TfpgButton;
- tsGeneral: TfpgTabSheet;
- tsFontsColor: TfpgTabSheet;
- Label1: TfpgLabel;
- edtNormalFont: TfpgEdit;
- btnNormalFont: TfpgButton;
- Label2: TfpgLabel;
- edtFixedFont: TfpgEdit;
- btnFixedFont: TfpgButton;
- btnHelp: TfpgButton;
- Panel1: TfpgPanel;
- cbIndexStyle: TfpgComboBox;
- lblIndexStyle: TfpgLabel;
- lblSearchDirs: TfpgLabel;
- btnSearchDirAdd: TfpgButton;
- lbSearchDirs: TfpgListBox;
- btnSearchDirDelete: TfpgButton;
- {@VFD_HEAD_END: ConfigurationForm}
- procedure ConfigurationFormShow(Sender: TObject);
- procedure btnHelpClick(Sender: TObject);
- procedure PageControl1Change(Sender: TObject; NewActiveSheet: TfpgTabSheet);
- procedure btnCancelClick(Sender: TObject);
- procedure btnSaveClick(Sender: TObject);
- procedure btnSearchDirAddClicked(Sender: TObject);
- procedure SettingsToGui;
- procedure GuiToSettings;
- public
- constructor Create(AOwner: TComponent); override;
- procedure AfterCreate; override;
- end;
-
-{@VFD_NEWFORM_DECL}
-
-procedure ShowConfigForm;
-
-implementation
-
-uses
- fpg_dialogs, SettingsUnit, dvConstants;
-
-procedure ShowConfigForm;
-var
- frm: TConfigurationForm;
-begin
- frm := TConfigurationForm.Create(nil);
- try
- frm.ShowModal;
- finally
- frm.Free;
- end;
-end;
-
-{@VFD_NEWFORM_IMPL}
-
-procedure TConfigurationForm.ConfigurationFormShow(Sender: TObject);
-begin
- SettingsToGui;
- PageControl1.ActivePage := tsGeneral;
- // programatically seting a tab does not fire OnChange event, so we do it mantually
- PageControl1Change(self, tsGeneral);
-end;
-
-procedure TConfigurationForm.btnHelpClick(Sender: TObject);
-begin
- ShowMessage(IntToStr(btnHelp.HelpContext));
-end;
-
-procedure TConfigurationForm.PageControl1Change(Sender: TObject;
- NewActiveSheet: TfpgTabSheet);
-begin
- if NewActiveSheet = tsGeneral then
- begin
- btnHelp.HelpContext := hcConfigGeneralTab;
- end
- else if NewActiveSheet = tsFontsColor then
- begin
- btnHelp.HelpContext := hcConfigFontsColorTab;
- end;
-end;
-
-procedure TConfigurationForm.btnCancelClick(Sender: TObject);
-begin
- ModalResult := mrCancel;
-end;
-
-procedure TConfigurationForm.btnSaveClick(Sender: TObject);
-begin
- GuiToSettings;
- SaveSettings;
- ModalResult := mrOK;
-end;
-
-procedure TConfigurationForm.btnSearchDirAddClicked(Sender: TObject);
-var
- s: TfpgString;
-begin
- s := SelectDirDialog('');
- if s <> '' then
- lbSearchDirs.Items.Add(s);
-end;
-
-procedure TConfigurationForm.SettingsToGui;
-begin
- // General
- cbIndexStyle.FocusItem := Ord(Settings.IndexStyle);
- lbSearchDirs.Items.Assign(Settings.SearchDirectories);
- // Fonts & Color
- edtNormalFont.Text := Settings.NormalFont.FontDesc;
- edtFixedFont.Text := Settings.FixedFont.FontDesc;
-end;
-
-procedure TConfigurationForm.GuiToSettings;
-begin
- // General
- Settings.IndexStyle := TIndexStyle(cbIndexStyle.FocusItem);
- Settings.SearchDirectories.Assign(lbSearchDirs.Items);
- // Fonts & Color
- Settings.NormalFont.Free;
- Settings.NormalFont := fpgGetFont(edtNormalFont.Text);
- Settings.FixedFont.Free;
- Settings.FixedFont := fpgGetFont(edtFixedFont.Text);
-end;
-
-constructor TConfigurationForm.Create(AOwner: TComponent);
-begin
- inherited Create(AOwner);
- OnShow := @ConfigurationFormShow;
-end;
-
-procedure TConfigurationForm.AfterCreate;
-begin
- {%region 'Auto-generated GUI code' -fold}
- {@VFD_BODY_BEGIN: ConfigurationForm}
- Name := 'ConfigurationForm';
- SetPosition(310, 157, 515, 439);
- WindowTitle := 'Configuration';
- WindowPosition := wpOneThirdDown;
-
- PageControl1 := TfpgPageControl.Create(self);
- with PageControl1 do
- begin
- Name := 'PageControl1';
- SetPosition(4, 4, 506, 388);
- Anchors := [anLeft,anRight,anTop,anBottom];
- ActivePageIndex := 1;
- TabOrder := 0;
- OnChange := @PageControl1Change;
- end;
-
- btnSave := TfpgButton.Create(self);
- with btnSave do
- begin
- Name := 'btnSave';
- SetPosition(344, 408, 80, 24);
- Text := 'Save';
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 1;
- OnClick := @btnSaveClick;
- end;
-
- btnCancel := TfpgButton.Create(self);
- with btnCancel do
- begin
- Name := 'btnCancel';
- SetPosition(428, 408, 80, 24);
- Text := 'Cancel';
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 2;
- OnClick := @btnCancelClick;
- end;
-
- tsGeneral := TfpgTabSheet.Create(PageControl1);
- with tsGeneral do
- begin
- Name := 'tsGeneral';
- SetPosition(3, 24, 500, 361);
- Text := 'General';
- end;
-
- tsFontsColor := TfpgTabSheet.Create(PageControl1);
- with tsFontsColor do
- begin
- Name := 'tsFontsColor';
- SetPosition(3, 24, 500, 361);
- Text := 'Fonts & Color';
- end;
-
- Label1 := TfpgLabel.Create(tsFontsColor);
- with Label1 do
- begin
- Name := 'Label1';
- SetPosition(12, 20, 108, 16);
- FontDesc := '#Label1';
- Hint := '';
- Text := 'Normal Font';
- end;
-
- edtNormalFont := TfpgEdit.Create(tsFontsColor);
- with edtNormalFont do
- begin
- Name := 'edtNormalFont';
- SetPosition(124, 16, 248, 24);
- Anchors := [anLeft,anRight,anTop];
- TabOrder := 1;
- Text := '';
- FontDesc := '#Edit1';
- end;
-
- btnNormalFont := TfpgButton.Create(tsFontsColor);
- with btnNormalFont do
- begin
- Name := 'btnNormalFont';
- SetPosition(384, 16, 80, 24);
- Anchors := [anRight,anTop];
- Text := 'Select...';
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 2;
- end;
-
- Label2 := TfpgLabel.Create(tsFontsColor);
- with Label2 do
- begin
- Name := 'Label2';
- SetPosition(12, 52, 104, 16);
- FontDesc := '#Label1';
- Hint := '';
- Text := 'Fixed Font';
- end;
-
- edtFixedFont := TfpgEdit.Create(tsFontsColor);
- with edtFixedFont do
- begin
- Name := 'edtFixedFont';
- SetPosition(124, 48, 248, 24);
- Anchors := [anLeft,anRight,anTop];
- TabOrder := 4;
- Text := '';
- FontDesc := '#Edit1';
- end;
-
- btnFixedFont := TfpgButton.Create(tsFontsColor);
- with btnFixedFont do
- begin
- Name := 'btnFixedFont';
- SetPosition(384, 48, 80, 24);
- Anchors := [anRight,anTop];
- Text := 'Select...';
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 5;
- end;
-
- btnHelp := TfpgButton.Create(self);
- with btnHelp do
- begin
- Name := 'btnHelp';
- SetPosition(468, 356, 28, 24);
- Anchors := [anRight,anBottom];
- Text := '?';
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 6;
- HelpType := htContext;
- OnClick := @btnHelpClick;
- end;
-
- Panel1 := TfpgPanel.Create(tsFontsColor);
- with Panel1 do
- begin
- Name := 'Panel1';
- SetPosition(128, 116, 204, 28);
- FontDesc := '#Label1';
- Style := bsLowered;
- Text := 'Panel';
- end;
-
- cbIndexStyle := TfpgComboBox.Create(tsGeneral);
- with cbIndexStyle do
- begin
- Name := 'cbIndexStyle';
- SetPosition(12, 32, 160, 22);
- FontDesc := '#List';
- Items.Add('Alphabetical');
- Items.Add('FileOnly');
- Items.Add('Full');
- TabOrder := 0;
- end;
-
- lblIndexStyle := TfpgLabel.Create(tsGeneral);
- with lblIndexStyle do
- begin
- Name := 'lblIndexStyle';
- SetPosition(12, 12, 212, 16);
- FontDesc := '#Label1';
- Hint := '';
- Text := 'Index style';
- end;
-
- lblSearchDirs := TfpgLabel.Create(tsGeneral);
- with lblSearchDirs do
- begin
- Name := 'lblSearchDirs';
- SetPosition(12, 64, 216, 16);
- FontDesc := '#Label1';
- Hint := '';
- Text := 'Search directories';
- end;
-
- btnSearchDirAdd := TfpgButton.Create(tsGeneral);
- with btnSearchDirAdd do
- begin
- Name := 'btnSearchDirAdd';
- SetPosition(408, 84, 80, 24);
- Text := 'Add...';
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 4;
- OnClick :=@btnSearchDirAddClicked;
- end;
-
- lbSearchDirs := TfpgListBox.Create(tsGeneral);
- with lbSearchDirs do
- begin
- Name := 'lbSearchDirs';
- SetPosition(12, 84, 388, 148);
- FontDesc := '#List';
- HotTrack := False;
- PopupFrame := False;
- TabOrder := 5;
- Items.Duplicates := dupIgnore;
- end;
-
- btnSearchDirDelete := TfpgButton.Create(tsGeneral);
- with btnSearchDirDelete do
- begin
- Name := 'btnSearchDirDelete';
- SetPosition(408, 116, 80, 24);
- Text := 'Remove...';
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 5;
- end;
-
- {@VFD_BODY_END: ConfigurationForm}
- {%endregion}
-end;
-
-
-end.