From fb5c2019e934a99dfa0f8d8d7642895295f35acf Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 30 Jun 2011 19:48:00 +0000 Subject: [PATCH] Various Mac OS X fixes for exceptions git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1724 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/lazimageeditor/createbundle.sh | 7 +++- .../lazimageeditor/lazimageeditor.lpi | 38 +++++++++++++++++-- .../lazimageeditor/lazimageeditor.pas | 4 +- applications/lazimageeditor/lieconstants.pas | 1 + applications/lazimageeditor/main.pas | 11 ++++-- 5 files changed, 51 insertions(+), 10 deletions(-) diff --git a/applications/lazimageeditor/createbundle.sh b/applications/lazimageeditor/createbundle.sh index d9b84c40a..09a2b3d96 100755 --- a/applications/lazimageeditor/createbundle.sh +++ b/applications/lazimageeditor/createbundle.sh @@ -56,6 +56,7 @@ else mkdir $appfolder/Contents mkdir $appfolder/Contents/MacOS mkdir $appfolder/Contents/Resources + mkdir $appfolder/Contents/Resources/images # # For a debug bundle, @@ -69,8 +70,10 @@ else fi # Copy the resource files to the correct place -# cp *.bmp $appfolder/Contents/Resources -# cp icon3.ico $appfolder/Contents/Resources +cp default.pal $appfolder/Contents/Resources/ +cp images/*.svg $appfolder/Contents/Resources/images +cp images/*.png $appfolder/Contents/Resources/images +cp images/*.ico $appfolder/Contents/Resources/images # cp icon3.png $appfolder/Contents/Resources # cp macicon.icns $appfolder/Contents/Resources # cp docs/*.* $appfolder/Contents/Resources diff --git a/applications/lazimageeditor/lazimageeditor.lpi b/applications/lazimageeditor/lazimageeditor.lpi index 463fa5a5e..8eeb77842 100644 --- a/applications/lazimageeditor/lazimageeditor.lpi +++ b/applications/lazimageeditor/lazimageeditor.lpi @@ -16,8 +16,39 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -154,7 +185,8 @@ - + + diff --git a/applications/lazimageeditor/lazimageeditor.pas b/applications/lazimageeditor/lazimageeditor.pas index 4f892ecd4..53fc5ba38 100644 --- a/applications/lazimageeditor/lazimageeditor.pas +++ b/applications/lazimageeditor/lazimageeditor.pas @@ -31,7 +31,9 @@ begin // show new picture dialog MainForm.Show; //MainForm.FileNewExecute(nil); - if ParamCount > 0 then + + // With OS X app, ParamStr not meaningful unless launched with --args switch. + if (ParamCount > 0) {$IFDEF DARWIN} and (Copy(ParamStr(1), 1, 4) <> '-psn') {$ENDIF} then MainForm.OpenImageFile(ParamStr(1)) else MainForm.FileNewOnStart; diff --git a/applications/lazimageeditor/lieconstants.pas b/applications/lazimageeditor/lieconstants.pas index fcbc63ccb..a31e1562e 100644 --- a/applications/lazimageeditor/lieconstants.pas +++ b/applications/lazimageeditor/lieconstants.pas @@ -9,6 +9,7 @@ uses const DefaultDirectory = '/usr/share/lazimageeditor/'; + BundleResourcesDirectory = '/Contents/Resources/'; SectionGeneral = 'General'; IdentLanguage = 'Language'; diff --git a/applications/lazimageeditor/main.pas b/applications/lazimageeditor/main.pas index 8d73c780b..14b52a1e4 100644 --- a/applications/lazimageeditor/main.pas +++ b/applications/lazimageeditor/main.pas @@ -33,7 +33,8 @@ uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus, ExtCtrls, ComCtrls, ActnList, StdActns, ExtDlgs, Buttons, StdCtrls, Spin, ColorBox, NewDialog, ResizeDialog, ResizePaperDialog, AboutDialog, DLBitmap, - PictureManager, PictureCtrls, ColorPalette; + PictureManager, PictureCtrls, ColorPalette, + appsettings; type @@ -1017,7 +1018,7 @@ begin UpdatePictureToolsEnabled; UpdateToolSettings; - Palette.LoadPalette('default.pal'); + Palette.LoadPalette(vConfigurations.MyDirectory + 'default.pal'); // Main Form Caption := lieMain; @@ -1182,9 +1183,11 @@ begin end; procedure TMainForm.FileNewOnStart; -var i: integer; +var + i: integer; begin - if ParamCount > 0 then + // With OS X app, ParamStr not meaningful unless launched with --args switch. + if (ParamCount > 0) {$IFDEF DARWIN} and (Copy(ParamStr(1), 1, 4) <> '-psn') {$ENDIF} then begin for i := 1 to ParamCount - 1 do Pictures.Load(ParamStr(i));