summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-15 15:14:05 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-15 15:14:05 +0000
commitd9548f09940c909a94f003758477f89696fe3741 (patch)
tree09ad76c15e4ee2935962b26e316b80f41d56f3e9 /src/corelib
parentacc50fa5d7ef195ae5f1746130a7edee646feab7 (diff)
downloadfpGUI-d9548f09940c909a94f003758477f89696fe3741.tar.xz
* Implemented some file handling functions.
* Implemented a FileGrid widget. Still work in progress and lots of refactoring and getting rid of IFDEFs.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/gdi/gfx_utils.pas43
-rw-r--r--src/corelib/gfx_utils_intf.inc7
-rw-r--r--src/corelib/x11/fpgfx_package.lpk6
-rw-r--r--src/corelib/x11/fpgfx_package.pas2
-rw-r--r--src/corelib/x11/gfx_utils.pas48
-rw-r--r--src/corelib/x11/x11_keyconv.pas4
6 files changed, 106 insertions, 4 deletions
diff --git a/src/corelib/gdi/gfx_utils.pas b/src/corelib/gdi/gfx_utils.pas
new file mode 100644
index 00000000..70078859
--- /dev/null
+++ b/src/corelib/gdi/gfx_utils.pas
@@ -0,0 +1,43 @@
+unit gfx_utils;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils;
+
+
+{$I gfx_utils_intf.inc}
+
+
+implementation
+
+
+// File utils
+function ExtractTargetSymLinkPath(ALink: string): string;
+begin
+{
+ var
+ info : _stat;
+ .....
+ fullname := FDirectoryName + e.Name;
+ if lstat(PChar(fullname),info) = 0 then
+ begin
+ e.IsLink := ((sr.Mode and $F000) = $A000);
+ if e.IsLink then
+ begin
+ SetLength(e.LinkTarget, MAX_PATH); // length was 256
+ r := libc.readlink(PChar(fullname),@(e.LinkTarget[1]), sizeof(e.LinkTarget));
+ if r > 0 then
+ SetLength(e.LinkTarget, r)
+ else
+ e.LinkTarget := '';
+ libc.stat(PChar(fullname), info);
+ end;
+}
+end;
+
+
+end.
+
diff --git a/src/corelib/gfx_utils_intf.inc b/src/corelib/gfx_utils_intf.inc
new file mode 100644
index 00000000..2bd3c72f
--- /dev/null
+++ b/src/corelib/gfx_utils_intf.inc
@@ -0,0 +1,7 @@
+{%mainunit gfx_utils.pas}
+
+// File utils
+function ExtractTargetSymLinkPath(ALink: string): string;
+
+
+
diff --git a/src/corelib/x11/fpgfx_package.lpk b/src/corelib/x11/fpgfx_package.lpk
index 60cd9992..82e20e85 100644
--- a/src/corelib/x11/fpgfx_package.lpk
+++ b/src/corelib/x11/fpgfx_package.lpk
@@ -24,7 +24,7 @@
<License Value="Modified LGPL
"/>
<Version Minor="5"/>
- <Files Count="12">
+ <Files Count="13">
<Item1>
<Filename Value="x11_xft.pas"/>
<UnitName Value="x11_xft"/>
@@ -73,6 +73,10 @@
<Filename Value="../gfx_clipboard.pas"/>
<UnitName Value="gfx_clipboard"/>
</Item12>
+ <Item13>
+ <Filename Value="gfx_utils.pas"/>
+ <UnitName Value="gfx_utils"/>
+ </Item13>
</Files>
<RequiredPkgs Count="1">
<Item1>
diff --git a/src/corelib/x11/fpgfx_package.pas b/src/corelib/x11/fpgfx_package.pas
index f8fc4f97..7385fd5b 100644
--- a/src/corelib/x11/fpgfx_package.pas
+++ b/src/corelib/x11/fpgfx_package.pas
@@ -9,7 +9,7 @@ interface
uses
x11_xft, x11_keyconv, gfxbase, gfx_x11, fpgfx, gfx_stdimages, gfx_imgfmt_bmp,
gfx_widget, gfx_UTF8utils, gfx_extinterpolation, gfx_cmdlineparams,
- gfx_clipboard;
+ gfx_clipboard, gfx_utils;
implementation
diff --git a/src/corelib/x11/gfx_utils.pas b/src/corelib/x11/gfx_utils.pas
new file mode 100644
index 00000000..b0fa283d
--- /dev/null
+++ b/src/corelib/x11/gfx_utils.pas
@@ -0,0 +1,48 @@
+unit gfx_utils;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils;
+
+
+{$I gfx_utils_intf.inc}
+
+
+implementation
+
+uses
+ baseunix;
+
+// File utils
+function ExtractTargetSymLinkPath(ALink: string): string;
+begin
+ Result := fpReadLink(ALink);
+
+ // The code below requires the libc unit.
+{
+ var
+ info : _stat;
+ .....
+ fullname := FDirectoryName + e.Name;
+ if lstat(PChar(fullname),info) = 0 then
+ begin
+ e.IsLink := ((sr.Mode and $F000) = $A000);
+ if e.IsLink then
+ begin
+ SetLength(e.LinkTarget, MAX_PATH); // length was 256
+ r := libc.readlink(PChar(fullname),@(e.LinkTarget[1]), sizeof(e.LinkTarget));
+ if r > 0 then
+ SetLength(e.LinkTarget, r)
+ else
+ e.LinkTarget := '';
+ libc.stat(PChar(fullname), info);
+ end;
+}
+end;
+
+
+end.
+
diff --git a/src/corelib/x11/x11_keyconv.pas b/src/corelib/x11/x11_keyconv.pas
index 297ff50b..fe25b7a4 100644
--- a/src/corelib/x11/x11_keyconv.pas
+++ b/src/corelib/x11/x11_keyconv.pas
@@ -6,8 +6,8 @@ interface
//
-// This conversion was taken from the OppenOffice 1.0.1 source code.
-procedure KeySymToUnicode(ks : longword; res : PWord);
+// This conversion was taken from the OpenOffice 1.0.1 source code.
+procedure KeySymToUnicode(ks: longword; res: PWord);
implementation