diff --git a/Info.plist b/Info.plist index b5d2a5aa..b2bfa1c1 100644 --- a/Info.plist +++ b/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable Grafx2 CFBundleIconFile - + Grafx2.icns CFBundleIdentifier com.googlecode.grafx2 CFBundleInfoDictionaryVersion diff --git a/doc/README.txt b/doc/README.txt index eab3e2f5..82f032f7 100644 --- a/doc/README.txt +++ b/doc/README.txt @@ -77,6 +77,7 @@ Sends greetings and glops to pouet.net : http://pouet.net/prod.php?which=51865 === HISTORY === Short revision history : + * 04/2011 2.3 Further improvements * 03/2010 2.2 Layers, Lua scripting * 09/2009 2.1 GUI improvements and some new features. * 06/2009 2.0 Completed the features planned by Sunset Design. diff --git a/install/WinInstaller_23.nsi b/install/WinInstaller_23.nsi new file mode 100644 index 00000000..cc8030a2 --- /dev/null +++ b/install/WinInstaller_23.nsi @@ -0,0 +1,338 @@ +;NSIS Modern User Interface +;Based on the Example Script written by Joost Verburg + +;-------------------------------- +;Include Modern UI + + !include "MUI2.nsh" + +;-------------------------------- +;General + + ;Name and file + Name "Grafx2" + OutFile "grafx2-2.3.1771.win32.exe" + + ;Default installation folder + InstallDir "$PROGRAMFILES\Grafx2" + + ;Get installation folder from registry if available + InstallDirRegKey HKCU "Software\Grafx2" "" + + ;Request application privileges for Windows Vista + RequestExecutionLevel user + +;-------------------------------- +;Interface Settings + + !define MUI_ABORTWARNING + +;-------------------------------- +;Pages + + !define MUI_WELCOMEFINISHPAGE_BITMAP vector.bmp + !define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH + !insertmacro MUI_PAGE_WELCOME + ;!define MUI_HEADERIMAGE_BITMAP logo_scenish.bmp + ;!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH + !insertmacro MUI_PAGE_LICENSE "..\doc\gpl-2.0.txt" + !insertmacro MUI_PAGE_COMPONENTS + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Functions + +Function .onInstSuccess + MessageBox MB_YESNO "Run GrafX2 now ?" IDNO norun + Exec $INSTDIR\bin\grafx2.exe + norun: +FunctionEnd + +;-------------------------------- +;Installer Sections + +Section "Grafx2" SecProgram + SectionIn RO + SetOutPath "$INSTDIR" + ;ADD YOUR OWN FILES HERE... + File ..\src-2.3.1771.tgz + SetOutPath "$INSTDIR\bin" + File ..\bin\grafx2.exe + File ..\bin\SDL_image.dll + File ..\bin\SDL.dll + File ..\bin\libfreetype-6.dll + File ..\bin\SDL_ttf.dll + File ..\bin\zlib1.dll + File ..\bin\libpng14-14.dll + SetOutPath "$INSTDIR\share\grafx2" + File ..\share\grafx2\gfx2.gif + File ..\share\grafx2\gfx2def.ini + SetOutPath "$INSTDIR\share\grafx2\skins" + File ..\share\grafx2\skins\font_Classic.png + File ..\share\grafx2\skins\font_DPaint.png + File ..\share\grafx2\skins\font_Fairlight.png + File ..\share\grafx2\skins\font_Fun.png + File ..\share\grafx2\skins\font_Melon.png + File ..\share\grafx2\skins\font_Seen.png + File ..\share\grafx2\skins\skin_Aurora.png + File ..\share\grafx2\skins\skin_classic.png + File ..\share\grafx2\skins\skin_DPaint.png + File ..\share\grafx2\skins\skin_modern.png + File ..\share\grafx2\skins\skin_scenish.png + SetOutPath "$INSTDIR\share\grafx2\scripts\samples_2.3\brush" + File ..\share\grafx2\scripts\samples_2.3\brush\ApplyColor.lua + File ..\share\grafx2\scripts\samples_2.3\brush\Fisheye.lua + File ..\share\grafx2\scripts\samples_2.3\brush\GrayscaleAvg.lua + File ..\share\grafx2\scripts\samples_2.3\brush\GrayscaleDesat.lua + File ..\share\grafx2\scripts\samples_2.3\brush\Halfsmooth.lua + File ..\share\grafx2\scripts\samples_2.3\brush\Waves.lua + SetOutPath "$INSTDIR\share\grafx2\scripts\samples_2.3\demo" + File ..\share\grafx2\scripts\samples_2.3\demo\3DPalette.lua + File ..\share\grafx2\scripts\samples_2.3\demo\Ellipse.lua + File ..\share\grafx2\scripts\samples_2.3\demo\FlipPicture.lua + File ..\share\grafx2\scripts\samples_2.3\demo\SierpinskyCarpet.lua + File ..\share\grafx2\scripts\samples_2.3\demo\SierpinskyTriangle.lua + File ..\share\grafx2\scripts\samples_2.3\demo\Spritesheet.lua + SetOutPath "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\brush" + File ..\share\grafx2\scripts\samples_2.3\demo\brush\Amigaball.lua + File ..\share\grafx2\scripts\samples_2.3\demo\brush\ColorSphere.lua + File ..\share\grafx2\scripts\samples_2.3\demo\brush\FindAA.lua + File ..\share\grafx2\scripts\samples_2.3\demo\brush\Mandelbrot.lua + SetOutPath "$INSTDIR\share\grafx2\scripts\samples_2.3\libs" + File ..\share\grafx2\scripts\samples_2.3\libs\dawnbringer_lib.lua + File ..\share\grafx2\scripts\samples_2.3\libs\memory.lua + SetOutPath "$INSTDIR\share\grafx2\scripts\samples_2.3\palette" + File ..\share\grafx2\scripts\samples_2.3\palette\Desaturate.lua + File ..\share\grafx2\scripts\samples_2.3\palette\ExpandColors.lua + File ..\share\grafx2\scripts\samples_2.3\palette\FillColorCube.lua + File ..\share\grafx2\scripts\samples_2.3\palette\InvertedRGB.lua + File ..\share\grafx2\scripts\samples_2.3\palette\Set3bit.lua + File ..\share\grafx2\scripts\samples_2.3\palette\Set6bit.lua + File ..\share\grafx2\scripts\samples_2.3\palette\SetC64Palette.lua + File ..\share\grafx2\scripts\samples_2.3\palette\ShiftHue.lua + SetOutPath "$INSTDIR\share\grafx2\scripts\samples_2.3\picture" + File ..\share\grafx2\scripts\samples_2.3\picture\CellColourReducer.lua + File ..\share\grafx2\scripts\samples_2.3\picture\DrawGridIsometric.lua + File ..\share\grafx2\scripts\samples_2.3\picture\DrawgridOrthogonal_Index.lua + File ..\share\grafx2\scripts\samples_2.3\picture\DrawGridOrthogonal_RGB.lua + File ..\share\grafx2\scripts\samples_2.3\picture\GlassGridFilter.lua + File ..\share\grafx2\scripts\samples_2.3\picture\PaletteToPicture.lua + File ..\share\grafx2\scripts\samples_2.3\picture\Pic2isometric.lua + File ..\share\grafx2\scripts\samples_2.3\picture\Rainbow-Dark2Bright.lua + File ..\share\grafx2\scripts\samples_2.3\picture\RemapImage2RGB.lua + File ..\share\grafx2\scripts\samples_2.3\picture\RemapImage2RGB_ed.lua + File ..\share\grafx2\scripts\samples_2.3\picture\RemapImageTo3bitPal.lua + File ..\share\grafx2\scripts\samples_2.3\picture\XBitColourXpaceFromPalette.lua + SetOutPath "$INSTDIR\doc" + File ..\doc\README.txt + File ..\doc\COMPILING.txt + File ..\doc\README-SDL_ttf.txt + File ..\doc\README-SDL.txt + File ..\doc\README-SDL_image.txt + File ..\doc\README-zlib1.txt + File ..\doc\README-lua.txt + File ..\doc\gpl-2.0.txt + SetOutPath "$INSTDIR\share\grafx2\fonts" + File ..\share\grafx2\fonts\8pxfont.png + File ..\share\grafx2\fonts\Tuffy.ttf + File ..\share\grafx2\fonts\PF_Arma_5__.png + File ..\share\grafx2\fonts\PF_Easta_7_.png + File ..\share\grafx2\fonts\PF_Easta_7__.png + File ..\share\grafx2\fonts\PF_Ronda_7__.png + File ..\share\grafx2\fonts\PF_Tempesta_5.png + File ..\share\grafx2\fonts\PF_Tempesta_5_.png + File ..\share\grafx2\fonts\PF_Tempesta_5__.png + File ..\share\grafx2\fonts\PF_Tempesta_5___.png + File ..\share\grafx2\fonts\PF_Tempesta_7.png + File ..\share\grafx2\fonts\PF_Tempesta_7_.png + File ..\share\grafx2\fonts\PF_Tempesta_7__.png + File ..\share\grafx2\fonts\PF_Tempesta_7___.png + File ..\share\grafx2\fonts\PF_Westa_7_.png + File ..\share\grafx2\fonts\PF_Westa_7__.png + + ; Register in Add/Remove programs + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "DisplayName" "GrafX2 (GNU GPL)" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "InstalledProductName" "GrafX2" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "InstalledLocation" $INSTDIR + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "DisplayIcon" "$INSTDIR\gfx2.ico" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "URLInfoAbout" "http://grafx2.googlecode.com" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "DisplayVersion" "2.3.1771" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "NoModify" 1 + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \ + "NoRepair" 1 + + ;Store installation folder + WriteRegStr HKLM "Software\Grafx2" "" $INSTDIR + + ;Create uninstaller + WriteUninstaller "$INSTDIR\Uninstall.exe" + +SectionEnd + +Section "Desktop shortcut" SecShortcut + + SetOutPath "$INSTDIR" + CreateShortCut "$DESKTOP\Grafx2.lnk" "$INSTDIR\bin\grafx2.exe" "" "" "" SW_SHOWNORMAL + +SectionEnd + + +;-------------------------------- +;Descriptions + + ;Language strings + LangString DESC_SecProgram ${LANG_ENGLISH} "Grafx2 application and runtime data." + LangString DESC_SecShortcut ${LANG_ENGLISH} "Desktop shortcut." + + ;Assign language strings to sections + !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SecProgram} $(DESC_SecProgram) + !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcut} $(DESC_SecShortcut) + !insertmacro MUI_FUNCTION_DESCRIPTION_END + +;-------------------------------- +;Uninstaller Section + +Section "un.SecProgram" + + ;ADD YOUR OWN FILES HERE... + Delete "$INSTDIR\bin\grafx2.exe" + Delete "$INSTDIR\src-2.3.1771.tgz" + Delete "$INSTDIR\share\grafx2\gfx2.gif" + Delete "$INSTDIR\share\grafx2\gfx2def.ini" + Delete "$INSTDIR\bin\SDL_image.dll" + Delete "$INSTDIR\bin\SDL.dll" + Delete "$INSTDIR\bin\libfreetype-6.dll" + Delete "$INSTDIR\bin\SDL_ttf.dll" + Delete "$INSTDIR\bin\zlib1.dll" + Delete "$INSTDIR\bin\libpng14-14.dll" + Delete "$INSTDIR\bin\stdout.txt" + Delete "$INSTDIR\bin\stderr.txt" + RMDir "$INSTDIR\bin" + Delete "$INSTDIR\doc\README.txt" + Delete "$INSTDIR\doc\COMPILING.txt" + Delete "$INSTDIR\doc\README-SDL_ttf.txt" + Delete "$INSTDIR\doc\README-SDL.txt" + Delete "$INSTDIR\doc\README-SDL_image.txt" + Delete "$INSTDIR\doc\README-zlib1.txt" + Delete "$INSTDIR\doc\README-lua.txt" + Delete "$INSTDIR\doc\gpl-2.0.txt" + RMDir "$INSTDIR\doc" + Delete "$INSTDIR\share\grafx2\fonts\8pxfont.png" + Delete "$INSTDIR\share\grafx2\fonts\Tuffy.ttf" + Delete "$INSTDIR\share\grafx2\fonts\PF_Arma_5__.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Easta_7_.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Easta_7__.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Ronda_7__.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_5.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_5_.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_5__.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_5___.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_7.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_7_.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_7__.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Tempesta_7___.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Westa_7_.png" + Delete "$INSTDIR\share\grafx2\fonts\PF_Westa_7__.png" + RMDir "$INSTDIR\share\grafx2\fonts" + Delete "$INSTDIR\share\grafx2\skins\font_Classic.png" + Delete "$INSTDIR\share\grafx2\skins\font_Fun.png" + Delete "$INSTDIR\share\grafx2\skins\font_Fairlight.png" + Delete "$INSTDIR\share\grafx2\skins\font_Melon.png" + Delete "$INSTDIR\share\grafx2\skins\font_DPaint.png" + Delete "$INSTDIR\share\grafx2\skins\font_Seen.png" + Delete "$INSTDIR\share\grafx2\skins\skin_classic.png" + Delete "$INSTDIR\share\grafx2\skins\skin_Aurora.png" + Delete "$INSTDIR\share\grafx2\skins\skin_modern.png" + Delete "$INSTDIR\share\grafx2\skins\skin_DPaint.png" + Delete "$INSTDIR\share\grafx2\skins\skin_scenish.png" + RMDir "$INSTDIR\share\grafx2\skins" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\brush\ApplyColor.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\brush\Fisheye.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\brush\GrayscaleAvg.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\brush\GrayscaleDesat.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\brush\Halfsmooth.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\brush\Waves.lua" + RMDir "$INSTDIR\share\grafx2\scripts\samples_2.3\brush" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\brush\Amigaball.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\brush\ColorSphere.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\brush\FindAA.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\brush\Mandelbrot.lua" + RMDir "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\brush" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\3DPalette.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\Ellipse.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\FlipPicture.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\SierpinskyCarpet.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\SierpinskyTriangle.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\demo\Spritesheet.lua" + RMDir "$INSTDIR\share\grafx2\scripts\samples_2.3\demo" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\libs\dawnbringer_lib.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\libs\memory.lua" + RMDir "$INSTDIR\share\grafx2\scripts\samples_2.3\libs" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\Desaturate.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\ExpandColors.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\FillColorCube.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\InvertedRGB.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\Set3bit.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\Set6bit.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\SetC64Palette.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\palette\ShiftHue.lua" + RMDir "$INSTDIR\share\grafx2\scripts\samples_2.3\palette" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\CellColourReducer.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\DrawGridIsometric.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\DrawgridOrthogonal_Index.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\DrawGridOrthogonal_RGB.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\GlassGridFilter.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\PaletteToPicture.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\Pic2isometric.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\Rainbow-Dark2Bright.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\RemapImage2RGB.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\RemapImage2RGB_ed.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\RemapImageTo3bitPal.lua" + Delete "$INSTDIR\share\grafx2\scripts\samples_2.3\picture\XBitColourXpaceFromPalette.lua" + RMDir "$INSTDIR\share\grafx2\scripts\samples_2.3\picture" + RMDir "$INSTDIR\share\grafx2\scripts\samples_2.3" + RMDir "$INSTDIR\share\grafx2\scripts" + RMDir "$INSTDIR\share\grafx2" + RMDir "$INSTDIR\share" + Delete "$INSTDIR\Uninstall.exe" + + MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION "Do you wish to keep your configuration settings ?" IDYES keepconfig IDNO deleteconfig + deleteconfig: + Delete "$INSTDIR\gfx2.cfg" + Delete "$INSTDIR\gfx2.ini" + Delete "$APPDATA\Grafx2\gfx2.cfg" + Delete "$APPDATA\Grafx2\gfx2.ini" + RMDir "$APPDATA\Grafx2" + keepconfig: + + RMDir "$INSTDIR" + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" + + DeleteRegKey /ifempty HKLM "Software\Grafx2" + +SectionEnd + +Section "un.SecShortcut" + Delete "$DESKTOP\Grafx2.lnk" +SectionEnd + diff --git a/install/vector.bmp b/install/vector.bmp new file mode 100644 index 00000000..f9d153b8 Binary files /dev/null and b/install/vector.bmp differ diff --git a/misc/unix/grafx2.1 b/misc/unix/grafx2.1 index 1ea6c72a..7219d61c 100644 --- a/misc/unix/grafx2.1 +++ b/misc/unix/grafx2.1 @@ -1,4 +1,4 @@ -.TH GRAFX2 1 "February 23, 2009" +.TH GRAFX2 1 "April 14, 2011" .SH NAME grafx2 \- Ultimate 256-color bitmap paint program .SH SYNOPSIS @@ -23,24 +23,40 @@ little more difficult for you, but you should give it a try (or more, because most of the power of this program won't show up on the first try). .SH OPTIONS A summary of options is included below. +They can be prefixed by either / - or -- .TP -.B /?, /h, /help +.B -?, -h, -help Show summary of options. .TP -.B /wide +.B -wide To emulate a video mode with wide pixels (2 x 1). .TP -.B /tall +.B -tall To emulate a video mode with tall pixels (1 x 2). .TP -.B /double +.B -double To emulate a video mode with double pixels (2 x 2). .TP -.B /skin +.B -wide2 +To emulate a video mode with double wide pixels (4 x 2). +.TP +.B -tall2 +To emulate a video mode with double tall pixels (2 x 4). +.TP +.B -triple +To emulate a video mode with triple pixels (3 x 3). +.TP +.B -quadruple +To emulate a video mode with quadruple pixels (4 x 4). +.TP +.B -rgb +To reduce RGB precision from 256 to n levels. +.TP +.B -skin Use an alternate file for the menu graphics. .TP -.B /mode -To set a video mode listed with the /help parameter. +.B -mode +To set a video mode listed with the -help parameter. .SH FILES User settings are stored in ~/.grafx2/gfx2.ini. This file is really meant to be edited by the user and allows to tweak many aspects of the program. diff --git a/share/grafx2/gfx2def.ini b/share/grafx2/gfx2def.ini index b05c8ef8..3d9f6728 100644 --- a/share/grafx2/gfx2def.ini +++ b/share/grafx2/gfx2def.ini @@ -364,6 +364,7 @@ ; When this mode is active, scrolling the view (and the magnifier view) ; affects both the main image and the spare page - as long as they have ; the same dimensions. + ; Sync_views = YES; (Default YES) ; This setting determines which key inverts the mouse buttons @@ -371,7 +372,19 @@ ; It's especially useful for one-button controllers, ; such as touchscreens and tablets. ; Possible values are 0 (none), 1 (control), 2 (alt) - + ; Swap_buttons = 1; (Default 1) + ; Last directory browsed with the script selector. + ; Leave blank to initially start in (data directory)/scripts + ; + Scripts_directory = + + ; When this setting is disabled, and you create a shortcut with a key that + ; is already associated to another shortcut, Grafx2 will unset the latter. + ; If you enable this mode, Grafx2 will not make such check, so you can design + ; shortcuts that trigger several actions at once. + ; + Allow_multi_shortcuts = no; (Default no) + ; end of configuration diff --git a/share/grafx2/scripts/samples_2.3/brush/ApplyColor.lua b/share/grafx2/scripts/samples_2.3/brush/ApplyColor.lua new file mode 100644 index 00000000..3da26c1d --- /dev/null +++ b/share/grafx2/scripts/samples_2.3/brush/ApplyColor.lua @@ -0,0 +1,124 @@ +--BRUSH Remap: Apply PenColor +--by Richard Fhager +--http://hem.fyristorg.com/dawnbringer/ + +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + +dofile("../libs/dawnbringer_lib.lua") + +OK,tin,clz,fade,amt,brikeep,falloff,nobg,briweight = inputbox("Apply PenColor 2 Brush", + + "1. Tint", 1, 0,1,-1, + "2. Colorize", 0, 0,1,-1, + "BG->FG color Fade", 0, 0,1,0, + "AMOUNT % (0-100)", 100, 0,100,0, + "Preserve Brightness", 1, 0,1,0, + "Bri/Dark FallOff", 1, 0,1,0, + "Exclude Background", 1,0,1,0, + "ColMatch Bri-Weight %", 25, 0,100,0 +); + + +if OK == true then + + function cap(v) return math.min(255,math.max(v,0)); end + + w, h = getbrushsize() + + + fg = getforecolor() + bg = getbackcolor() + fR,fG,fB = getcolor(fg) + bR,bG,bB = getcolor(bg) + + pal = db.fixPalette(db.makePalList(256)) + if nobg == 1 then + pal = db.stripIndexFromPalList(pal,bg) -- Remove background color from pallist + end + + amtA = amt / 100 + amtR = 1 - amtA + + -- Normalize Pen Color + lev = (fR+fG+fB)/3 + fR = fR - lev + fG = fG - lev + fB = fB - lev + + --------------------------------------------------- + -- Colorize (Colourant) (just apply colorbalance) + -- Tint (make grayscale and apply colorbalance) + -- + -- I think it should be the other way around since colorize is the process of adding color to B&W film... + -- But this is the what Brilliance and others call it + -- + if clz == 1 or tin == 1 then + cols = {} + for n = 0, 255, 1 do + + r,g,b = getcolor(n) + a = db.getBrightness(r,g,b) + + + mR,mG,mB = fR,fG,fB + + -- Fade between bg & fg pencolor across dark-bright + if fade == 1 then + lf = a / 255 + lr = 1 - lf + mR = bR*lr + fR*lf + mG = bG*lr + fG*lf + mB = bB*lr + fB*lf + lev = (mR+mG+mB)/3 + mR = mR - lev + mG = mG - lev + mB = mB - lev + end + + fr,fg,fb = mR,mG,mB + + + if brikeep == 1 then + -- Loose Brightness preservation (ex: applying full red to dark colors) + brin = db.getBrightness(cap(r+mR),cap(g+mG),cap(b+mB)) + itot = brin - a + fr = mR - itot + fg = mG - itot + fb = mB - itot + end + + -- Falloff (Effect weakens at dark and bright colors) + if falloff == 1 then + fo = 1 - math.abs((a - 127.5)/127.5)^2 + fr = fr * fo + fg = fg * fo + fb = fb * fo + end + + if tin == 1 then + --cols[n+1] = matchcolor((a+fr)*amtA + r*amtR, (a+fg)*amtA + g*amtR, (a+fb)*amtA + b*amtR) + cols[n+1] = db.getBestPalMatchHYBRID({(a+fr)*amtA+r*amtR, (a+fg)*amtA + g*amtR, (a+fb)*amtA + b*amtR},pal,briweight / 100,true) + end + if clz == 1 then + --cols[n+1] = matchcolor((r+fr)*amtA + r*amtR, (g+fg)*amtA + g*amtR, (b+fb)*amtA + b*amtR) + cols[n+1] = db.getBestPalMatchHYBRID({(r+fr)*amtA+r*amtR, (g+fg)*amtA + g*amtR, (b+fb)*amtA + b*amtR},pal,briweight / 100,true) + end + end + + if nobg == 1 then cols[getbackcolor()+1] = getbackcolor(); end + + for x = 0, w - 1, 1 do + for y = 0, h - 1, 1 do + putbrushpixel(x, y, cols[getbrushpixel(x,y) + 1]); + end + end +end; +-- eof Colorize & Tint +-------------------------------------------------------- + +end -- OK diff --git a/share/grafx2/scripts/bru_db_Fisheye.lua b/share/grafx2/scripts/samples_2.3/brush/Fisheye.lua similarity index 100% rename from share/grafx2/scripts/bru_db_Fisheye.lua rename to share/grafx2/scripts/samples_2.3/brush/Fisheye.lua diff --git a/share/grafx2/scripts/bru_db_GrayscaleAvg.lua b/share/grafx2/scripts/samples_2.3/brush/GrayscaleAvg.lua similarity index 100% rename from share/grafx2/scripts/bru_db_GrayscaleAvg.lua rename to share/grafx2/scripts/samples_2.3/brush/GrayscaleAvg.lua diff --git a/share/grafx2/scripts/bru_db_GrayscaleDesat.lua b/share/grafx2/scripts/samples_2.3/brush/GrayscaleDesat.lua similarity index 100% rename from share/grafx2/scripts/bru_db_GrayscaleDesat.lua rename to share/grafx2/scripts/samples_2.3/brush/GrayscaleDesat.lua diff --git a/share/grafx2/scripts/bru_db_Halfsmooth.lua b/share/grafx2/scripts/samples_2.3/brush/Halfsmooth.lua similarity index 100% rename from share/grafx2/scripts/bru_db_Halfsmooth.lua rename to share/grafx2/scripts/samples_2.3/brush/Halfsmooth.lua diff --git a/share/grafx2/scripts/bru_db_Waves.lua b/share/grafx2/scripts/samples_2.3/brush/Waves.lua similarity index 100% rename from share/grafx2/scripts/bru_db_Waves.lua rename to share/grafx2/scripts/samples_2.3/brush/Waves.lua diff --git a/share/grafx2/scripts/samples_2.3/demo/3DPalette.lua b/share/grafx2/scripts/samples_2.3/demo/3DPalette.lua new file mode 100644 index 00000000..b496240d --- /dev/null +++ b/share/grafx2/scripts/samples_2.3/demo/3DPalette.lua @@ -0,0 +1,431 @@ +--3D-Palette viwer V0.7 (HSL-models added, 3D-World added, Pen-color only cycles thru unique colors, InputBox) +--by Richard 'Dawnbringer' Fhager + +-- Mouse: Rotate Cube (Stops animation) +-- Arrow-keys: Move Cube (in 3D world) +-- F1: Start/Stop animation +-- F2: Reset +-- F3: Increase Color-Size +-- F4: Decrease Color-Size +-- F5: (Wip) Cycle thru selected PenColor (Note that only unique colors are displayed) +-- F9: RGB-space model +--F10: HSL-space model +--F11: HSLcubic-space model +-- "+" (Num): Zoom In +-- "-" (Num): Zoom Out +-- Esc: Exit script + +dofile("../libs/dawnbringer_lib.lua") + + +BRIDIAG_SHOW = 1 -- Show brightness/Grayscale diagonal (1 = on, 0 = off) +ANIM = 1 -- Animation (1 = on, 0 = off) +BOX_DRK = 8 -- Darkest color used for box (0-255) +BOX_BRI = 112 -- Brightest color used for box (0-255) +COLSIZE_BASE = 26 -- Colors base size (value to adjusted by palette-size, with 2 cols maxsize is v / 1.23) + +-- +OK,RGB,HSL,HSLC,BOX_BRI,COLSIZE_BASE,SET800x600 = inputbox("3D-Palette Viever Settings", + + "1. RGB space [F9]", 1, 0,1,-1, + "2. HSL space [F10]", 0, 0,1,-1, + "3. HSL-cubic space [F11]",0, 0,1,-1, + "Box Brightness (16-255)", BOX_BRI, 16,255,0, + "Col Size (1-100) [F3/F4]", COLSIZE_BASE, 1,100,0, + "Set Screen to 800x600", 1,0,1,0 + +); +-- + +if OK then + + if SET800x600 == 1 then setpicturesize(800,600); end + + SPACE = "rgb" + FORM = "cube" + if HSL == 1 then + SPACE = "hsl" + FORM = "cylinder" + end + if HSLC == 1 then + SPACE = "hsl_cubic" + FORM = "cube" + end + + +pal = db.fixPalette(db.makePalList(256)) + +FG = getforecolor() +BG = getbackcolor() + +palcol = FG + +-- +function initColors(space) + for n = 1, #pal, 1 do + c = pal[n]; + if space == "rgb" then + cols[n] = {c[1]/128-1,c[2]/128-1,c[3]/128-1,c[4]}; + end + if space == "hsl_cubic" then + cols[n] = {} + cols[n][1] = (db.getHUE(c[1],c[2],c[3],0) / 6.0 * 255) / 128 - 1 + cols[n][2] = (db.getSaturation(c[1],c[2],c[3])) / 128 - 1 + cols[n][3] = (db.getLightness(c[1],c[2],c[3])) / 128 - 1 + cols[n][4] = c[4] + end + if space == "hsl" then + cols[n] = {} + hue = db.getHUE(c[1],c[2],c[3],0) / 6.0 * math.pi*2 + rad = db.getSaturation(c[1],c[2],c[3]) / 256 + cols[n][1] = math.cos(hue) * rad + cols[n][2] = math.sin(hue) * rad + cols[n][3] = (db.getLightness(c[1],c[2],c[3])) / 128 - 1 + cols[n][4] = c[4] + end + end +end +-- + +cols = {} -- Make points of palette colors +colz = {} -- To hold calculated points +initColors(SPACE) + + +function initPointsAndLines(form,bridiag) + if form == "cube" then + pts = {{-1,1,-1},{1,1,-1},{1,-1,-1},{-1,-1,-1}, -- The box + {-1,1, 1},{1,1, 1},{1,-1, 1},{-1,-1, 1}} + lin = {{1,2},{2,3},{3,4},{4,1},{5,6},{6,7},{7,8},{8,5},{1,5},{2,6},{3,7},{4,8}} -- Box Lines + if bridiag == 1 then lin[13] = {4,6}; end + end + if form == "cylinder" then + p = 28 + pts = {} + lin = {} + for n = 1, p, 1 do + x = math.cos(math.pi*2 / p * (n-1)) + y = math.sin(math.pi*2 / p * (n-1)) + pts[n] = {x,y,-1} + lin[n] = {n,1 + (n%p)} + pts[n + p] = {x,y,1} + lin[n + p] = {n+p,p + 1 + (n%p)} + end + lin[p*2+1] = {1,p+1} -- Red (0 degrees) + lin[p*2+2] = {p+1,p+1+math.ceil(p/2)} -- Lightness end (needs an even # of points to work) + end +end + +boxp = {} -- To hold the calculated points +initPointsAndLines(FORM,BRIDIAG_SHOW) + +w,h = getpicturesize() +CX,CY = w/2, h/2 + + + +function initAndReset() + XANG, YANG, ZANG, ZOOM, COLSIZE_ADJ, XD, YD, WORLD_X, WORLD_Y = 0,0,0,0,0,0,0,0,0 +end + +initAndReset() + +SIZE = math.min(w,h)/4 +DIST = 5 -- Distance perspective modifier, ~5 is nominal, more means "less 3D" + +CMAXSIZE = math.floor(COLSIZE_BASE / ((#pal)^0.3)) +--CMAXSIZE = 8 +CMINSIZE = 1 -- Negative values are ok. Color are never smaller than 1 pix + +BOX_LINE_DIV = 20 -- Number of colors/segments that a box-line can be divided into (depth) +BOX_DIV_MULT = BOX_LINE_DIV / (math.sqrt(3)*2) + +-- Box depth colors +box_div = {} +for n = 0, BOX_LINE_DIV-1, 1 do + c = BOX_DRK + (BOX_BRI / (BOX_LINE_DIV - 1)) * n + --box_div[BOX_LINE_DIV - n] = matchcolor(c,c,c) + box_div[BOX_LINE_DIV - n] = db.getBestPalMatchHYBRID({c,c,c},pal,0.5,true) +end + +--BOX_COL = matchcolor(80,80,80) +BKG_COL = matchcolor(0,0,0) +--CUR_COL = matchcolor(112,112,112) + + + function rotate3D(x,y,z,Xsin,Ysin,Zsin,Xcos,Ycos,Zcos) -- PrecCalced cos&sin for speed + + local x1,x2,x3,y1,y2,y3,f,xp,yp + + x1 = x + y1 = y * Xcos + z * Xsin + z1 = z * Xcos - y * Xsin + + x2 = x1 * Ycos - z1 * Ysin + y2 = y1 + z2 = x1 * Ysin + z1 * Ycos + + x3 = x2 * Zcos - y2 * Zsin + y3 = x2 * Zsin + y2 * Zcos + z3 = z2 + + return x3,y3,z3 + end + + function do3D(x,y,z,zoom,dist,Xsin,Ysin,Zsin,Xcos,Ycos,Zcos) -- PrecCalced cos&sin for speed + + local x1,x2,x3,y1,y2,y3,f,xp,yp + + x1 = x + y1 = y * Xcos + z * Xsin + z1 = z * Xcos - y * Xsin + + x2 = x1 * Ycos - z1 * Ysin + y2 = y1 + z2 = x1 * Ysin + z1 * Ycos + + x3 = x2 * Zcos - y2 * Zsin + y3 = x2 * Zsin + y2 * Zcos + z3 = z2 + + f = dist/(z3 + dist + zoom) + xp = x3 * f + yp = y3 * f + + return xp,yp,z3 + end + + +function draw3Dline(x1,y1,z1,x2,y2,z2,div,mult,depthlist) + local s,xt,yt,xd,yd,zd,xf,yf + xd = (x2 - x1) / div + yd = (y2 - y1) / div + zd = (z2 - z1) / div + xf,yf = x1,y1 + + for s = 1, div, 1 do + -- Depth assumes a 1-Box (z ranges from -sq(3) to sq(3)) + depth = math.floor(1 + (z1+zd*s + 1.732) * mult) + xt = x1 + xd*s -- + math.random()*8 + yt = y1 + yd*s -- + math.random()*8 + c = depthlist[depth] + if c == null then c = 1; end -- Something isn't perfect, error is super rare but this controls it + drawline(xf,yf,xt,yt,c) + xf = xt + yf = yt + end +end + +function killinertia() + XD = 0 + YD = 0 +end + + -- If using 1-box, z is -sq(3) to sq(3) + minz = math.sqrt(3) + totz = minz * 2 + maxrad = CMAXSIZE - CMINSIZE + +q = 0 +delay = 4 +move = 0.03 + +while 1 < 2 do + + -- Time-for-space-wiggle...or somekindof attempt + --WORLD_X = -move + --q = (q + 1) % delay + --if q < delay/2 then WORLD_X = move; end + + clearpicture(BKG_COL) + + Xsin = math.sin(XANG); Xcos = math.cos(XANG) + Ysin = math.sin(YANG); Ycos = math.cos(YANG) + Zsin = math.sin(ZANG); Zcos = math.cos(ZANG) + + -- Rotate Box points + for n = 1, #pts, 1 do + p = pts[n] + x,y,z = p[1],p[2],p[3] + XP,YP,zp = rotate3D(x,y,z,Xsin,Ysin,Zsin,Xcos,Ycos,Zcos) + boxp[n] = {XP,YP,zp} + end + + -- Rotate Colors in palette + for n = 1, #cols, 1 do + p = cols[n] + x,y,z,c = p[1],p[2],p[3],p[4] + XP,YP,zp = rotate3D(x,y,z,Xsin,Ysin,Zsin,Xcos,Ycos,Zcos) + colz[n] = {XP,YP,zp,c} + end + + ------------------------------------ + -- Control world + ------------------------------------ + + -- Calculate points anew + + -- Worldize Box points + for n = 1, #boxp, 1 do + s = SIZE + v = boxp[n] + x = v[1] + WORLD_X + y = v[2] + WORLD_Y + z = v[3] + f = DIST/(z + DIST + ZOOM) + XP = CX + x * f * s + YP = CY + y * f * s + boxp[n] = {XP,YP,z} + end + + -- Worldize Colors in palette + for n = 1, #colz, 1 do + s = SIZE + v = colz[n] + x = v[1] + WORLD_X + y = v[2] + WORLD_Y + z = v[3] + c = v[4] + f = DIST/(z + DIST + ZOOM) + XP = CX + x * f * s + YP = CY + y * f * s + colz[n] = {XP,YP,z,c} + end + + +------------------------------------- +------------------------------------- + + -- Brightness Diagonal + --if BRIDIAG_SHOW == 1 then + -- p1 = boxp[4] + -- p2 = boxp[6] + -- x1,y1,z1 = p1[1],p1[2],p1[3] + -- x2,y2,z2 = p2[1],p2[2],p2[3] + -- draw3Dline(x1,y1,z1,x2,y2,z2,BOX_LINE_DIV,BOX_DIV_MULT,box_div) + --end + + -- sort on z + db.sorti(colz,3) + + -- Draw colors + for n = #colz, 1, -1 do + p = colz[n] + XP,YP,zp,c = p[1],p[2],p[3],p[4] + + radius = CMINSIZE + maxrad - (zp+minz) / totz * maxrad + dorad = math.floor(radius - ZOOM*2 + COLSIZE_ADJ) + + if dorad >= 1 then + drawdisk(XP,YP,dorad,c) + --db.drawRectangle(XP,YP,dorad,dorad,c) + else putpicturepixel(XP,YP,c) + end + + if c == FG or c == BG then + sz = math.max(3,dorad + 3) + if c == BKG_COL then v = (c+128) % 255; c = matchcolor(v,v,v); end + db.drawRectangleLine(XP-sz,YP-sz,sz*2,sz*2,c) + end + + end -- colz + + + + -- Draw box + for n = 1, #lin, 1 do + + l = lin[n] + p1 = boxp[l[1]] + p2 = boxp[l[2]] + x1,y1,z1 = p1[1],p1[2],p1[3] + x2,y2,z2 = p2[1],p2[2],p2[3] + draw3Dline(x1,y1,z1,x2,y2,z2,BOX_LINE_DIV,BOX_DIV_MULT,box_div) + + end -- eof box + + --updatescreen(); if (waitbreak(0.00)==1) then return; end + + repeat + + old_key = key; + old_mouse_x = mouse_x; + old_mouse_y = mouse_y; + old_mouse_b = mouse_b; + + updatescreen() + moved, key, mouse_x, mouse_y, mouse_b = waitinput(0) + + if mouse_b == 1 then ANIM = 0; end + + if (key==27) then + return; + end + + if (key==282) then ANIM = (ANIM+1) % 2; end -- F1: Stop/Start Animation + if (key==283) then initAndReset(); end -- F2: Reset all values + if (key==284) then COLSIZE_ADJ = COLSIZE_ADJ + 0.5; end -- F3 + if (key==285) then COLSIZE_ADJ = COLSIZE_ADJ - 0.5; end -- F4 + + if (key==286) then + --FG = (FG + 1) % 255; + palcol = (palcol + 1) % #pal + FG = pal[palcol+1][4] + setforecolor(FG); + setcolor(0,getcolor(0)) -- Force update of palette until setforecolor() is fixed + end -- F5 + + if (key==290) then -- F9 + initColors("rgb") + initPointsAndLines("cube",BRIDIAG_SHOW) + end + if (key==291) then -- F10 + initColors("hsl") + initPointsAndLines("cylinder", 0) -- Bridiag won't show even if turned on, it's only for cube + end + if (key==292) then -- F11 + initColors("hsl_cubic") + initPointsAndLines("cube",BRIDIAG_SHOW) + end + + if (key==269) then ZOOM = ZOOM + 0.1; end + if (key==270) then ZOOM = ZOOM - 0.1; end + SPEED = math.pi / 100 + + + if (key==273) then WORLD_Y = WORLD_Y - 0.05; killinertia(); end + if (key==274) then WORLD_Y = WORLD_Y + 0.05; killinertia(); end + + if (key==276) then WORLD_X = WORLD_X - 0.05; killinertia(); end + if (key==275) then WORLD_X = WORLD_X + 0.05; killinertia(); end + + until ((mouse_b == 1 and (old_mouse_x~=mouse_x or old_mouse_y~=mouse_y)) or key~=0 or ANIM==1 or math.abs(XD)>0.01 or math.abs(YD)>0.01); + + if ANIM == 0 then + if (mouse_b==1 and (old_mouse_x~=mouse_x or old_mouse_y~=mouse_y)) then -- Inertia + XD = (mouse_y - old_mouse_y)*0.005 + YD = (mouse_x - old_mouse_x)*0.005 + else + XD = XD*0.92 + YD = YD*0.92 + end + XANG = ((XANG - XD) % (math.pi*2)); + YANG = ((YANG + YD) % (math.pi*2)); + ZANG = 0 + end + + if ANIM == 1 then + XANG = (XANG + math.pi/300) % (math.pi*2) + YANG = (YANG + math.pi/500) % (math.pi*2) + ZANG = (ZANG + math.pi/1000) % (math.pi*2) + end + + --XANG = ((CY-mouse_y) / 200 % (math.pi*2)); + --YANG = ((mouse_x - CX) / 200 % (math.pi*2)); + --ZANG = 0 + + + statusmessage("X: "..math.floor(XANG*57.3).."°, Y: "..math.floor(YANG*57.3).."°, Z: "..math.floor(ZANG*57.3).."°, Zoom: "..math.floor(-ZOOM*10).." ") +end + +end -- OK diff --git a/share/grafx2/scripts/ani_db_ellipse.lua b/share/grafx2/scripts/samples_2.3/demo/Ellipse.lua similarity index 84% rename from share/grafx2/scripts/ani_db_ellipse.lua rename to share/grafx2/scripts/samples_2.3/demo/Ellipse.lua index fe8da2f2..f24df21c 100644 --- a/share/grafx2/scripts/ani_db_ellipse.lua +++ b/share/grafx2/scripts/samples_2.3/demo/Ellipse.lua @@ -23,18 +23,7 @@ function ellipse2(x,y,a,b,stp,rot,col) sa = m.sin(ast*n) * b; ca = m.cos(ast*n) * a x1 = x + ca * cb - sa * sb y1 = y + ca * sb + sa * cb - if (n > 0) then line(ox,oy,x1,y1,col); end - end -end --- - --- -function line(x1,y1,x2,y2,c) - local n,st,m; m = math - st = m.max(1,m.abs(x2-x1),m.abs(y2-y1)); - for n = 0, st, 1 do - putpicturepixel(m.floor(x1+n*(x2-x1)/st), m.floor(y1+n*(y2-y1)/st), -c ); + if (n > 0) then drawline(ox,oy,x1,y1,col); end end end -- diff --git a/share/grafx2/scripts/pic_ni_flippicture.lua b/share/grafx2/scripts/samples_2.3/demo/FlipPicture.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_flippicture.lua rename to share/grafx2/scripts/samples_2.3/demo/FlipPicture.lua diff --git a/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua b/share/grafx2/scripts/samples_2.3/demo/SierpinskyCarpet.lua similarity index 100% rename from share/grafx2/scripts/pic_db_SierpinskyCarpet.lua rename to share/grafx2/scripts/samples_2.3/demo/SierpinskyCarpet.lua diff --git a/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua b/share/grafx2/scripts/samples_2.3/demo/SierpinskyTriangle.lua similarity index 100% rename from share/grafx2/scripts/pic_db_SierpinskyTriangle.lua rename to share/grafx2/scripts/samples_2.3/demo/SierpinskyTriangle.lua diff --git a/share/grafx2/scripts/ani_db_spritesheet.lua b/share/grafx2/scripts/samples_2.3/demo/Spritesheet.lua similarity index 91% rename from share/grafx2/scripts/ani_db_spritesheet.lua rename to share/grafx2/scripts/samples_2.3/demo/Spritesheet.lua index 9c964047..171dcfaa 100644 --- a/share/grafx2/scripts/ani_db_spritesheet.lua +++ b/share/grafx2/scripts/samples_2.3/demo/Spritesheet.lua @@ -2,12 +2,11 @@ --Spare page holds data - Plays on current --by Richard Fhager -require("memory") +dofile("../libs/memory.lua") arg=memory.load({XS=16,YS=16,SPACE=1,FRAMES=8,XOFF=0,YOFF=0,FPS=10}) -OK, XS, YS, SPACE, FRAMES, XOFF, YOFF, FPS = inputbox("Sprite-Sheet -Animator", +OK, XS, YS, SPACE, FRAMES, XOFF, YOFF, FPS = inputbox("Sprite-Sheet Animator", "Sprite X-size", arg.XS, 1, 256,0, "Sprite Y-size", arg.YS, 1, 256,0, "Spacing", arg.SPACE, 0, 32,0, diff --git a/share/grafx2/scripts/bru_db_Amigaball.lua b/share/grafx2/scripts/samples_2.3/demo/brush/Amigaball.lua similarity index 92% rename from share/grafx2/scripts/bru_db_Amigaball.lua rename to share/grafx2/scripts/samples_2.3/demo/brush/Amigaball.lua index 0ed613ad..115a34a9 100644 --- a/share/grafx2/scripts/bru_db_Amigaball.lua +++ b/share/grafx2/scripts/samples_2.3/demo/brush/Amigaball.lua @@ -1,4 +1,7 @@ --BRUSH Scene: Amigaball 1.0 +-- +--Draws the famous 'Amiga ball' in the brush. +-- --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ @@ -15,6 +18,11 @@ w, h = getbrushsize() +if (w<64 or h<64) then + setbrushsize(64,64) + w=64 + h=64 +end for y = 0, h - 1, 1 do for x = 0, w - 1, 1 do diff --git a/share/grafx2/scripts/bru_db_ColorSphere.lua b/share/grafx2/scripts/samples_2.3/demo/brush/ColorSphere.lua similarity index 100% rename from share/grafx2/scripts/bru_db_ColorSphere.lua rename to share/grafx2/scripts/samples_2.3/demo/brush/ColorSphere.lua diff --git a/share/grafx2/scripts/bru_db_FindAA.lua b/share/grafx2/scripts/samples_2.3/demo/brush/FindAA.lua similarity index 100% rename from share/grafx2/scripts/bru_db_FindAA.lua rename to share/grafx2/scripts/samples_2.3/demo/brush/FindAA.lua diff --git a/share/grafx2/scripts/bru_db_Mandelbrot.lua b/share/grafx2/scripts/samples_2.3/demo/brush/Mandelbrot.lua similarity index 95% rename from share/grafx2/scripts/bru_db_Mandelbrot.lua rename to share/grafx2/scripts/samples_2.3/demo/brush/Mandelbrot.lua index 6fc12433..d93b8f6b 100644 --- a/share/grafx2/scripts/bru_db_Mandelbrot.lua +++ b/share/grafx2/scripts/samples_2.3/demo/brush/Mandelbrot.lua @@ -1,4 +1,7 @@ --BRUSH Scene: Mandelbrot fractal v0.5 +-- +--Draws a Mandelbrot fractal in the current brush. +-- --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ diff --git a/share/grafx2/scripts/samples_2.3/libs/dawnbringer_lib.lua b/share/grafx2/scripts/samples_2.3/libs/dawnbringer_lib.lua new file mode 100644 index 00000000..541a5cb0 --- /dev/null +++ b/share/grafx2/scripts/samples_2.3/libs/dawnbringer_lib.lua @@ -0,0 +1,2471 @@ +--DawnBringer function library v1.1 +--** THIS IS NOT A RUNNABLE SCRIPT! ** +--by Richard Fhager +-- http://hem.fyristorg.com/dawnbringer/ +-- Email: dawnbringer@hem.utfors.se +-- MSN: annassar@hotmail.com +-- +-- Many functions in here was adopted from Evalion, a Javascript codecrafting/imageprocessing project +-- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html +-- +-- +-- You may access these functions in your own scripts by loading this library, +-- just add the follwing line as one of the first instructions: +-- +-- require("dawnbringer_lib") +-- +-- or +-- +-- dofile("dawnbringer_lib.lua") +-- +-- +-- Note that the functions must be called with the full library object-name, "db.function_name..." +-- + +-- Global library object +db = {} + + +-- ************************************* +-- *** Text & Conversions *** +-- ************************************* +-- +-- + +function db.rgb2HEX(r,g,b,prefix) + local c,n,s,t,z + c = {r,g,b} + z = {"0",""} + t = "" + for n = 1, 3, 1 do + s = string.upper(string.format("%x",c[n])) + t = t..z[#s]..s + --s = tonumber(c[n],16) + --t = t..s + end + return prefix..t +end + + +-- +-- ... eof Text & Conversions ... +-- + + + +-- ************************************* +-- *** Custom Math Functions *** +-- ************************************* +-- +-- +function db.sign(v) + local s + s = 0 + if v > 0 then s = 1; end + if v < 0 then s = -1; end + return s +end +-- + +-- +function db.rotation (rot_ang,hub_x,hub_y,x,y) -- Rotate coordinates x & y relative hub + local new_ang,dist,m,xd,yd,v; m = math + xd=hub_x-x; + yd=hub_y-y; + if (not(xd==0 and yd==0)) then + v = -90; if xd < 0 then v = 90; end + new_ang = m.atan(yd/xd) - (v+rot_ang) * m.pi/180; + dist = m.sqrt(xd*xd+yd*yd); + x = hub_x - m.sin(new_ang)*dist; + y = hub_y + m.cos(new_ang)*dist; + end + return math.floor(x),math.floor(y) -- For drawing purposes +end +-- + +-- +-- ... eof Custom Math Functions ... +-- + +-- ************************************* +-- *** Fractional Scenery *** +-- ************************************* + +-- +function db.setSceneryPalette() + db.colorCigarr(10,28,true) -- 250 colors + setcolor(250, 208,48,48) + setcolor(251, 48,208,48) + setcolor(252, 48,48,208) + setcolor(253, 224,224,64) + setcolor(254, 224,64,224) + setcolor(255, 64,224,224) +end +-- + +-- +function db.star(xf,yf,sx,sy,rgb,haz,out,lum) + local n,c,dist; c={} + dist = haz + out * math.sqrt((xf-sx)^2+(yf-sy)^2); + for n = 1, 3, 1 do c[n] = (rgb[n] * lum) / dist; end + return c; +end +-- + +-- +function db.zoom(xf,yf,zoom,panx,pany) -- Zoom and Pan in a fractional coord-system + xf = (xf-0.5)/zoom + 0.5 + panx; + yf = (yf-0.5)/zoom + 0.5 + pany; + return xf,yf +end +-- + +-- +function db.rotationFrac(rot_ang,hub_x,hub_y,x,y) -- Rotate coordinates x & y relative hub + local new_ang,dist,m,xd,yd,v; m = math + xd=hub_x-x; + yd=hub_y-y; + if (not(xd==0 and yd==0)) then + v = -90; if xd < 0 then v = 90; end + new_ang = m.atan(yd/xd) - (v+rot_ang) * m.pi/180; + dist = m.sqrt(xd*xd+yd*yd); + x = hub_x - m.sin(new_ang)*dist; + y = hub_y + m.cos(new_ang)*dist; + end + return x,y +end +-- + +-- +function db.twirl(x,y,arms,trot,tpow,tang) + local b,ang,vx,vy,vr,m,deg,tw + m=math; deg=math.pi/180; tw=.5; + if (not(x==.5 and y==.5)) then + ang = m.atan((.5-y)/(.5-x)); + b = 0; if (x>.5) then b = m.pi; end + vx = .5-x; vy = .5-y; vr = m.pow(m.sqrt(vx*vx+vy*vy),tpow); + tw = .5+m.sin(-tang*deg+vr*trot+(ang + b)*arms)*.5; + end + return tw; +end +-- + +--- Alpha filters +-- +function db.alpha1(x,y,amp) -- Coord, Amplify: 0..n + local p,a,xh,yh,m + xh=0.5-x; yh=0.5-y; m = math + p = m.pow(xh*xh+yh*yh,0.7); + a = m.cos(32*m.pi*p)*m.sin(8*m.pi*(xh+yh)); + return 1 + (a * amp) +end +-- + +-- +-- ... eof Fractional Scenery ... +-- + +-- ************************************* +-- *** Custom Array Functions *** +-- ************************************* +-- +-- Ok, I don't know Lua that well (still unsure about some scopes & refs etc.) +-- And some features may not be active in Grafx2. So, some of the follwing functions +-- may exist in Lua/Grafx2...but since I'm not sure if and how they work - I'll prefer +-- to add a set of my own of known performance. + +-- +function db.newArrayInit2Dim(xs,ys,val) + local x,y,ary; ary = {} + for y = 1, ys, 1 do + ary[y] = {} + for x = 1, xs, 1 do + ary[y][x] = val + end + end + return ary +end +-- + +-- +-- Merge two arrays into a NEW one: array_c = db.newArrayMerge(array_b,array_b) +-- +function db.newArrayMerge(a,b) + local n,ary; ary = {} + for n = 1, #a, 1 do + ary[n] = a[n] + end + for n = 1, #b, 1 do + ary[n+#a] = b[n] + end + return ary +end +-- + +-- +-- Generate a copy of an array with a new value added Last +-- +function db.newArrayInsertLast(a,val) + local n,ary; ary = {} + for n = 1, #a, 1 do + ary[n] = a[n] + end + ary[#a+1] = val + return ary +end +-- + +-- +-- Generate a copy of an array with a new value added First +-- +function db.newArrayInsertFirst(a,val) + local n,ary; ary = {} + ary[1] = val + for n = 2, #a+1, 1 do + ary[n] = a[n-1] + end + return ary +end +-- + +-- +function db.ary2txt(ary) -- One & two dimensions supported [a,b] -> "a,b". [[a,b],[c,d]] -> "a-b, c-d" + local t,n,m,v + t = "" + for n = 1, #ary, 1 do + if type(ary[n]) == "table" then + t = t..ary[n][1] + for m = 2, #ary[n], 1 do + t = t.."-"..ary[n][m] + end + else t = t..ary[n]; + end + t = t..", " + end + return t +end +-- + + +-- +-- ... eof Custom Array Functions ... +-- + + +-- ************************************* +-- *** Misc. Logical Operations *** +-- ************************************* + +-- +-- palList [r,g,b,palindex] is expected only to contain unique colors +-- index = -1 --> index of list +-- +function db.makeIndexList(list,index) + local n,ilist + ilist = {} + for n = 1, #list, 1 do + if (index > 0) then ilist[n] = list[n][index]; end + if (index == -1) then ilist[n] = n; end + end + return ilist +end +-- + +-- +-- Return a list of all possible (non-same) pairs from the entries in a list +-- [a,b,c] --> [[a,b],[a,c],[b,c]] +-- (All entries are treated as unique. i.e it's only the INDEX that counts) +-- mode = 0: Only unique pairs (m = (n^2 - n)/2), [a,b] --> [[a,b]] +-- mode = 1: All pairs, i.e mirror versions as well. (m = n^2 - n), [a,b] --> [[a,b], [b,a]] +-- +function db.pairsFromList(list,mode) + local a,b,l,n,pairs + pairs = {} + l = #list + n = 1 + for a = 1, l, 1 do + for b = a+1, l, 1 do + pairs[n] = {list[a],list[b]}; n = n + 1 + if mode == 1 then pairs[n] = {list[b],list[a]}; n = n + 1; end + end + end + return pairs +end +-- + +function db.valueInArray(ary,val) + local n,res + res = false + for n = 1, #ary, 1 do + if ary[n] == val then res = true; break; end + end + return res +end + +-- RAMP specific + +-- Remove initial pair (palList) colors from pallist +function db.initiateRamp(pair,pallist,pal_index) + local n,found,plist + plist = {} + + found = 1 + for n = 1, #pallist, 1 do + if db.valueInArray(pair,pallist[n]) == false then + plist[found] = pallist[n]; found = found + 1; + end + end + + pair[pal_index] = plist -- ex: ["pal"] + + return pair -- Is now a 2 color RAMP +end +-- + +-- Remove new col entry from ramp's pallist and add it to the ramp, returns an updated ramp +-- RampList = [1,2] ["pal"] = palList = [3,4,5], addindex = 3 +-- --> [1,2,3] palList = [4,5] +function db.updateRamp(ramp,addindex,pal_index) + local n,found,pallist,plist,newramp + plist = {} + pallist = ramp[pal_index] + + -- New palList without added color to IndexList + found = 1 + for n = 1, #pallist, 1 do + if pallist[n] ~= addindex then + plist[found] = pallist[n]; found = found + 1; + end + end + + newramp = db.newArrayInsertLast(ramplist,addindex) + newramp[pal_index] = plist + + return rlist +end + +-- +-- Returns a list of all inital ramps from color pairs +-- +-- Weeds out bad pairs, attaches remaining palette colors and the first rgb-vector +-- +-- +function db.initiateRampList(pairs,pallist,pal_index,vec_index,min,maxmult,rw,gw,bw) + local n,ramplist,newpairs,accept,dist,c1,c2,max,rD,gD,bD + ramplist = {} + max = min + (142 / math.sqrt(#pallist)) * maxmult -- min ex: 8-12 + accept = 0 + + for n = 1, #pairs, 1 do + c1 = pallist[pairs[n][1]] + c2 = pallist[pairs[n][2]] + rD = c2[1] - c1[1] + gD = c2[2] - c1[2] + bD = c2[3] - c1[3] + dist = math.sqrt( (rw*rD)^2 + (gw*gD)^2 + (bw*bD)^2 ) + + if dist >= min and dist <= max then + accept = accept + 1; ramplist[accept] = db.initiateRamp(pairs[n],pallist,pal_index); + ramplist[accept][vec_index] = {rD, gD, bD, dist}; -- Add first color vector, ONLY KEEP DISTANCE? + end + end + + return ramplist +end + + +function db.findRampExpansionColors(ramp) + local clist + clist = {} + -- Calculate vectors here? + return clist +end + + +function db.findRAMPS(min_len, max_len) + local i,n,c,pallist,ramp,ramplist,pairs,spairs,palindex,vecindex,found,donelist,newlist,dones + local colorlist + palindex = "pal" + vecindex = "vector" + pallist = db.fixPalette(db.makePalList(256), 0) + pairs = db.pairsFromList(db.makeIndexList(pallist,-1), 0) + ramplist = db.initiateRampList(pairs,pallist,palindex,vecindex, 8,0.75, 0.26,0.55,0.19) + + -- MIN_LEN = 5 + -- MAX_LEN = 10 + + -- Split Ramp-build into two parts: + -- 1. Build ramps >= MIN_LEN, NONE added to 'Done' + -- 2. Run til no more ramps can be expanded or reaches MAX_LEN, ALL ramps added to 'Done' + + for i = 1, (min_len - 2), 1 do -- Assuming 2 for inital pairs (2 color ramps) + newlist = {} + found = 0 + for n = 1, #ramplist, 1 do + ramp = ramplist[n] + colorlist = db.findRampExpansionColors(ramp) -- Colors that can split the current ramp into new expanded ramps + for c = 1, #colorlist, 1 do + found = found + 1; newlist[found] = db.updateRamp(ramp,colorlist[c],palindex); -- Ramp is expanded by 1 color + end + end + ramplist = newlist + end + + + donelist = {}; dones = 0 + + repeat + newlist = {} + found = 0 + for n = 1, #ramplist, 1 do + ramp = ramplist[n] + if true == false then + found = found + 1; newlist[found] = db.updateRamp(ramp,color,palindex); + else + dones = dones + 1; donelist[dones] = ramp; + end + end + --ramplist = newlist + until found == 0 + + return #pairs.." - "..#ramplist +end + +-- +-- ... eof Misc. Logical Operations ... +-- + + +-- *************************************** +-- *** General RGB-Color Modifications *** +-- *************************************** + + +-- +function db.makeComplimentaryColor(r,g,b,brikeeplev) -- Lev: 0 = Normal, 1 = Loose, 2 = Strict + + local bri_o,bri_n,bdiff + + function cap(v) return math.max(0,math.min(v,255)); end + + bri_o = db.getBrightness(r,g,b) + r,g,b = db.shiftHUE(r,g,b,180) + + if brikeeplev > 0 then + + for n = 0, brikeeplev*3-1, 1 do -- Must iterate to reduce brightness error + bri_n = db.getBrightness(r,g,b) + bdiff = (bri_o - bri_n) / 2 * brikeeplev + r = cap(r + bdiff) + g = cap(g + bdiff) + b = cap(b + bdiff) + end + + end + + return r,g,b + +end +-- + + +-- *** Color balance *** +-- +-- bri_flag: Preserve brightness +-- loose_flag: Loose preservation restrictions for brightness and balance +-- +-- Jeez, was this a tricky sucker; color-balance is just adding and capping... +-- but trying color-balance with preserved perceptual brightness is a different monster... +-- ...so bad I could only solve it by iterative error correction. +-- +function db.ColorBalance(r,g,b,rd,gd,bd,bri_flag,loose_flag) -- preserve brightness + local rw,gw,bw,ri,gi,bi,itot,rni,gni,bni,ro,go,bo,ovscale,lev,count,rt,gt,bt,rf,gf,bf,bri + + -- Dawn 3.0, [0.26,0.55,0.19], 0-255 bri-colorscale adjust = 1.56905 + rw,gw,bw = 0.26, 0.55, 0.19 + + function cap(v) return math.min(255,math.max(v,0)); end + + bri = db.getBrightness(r,g,b) + + + -- Loose brightness & balance preservation, a good compromise. + if bri_flag == true and loose_flag == true then + + lev = (rd + gd + bd) / 3 + rd = rd - lev + gd = gd - lev + bd = bd - lev + + brin = db.getBrightness(cap(r+rd),cap(g+gd),cap(b+bd)) + itot = brin - bri + rd = rd - itot + gd = gd - itot + bd = bd - itot + + end + + + if bri_flag == true and loose_flag == false then + + itot = 255 + count = 0 + + -- Normalize (Yup, it's right only to normalize once first..cont.norm. will have some counter-effect) + lev = (rd + gd + bd) / 3 + rd = rd - lev + gd = gd - lev + bd = bd - lev + + repeat + + --messagebox("Norm:"..rd..", "..gd..", "..bd) + + -- Calculate total brightness change + -- Note: Perceptual Brightness is exponential, and can't be delta-adjusted for anything other than greyscales. + -- Although the formula for the new brightness corrected normalization level can can be derived... + -- ...it doesn't do much good since the bigger problem is overflow outside the 0-255 boundary. + -- As for now, I see no other means to solve this issue than with iterative error-correction. + + rt = r+rd + gt = g+gd + bt = b+bd + + itot = 9e99 + rni = rd + gni = gd + bni = bd + + -- We can get brightness of negative values etc. So bri-correction is put on hold until values are scaled down + if (rt>=0 and gt>=0 and bt>=0) and (rt<256 and gt<256 and bt<256) then + brin = db.getBrightness(rt,gt,bt) + itot = brin - bri + --messagebox("Bri Diff: "..itot) + -- Brightness adjusted balance + rni = rd - itot + gni = gd - itot + bni = bd - itot + end + + --messagebox("Bri Adj Bal:"..rni..", "..gni..", "..bni) + + -- Apply balance to find overflow (as fraction of the channel change) + ro = math.max( math.max((r + rni)-255,0), math.abs(math.min((r + rni),0)) ) / math.max(math.abs(rni),1) + go = math.max( math.max((g + gni)-255,0), math.abs(math.min((g + gni),0)) ) / math.max(math.abs(gni),1) + bo = math.max( math.max((b + bni)-255,0), math.abs(math.min((b + bni),0)) ) / math.max(math.abs(bni),1) + + ovscale = 1 - math.max(ro,go,bo) + + -- Scaling balances might be logically incorrect (as they can be seen as constant differences) + -- But scaling DOWN is quite harmless and I don't see how it could be done otherwise... + -- ex: +10 red, +5 blue: Scale x2 = +20 red, +10 blue -> More red over blue than ordered, a contrast behaviour. + -- +10 red, +5 blue: Scale x0.5 = +5 red, +2.5 blue -> Less of everything, but a part of the order. Harmless? + -- + rd = rni * ovscale + gd = gni * ovscale + bd = bni * ovscale + + count = count + 1 + + --messagebox("Final bal:"..rd..", "..gd..", "..bd) + + until math.abs(itot) < 1 or count > 5 + + end + + rf = r + rd + gf = g + gd + bf = b + bd + + --messagebox("Result color:"..rf..", "..gf..", "..bf) + + return rf,gf,bf +end +-- + + + +-- +-- bri_flag: Preserve brightness +-- cap_flag: Cap new color at 0-255, has a desaturating effect for large values. +-- +function db.ColorBalanceXXX(r,g,b,rd,gd,bd,bri_flag,cap_flag) -- preserve brightness + local rf,gf,bf + + if cap_flag == true then + rd = math.min(255,math.max(0, r+rd)) - r + gd = math.min(255,math.max(0, g+gd)) - g + bd = math.min(255,math.max(0, b+bd)) - b + end + + local rw,gw,bw,ri,gi,bi,itot,rni,gni,bni,ro,go,bo,ovscale + + + -- Dawn 3.0, [0.26,0.55,0.19], 0-255 bri-colorscale adjust = 1.56905 + rw,gw,bw = 0.26, 0.55, 0.19 + + if bri_flag == true then + + -- Calculate total brightness change + --ri = rd * rw + --gi = gd * gw + --bi = bd * bw + --itot = math.sqrt(ri^2 + gi^2 + bi^2) + + bri = db.getBrightness(r,g,b) + brin = db.getBrightness(r+rd,g+gd,b+bd) + itot = brin - bri + + + -- Normalized and Brightness adjusted balance + rni = rd - itot + gni = gd - itot + bni = bd - itot + + -- Apply balance to find overflow (as fraction of the channel change) + ro = math.max( math.max((r + rni)-255,0), math.abs(math.min((r + rni),0)) ) / math.max(math.abs(rni),1) + go = math.max( math.max((g + gni)-255,0), math.abs(math.min((g + gni),0)) ) / math.max(math.abs(gni),1) + bo = math.max( math.max((b + bni)-255,0), math.abs(math.min((b + bni),0)) ) / math.max(math.abs(bni),1) + + ovscale = 1 - math.max(ro,go,bo) + + rd = rni * ovscale + gd = gni * ovscale + bd = bni * ovscale + + end + + rf = r + rd + gf = g + gd + bf = b + bd + + return rf,gf,bf +end +-- + +-- +function db.getContrast(ch) -- Channel, returns fraction -1..0..1, negative for ch < 127.5 + --return math.abs((ch / 127.5) - 1) + return (ch / 127.5) - 1 +end +-- + +-- +function db.getAvgContrast(r,g,b) + return (math.abs(db.getContrast(r)) + math.abs(db.getContrast(g)) + math.abs(db.getContrast(b))) / 3 +end +-- + +-- +-- Mode = 0: Proportional - all colors reach max contrast at 100% +-- +-- Mode = 1: Linear - percentage simply added +-- +function db.changeContrastOLD(r,g,b,prc,mode) + + local m,rd,gd,bd,rv,gv,bv,rc,gc,bc,base,sign + + base = 1; sign = 1 + if prc < 0 then base = 0; sign = -1; end -- decontrast + + m = prc / 100 * sign + + -- mode 0 + rc = db.getContrast(r) + rd = (base - math.abs(rc)) * m * db.sign(rc) + rv = (rc+rd+1) * 127.5 + + gc = db.getContrast(g) + gd = (base - math.abs(gc)) * m * db.sign(gc) + gv = (gc+gd+1) * 127.5 + + bc = db.getContrast(b) + bd = (base - math.abs(bc)) * m * db.sign(bc) + bv = (bc+bd+1) * 127.5 + + return rv,gv,bv + +end +-- + +function db.changeContrast(r,g,b,prc) -- Photoshop style + + local m,rd,gd,bd,rv,gv,bv,rc,gc,bc + + m = 1 + math.pow((255 / 100 * prc),3) / (255*255) + + -- decontrast + if prc < 0 then + m = 1 - math.abs(prc)/100 + end + + rc = db.getContrast(r) + rd = rc * m + rv = (rd+1) * 127.5 + + gc = db.getContrast(g) + gd = gc * m + gv = (gd+1) * 127.5 + + bc = db.getContrast(b) + bd = bc * m + bv = (bd+1) * 127.5 + + return rv,gv,bv + +end + + + +-- +function db.getBrightness(r,g,b) -- 0-255 + local bri + --bri = (r+g+b)/3 + --bri = r*0.3 + g*0.59 + b*0.11 -- Luma Y'601 + --bri = math.sqrt((r*0.3)^2 + (g*0.59)^2 + (b*0.11)^2) -- Luma Y'601 + --bri = r*0.245 + g*0.575 + b*0.18 -- Dawn 2.0 + + bri = math.sqrt((r*0.26)^2 + (g*0.55)^2 + (b*0.19)^2) * 1.56905 -- Dawn 3.0 + return bri +end +-- + + +-- +-- Note on desaturation: These functions are all junk, the only way to desaturate +-- is to fade a color into it's corresponding greyscale. +-- + +-- +function db.desaturate(percent,r,g,b) -- V1.0 by Richard Fhager + local a,p + p = percent / 100 + a = (math.min(math.max(r,g,b),255) + math.max(math.min(r,g,b),0)) * 0.5 * p + r = r + (a-r*p) -- a+r*(1-p) + g = g + (a-g*p) + b = b + (a-b*p) + return r,g,b +end +-- + +-- +function db.desaturateA(percent,c) -- array version + local r,g,b,a + r = c[1] + g = c[2] + b = c[3] + p = percent / 100 + a = (math.min(math.max(r,g,b),255) + math.max(math.min(r,g,b),0)) * 0.5 * p + r = r + (a-r*p) + g = g + (a-g*p) + b = b + (a-b*p) + return {r,g,b} +end +-- + +-- +function db.desatAVG(desat,c) -- Desaturation, simpe average + r = c[1] + g = c[2] + b = c[3] + p = desat / 100 + a = (r+g+b)/3 + r = r + p*(a-r) + g = g + p*(a-g) + b = b + p*(a-b) + return {r,g,b} +end +-- + + +-- +function db.getSaturation(r,g,b) -- HSL + local M,m,c,s,l + M = math.max(r,g,b) + m = math.min(r,g,b) + c = (M - m)/255 + s = 0 + if c ~= 0 then + --l = (0.3*r + 0.59*g + 0.11*b)/255 -- HSLuma: Y'601 + l = (M+m)/510 -- This produces a quite "correct looking" divison of saturation + if l <= 0.5 then s = c / (2*l); end + if l > 0.5 then s = c / (2-2*l); end + end + return math.min(255,s * 255) +end +-- + +-- +function db.getTrueSaturationX(r,g,b) -- Distance from grayscale axis. Not HSV/HSL + local sat,bri + bri = (r+g+b) / 3 + sat = math.min(255, math.sqrt((r-bri)^2 + (g-bri)^2 + (b-bri)^2) * 1.224744875) + return sat +end +-- + +-- WIP. Trying to find a more natural model for estimating Saturation +-- Current: (HSL + True) / 2 +function db.getAppSaturation(r,g,b) + return math.min(255, (db.getSaturation(r,g,b) + db.getTrueSaturationX(r,g,b)) / 2) +end +-- + +-- +function db.saturate(percent,r,g,b) + local a,m,p,mc + a = (math.min(math.max(r,g,b),255) + math.max(math.min(r,g,b),0)) * 0.5 + m = math.min(255-math.max(r,g,b), math.min(r,g,b)) + p = percent * (m / 100) + mc = math.max((r-a),(g-a),(b-a)) -- Can this be derived elsewhere? + if mc ~= 0 then + r = r + (r-a) * p / mc + g = g + (g-a) * p / mc + b = b + (b-a) * p / mc + end + return r,g,b +end +-- + +-- +-- Super Saturate: Better than Photoshop etc. +-- +-- Higher than 100% power is ok +-- +function db.saturateAdv(percent,r,g,b,brikeeplev,greydamp) -- brikeep = 0 - 2 + local a,m,p,mc,bri_o,bri_n,bdiff,mx,mi,adj,q,n + function cap(v) return math.max(0,math.min(v,255)); end + mx = math.max(r,g,b) + mi = math.min(r,g,b) + bri_o = db.getBrightness(r,g,b) + a = (math.min(mx,255) + math.max(mi,0)) * 0.5 + m = math.min(255-mx, mi) + p = percent * (m / 100) + mc = math.max((r-a),(g-a),(b-a)) -- Can this be derived elsewhere? + if mc ~= 0 and m ~= 0 then + adj = math.min(1,(mx - mi) / m) -- Reduce effect on low saturation + if greydamp == false then adj = 1; end + q = p / mc * adj + r = cap( r + (r-a) * q ) + g = cap( g + (g-a) * q ) + b = cap( b + (b-a) * q ) + end + for n = 0, brikeeplev*2, 1 do -- Must iterate to reduce brightness error + bri_n = db.getBrightness(r,g,b) + bdiff = (bri_o - bri_n) / 2 * brikeeplev + r = cap(r + bdiff) + g = cap(g + bdiff) + b = cap(b + bdiff) + end + return r,g,b +end +-- + + +-- +-- Lightness: Darken / Brighten color (Argument and returnvalue is a rgb-list) +-- Rate of change is inversely proportional to the distance of the max/min. +-- i.e. all colors/channels will reach max/min at the same time (at 0 or 100 %) +-- (As opposed to 'Brightness' where all channels are changed by a constant value) +-- +function db.lightness(percent,c) + local v,r,g,b,p + r = c[1] + g = c[2] + b = c[3] + p = math.abs(percent/100) + v = 255 + if percent < 0 then v = 0; end + r = r + (v - r)*p + g = g + (v - g)*p + b = b + (v - b)*p + return {r,g,b} +end +-- + +-- +function db.changeLightness(r,g,b,percent) + local v + v = db.lightness(percent,{r,g,b}) + return v[1],v[2],v[3] +end +-- + +-- +function db.getLightness(r,g,b) -- HSL bi-hexcone + return (math.max(r,g,b) + math.min(r,g,b)) / 2 +end +-- + +-- +function db.shiftHUE(r,g,b,deg) -- V1.3 R.Fhager 2007, (Heavily derived code, hehe...) + local c,h,mi,mx,d,s,p,i,f,q,t + c = {g,b,r} + mi = math.min(r,g,b) + mx = math.max(r,g,b); v = mx; + d = mx - mi; + s = 0; if mx ~= 0 then s = d/mx; end + p = 1; if g ~= mx then p = 2; if b ~= mx then p = 0; end; end + + if s~=0 then + h=(deg/60+(6+p*2+(c[1+p]-c[1+(p+1)%3])/d))%6; + i=math.floor(h); + f=h-i; + p=v*(1-s); + q=v*(1-s*f); + t=v*(1-s*(1-f)); + c={v,q,p,p,t,v} + r = c[1+i] + g = c[1+(i+4)%6] + b = c[1+(i+2)%6] + end + + return r,g,b +end +-- + +-- +function db.getHUE(r,g,b,greytol) -- 0-6 (6.5 = Greyscale), mult. with 60 for degrees + -- 1 Color diff is roughly detected by Tolerance = 0.0078125 (Tol. incr. with lightness etc.) + local c,h,mi,mx,d,s,p,i,f,q,t + c = {g,b,r} + mi = math.min(r,g,b) + mx = math.max(r,g,b); v = mx; + d = mx - mi; + s = 0; if mx ~= 0 then s = d/mx; end + p = 1; if g ~= mx then p = 2; if b ~= mx then p = 0; end; end + + h = 6.5 -- for custom graphical purposes + if s>greytol then -- can't use >= + h=(6+p*2+(c[1+p]-c[1+(p+1)%3])/d)%6; + end + + return h +end +-- + +-- +-- ... eof RGB color modifications ... +-- + + + +-- **************************************** +-- *** Custom Color / Palette functions *** +-- **************************************** + + +-- +function db.rgbcap(r,g,b,mx,mi) + local m = math + return m.max(mi,m.min(r,mx)), m.max(mi,m.min(g,mx)), m.max(mi,m.min(b,mx)) +end +-- + +-- +function db.makePalList(cols) + local pal,n,r,g,b + pal = {} + for n = 0, cols-1, 1 do + r,g,b = getcolor(n) + pal[n+1] = {r,g,b,n} + end + return pal +end +-- + +-- +function db.makeSparePalList(cols) + local pal,n,r,g,b + pal = {} + for n = 0, cols-1, 1 do + r,g,b = getsparecolor(n) + pal[n+1] = {r,g,b,n} + end + return pal +end +-- + + +-- +-- Use to remove the black colors (marks unused colors) from palette-list +-- if it's known that no black color exists in the image. +function db.stripBlackFromPalList(pallist) + local i,u,c,dummy; i = 257 -- Do 'nothing' If using a full 256 col palette with no blacks + for u = 1, #pallist, 1 do + c = pallist[u] + if (c[1]+c[2]+c[3]) == 0 then i = u; end + end + dummy = table.remove(pallist,i) + return pallist +end +-- + +-- +function db.stripIndexFromPalList(pallist,colindex) + local i,u,c,dummy + for u = 1, #pallist, 1 do + c = pallist[u] + if c[4] == colindex then i = u; end + end + dummy = table.remove(pallist,i) + return pallist +end +-- + +-- +function db.addHSBtoPalette(pallist) + local n,hue,sat,rgb + for n=1, #pallist, 1 do + rgb = pallist[n] + pallist[n][5] = db.getHUE(rgb[1],rgb[2],rgb[3],0) + pallist[n][6] = db.getSaturation(rgb[1],rgb[2],rgb[3]) + pallist[n][7] = db.getBrightness(rgb[1],rgb[2],rgb[3]) + end + return pallist -- {r,g,b,n,bri,hue,sat} +end +-- + +-- +function db.makePalListRange(start,ends) + local pal,n,r,g,b,a + pal = {} + a = 1 + for n = start, ends, 1 do + r,g,b = getcolor(n) + pal[a] = {r,g,b,n}; a = a + 1; + end + return pal +end +-- + + +-- +function db.makePalListShade(cols,sha) -- Convert colors to less bits, colorcube operations etc. + local pal,n,r,g,b,mf,div + mf = math.floor + div = 256 / sha + pal = {} + for n = 0, cols-1, 1 do + r,g,b = getcolor(n) + pal[n+1] = {mf(r/div),mf(g/div),mf(b/div),n} + end + return pal +end +-- +-- +function db.makePalListShadeSPARE(cols,sha) -- Convert colors to less bits, colorcube operations etc. + local pal,n,r,g,b,mf,div + mf = math.floor + div = 256 / sha + pal = {} + for n = 0, cols-1, 1 do + r,g,b = getsparecolor(n) + pal[n+1] = {mf(r/div),mf(g/div),mf(b/div),n} + end + return pal +end +-- + + + +-- +function db.getColorDistance_weight(r1,g1,b1,r2,g2,b2,rw,gw,bw) + return math.sqrt( (rw*(r1-r2))^2 + (gw*(g1-g2))^2 + (bw*(b1-b2))^2 ) +end +-- + +-- +function db.getBestPalMatch(r,g,b,pal,index_flag) -- pal = [r,g,b,palindex], index_flag -> return palindex if pal is sorted or reduced + local diff,best,bestcol,cols,n,c,p + cols = #pal + bestcol = -1 + best = 9e99 + + for n=1, cols, 1 do + p = pal[n] + diff = db.getColorDistance_weight(r,g,b,p[1],p[2],p[3],0.26,0.55,0.19) * 1.569 + if diff < best then bestcol = n; best = diff; end + end + + if index_flag == true then + bestcol = pal[bestcol][4] + 1 + end + + return bestcol-1 -- palList index start at 1, image-palette at 0 +end +-- + + +-- Normally this function will return the (image)palette index of best color +-- ...but if the palette has been sorted with 'fixPalette' it will return the index +-- of the custom palList, setting index_flag will convert this value to image-palette index +-- +-- HYBRID means the colormatch is a combo of color and (perceptual)brightness +-- +-- +function db.getBestPalMatchHYBRID(rgb,pal,briweight,index_flag) -- Now correctly balanced + local diff,diffC,diffB,best,bestcol,cols,n,c,r,g,b,p,obri,pbri + cols = #pal + bestcol = -1 + best = 9e99 + + --messagebox(briweight) + + -- Note: Not secured against negative values (this algorithm is SLOW, we cannot afford it) + r = rgb[1] + g = rgb[2] + b = rgb[3] + + obri = db.getBrightness(r,g,b) -- 0-255 + + for n=1, cols, 1 do + p = pal[n] + pbri = db.getBrightness(p[1],p[2],p[3]) + diffB = math.abs(obri - pbri) + -- we need to normalize the distance by the weights + diffC = db.getColorDistance_weight(r,g,b,p[1],p[2],p[3],0.26,0.55,0.19) * 1.569 + + diff = briweight * (diffB - diffC) + diffC + if diff < best then bestcol = n; best = diff; end + end + + if index_flag == true then + bestcol = pal[bestcol][4] + 1 -- Since we detract 1 on return, God Lua is stupid + end + + return bestcol-1 -- palList index start at 1, image-palette at 0 +end +-- + + + +-- +-- Special version of Hybrid-remapping for mixPalette list +-- +-- mixpal: {score,col#1,col#2,dist,rm,gm,bm, c1_r,c1_g,c1_b, c2_r,c2_g,c2_b} +-- +-- returns: {col#1,col#2} (index of palette) +-- +function db.getBestPalMatchHybridMIX(rgb,mixpal,briweight,mixreduction) + local diff,diffC,diffB,best,bestcol,cols,n,c,r,g,b,p,obri,pbri, distmult + cols = #mixpal + bestcol = -1 + best = 9e99 + + -- We will simply add the the distance to the mix with the distance between the mixcolors and + -- employ a user tolerance to much the latter will matter. + --distmult = 255 / 9.56 / 100 * mixreduction -- 16 shades + distmult = 1.56902 / 100 * mixreduction -- 24-bit, Dawn3.0 colormodel + + -- Note: Not secured against negative values (this algorithm is SLOW, we cannot afford it) + r = rgb[1] + g = rgb[2] + b = rgb[3] + + obri = db.getBrightness(r,g,b) -- 0-255 + + for n=1, cols, 1 do + p = mixpal[n] + --pbri = db.getBrightness(p[5],p[6],p[7]) + + -- *** DawnBringer's exponetial color brightness dither resolution phenomena theorem *** + -- Bri = color value ^ 2 + -- Two adjacent pixels displayed with "normal high resolution" will NOT have the perceptual + -- brightness of the resulting mixcolor. The brightness lies closer to that of the brightest pixel. + -- Bri[(C1+C2)/2] = SQRT( (C1bri^2 + C2bri^2) / 2 ) + -- (Brightness according to Dawn-model: bri = SQRT( (r*.26)^2 + (g*.55)^2 + (b*.19)^2 ) ) + + pbri = math.sqrt((db.getBrightness(p[8],p[9],p[10])^2 + db.getBrightness(p[11],p[12],p[13])^2) / 2) + + diffB = math.abs(obri - pbri) + -- we need to normalize the distance by the weights + diffC = db.getColorDistance_weight(r,g,b,p[5],p[6],p[7],0.26,0.55,0.19) * 1.569 + p[4]*distmult + + diff = briweight * (diffB - diffC) + diffC + if diff <= best then bestcol = n; best = diff; end + end + + return {mixpal[bestcol][2], mixpal[bestcol][3]} +--return {mixpal[bestcol][2], 0} + + + +end +-- + + + +-- +function db.matchcolorHSB(h,s,b,pallist,index_flag) + -- + -- why don't we just convert HSB-diagram to RGB and do normal colormatching? + -- Not the same... + -- + local n,c,best,bestcol,pb,ph,ps,diff,huediff,huecorr,hue_adj,sat_adj,bri_adj + bestcol = -1 + best = 9e99 + + -- higher adjust means more impact (higher hue gives more interpolation ) + hue_adj = 4 + sat_adj = 0.075 + bri_adj = 2 + + huecorr = 255 / 6 -- Our Hue goes from 0.0 - 5.999 + + for n=1, #pallist, 1 do + c = pallist[n] + ph = c[5] + ps = c[6] + pb = c[7] + + huediff = math.abs(h-ph*huecorr) + if huediff > 127 then huediff = huediff - (huediff % 127) * 2; end + + --if ph == 6.5 then huediff = 0; end + + -- With less saturation, exact hue becomes less important and brightness more usefull + -- This allows for greyscales and low saturation colors to work smoothly. + huediff = huediff * (ps /255) + + diff = hue_adj*huediff^2 + (s-ps)^2 * sat_adj + (b-pb)^2 * bri_adj + + if diff <= best then bestcol = n; best = diff; end + end + + if index_flag == true then + bestcol = palList[bestcol][4] + 1 -- Since we detract 1 on return, God Lua is stupid + end + + return bestcol-1 + +end +-- + +-- +-- Used by PaletteAnalysis.lua, FindRamps(), MixColors() +-- +function db.fixPalette(pal,sortflag) -- Arrange palette & only keep unique colors + + local n,l,rgb,i,unique,bri,hue,sat,ulist,indexpal,newpal,dtot + ulist = {} + indexpal = {} + newpal = {} + local doubles; doubles = {} + + l = #pal + + unique = 1 -- ok, see how stupid lua is + dtot = 0 + for n=1, l, 1 do + rgb = pal[n]; -- actually rgbn + i = 1 + rgb[1] * 65536 + rgb[2] * 256 + rgb[3]; + bri = db.getBrightness(rgb[1],rgb[2],rgb[3]) + if indexpal[i] == nil then + indexpal[i] = rgb; ulist[unique] = {i,bri}; unique = unique+1; + else + doubles[rgb[4]] = true; -- Mark as double + dtot = dtot + 1 + end + end + + -- sort ulist + if sortflag == 1 then db.sorti(ulist,2); end -- sort by brightness + + l = #ulist + for n=1, l, 1 do + newpal[n] = indexpal[ulist[n][1]] + end + + newpal["doubles"] = doubles + newpal.double_total = dtot + + --messagebox("unique colors", unique-1) + + return newpal + +end +-- + +-- +-- InsertionSort Array, this is chaos...I'm confused and stomped...don't understand how Lua works... +-- ...sorting seem be to ok but this code is ugly... +-- Sort LO-HI +-- +-- Screwed up or confused thing here I think, perhaps lo-hi/hi-lo. This is working lo-hi but the code +-- looks like hi-lo...edit this some day +-- +function db.sorti(d,idx) + local a,j,tmp,l,e + l = #d + + for a=2, l, 1 do + tmp = d[a]; + e = a + for j=a, 2, -1 do + e = j + if d[j-1][idx] > tmp[idx] then d[j] = d[j-1]; e = j-1; else break; end; + end; + d[e] = tmp; -- WHY THE F**K CAN'T YOU READ j HERE!?! STUPID ASSUCKING LANGUAGE + + end; + --return d +end +-- + +-- +function db.drawColorspace12bit(x,y,cols,size) + local r,g,b,c,rows,row,col,s16,rx,ry,xx,yy + s16 = size*16 + rows = math.floor(16/cols) + + for g = 0, 15, 1 do + col = g % cols + row = math.floor(g / cols) + for r = 0, 15, 1 do + for b = 0, 15, 1 do + c = matchcolor(r*17,g*17,b*17) + xx = x+col*s16+r*size + yy = y+row*s16+b*size + for ry = 0, size-1, 1 do + for rx = 0, size-1, 1 do + putpicturepixel(xx+rx,yy+ry,c) + end;end + end + end + end +end +-- + +-- +function db.drawHSBdiagram(pallist,posx,posy,width,height,size,sat) + --db.addHSBtoPalette(palList) + local x,y,c + for y = 0, height-1, 1 do + for x = 0, width-1, 1 do + hue = 255/width * x + bri = 255/height * y + c = db.matchcolorHSB(hue,sat,bri,pallist,true) + db.drawRectangle(posx + x*size, posy + y*size,size,size, c) + end + end +end +-- + +-- +-- Histograms, remapping etc. +-- + +-- +function db.makeHistogram() + local n,y,x,c,w,h,list; list = {} + w, h = getpicturesize() + for n = 1, 256, 1 do list[n] = 0; end + for y = 0, h - 1, 1 do + for x = 0, w - 1, 1 do + c = getpicturepixel(x,y) + list[c+1] = list[c+1] + 1 + end + end + return list +end +-- + +-- +function db.makeSpareHistogram() + local n,y,x,c,w,h,list; list = {} + w, h = getsparepicturesize() + --w,h = 512,360 + for n = 1, 256, 1 do list[n] = 0; end + for y = 0, h - 1, 1 do + for x = 0, w - 1, 1 do + c = getsparepicturepixel(x,y) + list[c+1] = list[c+1] + 1 + end + end + return list +end +-- + + +-- +-- Makes a palette-list from only the colors (histogram) that occurs in the image +-- Assumes image/palette has not changed since histogram was created +function db.makePalListFromHistogram(hist) + local n,r,g,b,list,count + list = {} + count = 1 + for n = 1, #hist, 1 do + if hist[n] > 0 then + r,g,b = getcolor(n-1) + list[count] = {r,g,b,n-1} + count = count + 1 + end + end + return list +end +-- + +function db.makePalListFromSpareHistogram(hist) + local n,r,g,b,list,count + list = {} + count = 1 + for n = 1, #hist, 1 do + if hist[n] > 0 then + r,g,b = getsparecolor(n-1) + list[count] = {r,g,b,n-1} + count = count + 1 + end + end + return list +end +-- + + +-- +function db.remap(org) -- Working with a remap-list there's no need of reading backuppixel + --messagebox("Remapping") + local x,y,c,i,w,h,s,f,col + f = getpicturepixel + s = false + w, h = getpicturesize() + for y = 0, h - 1, 1 do + for x = 0, w - 1, 1 do + c = f(x,y) + i = org[c+1] + if i == null then i = matchcolor(getbackupcolor(getbackuppixel(x,y))); s = true; col = c; end -- Find color for a removed double + putpicturepixel(x,y,i) + end + end + if s then messagebox("Remapping: Not all image colors were found in remap-list (re-assign), probably due to duplicate removal. Matchcolor was used, ex: col# "..col); + end +end +-- + +-- +-- Palette DeCluster: Color-reduction by fusing similar colors into new ones, using a desired tolerance. +-- This is a method similar to Median-Cut, but more surgical. +-- +-- pallist: Palette list {r,g,b,palette_index} +-- hist: Histogram {color 0 pixels, color 1 pixels...etc} always a full 256 color list +-- crad: Cluster radius treshold in % of distance between black & white +-- A value of 0 will only remove identical colors +-- A value of 3-4 will usally fuse redundant colors without causing notice +-- prot_pow: (0..10) Protect common colors in histogram. Distances are increased by ocurrence. +-- Also gives protection to fused colors even if not using histogram (combined nominal weights) +-- pixels: Pixels in image (so protection can be calculated) +-- rw,gw,bw: Color weights (rw+gw+bw = 1, 0.33,0.33,0.33 is nominal) +-- +-- Returns: +-- a new (c)palette list {r,g,b,{original palette_indices},fused flag, histogram_weight} +-- a remap list (org) [image color + 1] = remap color (in the new palette) +function db.deCluster(pallist, hist, crad, prot_pow, pixels, rw,gw,bw) + + --messagebox(pixels) + + local u,c,a,i,o,j,n,c1,c2,r,g,b,r1,g1,b1,r2,g2,b2,wt,rt,gt,bt,tot,pd + local worst,wtot,maxdist,maxDist,distfrac,clusterExists,clustVal,count,crad1 + local cList,cPalList,clusterList,fuseCol,orgcols,newPalList,org + + maxdist = math.sqrt(rw*rw*65025 + gw*gw*65025 + bw*bw*65025) + distfrac = 100 / maxdist + + -- Let's just make a slightly more suitable format of the pallist (List for original color(s)) + cPalList = {} + for u = 1, #pallist, 1 do + c = pallist[u] + cPalList[u] = {c[1],c[2],c[3],{c[4]},false,hist[c[4]+1]} -- r,g,b,{original colors},fuse_marker,histogram_weight + end + + --table.insert(cPalList,{255,255,0,{257},false,1}) + + clusterExists = true + while clusterExists do + clusterExists = false + clusterList = {} + + crad1 = crad + 1 -- avoid divison by zero + worst = 9999 + for a = 1, #cPalList, 1 do + c1 = cPalList[a] + r1,g1,b1 = c1[1],c1[2],c1[3] + wtot = c1[6] + cList = {a} + maxDist = 0 + for b = 1, #cPalList, 1 do + if (b ~= a) then + c2 = cPalList[b] + r2,g2,b2 = c2[1],c2[2],c2[3] + wt = c2[6] + pd = math.pow((1 + wt / pixels), prot_pow) -- Protection, increase distance + dist = db.getColorDistance_weight(r1,g1,b1,r2,g2,b2,rw,gw,bw) * distfrac * pd + if dist <= crad then + wtot = wtot + wt + table.insert(cList,b) + maxDist = math.max(dist,maxDist) + end + end + end -- b + if #cList > 1 then + clustVal = maxDist / (crad1 * #cList) * (wtot / #cList) + if clustVal < worst then + worst = clustVal + clusterList = cList + end + end + end -- a + + --t = db.ary2txt(clusterList) + --messagebox("Worst cluster is "..t) + + -- Fuse + if #clusterList > 1 then + clusterExists = true -- Run another iteration and look for more clusters + fuseCol = {0,0,0,{}} + rt,gt,bt,tot = 0,0,0,0 + for n = 1, #clusterList, 1 do + i = clusterList[n] + c = cPalList[i] + --o = c[4][1] -- Original color (always #1 in list since fused colors can't re-fuse) + o = c[4] -- Original color list + --if c[5] == true then messagebox("Re-Fusing..."); end + r,g,b = c[1],c[2],c[3] + --wt = hist[o+1] -- Org. colors are 0-255 + wt = c[6] + rt = rt + r * wt + gt = gt + g * wt + bt = bt + b * wt + tot = tot + wt + cPalList[i] = -1 -- Erase color + --table.insert(fuseCol[4],o) + orgcols = fuseCol[4] + for j = 1, #o, 1 do + table.insert(orgcols,o[j]) + end + fuseCol[4] = orgcols + end + + rt = rt / tot + gt = gt / tot + bt = bt / tot + fuseCol[1] = rt + fuseCol[2] = gt + fuseCol[3] = bt + fuseCol[5] = true -- fusecol marker + fuseCol[6] = tot + table.insert(cPalList,fuseCol) + --messagebox(#clusterList.." Colors was fused, resulting in "..rt..", "..gt..", "..bt) + newPalList = {} + for n = 1, #cPalList, 1 do + if cPalList[n] ~= -1 then + table.insert(newPalList,cPalList[n]) + --newPalList = db.newArrayInsertLast(newPalList,cPalList[n]) + end + end + cPalList = newPalList + --messagebox("Pal length: "..#cPalList) + statusmessage("DeCluster - Image colors:"..#cPalList.." "); waitbreak(0) + end -- fuse + + end -- while + + -- Create remap-list + org = {} + count = 0 + for u = 1, #cPalList, 1 do + c = cPalList[u] + for n = 1, #c[4], 1 do + i = c[4][n] + org[i+1] = count -- quick way to remap without matchcolor + end + count = count + 1 + end + + return org,cPalList + +end; -- decluster + + +-- +-- ... eof Custom Color / Palette functions ... +-- + + +-- ***************************** +-- *** Custom Draw functions *** +-- ***************************** + +-- +function db.lineTransp(x1,y1,x2,y2,c,amt) -- amt: 0-1, 1 = Full color + local n,st,m,x,y,r,g,b,r1,g1,b1,c2,org; m = math + org = 1 - amt + st = m.max(1,m.abs(x2-x1),m.abs(y2-y1)); + for n = 0, st, 1 do + x = m.floor(x1+n*(x2-x1)/st) + y = m.floor(y1+n*(y2-y1)/st) + r,g,b = getcolor(getpicturepixel(x,y)) + r1,g1,b1 = getcolor(c) + c2 = matchcolor(r1*amt+r*org, g1*amt+g*org, b1*amt+b*org) + putpicturepixel(x, y, c2 ); + end +end +-- + +-- +function db.drawBrushRectangle(x1,y1,w,h,c) + local x,y + for y = y1, y1+h-1, 1 do + for x = x1, x1+w-1, 1 do + putbrushpixel(x,y,c); + end + end +end +-- + +-- +function db.drawRectangle(x1,y1,w,h,c) + drawfilledrect(x1, y1, x1+w, y1+w, c); +end +-- + +-- +function db.drawRectangleNeg(x1,y1,w,h,c) + local x,y,xs,ys + xs = db.sign(w) + ys = db.sign(h) + if xs == 0 then xs = 1; end + if ys == 0 then ys = 1; end + for y = y1, y1+h-1, ys do + for x = x1, x1+w-1, xs do + putpicturepixel(x,y,c); + end + end +end +-- + +-- +function db.drawRectangleLine(x,y,w,h,c) + w = w-1 + h = h-1 + drawline(x,y,x+w,y,c) + drawline(x,y,x,y+h,c) + drawline(x,y+h,x+w,y+h,c) + drawline(x+w,y,x+w,y+h,c) +end +-- + + +-- +function db.drawRectangleMix(x1,y1,w,h,c1,c2) + local x,y,c,n + c = {c1,c2} + n = 0 + for y = y1, y1+h-1, 1 do + n = n + 1 + for x = x1, x1+w-1, 1 do + n = n + 1 + putpicturepixel(x,y,c[n%2+1]); + end + end +end +-- + +-- +function db.drawBrushCircle(x1,y1,r,c) -- ok, lottsa weird adjustments here, can probably be optimized... + local x,y,d + for y = 0, r*2, 1 do + for x = 0, r*2, 1 do + d = math.sqrt((x-r-0.5)^2 + (y-r-0.5)^2) + if d < r-0.25 then putbrushpixel(x1+x-r-0.5,y1+y-r-0.5,c); end + end + end +end +-- + +-- +-- Rotation in degrees +-- Step is # of line segments (more is "better") +-- a & b are axis-radius +function db.ellipse2(x,y,a,b,stp,rot,col) + local n,m=math,rad,al,sa,ca,sb,cb,ox,oy,x1,y1,ast + m = math; rad = m.pi/180; ast = rad * 360/stp; + sb = m.sin(-rot * rad); cb = m.cos(-rot * rad) + for n = 0, stp, 1 do + ox = x1; oy = y1; + sa = m.sin(ast*n) * b; ca = m.cos(ast*n) * a + x1 = x + ca * cb - sa * sb + y1 = y + ca * sb + sa * cb + if (n > 0) then drawline(ox,oy,x1,y1,col); end + end +end +-- + + + +--[[ +var ER = 0.3 +var DR = 0.15 + +ellipse(0.5*xx,0.5*yy,DR*xx,6,Math.PI*0) + +function ellipse(x,y,r,stp,rot){ + var n,deg=360,m=Math,rad=Math.PI/180,rn + var ox,oy,x1,y1,x2,y2,d1,r1 = ER * xx + + for (n=0; n<=deg; n+=stp){ + + ox = x2; oy = y2, rn = rad * n + d1 = rn - rot + x1 = x + m.sin(d1) * r + y1 = y + m.cos(d1) * r + + x2 = x1 + m.sin(-rn) * r1 + y2 = y1 + m.cos(-rn) * r1 + if (n > 0){ line_rgb(MX,[0,0,0],0,ox,oy,x2,y2) } + } +} + +} + +ellipse2(0.5*xx,0.5*yy,15,8,200,22,[0,0,0],0.5) + +function ellipse2(x,y,a,b,stp,rot,rgb,transp){ + var n,m=Math,rad=m.PI/180,al,sa,ca,sb,cb,ox,oy,x1,y1 + sb = m.sin(-rot * rad); cb = m.cos(-rot * rad) + for (n=0; n<=stp; n++){ + ox = x1; oy = y1; al = rad * 360/stp * n + sa = m.sin(al) * b; ca = m.cos(al) * a + x1 = x + ca * cb - sa * sb + y1 = y + ca * sb + sa * cb + if (n > 0){ line_rgb(MX,rgb,transp,ox,oy,x1,y1) } + } +} + + +]] + + + +function db.obliqueCube(side,x,y,r,g,b,bri) + local n,c,depth,x1,y1,x2,y2,f + + f = matchcolor + c = f(r,g,b) + cP50 = f(r+bri*0.5,g+bri*0.5,b+bri*0.5) + cP75 = f(r+bri*0.75,g+bri*0.75,b+bri*0.75) + cM50 = f(r-bri*0.5,g-bri*0.5,b-bri*0.5) + cM100 = f(r-bri,g-bri,b-bri) + + depth = math.floor(side / 2) + + for n = 0, depth-1, 1 do + drawline(x+side+n,y-1-n,x+side+n,y+side-n-1,cM50) + end + + for n = 0, depth-1, 1 do + drawline(x+n,y-1-n,x+side+n-1,y-1-n,cP50) + end + + -- / + -- + --drawline(x+side,y-1,x+side+depth-1,y-depth,c) + + -- Smoothing & Shade + + -- + -- / + --drawline(x+side,y+side-1,x+side+depth-1,y+side-depth,cM100) + + --drawline(x,y,x+side-2,y,cP75) + --drawline(x,y,x,y+side-2,cP75) + + db.drawRectangle(x,y,side,side,c) + +end + + +function db.obliqueCubeBRI(side,x,y,r,g,b,bri,pallist,briweight,index_flag) + local n,c,depth,x1,y1,x2,y2 + + --f = db.getBestPalMatchHYBRID + c = db.getBestPalMatchHYBRID({r,g,b}, pallist, briweight, index_flag) + cP50 = db.getBestPalMatchHYBRID({r+bri*0.5,g+bri*0.5,b+bri*0.5}, pallist, briweight, index_flag) + cP75 = db.getBestPalMatchHYBRID({r+bri*0.75,g+bri*0.75,b+bri*0.75}, pallist, briweight, index_flag) + cM50 = db.getBestPalMatchHYBRID({r-bri*0.5,g-bri*0.5,b-bri*0.5}, pallist, briweight, index_flag) + cM100 = db.getBestPalMatchHYBRID({r-bri,g-bri,b-bri}, pallist, briweight, index_flag) + + depth = math.floor(side / 2) + + db.drawRectangle(x,y,side,side,c) + + for n = 0, depth-1, 1 do + drawline(x+side+n,y-1-n,x+side+n,y+side-n-1,cM50) + end + + for n = 0, depth-1, 1 do + drawline(x+n,y-1-n,x+side+n-1,y-1-n,cP50) + end + + -- / + -- + drawline(x+side,y-1,x+side+depth-1,y-depth,c) + + -- Smoothing & Shade + + -- + -- / + --drawline(x+side,y+side-1,x+side+depth-1,y+side-depth,cM100) + + --drawline(x,y,x+side-2,y,cP75) + --drawline(x,y,x,y+side-2,cP75) + + +end + + +-- +-- ... eof Custom Draw functions ... +-- + + +-- ****************************** +-- *** Filters & Convolutions *** +-- ****************************** + + +function db.applyConvolution2Pic(convmx,divisor,bias,neg,amt) + local r,g,b,mx,my,cx,cy,mxh,myh,mp,rb,gb,bb,xx,yy,x,y,w,h,div,n1,n2,amtr,ro,go,bo + + n1 = 1 + n2 = bias + if neg == 1 then + n1 = -1 + n2 = 255 + bias + end + + amtr = 1 - amt + w, h = getpicturesize() + cy = #convmx + cx = #convmx[1] + mxh = math.floor(cx / 2) + 1 + myh = math.floor(cy / 2) + 1 + + for y = 0, h-1, 1 do + for x = 0, w-1, 1 do + r,g,b = 0,0,0 + ro,go,bo = getcolor(getbackuppixel(x,y)) + div = divisor + for my = 1, cy, 1 do + for mx = 1, cx, 1 do + xp = mx-mxh + yp = my-myh + mp = convmx[my][mx] + xx = x + xp + yy = y + yp + if yy>=0 and yy=0 and xx 0 and n 0 and n0) then + x = x*px - fx + y = y*py - fy + nfrac = nfrac + spfrac + end + n = n+1 + end + --return 1 - n/i; + return 1 - nfrac/i +end +-- + + +-- +function db.mandel(x,y,l,r,o,i) -- pos. as fraction of 1, left coord, right coord, y coord, iterations + + local w,s,a,p,q,n,v,w + + s=math.abs(r-l); + + a = l + s*x; + p = a; + b = o - s*(y-0.5); + q = b; + n = 1; + v = 0; + w = 0; + + while (v+w<4 and n weakest then weakest = w; weak_i = {z,y,x}; end + end + + end;end;end + return weak_i[1],weak_i[2],weak_i[3] +end +-- + +-- +-- +-- Nearest color version: void is selected by the point that has the greatest distance +-- to the nearest color. Higher value means greater void. +-- +function db.addColor2Cube(cube,sha,r,g,b,rw,gw,bw) + local star,x,y,z,d,rd,gd,bd,cu1,cu2 + star = 0 + cube[r+1][g+1][b+1] = {false, star} + for z = 0, sha-1, 1 do + rd = (rw*(z-r))^2 + cu2 = cube[z+1] + for y = 0, sha-1, 1 do + gd = (gw*(y-g))^2 + cu1 = cu2[y+1] + for x = 0, sha-1, 1 do + + d = rd + gd + (bw*(x-b))^2 + + --cube[z+1][y+1][x+1][2] = math.min(d, cube[z+1][y+1][x+1][2]) -- Don't add, use nearest color + + cu1[x+1][2] = math.min(d, cu1[x+1][2]) + + end;end;end +end +-- + +-- Should be same as original, but not 100% verified. Using a rgb+1 trick to speed up handling +-- +function db.addColor2Cube_test(cube,sha,r,g,b,rw,gw,bw) + local star,x,y,z,d,rd,gd,bd,cu1,cu2 + star = 0 + r = r+1; g = g+1; b = b+1 + cube[r][g][b] = {false, star} + for z = 1, sha, 1 do + rd = (rw*(z-r))^2 + cu2 = cube[z] + for y = 1, sha, 1 do + gd = (gw*(y-g))^2 + cu1 = cu2[y] + for x = 1, sha, 1 do + cu1[x][2] = math.min(rd+gd+(bw*(x-b))^2, cu1[x][2]) + end;end;end +end +-- + + + +-- Create new allowed colorlines in colorspace (ramps from which colors can be picked) +function db.enableRangeColorsInCube(cube,sha,r1,g1,b1,r2,g2,b2) + + local div,r,g,b,n,rs,gs,bs + div = 256 / sha + rs = (r2 - r1) / sha / div + gs = (g2 - g1) / sha / div + bs = (b2 - b1) / sha / div + + for n = 0, sha-1, 1 do + + r = math.floor(r1/div + rs * n) + g = math.floor(g1/div + gs * n) + b = math.floor(b1/div + bs * n) + + cube[r+1][g+1][b+1][1] = true + + end +end +-- + + +function db.colorCigarr(shades,radius,fill_flag) + local s,rad,radsq,step,shalf,bas,cols,found,x,y,z,bri,con,d,n + radius = radius / 100 + step = math.floor(255 / (shades-1)) + shalf = math.floor(shades / 2) + s = shades - 1 + rad = math.floor(shades / 2 * radius) + radsq = rad^2 + + bas = 0 + cols = {} + found = 0 + + for z = 0, s, 1 do + for y = 0, s, 1 do + for x = 0, s, 1 do + + --0.26,0.55,0.19 + bri = (x + y + z ) / 3 + --bri = math.sqrt(((x*0.26)^2 + (y*0.55)^2 + (z*0.19)^2)) * 1.5609 + con = math.floor((shades - math.abs(bri - shalf)*2) * radius) + + d = math.floor(math.sqrt((bri-x)^2 + (bri-y)^2 + (bri-z)^2)) + --d = math.floor(math.sqrt(((bri-x)*0.26)^2 + ((bri-y)*0.55)^2 + ((bri-z)*0.19)^2)) * 1.5609 + + -- Filled cigarr: Less or Equal, cigarr shell: Equal + if d == con or (d < con and fill_flag) then + found = found + 1 + r = bas + x * step + g = bas + y * step + b = bas + z * step + cols[found] = {r,g,b} + end + + end; end; end + + --messagebox("Colors found: "..found.."\n\n".."Run AnalyzePalette to examine") + + for n = 0, 255, 1 do + if n < found then + c = cols[n+1] + setcolor(n,c[1],c[2],c[3]) + else + setcolor(n,0,0,0) + end + end +end -- eof colorcigarr + + +-- +-- ... eof Color Cube ... +-- + + + +-- COLORMIX -- +-- +-- Returns a list of mixcolors palette entries, that are ranked by by quality & usefulness +-- +-- This whole junk my partly locked on 16 shades (4096 colors/ 12bit palette precision) so don't use anything else... +-- +-- +function db.colormixAnalysis(sha,spare_flag,cust_dist) -- Interface + local shades,pallist,ilist,custom_max_distance + + shades = sha -- 16 is good + --messagebox(shades) + + custom_max_distance = -1 + if cust_dist ~= null then + custom_max_distance = cust_dist -- in % + end + + if spare_flag == true then -- No shades here for now + --pallist = db.makePalListShadeSPARE(256,shades) -- 16 shades so Colorcube processes is possible + pallist = db.makeSparePalList(256) + pallist = db.fixPalette(pallist,0) -- Remove doubles, No need to sort? + ilist = db.makeIndexList(pallist, -1) -- -1, use list order as index + else + pallist = db.makePalListShade(256,shades) -- 16 shades so Colorcube processes is possible + pallist = db.fixPalette(pallist,0) -- Remove doubles, No need to sort? + ilist = db.makeIndexList(pallist, -1) -- -1, use list order as index + end + + if shades > 0 then + return db.colormixAnalysisEXT(shades,pallist,ilist,custom_max_distance) -- max distance in % + end + if shades == -1 then + return db.colormixAnalysisEXTnoshade(pallist,ilist,custom_max_distance) -- max distance in % + end +end +-- +-- +function db.colormixAnalysisEXT(SHADES,pallist,ilist,custom_max_distance) -- Shades, most number of mixes returned + local n,m,c1,c2,pairs,cube,rm,gm,bm + local mix,total,found,dist,void,ideal,mini,maxi,bestmix,bestscore + + --messagebox("will now make pairs") + + pairs = db.pairsFromList(ilist,0) -- 0 for unique pairs only, pairs are entries in pallist + + --messagebox(#pairs.." will now add colors to cube") + + cube = db.initColorCube(SHADES,{true,9999}) + for n = 1, #pallist, 1 do + c1 = pallist[n] + db.addColor2Cube_test(cube,SHADES,c1[1],c1[2],c1[3],0.26,0.55,0.19) + end + + -- these values are adjusted for a 12bit palette (0-15) and perceptual weight where r+g+b = 1.0 + -- Ideal distance = 2.5 Green steps = 1.375 + -- Minimum distance = 1 Green step = 0.55 + + --messagebox("colorcube done") + + VACT = 1 + DACT = 1 + + total = 9.56 -- Max distance possible with 16 shades + ideal = 0.45 -- 1 step = 0.637 + mini = 0.35 + maxi = ideal + (total - ideal) / math.max(1, #pallist / 16) + if custom_max_distance ~= -1 then + maxi = total * (custom_max_distance / 100) + end + mix = {} + --mix[1] = {9e99,0,0,9e99,0,0,0} + bestmix = -1 + bestscore = 9e99 + found = 0 + for n = 1, #pairs, 1 do + + c1 = pallist[pairs[n][1]] + c2 = pallist[pairs[n][2]] + --0.26,0.55,0.19 + dist = db.getColorDistance_weight(c1[1],c1[2],c1[3],c2[1],c2[2],c2[3],0.26,0.55,0.19) -- Not normalized + + rm = math.floor((c1[1]+c2[1])/2) + gm = math.floor((c1[2]+c2[2])/2) + bm = math.floor((c1[3]+c2[3])/2) + + -- Mix color adjustment (perhaps less than perfect, but probably good enough) + mixbri = db.getBrightness(rm,gm,bm) + truebri = math.sqrt((db.getBrightness(c1[1],c1[2],c1[3])^2 + db.getBrightness(c2[1],c2[2],c2[3])^2) / 2) + diff = truebri - mixbri + rm = math.max(0,math.min(15,math.floor(rm + diff))) + gm = math.max(0,math.min(15,math.floor(gm + diff))) + bm = math.max(0,math.min(15,math.floor(bm + diff))) + newbri = db.getBrightness(rm,gm,bm) + delta = math.abs(newbri - truebri) + --if delta > 0.9 then + -- messagebox(pallist[pairs[n][1]][4]..", "..pallist[pairs[n][2]][4].." delta = "..delta) + --end + -- + + --rm = math.floor(math.sqrt((c1[1]^2 + c2[1]^2) / 2)) + --gm = math.floor(math.sqrt((c1[2]^2 + c2[2]^2) / 2)) + --bm = math.floor(math.sqrt((c1[3]^2 + c2[3]^2) / 2)) + + void = cube[rm+1][gm+1][bm+1][2] + + if dist >= mini and dist <= maxi then + found = found + 1 + score = ((1+DACT*(dist - ideal)^2) / (1+void*VACT)) -- Lowest is best + mix[found] = {score,pallist[pairs[n][1]][4],pallist[pairs[n][2]][4],dist,rm*SHADES,gm*SHADES,bm*SHADES,c1[1]*SHADES,c1[2]*SHADES,c1[3]*SHADES,c2[1]*SHADES,c2[2]*SHADES,c2[3]*SHADES} -- mix holds palette entry + if score < bestscore then bestscore = score; bestmix = found; end + end + + end + + + if true == false then + -- 2nd pass, add bestmix to colorspace. This reduces many similar mixes. + m = mix[bestmix] + db.addColor2Cube(cube,SHADES,m[5],m[6],m[7],0.26,0.55,0.19) + for n = 1, #mix, 1 do + if n ~= bestmix then + m = mix[n] + dist = m[4] + void = cube[m[5]+1][m[6]+1][m[7]+1][2] + score = ((1+DACT*(dist - ideal)^2) / (1+void*VACT)) + m[1] = score + end + end + end + + c1,c2 = -1,-1 + if found > 0 then + db.sorti(mix,1) + best = mix[1] + c1 = best[2] + c2 = best[3] + end + + --return found,c1,c2 + return mix,found,c1,c2 +end +-- + + +-- +-- Mixcolor without colorcube - no scoring or sorting, 24bit colors, faster... +-- +function db.colormixAnalysisEXTnoshade(pallist,ilist,custom_max_distance) + local n,m,c1,c2,pairs,cube,rm,gm,bm + local mix,total,found,dist,void,ideal,mini,maxi,bestmix,bestscore + + pairs = db.pairsFromList(ilist,0) -- 0 for unique pairs only, pairs are entries in pallist + + total = 162.53 -- Max distance possible with 24-bit palette ad Dawn3.0 color weights 162.53 + ideal = 0 + mini = 0 + maxi = ideal + (total - ideal) / math.max(1, #pallist / 16) + + if custom_max_distance ~= -1 then + maxi = total * (custom_max_distance / 100) + end + + mix = {} + found = 0 + for n = 1, #pairs, 1 do + + c1 = pallist[pairs[n][1]] + c2 = pallist[pairs[n][2]] + --0.26,0.55,0.19 + dist = db.getColorDistance_weight(c1[1],c1[2],c1[3],c2[1],c2[2],c2[3],0.26,0.55,0.19) -- Not normalized + + rm = math.floor((c1[1]+c2[1])/2) + gm = math.floor((c1[2]+c2[2])/2) + bm = math.floor((c1[3]+c2[3])/2) + + -- Mix color adjustment + mixbri = db.getBrightness(rm,gm,bm) + truebri = math.sqrt((db.getBrightness(c1[1],c1[2],c1[3])^2 + db.getBrightness(c2[1],c2[2],c2[3])^2) / 2) + diff = truebri - mixbri + rm = math.max(0,math.min(255,math.floor(rm + diff))) + gm = math.max(0,math.min(255,math.floor(gm + diff))) + bm = math.max(0,math.min(255,math.floor(bm + diff))) + newbri = db.getBrightness(rm,gm,bm) + delta = math.abs(newbri - truebri) + --if delta > 0.9 then + -- messagebox(pallist[pairs[n][1]][4]..", "..pallist[pairs[n][2]][4].." delta = "..delta) + --end + -- + + if dist >= mini and dist <= maxi then + found = found + 1 + score = 1 + mix[found] = {score,pallist[pairs[n][1]][4],pallist[pairs[n][2]][4],dist,rm,gm,bm,c1[1],c1[2],c1[3],c2[1],c2[2],c2[3]} -- mix holds palette entry + end + + end + + --messagebox(#mix) + + return mix,found,-1,-1 +end +-- + + + +-- Fuse a palettelist into an extended mix-anlysis list +function db.fusePALandMIX(pal,mix,max_score,max_dist) + local n,c,mixlist,tot,score,dist,c1,c2,rm,gm,bm + + mixlist = {} + tot = 0 + + -- {r,g,b,n} + for n = 1, #pal, 1 do + tot = tot + 1 + c = pal[n] + mixlist[tot] = {0,c[4],c[4],0,c[1],c[2],c[3],c[1],c[2],c[3],c[1],c[2],c[3]} + end + + -- {score,col#1,col#2,dist,rm,gm,bm} low score is best + for n = 1, #mix, 1 do + score = mix[n][1] + dist = mix[n][4] + if score <= max_score and dist <= max_dist then + tot = tot + 1 + mixlist[tot] = mix[n] + end + end + + return mixlist +end +-- + + +-- ******************************************** +-- *** L-system (fractal curves & "plants") *** +-- ******************************************** +-- + +-- +function db.Lsys_makeData(a) + local n,i; i = {} + for n = 1, #a, 1 do i[a[n][2]] = a[n]; end + return i +end +-- + +-- +function db.Lsys_makeSet(seed,iter,data) + local s,n,i,nset,set + set = seed + for n = 1, iter, 1 do + nset = '' + for i = 1, #set, 1 do + s = string.sub(set,i,i) + nset = nset..data[s][3] + end + set = nset + end + return set +end +-- + +function db.Lsys_draw(set,data,cx,cy,size,rot,rgb,rng,transp, speed) + local p,M,DEG,l,n,d,i,v,q,c,tx,ty,posx,posy,dval,col,w,h,s,cl,count + + if speed == nil then speed = 50; end -- speed is drawing operations per update + + function ang(d) return (d % 360 + 360) * DEG; end + + w,h = getpicturesize() + + p = 0 + M = math + DEG = math.pi/180 + l = #set + + posx={}; posy={}; dval={} + + if (rgb == null) then rgb = {0,0,0}; end + if (transp == null) then transp = 0; end + col = db.newArrayMerge(rgb,{}) + q = 255 / l + + count = 0 + for n = 1, l, 1 do + s = string.sub(set,n,n) + d = data[s] + i = d[1] + v = d[4] + + --messagebox(i) + + if (i == 'Left') then rot = rot - v; end + if (i == 'Right') then rot = rot + v; end + + if (i == 'Save') then p=p+1; posx[p] = cx; posy[p] = cy; dval[p] = rot; end + if (i == 'Load') then cx = posx[p]; cy = posy[p]; rot = dval[p]; p=p-1; end + + if (i == 'Draw') then + tx = cx + M.sin(ang(rot)) * size + ty = cy + -M.cos(ang(rot)) * size + for c = 1, 3, 1 do + if (rng[c] > 0) then col[c] = rgb[c] + (n * q) * rng[c]; end + if (rng[c] < 0) then col[c] = rgb[c] + (n * q) * rng[c]; end + end + + cl = matchcolor(col[1],col[2],col[3]) + --putpicturepixel(cx*w,cy*h,cl); + --drawline(cx*w,cy*h,tx*w,ty*h,cl) + db.lineTransp(cx*w,cy*h,tx*w,ty*h,cl,transp) + + cx = tx; cy = ty + end + count = count + 1 + if count == speed then count = 0; updatescreen(); if (waitbreak(0)==1) then return end; end + end + + return {cx,cy,rot} +end -- draw + + +-- +-- eof L-system +-- + + + + + + + + diff --git a/share/grafx2/scripts/libs/memory.lua b/share/grafx2/scripts/samples_2.3/libs/memory.lua similarity index 84% rename from share/grafx2/scripts/libs/memory.lua rename to share/grafx2/scripts/samples_2.3/libs/memory.lua index 22d1ea24..f650e873 100644 --- a/share/grafx2/scripts/libs/memory.lua +++ b/share/grafx2/scripts/samples_2.3/libs/memory.lua @@ -3,7 +3,7 @@ -- memory.save(tab) and tab=memory.load() -- -- The data will be stored in file called --- ZZZ.dat +-- .dat -- in the lua directory -- -- Example 1: @@ -74,12 +74,18 @@ memory = -- Get part after directory name last_slash=0 while true do - local pos = string.find(info.short_src, "/", last_slash+1) + local pos = string.find(info.source, "/", last_slash+1) if (pos==nil) then break end last_slash=pos end - caller=string.sub(info.short_src, last_slash+1) - + while true do + local pos = string.find(info.source, "\\", last_slash+1) + if (pos==nil) then break end + last_slash=pos + end + + caller=string.sub(info.source, last_slash+1) + -- Remove file extension if (string.sub(caller,-4, -1)==".lua") then caller=string.sub(caller, 1, -5) @@ -94,7 +100,7 @@ memory = -- messagebox(tostring(k)) -- messagebox(tostring(v)) --end - local f, e = io.open("ZZZ"..caller..".dat", "w"); + local f, e = io.open(caller..".dat", "w"); if (f ~= nil) then f:write("Entry {\n") for k, v in pairs(o) do @@ -119,7 +125,7 @@ memory = o[k]=v end end - local f = (loadfile("ZZZ"..caller..".dat")) + local f = (loadfile(caller..".dat")) if (f ~= nil) then f() end diff --git a/share/grafx2/scripts/pal_db_Desaturate.lua b/share/grafx2/scripts/samples_2.3/palette/Desaturate.lua similarity index 100% rename from share/grafx2/scripts/pal_db_Desaturate.lua rename to share/grafx2/scripts/samples_2.3/palette/Desaturate.lua diff --git a/share/grafx2/scripts/pal_db_ExpandColors.lua b/share/grafx2/scripts/samples_2.3/palette/ExpandColors.lua similarity index 100% rename from share/grafx2/scripts/pal_db_ExpandColors.lua rename to share/grafx2/scripts/samples_2.3/palette/ExpandColors.lua diff --git a/share/grafx2/scripts/pal_db_FillColorCube.lua b/share/grafx2/scripts/samples_2.3/palette/FillColorCube.lua similarity index 100% rename from share/grafx2/scripts/pal_db_FillColorCube.lua rename to share/grafx2/scripts/samples_2.3/palette/FillColorCube.lua diff --git a/share/grafx2/scripts/pal_db_InvertedRGB.lua b/share/grafx2/scripts/samples_2.3/palette/InvertedRGB.lua similarity index 100% rename from share/grafx2/scripts/pal_db_InvertedRGB.lua rename to share/grafx2/scripts/samples_2.3/palette/InvertedRGB.lua diff --git a/share/grafx2/scripts/pal_db_Set3bit.lua b/share/grafx2/scripts/samples_2.3/palette/Set3bit.lua similarity index 100% rename from share/grafx2/scripts/pal_db_Set3bit.lua rename to share/grafx2/scripts/samples_2.3/palette/Set3bit.lua diff --git a/share/grafx2/scripts/pal_db_Set6bit.lua b/share/grafx2/scripts/samples_2.3/palette/Set6bit.lua similarity index 100% rename from share/grafx2/scripts/pal_db_Set6bit.lua rename to share/grafx2/scripts/samples_2.3/palette/Set6bit.lua diff --git a/share/grafx2/scripts/pal_db_SetC64Palette.lua b/share/grafx2/scripts/samples_2.3/palette/SetC64Palette.lua similarity index 100% rename from share/grafx2/scripts/pal_db_SetC64Palette.lua rename to share/grafx2/scripts/samples_2.3/palette/SetC64Palette.lua diff --git a/share/grafx2/scripts/pal_db_ShiftHue.lua b/share/grafx2/scripts/samples_2.3/palette/ShiftHue.lua similarity index 100% rename from share/grafx2/scripts/pal_db_ShiftHue.lua rename to share/grafx2/scripts/samples_2.3/palette/ShiftHue.lua diff --git a/share/grafx2/scripts/pic_ni_cellcolourreducer.lua b/share/grafx2/scripts/samples_2.3/picture/CellColourReducer.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_cellcolourreducer.lua rename to share/grafx2/scripts/samples_2.3/picture/CellColourReducer.lua diff --git a/share/grafx2/scripts/pic_ni_drawgridisometric.lua b/share/grafx2/scripts/samples_2.3/picture/DrawGridIsometric.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_drawgridisometric.lua rename to share/grafx2/scripts/samples_2.3/picture/DrawGridIsometric.lua diff --git a/share/grafx2/scripts/pic_ni_drawgridorthogonal_rgbmatchcolor.lua b/share/grafx2/scripts/samples_2.3/picture/DrawGridOrthogonal_RGB.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_drawgridorthogonal_rgbmatchcolor.lua rename to share/grafx2/scripts/samples_2.3/picture/DrawGridOrthogonal_RGB.lua diff --git a/share/grafx2/scripts/pic_ni_drawgridorthogonal_indexedcolour.lua b/share/grafx2/scripts/samples_2.3/picture/DrawgridOrthogonal_Index.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_drawgridorthogonal_indexedcolour.lua rename to share/grafx2/scripts/samples_2.3/picture/DrawgridOrthogonal_Index.lua diff --git a/share/grafx2/scripts/pic_ni_GlassGridFilter.lua b/share/grafx2/scripts/samples_2.3/picture/GlassGridFilter.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_GlassGridFilter.lua rename to share/grafx2/scripts/samples_2.3/picture/GlassGridFilter.lua diff --git a/share/grafx2/scripts/pic_ni_palettetopicture.lua b/share/grafx2/scripts/samples_2.3/picture/PaletteToPicture.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_palettetopicture.lua rename to share/grafx2/scripts/samples_2.3/picture/PaletteToPicture.lua diff --git a/share/grafx2/scripts/pic_db_Pic2isometric.lua b/share/grafx2/scripts/samples_2.3/picture/Pic2isometric.lua similarity index 100% rename from share/grafx2/scripts/pic_db_Pic2isometric.lua rename to share/grafx2/scripts/samples_2.3/picture/Pic2isometric.lua diff --git a/share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua b/share/grafx2/scripts/samples_2.3/picture/Rainbow-Dark2Bright.lua similarity index 100% rename from share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua rename to share/grafx2/scripts/samples_2.3/picture/Rainbow-Dark2Bright.lua diff --git a/share/grafx2/scripts/scn_db_RemapImage2RGB.lua b/share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB.lua similarity index 100% rename from share/grafx2/scripts/scn_db_RemapImage2RGB.lua rename to share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB.lua diff --git a/share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua b/share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB_ed.lua similarity index 100% rename from share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua rename to share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB_ed.lua diff --git a/share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua b/share/grafx2/scripts/samples_2.3/picture/RemapImageTo3bitPal.lua similarity index 100% rename from share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua rename to share/grafx2/scripts/samples_2.3/picture/RemapImageTo3bitPal.lua diff --git a/share/grafx2/scripts/pic_ni_xbitcolourspacefrompalette.lua b/share/grafx2/scripts/samples_2.3/picture/XBitColourXpaceFromPalette.lua similarity index 100% rename from share/grafx2/scripts/pic_ni_xbitcolourspacefrompalette.lua rename to share/grafx2/scripts/samples_2.3/picture/XBitColourXpaceFromPalette.lua diff --git a/share/grafx2/skins/font_Classic.png b/share/grafx2/skins/font_Classic.png index 8db8d5fc..cdb07016 100644 Binary files a/share/grafx2/skins/font_Classic.png and b/share/grafx2/skins/font_Classic.png differ diff --git a/share/grafx2/skins/font_DPaint.png b/share/grafx2/skins/font_DPaint.png index c7c84745..f9e89c22 100644 Binary files a/share/grafx2/skins/font_DPaint.png and b/share/grafx2/skins/font_DPaint.png differ diff --git a/share/grafx2/skins/font_Fairlight.png b/share/grafx2/skins/font_Fairlight.png index 5d4f9818..f5ca8af9 100644 Binary files a/share/grafx2/skins/font_Fairlight.png and b/share/grafx2/skins/font_Fairlight.png differ diff --git a/share/grafx2/skins/font_Fun.png b/share/grafx2/skins/font_Fun.png index a1e36add..6d3b5667 100644 Binary files a/share/grafx2/skins/font_Fun.png and b/share/grafx2/skins/font_Fun.png differ diff --git a/share/grafx2/skins/font_Melon.png b/share/grafx2/skins/font_Melon.png index efa4d4f0..7ae30253 100644 Binary files a/share/grafx2/skins/font_Melon.png and b/share/grafx2/skins/font_Melon.png differ diff --git a/share/grafx2/skins/font_Seen.png b/share/grafx2/skins/font_Seen.png index 8510a9a0..85f82d56 100644 Binary files a/share/grafx2/skins/font_Seen.png and b/share/grafx2/skins/font_Seen.png differ diff --git a/share/grafx2/skins/skin_Clax2.gif b/share/grafx2/skins/skin_Clax2.gif index 1e9cac8f..6247deca 100644 Binary files a/share/grafx2/skins/skin_Clax2.gif and b/share/grafx2/skins/skin_Clax2.gif differ diff --git a/share/grafx2/skins/skin_Clax3.gif b/share/grafx2/skins/skin_Clax3.gif index 98fe8257..3e7d2f5b 100644 Binary files a/share/grafx2/skins/skin_Clax3.gif and b/share/grafx2/skins/skin_Clax3.gif differ diff --git a/share/grafx2/skins/skin_DPaint.png b/share/grafx2/skins/skin_DPaint.png index 2685dcb4..52fd2076 100644 Binary files a/share/grafx2/skins/skin_DPaint.png and b/share/grafx2/skins/skin_DPaint.png differ diff --git a/src/.DS_Store b/src/.DS_Store index fdc86689..98526fb4 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/English.lproj/InfoPlist.strings b/src/English.lproj/InfoPlist.strings index 1538ff21..456b0022 100644 Binary files a/src/English.lproj/InfoPlist.strings and b/src/English.lproj/InfoPlist.strings differ diff --git a/src/Grafx2.icns b/src/Grafx2.icns new file mode 100755 index 00000000..3d0bfa34 Binary files /dev/null and b/src/Grafx2.icns differ diff --git a/src/Grafx2.xcodeproj/project.pbxproj b/src/Grafx2.xcodeproj/project.pbxproj deleted file mode 100644 index dbebbcfb..00000000 --- a/src/Grafx2.xcodeproj/project.pbxproj +++ /dev/null @@ -1,754 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 002F39FA09D0881F10EBEB88 /* SDL_image.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F10EBEB88 /* SDL_image.framework */; }; - 002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A2C09D0888800EBEB88 /* SDLMain.m */; }; - 002F3A3F09D088BA00EBEB88 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A3E09D088BA00EBEB88 /* main.c */; }; - 40D82CA110ECAF13005D27B5 /* miscfileformats.c in Sources */ = {isa = PBXBuildFile; fileRef = 40D82CA010ECAF13005D27B5 /* miscfileformats.c */; }; - 40D82CA610ECAF58005D27B5 /* brush_ops.c in Sources */ = {isa = PBXBuildFile; fileRef = 40D82CA510ECAF58005D27B5 /* brush_ops.c */; }; - 40D82CAA10ECAFC5005D27B5 /* buttons_effects.c in Sources */ = {isa = PBXBuildFile; fileRef = 40D82CA910ECAFC5005D27B5 /* buttons_effects.c */; }; - 40D82CAE10ECAFDC005D27B5 /* layers.c in Sources */ = {isa = PBXBuildFile; fileRef = 40D82CAD10ECAFDC005D27B5 /* layers.c */; }; - 40D82CB210ECB02B005D27B5 /* fileformats.c in Sources */ = {isa = PBXBuildFile; fileRef = 40D82CB110ECB02B005D27B5 /* fileformats.c */; }; - 40D82CBF10ECB089005D27B5 /* libraw2crtc.c in Sources */ = {isa = PBXBuildFile; fileRef = 40D82CBE10ECB089005D27B5 /* libraw2crtc.c */; }; - 40D82D3A10ECC4CA005D27B5 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; }; - 40D82D4310ECC536005D27B5 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 40D82D4110ECC536005D27B5 /* Info.plist */; }; - 40D82D4410ECC536005D27B5 /* SDLMain.nib in Resources */ = {isa = PBXBuildFile; fileRef = 40D82D4210ECC536005D27B5 /* SDLMain.nib */; }; - 40D82D5010ECC609005D27B5 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 40D82D4E10ECC609005D27B5 /* Info.plist */; }; - 40D82D5110ECC609005D27B5 /* SDLMain.nib in Resources */ = {isa = PBXBuildFile; fileRef = 40D82D4F10ECC609005D27B5 /* SDLMain.nib */; }; - 40D82D5710ECC67A005D27B5 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 40D82D5510ECC67A005D27B5 /* Info.plist */; }; - 40D82D5810ECC67A005D27B5 /* SDLMain.nib in Resources */ = {isa = PBXBuildFile; fileRef = 40D82D5610ECC67A005D27B5 /* SDLMain.nib */; }; - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - F5142653101F6CC5006CF3C4 /* font_Classic.png in Copy skins */ = {isa = PBXBuildFile; fileRef = F514264D101F6CB8006CF3C4 /* font_Classic.png */; }; - F5142654101F6CC5006CF3C4 /* font_Fairlight.png in Copy skins */ = {isa = PBXBuildFile; fileRef = F514264E101F6CB8006CF3C4 /* font_Fairlight.png */; }; - F5142655101F6CC5006CF3C4 /* font_Fun.png in Copy skins */ = {isa = PBXBuildFile; fileRef = F514264F101F6CB9006CF3C4 /* font_Fun.png */; }; - F5142656101F6CC5006CF3C4 /* font_Melon.png in Copy skins */ = {isa = PBXBuildFile; fileRef = F5142650101F6CB9006CF3C4 /* font_Melon.png */; }; - F5142657101F6CC5006CF3C4 /* skin_classic.png in Copy skins */ = {isa = PBXBuildFile; fileRef = F5142651101F6CB9006CF3C4 /* skin_classic.png */; }; - F5142658101F6CC5006CF3C4 /* skin_modern.png in Copy skins */ = {isa = PBXBuildFile; fileRef = F5142652101F6CB9006CF3C4 /* skin_modern.png */; }; - F51CBD2E0EC8A3E1005C06AC /* 5pxtinyfont.png in Copy fonts */ = {isa = PBXBuildFile; fileRef = F51CBD2B0EC8A3E1005C06AC /* 5pxtinyfont.png */; }; - F51CBD2F0EC8A3E1005C06AC /* colorfont.pcx in Copy fonts */ = {isa = PBXBuildFile; fileRef = F51CBD2C0EC8A3E1005C06AC /* colorfont.pcx */; }; - F51CBD300EC8A3E1005C06AC /* Tuffy.ttf in Copy fonts */ = {isa = PBXBuildFile; fileRef = F51CBD2D0EC8A3E1005C06AC /* Tuffy.ttf */; }; - F539315E0FE171C3003CB103 /* pversion.c in Sources */ = {isa = PBXBuildFile; fileRef = F539315D0FE171C3003CB103 /* pversion.c */; }; - F5A33E6A0EC893F800F8052D /* 8pxfont.png in Copy fonts */ = {isa = PBXBuildFile; fileRef = F5A33E690EC893F800F8052D /* 8pxfont.png */; }; - F5AA405F0FBC406D00B7577C /* pxquad.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AA405A0FBC406D00B7577C /* pxquad.c */; }; - F5AA40600FBC406D00B7577C /* pxtall2.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AA405B0FBC406D00B7577C /* pxtall2.c */; }; - F5AA40610FBC406D00B7577C /* pxtriple.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AA405C0FBC406D00B7577C /* pxtriple.c */; }; - F5AA40620FBC406D00B7577C /* pxwide2.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AA405D0FBC406D00B7577C /* pxwide2.c */; }; - F5AA40630FBC406D00B7577C /* transform.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AA405E0FBC406D00B7577C /* transform.c */; }; - F5AC28BC0F4873C700455509 /* hotkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AC28B90F4873C700455509 /* hotkeys.c */; }; - F5AC28BD0F4873C700455509 /* input.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AC28BA0F4873C700455509 /* input.c */; }; - F5AC28BE0F4873C700455509 /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AC28BB0F4873C700455509 /* realpath.c */; }; - F5AD4B1F0EA8CCF0009CCAC4 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AD4B1E0EA8CCF0009CCAC4 /* version.c */; }; - F5AE6F990EDA119D000CE0EF /* GrafX2_Classic.gif in Copy fonts */ = {isa = PBXBuildFile; fileRef = F5AE6F980EDA119D000CE0EF /* GrafX2_Classic.gif */; }; - F5AE83FD0ECF8FD300200704 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5AE83FC0ECF8FD300200704 /* ApplicationServices.framework */; }; - F5AED03E0F1989E00090A93F /* mountlist.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AED03C0F1989E00090A93F /* mountlist.c */; }; - F5AFA00D0EFAC7D300663B43 /* brush.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA0070EFAC7D300663B43 /* brush.c */; }; - F5AFA00E0EFAC7D300663B43 /* pxsimple.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA0080EFAC7D300663B43 /* pxsimple.c */; }; - F5AFA00F0EFAC7D300663B43 /* pxtall.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA0090EFAC7D300663B43 /* pxtall.c */; }; - F5AFA0100EFAC7D300663B43 /* pxwide.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA00A0EFAC7D300663B43 /* pxwide.c */; }; - F5AFA0110EFAC7D300663B43 /* setup.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA00B0EFAC7D300663B43 /* setup.c */; }; - F5AFA0120EFAC7D300663B43 /* windows.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA00C0EFAC7D300663B43 /* windows.c */; }; - F5B138C30EB71D28000B83CC /* SDL_ttf in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B138C20EB71D28000B83CC /* SDL_ttf */; }; - F5B19B930EA4BE3E003F4BA4 /* graph.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B7B0EA4BE3E003F4BA4 /* graph.c */; }; - F5B19B940EA4BE3E003F4BA4 /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B7C0EA4BE3E003F4BA4 /* init.c */; }; - F5B19B950EA4BE3E003F4BA4 /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B7D0EA4BE3E003F4BA4 /* io.c */; }; - F5B19B970EA4BE3E003F4BA4 /* loadsave.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B7F0EA4BE3E003F4BA4 /* loadsave.c */; }; - F5B19B9A0EA4BE3E003F4BA4 /* op_c.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B820EA4BE3E003F4BA4 /* op_c.c */; }; - F5B19B9B0EA4BE3E003F4BA4 /* operatio.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B830EA4BE3E003F4BA4 /* operatio.c */; }; - F5B19B9C0EA4BE3E003F4BA4 /* pages.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B840EA4BE3E003F4BA4 /* pages.c */; }; - F5B19B9D0EA4BE3E003F4BA4 /* palette.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B850EA4BE3E003F4BA4 /* palette.c */; }; - F5B19B9E0EA4BE3E003F4BA4 /* readini.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B860EA4BE3E003F4BA4 /* readini.c */; }; - F5B19B9F0EA4BE3E003F4BA4 /* readline.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B870EA4BE3E003F4BA4 /* readline.c */; }; - F5B19BA00EA4BE3E003F4BA4 /* saveini.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B880EA4BE3E003F4BA4 /* saveini.c */; }; - F5B19BA10EA4BE3E003F4BA4 /* sdlscreen.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B890EA4BE3E003F4BA4 /* sdlscreen.c */; }; - F5B19BA20EA4BE3E003F4BA4 /* SFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B8A0EA4BE3E003F4BA4 /* SFont.c */; }; - F5B19BA30EA4BE3E003F4BA4 /* shade.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B8B0EA4BE3E003F4BA4 /* shade.c */; }; - F5B19BA40EA4BE3E003F4BA4 /* special.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B8C0EA4BE3E003F4BA4 /* special.c */; }; - F5B19C1D0EA4D71C003F4BA4 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */; }; - F5B19C3D0EA4DC91003F4BA4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F5B19C3B0EA4DC91003F4BA4 /* InfoPlist.strings */; }; - F5B1EE850EAD0F4E00B087B5 /* gfx2def.ini in Resources */ = {isa = PBXBuildFile; fileRef = F5B1EE840EAD0F4E00B087B5 /* gfx2def.ini */; }; - F5B310B40F949A9C008197E2 /* buttons.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B310AD0F949A9C008197E2 /* buttons.c */; }; - F5B310B50F949A9C008197E2 /* engine.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B310AE0F949A9C008197E2 /* engine.c */; }; - F5B310B60F949A9C008197E2 /* filesel.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B310AF0F949A9C008197E2 /* filesel.c */; }; - F5B310B70F949A9C008197E2 /* help.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B310B00F949A9C008197E2 /* help.c */; }; - F5B310B80F949A9C008197E2 /* keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B310B10F949A9C008197E2 /* keyboard.c */; }; - F5B310B90F949A9C008197E2 /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B310B20F949A9C008197E2 /* misc.c */; }; - F5B310BA0F949A9C008197E2 /* text.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B310B30F949A9C008197E2 /* text.c */; }; - F5CDCE320F6EA6D600B31F63 /* pxdouble.c in Sources */ = {isa = PBXBuildFile; fileRef = F5CDCE310F6EA6D600B31F63 /* pxdouble.c */; }; - F5DCE2BC0EA5116A0065B0EF /* SDL_ttf in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = F5DCE2BE0EA5118F0065B0EF /* SDL_ttf */; }; - F5DCE2BC0EA5116B0065B0EF /* SDL_image in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = F5DCE2BB0EA5116B0065B0EF /* SDL_image */; }; - F5DCE2BE0EA5118E0065B0EF /* SDL in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = F5DCE2BD0EA5118E0065B0EF /* SDL */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = SDL_image.framework/Versions/A; - dstSubfolderSpec = 10; - files = ( - F5DCE2BC0EA5116B0065B0EF /* SDL_image in Copy Frameworks into .app bundle */, - ); - name = "Copy Frameworks into .app bundle"; - runOnlyForDeploymentPostprocessing = 0; - }; - 002F39FD09D0883400EBEB89 /* Copy Frameworks into .app bundle */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = SDL.framework/Versions/A; - dstSubfolderSpec = 10; - files = ( - F5DCE2BE0EA5118E0065B0EF /* SDL in Copy Frameworks into .app bundle */, - ); - name = "Copy Frameworks into .app bundle"; - runOnlyForDeploymentPostprocessing = 0; - }; - 002F39FD09D0883400EBEB8A /* Copy Frameworks into .app bundle */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = SDL_ttf.framework/Versions/A; - dstSubfolderSpec = 10; - files = ( - F5DCE2BC0EA5116A0065B0EF /* SDL_ttf in Copy Frameworks into .app bundle */, - ); - name = "Copy Frameworks into .app bundle"; - runOnlyForDeploymentPostprocessing = 0; - }; - 40D82D4C10ECC5A4005D27B5 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = Library/Frameworks/SDL.framework/Resources; - dstSubfolderSpec = 7; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 40D82D5310ECC659005D27B5 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 7; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F514264B101F6C5B006CF3C4 /* Copy skins */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = skins; - dstSubfolderSpec = 7; - files = ( - F5142653101F6CC5006CF3C4 /* font_Classic.png in Copy skins */, - F5142654101F6CC5006CF3C4 /* font_Fairlight.png in Copy skins */, - F5142655101F6CC5006CF3C4 /* font_Fun.png in Copy skins */, - F5142656101F6CC5006CF3C4 /* font_Melon.png in Copy skins */, - F5142657101F6CC5006CF3C4 /* skin_classic.png in Copy skins */, - F5142658101F6CC5006CF3C4 /* skin_modern.png in Copy skins */, - ); - name = "Copy skins"; - runOnlyForDeploymentPostprocessing = 0; - }; - F5A33F1D0EC8A26C00F8052D /* Copy fonts */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = fonts; - dstSubfolderSpec = 7; - files = ( - F5AE6F990EDA119D000CE0EF /* GrafX2_Classic.gif in Copy fonts */, - F51CBD300EC8A3E1005C06AC /* Tuffy.ttf in Copy fonts */, - F51CBD2F0EC8A3E1005C06AC /* colorfont.pcx in Copy fonts */, - F51CBD2E0EC8A3E1005C06AC /* 5pxtinyfont.png in Copy fonts */, - F5A33E6A0EC893F800F8052D /* 8pxfont.png in Copy fonts */, - ); - name = "Copy fonts"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 002F39F909D0881F00EBEB88 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; - 002F39F909D0881F10EBEB88 /* SDL_image.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_image.framework; path = /Library/Frameworks/SDL_image.framework; sourceTree = ""; }; - 002F3A2B09D0888800EBEB88 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = SOURCE_ROOT; }; - 002F3A2C09D0888800EBEB88 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = SOURCE_ROOT; }; - 002F3A3E09D088BA00EBEB88 /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = SOURCE_ROOT; }; - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 32CA4F630368D1EE00C91783 /* Grafx2_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Grafx2_Prefix.pch; sourceTree = ""; }; - 40D82CA010ECAF13005D27B5 /* miscfileformats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = miscfileformats.c; sourceTree = ""; }; - 40D82CA510ECAF58005D27B5 /* brush_ops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = brush_ops.c; sourceTree = ""; }; - 40D82CA910ECAFC5005D27B5 /* buttons_effects.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = buttons_effects.c; sourceTree = ""; }; - 40D82CAD10ECAFDC005D27B5 /* layers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = layers.c; sourceTree = ""; }; - 40D82CB110ECB02B005D27B5 /* fileformats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fileformats.c; sourceTree = ""; }; - 40D82CBE10ECB089005D27B5 /* libraw2crtc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = libraw2crtc.c; sourceTree = ""; }; - 40D82D4110ECC536005D27B5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = /Library/Frameworks/SDL.framework/Resources/Info.plist; sourceTree = ""; }; - 40D82D4210ECC536005D27B5 /* SDLMain.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SDLMain.nib; path = /Library/Frameworks/SDL.framework/Resources/SDLMain.nib; sourceTree = ""; }; - 40D82D4E10ECC609005D27B5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = /Library/Frameworks/SDL.framework/Versions/A/Resources/Info.plist; sourceTree = ""; }; - 40D82D4F10ECC609005D27B5 /* SDLMain.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SDLMain.nib; path = /Library/Frameworks/SDL.framework/Versions/A/Resources/SDLMain.nib; sourceTree = ""; }; - 40D82D5510ECC67A005D27B5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = /Library/Frameworks/SDL.framework/Versions/A/Resources/Info.plist; sourceTree = ""; }; - 40D82D5610ECC67A005D27B5 /* SDLMain.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SDLMain.nib; path = /Library/Frameworks/SDL.framework/Versions/A/Resources/SDLMain.nib; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; - 8D1107320486CEB800E47090 /* Grafx2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Grafx2.app; sourceTree = BUILT_PRODUCTS_DIR; }; - F514264D101F6CB8006CF3C4 /* font_Classic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_Classic.png; path = skins/font_Classic.png; sourceTree = ""; }; - F514264E101F6CB8006CF3C4 /* font_Fairlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_Fairlight.png; path = skins/font_Fairlight.png; sourceTree = ""; }; - F514264F101F6CB9006CF3C4 /* font_Fun.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_Fun.png; path = skins/font_Fun.png; sourceTree = ""; }; - F5142650101F6CB9006CF3C4 /* font_Melon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_Melon.png; path = skins/font_Melon.png; sourceTree = ""; }; - F5142651101F6CB9006CF3C4 /* skin_classic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skin_classic.png; path = skins/skin_classic.png; sourceTree = ""; }; - F5142652101F6CB9006CF3C4 /* skin_modern.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skin_modern.png; path = skins/skin_modern.png; sourceTree = ""; }; - F51CBD2B0EC8A3E1005C06AC /* 5pxtinyfont.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 5pxtinyfont.png; path = fonts/5pxtinyfont.png; sourceTree = ""; }; - F51CBD2C0EC8A3E1005C06AC /* colorfont.pcx */ = {isa = PBXFileReference; lastKnownFileType = file; name = colorfont.pcx; path = fonts/colorfont.pcx; sourceTree = ""; }; - F51CBD2D0EC8A3E1005C06AC /* Tuffy.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = Tuffy.ttf; path = fonts/Tuffy.ttf; sourceTree = ""; }; - F539315D0FE171C3003CB103 /* pversion.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pversion.c; sourceTree = ""; }; - F5A33E690EC893F800F8052D /* 8pxfont.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 8pxfont.png; path = fonts/8pxfont.png; sourceTree = ""; }; - F5AA405A0FBC406D00B7577C /* pxquad.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxquad.c; sourceTree = ""; }; - F5AA405B0FBC406D00B7577C /* pxtall2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxtall2.c; sourceTree = ""; }; - F5AA405C0FBC406D00B7577C /* pxtriple.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxtriple.c; sourceTree = ""; }; - F5AA405D0FBC406D00B7577C /* pxwide2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxwide2.c; sourceTree = ""; }; - F5AA405E0FBC406D00B7577C /* transform.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = transform.c; sourceTree = ""; }; - F5AC28B90F4873C700455509 /* hotkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = hotkeys.c; sourceTree = ""; }; - F5AC28BA0F4873C700455509 /* input.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = input.c; sourceTree = ""; }; - F5AC28BB0F4873C700455509 /* realpath.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = realpath.c; sourceTree = ""; }; - F5AD4B1E0EA8CCF0009CCAC4 /* version.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = ""; }; - F5AE6F980EDA119D000CE0EF /* GrafX2_Classic.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = GrafX2_Classic.gif; path = fonts/GrafX2_Classic.gif; sourceTree = ""; }; - F5AE83FC0ECF8FD300200704 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; - F5AED03C0F1989E00090A93F /* mountlist.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mountlist.c; sourceTree = ""; }; - F5AFA0070EFAC7D300663B43 /* brush.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = brush.c; sourceTree = ""; }; - F5AFA0080EFAC7D300663B43 /* pxsimple.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxsimple.c; sourceTree = ""; }; - F5AFA0090EFAC7D300663B43 /* pxtall.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxtall.c; sourceTree = ""; }; - F5AFA00A0EFAC7D300663B43 /* pxwide.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxwide.c; sourceTree = ""; }; - F5AFA00B0EFAC7D300663B43 /* setup.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = setup.c; sourceTree = ""; }; - F5AFA00C0EFAC7D300663B43 /* windows.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = windows.c; sourceTree = ""; }; - F5B138C20EB71D28000B83CC /* SDL_ttf */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = SDL_ttf; path = /Library/Frameworks/SDL_ttf.framework/SDL_ttf; sourceTree = ""; }; - F5B19B6C0EA4BDA8003F4BA4 /* SDL_image.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_image.framework; path = /Library/Frameworks/SDL_image.framework; sourceTree = ""; }; - F5B19B7B0EA4BE3E003F4BA4 /* graph.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = graph.c; sourceTree = ""; }; - F5B19B7C0EA4BE3E003F4BA4 /* init.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = init.c; sourceTree = ""; }; - F5B19B7D0EA4BE3E003F4BA4 /* io.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = io.c; sourceTree = ""; }; - F5B19B7F0EA4BE3E003F4BA4 /* loadsave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = loadsave.c; sourceTree = ""; }; - F5B19B820EA4BE3E003F4BA4 /* op_c.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = op_c.c; sourceTree = ""; }; - F5B19B830EA4BE3E003F4BA4 /* operatio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = operatio.c; sourceTree = ""; }; - F5B19B840EA4BE3E003F4BA4 /* pages.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pages.c; sourceTree = ""; }; - F5B19B850EA4BE3E003F4BA4 /* palette.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = palette.c; sourceTree = ""; }; - F5B19B860EA4BE3E003F4BA4 /* readini.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = readini.c; sourceTree = ""; }; - F5B19B870EA4BE3E003F4BA4 /* readline.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = readline.c; sourceTree = ""; }; - F5B19B880EA4BE3E003F4BA4 /* saveini.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = saveini.c; sourceTree = ""; }; - F5B19B890EA4BE3E003F4BA4 /* sdlscreen.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = sdlscreen.c; sourceTree = ""; }; - F5B19B8A0EA4BE3E003F4BA4 /* SFont.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SFont.c; sourceTree = ""; }; - F5B19B8B0EA4BE3E003F4BA4 /* shade.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = shade.c; sourceTree = ""; }; - F5B19B8C0EA4BE3E003F4BA4 /* special.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = special.c; sourceTree = ""; }; - F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; - F5B19C3C0EA4DC91003F4BA4 /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - F5B1EE840EAD0F4E00B087B5 /* gfx2def.ini */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = gfx2def.ini; sourceTree = ""; }; - F5B310AD0F949A9C008197E2 /* buttons.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = buttons.c; sourceTree = ""; }; - F5B310AE0F949A9C008197E2 /* engine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = engine.c; sourceTree = ""; }; - F5B310AF0F949A9C008197E2 /* filesel.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = filesel.c; sourceTree = ""; }; - F5B310B00F949A9C008197E2 /* help.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = help.c; sourceTree = ""; }; - F5B310B10F949A9C008197E2 /* keyboard.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = keyboard.c; sourceTree = ""; }; - F5B310B20F949A9C008197E2 /* misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = ""; }; - F5B310B30F949A9C008197E2 /* text.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = text.c; sourceTree = ""; }; - F5CDCE310F6EA6D600B31F63 /* pxdouble.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxdouble.c; sourceTree = ""; }; - F5DCE2BB0EA5116B0065B0EF /* SDL_image */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = SDL_image; path = /Library/Frameworks/SDL_image.framework/Versions/A/SDL_image; sourceTree = ""; }; - F5DCE2BD0EA5118E0065B0EF /* SDL */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = SDL; path = /Library/Frameworks/SDL.framework/Versions/A/SDL; sourceTree = ""; }; - F5DCE2BE0EA5118F0065B0EF /* SDL_ttf */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = SDL_ttf; path = /Library/Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D11072E0486CEB800E47090 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F39FA09D0881F10EBEB88 /* SDL_image.framework in Frameworks */, - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, - F5B19C1D0EA4D71C003F4BA4 /* CoreFoundation.framework in Frameworks */, - F5B138C30EB71D28000B83CC /* SDL_ttf in Frameworks */, - F5AE83FD0ECF8FD300200704 /* ApplicationServices.framework in Frameworks */, - 40D82D3A10ECC4CA005D27B5 /* SDL.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - 002F3A2B09D0888800EBEB88 /* SDLMain.h */, - 002F3A2C09D0888800EBEB88 /* SDLMain.m */, - ); - name = Classes; - sourceTree = ""; - }; - 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 002F39F909D0881F00EBEB88 /* SDL.framework */, - 002F39F909D0881F10EBEB88 /* SDL_image.framework */, - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 29B97324FDCFA39411CA2CEA /* AppKit.framework */, - 29B97325FDCFA39411CA2CEA /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D1107320486CEB800E47090 /* Grafx2.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* Grafx2 */ = { - isa = PBXGroup; - children = ( - 40D82D5410ECC67A005D27B5 /* Resources */, - 40D82D4D10ECC609005D27B5 /* Resources */, - 40D82D4010ECC536005D27B5 /* Resources */, - 40D82CBE10ECB089005D27B5 /* libraw2crtc.c */, - 40D82CB110ECB02B005D27B5 /* fileformats.c */, - 40D82CAD10ECAFDC005D27B5 /* layers.c */, - 40D82CA910ECAFC5005D27B5 /* buttons_effects.c */, - 40D82CA510ECAF58005D27B5 /* brush_ops.c */, - 40D82CA010ECAF13005D27B5 /* miscfileformats.c */, - F514264D101F6CB8006CF3C4 /* font_Classic.png */, - F514264E101F6CB8006CF3C4 /* font_Fairlight.png */, - F514264F101F6CB9006CF3C4 /* font_Fun.png */, - F5142650101F6CB9006CF3C4 /* font_Melon.png */, - F5142651101F6CB9006CF3C4 /* skin_classic.png */, - F5142652101F6CB9006CF3C4 /* skin_modern.png */, - F539315D0FE171C3003CB103 /* pversion.c */, - F5CDCE310F6EA6D600B31F63 /* pxdouble.c */, - F5AC28B90F4873C700455509 /* hotkeys.c */, - F5AC28BA0F4873C700455509 /* input.c */, - F5AC28BB0F4873C700455509 /* realpath.c */, - F5AED03C0F1989E00090A93F /* mountlist.c */, - F5AFA0070EFAC7D300663B43 /* brush.c */, - F5AFA0080EFAC7D300663B43 /* pxsimple.c */, - F5AFA0090EFAC7D300663B43 /* pxtall.c */, - F5AFA00A0EFAC7D300663B43 /* pxwide.c */, - F5AFA00B0EFAC7D300663B43 /* setup.c */, - F5AFA00C0EFAC7D300663B43 /* windows.c */, - F5AE6F980EDA119D000CE0EF /* GrafX2_Classic.gif */, - F5AE83FC0ECF8FD300200704 /* ApplicationServices.framework */, - F51CBD2B0EC8A3E1005C06AC /* 5pxtinyfont.png */, - F51CBD2C0EC8A3E1005C06AC /* colorfont.pcx */, - F51CBD2D0EC8A3E1005C06AC /* Tuffy.ttf */, - F5A33E690EC893F800F8052D /* 8pxfont.png */, - F5B138C20EB71D28000B83CC /* SDL_ttf */, - F5B1EE840EAD0F4E00B087B5 /* gfx2def.ini */, - F5B310AD0F949A9C008197E2 /* buttons.c */, - F5B310AE0F949A9C008197E2 /* engine.c */, - F5B310AF0F949A9C008197E2 /* filesel.c */, - F5B310B00F949A9C008197E2 /* help.c */, - F5B310B10F949A9C008197E2 /* keyboard.c */, - F5B310B20F949A9C008197E2 /* misc.c */, - F5B310B30F949A9C008197E2 /* text.c */, - F5AD4B1E0EA8CCF0009CCAC4 /* version.c */, - F5DCE2BD0EA5118E0065B0EF /* SDL */, - F5DCE2BB0EA5116B0065B0EF /* SDL_image */, - F5DCE2BE0EA5118F0065B0EF /* SDL_ttf */, - F5B19C3B0EA4DC91003F4BA4 /* InfoPlist.strings */, - F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */, - F5B19B7B0EA4BE3E003F4BA4 /* graph.c */, - F5B19B7C0EA4BE3E003F4BA4 /* init.c */, - F5B19B7D0EA4BE3E003F4BA4 /* io.c */, - F5B19B7F0EA4BE3E003F4BA4 /* loadsave.c */, - F5B19B820EA4BE3E003F4BA4 /* op_c.c */, - F5B19B830EA4BE3E003F4BA4 /* operatio.c */, - F5B19B840EA4BE3E003F4BA4 /* pages.c */, - F5B19B850EA4BE3E003F4BA4 /* palette.c */, - F5B19B860EA4BE3E003F4BA4 /* readini.c */, - F5B19B870EA4BE3E003F4BA4 /* readline.c */, - F5B19B880EA4BE3E003F4BA4 /* saveini.c */, - F5B19B890EA4BE3E003F4BA4 /* sdlscreen.c */, - F5B19B8A0EA4BE3E003F4BA4 /* SFont.c */, - F5B19B8B0EA4BE3E003F4BA4 /* shade.c */, - F5B19B8C0EA4BE3E003F4BA4 /* special.c */, - F5B19B6C0EA4BDA8003F4BA4 /* SDL_image.framework */, - 080E96DDFE201D6D7F000001 /* Classes */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - name = Grafx2; - sourceTree = ""; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32CA4F630368D1EE00C91783 /* Grafx2_Prefix.pch */, - 002F3A3E09D088BA00EBEB88 /* main.c */, - F5AA405A0FBC406D00B7577C /* pxquad.c */, - F5AA405B0FBC406D00B7577C /* pxtall2.c */, - F5AA405C0FBC406D00B7577C /* pxtriple.c */, - F5AA405D0FBC406D00B7577C /* pxwide2.c */, - F5AA405E0FBC406D00B7577C /* transform.c */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 8D1107310486CEB800E47090 /* Info.plist */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, - 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; - 40D82D4010ECC536005D27B5 /* Resources */ = { - isa = PBXGroup; - children = ( - 40D82D4110ECC536005D27B5 /* Info.plist */, - 40D82D4210ECC536005D27B5 /* SDLMain.nib */, - ); - name = Resources; - path = /Library/Frameworks/SDL.framework/Resources; - sourceTree = ""; - }; - 40D82D4D10ECC609005D27B5 /* Resources */ = { - isa = PBXGroup; - children = ( - 40D82D4E10ECC609005D27B5 /* Info.plist */, - 40D82D4F10ECC609005D27B5 /* SDLMain.nib */, - ); - name = Resources; - path = /Library/Frameworks/SDL.framework/Versions/A/Resources; - sourceTree = ""; - }; - 40D82D5410ECC67A005D27B5 /* Resources */ = { - isa = PBXGroup; - children = ( - 40D82D5510ECC67A005D27B5 /* Info.plist */, - 40D82D5610ECC67A005D27B5 /* SDLMain.nib */, - ); - name = Resources; - path = /Library/Frameworks/SDL.framework/Versions/A/Resources; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D1107260486CEB800E47090 /* Grafx2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Grafx2" */; - buildPhases = ( - 8D1107290486CEB800E47090 /* Resources */, - 8D11072C0486CEB800E47090 /* Sources */, - 8D11072E0486CEB800E47090 /* Frameworks */, - 002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */, - 002F39FD09D0883400EBEB89 /* Copy Frameworks into .app bundle */, - 002F39FD09D0883400EBEB8A /* Copy Frameworks into .app bundle */, - F5A33F1D0EC8A26C00F8052D /* Copy fonts */, - F514264B101F6C5B006CF3C4 /* Copy skins */, - 40D82D4C10ECC5A4005D27B5 /* CopyFiles */, - 40D82D5310ECC659005D27B5 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Grafx2; - productInstallPath = "$(HOME)/Applications"; - productName = Grafx2; - productReference = 8D1107320486CEB800E47090 /* Grafx2.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Grafx2" */; - compatibilityVersion = "Xcode 2.4"; - hasScannedForEncodings = 1; - mainGroup = 29B97314FDCFA39411CA2CEA /* Grafx2 */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D1107260486CEB800E47090 /* Grafx2 */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D1107290486CEB800E47090 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F5B19C3D0EA4DC91003F4BA4 /* InfoPlist.strings in Resources */, - F5B1EE850EAD0F4E00B087B5 /* gfx2def.ini in Resources */, - 40D82D4310ECC536005D27B5 /* Info.plist in Resources */, - 40D82D4410ECC536005D27B5 /* SDLMain.nib in Resources */, - 40D82D5010ECC609005D27B5 /* Info.plist in Resources */, - 40D82D5110ECC609005D27B5 /* SDLMain.nib in Resources */, - 40D82D5710ECC67A005D27B5 /* Info.plist in Resources */, - 40D82D5810ECC67A005D27B5 /* SDLMain.nib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D11072C0486CEB800E47090 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */, - 002F3A3F09D088BA00EBEB88 /* main.c in Sources */, - F5B19B930EA4BE3E003F4BA4 /* graph.c in Sources */, - F5B19B940EA4BE3E003F4BA4 /* init.c in Sources */, - F5B19B950EA4BE3E003F4BA4 /* io.c in Sources */, - F5B19B970EA4BE3E003F4BA4 /* loadsave.c in Sources */, - F5B19B9A0EA4BE3E003F4BA4 /* op_c.c in Sources */, - F5B19B9B0EA4BE3E003F4BA4 /* operatio.c in Sources */, - F5B19B9C0EA4BE3E003F4BA4 /* pages.c in Sources */, - F5B19B9D0EA4BE3E003F4BA4 /* palette.c in Sources */, - F5B19B9E0EA4BE3E003F4BA4 /* readini.c in Sources */, - F5B19B9F0EA4BE3E003F4BA4 /* readline.c in Sources */, - F5B19BA00EA4BE3E003F4BA4 /* saveini.c in Sources */, - F5B19BA10EA4BE3E003F4BA4 /* sdlscreen.c in Sources */, - F5B19BA20EA4BE3E003F4BA4 /* SFont.c in Sources */, - F5B19BA30EA4BE3E003F4BA4 /* shade.c in Sources */, - F5B19BA40EA4BE3E003F4BA4 /* special.c in Sources */, - F5AD4B1F0EA8CCF0009CCAC4 /* version.c in Sources */, - F5AFA00D0EFAC7D300663B43 /* brush.c in Sources */, - F5AFA00E0EFAC7D300663B43 /* pxsimple.c in Sources */, - F5AFA00F0EFAC7D300663B43 /* pxtall.c in Sources */, - F5AFA0100EFAC7D300663B43 /* pxwide.c in Sources */, - F5AFA0110EFAC7D300663B43 /* setup.c in Sources */, - F5AFA0120EFAC7D300663B43 /* windows.c in Sources */, - F5AED03E0F1989E00090A93F /* mountlist.c in Sources */, - F5AC28BC0F4873C700455509 /* hotkeys.c in Sources */, - F5AC28BD0F4873C700455509 /* input.c in Sources */, - F5AC28BE0F4873C700455509 /* realpath.c in Sources */, - F5CDCE320F6EA6D600B31F63 /* pxdouble.c in Sources */, - F5B310B40F949A9C008197E2 /* buttons.c in Sources */, - F5B310B50F949A9C008197E2 /* engine.c in Sources */, - F5B310B60F949A9C008197E2 /* filesel.c in Sources */, - F5B310B70F949A9C008197E2 /* help.c in Sources */, - F5B310B80F949A9C008197E2 /* keyboard.c in Sources */, - F5B310B90F949A9C008197E2 /* misc.c in Sources */, - F5B310BA0F949A9C008197E2 /* text.c in Sources */, - F5AA405F0FBC406D00B7577C /* pxquad.c in Sources */, - F5AA40600FBC406D00B7577C /* pxtall2.c in Sources */, - F5AA40610FBC406D00B7577C /* pxtriple.c in Sources */, - F5AA40620FBC406D00B7577C /* pxwide2.c in Sources */, - F5AA40630FBC406D00B7577C /* transform.c in Sources */, - F539315E0FE171C3003CB103 /* pversion.c in Sources */, - 40D82CA110ECAF13005D27B5 /* miscfileformats.c in Sources */, - 40D82CA610ECAF58005D27B5 /* brush_ops.c in Sources */, - 40D82CAA10ECAFC5005D27B5 /* buttons_effects.c in Sources */, - 40D82CAE10ECAFDC005D27B5 /* layers.c in Sources */, - 40D82CB210ECB02B005D27B5 /* fileformats.c in Sources */, - 40D82CBF10ECB089005D27B5 /* libraw2crtc.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - F5B19C3B0EA4DC91003F4BA4 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - F5B19C3C0EA4DC91003F4BA4 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C01FCF4B08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Versions/A/Frameworks\""; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - __macosx__, - __linux__, - ); - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_4)", - ); - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_image.framework\""; - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL.framework\""; - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3 = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_ttf.framework\""; - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_4 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework\""; - PRODUCT_NAME = Grafx2; - REZ_SEARCH_PATHS = ""; - WRAPPER_EXTENSION = app; - ZERO_LINK = YES; - }; - name = Debug; - }; - C01FCF4C08A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - ppc, - i386, - ); - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Versions/A/Frameworks\""; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = ( - __macosx__, - __linux__, - ); - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_4)", - ); - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_image.framework\""; - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL.framework\""; - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3 = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_ttf.framework\""; - LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_4 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework\""; - PRODUCT_NAME = Grafx2; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - /Library/Frameworks, - "$(FRAMEWORK_SEARCH_PATHS)", - ); - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = ( - __macosx__, - __linux__, - ); - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - /usr/X11/include, - /Library/Frameworks/SDL_image.framework/Headers, - "$(HOME)/Library/Frameworks/SDL.framework/Headers", - /Library/Frameworks/SDL.framework/Headers, - /Library/SDL_ttf.framework/Headers, - /usr/local/include, - "$(HEADER_SEARCH_PATHS)", - ); - LIBRARY_SEARCH_PATHS = ( - /usr/X11/lib, - /usr/local/lib, - ); - OTHER_LDFLAGS = ( - "-lpng", - "-lz", - ); - PREBINDING = NO; - PRELINK_LIBS = SDL_Image; - SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; - STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; - ZERO_LINK = YES; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEAD_CODE_STRIPPING = YES; - FRAMEWORK_SEARCH_PATHS = ( - /Library/Frameworks, - "$(FRAMEWORK_SEARCH_PATHS)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - __macosx__, - __linux__, - ); - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(HOME)/Library/Frameworks/SDL.framework/Headers", - /Library/Frameworks/SDL.framework/Headers, - /usr/local/include, - "$(HEADER_SEARCH_PATHS)", - ); - LIBRARY_SEARCH_PATHS = /usr/local/lib; - OTHER_LDFLAGS = ( - "-lpng", - "-lz", - ); - PREBINDING = NO; - PRELINK_LIBS = SDL_Image; - SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; - STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Grafx2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4B08A954540054247B /* Debug */, - C01FCF4C08A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Grafx2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/src/Grafx2.xcodeproj/xx.pbxuser b/src/Grafx2.xcodeproj/xx.pbxuser deleted file mode 100644 index a3b5507f..00000000 --- a/src/Grafx2.xcodeproj/xx.pbxuser +++ /dev/null @@ -1,319 +0,0 @@ -// !$*UTF8*$! -{ - 002F3A2B09D0888800EBEB88 /* SDLMain.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {867, 536}}"; - sepNavSelRange = "{302, 0}"; - sepNavVisRect = "{{0, 0}, {867, 536}}"; - sepNavWindowFrame = "{{15, 76}, {906, 665}}"; - }; - }; - 002F3A2C09D0888800EBEB88 /* SDLMain.m */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1084, 7296}}"; - sepNavSelRange = "{1567, 12}"; - sepNavVisRect = "{{0, 718}, {867, 536}}"; - sepNavWindowFrame = "{{38, 55}, {906, 665}}"; - }; - }; - 002F3A3E09D088BA00EBEB88 /* main.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1044, 15086}}"; - sepNavSelRange = "{19535, 0}"; - sepNavVisRect = "{{0, 10961}, {867, 536}}"; - sepNavWindowFrame = "{{14, 76}, {906, 665}}"; - }; - }; - 29B97313FDCFA39411CA2CEA /* Project object */ = { - activeBuildConfigurationName = Release; - activeExecutable = F5B19B5D0EA4BD57003F4BA4 /* Grafx2 */; - activeTarget = 8D1107260486CEB800E47090 /* Grafx2 */; - addToTargets = ( - ); - breakpointsGroup = F5B19B700EA4BDA9003F4BA4 /* XCBreakpointsBucket */; - codeSenseManager = F5B19B6A0EA4BD79003F4BA4 /* Code sense */; - executables = ( - F5B19B5D0EA4BD57003F4BA4 /* Grafx2 */, - ); - perUserDictionary = { - PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 453, - 58, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXErrorsWarningsDataSource_TypeID, - PBXErrorsWarningsDataSource_MessageID, - PBXErrorsWarningsDataSource_LocationID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; - PBXFileTableDataSourceColumnWidthsKey = ( - 22, - 300, - 209, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXExecutablesDataSource_ActiveFlagID, - PBXExecutablesDataSource_NameID, - PBXExecutablesDataSource_CommentsID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = 1; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Built_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 99, - 20, - 48, - 43, - 43, - 20, - 264, - 10, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - PBXFileDataSource_Path_ColumnID, - PBXFileDataSource_Comments_ColumnID, - PBXFileDataSource_SCM_ColumnID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXFindDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFindDataSource_LocationID; - PBXFileTableDataSourceColumnWidthsKey = ( - 200, - 413.2085, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFindDataSource_MessageID, - PBXFindDataSource_LocationID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXSymbolsDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXSymbolsDataSource_SymbolNameID; - PBXFileTableDataSourceColumnWidthsKey = ( - 16, - 200, - 50, - 325.2085, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXSymbolsDataSource_SymbolTypeIconID, - PBXSymbolsDataSource_SymbolNameID, - PBXSymbolsDataSource_SymbolTypeID, - PBXSymbolsDataSource_ReferenceNameID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 20, - 262, - 20, - 48.1626, - 43, - 43, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_SCM_ColumnID, - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - ); - }; - PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXTargetDataSource_PrimaryAttribute; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 200, - 106, - 20, - 48, - 43, - 43, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXTargetDataSource_PrimaryAttribute, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - ); - }; - PBXPerProjectTemplateStateSaveDate = 270495112; - PBXWorkspaceStateSaveDate = 270495112; - }; - sourceControlManager = F5B19B690EA4BD79003F4BA4 /* Source Control */; - userBuildSettings = { - OBJROOT = "$(SYMROOT)"; - }; - }; - 32CA4F630368D1EE00C91783 /* Grafx2_Prefix.pch */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {932, 587}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRect = "{{0, 0}, {932, 587}}"; - sepNavWindowFrame = "{{15, 25}, {971, 716}}"; - }; - }; - 8D1107260486CEB800E47090 /* Grafx2 */ = { - activeExec = 0; - executables = ( - F5B19B5D0EA4BD57003F4BA4 /* Grafx2 */, - ); - }; - F51CBD2B0EC8A3E1005C06AC /* 5pxtinyfont.png */ = { - uiCtxt = { - sepNavWindowFrame = "{{15, 25}, {971, 716}}"; - }; - }; - F5A33E690EC893F800F8052D /* 8pxfont.png */ = { - uiCtxt = { - sepNavWindowFrame = "{{15, 76}, {906, 665}}"; - }; - }; - F5AD4B1E0EA8CCF0009CCAC4 /* version.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {932, 587}}"; - sepNavSelRange = "{26, 0}"; - sepNavVisRect = "{{0, 0}, {932, 587}}"; - sepNavWindowFrame = "{{7, 5}, {971, 716}}"; - }; - }; - F5AED03C0F1989E00090A93F /* mountlist.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {867, 17252}}"; - sepNavSelRange = "{4702, 50}"; - sepNavVisRect = "{{0, 2973}, {867, 536}}"; - sepNavWindowFrame = "{{15, 76}, {906, 665}}"; - }; - }; - F5B19B5D0EA4BD57003F4BA4 /* Grafx2 */ = { - isa = PBXExecutable; - activeArgIndex = 2147483647; - activeArgIndices = ( - ); - argumentStrings = ( - ); - autoAttachOnCrash = 1; - configStateDict = { - }; - customDataFormattersEnabled = 1; - debuggerPlugin = GDBDebugging; - disassemblyDisplayState = 0; - dylibVariantSuffix = ""; - enableDebugStr = 1; - environmentEntries = ( - ); - executableSystemSymbolLevel = 0; - executableUserSymbolLevel = 0; - libgmallocEnabled = 0; - name = Grafx2; - savedGlobals = { - }; - sourceDirectories = ( - ); - variableFormatDictionary = { - }; - }; - F5B19B690EA4BD79003F4BA4 /* Source Control */ = { - isa = PBXSourceControlManager; - fallbackIsa = XCSourceControlManager; - isSCMEnabled = 0; - scmConfiguration = { - }; - scmType = scm.subversion; - }; - F5B19B6A0EA4BD79003F4BA4 /* Code sense */ = { - isa = PBXCodeSenseManager; - indexTemplatePath = ""; - }; - F5B19B700EA4BDA9003F4BA4 /* XCBreakpointsBucket */ = { - isa = XCBreakpointsBucket; - name = "Project Breakpoints"; - objects = ( - ); - }; - F5B19B7B0EA4BE3E003F4BA4 /* graph.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1140, 52782}}"; - sepNavSelRange = "{6769, 0}"; - sepNavVisRect = "{{0, 0}, {867, 536}}"; - sepNavWindowFrame = "{{14, 76}, {906, 665}}"; - }; - }; - F5B19B7C0EA4BE3E003F4BA4 /* init.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1660, 46018}}"; - sepNavSelRange = "{81112, 1}"; - sepNavVisRect = "{{0, 44925}, {867, 536}}"; - sepNavWindowFrame = "{{12, 46}, {906, 665}}"; - }; - }; - F5B19B7F0EA4BE3E003F4BA4 /* loadsave.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1700, 112651}}"; - sepNavSelRange = "{1098, 24}"; - sepNavVisRect = "{{0, 331}, {867, 536}}"; - sepNavWindowFrame = "{{15, 76}, {906, 665}}"; - }; - }; - F5B19B850EA4BE3E003F4BA4 /* palette.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1268, 37031}}"; - sepNavSelRange = "{75128, 0}"; - sepNavVisRect = "{{0, 0}, {0, 0}}"; - sepNavWindowFrame = "{{15, 76}, {906, 665}}"; - }; - }; - F5B19B880EA4BE3E003F4BA4 /* saveini.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1156, 12084}}"; - sepNavSelRange = "{19568, 0}"; - sepNavVisRect = "{{0, 0}, {0, 0}}"; - sepNavWindowFrame = "{{15, 76}, {906, 665}}"; - }; - }; - F5B19B890EA4BE3E003F4BA4 /* sdlscreen.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1396, 4351}}"; - sepNavSelRange = "{2375, 0}"; - sepNavVisRect = "{{0, 1072}, {867, 536}}"; - sepNavWindowFrame = "{{35, 15}, {906, 665}}"; - }; - }; - F5B19C3C0EA4DC91003F4BA4 /* English */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1692, 536}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRect = "{{825, 0}, {867, 536}}"; - sepNavWindowFrame = "{{15, 76}, {906, 665}}"; - }; - }; -} diff --git a/src/Grafx2.xcodeproj/xx.perspective b/src/Grafx2.xcodeproj/xx.perspective deleted file mode 100644 index f9c5d992..00000000 --- a/src/Grafx2.xcodeproj/xx.perspective +++ /dev/null @@ -1,1403 +0,0 @@ - - - - - ActivePerspectiveName - Build - AllowedModules - - - BundleLoadPath - - MaxInstances - n - Module - PBXSmartGroupTreeModule - Name - Groups and Files Outline View - - - BundleLoadPath - - MaxInstances - n - Module - PBXNavigatorGroup - Name - Editor - - - BundleLoadPath - - MaxInstances - n - Module - XCTaskListModule - Name - Task List - - - BundleLoadPath - - MaxInstances - n - Module - XCDetailModule - Name - File and Smart Group Detail Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXBuildResultsModule - Name - Detailed Build Results Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXProjectFindModule - Name - Project Batch Find Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXRunSessionModule - Name - Run Log - - - BundleLoadPath - - MaxInstances - n - Module - PBXBookmarksModule - Name - Bookmarks Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXClassBrowserModule - Name - Class Browser - - - BundleLoadPath - - MaxInstances - n - Module - PBXCVSModule - Name - Source Code Control Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXDebugBreakpointsModule - Name - Debug Breakpoints Tool - - - BundleLoadPath - - MaxInstances - n - Module - XCDockableInspector - Name - Inspector - - - BundleLoadPath - - MaxInstances - n - Module - PBXOpenQuicklyModule - Name - Open Quickly Tool - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugSessionModule - Name - Debugger - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugCLIModule - Name - Debug Console - - - Description - AIODescriptionKey - DockingSystemVisible - - Extension - perspective - FavBarConfig - - PBXProjectModuleGUID - F5A33EC80EC89C3000F8052D - XCBarModuleItemNames - - XCBarModuleItems - - - FirstTimeWindowDisplayed - - Identifier - com.apple.perspectives.project.default - MajorVersion - 33 - MinorVersion - 0 - Name - All-In-One - Notifications - - OpenEditors - - PerspectiveWidths - - 971 - 971 - 971 - - Perspectives - - - ChosenToolbarItems - - XCToolbarPerspectiveControl - NSToolbarSeparatorItem - active-target-popup - active-buildstyle-popup - action - NSToolbarFlexibleSpaceItem - buildOrClean - build-and-runOrDebug - com.apple.ide.PBXToolbarStopButton - get-info - toggle-editor - NSToolbarFlexibleSpaceItem - com.apple.pbx.toolbar.searchfield - - ControllerClassBaseName - - IconName - WindowOfProject - Identifier - perspective.project - IsVertical - - Layout - - - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - 1C77FABC04509CD000000102 - - PBXProjectModuleGUID - 1CA23ED40692098700951B8B - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 345 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 29B97314FDCFA39411CA2CEA - 29B97317FDCFA39411CA2CEA - 1C37FBAC04509CD000000102 - F56B73F7101F6D9500B6D9A4 - F56B7443101FA1C600B6D9A4 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {345, 600}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - - - GeometryConfiguration - - Frame - {{0, 0}, {362, 618}} - GroupTreeTableConfiguration - - MainColumn - 345 - - - Module - PBXSmartGroupTreeModule - Proportion - 362pt - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - F5A33EBD0EC89C3000F8052D - PBXProjectModuleLabel - - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - F5A33EBE0EC89C3000F8052D - PBXProjectModuleLabel - - - SplitCount - 1 - - StatusBarVisibility - - XCSharingToken - com.apple.Xcode.CommonNavigatorGroupSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {604, 0}} - - Module - PBXNavigatorGroup - Proportion - 0pt - - - Proportion - 613pt - Tabs - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA23EDF0692099D00951B8B - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{10, 27}, {604, 586}} - - Module - XCDetailModule - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA23EE00692099D00951B8B - PBXProjectModuleLabel - Project Find - - GeometryConfiguration - - Frame - {{10, 27}, {644, 586}} - - Module - PBXProjectFindModule - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA23EE10692099D00951B8B - PBXProjectModuleLabel - SCM Results - - GeometryConfiguration - - Frame - {{10, 27}, {644, 586}} - - Module - PBXCVSModule - - - - - Proportion - 604pt - - - Name - Project - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - XCModuleDock - PBXNavigatorGroup - XCDockableTabModule - XCDetailModule - PBXProjectFindModule - PBXCVSModule - - TableOfContents - - F56B7444101FA1C600B6D9A4 - 1CA23ED40692098700951B8B - F56B7445101FA1C600B6D9A4 - F5A33EBD0EC89C3000F8052D - F56B7446101FA1C600B6D9A4 - 1CA23EDF0692099D00951B8B - 1CA23EE00692099D00951B8B - 1CA23EE10692099D00951B8B - - ToolbarConfiguration - xcode.toolbar.config.default - - - ChosenToolbarItems - - XCToolbarPerspectiveControl - NSToolbarSeparatorItem - active-target-popup - active-buildstyle-popup - active-executable-popup - NSToolbarFlexibleSpaceItem - build - clean - NSToolbarSeparatorItem - run - debug - - ControllerClassBaseName - - IconName - BuildTabIcon - Identifier - perspective.build - IsVertical - - Layout - - - BecomeActive - - ContentConfiguration - - PBXBottomSmartGroupGIDs - - PBXProjectModuleGUID - 1CA23EE50692099D00951B8B - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 275 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 29B97314FDCFA39411CA2CEA - F5B19C3B0EA4DC91003F4BA4 - 080E96DDFE201D6D7F000001 - 29B97315FDCFA39411CA2CEA - 29B97317FDCFA39411CA2CEA - 29B97323FDCFA39411CA2CEA - 1058C7A0FEA54F0111CA2CBB - 1058C7A2FEA54F0111CA2CBB - 19C28FACFE9D520D11CA2CBB - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 42 - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 475}, {275, 600}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - - - GeometryConfiguration - - Frame - {{0, 0}, {292, 618}} - GroupTreeTableConfiguration - - MainColumn - 275 - - RubberWindowFrame - 151 75 971 659 0 0 1024 746 - - Module - PBXSmartGroupTreeModule - Proportion - 292pt - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - F5A33EC20EC89C3000F8052D - PBXProjectModuleLabel - - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - F5A33EC30EC89C3000F8052D - PBXProjectModuleLabel - - - SplitCount - 1 - - StatusBarVisibility - - XCSharingToken - com.apple.Xcode.CommonNavigatorGroupSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {674, 0}} - RubberWindowFrame - 151 75 971 659 0 0 1024 746 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - Proportion - 613pt - Tabs - - - ContentConfiguration - - PBXBuildLogShowsTranscriptDefaultKey - {{0, 5}, {674, 581}} - PBXProjectModuleGUID - XCMainBuildResultsModuleGUID - PBXProjectModuleLabel - Build - XCBuildResultsTrigger_Collapse - 1021 - XCBuildResultsTrigger_Open - 1011 - - GeometryConfiguration - - Frame - {{10, 27}, {674, 586}} - RubberWindowFrame - 151 75 971 659 0 0 1024 746 - - Module - PBXBuildResultsModule - - - ContentConfiguration - - LauncherConfigVersion - 3 - PBXProjectModuleGUID - 1CA23EE80692099D00951B8B - PBXProjectModuleLabel - Run - Runner - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {365, 167}} - {{0, 176}, {365, 267}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {405, 443}} - {{414, 0}, {514, 443}} - - - - - GeometryConfiguration - - Frame - {{10, 27}, {902, 597}} - - Module - PBXRunSessionModule - - - - - Proportion - 674pt - - - Name - Build - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - XCModuleDock - PBXNavigatorGroup - XCDockableTabModule - PBXBuildResultsModule - PBXRunSessionModule - XCConsole - - TableOfContents - - F56B7447101FA1C600B6D9A4 - 1CA23EE50692099D00951B8B - F56B7448101FA1C600B6D9A4 - F5A33EC20EC89C3000F8052D - F56B7449101FA1C600B6D9A4 - XCMainBuildResultsModuleGUID - 1CA23EE80692099D00951B8B - F56B744A101FA1C600B6D9A4 - - ToolbarConfiguration - xcode.toolbar.config.buildAndRun - - - ChosenToolbarItems - - XCToolbarPerspectiveControl - NSToolbarSeparatorItem - build-and-debug - debug - NSToolbarFlexibleSpaceItem - debugger-fix-and-continue - debugger-restart-executable - debugger-pause - debugger-continue - debugger-step-over - debugger-step-into - debugger-step-out - debugger-step-instruction - NSToolbarFlexibleSpaceItem - - ControllerClassBaseName - PBXDebugSessionModule - IconName - DebugTabIcon - Identifier - perspective.debug - IsVertical - - Layout - - - ContentConfiguration - - PBXProjectModuleGUID - 1CCC7628064C1048000F2A68 - PBXProjectModuleLabel - Debugger Console - - GeometryConfiguration - - Frame - {{0, 0}, {971, 0}} - - Module - PBXDebugCLIModule - Proportion - 0pt - - - ContentConfiguration - - Debugger - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {470, 295}} - {{470, 0}, {501, 295}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {971, 295}} - {{0, 295}, {971, 318}} - - - - LauncherConfigVersion - 8 - PBXProjectModuleGUID - 1CCC7629064C1048000F2A68 - PBXProjectModuleLabel - Debug - - GeometryConfiguration - - DebugConsoleDrawerSize - {100, 120} - DebugConsoleVisible - None - DebugConsoleWindowFrame - {{200, 200}, {500, 300}} - DebugSTDIOWindowFrame - {{200, 200}, {500, 300}} - Frame - {{0, 5}, {971, 613}} - - Module - PBXDebugSessionModule - Proportion - 613pt - - - Name - Debug - ServiceClasses - - XCModuleDock - PBXDebugCLIModule - PBXDebugSessionModule - PBXDebugProcessAndThreadModule - PBXDebugProcessViewModule - PBXDebugThreadViewModule - PBXDebugStackFrameViewModule - PBXNavigatorGroup - XCConsole - - TableOfContents - - F56B744B101FA1C600B6D9A4 - 1CCC7628064C1048000F2A68 - 1CCC7629064C1048000F2A68 - F56B744C101FA1C600B6D9A4 - F56B744D101FA1C600B6D9A4 - F56B744E101FA1C600B6D9A4 - F56B744F101FA1C600B6D9A4 - F56B7409101F6DEB00B6D9A4 - F56B7450101FA1C600B6D9A4 - - ToolbarConfiguration - xcode.toolbar.config.debug - - - PerspectivesBarVisible - - PinnedNavigatorIdentifier - F56B743E101F7E4F00B6D9A4 - ShelfIsVisible - - SourceDescription - file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecification.xcperspec' - StatusbarIsVisible - - TimeStamp - 0.0 - ToolbarDisplayMode - 1 - ToolbarIsVisible - - ToolbarSizeMode - 1 - Type - Perspectives - UpdateMessage - - WindowJustification - 5 - WindowOrderList - - F56B7450101FA1C600B6D9A4 - /Users/xx/Grafx2/Grafx2.xcodeproj - - WindowString - 151 75 971 659 0 0 1024 746 - WindowTools - - - Identifier - windowTool.find - Layout - - - Dock - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CDD528C0622207200134675 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CD0528D0623707200166675 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {781, 167}} - RubberWindowFrame - 62 385 781 470 0 0 1440 878 - - Module - PBXNavigatorGroup - Proportion - 781pt - - - Proportion - 50% - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528E0623707200166675 - PBXProjectModuleLabel - Project Find - - GeometryConfiguration - - Frame - {{8, 0}, {773, 254}} - RubberWindowFrame - 62 385 781 470 0 0 1440 878 - - Module - PBXProjectFindModule - Proportion - 50% - - - Proportion - 428pt - - - Name - Project Find - ServiceClasses - - PBXProjectFindModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C530D57069F1CE1000CFCEE - 1C530D58069F1CE1000CFCEE - 1C530D59069F1CE1000CFCEE - 1CDD528C0622207200134675 - 1C530D5A069F1CE1000CFCEE - 1CE0B1FE06471DED0097A5F4 - 1CD0528E0623707200166675 - - WindowString - 62 385 781 470 0 0 1440 878 - WindowToolGUID - 1C530D57069F1CE1000CFCEE - WindowToolIsVisible - 0 - - - Identifier - windowTool.run - Layout - - - Dock - - - ContentConfiguration - - LauncherConfigVersion - 3 - PBXProjectModuleGUID - 1CD0528B0623707200166675 - PBXProjectModuleLabel - Run - cocoapp112 - cocoapp112 - Runner - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {365, 167}} - {{0, 176}, {365, 267}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {405, 443}} - {{414, 0}, {514, 443}} - - - - - GeometryConfiguration - - Frame - {{0, 0}, {456, 192}} - RubberWindowFrame - 741 130 456 234 0 0 1280 1002 - - Module - PBXRunSessionModule - Proportion - 192pt - - - Proportion - 192pt - - - Name - Run Log - ServiceClasses - - PBXRunSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAAF065D492600B07095 - 1C78EAB0065D492600B07095 - 1CD0528B0623707200166675 - 1C78EAB1065D492600B07095 - - ToolbarConfiguration - xcode.toolbar.config.run - WindowString - 741 130 456 234 0 0 1280 1002 - - - Identifier - windowTool.scm - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAB2065D492600B07095 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1C78EAB3065D492600B07095 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {452, 0}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD052920623707200166675 - PBXProjectModuleLabel - SCM - - GeometryConfiguration - - ConsoleFrame - {{0, 259}, {452, 0}} - Frame - {{0, 7}, {452, 259}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - TableConfiguration - - Status - 30 - FileName - 199 - Path - 197.09500122070312 - - TableFrame - {{0, 0}, {452, 250}} - - Module - PBXCVSModule - Proportion - 262pt - - - Proportion - 266pt - - - Name - SCM - ServiceClasses - - PBXCVSModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAB4065D492600B07095 - 1C78EAB5065D492600B07095 - 1C78EAB2065D492600B07095 - 1CD052920623707200166675 - - ToolbarConfiguration - xcode.toolbar.config.scm - WindowString - 743 379 452 308 0 0 1280 1002 - - - Identifier - windowTool.breakpoints - IsVertical - 0 - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C77FABC04509CD000000102 - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - no - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 168 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 1C77FABC04509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {168, 350}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 0 - - GeometryConfiguration - - Frame - {{0, 0}, {185, 368}} - GroupTreeTableConfiguration - - MainColumn - 168 - - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 185pt - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA1AED706398EBD00589147 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{190, 0}, {554, 368}} - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - XCDetailModule - Proportion - 554pt - - - Proportion - 368pt - - - MajorVersion - 2 - MinorVersion - 0 - Name - Breakpoints - ServiceClasses - - PBXSmartGroupTreeModule - XCDetailModule - - StatusbarIsVisible - 1 - TableOfContents - - 1CDDB66807F98D9800BB5817 - 1CDDB66907F98D9800BB5817 - 1CE0B1FE06471DED0097A5F4 - 1CA1AED706398EBD00589147 - - ToolbarConfiguration - xcode.toolbar.config.breakpoints - WindowString - 315 424 744 409 0 0 1440 878 - WindowToolGUID - 1CDDB66807F98D9800BB5817 - WindowToolIsVisible - 1 - - - Identifier - windowTool.debugAnimator - Layout - - - Dock - - - Module - PBXNavigatorGroup - Proportion - 100% - - - Proportion - 100% - - - Name - Debug Visualizer - ServiceClasses - - PBXNavigatorGroup - - StatusbarIsVisible - 1 - ToolbarConfiguration - xcode.toolbar.config.debugAnimator - WindowString - 100 100 700 500 0 0 1280 1002 - - - Identifier - windowTool.bookmarks - Layout - - - Dock - - - Module - PBXBookmarksModule - Proportion - 166pt - - - Proportion - 166pt - - - Name - Bookmarks - ServiceClasses - - PBXBookmarksModule - - StatusbarIsVisible - 0 - WindowString - 538 42 401 187 0 0 1280 1002 - - - Identifier - windowTool.classBrowser - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - OptionsSetName - Hierarchy, all classes - PBXProjectModuleGUID - 1CA6456E063B45B4001379D8 - PBXProjectModuleLabel - Class Browser - NSObject - - GeometryConfiguration - - ClassesFrame - {{0, 0}, {369, 96}} - ClassesTreeTableConfiguration - - PBXClassNameColumnIdentifier - 208 - PBXClassBookColumnIdentifier - 22 - - Frame - {{0, 0}, {616, 353}} - MembersFrame - {{0, 105}, {369, 395}} - MembersTreeTableConfiguration - - PBXMemberTypeIconColumnIdentifier - 22 - PBXMemberNameColumnIdentifier - 216 - PBXMemberTypeColumnIdentifier - 94 - PBXMemberBookColumnIdentifier - 22 - - PBXModuleWindowStatusBarHidden2 - 1 - RubberWindowFrame - 597 125 616 374 0 0 1280 1002 - - Module - PBXClassBrowserModule - Proportion - 354pt - - - Proportion - 354pt - - - Name - Class Browser - ServiceClasses - - PBXClassBrowserModule - - StatusbarIsVisible - 0 - TableOfContents - - 1C78EABA065D492600B07095 - 1C78EABB065D492600B07095 - 1CA6456E063B45B4001379D8 - - ToolbarConfiguration - xcode.toolbar.config.classbrowser - WindowString - 597 125 616 374 0 0 1280 1002 - - - - diff --git a/src/Makefile b/src/Makefile index 7846d638..80d1b167 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,6 @@ # Grafx2 - The Ultimate 256-color bitmap paint program # +# Copyright 2011 Franck Charlet # Copyright 2011 Pawel Góralski # Copyright 2009 Per Olofsson # Copyright 2008 Peter Gordon @@ -31,6 +32,11 @@ # Compile with OPTIM=0 to disable gcc optimizations, to enable debug. STRIP = strip +### Specific to build MAC OS X universal binaries on Tiger ### +### (may need to be changed or removed depedning on the OSX version) ### + +MACOSX_SYSROOT = /Developer/SDKs/MacOSX10.4u.sdk +MACOSX_ARCH = -arch ppc -arch i386 ### PLATFORM DETECTION AND CONFIGURATION ### @@ -41,7 +47,7 @@ PLATFORMOBJ = ifdef COMSPEC DELCOMMAND = rm -f MKDIR = mkdir -p - RMDIR = rmdir + RMDIR = rmdir --ignore-fail-on-non-empty CP = cp BIN = ../bin/grafx2.exe COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT) $(VKEYCOPT) $(LUACOPT) $(LAYERCOPT) @@ -61,11 +67,11 @@ else #For all other platforms, we can rely on uname PLATFORM = $(shell uname) - #AmigaOS (3 or 4) specific ifeq ($(PLATFORM),AmigaOS) # 1 + #AmigaOS (3 or 4) specific DELCOMMAND = rm -rf MKDIR = mkdir -p - RMDIR = rmdir + RMDIR = rmdir --ignore-fail-on-non-empty CP = cp BIN = ../bin/grafx2 COPT = -Wall -c -gstabs `sdl-config --cflags` $(TTFCOPT) @@ -78,34 +84,39 @@ else else ifeq ($(PLATFORM),Darwin) # 2 - #Mac OS X specific - DELCOMMAND = rm -rf - MKDIR = mkdir -p - RMDIR = rmdir - CP = cp - ZIP = zip - PLATFORMFILES = gfx2.png - BIN = ../bin/grafx2 - # Where the SDL frameworks are located - FWDIR = /Library/Frameworks - SDLCOPT = -arch i386 -I$(FWDIR)/SDL.framework/Headers -I$(FWDIR)/SDL_image.framework/Headers -I$(FWDIR)/SDL_ttf.framework/Headers -D_THREAD_SAFE - SDLLOPT = -arch i386 -L/usr/lib -framework SDL -framework SDL_image -framework SDL_ttf -framework Cocoa -framework Carbon -framework OpenGL - COPT = -D_DARWIN_C_SOURCE -D__macosx__ -D__linux__ -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -std=c99 -c -g $(SDLCOPT) $(TTFCOPT) -I/usr/X11/include - LOPT = $(SDLLOPT) -L/usr/X11/lib -R/usr/X11/lib -lpng - # Use gcc for compiling. Use ncc to build a callgraph and analyze the code. - CC = gcc - #CC = nccgen -ncgcc -ncld -ncfabs - OBJDIR = ../obj/macosx - PLATFORMOBJ = $(OBJDIR)/SDLMain.o - X11LOPT = - MACAPPEXE = Grafx2.app/Contents/MacOS/Grafx2 + #Mac OS X specific + DELCOMMAND = rm -rf + MKDIR = mkdir -p + RMDIR = rmdir --ignore-fail-on-non-empty + # Force it + OPTIM = 3 + CP = cp + ZIP = zip + PLATFORMFILES = gfx2.png + # Where the SDL frameworks are located + FWDIR = /Library/Frameworks + BIN = ../bin/grafx2 + SVN_REVISION = $(shell svnversion | cut -f2 -d ":" - | tr -d "M") + SDLCOPT = $(MACOSX_ARCH) -I$(FWDIR)/SDL.framework/Headers -I$(FWDIR)/SDL_image.framework/Headers -I$(FWDIR)/SDL_ttf.framework/Headers -D_THREAD_SAFE + #-framework SDL_ttf + SDLLOPT = -isysroot $(MACOSX_SYSROOT) $(MACOSX_ARCH) -L/usr/lib -framework SDL -framework SDL_image -framework Cocoa -framework Carbon -framework OpenGL + COPT = -D_DARWIN_C_SOURCE -D__macosx__ -D__linux__ -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -std=c99 -c -g $(LUACOPT) $(SDLCOPT) $(TTFCOPT) -I/usr/X11/include + LOPT = $(SDLLOPT) -llua -lpng -lz + # Use gcc for compiling. Use ncc to build a callgraph and analyze the code. + CC = gcc + #CC = nccgen -ncgcc -ncld -ncfabs + OBJDIR = ../obj/macosx + PLATFORMOBJ = $(OBJDIR)/SDLMain.o + X11LOPT = + MACAPPEXE = Grafx2.app/Contents/MacOS/Grafx2 + NOTTF = 1 else ifeq ($(PLATFORM),AROS) # 3 - #AROS specific + #AROS specific DELCOMMAND = rm -rf MKDIR = mkdir -p - RMDIR = rmdir + RMDIR = rmdir --ignore-fail-on-non-empty CP = cp BIN = ../bin/grafx2 COPT = -Wall -g `sdl-config --cflags` $(TTFCOPT) @@ -118,10 +129,10 @@ else else ifeq ($(PLATFORM),MorphOS) # 4 - #MorphOS specific + #MorphOS specific DELCOMMAND = rm -rf MKDIR = mkdir -p - RMDIR = rmdir + RMDIR = rmdir --ignore-fail-on-non-empty CP = cp BIN = ../bin/grafx2 COPT = -Wall -gstabs -c `sdl-config --cflags` $(TTFCOPT) @@ -134,10 +145,10 @@ else else ifeq ($(PLATFORM),BeOS) # 6 - #BeOS specific + #BeOS specific DELCOMMAND = rm -rf MKDIR = mkdir -p - RMDIR = rmdir + RMDIR = rmdir --ignore-fail-on-non-empty CP = cp BIN = ../bin/grafx2 COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/home/config/include @@ -148,18 +159,18 @@ else else ifeq ($(PLATFORM),Haiku) # 7 - #Haiku specific + #Haiku specific DELCOMMAND = rm -rf MKDIR = mkdir -p - RMDIR = rmdir + RMDIR = rmdir --ignore-fail-on-non-empty CP = cp BIN = ../bin/grafx2 ifeq ($(NOLUA),1) LUACOPT = LUALOPT = else - LUACOPT = -D__ENABLE_LUA__ - LUALOPT = -llua + LUACOPT = -D__ENABLE_LUA__ + LUALOPT = -llua endif COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/common/include $(LUACOPT) LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lfreetype -lbe $(LUALOPT) @@ -169,10 +180,10 @@ else else ifeq ($(PLATFORM),skyos) # 8 - #SkyOS specific + #SkyOS specific DELCOMMAND = rm -rf MKDIR = mkdir -p - RMDIR = rmdir + RMDIR = rmdir --ignore-fail-on-non-empty CP = cp BIN = ../bin/grafx2 COPT = -W -Wall -Wdeclaration-after-statement -c -g `sdl-config --cflags` $(TTFCOPT) @@ -183,50 +194,50 @@ else else ifeq ($(PLATFORM),OSF1) #9 - #OSF1 / tru64 alpha - DELCOMMAND = rm -rf - MKDIR = mkdir -p - RMDIR = rmdir - CP = cp - ZIP = zip - PLATFORMFILES = gfx2.png - BIN = ../bin/grafx2 - COPT = -W -Wall -std=c99 -c -g -gstabs -D__TRU64__ `sdl-config --cflags` $(TTFCOPT) $(LUACOPT) - LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng $(LUALOPT) -lm - OBJDIR = ../obj/unix - X11LOPT = -lX11 - CC = gcc + #OSF1 / tru64 alpha + DELCOMMAND = rm -rf + MKDIR = mkdir -p + RMDIR = rmdir --ignore-fail-on-non-empty + CP = cp + ZIP = zip + PLATFORMFILES = gfx2.png + BIN = ../bin/grafx2 + COPT = -W -Wall -std=c99 -c -g -gstabs -D__TRU64__ `sdl-config --cflags` $(TTFCOPT) $(LUACOPT) + LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng $(LUALOPT) -lm + OBJDIR = ../obj/unix + X11LOPT = -lX11 + CC = gcc else - # Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested. - # Linux and FreeBSD specific (default rules) - DELCOMMAND = rm -rf - MKDIR = mkdir -p - RMDIR = rmdir - CP = cp - ZIP = zip - PLATFORMFILES = gfx2.png - ifneq ($(ATARICROSS),1) + # Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested. + # Linux and FreeBSD specific (default rules) + DELCOMMAND = rm -rf + MKDIR = mkdir -p + RMDIR = rmdir --ignore-fail-on-non-empty + CP = cp + ZIP = zip + PLATFORMFILES = gfx2.png + ifneq ($(ATARICROSS),1) ifeq ($(NOLUA),1) LUACOPT = LUALOPT = else - LUACOPT = `pkg-config lua --cflags --silence-errors ||pkg-config lua5.1 --cflags --silence-errors ||pkg-config lua-5.1 --cflags` - LUALOPT = `pkg-config lua --libs --silence-errors ||pkg-config lua5.1 --libs --silence-errors ||pkg-config lua-5.1 --libs` + LUACOPT = `pkg-config lua --cflags --silence-errors ||pkg-config lua5.1 --cflags --silence-errors ||pkg-config lua-5.1 --cflags` + LUALOPT = `pkg-config lua --libs --silence-errors ||pkg-config lua5.1 --libs --silence-errors ||pkg-config lua-5.1 --libs` endif - endif - # These can only be used under linux and maybe freebsd. They allow to compile for the gp2x or to create a windows binary - ifdef WIN32CROSS - #cross compile a Win32 executable - CC = i586-mingw32msvc-gcc - BIN = ../bin/grafx2.exe - COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -g -ggdb -Dmain=SDL_main `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --cflags` $(TTFCOPT) - LOPT = -mwindows -lmingw32 -lSDLmain -lSDL -lshlwapi `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --libs` -lSDL_image $(TTFLOPT) - OBJDIR = ../obj/win32 - PLATFORM = win32 - else + endif + + # These can only be used under linux and maybe freebsd. They allow to compile for the gp2x or to create a windows binary + ifdef WIN32CROSS + #cross compile a Win32 executable + CC = i586-mingw32msvc-gcc + BIN = ../bin/grafx2.exe + COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -g -ggdb -Dmain=SDL_main `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --cflags` $(TTFCOPT) + LOPT = -mwindows -lmingw32 -lSDLmain -lSDL -lshlwapi `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --libs` -lSDL_image $(TTFLOPT) + OBJDIR = ../obj/win32 + PLATFORM = win32 + else ifdef GP2XCROSS - #cross compile an exec for the gp2x CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc BIN = ../bin/grafx2.gpe @@ -238,28 +249,30 @@ else STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-strip JOYCOPT = -DUSE_JOYSTICK - else ifdef AROS32CROSS - #cross compile an Aros 32 bit executable + else + ifdef AROS32CROSS + #cross compile an Aros 32 bit executable BIN = ../bin/grafx2 COPT = -Wall -g `i386-linux-aros-sdl-config --cflags` $(TTFCOPT) LOPT = -lSDL_image `i386-linux-aros-sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared CC = i386-aros-gcc OBJDIR = ../obj/aros - STRIP = strip --strip-unneeded --remove-section .comment + STRIP = strip --strip-unneeded --remove-section .comment PLATFORM = AROS ZIP = lha ZIPOPT = a - else ifdef ATARICROSS + else + ifdef ATARICROSS #cross compile an exec for atari TOS/MiNT machine CC = m68k-atari-mint-gcc BIN = ../bin/grafx2.ttp - LUALOPT = -llua + LUALOPT = -llua OBJDIR = ../obj/m68k-atari-mint PLATFORM = m68k-atari-mint STRIP = m68k-atari-mint-strip -s - X11LOPT = - COPT = -W -Wall -m68020-60 -fomit-frame-pointer -pedantic -std=c99 -Wdeclaration-after-statement -D__MINT__ -DNO_INLINE_MATH -O$(OPTIM) -c -I$(prefix)/include `$(prefix)/bin/libpng12-config --cflags` `$(prefix)/bin/sdl-config --cflags` $() $(JOYCOPT) $(LAYERCOPT) $(LUACOPT) - LOPT = -static -m68020-60 -lSDL_image `$(prefix)/bin/sdl-config --libs` -L$(prefix)/lib -ltiff -ljpeg `$(prefix)/bin/libpng12-config --libs` -lz -lm $(TTFLOPT) -lfreetype $(LUALOPT) $(LAYERLOPT) + X11LOPT = + COPT = -W -Wall -m68020-60 -fomit-frame-pointer -pedantic -std=c99 -Wdeclaration-after-statement -D__MINT__ -DNO_INLINE_MATH -O$(OPTIM) -c -I$(prefix)/include `$(prefix)/bin/libpng12-config --cflags` `$(prefix)/bin/sdl-config --cflags` $() $(JOYCOPT) $(LAYERCOPT) $(LUACOPT) + LOPT = -static -m68020-60 -lSDL_image `$(prefix)/bin/sdl-config --libs` -L$(prefix)/lib -ltiff -ljpeg `$(prefix)/bin/libpng12-config --libs` -lz -lm $(TTFLOPT) -lfreetype $(LUALOPT) $(LAYERLOPT) else # Compiles a regular linux executable for the native platform @@ -273,6 +286,9 @@ else X11LOPT = -lX11 endif endif + endif + endif + endif endif endif @@ -283,33 +299,34 @@ else endif endif -### BUILD SETTINGS are set according to vars set in the platform selection, the "overridable defaults", and environment variables set before launching make +### BUILD SETTINGS are set according to vars set in the platform selection, +### the "overridable defaults", and environment variables set before launching make #TrueType is optional: make NOTTF=1 to disable support and dependencies. ifndef ($(ATARICROSS,1)) -ifeq ($(NOTTF),1) - TTFCOPT = -DNOTTF=1 - TTFLOPT = - TTFLIBS = - TTFLABEL = -nottf + ifeq ($(NOTTF),1) + TTFCOPT = -DNOTTF=1 + TTFLOPT = + TTFLIBS = + TTFLABEL = -nottf + else + TTFCOPT = + TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT) + TTFLIBS = bin/libfreetype-6.dll bin/SDL_ttf.dll + TTFLABEL = + endif else - TTFCOPT = - TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT) - TTFLIBS = bin/libfreetype-6.dll bin/SDL_ttf.dll - TTFLABEL = -endif -else -ifeq ($(NOTTF),1) - TTFCOPT = -DNOTTF=1 - TTFLOPT = - TTFLIBS = - TTFLABEL = -nottf -else - TTFCOPT = - TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT) - TTFLIBS = - TTFLABEL = -endif + ifeq ($(NOTTF),1) + TTFCOPT = -DNOTTF=1 + TTFLOPT = + TTFLIBS = + TTFLABEL = -nottf + else + TTFCOPT = + TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT) + TTFLIBS = + TTFLABEL = + endif endif #Lua scripting is optional too @@ -354,13 +371,13 @@ endif # This is the list of the objects we want to build. Dependancies are built by "make depend" automatically. OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o $(OBJDIR)/factory.o $(PLATFORMOBJ) $(OBJDIR)/fileformats.o $(OBJDIR)/miscfileformats.o $(OBJDIR)/libraw2crtc.o $(OBJDIR)/brush_ops.o $(OBJDIR)/buttons_effects.o $(OBJDIR)/layers.o $(OBJDIR)/oldies.o -SKIN_FILES = ../share/grafx2/skins/skin_classic.png ../share/grafx2/skins/skin_modern.png ../share/grafx2/skins/skin_DPaint.png ../share/grafx2/skins/font_Classic.png ../share/grafx2/skins/font_Fun.png ../share/grafx2/skins/font_Fairlight.png ../share/grafx2/skins/font_Melon.png ../share/grafx2/skins/font_DPaint.png ../share/grafx2/skins/skin_scenish.png ../share/grafx2/skins/font_Seen.png ../share/grafx2/skins/skin_Aurora.png ../share/grafx2/skins/skin_Clax3.gif ../share/grafx2/skins/skin_Clax2.gif ../share/grafx2/skins/skin_Clax4.gif +SKIN_FILES = ../share/grafx2/skins/skin_classic.png ../share/grafx2/skins/skin_modern.png ../share/grafx2/skins/skin_DPaint.png ../share/grafx2/skins/font_Classic.png ../share/grafx2/skins/font_Fun.png ../share/grafx2/skins/font_Fairlight.png ../share/grafx2/skins/font_Melon.png ../share/grafx2/skins/font_DPaint.png ../share/grafx2/skins/skin_scenish.png ../share/grafx2/skins/font_Seen.png ../share/grafx2/skins/skin_Aurora.png -SCRIPT_FILES1 = ../share/grafx2/scripts/bru_db_Amigaball.lua ../share/grafx2/scripts/bru_db_ColorSphere.lua ../share/grafx2/scripts/bru_db_FindAA.lua ../share/grafx2/scripts/bru_db_Fisheye.lua ../share/grafx2/scripts/bru_db_GrayscaleAvg.lua ../share/grafx2/scripts/bru_db_GrayscaleDesat.lua ../share/grafx2/scripts/bru_db_Halfsmooth.lua ../share/grafx2/scripts/bru_db_Mandelbrot.lua ../share/grafx2/scripts/bru_db_Waves.lua ../share/grafx2/scripts/pal_db_Desaturate.lua ../share/grafx2/scripts/pal_db_ExpandColors.lua ../share/grafx2/scripts/pal_db_FillColorCube.lua ../share/grafx2/scripts/pal_db_InvertedRGB.lua ../share/grafx2/scripts/pal_db_Set3bit.lua ../share/grafx2/scripts/pal_db_Set6bit.lua ../share/grafx2/scripts/pal_db_SetC64Palette.lua ../share/grafx2/scripts/pal_db_ShiftHue.lua ../share/grafx2/scripts/pic_db_Pic2isometric.lua ../share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua ../share/grafx2/scripts/pic_db_SierpinskyCarpet.lua -SCRIPT_FILES2 = ../share/grafx2/scripts/pic_db_SierpinskyTriangle.lua ../share/grafx2/scripts/pic_ni_GlassGridFilter.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua ../share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua -SCRIPT_FILES= $(SCRIPT_FILES1) $(SCRIPT_FILES2) - -SCRIPTLIB_FILES = ../share/grafx2/scripts/libs/memory.lua +SCRIPT_FILES = ../share/grafx2/scripts/samples_2.3/brush/ApplyColor.lua ../share/grafx2/scripts/samples_2.3/brush/Fisheye.lua ../share/grafx2/scripts/samples_2.3/brush/GrayscaleAvg.lua ../share/grafx2/scripts/samples_2.3/brush/GrayscaleDesat.lua ../share/grafx2/scripts/samples_2.3/brush/Halfsmooth.lua ../share/grafx2/scripts/samples_2.3/brush/Waves.lua ../share/grafx2/scripts/samples_2.3/demo/3DPalette.lua ../share/grafx2/scripts/samples_2.3/demo/Ellipse.lua ../share/grafx2/scripts/samples_2.3/demo/FlipPicture.lua \ +../share/grafx2/scripts/samples_2.3/demo/SierpinskyCarpet.lua ../share/grafx2/scripts/samples_2.3/demo/SierpinskyTriangle.lua ../share/grafx2/scripts/samples_2.3/demo/Spritesheet.lua ../share/grafx2/scripts/samples_2.3/demo/brush/Amigaball.lua ../share/grafx2/scripts/samples_2.3/demo/brush/ColorSphere.lua ../share/grafx2/scripts/samples_2.3/demo/brush/FindAA.lua ../share/grafx2/scripts/samples_2.3/demo/brush/Mandelbrot.lua ../share/grafx2/scripts/samples_2.3/libs/dawnbringer_lib.lua ../share/grafx2/scripts/samples_2.3/libs/memory.lua \ +../share/grafx2/scripts/samples_2.3/palette/Desaturate.lua ../share/grafx2/scripts/samples_2.3/palette/ExpandColors.lua ../share/grafx2/scripts/samples_2.3/palette/FillColorCube.lua ../share/grafx2/scripts/samples_2.3/palette/InvertedRGB.lua ../share/grafx2/scripts/samples_2.3/palette/Set3bit.lua ../share/grafx2/scripts/samples_2.3/palette/Set6bit.lua ../share/grafx2/scripts/samples_2.3/palette/SetC64Palette.lua ../share/grafx2/scripts/samples_2.3/palette/ShiftHue.lua ../share/grafx2/scripts/samples_2.3/picture/CellColourReducer.lua \ +../share/grafx2/scripts/samples_2.3/picture/DrawGridIsometric.lua ../share/grafx2/scripts/samples_2.3/picture/DrawgridOrthogonal_Index.lua ../share/grafx2/scripts/samples_2.3/picture/DrawGridOrthogonal_RGB.lua ../share/grafx2/scripts/samples_2.3/picture/GlassGridFilter.lua ../share/grafx2/scripts/samples_2.3/picture/PaletteToPicture.lua ../share/grafx2/scripts/samples_2.3/picture/Pic2isometric.lua ../share/grafx2/scripts/samples_2.3/picture/Rainbow-Dark2Bright.lua ../share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB.lua \ +../share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB_ed.lua ../share/grafx2/scripts/samples_2.3/picture/RemapImageTo3bitPal.lua ../share/grafx2/scripts/samples_2.3/picture/XBitColourXpaceFromPalette.lua FONT_FILES = ../share/grafx2/fonts/8pxfont.png ../share/grafx2/fonts/Tuffy.ttf ../share/grafx2/fonts/PF_Arma_5__.png ../share/grafx2/fonts/PF_Easta_7_.png ../share/grafx2/fonts/PF_Easta_7__.png ../share/grafx2/fonts/PF_Ronda_7__.png ../share/grafx2/fonts/PF_Tempesta_5.png ../share/grafx2/fonts/PF_Tempesta_5_.png ../share/grafx2/fonts/PF_Tempesta_5__.png ../share/grafx2/fonts/PF_Tempesta_5___.png ../share/grafx2/fonts/PF_Tempesta_7.png ../share/grafx2/fonts/PF_Tempesta_7_.png ../share/grafx2/fonts/PF_Tempesta_7__.png ../share/grafx2/fonts/PF_Tempesta_7___.png ../share/grafx2/fonts/PF_Westa_7_.png ../share/grafx2/fonts/PF_Westa_7__.png @@ -369,17 +386,30 @@ ifeq ($(PLATFORM),Darwin) all : $(MACAPPEXE) $(MACAPPEXE) : $(BIN) rm -rf Grafx2.app - mkdir -p Grafx2.app Grafx2.app/Contents Grafx2.app/Contents/Frameworks Grafx2.app/Contents/MacOS Grafx2.app/Contents/Resources + mkdir -p Grafx2.app Grafx2.app/Contents Grafx2.app/Contents/Frameworks Grafx2.app/Contents/MacOS Grafx2.app/Contents/Resources Grafx2.app/Contents/Resources/scripts echo 'APPL????' > Grafx2.app/Contents/PkgInfo cp ../Info.plist Grafx2.app/Contents + cp -r Grafx2.icns Grafx2.app/Contents/Resources cp -r English.lproj Grafx2.app/Contents/Resources cp -r ../share/grafx2/fonts Grafx2.app/Contents/Resources cp -r ../share/grafx2/skins Grafx2.app/Contents/Resources cp -r ../share/grafx2/gfx2def.ini Grafx2.app/Contents/Resources - cp -Rp $(FWDIR)/SDL.framework Grafx2.app/Contents/Frameworks - cp -Rp $(FWDIR)/SDL_image.framework Grafx2.app/Contents/Frameworks - cp -Rp $(FWDIR)/SDL_ttf.framework Grafx2.app/Contents/Frameworks + cp -r $(SCRIPT_FILES) Grafx2.app/Contents/Resources/scripts + mkdir -p Grafx2.app/Contents/Frameworks/SDL.framework/Versions + mkdir -p Grafx2.app/Contents/Frameworks/SDL_image.framework/Versions +# mkdir -p Grafx2.app/Contents/Frameworks/SDL_ttf.framework/Versions + cp -Rp $(FWDIR)/SDL.framework/Versions/A Grafx2.app/Contents/Frameworks/SDL.framework/Versions + cp -Rp $(FWDIR)/SDL_image.framework/Versions/A Grafx2.app/Contents/Frameworks/SDL_image.framework/Versions +# cp -Rp $(FWDIR)/SDL_ttf.framework/Versions/A Grafx2.app/Contents/Frameworks/SDL_ttf.framework/Versions + rm -fr Grafx2.app/Contents/Frameworks/SDL.framework/Versions/A/Headers + rm -fr Grafx2.app/Contents/Frameworks/SDL.framework/Versions/A/Resources + rm -fr Grafx2.app/Contents/Frameworks/SDL_image.framework/Versions/A/Headers + rm -fr Grafx2.app/Contents/Frameworks/SDL_image.framework/Versions/A/Resources +# rm -fr Grafx2.app/Contents/Frameworks/SDL_ttf.framework/Versions cp $(BIN) $(MACAPPEXE) + $(STRIP) -x -X -S $(MACAPPEXE) + chmod +x $(MACAPPEXE) + tar cvzf grafx2-svn$(SVN_REVISION)-macosx.tgz --exclude '*svn*' --exclude '*DS_Store*' Grafx2.app/* else all : $(BIN) endif @@ -394,15 +424,12 @@ release : version $(BIN) # Create a zip archive ready for upload to the website, including binaries and sourcecode ziprelease: version $(BIN) release echo `sed "s/.*=\"\(.*\)\";/\1/" pversion.c`.`svnversion` | tr " :" "_-" | sed -e "s/\(wip\)\\./\1/I" > $(OBJDIR)/versiontag - tar cvzf "../src-`cat $(OBJDIR)/versiontag`.tgz" --strip=1 ../src/*.c ../src/*.h ../src/Makefile ../src/Makefile.dep ../src/gfx2.ico - cd .. && $(ZIP) $(ZIPOPT) "grafx2-`cat $(OBJDIR:../%=%)/versiontag`$(TTFLABEL)-$(PLATFORM).$(ZIP)" $(BIN:../%=%) share/grafx2/gfx2def.ini $(SCRIPT_FILES:../%=%) $(SCRIPTLIB_FILES:../%=%) $(SKIN_FILES:../%=%) share/grafx2/gfx2.gif share/icons/grafx2.svg doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt doc/PF_fonts.txt $(FONT_FILES:../%=%) doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt doc/README-lua.txt src-`cat $(OBJDIR:../%=%)/versiontag`.tgz $(PLATFORMFILES:../%=%) + cd .. && $(ZIP) $(ZIPOPT) "grafx2-`cat $(OBJDIR:../%=%)/versiontag`$(TTFLABEL)-$(PLATFORM).$(ZIP)" $(BIN:../%=%) share/grafx2/gfx2def.ini $(SCRIPT_FILES:../%=%) $(SKIN_FILES:../%=%) share/grafx2/gfx2.gif share/icons/grafx2.svg doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt doc/PF_fonts.txt $(FONT_FILES:../%=%) doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt doc/README-lua.txt src-`cat $(OBJDIR:../%=%)/versiontag`.tgz $(PLATFORMFILES:../%=%) $(DELCOMMAND) "../src-`cat $(OBJDIR)/versiontag`.tgz" - tar cvzf "../grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-src.tgz" --strip=1 --transform 's,^,grafx2/,g' ../src/*.c ../src/*.h ../src/Makefile ../src/Makefile.dep ../share/grafx2/gfx2def.ini $(SCRIPT_FILES) $(SCRIPTLIB_FILES) $(SKIN_FILES) ../src/gfx2.ico ../share/grafx2/gfx2.gif ../share/icons/grafx2.svg ../doc/README.txt ../doc/COMPILING.txt ../doc/gpl-2.0.txt ../doc/PF_fonts.txt ../misc/unix/grafx2.1 ../misc/unix/grafx2.xpm ../misc/unix/grafx2.desktop $(FONT_FILES) + tar cvzf "../grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-src.tgz" --strip=1 --transform 's,^,grafx2/,g' ../src/*.c ../src/*.h ../src/Makefile ../src/Makefile.dep ../share/grafx2/gfx2def.ini $(SCRIPT_FILES) $(SKIN_FILES) ../src/gfx2.ico ../share/grafx2/gfx2.gif ../share/icons/grafx2.svg ../doc/README.txt ../doc/COMPILING.txt ../doc/gpl-2.0.txt ../doc/PF_fonts.txt ../misc/unix/grafx2.1 ../misc/unix/grafx2.xpm ../misc/unix/grafx2.desktop $(FONT_FILES) $(DELCOMMAND) "$(OBJDIR)/versiontag" -testsed : - $(BIN) : $(OBJ) test -d ../bin || $(MKDIR) ../bin $(CC) $(OBJ) -o $(BIN) $(LOPT) $(LFLAGS) @@ -456,6 +483,13 @@ install : $(BIN) test -d $(DESTDIR)$(datadir)/grafx2/skins || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/skins test -d $(DESTDIR)$(datadir)/grafx2/scripts || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts test -d $(DESTDIR)$(datadir)/grafx2/scripts/libs || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/libs + test -d $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3 || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3 + test -d $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/brush || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/brush + test -d $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo + test -d $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo/brush || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo/brush + test -d $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/libs || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/libs + test -d $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/palette || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/palette + test -d $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/picture || $(MKDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/picture test -d $(DESTDIR)$(datadir)/applications || $(MKDIR) $(DESTDIR)$(datadir)/applications test -d $(DESTDIR)$(pixmapdir) || $(MKDIR) $(DESTDIR)$(pixmapdir) # Copy files @@ -464,8 +498,7 @@ install : $(BIN) $(CP) ../share/grafx2/gfx2.gif $(DESTDIR)$(datadir)/grafx2/ $(CP) ../share/grafx2/fonts/* $(DESTDIR)$(datadir)/grafx2/fonts/ $(CP) $(SKIN_FILES) $(DESTDIR)$(datadir)/grafx2/skins/ - $(CP) $(SCRIPT_FILES) $(DESTDIR)$(datadir)/grafx2/scripts/ - $(CP) $(SCRIPTLIB_FILES) $(DESTDIR)$(datadir)/grafx2/scripts/libs/ + for f in $(SCRIPT_FILES); do cp "$$f" "$(DESTDIR)$(bindir)/$$f" ; done # Icon and desktop file for debian $(CP) ../misc/unix/grafx2.desktop $(DESTDIR)$(datadir)/applications/ $(CP) ../misc/unix/grafx2.xpm $(DESTDIR)$(pixmapdir) @@ -478,14 +511,20 @@ uninstall : $(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/gfx2def.ini $(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/gfx2.gif $(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/fonts/* - $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/fonts),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/fonts) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/fonts),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/fonts,) $(DELCOMMAND) $(SKIN_FILES:../share%=$(DESTDIR)$(datadir)%) - $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/skins),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/skins) - $(DELCOMMAND) $(SCRIPTLIB_FILES:../share%=$(DESTDIR)$(datadir)%) - $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/libs),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/libs) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/skins),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/skins,) $(DELCOMMAND) $(SCRIPT_FILES:../share%=$(DESTDIR)$(datadir)%) - $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts) - $(if $(wildcard $(DESTDIR)$(datadir)/grafx2),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/picture),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/picture,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/palette),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/palette,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/libs),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/libs,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo/brush),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo/brush,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/demo,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/brush),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3/brush,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/samples_2.3,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts/libs),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts/libs,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2/scripts),$(RMDIR) $(DESTDIR)$(datadir)/grafx2/scripts,) + $(if $(wildcard $(DESTDIR)$(datadir)/grafx2),$(RMDIR) $(DESTDIR)$(datadir)/grafx2,) # Icon and desktop file for debian $(DELCOMMAND) $(DESTDIR)$(datadir)/applications/grafx2.desktop $(DELCOMMAND) $(DESTDIR)$(pixmapdir)/grafx2.xpm diff --git a/src/Makefile.dep b/src/Makefile.dep index 27c8461b..5a8bbedc 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep @@ -15,7 +15,7 @@ $(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h input.h engine.h pages.h layers.h factory.h loadsave.h io.h $(OBJDIR)/factory.o: factory.c brush.h struct.h const.h buttons.h engine.h errors.h \ filesel.h loadsave.h global.h graph.h io.h misc.h pages.h readline.h \ - sdlscreen.h windows.h palette.h input.h help.h + sdlscreen.h windows.h palette.h input.h help.h realpath.h $(OBJDIR)/fileformats.o: fileformats.c errors.h global.h struct.h const.h \ loadsave.h misc.h io.h windows.h pages.h $(OBJDIR)/filesel.o: filesel.c const.h struct.h global.h misc.h errors.h io.h \ @@ -45,7 +45,8 @@ $(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h errors.h global.h io engine.h brush.h setup.h $(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.h \ engine.h pages.h loadsave.h sdlscreen.h errors.h readini.h saveini.h \ - io.h text.h setup.h windows.h brush.h palette.h realpath.h input.h + io.h text.h setup.h windows.h brush.h palette.h realpath.h input.h \ + help.h $(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons.h \ engine.h misc.h keyboard.h windows.h palette.h input.h graph.h pages.h $(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \ @@ -61,6 +62,9 @@ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h loadsave.h $(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \ buttons.h pages.h help.h sdlscreen.h errors.h op_c.h windows.h input.h \ palette.h shade.h +$(OBJDIR)/palette_test.o: palette_test.c const.h struct.h global.h misc.h engine.h \ + readline.h buttons.h pages.h help.h sdlscreen.h errors.h op_c.h \ + windows.h input.h palette.h shade.h $(OBJDIR)/pversion.o: pversion.c $(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h misc.h \ graph.h pxdouble.h pxwide.h @@ -79,9 +83,9 @@ $(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h sdlscreen.h misc.h graph. $(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \ pxwide2.h $(OBJDIR)/readini.o: readini.c const.h errors.h global.h struct.h misc.h readini.h \ - setup.h + setup.h realpath.h io.h $(OBJDIR)/readline.o: readline.c const.h struct.h global.h misc.h errors.h \ - sdlscreen.h readline.h windows.h input.h + sdlscreen.h readline.h windows.h input.h engine.h $(OBJDIR)/realpath.o: realpath.c $(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h readini.h io.h errors.h \ misc.h saveini.h setup.h diff --git a/src/SDLMain.m b/src/SDLMain.m index 5274d96c..06b858aa 100644 --- a/src/SDLMain.m +++ b/src/SDLMain.m @@ -82,7 +82,7 @@ static NSString *getApplicationName(void) if (NSKeyDown == [anEvent type] || NSKeyUp == [anEvent type]) { if ([anEvent modifierFlags] & NSCommandKeyMask) { - SDL_SetModState(SDL_GetModState() | KMOD_META); +// SDL_SetModState(SDL_GetModState() /*| KMOD_META*/); [super sendEvent: anEvent]; } } else diff --git a/src/SFont.c b/src/SFont.c index fef5b17f..23de8ce0 100644 --- a/src/SFont.c +++ b/src/SFont.c @@ -117,7 +117,9 @@ SFont_Font* SFont_InitFont(SDL_Surface* Surface) pixel = GetPixel(Surface, 0, Surface->h-1); SDL_UnlockSurface(Surface); - SDL_SetColorKey(Surface, SDL_SRCCOLORKEY, pixel); + // No longer use SDL color keying + //SDL_SetColorKey(Surface, SDL_SRCCOLORKEY, pixel); + Font->Transparent=pixel; return Font; } @@ -143,8 +145,13 @@ void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, srcrect.h = dstrect.h = Font->Surface->h - 1; for(c = text; *c != '\0' && x <= Surface->w ; c++) { + if (*c == '\n') { + dstrect.y += Font->Surface->h-1; + x=0; + continue; + } // skip spaces and nonprintable characters - if (*c == ' ' || Font->CharWidth[(int)*c]==0) { + else if (*c == ' ' || Font->CharWidth[(int)*c]==0) { x += Font->Space; continue; } @@ -164,13 +171,23 @@ int SFont_TextWidth(const SFont_Font *Font, const char *text) { const char* c; int width = 0; + int previous_width = 0; if(text == NULL) return 0; - for(c = text; *c != '\0'; c++) { + for(c = text; *c != '\0'; c++) + { + if (*c == '\n') + { + if (previous_widthCharWidth[(int)*c]==0) { + if (*c == ' ' || Font->CharWidth[(int)*c]==0) + { width += Font->Space; continue; } @@ -178,18 +195,30 @@ int SFont_TextWidth(const SFont_Font *Font, const char *text) width += Font->CharWidth[(int)*c]; } - return width; + return previous_widthSurface->h - 1; + // Count occurences of '\n' + int nb_cr=0; + while (*text!='\0') + { + if (*text=='\n') + nb_cr++; + text++; + } + + return (Font->Surface->h - 1) * (nb_cr+1); } +/* +// Do not use: Doesn't implement carriage returns + void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font *Font, int y, const char *text) { SFont_Write(Surface, Font, Surface->w/2 - SFont_TextWidth(Font, text)/2, y, text); } - +*/ diff --git a/src/SFont.h b/src/SFont.h index 27a54937..446acf4e 100644 --- a/src/SFont.h +++ b/src/SFont.h @@ -59,6 +59,7 @@ typedef struct { int CharBegin[256]; int CharWidth[256]; int Space; + unsigned char Transparent; } SFont_Font; /// @@ -86,7 +87,7 @@ void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y, /// Returns the width of "text" in pixels int SFont_TextWidth(const SFont_Font* Font, const char *text); /// Returns the height of "text" in pixels (which is always equal to Font->Surface->h) -int SFont_TextHeight(const SFont_Font* Font); +int SFont_TextHeight(const SFont_Font* Font, const char *text); /// Blits a string to Surface with centered x position void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y, diff --git a/src/brush.c b/src/brush.c index 6ed6addf..5bba8989 100644 --- a/src/brush.c +++ b/src/brush.c @@ -949,7 +949,7 @@ void Remap_brush(void) Brush_colormap[color]=color; else // Usual method: closest by r g b - Brush_colormap[color]=Best_color_perceptual(r,g,b); + Brush_colormap[color]=Best_color_perceptual_except(r,g,b,Back_color); } // Il reste une couleur non calculée dans la table qu'il faut mettre à diff --git a/src/buttons.c b/src/buttons.c index 8d424254..ea9c9702 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -25,14 +25,11 @@ #include #include #include - #define isHidden(x) (0) #elif defined(__WIN32__) #include #include - #define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN) #else #include - #define isHidden(x) ((x)->d_name[0]=='.') #endif #define _XOPEN_SOURCE 500 @@ -82,18 +79,14 @@ #if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) #include #include - #define isHidden(x) (0) #elif defined(__MINT__) #include #include - #define isHidden(x) (0) #elif defined(__WIN32__) #include #include - #define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN) #else #include - #define isHidden(x) ((x)->d_name[0]=='.') #endif extern char Program_version[]; // generated in pversion.c @@ -169,7 +162,7 @@ void Button_Message_initial(void) for (x=14,x_pos=0; x_pos<231; x_pos++,x++) Pixel_in_window(x,y,Gfx->Logo_grafx2[offs_y+x_pos]); - Print_in_window(130-4*26,88,"Copyright (c) 2007-2010 by",MC_Dark,MC_Light); + Print_in_window(130-4*26,88,"Copyright (c) 2007-2011 by",MC_Dark,MC_Light); Print_in_window(130-4*23,96,"the Grafx2 project team",MC_Black,MC_Light); Print_in_window(130-4*26,112,"Copyright (c) 1996-2001 by",MC_Dark,MC_Light); Print_in_window(130-4*13,120,"Sunset Design",MC_Black,MC_Light); @@ -905,6 +898,7 @@ void Settings_display_config(T_Setting *setting, T_Config * conf, T_Special_butt } } } + Update_window_area(panel->Pos_X, panel->Pos_Y, panel->Width, panel->Height+1); } void Settings_save_config(T_Config * conf) @@ -959,10 +953,13 @@ void Button_Settings(void) {"Merge movement:",1,&(selected_config.Mouse_merge_movement),0,100,4,NULL}, {"Double click speed:",2,&(selected_config.Double_click_speed),1,1999,4,NULL}, {"Double key speed:",2,&(selected_config.Double_key_speed),1,1999,4,NULL}, - {"Mouse speed (fullscreen)",0,NULL,0,0,0,NULL}, - {" horizontally:",1,&(selected_config.Mouse_sensitivity_index_x),1,4,0,Lookup_MouseSpeed}, - {" vertically:",1,&(selected_config.Mouse_sensitivity_index_y),1,4,0,Lookup_MouseSpeed}, + //{"Mouse speed (fullscreen)",0,NULL,0,0,0,NULL}, + //{" horizontally:",1,&(selected_config.Mouse_sensitivity_index_x),1,4,0,Lookup_MouseSpeed}, + //{" vertically:",1,&(selected_config.Mouse_sensitivity_index_y),1,4,0,Lookup_MouseSpeed}, {"Key to swap buttons:",2,&(selected_config.Swap_buttons),0,0,0,Lookup_SwapButtons}, + {"",0,NULL,0,0,0,NULL}, + {"",0,NULL,0,0,0,NULL}, + {"",0,NULL,0,0,0,NULL}, {" --- Editing ---",0,NULL,0,0,0,NULL}, {"Adjust brush pick:",1,&(selected_config.Adjust_brush_pick),0,1,0,Lookup_YesNo}, @@ -973,7 +970,7 @@ void Button_Settings(void) {"Auto discontinuous:",1,&(selected_config.Auto_discontinuous),0,1,0,Lookup_YesNo}, {"Auto count colors:",1,&(selected_config.Auto_nb_used),0,1,0,Lookup_YesNo}, {"Right click colorpick:",1,&(selected_config.Right_click_colorpick),0,1,0,Lookup_YesNo}, - {"",0,NULL,0,0,0,NULL}, + {"Multi shortcuts:",1,&(selected_config.Allow_multi_shortcuts),0,1,0,Lookup_YesNo}, {"",0,NULL,0,0,0,NULL}, {" --- File selector ---",0,NULL,0,0,0,NULL}, @@ -1159,6 +1156,11 @@ void Button_Settings(void) Spare_fileselector_position=0; Spare_fileselector_offset=0; } + if(Config.Allow_multi_shortcuts && !selected_config.Allow_multi_shortcuts) + { + // User just disabled multi shortcuts: make them unique now. + Remove_duplicate_shortcuts(); + } // Copy all Config=selected_config; @@ -1314,7 +1316,7 @@ void Button_Skins(void) // Scroller for the fileselector (file_scroller = Window_set_scroller_button(155, FILESEL_Y - 1, 82, Skin_files_list.Nb_elements, 10, 0)), // 3 - Draw_one_skin_name); // 4 + Draw_one_skin_name, 2); // 4 skin_list->Cursor_position = Find_file_in_fileselector(&Skin_files_list, Config.Skin_file); @@ -1424,12 +1426,12 @@ void Button_Skins(void) { case 1 : // OK break; - case 2 : // doesn't happen + case 2 : // double-click file: do nothing break; case 3 : // doesn't happen break; case 4 : // a file is selected - need_load=1; + need_load=1; break; case 5 : // Font dropdown selected_font = Window_attribute2; // Get the index of the chosen font. @@ -4066,7 +4068,7 @@ void Refresh_airbrush_settings(byte selected_color, byte update_slider) void Button_Airbrush_menu(void) { - static byte spray_init=0; + static byte spray_init=1; short clicked_button; char str[4]; word index; @@ -4329,6 +4331,12 @@ void Button_Airbrush_menu(void) Num2str(spray_init,str,2); Window_input_content(input_init_button,str); } + else if (spray_init<1) + { + spray_init=1; + Num2str(spray_init,str,2); + Window_input_content(input_init_button,str); + } Display_cursor(); break; } @@ -4862,7 +4870,7 @@ void Button_Text(void) Window_set_normal_button(54,160,60,14,"Cancel",0,1,KEY_ESC); // 12 // List of fonts - font_list = Window_set_list_button(font_list_button, font_scroller, Draw_one_font_name); // 13 + font_list = Window_set_list_button(font_list_button, font_scroller, Draw_one_font_name, 2); // 13 // Restore its settings from last passage in screen font_list->List_start = list_start; font_list->Cursor_position = cursor_position; @@ -4893,9 +4901,22 @@ void Button_Text(void) if (str[0]) preview_string=str; is_truetype=TrueType_font(selected_font_index); - Window_rectangle(8, 106, 273, 50,(antialias&&is_truetype)?MC_Black:Back_color); free(new_brush); new_brush = Render_text(preview_string, selected_font_index, font_size, antialias, is_bold, is_italic, &new_width, &new_height, text_palette); + // Background: + if (antialias&&is_truetype) + // Solid + Window_rectangle(8, 106, 273, 50,MC_Black); + else if (is_truetype) + { + long l = text_palette[Fore_color].R+text_palette[Fore_color].G+text_palette[Fore_color].B; + Window_rectangle(8, 106, 273, 50,l>128*3? MC_Black:MC_Light); + } + else + { + long l = text_palette[Back_color].R+text_palette[Back_color].G+text_palette[Back_color].B; + Window_rectangle(8, 106, 273, 50,l>128*3? MC_Light:MC_Black); + } if (new_brush) { if (!is_truetype || (is_truetype&&antialias)) @@ -4932,7 +4953,7 @@ void Button_Text(void) //if (r==Main_palette[color].R && g==Main_palette[color].G && b==Main_palette[color].B) // colmap[color]=color; //else - colmap[color]=Best_color_perceptual(r,g,b); + colmap[color]=Best_color_perceptual_except(r,g,b,Back_color); } colmap[Back_color]=Back_color; @@ -5022,10 +5043,6 @@ void Button_Text(void) /* Cannot happen, event is catched by the list control */ break; - case 6: // Selecteur de fonte - /* Cannot happen, event is catched by the list control */ - break; - case 13: // Font selection selected_font_index = Window_attribute2; Hide_cursor(); @@ -5069,6 +5086,7 @@ void Button_Text(void) break; + case 6: // Double-click font selector case 11: // OK // Save the selector settings list_start = font_list->List_start; diff --git a/src/engine.c b/src/engine.c index 3c71c13a..8deaff05 100644 --- a/src/engine.c +++ b/src/engine.c @@ -227,7 +227,7 @@ void Draw_menu_button(byte btn_number,byte pressed) word y_pos; byte current_menu; byte color; - char icon; + signed char icon; // Find in which menu the button is for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++) @@ -2190,7 +2190,7 @@ void Window_dropdown_clear_items(T_Dropdown_button * dropdown) // - entry_button is the textual area where the list values will be printed. // - scroller is a scroller button attached to it -T_List_button * Window_set_list_button(T_Special_button * entry_button, T_Scroller_button * scroller, Func_draw_list_item draw_list_item) +T_List_button * Window_set_list_button(T_Special_button * entry_button, T_Scroller_button * scroller, Func_draw_list_item draw_list_item, byte color_index) { T_List_button *temp; @@ -2201,6 +2201,7 @@ T_List_button * Window_set_list_button(T_Special_button * entry_button, T_Scroll temp->Entry_button = entry_button; temp->Scroller = scroller; temp->Draw_list_item = draw_list_item; + temp->Color_index = color_index; temp->Next=Window_list_button_list; Window_list_button_list=temp; @@ -2222,12 +2223,19 @@ void Window_redraw_list(T_List_button * list) // Remaining rectangle under list i=list->Scroller->Nb_visibles-list->Scroller->Nb_elements; if (i>0) + { + byte color; + color = list->Color_index == 0 ? MC_Black : + (list->Color_index == 1 ? MC_Dark : + (list->Color_index == 2 ? MC_Light : MC_White)); + Window_rectangle( list->Entry_button->Pos_X, list->Entry_button->Pos_Y+list->Scroller->Nb_elements*8, list->Entry_button->Width, i*8, - MC_Light); + color); + } } //----------------------- Ouverture d'un pop-up ----------------------- @@ -3151,9 +3159,10 @@ short Window_get_button_shortcut(void) short Window_clicked_button(void) { short Button; + byte old_mouse_k; + old_mouse_k=Mouse_K; Get_input(20); - // Handle clicks if (Mouse_K) { @@ -3180,6 +3189,9 @@ short Window_clicked_button(void) { short clicked_button; T_List_button * list; + static Uint32 time_last_click = 0; + static int last_list_number = -1; + Uint32 time_now; // Check which controls was clicked (by rectangular area) clicked_button = Window_get_clicked_button(); @@ -3192,9 +3204,26 @@ short Window_clicked_button(void) // Click in the textual part of a list. short clicked_line; clicked_line = (((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-list->Entry_button->Pos_Y)>>3; - if (clicked_line == list->Cursor_position || // Same as before - clicked_line >= list->Scroller->Nb_elements) // Below last line + if (clicked_line >= list->Scroller->Nb_elements) // Below last line return 0; + time_now = SDL_GetTicks(); + if (clicked_line == list->Cursor_position) + { + // Double click check + if (old_mouse_k==0 && last_list_number==list->Number && time_now - time_last_click < Config.Double_click_speed) + { + time_last_click = time_now; + Input_sticky_control=0; + // Store the selected value as attribute2 + Window_attribute2=list->List_start + list->Cursor_position; + // Return the control ID of the "special button" that covers the list. + return list->Entry_button->Number; + } + time_last_click = time_now; + last_list_number=list->Number; + // Already selected : don't activate anything + return 0; + } Hide_cursor(); // Redraw one item as disabled diff --git a/src/engine.h b/src/engine.h index d9f16861..fb577db2 100644 --- a/src/engine.h +++ b/src/engine.h @@ -98,7 +98,7 @@ void Window_dropdown_clear_items(T_Dropdown_button * dropdown); T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, short off_y); T_List_button * Window_set_list_button(T_Special_button * entry_button, - T_Scroller_button * scroller, Func_draw_list_item draw_list_item); + T_Scroller_button * scroller, Func_draw_list_item draw_list_item, byte color_index); void Window_redraw_list(T_List_button * list); byte Window_click_in_rectangle(short start_x, short start_y, short end_x, short end_y); diff --git a/src/factory.c b/src/factory.c index 62cdf692..03fe7674 100644 --- a/src/factory.c +++ b/src/factory.c @@ -42,6 +42,10 @@ #include "palette.h" #include "input.h" // Is_shortcut() #include "help.h" // Window_help() +#include "graph.h" +#include "filesel.h" // Read_list_of_drives() +#include "realpath.h" + /// Lua scripts bound to shortcut keys. char * Bound_script[10]; @@ -148,11 +152,19 @@ void Update_colors_during_script(void) } } +/// Paint a pixel in image without updating the screen +void Pixel_figure_no_screen(short x_pos,short y_pos,byte color) +{ + if (x_pos>0 && y_pos >0 && x_pos>1); @@ -345,6 +359,133 @@ int L_PutPicturePixel(lua_State* L) return 0; // no values returned for lua } + +int L_DrawLine(lua_State* L) +{ + int x1, y1, x2, y2, c; + + int nb_args = lua_gettop(L); + + LUA_ARG_LIMIT(5, "drawline"); + LUA_ARG_NUMBER(1, "drawline", x1, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(2, "drawline", y1, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(3, "drawline", x2, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(4, "drawline", y2, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(5, "drawline", c, INT_MIN, INT_MAX); + + Pixel_figure = (void (*) (word,word,byte))Pixel_figure_no_screen; + Draw_line_general(x1, y1, x2, y2, c); + + return 0; +} + + +int L_DrawFilledRect(lua_State* L) +{ + int x1, y1, x2, y2, c; + int min_x,min_y,max_x,max_y, x_pos, y_pos; + + int nb_args = lua_gettop(L); + + LUA_ARG_LIMIT(5, "drawfilledrect"); + LUA_ARG_NUMBER(1, "drawfilledrect", x1, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(2, "drawfilledrect", y1, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(3, "drawfilledrect", x2, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(4, "drawfilledrect", y2, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(5, "drawfilledrect", c, INT_MIN, INT_MAX); + + // Put bounds in ascending order + if (x2>x1) + { + min_x=x1; + max_x=x2; + } + else + { + min_x=x2; + max_x=x1; + } + if (y2>y1) + { + min_y=y1; + max_y=y2; + } + else + { + min_y=y2; + max_y=y1; + } + + // Clipping limits + if (max_x>Main_image_width) + max_x=Main_image_width-1; + if (max_y>Main_image_height) + max_y=Main_image_height-1; + if (min_x<0) + min_x=0; + if (min_y<0) + min_y=0; + + // Perform drawing + for (y_pos=min_y; y_pos<=max_y;y_pos++) + for (x_pos=min_x; x_pos<=max_x;x_pos++) + Pixel_in_current_screen(x_pos,y_pos,c,0); + return 0; + +} + + +int L_DrawCircle(lua_State* L) +{ + int x1, y1, r, c; + + int nb_args = lua_gettop(L); + + LUA_ARG_LIMIT(4, "drawcircle"); + LUA_ARG_NUMBER(1, "drawcircle", x1, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(2, "drawcircle", y1, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(3, "drawcircle", r, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(4, "drawcircle", c, INT_MIN, INT_MAX); + + Pixel_figure = (void (*) (word,word,byte))Pixel_figure_no_screen; + Circle_limit = r*r; + Draw_empty_circle_general(x1, y1, r, c); + + return 0; +} + + +int L_DrawDisk(lua_State* L) +{ + int center_x, center_y, r, c; + long circle_limit; + short x_pos,y_pos; + short min_x,max_x,min_y,max_y; + + int nb_args = lua_gettop(L); + + LUA_ARG_LIMIT(4, "drawdisk"); + LUA_ARG_NUMBER(1, "drawdisk", center_x, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(2, "drawdisk", center_y, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(3, "drawdisk", r, INT_MIN, INT_MAX); + LUA_ARG_NUMBER(4, "drawdisk", c, INT_MIN, INT_MAX); + + circle_limit = r*r; + + // Compute clipping limits + min_x=center_x-r<0 ? 0 : center_x-r; + max_x=center_x+r>=Main_image_width? Main_image_width-1 : center_x+r; + min_y=center_y-r<0 ? 0 : center_y-r; + max_y=center_y+r>=Main_image_height? Main_image_height-1 : center_y+r; + + for (y_pos=min_y;y_pos<=max_y;y_pos++) + for (x_pos=min_x;x_pos<=max_x;x_pos++) + Pixel_in_current_screen(x_pos,y_pos,c,0); + + return 0; +} + + int L_GetPicturePixel(lua_State* L) { int x; @@ -1089,11 +1230,16 @@ int L_UpdateScreen(lua_State* L) int L_StatusMessage(lua_State* L) { const char* msg; + char* msg2; int nb_args = lua_gettop(L); LUA_ARG_LIMIT(1,"statusmessage"); LUA_ARG_STRING(1, "statusmessage", msg); - Print_in_menu(msg,0); + msg2 = strdup(msg); + if(strlen(msg)>24) + msg2[24] = 0; // Cut off long messages + Print_in_menu(msg2,0); + free(msg2); return 0; } @@ -1125,15 +1271,23 @@ void Draw_script_name(word x, word y, word index, byte highlighted) current_item = Get_item_by_index(&Scripts_selector, index); - if (current_item->Type==1) // Directories + if (current_item->Type==0) // Files { - fg=(highlighted)?MC_Black:MC_Dark; - bg=(highlighted)?MC_Dark:MC_Light; + fg=(highlighted)?MC_White:MC_Light; + bg=(highlighted)?MC_Dark:MC_Black; } - else // Files + else if (current_item->Type==1) // Directories { - fg=MC_Black; - bg=(highlighted)?MC_Dark:MC_Light; + fg=(highlighted)?MC_Light:MC_Dark; + bg=(highlighted)?MC_Dark:MC_Black; + } + else // Drives + { + fg=(highlighted)?MC_Light:MC_Dark; + bg=(highlighted)?MC_Dark:MC_Black; + + Window_display_icon_sprite(x,y,current_item->Icon); + x+=8; } Print_in_window(x, y, current_item->Short_name, fg,bg); @@ -1144,26 +1298,24 @@ void Draw_script_name(word x, word y, word index, byte highlighted) /// /// Displays first lines of comments from a lua script in the window. -void Draw_script_information(T_Fileselector_item * script_item) +void Draw_script_information(T_Fileselector_item * script_item, const char *full_directory) { FILE *script_file; - char full_name[MAX_PATH_CHARACTERS]; char text_block[3][DESC_WIDTH+1]; int x, y; int i; - + // Blank the target area Window_rectangle(7, FILESEL_Y + 89, DESC_WIDTH*6+2, 4*8, MC_Black); - if (script_item && script_item->Full_name && script_item->Full_name[0]!='\0') + if (script_item && script_item->Type==0 && script_item->Full_name && script_item->Full_name[0]!='\0') { - strcpy(full_name, Data_directory); - strcat(full_name, "scripts/"); - strcat(full_name, script_item->Full_name); - - + char full_name[MAX_PATH_CHARACTERS]; + strcpy(full_name, full_directory); + Append_path(full_name, script_item->Full_name, NULL); + x=0; - y=0; + y=0; text_block[0][0] = text_block[1][0] = text_block[2][0] = '\0'; // Start reading script_file = fopen(full_name, "r"); @@ -1209,7 +1361,7 @@ void Draw_script_information(T_Fileselector_item * script_item) // Display a line with the keyboard shortcut Print_help(8, FILESEL_Y + 89+24, "Key:", 'N', 0, 0); for (i=0; i<10; i++) - if (Bound_script[i]!=NULL && !strcmp(Bound_script[i], script_item->Full_name)) + if (Bound_script[i]!=NULL && !strcmp(Bound_script[i], full_name)) break; if (i<10) @@ -1245,8 +1397,8 @@ void Add_script(const char *name, byte is_file, byte is_directory, byte is_hidde if (len<=4 || strcasecmp(file_name+len-4, ".lua")) return; // Hidden - //if (is_hidden && !Config.Show_hidden_files) - // return; + if (is_hidden && !Config.Show_hidden_files) + return; Add_element_to_list(&Scripts_selector, file_name, Format_filename(file_name, NAME_WIDTH+1, 0), 0, ICON_NONE); } @@ -1255,9 +1407,12 @@ void Add_script(const char *name, byte is_file, byte is_directory, byte is_hidde // Ignore current directory if ( !strcmp(file_name, ".")) return; + // Ignore parent directory entry + if (!strcmp(file_name, PARENT_DIR)) + return; // Hidden - //if (is_hidden && !Config.Show_hidden_directories) - // return; + if (is_hidden && !Config.Show_hidden_directories) + return; Add_element_to_list(&Scripts_selector, file_name, Format_filename(file_name, NAME_WIDTH+1, 1), 1, ICON_NONE); } @@ -1268,7 +1423,7 @@ void Highlight_script(T_Fileselector *selector, T_List_button *list, const char short index; index=Find_file_in_fileselector(selector, selected_file); - Locate_list_item(list, selector, index); + Locate_list_item(list, index); } static char Last_run_script[MAX_PATH_CHARACTERS]=""; @@ -1280,61 +1435,85 @@ void Run_script(const char *script_subdirectory, const char *script_filename) lua_State* L; const char* message; byte old_cursor_shape=Cursor_shape; - char scriptdir[MAX_PATH_CHARACTERS]; - - strcpy(scriptdir, Data_directory); - strcat(scriptdir, "scripts/"); + char buf[MAX_PATH_CHARACTERS]; // Some scripts are slow Cursor_shape=CURSOR_SHAPE_HOURGLASS; Display_cursor(); Flush_update(); - chdir(scriptdir); - if (script_subdirectory && script_subdirectory[0]!='\0') { - sprintf(Last_run_script, "%s%s%s", script_subdirectory, PATH_SEPARATOR, script_filename); + strcpy(Last_run_script, script_subdirectory); + Append_path(Last_run_script, script_filename, NULL); } else { strcpy(Last_run_script, script_filename); } + // This chdir is for the script's sake. Grafx2 itself will (try to) + // not rely on what is the system's current directory. + Extract_path(buf,Last_run_script); + chdir(buf); L = lua_open(); - putenv("LUA_PATH=libs\\?.lua"); + strcpy(buf, "LUA_PATH="); + strcat(buf, Data_directory); + Append_path(buf+9, "scripts", NULL); + Append_path(buf+9, "libs", NULL); + Append_path(buf+9, "?.lua", NULL); + putenv(buf); + + // writing and reading pixels lua_register(L,"putbrushpixel",L_PutBrushPixel); + lua_register(L,"putpicturepixel",L_PutPicturePixel); + lua_register(L, "drawline",L_DrawLine); + lua_register(L, "drawfilledrect",L_DrawFilledRect); + lua_register(L, "drawcircle",L_DrawCircle); + lua_register(L, "drawdisk",L_DrawDisk); + lua_register(L,"getbrushpixel",L_GetBrushPixel); lua_register(L,"getbrushbackuppixel",L_GetBrushBackupPixel); - lua_register(L,"putpicturepixel",L_PutPicturePixel); lua_register(L,"getpicturepixel",L_GetPicturePixel); lua_register(L,"getlayerpixel",L_GetLayerPixel); lua_register(L,"getbackuppixel",L_GetBackupPixel); + lua_register(L,"getsparelayerpixel",L_GetSpareLayerPixel); + lua_register(L,"getsparepicturepixel",L_GetSparePicturePixel); + + + // resizing stuff lua_register(L,"setbrushsize",L_SetBrushSize); lua_register(L,"setpicturesize",L_SetPictureSize); + lua_register(L,"getbrushsize",L_GetBrushSize); lua_register(L,"getpicturesize",L_GetPictureSize); + lua_register(L,"getsparepicturesize",L_GetSparePictureSize); + + // color and palette lua_register(L,"setcolor",L_SetColor); + lua_register(L,"setforecolor",L_SetForeColor); + lua_register(L,"setbackcolor",L_SetBackColor); + lua_register(L,"getcolor",L_GetColor); lua_register(L,"getbackupcolor",L_GetBackupColor); - lua_register(L,"matchcolor",L_MatchColor); lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor); + lua_register(L,"getsparecolor",L_GetSpareColor); + lua_register(L,"getsparetranscolor",L_GetSpareTransColor); + lua_register(L,"getforecolor",L_GetForeColor); + lua_register(L,"getbackcolor",L_GetBackColor); + lua_register(L,"gettranscolor",L_GetTransColor); + + lua_register(L,"matchcolor",L_MatchColor); + + // ui lua_register(L,"inputbox",L_InputBox); lua_register(L,"messagebox",L_MessageBox); lua_register(L,"statusmessage",L_StatusMessage); lua_register(L,"selectbox",L_SelectBox); - lua_register(L,"getforecolor",L_GetForeColor); - lua_register(L,"getbackcolor",L_GetBackColor); - lua_register(L,"setforecolor",L_SetForeColor); - lua_register(L,"setbackcolor",L_SetBackColor); - lua_register(L,"gettranscolor",L_GetTransColor); - lua_register(L,"getsparepicturesize",L_GetSparePictureSize); - lua_register(L,"getsparelayerpixel",L_GetSpareLayerPixel); - lua_register(L,"getsparepicturepixel",L_GetSparePicturePixel); - lua_register(L,"getsparecolor",L_GetSpareColor); - lua_register(L,"getsparetranscolor",L_GetSpareTransColor); + + // misc. stuff lua_register(L,"clearpicture",L_ClearPicture); lua_register(L,"wait",L_Wait); lua_register(L,"waitbreak",L_WaitBreak); @@ -1407,6 +1586,7 @@ void Run_script(const char *script_subdirectory, const char *script_filename) Brush_backup=NULL; Update_colors_during_script(); End_of_modification(); + Print_in_menu(" ",0); lua_close(L); @@ -1467,20 +1647,19 @@ void Repeat_script(void) Run_script(NULL, Last_run_script); } -void Set_script_shortcut(T_Fileselector_item * script_item) +void Set_script_shortcut(T_Fileselector_item * script_item, const char *full_directory) { int i; char full_name[MAX_PATH_CHARACTERS]; if (script_item && script_item->Full_name && script_item->Full_name[0]!='\0') { - strcpy(full_name, Data_directory); - strcat(full_name, "scripts/"); - strcat(full_name, script_item->Full_name); + strcpy(full_name, full_directory); + Append_path(full_name, script_item->Full_name, NULL); // Find if it already has a shortcut for (i=0; i<10; i++) - if (Bound_script[i]!=NULL && !strcmp(Bound_script[i], script_item->Full_name)) + if (Bound_script[i]!=NULL && !strcmp(Bound_script[i], full_name)) break; if (i<10) { @@ -1497,7 +1676,7 @@ void Set_script_shortcut(T_Fileselector_item * script_item) if (i<10) { free(Bound_script[i]); - Bound_script[i]=strdup(script_item->Full_name); + Bound_script[i]=strdup(full_name); } else { @@ -1514,33 +1693,42 @@ void Set_script_shortcut(T_Fileselector_item * script_item) } // Refresh display Hide_cursor(); - Draw_script_information(script_item); + Draw_script_information(script_item, full_directory); Display_cursor(); } } +void Reload_scripts_list(void) +{ + // Reinitialize the list + Free_fileselector_list(&Scripts_selector); + if (Config.Scripts_directory[0]=='\0') + { + Read_list_of_drives(&Scripts_selector,NAME_WIDTH+1); + } + else + { + Add_element_to_list(&Scripts_selector, PARENT_DIR, Format_filename(PARENT_DIR, NAME_WIDTH+1, 1), 1, ICON_NONE); + // Add each found file to the list + For_each_directory_entry(Config.Scripts_directory, Add_script); + } + // Sort it + Sort_list_of_files(&Scripts_selector); + // +} + void Button_Brush_Factory(void) { static char selected_file[MAX_PATH_CHARACTERS]=""; - static char sub_directory[MAX_PATH_CHARACTERS]=""; - + short clicked_button; T_List_button* scriptlist; T_Scroller_button* scriptscroll; T_Special_button* scriptarea; - char scriptdir[MAX_PATH_CHARACTERS]; T_Fileselector_item *item; + int last_selected_item=-1; - // Reinitialize the list - Free_fileselector_list(&Scripts_selector); - strcpy(scriptdir, Data_directory); - strcat(scriptdir, "scripts/"); - strcat(scriptdir, sub_directory); - // Add each found file to the list - For_each_directory_entry(scriptdir, Add_script); - // Sort it - Sort_list_of_files(&Scripts_selector); - // + Reload_scripts_list(); Open_window(33+8*NAME_WIDTH, 180, "Brush Factory"); @@ -1548,11 +1736,11 @@ void Button_Brush_Factory(void) Window_display_frame_in(6, FILESEL_Y - 2, NAME_WIDTH*8+4, 84); // File selector // Fileselector - scriptarea=Window_set_special_button(8, FILESEL_Y + 1, NAME_WIDTH*8, 80); // 2 + scriptarea=Window_set_special_button(8, FILESEL_Y + 0, NAME_WIDTH*8, 80); // 2 // Scroller for the fileselector scriptscroll = Window_set_scroller_button(NAME_WIDTH*8+14, FILESEL_Y - 1, 82, Scripts_selector.Nb_elements,10, 0); // 3 - scriptlist = Window_set_list_button(scriptarea,scriptscroll,Draw_script_name); // 4 + scriptlist = Window_set_list_button(scriptarea,scriptscroll,Draw_script_name, 0); // 4 Window_set_normal_button(10, 149, 67, 14, "Run", 0, 1, SDLK_RETURN); // 5 @@ -1569,17 +1757,23 @@ void Button_Brush_Factory(void) Window_redraw_list(scriptlist); Draw_script_information(Get_item_by_index(&Scripts_selector, - scriptlist->List_start + scriptlist->Cursor_position)); + scriptlist->List_start + scriptlist->Cursor_position), Config.Scripts_directory); Update_window_area(0, 0, Window_width, Window_height); Display_cursor(); + // Wait for mouse release (needed for example after a double-click + // that navigates to a subdirectory) + while (last_selected_item==-1 && Mouse_K) + { + Get_input(20); + } Reset_quicksearch(); do { clicked_button = Window_clicked_button(); - if (Key==SDLK_BACKSPACE && sub_directory[0]!='\0') + if (Key==SDLK_BACKSPACE && Config.Scripts_directory[0]!='\0') { // Make it select first entry (parent directory) scriptlist->List_start=0; @@ -1598,34 +1792,20 @@ void Button_Brush_Factory(void) switch (clicked_button) { - case 4: + case 2: // Double-click an entry in script list + clicked_button=5; + break; + case 4: // Select script + last_selected_item = scriptlist->List_start + scriptlist->Cursor_position; Hide_cursor(); Draw_script_information(Get_item_by_index(&Scripts_selector, - scriptlist->List_start + scriptlist->Cursor_position)); + scriptlist->List_start + scriptlist->Cursor_position), Config.Scripts_directory); Display_cursor(); - { - // Test double-click - static long time_click = 0; - static int last_selected_item=-1; - static long time_previous; - - time_previous = time_click; - time_click = SDL_GetTicks(); - if (scriptlist->List_start + scriptlist->Cursor_position == last_selected_item) - { - if (time_click - time_previous < Config.Double_click_speed) - clicked_button=5; - } - else - { - last_selected_item=scriptlist->List_start + scriptlist->Cursor_position; - } - } break; case 6: Set_script_shortcut(Get_item_by_index(&Scripts_selector, - scriptlist->List_start + scriptlist->Cursor_position)); + scriptlist->List_start + scriptlist->Cursor_position), Config.Scripts_directory); break; default: @@ -1652,60 +1832,30 @@ void Button_Brush_Factory(void) if (item->Type==0) // File { - strcpy(selected_file, sub_directory); - strcat(selected_file, item->Full_name); + strcpy(selected_file, item->Full_name); break; } - else if (item->Type==1) // Directory + else if (item->Type==1 || item->Type==2) // Directory { - if (!strcmp(item->Full_name,PARENT_DIR)) + if (item->Type==2) { - // Going up one directory - long len; - char * slash_pos; - - // Remove trailing slash - len=strlen(sub_directory); - if (len && !strcmp(sub_directory+len-1,PATH_SEPARATOR)) - sub_directory[len-1]='\0'; - - slash_pos=Find_last_slash(sub_directory); - if (slash_pos) - { - strcpy(selected_file, slash_pos+1); - *slash_pos='\0'; - } - else - { - strcpy(selected_file, sub_directory); - sub_directory[0]='\0'; - } + // Selecting one drive root + strcpy(selected_file, PARENT_DIR); + strcat(Config.Scripts_directory, item->Full_name); } else { - // Going down one directory - strcpy(selected_file, PARENT_DIR); - - strcat(sub_directory, item->Full_name); - strcat(sub_directory, PATH_SEPARATOR); + // Going down one or up by one directory + Append_path(Config.Scripts_directory, item->Full_name, selected_file); } // No break: going back up to beginning of loop - // Reinitialize the list - Free_fileselector_list(&Scripts_selector); - strcpy(scriptdir, Data_directory); - strcat(scriptdir, "scripts/"); - strcat(scriptdir, sub_directory); - // Add each found file to the list - For_each_directory_entry(scriptdir, Add_script); - // Sort it - Sort_list_of_files(&Scripts_selector); - // + Reload_scripts_list(); scriptlist->Scroller->Nb_elements=Scripts_selector.Nb_elements; Compute_slider_cursor_length(scriptlist->Scroller); - + last_selected_item = -1; Hide_cursor(); } } @@ -1715,7 +1865,7 @@ void Button_Brush_Factory(void) if (clicked_button == 5) // Run the script { - Run_script("", selected_file); + Run_script(Config.Scripts_directory, selected_file); } else { diff --git a/src/fileformats.c b/src/fileformats.c index bef58bcc..66a5344e 100644 --- a/src/fileformats.c +++ b/src/fileformats.c @@ -28,6 +28,9 @@ #ifndef __no_pnglib__ #include +#if !defined(PNG_HAVE_PLTE) +#define PNG_HAVE_PLTE 0x02 +#endif #if (PNG_LIBPNG_VER_MAJOR <= 1) && (PNG_LIBPNG_VER_MINOR < 4) // Compatibility layer to allow us to use libng 1.4 or any older one. @@ -2079,7 +2082,6 @@ void Load_GIF(T_IO_Context * context) break; case 0x2C: // Local Image Descriptor { - // Si on a deja lu une image, c'est une GIF animée ou bizarroide, on sort. if (number_LID!=0) { // This a second layer/frame, or more. @@ -2195,14 +2197,18 @@ void Load_GIF(T_IO_Context * context) } } else + { File_error=2; + break; + } } // Code End-Of-Information ou erreur de fichier rencontré - + if (File_error==2 && GIF_pos_X==0 && GIF_pos_Y==IDB.Image_height) + File_error=0; /*Close_lecture();*/ if (File_error>=0) if ( /* (GIF_pos_X!=0) || */ - ( ( (!GIF_interlaced) && (GIF_pos_Y!=IDB.Image_height) ) || + ( ( (!GIF_interlaced) && (GIF_pos_Y!=IDB.Image_height) && (GIF_pos_X!=0)) || ( (GIF_interlaced) && (!GIF_finished_interlaced_image) ) ) ) File_error=2; @@ -2214,7 +2220,8 @@ void Load_GIF(T_IO_Context * context) break; } // Lecture du code de fonction suivant: - Read_byte(GIF_file,&block_identifier); + if (!Read_byte(GIF_file,&block_identifier)) + File_error=2; } } // Le fichier contenait un LSDB else diff --git a/src/filesel.c b/src/filesel.c index 6a24a71a..f0eec93c 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -29,20 +29,15 @@ #include #include #include - #define isHidden(x) (0) - #elif defined (__MINT__) #include #include - #define isHidden(x) (0) #elif defined(__WIN32__) #include #include #include - #define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN) #else #include - #define isHidden(x) ((x)->d_name[0]=='.') #endif #include @@ -393,7 +388,7 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format) (!strcmp(entry->d_name, PARENT_DIR) || // ou qu'il n'est pas caché Config.Show_hidden_directories || - !isHidden(entry))) + !File_is_hidden(entry->d_name, entry->d_name))) { // On rajoute le répertoire à la liste Add_element_to_list(list, entry->d_name, Format_filename(entry->d_name, 19, 1), 1, ICON_NONE); @@ -401,7 +396,7 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format) } else if (S_ISREG(Infos_enreg.st_mode) && //Il s'agit d'un fichier (Config.Show_hidden_files || //Il n'est pas caché - !isHidden(entry))) + !File_is_hidden(entry->d_name, entry->d_name))) { const char * ext = filter; while (ext!=NULL) @@ -479,7 +474,7 @@ void bstrtostr( BSTR in, STRPTR out, TEXT max ) #endif // -- Lecture d'une liste de lecteurs / volumes ----------------------------- -void Read_list_of_drives(T_Fileselector *list) +void Read_list_of_drives(T_Fileselector *list, byte name_length) { // Empty the current content of fileselector: @@ -500,7 +495,7 @@ void Read_list_of_drives(T_Fileselector *list) { bstrtostr( dl->dol_Name, tmp, 254 ); strcat( tmp, ":" ); - Add_element_to_list(list, tmp, Format_filename(tmp, 19, 2), 2, ICON_NONE ); + Add_element_to_list(list, tmp, Format_filename(tmp, name_length, 2), 2, ICON_NONE ); list->Nb_directories++; } UnLockDosList( LDF_VOLUMES | LDF_READ ); @@ -544,7 +539,7 @@ void Read_list_of_drives(T_Fileselector *list) break; } drive_name[0]='A'+bit_index; - Add_element_to_list(list, drive_name, Format_filename(drive_name,18,2), 2, icon); + Add_element_to_list(list, drive_name, Format_filename(drive_name,name_length-1,2), 2, icon); list->Nb_directories++; drive_index++; } @@ -561,7 +556,7 @@ void Read_list_of_drives(T_Fileselector *list) if ( (1 << bit_index) & drive_bits ) { drive_name[0]='A'+bit_index; - Add_element_to_list(list, drive_name,Format_filename(drive_name,19,2),2,ICON_NONE); + Add_element_to_list(list, drive_name,Format_filename(drive_name,name_length,2),2,ICON_NONE); list->Nb_directories++; drive_index++; } @@ -583,11 +578,11 @@ void Read_list_of_drives(T_Fileselector *list) #else char * home_dir = getenv("HOME"); #endif - Add_element_to_list(list, "/", Format_filename("/",19,2), 2, ICON_NONE); + Add_element_to_list(list, "/", Format_filename("/",name_length,2), 2, ICON_NONE); list->Nb_directories++; if(home_dir) { - Add_element_to_list(list, home_dir, Format_filename(home_dir, 19, 2), 2, ICON_NONE); + Add_element_to_list(list, home_dir, Format_filename(home_dir, name_length, 2), 2, ICON_NONE); list->Nb_directories++; } @@ -597,7 +592,7 @@ void Read_list_of_drives(T_Fileselector *list) { if(mount_points_list->me_dummy == 0 && strcmp(mount_points_list->me_mountdir,"/") && strcmp(mount_points_list->me_mountdir,"/home")) { - Add_element_to_list(list, mount_points_list->me_mountdir, Format_filename(mount_points_list->me_mountdir, 19, 2), 2, ICON_NONE); + Add_element_to_list(list, mount_points_list->me_mountdir, Format_filename(mount_points_list->me_mountdir, name_length, 2), 2, ICON_NONE); list->Nb_directories++; } next = mount_points_list -> me_next; @@ -1227,7 +1222,7 @@ short Quicksearch(T_Fileselector *selector) } // Translated from Highlight_file -void Locate_list_item(T_List_button * list, T_Fileselector * selector, short selected_item) +void Locate_list_item(T_List_button * list, short selected_item) { // Safety bounds @@ -1263,7 +1258,7 @@ int Quicksearch_list(T_List_button * list, T_Fileselector * selector) short selected_item=Quicksearch(selector); if (selected_item>=0 && selected_item!=list->Cursor_position+list->List_start) { - Locate_list_item(list, selector, selected_item); + Locate_list_item(list, selected_item); Hide_cursor(); // Mise à jour du scroller @@ -1419,12 +1414,13 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context) else { #if defined(__MINT__) - chdir(context->File_directory); static char path[1024]={0}; + chdir(context->File_directory); Dgetpath(path,0); strcat(path,PATH_SEPARATOR); strcpy(Main_current_directory,path); #else + chdir(context->File_directory); getcwd(Main_current_directory,256); #endif @@ -1610,7 +1606,6 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context) if (Main_format != Window_attribute2) { char* savename = (char *)strdup(Selector_filename); int nameLength = strlen(savename); - DEBUG(Selector_filename, 42); Main_format = Window_attribute2; // Comme on change de liste, on se place en début de liste: Main_fileselector_position = 0; @@ -1709,7 +1704,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context) Main_fileselector_position=0; Main_fileselector_offset=0; // Affichage des premiers fichiers visibles: - Read_list_of_drives(&Filelist); + Read_list_of_drives(&Filelist,19); Sort_list_of_files(&Filelist); Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,file_scroller); Display_cursor(); @@ -1940,7 +1935,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context) else // Sinon on essaye de charger ou sauver le fichier { strcpy(context->File_directory,Main_current_directory); - if (!load) + if (!load && !Get_fileformat(Main_format)->Palette_only) Main_fileformat=Main_format; save_or_load_image=1; } diff --git a/src/filesel.h b/src/filesel.h index 19b6f777..e2f9a4c1 100644 --- a/src/filesel.h +++ b/src/filesel.h @@ -46,9 +46,11 @@ void Recount_files(T_Fileselector *list); T_Fileselector_item * Get_item_by_index(T_Fileselector *list, short index); +void Read_list_of_drives(T_Fileselector *list, byte name_length); + short Find_file_in_fileselector(T_Fileselector *list, const char * fname); -void Locate_list_item(T_List_button * list, T_Fileselector * selector, short selected_item); +void Locate_list_item(T_List_button * list, short selected_item); int Quicksearch_list(T_List_button * list, T_Fileselector * selector); diff --git a/src/global.h b/src/global.h index 771e630e..220abbf9 100644 --- a/src/global.h +++ b/src/global.h @@ -581,7 +581,7 @@ GFX2_GLOBAL struct word Height; ///< Button's active heigth byte Pressed; ///< Button is currently pressed byte Shape; ///< Shape, listed in enum ::BUTTON_SHAPES - char Icon; ///< Which icon to display: Either the one from the toolbar (-1) or one of ::MENU_SPRITE + signed char Icon; ///< Which icon to display: Either the one from the toolbar (-1) or one of ::MENU_SPRITE // Triggers on mouse/keyboard Func_action Left_action; ///< Action triggered by a left mouseclick on the button diff --git a/src/graph.c b/src/graph.c index d263fc72..776f9c60 100644 --- a/src/graph.c +++ b/src/graph.c @@ -1275,7 +1275,6 @@ void Draw_empty_circle_general(short center_x,short center_y,short radius,byte c Pixel_figure(center_x+radius,center_y,color); // Droite Pixel_figure(center_x,center_y+radius,color); // Bas - if(Main_magnifier_mode) Update_part_of_screen(center_x-radius,center_y-radius,2*radius+1,2*radius+1); } // -- Tracé définitif d'un cercle vide -- diff --git a/src/graph.h b/src/graph.h index 27724c5f..2ba2d776 100644 --- a/src/graph.h +++ b/src/graph.h @@ -59,9 +59,12 @@ void Pixel_figure_preview_xor(word x_pos,word y_pos,byte color); void Pixel_figure_preview_xorback(word x_pos,word y_pos,byte color); void Pixel_figure_in_brush(word x_pos,word y_pos,byte color); +void Draw_empty_circle_general(short center_x,short center_y,short radius,byte color); + void Draw_empty_circle_permanent(short center_x,short center_y,short radius,byte color); void Draw_empty_circle_preview (short center_x,short center_y,short radius,byte color); void Hide_empty_circle_preview (short center_x,short center_y,short radius); +void Draw_empty_circle_general(short center_x,short center_y,short radius,byte color); void Draw_filled_circle (short center_x,short center_y,short radius,byte color); void Draw_empty_ellipse_permanent(short center_x,short center_y,short horizontal_radius,short vertical_radius,byte color); diff --git a/src/help.c b/src/help.c index 7ce41b18..e258fa2c 100644 --- a/src/help.c +++ b/src/help.c @@ -226,6 +226,32 @@ void Window_set_shortcut(int action_id) shortcut_ptr[0]=backup_shortcut[0]; shortcut_ptr[1]=backup_shortcut[1]; case 2: // OK + // Replace twice by single + if (shortcut_ptr[0]==shortcut_ptr[1]) + shortcut_ptr[1]=0; + // Remove all other shortcuts that use same keys + if (!Config.Allow_multi_shortcuts) + { + int n; + for (n=0; n<2; n++) + { + if (shortcut_ptr[n]!=0) + { + int i; + for(i=0; i, the program will") diff --git a/src/init.c b/src/init.c index 2ff75c27..8be7e423 100644 --- a/src/init.c +++ b/src/init.c @@ -2512,7 +2512,7 @@ void Set_config_defaults(void) { int index, index2; - // Raccourcis clavier + // Keyboard shortcuts for (index=0; index>8) @@ -2550,7 +2550,7 @@ void Set_config_defaults(void) Shade_list[Shade_current].Mode, Shade_table_left,Shade_table_right); - // Masque + // Mask for (index=0; index<256; index++) Mask_table[index]=0; @@ -2577,7 +2577,7 @@ void Set_config_defaults(void) Quick_shade_step=1; Quick_shade_loop=0; - // Grille + // Grid Snap_width=Snap_height=8; Snap_offset_X=Snap_offset_Y=0; @@ -2588,6 +2588,7 @@ void Set_config_defaults(void) #if defined(__WIN32__) #define SIGHANDLER_T __p_sig_fn_t #elif defined(__macosx__) + typedef void (*sig_t) (int); #define SIGHANDLER_T sig_t #else #define SIGHANDLER_T __sighandler_t diff --git a/src/input.c b/src/input.c index 45b54b6f..d9e5273d 100644 --- a/src/input.c +++ b/src/input.c @@ -85,12 +85,6 @@ word Input_new_mouse_Y; byte Input_new_mouse_K; byte Button_inverter=0; // State of the key that swaps mouse buttons. -byte Mouse_mode = 0; ///< Mouse mode = 0:normal, 1:emulated with custom sensitivity. -short Mouse_virtual_x_position; -short Mouse_virtual_y_position; -short Mouse_virtual_width; -short Mouse_virtual_height; - // Joystick/pad configurations for the various console ports. // See the #else for the documentation of fields. // TODO: Make these user-settable somehow. @@ -306,30 +300,8 @@ void Handle_window_exit(__attribute__((unused)) SDL_QuitEvent event) int Handle_mouse_move(SDL_MouseMotionEvent event) { - if (Mouse_mode == 0) - { - Input_new_mouse_X = event.x/Pixel_width; - Input_new_mouse_Y = event.y/Pixel_height; - } - else - { - Mouse_virtual_x_position += event.xrel * 12 / Config.Mouse_sensitivity_index_x; - // Clip - if (Mouse_virtual_x_position > Mouse_virtual_width) - Mouse_virtual_x_position = Mouse_virtual_width; - else if (Mouse_virtual_x_position < 0) - Mouse_virtual_x_position = 0; - - Mouse_virtual_y_position += event.yrel * 12 / Config.Mouse_sensitivity_index_y; - // Clip - if (Mouse_virtual_y_position > Mouse_virtual_height) - Mouse_virtual_y_position = Mouse_virtual_height; - else if (Mouse_virtual_y_position < 0) - Mouse_virtual_y_position = 0; - - Input_new_mouse_X = Mouse_virtual_x_position / 12 / Pixel_width; - Input_new_mouse_Y = Mouse_virtual_y_position / 12 / Pixel_height; - } + Input_new_mouse_X = event.x/Pixel_width; + Input_new_mouse_Y = event.y/Pixel_height; return Move_cursor_with_constraints(); } @@ -1050,32 +1022,13 @@ int Get_input(int sleep_time) void Adjust_mouse_sensitivity(word fullscreen) { - if (fullscreen == 0) - { - Mouse_mode = 0; - return; - } - Mouse_mode = 1; - Mouse_virtual_x_position = 12*Mouse_X*Pixel_width; - Mouse_virtual_y_position = 12*Mouse_Y*Pixel_height; - Mouse_virtual_width = 12*(Screen_width-1)*Pixel_width; - Mouse_virtual_height = 12*(Screen_height-1)*Pixel_height; + // Deprecated + (void)fullscreen; } void Set_mouse_position(void) { - if (Mouse_mode == 0) - { - SDL_WarpMouse( - Mouse_X*Pixel_width, - Mouse_Y*Pixel_height - ); - } - else - { - Mouse_virtual_x_position = 12*Mouse_X*Pixel_width; - Mouse_virtual_y_position = 12*Mouse_Y*Pixel_height; - } + SDL_WarpMouse(Mouse_X*Pixel_width, Mouse_Y*Pixel_height); } int Color_cycling(__attribute__((unused)) void* useless) diff --git a/src/io.c b/src/io.c index d770a84f..171cb853 100644 --- a/src/io.c +++ b/src/io.c @@ -37,20 +37,16 @@ #include #include #include - #define isHidden(x) (0) #elif defined(__WIN32__) #include #include //#include - #define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN) #elif defined(__MINT__) #include #include #include - #define isHidden(x) (0) #else #include - #define isHidden(x) ((x)->d_name[0]=='.') #endif #include "struct.h" @@ -204,6 +200,75 @@ void Extract_path(char *dest, const char *source) strcat(dest, PATH_SEPARATOR); } +/// +/// Appends a file or directory name to an existing directory name. +/// As a special case, when the new item is equal to PARENT_DIR, this +/// will remove the rightmost directory name. +/// reverse_path is optional, if it's non-null, the function will +/// write there : +/// - if filename is ".." : The name of eliminated directory/file +/// - else: ".." +void Append_path(char *path, const char *filename, char *reverse_path) +{ + // Parent + if (!strcmp(filename, PARENT_DIR)) + { + // Going up one directory + long len; + char * slash_pos; + + // Remove trailing slash + len=strlen(path); + if (len && (!strcmp(path+len-1,PATH_SEPARATOR) + #ifdef __WIN32__ + || path[len-1]=='/' + #endif + )) + path[len-1]='\0'; + + slash_pos=Find_last_slash(path); + if (slash_pos) + { + if (reverse_path) + strcpy(reverse_path, slash_pos+1); + *slash_pos='\0'; + } + else + { + if (reverse_path) + strcpy(reverse_path, path); + path[0]='\0'; + } + #if defined(__WIN32__) + // Roots of drives need a pending antislash + if (path[0]!='\0' && path[1]==':' && path[2]=='\0') + { + strcat(path, PATH_SEPARATOR); + } + #endif + } + else + // Sub-directory + { + long len; + // Add trailing slash if needed + len=strlen(path); + if (len && (strcmp(path+len-1,PATH_SEPARATOR) + #ifdef __WIN32__ + && path[len-1]!='/' + #endif + )) + { + strcpy(path+len, PATH_SEPARATOR); + len+=strlen(PATH_SEPARATOR); + } + strcat(path, filename); + + if (reverse_path) + strcpy(reverse_path, PARENT_DIR); + } +} + int File_exists(char * fname) // Détermine si un file passé en paramètre existe ou non dans le // répertoire courant. @@ -242,6 +307,32 @@ int Directory_exists(char * directory) } } +#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) || defined(__MINT__) + #define FILE_IS_HIDDEN_ATTRIBUTE __attribute__((unused)) +#else + #define FILE_IS_HIDDEN_ATTRIBUTE +#endif +/// Check if a file or directory is hidden. +int File_is_hidden(FILE_IS_HIDDEN_ATTRIBUTE const char *fname, const char *full_name) +{ +#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) || defined(__MINT__) + // False (unable to determine, or irrrelevent for platform) + return 0; +#elif defined(__WIN32__) + unsigned long att; + if (full_name!=NULL) + att = GetFileAttributesA(full_name); + else + att = GetFileAttributesA(fname); + if (att==INVALID_FILE_ATTRIBUTES) + return 0; + return (att&FILE_ATTRIBUTE_HIDDEN)?1:0; +#else + return fname[0]=='.'; +#endif + + +} // Taille de fichier, en octets int File_length(const char * fname) { @@ -296,7 +387,7 @@ void For_each_directory_entry(const char * directory_name, void Callback(const c char full_filename[MAX_PATH_CHARACTERS]; int filename_position; strcpy(full_filename, directory_name); - current_directory=opendir(directory_name); + current_directory=opendir(full_filename); if(current_directory == NULL) return; // Répertoire invalide ... filename_position = strlen(full_filename); if (filename_position==0 || strcmp(full_filename+filename_position-1,PATH_SEPARATOR)) @@ -313,7 +404,7 @@ void For_each_directory_entry(const char * directory_name, void Callback(const c full_filename, S_ISREG(Infos_enreg.st_mode), S_ISDIR(Infos_enreg.st_mode), - isHidden(entry)?1:0); + File_is_hidden(entry->d_name, full_filename)); } closedir(current_directory); } diff --git a/src/io.h b/src/io.h index 53237f3f..042ef337 100644 --- a/src/io.h +++ b/src/io.h @@ -90,18 +90,30 @@ int File_exists(char * fname); /// Returns true if a directory passed as a parameter exists in the current directory. int Directory_exists(char * directory); +/// Check if a file or directory is hidden. Full name (with directories) is optional. +int File_is_hidden(const char *fname, const char *full_name); + /// Scans a directory, calls Callback for each file in it, void For_each_file(const char * directory_name, void Callback(const char *)); /// Scans a directory, calls Callback for each file or directory in it, void For_each_directory_entry(const char * directory_name, void Callback(const char *, byte is_file, byte is_directory, byte is_hidden)); - /// /// Creates a fully qualified name from a directory and filename. /// The point is simply to insert a PATH_SEPARATOR when needed. void Get_full_filename(char * output_name, char * file_name, char * directory_name); +/// +/// Appends a file or directory name to an existing directory name. +/// As a special case, when the new item is equal to PARENT_DIR, this +/// will remove the rightmost directory name. +/// reverse_path is optional, if it's non-null, the function will +/// write there : +/// - if filename is ".." : The name of eliminated directory/file +/// - else: ".." +void Append_path(char *path, const char *filename, char *reverse_path); + /// /// Creates a lock file, to check if an other instance of Grafx2 is running. /// @return 0 on success (first instance), -1 on failure (others are running) diff --git a/src/keyboard.c b/src/keyboard.c index b459b83c..584d20fb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -601,6 +601,7 @@ word Keysym_to_ANSI(SDL_keysym keysym) #if !(defined(__macosx__) || defined(__FreeBSD__)) if ( keysym.unicode == 0) { + switch(keysym.sym) { case SDLK_DELETE: @@ -610,7 +611,11 @@ word Keysym_to_ANSI(SDL_keysym keysym) case SDLK_END: case SDLK_BACKSPACE: case KEY_ESC: + return keysym.sym; case SDLK_RETURN: + // Case alt-enter + if (SDL_GetModState() & (KMOD_ALT|KMOD_META)) + return '\n'; return keysym.sym; default: return 0; diff --git a/src/loadsave.c b/src/loadsave.c index e9e73edb..9de15cf7 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -628,7 +628,8 @@ void Load_image(T_IO_Context *context) if (File_error>0) { fprintf(stderr,"Unable to load file %s!\n",context->File_name); - Error(0); + if (context->Type!=CONTEXT_SURFACE) + Error(0); } // Post-load @@ -693,14 +694,35 @@ void Load_image(T_IO_Context *context) memset(color_usage,0,sizeof(color_usage)); if (Count_used_colors(color_usage)<252) { - int gui_index=0; - int c; - for (c=255; c>=0 && gui_index<4; c--) + int gui_index; + // From white to black + for (gui_index=3; gui_index>=0; gui_index--) { - if (color_usage[c]==0) + int c; + T_Components gui_color; + + gui_color=*Favorite_GUI_color(gui_index); + // Try find a very close match (ignore last 2 bits) + for (c=255; c>=0; c--) { - context->Palette[c]=*Favorite_GUI_color(gui_index); - gui_index++; + if ((context->Palette[c].R|3) == (gui_color.R|3) + && (context->Palette[c].G|3) == (gui_color.G|3) + && (context->Palette[c].B|3) == (gui_color.B|3) ) + break; + } + if (c<0) // Not found + { + // Find an unused slot at end of palette + for (c=255; c>=0; c--) + { + if (color_usage[c]==0) + { + context->Palette[c]=gui_color; + // Tag as a used color + color_usage[c]=1; + break; + } + } } } } diff --git a/src/main.c b/src/main.c index 3ba10ff9..08685850 100644 --- a/src/main.c +++ b/src/main.c @@ -67,6 +67,7 @@ #include "palette.h" #include "realpath.h" #include "input.h" +#include "help.h" #if defined(__WIN32__) #include @@ -658,6 +659,11 @@ int Init_program(int argc,char * argv[]) temp=Load_INI(&Config); if (temp) Error(temp); + + if(!Config.Allow_multi_shortcuts) + { + Remove_duplicate_shortcuts(); + } Compute_menu_offsets(); diff --git a/src/mountlist.c b/src/mountlist.c index 2912918c..113a4d34 100644 --- a/src/mountlist.c +++ b/src/mountlist.c @@ -25,6 +25,9 @@ // We don't use autoconf and all that in grafx2, so let's do the config here ... #if defined(__macosx__) || defined(__FreeBSD__) // MacOS X is POSIX compliant #define MOUNTED_GETMNTINFO +#if defined(__macosx__) + #include +#endif #elif defined(__NetBSD__) #define MOUNTED_GETMNTINFO2 #elif defined(__BEOS__) || defined(__HAIKU__) diff --git a/src/operatio.c b/src/operatio.c index d822fe29..92667d37 100644 --- a/src/operatio.c +++ b/src/operatio.c @@ -2760,7 +2760,16 @@ void Scroll_12_0(void) if (Mouse_K == LEFT_SIDE) Backup(); else - Backup_layers(Main_layers_visible); + { + Backup_layers(-1); // Main_layers_visible + #ifndef NOLAYERS + // Ensure the backup visible image is up-to-date + // (after swapping some layers on/off, it gets outdated) + memcpy(Main_visible_image_backup.Image, + Main_visible_image.Image, + Main_image_width*Main_image_height); + #endif + } Cursor_hidden_before_scroll=Cursor_hidden; Cursor_hidden=1; @@ -2818,7 +2827,6 @@ void Scroll_12_5(void) { // One layer at once Scroll_picture(Main_backups->Pages->Next->Image[Main_current_layer], Main_backups->Pages->Image[Main_current_layer], x_offset, y_offset); - //Redraw_layered_image(); Redraw_current_layer(); } @@ -2874,6 +2882,7 @@ void Scroll_0_5(void) // Do the actual scroll operation on all layers. for (i=0; iPages->Nb_layers; i++) + //if ((1<Pages->Next->Image[i], Main_backups->Pages->Image[i], x_offset, y_offset); // Update the depth buffer too ... // It would be faster to scroll it, but we don't have method diff --git a/src/palette.c b/src/palette.c index 91bad838..3ca1f7d3 100644 --- a/src/palette.c +++ b/src/palette.c @@ -207,6 +207,66 @@ void Spread_colors(short start,short end,T_Palette palette) } } +// FIXME: keep them in main function but pass them to Palette_edit_*() + T_Components * backup_palette; + T_Components * temp_palette; + T_Components * working_palette; + +byte Palette_undo_state = 0; +byte Palette_change_state = 0; + +/// Backup before doing one self-complete change. +void Palette_edit_step() +{ + // back up + memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_change_state=0; + Palette_undo_state=0; +} + +/// Mode for incremental changes. +void Palette_edit_select_range() +{ + if (Palette_change_state) + {/* + // acknowledge pending changes and back up + memcpy(backup_palette,working_palette,sizeof(T_Palette)); + memcpy(temp_palette,working_palette,sizeof(T_Palette)); + */} + Palette_change_state=0; +} + +/// Perform incremental change in RGB channel of some color(s). +void Palette_edit_alter_channel() +{ + if (!Palette_change_state) + { + memcpy(backup_palette,working_palette,sizeof(T_Palette)); + memcpy(temp_palette,working_palette,sizeof(T_Palette)); + } + Palette_change_state=1; +} + +/// Undo +void Palette_edit_undo_redo() +{ + if (Palette_change_state) + { + // swap backup and working (temp serves as intermediate) + memcpy(temp_palette,backup_palette,sizeof(T_Palette)); + memcpy(backup_palette,working_palette,sizeof(T_Palette)); + memcpy(working_palette,temp_palette,sizeof(T_Palette)); + } + else + { + // swap backup and working (temp serves as intermediate) + memcpy(temp_palette,backup_palette,sizeof(T_Palette)); + memcpy(backup_palette,working_palette,sizeof(T_Palette)); + memcpy(working_palette,temp_palette,sizeof(T_Palette)); + } + Palette_undo_state=(Palette_undo_state==0); +} + void Update_color_count(short * used_colors, dword * color_usage) { @@ -1027,9 +1087,9 @@ void Button_Palette(void) short used_colors = -1; // -1 <=> Inconnu byte conversion_table[256]; - T_Components * backup_palette; - T_Components * temp_palette; - T_Components * working_palette; + //T_Components * backup_palette; + //T_Components * temp_palette; + //T_Components * working_palette; static byte show_used_colors=0; @@ -1042,8 +1102,7 @@ void Button_Palette(void) Open_window(299, 188,"Palette"); memcpy(working_palette, Main_palette, sizeof(T_Palette)); - memcpy(backup_palette, Main_palette, sizeof(T_Palette)); - memcpy(temp_palette, Main_palette, sizeof(T_Palette)); + Palette_edit_step(); Window_set_palette_button(5, 79); // 1 @@ -1195,7 +1254,7 @@ void Button_Palette(void) int nb_colors; // Backup - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); nb_colors = Get_clipboard_colors(working_palette, block_start); if (nb_colors>0) @@ -1261,8 +1320,7 @@ void Button_Palette(void) Window_rectangle(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,Fore_color); Update_window_area(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H); - memcpy(backup_palette ,working_palette,sizeof(T_Palette)); - memcpy(temp_palette,working_palette,sizeof(T_Palette)); + Palette_edit_select_range(); } } else @@ -1337,6 +1395,7 @@ void Button_Palette(void) break; case 2 : // Jauge rouge Hide_cursor(); + Palette_edit_alter_channel(); if (block_start==block_end) { if(Palette_view_is_RGB) @@ -1417,6 +1476,7 @@ void Button_Palette(void) break; case 3 : // Jauge verte Hide_cursor(); + Palette_edit_alter_channel(); if (block_start==block_end) { if(Palette_view_is_RGB) @@ -1497,6 +1557,7 @@ void Button_Palette(void) case 4 : // Jauge bleue Hide_cursor(); + Palette_edit_alter_channel(); if (block_start==block_end) { if(Palette_view_is_RGB) @@ -1580,7 +1641,7 @@ void Button_Palette(void) { dword sum_r=0, sum_g=0, sum_b=0, used=0; - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); // Compute weighted average for (i=block_start; i<=block_end; i++) { @@ -1614,7 +1675,7 @@ void Button_Palette(void) if (temp_color>=0) { dword sum_r=0, sum_g=0, sum_b=0, used; - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); // Compute weighted average used=color_usage[temp_color]+color_usage[Fore_color]; @@ -1656,7 +1717,7 @@ void Button_Palette(void) case 6 : // Grey scale // Backup - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); // Grey Scale for (i=block_start;i<=block_end;i++) { @@ -1680,7 +1741,7 @@ void Button_Palette(void) && (temp_color!=block_start)) { Hide_cursor(); - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); // On calcule le nombre de couleurs a swapper sans risquer de sortir // de la palette (La var. first_color est utilisée pour économiser 1 var; c'est tout) @@ -1735,6 +1796,7 @@ void Button_Palette(void) // En cas de X-Swap, tout l'ecran a pu changer de couleur. if (clicked_button==8) { + Palette_edit_step(); // Disable Undo Update_rect(0, 0, Screen_width, Menu_Y_before_window); End_of_modification(); } @@ -1742,12 +1804,12 @@ void Button_Palette(void) } break; - case 9 : // Copy + case 9 : // Copy (to other slot) temp_color=Wait_click_in_palette(Window_palette_button_list); if ((temp_color>=0) && (temp_color!=block_start)) { Hide_cursor(); - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); memcpy(working_palette+temp_color,backup_palette+block_start, ((temp_color+block_end-block_start<=255)?block_end+1-block_start:256-temp_color)*3); memcpy(temp_palette,working_palette,sizeof(T_Palette)); @@ -1788,7 +1850,7 @@ void Button_Palette(void) case 10 : // Spread if (block_start!=block_end) { - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); Spread_colors(block_start,block_end,working_palette); } else @@ -1796,7 +1858,7 @@ void Button_Palette(void) temp_color=Wait_click_in_palette(Window_palette_button_list); if (temp_color>=0) { - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); if (temp_colorPosition) @@ -2037,6 +2098,7 @@ void Button_Palette(void) if (!Palette_view_is_RGB) break; Hide_cursor(); + Palette_edit_alter_channel(); if (block_start==block_end) { if (red_slider->Position RGB // Acte les changements en cours sur une ou plusieurs couleurs - memcpy(temp_palette,working_palette,sizeof(T_Palette)); - memcpy(backup_palette, working_palette,sizeof(T_Palette)); + Palette_edit_select_range(); Hide_cursor(); @@ -2360,6 +2422,7 @@ void Button_Palette(void) // Maintenant, tous ces calculs doivent êtres pris en compte dans la // palette, l'image et à l'écran. Set_palette(working_palette); + Palette_edit_step(); // Disable Undo End_of_modification(); need_to_remap=1; @@ -2398,7 +2461,7 @@ void Button_Palette(void) new_blue=(new_color&0x0000FF); // Backup - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); // Assign color for (i=block_start;i<=block_end;i++) { @@ -2445,8 +2508,7 @@ void Button_Palette(void) Window_rectangle(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,Fore_color); Update_window_area(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H); - memcpy(backup_palette ,working_palette,sizeof(T_Palette)); - memcpy(temp_palette,working_palette,sizeof(T_Palette)); + Palette_edit_select_range(); } Display_cursor(); @@ -2541,7 +2603,7 @@ void Button_Palette(void) if (used_colors==-1) Update_color_count(&used_colors, color_usage); - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); memcpy(temp_palette,Main_palette,sizeof(T_Palette)); memcpy(Main_palette,working_palette,sizeof(T_Palette)); Set_nice_menu_colors(color_usage,0); @@ -2594,8 +2656,7 @@ void Button_Palette(void) Window_rectangle(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,Fore_color); Update_window_area(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H); - memcpy(backup_palette ,working_palette,sizeof(T_Palette)); - memcpy(temp_palette,working_palette,sizeof(T_Palette)); + Palette_edit_select_range(); } Display_cursor(); Wait_end_of_click(); @@ -2622,7 +2683,7 @@ void Button_Palette(void) Hide_cursor(); // Backup - memcpy(backup_palette,working_palette,sizeof(T_Palette)); + Palette_edit_step(); nb_colors = Get_clipboard_colors(working_palette, block_start); if (nb_colors>0) diff --git a/src/pversion.c b/src/pversion.c index 8d757738..b60e3b67 100644 --- a/src/pversion.c +++ b/src/pversion.c @@ -1,2 +1,2 @@ -char Program_version[]="2.3wip"; +char Program_version[]="2.3"; diff --git a/src/readini.c b/src/readini.c index 15473878..21827b6c 100644 --- a/src/readini.c +++ b/src/readini.c @@ -34,6 +34,8 @@ #include "misc.h" #include "readini.h" #include "setup.h" +#include "realpath.h" +#include "io.h" void Load_INI_clear_string(char * str, byte keep_comments) { @@ -933,8 +935,26 @@ int Load_INI(T_Config * conf) } } + // Optional, Location of last directory used for Lua scripts browsing (>=2.3) + conf->Scripts_directory[0]='\0'; + if (!Load_INI_get_string (file,buffer,"Scripts_directory",value_label, 1)) + { + strcpy(conf->Scripts_directory,value_label); + } + if (conf->Scripts_directory[0]=='\0') + { + // Default when empty: + Realpath(Data_directory, conf->Scripts_directory); + Append_path(conf->Scripts_directory, "scripts", NULL); + } - + conf->Allow_multi_shortcuts=0; + // Optional, allow or disallow multiple shortcuts on same key (>=2.3) + if (!Load_INI_get_values (file,buffer,"Allow_multi_shortcuts",1,values)) + { + conf->Allow_multi_shortcuts=(values[0]!=0); + } + // Insert new values here fclose(file); diff --git a/src/readline.c b/src/readline.c index ce153024..cc7900be 100644 --- a/src/readline.c +++ b/src/readline.c @@ -39,6 +39,7 @@ #include "readline.h" #include "windows.h" #include "input.h" +#include "engine.h" // Virtual keyboard is mandatory on these platforms: #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) @@ -509,7 +510,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz switch(input_type) { case INPUT_TYPE_STRING : - if (input_key>=' ' && input_key<= 255) + if ((input_key>=' ' && input_key<= 255)||input_key=='\n') is_authorized=1; break; case INPUT_TYPE_INTEGER : diff --git a/src/saveini.c b/src/saveini.c index b512b7ac..b691965f 100644 --- a/src/saveini.c +++ b/src/saveini.c @@ -419,7 +419,9 @@ int Save_INI(T_Config * conf) strcpy(temp_filename,Config_directory); strcat(temp_filename,INISAVE_FILENAME); - // On renome l'ancienne version du fichier INI vers un fichier temporaire: + // Delete gfx2.$$$ + remove(temp_filename); + // Rename current config file as gfx2.$$$ if (rename(filename,temp_filename)!=0) { goto Erreur_ERREUR_SAUVEGARDE_INI; @@ -697,6 +699,13 @@ int Save_INI(T_Config * conf) if ((return_code=Save_INI_set_values (old_file,new_file,buffer,"Swap_buttons",1,values,0))) goto Erreur_Retour; + if ((return_code=Save_INI_set_strings (old_file,new_file,buffer,"Scripts_directory",conf->Scripts_directory))) + goto Erreur_Retour; + + values[0]=(conf->Allow_multi_shortcuts); + if ((return_code=Save_INI_set_values (old_file,new_file,buffer,"Allow_multi_shortcuts",1,values,1))) + goto Erreur_Retour; + // Insert new values here Save_INI_flush(old_file,new_file,buffer); diff --git a/src/sdlscreen.c b/src/sdlscreen.c index a8ef9476..ee1127e6 100644 --- a/src/sdlscreen.c +++ b/src/sdlscreen.c @@ -99,6 +99,8 @@ short Min_X=0; short Min_Y=0; short Max_X=10000; short Max_Y=10000; +short Status_line_dirty_begin=0; +short Status_line_dirty_end=0; #endif #if (UPDATE_METHOD == UPDATE_METHOD_FULL_PAGE) @@ -131,6 +133,13 @@ void Flush_update(void) Min_X=Min_Y=10000; Max_X=Max_Y=0; } + if (Status_line_dirty_end) + { + SDL_UpdateRect(Screen_SDL, (18+(Status_line_dirty_begin*8))*Menu_factor_X*Pixel_width,Menu_status_Y*Pixel_height,(Status_line_dirty_end-Status_line_dirty_begin)*8*Menu_factor_X*Pixel_width,8*Menu_factor_Y*Pixel_height); + } + Status_line_dirty_begin=25; + Status_line_dirty_end=0; + #endif } @@ -166,6 +175,28 @@ void Update_rect(short x, short y, unsigned short width, unsigned short height) } +void Update_status_line(short char_pos, short width) +{ + #if (UPDATE_METHOD == UPDATE_METHOD_MULTI_RECTANGLE) + SDL_UpdateRect(Screen_SDL, (18+char_pos*8)*Menu_factor_X*Pixel_width,Menu_status_Y*Pixel_height,width*8*Menu_factor_X*Pixel_width,8*Menu_factor_Y*Pixel_height); + #endif + + #if (UPDATE_METHOD == UPDATE_METHOD_CUMULATED) + // Merge the ranges + if (Status_line_dirty_end < char_pos+width) + Status_line_dirty_end=char_pos+width; + if (Status_line_dirty_begin > char_pos) + Status_line_dirty_begin=char_pos; + #endif + + #if (UPDATE_METHOD == UPDATE_METHOD_FULL_PAGE) + (void)char_pos; // unused parameter + (void)width; // unused parameter + update_is_required=1; + #endif + +} + /// /// Converts a SDL_Surface (indexed colors or RGB) into an array of bytes /// (indexed colors). diff --git a/src/sdlscreen.h b/src/sdlscreen.h index d0b7d004..8c58a141 100644 --- a/src/sdlscreen.h +++ b/src/sdlscreen.h @@ -44,6 +44,8 @@ byte* Screen_pixels; void Update_rect(short x, short y, unsigned short width, unsigned short height); void Flush_update(void); +void Update_status_line(short char_pos, short width); + /// /// Converts a SDL_Surface (indexed colors or RGB) into an array of bytes /// (indexed colors). diff --git a/src/struct.h b/src/struct.h index e3888068..7cba6cc9 100644 --- a/src/struct.h +++ b/src/struct.h @@ -215,7 +215,8 @@ typedef struct T_List_button T_Special_button * Entry_button; ///< Pointer to the associated selection control. T_Scroller_button * Scroller; ///< Pointer to the associated scroller - Func_draw_list_item Draw_list_item; ///< + Func_draw_list_item Draw_list_item; ///< Function to call for each item to draw its line + byte Color_index; ///< Background color: From 0->MC_Black to 3->MC_White struct T_List_button * Next; ///< Pointer to the next list button of current window. } T_List_button; @@ -356,7 +357,7 @@ typedef struct byte Screen_size_in_GIF; ///< Boolean, true to store current resolution in GIF files. byte Auto_nb_used; ///< Boolean, true to count colors in Palette screen. byte Default_resolution; ///< Default video mode to use on startup. Index in ::Video_mode. - char *Bookmark_directory[NB_BOOKMARKS];///< Bookmarked directories in fileselectors: This is the full dierctory name. + char *Bookmark_directory[NB_BOOKMARKS];///< Bookmarked directories in fileselectors: This is the full directory name. char Bookmark_label[NB_BOOKMARKS][8+1];///< Bookmarked directories in fileselectors: This is the displayed name. int Window_pos_x; ///< Last window x position (9999 if unsupportd/irrelevant for the platform) int Window_pos_y; ///< Last window y position (9999 if unsupportd/irrelevant for the platform) @@ -367,6 +368,8 @@ typedef struct byte Sync_views; ///< Boolean, true when the Main and Spare should share their viewport settings. byte Stylus_mode; ///< Boolean, true to tweak some tools (eg:Curve) for single-button stylus. word Swap_buttons; ///< Sets which key swaps mouse buttons : 0=none, or MOD_CTRL, or MOD_ALT. + char Scripts_directory[MAX_PATH_CHARACTERS];///< Full pathname of directory for Lua scripts + byte Allow_multi_shortcuts; ///< Boolean, true if the same key combination can trigger multiple shortcuts. } T_Config; // Structures utilisées pour les descriptions de pages et de liste de pages. diff --git a/src/text.c b/src/text.c index 701ba06e..9c0258c6 100644 --- a/src/text.c +++ b/src/text.c @@ -39,15 +39,17 @@ #if defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__) // No X11 -#elif defined(__macosx__) - #include - #import - #import #elif defined(__linux__) #include #endif #endif +#if defined(__macosx__) + #include + #import + #import +#endif + #include #include "SFont.h" @@ -483,12 +485,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias, if (Fore_color==Back_color) { - if (Main_palette[Back_color].R+Main_palette[Back_color].G+Main_palette[Back_color].B > 128*3) - // Back color is rather light: - new_fore=MC_Black; - else - // Back color is rather dark: - new_fore=MC_White; + new_fore=Best_color_perceptual_except(Main_palette[Back_color].R, Main_palette[Back_color].G, Main_palette[Back_color].B, Back_color); } for (index=0; index < text_surface->w * text_surface->h; index++) @@ -572,18 +569,18 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh } // Calcul des dimensions - *height=SFont_TextHeight(font); + *height=SFont_TextHeight(font, str); *width=SFont_TextWidth(font, str); // Allocation d'une surface SDL text_surface=SDL_CreateRGBSurface(SDL_SWSURFACE, *width, *height, 8, 0, 0, 0, 0); // Copy palette SDL_SetPalette(text_surface, SDL_LOGPAL, font_surface->format->palette->colors, 0, 256); - // Fill with backcolor + // Fill with transparent color rectangle.x=0; rectangle.y=0; rectangle.w=*width; rectangle.h=*height; - SDL_FillRect(text_surface, &rectangle, Back_color); + SDL_FillRect(text_surface, &rectangle, font->Transparent); // Rendu du texte SFont_Write(text_surface, font, 0, 0, str); if (!text_surface) @@ -604,6 +601,29 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh Get_SDL_Palette(font_surface->format->palette, palette); + // Swap current BG color with font's transparent color + if (font->Transparent != Back_color) + { + int c; + byte colmap[256]; + // Swap palette entries + + SWAP_BYTES(palette[font->Transparent].R, palette[Back_color].R) + SWAP_BYTES(palette[font->Transparent].G, palette[Back_color].G) + SWAP_BYTES(palette[font->Transparent].B, palette[Back_color].B) + + // Define a colormap + for (c=0; c<256; c++) + colmap[c]=c; + + // The swap + colmap[font->Transparent]=Back_color; + colmap[Back_color]=font->Transparent; + + Remap_general_lowlevel(colmap, new_brush, new_brush, text_surface->w,text_surface->h, text_surface->w); + + } + SDL_FreeSurface(text_surface); SFont_FreeFont(font); diff --git a/src/windows.c b/src/windows.c index 49c3d456..e2e5fa27 100644 --- a/src/windows.c +++ b/src/windows.c @@ -697,7 +697,7 @@ void Print_in_window(short x,short y,const char * str,byte text_color,byte backg void Print_in_menu(const char * str, short position) { Print_general((18+(position<<3))*Menu_factor_X,Menu_status_Y,str,MC_Black,MC_Light); - Update_rect((18+(position<<3))*Menu_factor_X,Menu_status_Y,strlen(str)*8*Menu_factor_X,8*Menu_factor_Y); + Update_status_line(position, strlen(str)); } /// Draws the mouse coordinates on the menu @@ -724,7 +724,6 @@ void Print_coordinates(void) Num2str(Colorpicker_color,temp,3); Print_in_menu(temp,20); Print_general(170*Menu_factor_X,Menu_status_Y," ",0,Colorpicker_color); - Update_rect(170*Menu_factor_X,Menu_status_Y,8*Menu_factor_X,8*Menu_factor_Y); } Num2str((dword)Paintbrush_X,temp,4); @@ -2721,6 +2720,48 @@ byte Best_color_perceptual(byte r,byte g,byte b) return best_color; } +byte Best_color_perceptual_except(byte r,byte g,byte b, byte except) +{ + + int col; + float best_diff=255.0*1.56905; + byte best_color=0; + float target_bri; + float bri; + float diff_b, diff_c, diff; + + // Similar to Perceptual_lightness(); + target_bri = sqrt(0.26*r*0.26*r + 0.55*g*0.55*g + 0.19*b*0.19*b); + + for (col=0; col<256; col++) + { + if (col==except || Exclude_color[col]) + continue; + + diff_c = sqrt( + (0.26*(Main_palette[col].R-r))* + (0.26*(Main_palette[col].R-r))+ + (0.55*(Main_palette[col].G-g))* + (0.55*(Main_palette[col].G-g))+ + (0.19*(Main_palette[col].B-b))* + (0.19*(Main_palette[col].B-b))); + // Exact match + if (diff_c==0) + return col; + + bri = sqrt(0.26*Main_palette[col].R*0.26*Main_palette[col].R + 0.55*Main_palette[col].G*0.55*Main_palette[col].G + 0.19*Main_palette[col].B*0.19*Main_palette[col].B); + diff_b = abs(target_bri-bri); + + diff=0.25*(diff_b-diff_c)+diff_c; + if (diff