diff --git a/.DS_Store b/.DS_Store index 4f2ce756..d5d2c847 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Grafx2.xcodeproj/xx.pbxuser b/Grafx2.xcodeproj/xx.pbxuser index f51bd7c3..3025b26d 100644 --- a/Grafx2.xcodeproj/xx.pbxuser +++ b/Grafx2.xcodeproj/xx.pbxuser @@ -42,8 +42,8 @@ PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 300, - 200, + 453, + 122.2085, ); PBXFileTableDataSourceColumnsKey = ( PBXErrorsWarningsDataSource_TypeID, @@ -125,8 +125,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 245760591; - PBXWorkspaceStateSaveDate = 245760591; + PBXPerProjectTemplateStateSaveDate = 245795027; + PBXWorkspaceStateSaveDate = 245795027; }; perUserProjectItems = { F5B19C160EA4D6E8003F4BA4 = F5B19C160EA4D6E8003F4BA4 /* PBXTextBookmark */; @@ -141,45 +141,46 @@ F5B1D1880EA5FE5100AB8D0F = F5B1D1880EA5FE5100AB8D0F /* PBXTextBookmark */; F5B1D19A0EA600BF00AB8D0F = F5B1D19A0EA600BF00AB8D0F /* PBXTextBookmark */; F5B1D19B0EA600BF00AB8D0F = F5B1D19B0EA600BF00AB8D0F /* PBXTextBookmark */; - F5B1D1AF0EA6025D00AB8D0F /* PBXTextBookmark */ = F5B1D1AF0EA6025D00AB8D0F /* PBXTextBookmark */; - F5B1D1B00EA6027D00AB8D0F /* PBXTextBookmark */ = F5B1D1B00EA6027D00AB8D0F /* PBXTextBookmark */; - F5B1D1B20EA6028C00AB8D0F /* PBXTextBookmark */ = F5B1D1B20EA6028C00AB8D0F /* PBXTextBookmark */; - F5B1D1B50EA602BA00AB8D0F /* PBXTextBookmark */ = F5B1D1B50EA602BA00AB8D0F /* PBXTextBookmark */; - F5B1D1B60EA602BA00AB8D0F /* PBXTextBookmark */ = F5B1D1B60EA602BA00AB8D0F /* PBXTextBookmark */; - F5B1D1B70EA602BA00AB8D0F /* PBXTextBookmark */ = F5B1D1B70EA602BA00AB8D0F /* PBXTextBookmark */; - F5B1D1B80EA602BA00AB8D0F /* PBXTextBookmark */ = F5B1D1B80EA602BA00AB8D0F /* PBXTextBookmark */; - F5B1D1B90EA602C300AB8D0F /* PBXTextBookmark */ = F5B1D1B90EA602C300AB8D0F /* PBXTextBookmark */; - F5B1D1BD0EA602C300AB8D0F /* PBXTextBookmark */ = F5B1D1BD0EA602C300AB8D0F /* PBXTextBookmark */; - F5B1D1BE0EA602C300AB8D0F /* PBXTextBookmark */ = F5B1D1BE0EA602C300AB8D0F /* PBXTextBookmark */; - F5B1D1CA0EA602F600AB8D0F /* PBXTextBookmark */ = F5B1D1CA0EA602F600AB8D0F /* PBXTextBookmark */; - F5B1D1CC0EA6030C00AB8D0F /* PBXTextBookmark */ = F5B1D1CC0EA6030C00AB8D0F /* PBXTextBookmark */; - F5B1D1CD0EA6030C00AB8D0F /* PBXTextBookmark */ = F5B1D1CD0EA6030C00AB8D0F /* PBXTextBookmark */; - F5B1D1CF0EA6035100AB8D0F /* PBXTextBookmark */ = F5B1D1CF0EA6035100AB8D0F /* PBXTextBookmark */; - F5B1D1D00EA6035100AB8D0F /* PBXTextBookmark */ = F5B1D1D00EA6035100AB8D0F /* PBXTextBookmark */; - F5B1D1D20EA6037500AB8D0F /* PBXTextBookmark */ = F5B1D1D20EA6037500AB8D0F /* PBXTextBookmark */; - F5B1D1D30EA6037500AB8D0F /* PBXTextBookmark */ = F5B1D1D30EA6037500AB8D0F /* PBXTextBookmark */; - F5B1D1D50EA603BB00AB8D0F /* PBXTextBookmark */ = F5B1D1D50EA603BB00AB8D0F /* PBXTextBookmark */; - F5B1D1D60EA603BB00AB8D0F /* PBXTextBookmark */ = F5B1D1D60EA603BB00AB8D0F /* PBXTextBookmark */; - F5B1D1D80EA6045800AB8D0F /* PBXTextBookmark */ = F5B1D1D80EA6045800AB8D0F /* PBXTextBookmark */; - F5B1D1D90EA6045800AB8D0F /* PBXTextBookmark */ = F5B1D1D90EA6045800AB8D0F /* PBXTextBookmark */; - F5B1D1DB0EA6047A00AB8D0F /* PBXTextBookmark */ = F5B1D1DB0EA6047A00AB8D0F /* PBXTextBookmark */; - F5B1D1DC0EA6047A00AB8D0F /* PBXTextBookmark */ = F5B1D1DC0EA6047A00AB8D0F /* PBXTextBookmark */; - F5B1D1DE0EA604D800AB8D0F /* PBXTextBookmark */ = F5B1D1DE0EA604D800AB8D0F /* PBXTextBookmark */; - F5B1D1DF0EA604D800AB8D0F /* PBXTextBookmark */ = F5B1D1DF0EA604D800AB8D0F /* PBXTextBookmark */; - F5B1D1E10EA605D200AB8D0F /* PBXTextBookmark */ = F5B1D1E10EA605D200AB8D0F /* PBXTextBookmark */; - F5B1D1E20EA605D200AB8D0F /* PBXTextBookmark */ = F5B1D1E20EA605D200AB8D0F /* PBXTextBookmark */; - F5B1D1E40EA6061B00AB8D0F /* PBXTextBookmark */ = F5B1D1E40EA6061B00AB8D0F /* PBXTextBookmark */; - F5B1D1E50EA6061B00AB8D0F /* PBXTextBookmark */ = F5B1D1E50EA6061B00AB8D0F /* PBXTextBookmark */; - F5B1D1E70EA6065F00AB8D0F /* PBXTextBookmark */ = F5B1D1E70EA6065F00AB8D0F /* PBXTextBookmark */; - F5B1D1E80EA6065F00AB8D0F /* PBXTextBookmark */ = F5B1D1E80EA6065F00AB8D0F /* PBXTextBookmark */; - F5B1D1EA0EA6070000AB8D0F /* PBXTextBookmark */ = F5B1D1EA0EA6070000AB8D0F /* PBXTextBookmark */; - F5B1D1EB0EA6070000AB8D0F /* PBXTextBookmark */ = F5B1D1EB0EA6070000AB8D0F /* PBXTextBookmark */; - F5B1D1EE0EA608C200AB8D0F /* PBXTextBookmark */ = F5B1D1EE0EA608C200AB8D0F /* PBXTextBookmark */; - F5B1D1EF0EA608C200AB8D0F /* PBXTextBookmark */ = F5B1D1EF0EA608C200AB8D0F /* PBXTextBookmark */; - F5B1D1F10EA6093700AB8D0F /* PBXTextBookmark */ = F5B1D1F10EA6093700AB8D0F /* PBXTextBookmark */; - F5B1D1F20EA6093700AB8D0F /* PBXTextBookmark */ = F5B1D1F20EA6093700AB8D0F /* PBXTextBookmark */; - F5B1D1F40EA60C3700AB8D0F /* PBXTextBookmark */ = F5B1D1F40EA60C3700AB8D0F /* PBXTextBookmark */; - F5B1D1F50EA60C3700AB8D0F /* PBXTextBookmark */ = F5B1D1F50EA60C3700AB8D0F /* PBXTextBookmark */; + F5B1D1AF0EA6025D00AB8D0F = F5B1D1AF0EA6025D00AB8D0F /* PBXTextBookmark */; + F5B1D1B00EA6027D00AB8D0F = F5B1D1B00EA6027D00AB8D0F /* PBXTextBookmark */; + F5B1D1B20EA6028C00AB8D0F = F5B1D1B20EA6028C00AB8D0F /* PBXTextBookmark */; + F5B1D1B50EA602BA00AB8D0F = F5B1D1B50EA602BA00AB8D0F /* PBXTextBookmark */; + F5B1D1B60EA602BA00AB8D0F = F5B1D1B60EA602BA00AB8D0F /* PBXTextBookmark */; + F5B1D1B70EA602BA00AB8D0F = F5B1D1B70EA602BA00AB8D0F /* PBXTextBookmark */; + F5B1D1B80EA602BA00AB8D0F = F5B1D1B80EA602BA00AB8D0F /* PBXTextBookmark */; + F5B1D1B90EA602C300AB8D0F = F5B1D1B90EA602C300AB8D0F /* PBXTextBookmark */; + F5B1D1BD0EA602C300AB8D0F = F5B1D1BD0EA602C300AB8D0F /* PBXTextBookmark */; + F5B1D1BE0EA602C300AB8D0F = F5B1D1BE0EA602C300AB8D0F /* PBXTextBookmark */; + F5B1D1CA0EA602F600AB8D0F = F5B1D1CA0EA602F600AB8D0F /* PBXTextBookmark */; + F5B1D1CC0EA6030C00AB8D0F = F5B1D1CC0EA6030C00AB8D0F /* PBXTextBookmark */; + F5B1D1CD0EA6030C00AB8D0F = F5B1D1CD0EA6030C00AB8D0F /* PBXTextBookmark */; + F5B1D1CF0EA6035100AB8D0F = F5B1D1CF0EA6035100AB8D0F /* PBXTextBookmark */; + F5B1D1D00EA6035100AB8D0F = F5B1D1D00EA6035100AB8D0F /* PBXTextBookmark */; + F5B1D1D20EA6037500AB8D0F = F5B1D1D20EA6037500AB8D0F /* PBXTextBookmark */; + F5B1D1D30EA6037500AB8D0F = F5B1D1D30EA6037500AB8D0F /* PBXTextBookmark */; + F5B1D1D50EA603BB00AB8D0F = F5B1D1D50EA603BB00AB8D0F /* PBXTextBookmark */; + F5B1D1D60EA603BB00AB8D0F = F5B1D1D60EA603BB00AB8D0F /* PBXTextBookmark */; + F5B1D1D80EA6045800AB8D0F = F5B1D1D80EA6045800AB8D0F /* PBXTextBookmark */; + F5B1D1D90EA6045800AB8D0F = F5B1D1D90EA6045800AB8D0F /* PBXTextBookmark */; + F5B1D1DB0EA6047A00AB8D0F = F5B1D1DB0EA6047A00AB8D0F /* PBXTextBookmark */; + F5B1D1DC0EA6047A00AB8D0F = F5B1D1DC0EA6047A00AB8D0F /* PBXTextBookmark */; + F5B1D1DE0EA604D800AB8D0F = F5B1D1DE0EA604D800AB8D0F /* PBXTextBookmark */; + F5B1D1DF0EA604D800AB8D0F = F5B1D1DF0EA604D800AB8D0F /* PBXTextBookmark */; + F5B1D1E10EA605D200AB8D0F = F5B1D1E10EA605D200AB8D0F /* PBXTextBookmark */; + F5B1D1E20EA605D200AB8D0F = F5B1D1E20EA605D200AB8D0F /* PBXTextBookmark */; + F5B1D1E40EA6061B00AB8D0F = F5B1D1E40EA6061B00AB8D0F /* PBXTextBookmark */; + F5B1D1E50EA6061B00AB8D0F = F5B1D1E50EA6061B00AB8D0F /* PBXTextBookmark */; + F5B1D1E70EA6065F00AB8D0F = F5B1D1E70EA6065F00AB8D0F /* PBXTextBookmark */; + F5B1D1E80EA6065F00AB8D0F = F5B1D1E80EA6065F00AB8D0F /* PBXTextBookmark */; + F5B1D1EA0EA6070000AB8D0F = F5B1D1EA0EA6070000AB8D0F /* PBXTextBookmark */; + F5B1D1EB0EA6070000AB8D0F = F5B1D1EB0EA6070000AB8D0F /* PBXTextBookmark */; + F5B1D1EE0EA608C200AB8D0F = F5B1D1EE0EA608C200AB8D0F /* PBXTextBookmark */; + F5B1D1EF0EA608C200AB8D0F = F5B1D1EF0EA608C200AB8D0F /* PBXTextBookmark */; + F5B1D1F10EA6093700AB8D0F = F5B1D1F10EA6093700AB8D0F /* PBXTextBookmark */; + F5B1D1F20EA6093700AB8D0F = F5B1D1F20EA6093700AB8D0F /* PBXTextBookmark */; + F5B1D1F40EA60C3700AB8D0F = F5B1D1F40EA60C3700AB8D0F /* PBXTextBookmark */; + F5B1D1F50EA60C3700AB8D0F = F5B1D1F50EA60C3700AB8D0F /* PBXTextBookmark */; + F5BF1F120EA68C30000E9B3D /* PBXTextBookmark */ = F5BF1F120EA68C30000E9B3D /* PBXTextBookmark */; F5DCE26A0EA50EDC0065B0EF = F5DCE26A0EA50EDC0065B0EF /* PBXTextBookmark */; F5DCE26B0EA50EDC0065B0EF = F5DCE26B0EA50EDC0065B0EF /* PBXTextBookmark */; F5DCE26C0EA50EDC0065B0EF = F5DCE26C0EA50EDC0065B0EF /* PBXTextBookmark */; @@ -187,6 +188,7 @@ }; sourceControlManager = F5B19B690EA4BD79003F4BA4 /* Source Control */; userBuildSettings = { + OBJROOT = "$(SYMROOT)"; }; }; 8D1107260486CEB800E47090 /* Grafx2 */ = { @@ -256,9 +258,9 @@ }; F5B19B7B0EA4BE3E003F4BA4 /* graph.c */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1732, 115957}}"; + sepNavIntBoundsRect = "{{0, 0}, {1732, 117705}}"; sepNavSelRange = "{204644, 0}"; - sepNavVisRect = "{{0, 0}, {583, 67}}"; + sepNavVisRect = "{{0, 9}, {583, 67}}"; }; }; F5B19B7C0EA4BE3E003F4BA4 /* init.c */ = { @@ -276,6 +278,14 @@ sepNavVisRect = "{{0, 0}, {0, 0}}"; }; }; + F5B19B850EA4BE3E003F4BA4 /* palette.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1268, 35967}}"; + sepNavSelRange = "{44692, 0}"; + sepNavVisRect = "{{0, 21479}, {867, 536}}"; + sepNavWindowFrame = "{{15, 76}, {906, 665}}"; + }; + }; F5B19B880EA4BE3E003F4BA4 /* saveini.c */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1156, 12084}}"; @@ -358,6 +368,14 @@ vrLen = 319; vrLoc = 5217; }; + F5B19C3C0EA4DC91003F4BA4 /* English */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1404, 536}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {867, 536}}"; + sepNavWindowFrame = "{{15, 76}, {906, 665}}"; + }; + }; F5B1D1770EA5FE2100AB8D0F /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = F5DCE2700EA50EDC0065B0EF /* SDL_image.h */; @@ -802,6 +820,16 @@ vrLen = 0; vrLoc = 0; }; + F5BF1F120EA68C30000E9B3D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = F5B19B7B0EA4BE3E003F4BA4 /* graph.c */; + name = "graph.c: 6162"; + rLen = 0; + rLoc = 204644; + rType = 0; + vrLen = 170; + vrLoc = 0; + }; F5DCE26A0EA50EDC0065B0EF /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = F5B19B880EA4BE3E003F4BA4 /* saveini.c */; diff --git a/Grafx2.xcodeproj/xx.perspective b/Grafx2.xcodeproj/xx.perspective index 7641b007..41b85033 100644 --- a/Grafx2.xcodeproj/xx.perspective +++ b/Grafx2.xcodeproj/xx.perspective @@ -222,6 +222,8 @@ Layout + BecomeActive + ContentConfiguration PBXBottomSmartGroupGIDs @@ -264,15 +266,16 @@ 29B97314FDCFA39411CA2CEA 1C37FBAC04509CD000000102 + F5BF1F110EA68C30000E9B3D PBXSmartGroupTreeModuleOutlineStateSelectionKey - 42 + 46 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 398}, {339, 502}} + {{0, 470}, {339, 502}} PBXTopSmartGroupGIDs @@ -321,7 +324,7 @@ _historyCapacity 0 bookmark - F5B1D1F40EA60C3700AB8D0F + F5BF1F120EA68C30000E9B3D history F5B19C160EA4D6E8003F4BA4 @@ -330,7 +333,7 @@ F5DCE26C0EA50EDC0065B0EF F5B1D1770EA5FE2100AB8D0F F5B1D1B50EA602BA00AB8D0F - F5B1D1B60EA602BA00AB8D0F + F5B1D1F40EA60C3700AB8D0F prevStack @@ -365,8 +368,6 @@ Tabs - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -438,11 +439,11 @@ TableOfContents - F5B1D1BA0EA602C300AB8D0F + F5BF1F130EA68C30000E9B3D 1CA23ED40692098700951B8B - F5B1D1BB0EA602C300AB8D0F + F5BF1F140EA68C30000E9B3D F5B19BA70EA4BF24003F4BA4 - F5B1D1BC0EA602C300AB8D0F + F5BF1F150EA68C30000E9B3D 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -490,7 +491,7 @@ PBXSmartGroupTreeModuleColumnWidthsKey - 404 + 963 PBXSmartGroupTreeModuleColumnsKey_v4 @@ -511,7 +512,7 @@ PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 18}, {963, 502}} + {{0, 0}, {0, 0}} PBXTopSmartGroupGIDs @@ -525,7 +526,7 @@ GroupTreeTableConfiguration MainColumn - 404 + 963 Module @@ -551,10 +552,6 @@ F5B19BA80EA4BF24003F4BA4 PBXProjectModuleLabel graph.c - _historyCapacity - 0 - bookmark - F5B1D1F50EA60C3700AB8D0F history F5B19C160EA4D6E8003F4BA4 @@ -593,7 +590,7 @@ Proportion - 154pt + 0pt Tabs @@ -611,7 +608,7 @@ GeometryConfiguration Frame - {{10, 27}, {0, 127}} + {{10, 27}, {0, -27}} Module PBXBuildResultsModule @@ -691,14 +688,14 @@ TableOfContents - F5B1D1BF0EA602C300AB8D0F + F5BF1F160EA68C30000E9B3D 1CA23EE50692099D00951B8B - F5B1D1C00EA602C300AB8D0F + F5BF1F170EA68C30000E9B3D F5B19BA70EA4BF24003F4BA4 - F5B1D1C10EA602C300AB8D0F + F5BF1F180EA68C30000E9B3D XCMainBuildResultsModuleGUID 1CA23EE80692099D00951B8B - F5B1D1C20EA602C300AB8D0F + F5BF1F190EA68C30000E9B3D ToolbarConfiguration xcode.toolbar.config.buildAndRun @@ -867,7 +864,6 @@ 5 WindowOrderList - F5B1D1C80EA602C300AB8D0F /Users/xx/Grafx2/Grafx2.xcodeproj WindowString diff --git a/SDLMain.h b/SDLMain.h new file mode 100644 index 00000000..4683df57 --- /dev/null +++ b/SDLMain.h @@ -0,0 +1,11 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#import + +@interface SDLMain : NSObject +@end diff --git a/SDLMain.m b/SDLMain.m new file mode 100644 index 00000000..05b39448 --- /dev/null +++ b/SDLMain.m @@ -0,0 +1,383 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#import "SDL.h" +#import "SDLMain.h" +#import /* for MAXPATHLEN */ +#import + +/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, + but the method still is there and works. To avoid warnings, we declare + it ourselves here. */ +@interface NSApplication(SDL_Missing_Methods) +- (void)setAppleMenu:(NSMenu *)menu; +@end + +/* Use this flag to determine whether we use SDLMain.nib or not */ +#define SDL_USE_NIB_FILE 0 + +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + +static int gArgc; +static char **gArgv; +static BOOL gFinderLaunch; +static BOOL gCalledAppMainline = FALSE; + +static NSString *getApplicationName(void) +{ + NSDictionary *dict; + NSString *appName = 0; + + /* Determine the application name */ + dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); + if (dict) + appName = [dict objectForKey: @"CFBundleName"]; + + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; + + return appName; +} + +#if SDL_USE_NIB_FILE +/* A helper category for NSString */ +@interface NSString (ReplaceSubString) +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; +@end +#endif + +@interface SDLApplication : NSApplication +@end + +@implementation SDLApplication +/* Invoked from the Quit menu item */ +- (void)terminate:(id)sender +{ + /* Post a SDL_QUIT event */ + SDL_Event event; + event.type = SDL_QUIT; + SDL_PushEvent(&event); +} +@end + +/* The main class of the application, the application's delegate */ +@implementation SDLMain + +/* Set the working directory to the .app's parent directory */ +- (void) setupWorkingDirectory:(BOOL)shouldChdir +{ + if (shouldChdir) + { + char parentdir[MAXPATHLEN]; + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); + if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) { + assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ + } + CFRelease(url); + CFRelease(url2); + } + +} + +#if SDL_USE_NIB_FILE + +/* Fix menu to contain the real app name instead of "SDL App" */ +- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName +{ + NSRange aRange; + NSEnumerator *enumerator; + NSMenuItem *menuItem; + + aRange = [[aMenu title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; + + enumerator = [[aMenu itemArray] objectEnumerator]; + while ((menuItem = [enumerator nextObject])) + { + aRange = [[menuItem title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; + if ([menuItem hasSubmenu]) + [self fixMenu:[menuItem submenu] withAppName:appName]; + } + [ aMenu sizeToFit ]; +} + +#else + +static void setApplicationMenu(void) +{ + /* warning: this code is very odd */ + NSMenu *appleMenu; + NSMenuItem *menuItem; + NSString *title; + NSString *appName; + + appName = getApplicationName(); + appleMenu = [[NSMenu alloc] initWithTitle:@""]; + + /* Add menu items */ + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; + + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Quit " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + + + /* Put menu into the menubar */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; + + /* Tell the application object that this is now the application menu */ + [NSApp setAppleMenu:appleMenu]; + + /* Finally give up our references to the objects */ + [appleMenu release]; + [menuItem release]; +} + +/* Create a window menu */ +static void setupWindowMenu(void) +{ + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; + + windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; + + /* "Minimize" item */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; + [windowMenu addItem:menuItem]; + [menuItem release]; + + /* Put menu into the menubar */ + windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; + [windowMenuItem setSubmenu:windowMenu]; + [[NSApp mainMenu] addItem:windowMenuItem]; + + /* Tell the application object that this is now the window menu */ + [NSApp setWindowsMenu:windowMenu]; + + /* Finally give up our references to the objects */ + [windowMenu release]; + [windowMenuItem release]; +} + +/* Replacement for NSApplicationMain */ +static void CustomApplicationMain (int argc, char **argv) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + SDLMain *sdlMain; + + /* Ensure the application object is initialised */ + [SDLApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [SDLApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ + + /* Set up the menubar */ + [NSApp setMainMenu:[[NSMenu alloc] init]]; + setApplicationMenu(); + setupWindowMenu(); + + /* Create SDLMain and make it the app delegate */ + sdlMain = [[SDLMain alloc] init]; + [NSApp setDelegate:sdlMain]; + + /* Start the main event loop */ + [NSApp run]; + + [sdlMain release]; + [pool release]; +} + +#endif + + +/* + * Catch document open requests...this lets us notice files when the app + * was launched by double-clicking a document, or when a document was + * dragged/dropped on the app's icon. You need to have a + * CFBundleDocumentsType section in your Info.plist to get this message, + * apparently. + * + * Files are added to gArgv, so to the app, they'll look like command line + * arguments. Previously, apps launched from the finder had nothing but + * an argv[0]. + * + * This message may be received multiple times to open several docs on launch. + * + * This message is ignored once the app's mainline has been called. + */ +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + const char *temparg; + size_t arglen; + char *arg; + char **newargv; + + if (!gFinderLaunch) /* MacOS is passing command line args. */ + return FALSE; + + if (gCalledAppMainline) /* app has started, ignore this document. */ + return FALSE; + + temparg = [filename UTF8String]; + arglen = SDL_strlen(temparg) + 1; + arg = (char *) SDL_malloc(arglen); + if (arg == NULL) + return FALSE; + + newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2)); + if (newargv == NULL) + { + SDL_free(arg); + return FALSE; + } + gArgv = newargv; + + SDL_strlcpy(arg, temparg, arglen); + gArgv[gArgc++] = arg; + gArgv[gArgc] = NULL; + return TRUE; +} + + +/* Called when the internal event loop has just started running */ +- (void) applicationDidFinishLaunching: (NSNotification *) note +{ + int status; + + /* Set the working directory to the .app's parent directory */ + [self setupWorkingDirectory:gFinderLaunch]; + +#if SDL_USE_NIB_FILE + /* Set the main menu to contain the real app name instead of "SDL App" */ + [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; +#endif + + /* Hand off to main application code */ + gCalledAppMainline = TRUE; + status = SDL_main (gArgc, gArgv); + + /* We're done, thank you for playing */ + exit(status); +} +@end + + +@implementation NSString (ReplaceSubString) + +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString +{ + unsigned int bufferSize; + unsigned int selfLen = [self length]; + unsigned int aStringLen = [aString length]; + unichar *buffer; + NSRange localRange; + NSString *result; + + bufferSize = selfLen + aStringLen - aRange.length; + buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar)); + + /* Get first part into buffer */ + localRange.location = 0; + localRange.length = aRange.location; + [self getCharacters:buffer range:localRange]; + + /* Get middle part into buffer */ + localRange.location = 0; + localRange.length = aStringLen; + [aString getCharacters:(buffer+aRange.location) range:localRange]; + + /* Get last part into buffer */ + localRange.location = aRange.location + aRange.length; + localRange.length = selfLen - localRange.location; + [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; + + /* Build output string */ + result = [NSString stringWithCharacters:buffer length:bufferSize]; + + NSDeallocateMemoryPages(buffer, bufferSize); + + return result; +} + +@end + + + +#ifdef main +# undef main +#endif + + +/* Main entry point to executable - should *not* be SDL_main! */ +int main (int argc, char **argv) +{ + /* Copy the arguments into a global variable */ + /* This is passed if we are launched by double-clicking */ + if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { + gArgv = (char **) SDL_malloc(sizeof (char *) * 2); + gArgv[0] = argv[0]; + gArgv[1] = NULL; + gArgc = 1; + gFinderLaunch = YES; + } else { + int i; + gArgc = argc; + gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); + for (i = 0; i <= argc; i++) + gArgv[i] = argv[i]; + gFinderLaunch = NO; + } + +#if SDL_USE_NIB_FILE + [SDLApplication poseAsClass:[NSApplication class]]; + NSApplicationMain (argc, argv); +#else + CustomApplicationMain (argc, argv); +#endif + return 0; +} diff --git a/aide.c b/aide.c index edb0ce51..9e7215d8 100644 --- a/aide.c +++ b/aide.c @@ -141,7 +141,9 @@ void Afficher_aide(void) Menu_Facteur_Y<<3, CM_Noir); } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+13*Menu_Facteur_X,Fenetre_Pos_Y+19*Menu_Facteur_Y,44*6*Menu_Facteur_X,16*8*Menu_Facteur_Y); +#endif } @@ -218,7 +220,9 @@ void Fenetre_aide(int Section, const char *Sous_section) Afficher_aide(); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,310*Menu_Facteur_X,175*Menu_Facteur_Y); +#endif Afficher_curseur(); @@ -394,7 +398,9 @@ void Bouton_Stats(void) sprintf(Buffer,"%dx%d",Largeur_ecran,Hauteur_ecran); Print_dans_fenetre(106,99,Buffer,STATS_COULEUR_DONNEES,CM_Noir); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,Menu_Facteur_X*310,Menu_Facteur_Y*174); +#endif Afficher_curseur(); diff --git a/boutons.c b/boutons.c index ea70818c..3d768260 100644 --- a/boutons.c +++ b/boutons.c @@ -55,7 +55,11 @@ #define FILENAMESPACE 13 +#ifdef __macosx__ +#define Display_Window(X,Y) +#else #define Display_Window(X,Y) SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,X*Menu_Facteur_X,Y*Menu_Facteur_Y); +#endif //-- MODELE DE BOUTON DE MENU ------------------------------------------------ /* @@ -1239,8 +1243,10 @@ void Cocher_bouton_mode(short Pos_X, short Pos_Y, byte Etat) Block(Fenetre_Pos_X+Menu_Facteur_X*Pos_X,Fenetre_Pos_Y+Menu_Facteur_Y*Pos_Y, Menu_Facteur_X*9,Menu_Facteur_Y*3,Couleur); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+Menu_Facteur_X*Pos_X,Fenetre_Pos_Y+Menu_Facteur_Y*Pos_Y, Menu_Facteur_X*9,Menu_Facteur_Y*3); +#endif } @@ -1748,8 +1754,10 @@ void Degrade_Dessiner_bouton_de_technique(short Pos_X,short Pos_Y,int Technique) } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+((Pos_X+2)*Menu_Facteur_X),Fenetre_Pos_Y+((Pos_Y+2)*Menu_Facteur_Y), Menu_Facteur_X*10,Menu_Facteur_Y*10); +#endif } void Degrade_Charger_infos_du_tableau(int Indice) @@ -1797,7 +1805,9 @@ void Degrade_Dessiner_preview(short Debut_X,short Debut_Y,short Largeur,short Ha for (Pos_Y=Debut_Y;Pos_Y1) && (!Loupe_Mode) && (Operation_en_cours!=OPERATION_LOUPE) ) // Passage en mode zoom { @@ -4908,7 +4928,9 @@ void Dessiner_trame_zoomee(short Orig_X, short Orig_Y) for (Pos_Y=0; Pos_Y>(15-i))&1)?CM_Blanc:CM_Noir); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,ToWinX(10),ToWinY(22),ToWinL(12*23+16),ToWinH(16)); +#endif } @@ -4950,7 +4974,9 @@ void Inverser_trame(void) // Rafraichit toute la zone correspondant à la trame zoomee. void Mettre_a_jour_trame(short X, short Y) { +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,X,Y,80*Menu_Facteur_X,80*Menu_Facteur_Y); +#endif } @@ -5089,7 +5115,9 @@ void Bouton_Trame_Menu(void) Dessiner_trame_zoomee(Orig_X,Orig_Y); Afficher_curseur(); // Maj de la case seule +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Orig_X+(Old_Pos_X*Pos_X), Orig_Y+(Old_Pos_Y*Pos_Y),Menu_Facteur_X*5,Menu_Facteur_Y*5); +#endif } } break; @@ -5207,11 +5235,13 @@ void Bouton_Trame_Menu(void) Fenetre_Pos_Y+(Menu_Facteur_Y*(Bouton_Octet_insere->Pos_Y+2)), Menu_Facteur_X*7, Menu_Facteur_Y*7, (Octet_insere)?CM_Blanc:CM_Noir); Afficher_curseur(); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL, Fenetre_Pos_X+(Menu_Facteur_X*(Bouton_Octet_insere->Pos_X+2)), Fenetre_Pos_Y+(Menu_Facteur_Y*(Bouton_Octet_insere->Pos_Y+2)), Menu_Facteur_X*7, Menu_Facteur_Y*7); +#endif break; @@ -5360,7 +5390,9 @@ void Afficher_sprite_effet(short Numero_sprite, short Debut_X, short Debut_Y) for (X=0,Pos_X=Debut_X;X 2.0 ß95.5% diff --git a/divers.c b/divers.c index 3127e60a..7536b414 100644 --- a/divers.c +++ b/divers.c @@ -160,7 +160,20 @@ void Get_input(void) //Clic sur un des boutons de la souris switch(event.button.button) { +#ifdef __macosx__ + // fc: poor poor mac users with a signle button mouse... + // emulated with the shifts keys + case SDL_BUTTON_LEFT: + INPUT_Nouveau_Mouse_K = 1; + if(SDL_GetModState() & KMOD_LSHIFT || + SDL_GetModState() & KMOD_RSHIFT) + { + INPUT_Nouveau_Mouse_K = 2; + } + break; +#else case SDL_BUTTON_LEFT: INPUT_Nouveau_Mouse_K = 1; break; +#endif case SDL_BUTTON_MIDDLE: // Pour SDL, 2 = clic milieu. Pour nous c'est le clic droit case SDL_BUTTON_RIGHT: // Clic droit SDL, clic droit pour nous aussi ( pour le moment en tout cas) INPUT_Nouveau_Mouse_K = 2; @@ -331,6 +344,14 @@ void Get_input(void) Calculer_coordonnees_pinceau(); Afficher_curseur(); } + +#ifdef __macosx__ + // Flush + SDL_UpdateRect(Ecran_SDL,0,0,0,0); + //updaterect() waits for vblank on macosx + //SDL_Flip(Ecran_SDL); +#endif + } @@ -412,7 +433,9 @@ void Remplacer_une_couleur(byte Ancienne_couleur, byte Nouvelle_couleur) for(edi = Principal_Ecran;edi < Principal_Ecran + Principal_Hauteur_image * Principal_Largeur_image;edi++) if (*edi == Ancienne_couleur) *edi = Nouvelle_couleur; +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,0,0,0); // On pet TOUT a jour +#endif // C'est pas un problème car il n'y a pas de preview } @@ -837,7 +860,9 @@ void Scroll_picture(short Decalage_X,short Decalage_Y) esi += Principal_Largeur_image; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,0,0,0); +#endif } word Get_key(void) diff --git a/gfx2.ini b/gfx2.ini new file mode 100644 index 00000000..8250f5a3 --- /dev/null +++ b/gfx2.ini @@ -0,0 +1,293 @@ +###### GrafX2 initialization file ###### Fichier d'initialisation de GrafX2 ## +# # # # +# You may modify this file with any # Vous pouvez modifier ce fichier avec # +# standard ASCII text editor. # n'importe quel éditeur de texte # +# # ASCII standard. # +# # # +# Comments are preceded by ';' or # Les commentaires sont précédés par # +# '#'. # ';' ou '#'. # +# # # +# Options are not case sensitive and # Les options ne sont pas sensibles à # +# spaces are ignored. # la casse et les espaces sont ignorés.# +# # # +# You must not change the order of # Vous ne devez pas changer l'ordre # +# the sections and their options. # des sections et de leurs options. # +# You must not delete or put into # Vous ne devez pas effacer ou mettre # +# comment any section nor option. # en commentaire une section ou option.# +# # # +# Each option is preceded by a # Chaque option est précédée par un # +# comment which explains its meaning. # commentaire qui explique sa fonction.# +# # # +############################################################################## + + + +[MOUSE] # [SOURIS] + + ; The sensitivity of the mouse can | La sensibilité de la souris peut + ; take values from 1 to 64. The | prendre des valeurs de 1 à 64. Plus + ; smaller values, the faster. | les valeurs sont petites, plus c'est + ; | rapide. + X_sensitivity = 1 ; (default 3) + Y_sensitivity = 1 ; (default 3) + + ; Due to the fact that those stupid | A cause du fait que ces imbéciles de + ; mouse drivers' makers don't care | programmeurs de gestionnaires de + ; if the mouse moves by steps of 2, | souris se fichent que votre souris se + ; 4 or even 8 pixels, we have to | deplace par pas de 2, 4 ou même 8 + ; stretch the virtual area of the | pixels, nous devons élargir la zone + ; mouse and divide coordinates to | virtuelle de la souris et diviser les + ; get a one-pixel step motion. | coordonnées pour obtenir un pas de 1. + ; (Warning: the mouse movement can | (Attention: le déplacement de la + ; be correct in some video modes | souris peut être correct dans certains + ; but not in others... But all the | modes vidéos mais pas dans d'autres... + ; "Modes X" should behave the same | Mais tout les Modes X devraient se + ; way, so you won't have to test | comporter de la même manière, donc + ; them all). | vous n'aurez pas à tous les tester. + ; A correction factor of 0 means | Un facteur de correction de 0 signifie + ; that you are very lucky because | que vous avez de la chace car votre + ; your driver doesn't need any | driver n'a pas besoin de correction. + ; correction. If you set the | Si vous définissez le facteur de + ; correction factor to 1, it means | correction à 1, cela signifie que + ; that your mouse moves by steps of | votre souris se déplace par pas de 2 + ; 2 pixels; 2 for 4; 3 for 8, etc...| pixels; 2 pour 4; 3 pour 8, etc... + ; If you want to use GrafX2 in a | Si vous désirez lancer GrafX2 dans une + ; Win95 window, you should turn | fenêtre Windows95, vous devriez passer + ; these values to 0 (and increase X | ces valeurs à 0 (et augmenter les sen- + ; and Y sensitivities above). | sibilités X et Y définies plus haut). + X_correction_factor = 0 ; (default 0) + Y_correction_factor = 0 ; (default 0) + + ; Aspect of the main cursor (cross) | Aspect du curseur principal (croix) + ; 1: Solid | 1: Solide + ; 2: Transparent | 2: Transparent + ; 3: Thin (solid) | 3: Fin (solide) + Cursor_aspect = 1 ; (default 1) + + + +[MENU] # [MENU] + + ; Colors of the menus (the black | Couleurs des menus (la couleur noire + ; and the white colors cannot be | et la couleur blanche ne peuvent pas + ; modified). | être modifiées). + ; Values are in {Red,Green,Blue} | Les valeurs sont dans l'ordre {Rouge, + ; order and are between 0 and 63. | Vert,Bleu} et vont de 0 à 63. + Light_color = 42,42,42 ; (default 42,42,42) + Dark_color = 27,27,27 ; (default 27,27,27) + ; + ; Light_color = 24,25,30 ; \_ Nightmare + ; Dark_color = 13,14,19 ; / + ; + ; Light_color = 10,45,28 ; \_ Forest + ; Dark_color = 5,27,12 ; / + ; + ; Light_color = 48,41,26 ; \_ Gold + ; Dark_color = 26,22,15 ; / + ; + ; Light_color = 10,40,55 ; \_ Oceanic + ; Dark_color = 10,20,32 ; / + + ; Aspect ratio and size of the | Proportion des menus et de la barre + ; menus and the tool-bar. | d'outils. + ; Possible values: | Valeurs possibles: + ; 0: Do not adapt (pixels are not | 0: Ne pas adapter (les pixels ne sont + ; stretched) | pas étirés) + ; 1: Adapt the menus and the tool- | 1: Adapter les menus et la barre + ; bar according to the resolution| d'outils suivant la résolution + ; 2: Slightly adapt the ratio of | 2: Adapter légèrement les proportions + ; the menus and tool-bar | des menus et de la barre d'outils + Menu_ratio = 1 ; (default 1) + + ; Font: | Police de caractères (fonte): + ; 1: Classic | 1: Classique + ; 2: Fun | 2: Fun + Font = 1 ; (default 1) + + + +[FILE_SELECTOR] # [SELECTEUR_DE_FICHIERS] + + ; Show special files and | Afficher les fichiers et répertoires + ; directories (values are 'yes' or | spéciaux (les valeurs sont 'yes' ou + ; 'no'). | 'no'). + Show_hidden_files = no ; (default 'no') + Show_hidden_directories = no ; (default 'no') + Show_system_directories = no ; (default 'no') + + ; Delay before displaying a preview | Délai avant d'afficher une preview + ; in file-selectors (in 18.2th of | dans les sélecteurs de fichiers (en + ; second). Possible values range | 18.2èmes de seconde) Les valeurs + ; from 1 to 256. | possibles vont de 1 à 256. + Preview_delay = 8 ; (default 8) + + ; Maximize the preview of the | Maximiser la preview des images pour + ; pictures so that it is as big as | qu'elle soit aussi grande que + ; possible. If you're not in the | possible. + ; same resolution as the picture's | Si vous n'êtes pas dans la même réso- + ; one, it can try to correct the | lution que celle de l'image, cela peut + ; aspect ratio, but if the picture | essayer de corriger les proportions, + ; does not fill the whole screen, | mais si l'image ne prend pas tout + ; it can be worse. | l'écran, cela peut être pire. + Maximize_preview = no ; (default 'no') + + ; This option is used to place the | Cette option est utilisée pour placer + ; selection bar on a filename by | la barre de sélection sur un nom de + ; typing its first letters. | fichier en tapant ses 1ères lettres. + ; For example, if you want to find | Par exemple, si vous voulez trouver le + ; the "PICTURE.PKM" in a directory | fichier "PICTURE.PKM" dans un réper- + ; that also contains "PALETTE.PAL", | toire contenant également le fichier + ; you'll just have to type P and I. | "PALETTE.PAL", vous n'aurez qu'à taper + ; The different values of "FFF" | P puis I. + ; indicate if you want to find the | Les different valeurs de "FFF" + ; name in both files and directories| indiquent si vous voulez trouvez le nom + ; or just in only one of these: | dans les fichiers ET les répertoires ou + ; 0: files and directories | simplement dans l'un OU l'autre. + ; 1: files only | 0: fichiers et répertoires + ; 2: directories only | 1: fichiers seulement + ; | 2: répertoires seulement + Find_file_fast = 0 ; (default 0) + + +[LOADING] # [CHARGEMENT] + + ; Automatically set the resolution | Passer automatiquement dans la bonne + ; when loading a picture. | résolution lors du chargement d'une + ; You should set this value to | image. + ; 'yes' after disabling the video | Vous devriez définir cette option à + ; modes that are not supported by | 'yes' après avoir inhibé les modes + ; your video card or monitor. | vidéo qui ne sont pas supportés par + ; | votre matériel. + Auto_set_resolution = no ; (default 'no') + + ; If the variable above is set to | Si la variable ci-dessus est à 'yes', + ; 'yes', this one tells if you want | celle-ci indique si vous voulez + ; to set the resolution according | définir la résolution suivant: + ; to: | 1: les dimensions de "l'écran + ; 1: the internal "original screen" | d'origine" internes à l'image + ; dimensions of the picture | 2: les véritables dimensions de + ; 2: the actual dimensions of the | l'image + ; picture | + Set_resolution_according_to = 1 ; (default 1) + + ; If you load a picture with a | Si vous chargez une image ayant une + ; palette of less than 256 colors, | palette de moins de 256 couleurs, + ; this option defines if you want | cette option indique si vous souhaitez + ; to clear the palette or to keep | effacer la palette ou bien conserver + ; the colors of the previous | les couleurs de l'image précédente qui + ; picture that are over the number | se situent au-delà du nombre de la + ; of colors of the new picture. | nouvelle image. + ; For example, if you load a | Par exemple, si vous chargez une image + ; 32-color picture, the colors 32 | de 32 couleurs, les couleurs 32 à 255 + ; to 255 will be set to black if | seront passées en noir si cette option + ; this option is set to 'yes', or | est à 'yes', ou bien elles resteront + ; they will be kept unchanged if | inchangées si elle est à 'no'. + ; this option is set to 'no'. | + Clear_palette = yes ; (default 'yes') + + +[MISCELLANEOUS] # [DIVERS] + + ; Draw the limits of the picture. | Afficher les limites de l'image + Draw_limits = yes ; (default 'yes') + + ; Adjust the brush grabbing in | Ajuster la capture de brosse en mode + ; "grid" mode. | "grille". + Adjust_brush_pick = yes ; (default 'yes') + + ; Coordinates: | Coordonnées: + ; 1: Relative | 1: Relatives + ; 2: Absolute | 2: Absolues + Coordinates = 1 ; (default 1) + + ; Create a backup file when saving. | Créer un fichier backup lors des + ; | sauvegardes. + Backup = no ; (default 'no') + + ; Number of pages stored in memory | Nombre de pages stockées en mémoire + ; for "undoing". | destinées à annuler les dernières + ; Values are between 1 and 99. | modifications. Valeurs entre 1 et 99. + Undo_pages = 1 ; (default 4) + + ; Speed of the scroll-bars (in VBLs | Vitesse des barre de défilement (en + ; waited) while clicking with the | VBLs attendus) lorsque l'un des + ; left or right button of the mouse.| boutons de la souris est enfoncé. + ; Values can be between 1 and 255. | Les valeurs sont comprises entre 1 et + ; The bigger values, the slower. | 255. Plus elles sont grandes, plus + ; | c'est lent. + Gauges_scrolling_speed_Left = 10 ; (default 10) + Gauges_scrolling_speed_Right = 3 ; (default 3) + + ; Automatically save the configu- | Enregistre automatiquement la configu- + ; ration when exiting the program. | ration lorsqu'on quitte le programme. + Auto_save = yes ; (default 'yes') + + ; Maximum number of vertices used | Nombre maximum de vertex utilisés dans + ; in filled polygons and polyforms, | les polygônes et polyformes pleins, et + ; and lasso. Possible values range | le lasso. Les valeurs possibles vont + ; from 2 to 16384. | de 2 à 16384. + ; Each vertex takes 4 bytes. | Chaque vertex prend 4 octets. + Vertices_per_polygon = 1024 ; (default 1024) + + ; Automatically zoom into the | Zoomer automatiquement la zone pointée + ; pointed area when you press the | par la souris lorsque vous appuyez sur + ; short-key of the Magnifier button | la touche de raccourci de la loupe. + ; while being above the picture. | + Fast_zoom = yes ; (default 'yes') + + ; Separate the colors in the tool- | Séparer les couleurs dans la barre + ; bar by a black squaring. | d'outils par un quadrillage noir. + Separate_colors = no ; (default 'no') + + ; Initial value of the feedback for | Valeur initiale du "feedback" pour les + ; the drawing modes (cf. docs). | modes de dessin (cf. docs). + FX_feedback = yes ; (default 'yes') + + ; When you reduce the palette or | Si vous réduisez la palette ou "zappez" + ; "zap" some colors out of it, it is| quelques couleurs, il est possible + ; possible that there are not enough| qu'il ne reste pas assez de couleurs + ; colors left to draw the menus. | pour afficher les menus. Mettre cette + ; Switching the following variable | variable à 'yes' ramènera automatiquent + ; on will bring back the colors of | les couleurs du menu s'il reste moins + ; the menu if there are less than 4 | de 4 couleurs après une "réduction" ou + ; colors left after "reducing" or | un "zapping". + ; "zapping". | + Safety_colors = yes ; (default 'yes') + + ; Display a message at startup | Afficher un message au démarrage + ; telling the version number of the | indiquant le numéro de version du + ; program. | programme. + Opening_message = yes ; (default 'yes') + + ; Take the Stencil into account when| Prendre le Stencil en compte lorsqu'on + ; clearing the image. | efface l'image. + Clear_with_stencil = yes ; (default 'yes') + + ; Directly set the discontinuous | Passer automatiquement en mode de + ; freehand drawing mode after brush | dessin discontinu après la prise d'une + ; grabbing. | brosse. + Auto_discontinuous = no ; (default 'no') + + ; Save the screen dimensions in GIF | Sauver les dimensions de l'écran dans + ; files. If you want to read these | les fichiers GIF. Si vous voulez lire + ; files with Photoshop or Alchemy, | ces fichiers avec Photoshop ou Alchemy, + ; and maybe some other programs, you| et peut-être d'autres programmes, vous + ; must set this option to 'no'. | devez mettre cette option à 'no'. + Save_screen_size_in_GIF = no ; (default 'no') + + ; Automaticaly count the number of | Compter automatiquement le nombre de + ; different colors used when opening| couleurs différentes utilisées lors de + ; the palette editor window. (Set it| d'ouverture de la fenêtre d'édition de + ; to 'no' if you have a slow PC or | la palette. (Mettez-le à 'no' si vous + ; if you edit huge pictures) | avez un PC lent ou bien si vous éditez + ; | d'énormes images). + Auto_nb_colors_used = yes ; (default 'yes') + + ; Default video mode at startup | Numéro du mode vidéo par défaut au + ; (see the list by running the | démarrage (voir la liste en lançant + ; program with argument "/?". | le programme avec l'option "/?". + Default_video_mode = window ; (default 'window') + + ; Window dimensions. The program | Dimensions de la fenêtre en mode + ; remembers the last window size. | fenêtré. + Default_window_size = 640,480 ; (default '640,480') diff --git a/graph.c b/graph.c index a394c2b7..256b101d 100644 --- a/graph.c +++ b/graph.c @@ -82,7 +82,9 @@ void Mettre_Ecran_A_Jour(short X, short Y, short Largeur, short Hauteur) if(Y_effectif + Hauteur <= Menu_Ordonnee) H_effectif = Hauteur; else H_effectif = Menu_Ordonnee - Y_effectif; +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,X_effectif,Y_effectif,L_effectif,H_effectif); +#endif // Et ensuite dans la partie zoomée if(Loupe_Mode) @@ -108,7 +110,9 @@ void Mettre_Ecran_A_Jour(short X, short Y, short Largeur, short Hauteur) r.h=r.w=3; SDL_FillRect(Ecran_SDL,&r,3); */ +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,X_effectif,Y_effectif,L_effectif,H_effectif); +#endif } } @@ -325,7 +329,9 @@ void Afficher_palette_du_menu_en_evitant_la_fenetre(byte * Table) } } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,(LARGEUR_MENU+1)*Menu_Facteur_X,Menu_Ordonnee*Menu_Facteur_Y,Largeur,Hauteur); +#endif // SDL_UpdateRect(Ecran_SDL,LARGEUR_MENU*Menu_Facteur_X,Menu_Ordonnee,Largeur_ecran-(LARGEUR_MENU*Menu_Facteur_X),(HAUTEUR_MENU-9)*Menu_Facteur_Y); } @@ -907,8 +913,9 @@ void Afficher_limites_de_l_image(void) for (Pos=Debut;Pos<=Fin;Pos++) Pixel_Preview(Principal_Largeur_image,Pos,((Pos+Principal_Hauteur_image)&1)?CM_Blanc:CM_Noir); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Principal_Largeur_image,Debut,1,Fin-Debut + 1); - +#endif // On restaure la bonne valeur des limites Limite_Droite_Zoom=Ancienne_Limite_Zoom; } @@ -927,7 +934,9 @@ void Afficher_limites_de_l_image(void) for (Pos=Debut;Pos<=Fin;Pos++) Pixel_Preview(Pos,Principal_Hauteur_image,((Pos+Principal_Hauteur_image)&1)?CM_Blanc:CM_Noir); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Debut,Principal_Hauteur_image,Fin-Debut + 1,1); +#endif // On restaure la bonne valeur des limites Limite_Bas_Zoom=Ancienne_Limite_Zoom; @@ -1216,7 +1225,9 @@ void Afficher_foreback(void) Block((LARGEUR_MENU-17)*Menu_Facteur_X,Menu_Ordonnee+Menu_Facteur_Y,Menu_Facteur_X<<4,Menu_Facteur_Y*7,Back_color); Block((LARGEUR_MENU-13)*Menu_Facteur_X,Menu_Ordonnee+(Menu_Facteur_Y<<1),Menu_Facteur_X<<3,Menu_Facteur_Y*5,Fore_color); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,(LARGEUR_MENU-17)*Menu_Facteur_X,Menu_Ordonnee+Menu_Facteur_Y,Menu_Facteur_X<<4,Menu_Facteur_Y*7); +#endif } } @@ -1250,7 +1261,9 @@ void Encadrer_couleur_menu(byte Couleur) Block(Debut_X,Debut_Y,Menu_Taille_couleur*Menu_Facteur_X, Menu_Facteur_Y<<2,Fore_color); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Debut_X,Debut_Y,Menu_Taille_couleur*Menu_Facteur_X,Menu_Facteur_Y*4); // TODO On met à jour toute la palette... peut mieux faire +#endif } else { @@ -1280,7 +1293,9 @@ void Encadrer_couleur_menu(byte Couleur) Menu_Facteur_X,Menu_Facteur_Y, ((Indice+Fin_Y)&1)?CM_Blanc:CM_Noir); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Debut_X*Menu_Facteur_X,Debut_Y*Menu_Facteur_X,Menu_Taille_couleur*Menu_Facteur_X,Menu_Ordonnee+Menu_Facteur_Y*4); +#endif } } } @@ -1312,7 +1327,9 @@ void Afficher_palette_du_menu(void) Couleur_debut_palette+Couleur); Encadrer_couleur_menu(CM_Blanc); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,LARGEUR_MENU*Menu_Facteur_X,Menu_Ordonnee,Largeur_ecran-(LARGEUR_MENU*Menu_Facteur_X),(HAUTEUR_MENU-9)*Menu_Facteur_Y); +#endif } } @@ -1377,7 +1394,9 @@ void Afficher_barre_de_split(void) Block(Principal_X_Zoom-(Menu_Facteur_X<<1),0, Menu_Facteur_X,Menu_Facteur_Y,CM_Clair); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Principal_Split,0,LARGEUR_BARRE_SPLIT*Menu_Facteur_X,Menu_Ordonnee); // On réaffiche toute la partie à gauche du split, ce qui permet d'effacer son ancienne position +#endif } // -- Afficher tout le menu -- @@ -1423,7 +1442,9 @@ void Afficher_menu(void) } Print_nom_fichier(); } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,Menu_Ordonnee,Largeur_ecran,HAUTEUR_MENU*Menu_Facteur_Y); // on met toute la largur à jour, ça inclut la palette et la zone d'étant avec le nom du fichier +#endif } } @@ -1477,7 +1498,9 @@ void Print_general(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur for (Repeat_Menu_Facteur_Y=0;Repeat_Menu_Facteur_Y= Largeur_ecran) break; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y); +#endif } } break; @@ -2526,7 +2561,9 @@ void Afficher_curseur(void) Pixel(Pos_X,Pos_Y,Couleur); } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Debut_X,Debut_Y,16,16); +#endif } } break; @@ -2551,7 +2588,9 @@ void Afficher_curseur(void) Pixel(Pos_X,Pos_Y,Couleur); } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Max(Debut_X,0),Max(Debut_Y,0),16,16); +#endif break; case FORME_CURSEUR_CIBLE_XOR : Pos_X=Pinceau_X-Principal_Decalage_X; @@ -2561,13 +2600,17 @@ void Afficher_curseur(void) if ((Pos_Y=Limite_Haut)) { Ligne_horizontale_XOR(0,Pinceau_Y-Principal_Decalage_Y,Compteur_X); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,Pinceau_Y-Principal_Decalage_Y,Compteur_X,1); +#endif } if ((Pos_X=Limite_Gauche)) { Ligne_verticale_XOR(Pinceau_X-Principal_Decalage_X,0,Menu_Ordonnee); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pinceau_X-Principal_Decalage_X,0,1,Menu_Ordonnee); +#endif } if (Loupe_Mode) @@ -2618,7 +2661,9 @@ void Afficher_curseur(void) Ligne_verticale_XOR( Fin_X,Debut_Y+1,Loupe_Hauteur-2); Ligne_horizontale_XOR(Debut_X, Fin_Y,Loupe_Largeur); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Debut_X,Debut_Y,Fin_X+1-Debut_X,Fin_Y+1-Debut_Y); +#endif break; default: //case FORME_CURSEUR_ROTATE_XOR : @@ -2735,7 +2780,9 @@ void Effacer_curseur(void) if (Fin_Y<4) Ligne_verticale_XOR (Mouse_X,Mouse_Y+3,4-Fin_Y); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Mouse_X+Debut_X-6,Mouse_Y+Debut_Y-6,12-Fin_X,12-Fin_Y); +#endif } else { @@ -2754,7 +2801,9 @@ void Effacer_curseur(void) } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Max(Debut_X,0),Max(Debut_Y,0),Pos_X-Debut_X,Pos_Y-Debut_Y); +#endif } } if (!Cacher_pinceau) @@ -2802,7 +2851,9 @@ void Effacer_curseur(void) if (Mouse_Y=0) && (Pos_X=0) && (Pos_Y=0) && (Pos_Y>=0) ) Pixel(Pos_X,Pos_Y,FOND_CURSEUR[Compteur_Y][Compteur_X]); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Max(Debut_X,0),Max(Debut_Y,0),16,16); +#endif break; case FORME_CURSEUR_CIBLE_XOR : @@ -2846,13 +2901,17 @@ void Effacer_curseur(void) if ((Pos_Y=Limite_Haut)) { Ligne_horizontale_XOR(0,Pinceau_Y-Principal_Decalage_Y,Compteur_X); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,Pinceau_Y-Principal_Decalage_Y,Compteur_X,1); +#endif } if ((Pos_X=Limite_Gauche)) { Ligne_verticale_XOR(Pinceau_X-Principal_Decalage_X,0,Menu_Ordonnee); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pinceau_X-Principal_Decalage_X,0,1,Menu_Ordonnee); +#endif } if (Loupe_Mode) @@ -2906,7 +2965,9 @@ void Effacer_curseur(void) Ligne_verticale_XOR( Fin_X,Debut_Y+1,Loupe_Hauteur-2); Ligne_horizontale_XOR(Debut_X, Fin_Y,Loupe_Largeur); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Debut_X,Debut_Y,Fin_X+1-Debut_X,Fin_Y+1-Debut_Y); +#endif break; default: //case FORME_CURSEUR_ROTATE_XOR : @@ -2992,7 +3053,9 @@ byte Demande_de_confirmation(char * Message) Fenetre_Definir_bouton_normal((Largeur_de_la_fenetre/3)-20 ,37,40,14,"Yes",1,1,SDLK_y); // 1 Fenetre_Definir_bouton_normal(((Largeur_de_la_fenetre<<1)/3)-20,37,40,14,"No" ,1,1,SDLK_n); // 2 +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,Menu_Facteur_X*Largeur_de_la_fenetre,Menu_Facteur_Y*60); +#endif Afficher_curseur(); @@ -3026,7 +3089,9 @@ void Warning_message(char * Message) Print_dans_fenetre((Largeur_de_la_fenetre>>1)-(strlen(Message)<<2),20,Message,CM_Noir,CM_Clair); Fenetre_Definir_bouton_normal((Largeur_de_la_fenetre>>1)-20 ,37,40,14,"OK",1,1,SDLK_RETURN); // 1 +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,Menu_Facteur_X*Largeur_de_la_fenetre,Menu_Facteur_Y*60); +#endif Afficher_curseur(); do @@ -3115,7 +3180,9 @@ void Afficher_ecran(void) // ---/\/\/\ Affichage des limites /\/\/\--- if (Config.Afficher_limites_image) Afficher_limites_de_l_image(); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,0,Largeur_ecran,Menu_Ordonnee); // TODO On peut faire plus fin, en évitant de mettre à jour la partie à droite du split quand on est en mode loupe. Mais c'est pas vraiment intéressant ? +#endif } // -- Redessiner le sprite d'un bouton dans le menu -- @@ -3135,9 +3202,11 @@ void Afficher_sprite_dans_menu(int Numero_bouton,int Numero_sprite) Pixel_dans_menu(Pos_menu_X,Pos_menu_Y,Couleur); BLOCK_MENU[Pos_menu_Y][Pos_menu_X]=Couleur; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Menu_Facteur_X*(Bouton[Numero_bouton].Decalage_X+1), (Bouton[Numero_bouton].Decalage_Y+1)*Menu_Facteur_Y+Menu_Ordonnee, LARGEUR_SPRITE_MENU*Menu_Facteur_X,HAUTEUR_SPRITE_MENU*Menu_Facteur_Y); +#endif } // -- Redessiner la forme du pinceau dans le menu -- @@ -3197,7 +3266,9 @@ void Afficher_pinceau_dans_menu(void) BLOCK_MENU[Pos_menu_Y][Pos_menu_X]=Couleur; } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,Menu_Ordonnee,LARGEUR_SPRITE_MENU*Menu_Facteur_X+3,HAUTEUR_SPRITE_MENU*Menu_Facteur_Y+3); +#endif } // -- Dessiner un pinceau prédéfini dans la fenêtre -- @@ -3217,10 +3288,12 @@ void Afficher_pinceau_dans_fenetre(word X,word Y,int Numero) for (Pos_fenetre_X=Orig_X,Pos_X=0; Pos_X +#import +#endif byte Ancien_nb_lignes; // Ancien nombre de lignes de l'écran @@ -262,7 +266,15 @@ void Initialisation_du_programme(int argc,char * argv[]) Initialiser_la_table_precalculee_des_distances_de_couleur(); // On détermine dès le départ où se trouve le fichier: + // On détermine dès le départ où se trouve le fichier: +#ifdef __macosx__ + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFURLGetFileSystemRepresentation(url, true, (UInt8 *) Repertoire_du_programme, MAXPATHLEN); + CFRelease(url); + strcat(Repertoire_du_programme, "/Contents/Resources/"); +#else Chercher_repertoire_du_programme(argv[0]); +#endif // On détecte les lecteurs qui sont accessibles: Rechercher_drives(); @@ -335,7 +347,7 @@ void Initialisation_du_programme(int argc,char * argv[]) SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO); SDL_EnableKeyRepeat(250, 32); SDL_EnableUNICODE(SDL_ENABLE); - SDL_WM_SetCaption("GrafX2 beta 97.0% - USE AT YOUR OWN RISK","grafx2.gif"); + SDL_WM_SetCaption("GrafX2 beta "POURCENTAGE_VERSION" - USE AT YOUR OWN RISK","grafx2.gif"); // On initialise tous les modes vidéo Definition_des_modes_video(); diff --git a/moteur.c b/moteur.c index 5930a490..28cd70c1 100644 --- a/moteur.c +++ b/moteur.c @@ -303,11 +303,13 @@ void Tracer_cadre_de_bouton_du_menu(byte Numero,byte Enfonce) BLOCK_MENU[Fin_Y-Pos_X][Fin_X]=Couleur_Bas_droite; } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL, Debut_X*Menu_Facteur_X, Debut_Y*Menu_Facteur_Y + Menu_Ordonnee, (Fin_X+1-Debut_X)*Menu_Facteur_X, (Fin_Y+1-Debut_Y)*Menu_Facteur_Y); +#endif } @@ -427,7 +429,9 @@ void Deplacer_Split(void) Ligne_verticale_XOR(Ancien_Split,0,Menu_Ordonnee); Ligne_verticale_XOR(Ancien_X_Zoom-1,0,Menu_Ordonnee); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Ancien_Split,0,abs(Ancien_Split-Ancien_X_Zoom)+1,Menu_Ordonnee); +#endif Ancien_Split=Principal_Split; Ancien_X_Zoom=Principal_X_Zoom; @@ -436,7 +440,9 @@ void Deplacer_Split(void) Ligne_verticale_XOR(Principal_Split,0,Menu_Ordonnee); Ligne_verticale_XOR(Principal_X_Zoom-1,0,Menu_Ordonnee); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Principal_Split,0,abs(Principal_Split-Principal_X_Zoom)+1,Menu_Ordonnee); +#endif Afficher_curseur(); } @@ -1104,7 +1110,9 @@ void Fermer_fenetre(void) // Restore de ce que la fenêtre cachait Restaure_fond(Fond_fenetre[Fenetre-1], Fenetre_Pos_X, Fenetre_Pos_Y, Fenetre_Largeur, Fenetre_Hauteur); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,Fenetre_Largeur*Menu_Facteur_X,Fenetre_Hauteur*Menu_Facteur_Y); +#endif //Afficher_ecran(); //Afficher_menu(); @@ -1153,14 +1161,18 @@ void Fenetre_Dessiner_bouton_normal(word Pos_X,word Pos_Y,word Largeur,word Haut void Fenetre_Enfoncer_bouton_normal(word Pos_X,word Pos_Y,word Largeur,word Hauteur) { Fenetre_Afficher_cadre_general(Pos_X,Pos_Y,Largeur,Hauteur,CM_Fonce,CM_Noir,CM_Fonce,CM_Fonce,CM_Noir); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pos_X, Pos_Y, Largeur, Hauteur); +#endif } // -- Bouton normal désenfoncé dans la fenêtre -- void Fenetre_Desenfoncer_bouton_normal(word Pos_X,word Pos_Y,word Largeur,word Hauteur) { Fenetre_Afficher_cadre_bombe(Pos_X,Pos_Y,Largeur,Hauteur); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+Pos_X*Menu_Facteur_X, Fenetre_Pos_Y+Pos_Y*Menu_Facteur_X, Largeur*Menu_Facteur_X, Hauteur*Menu_Facteur_Y); +#endif } @@ -1190,7 +1202,9 @@ void Fenetre_Effacer_tags(void) Origine_Y=Fenetre_Pos_Y+(Fenetre_Liste_boutons_palette->Pos_Y+3)*Menu_Facteur_Y; for (Pos_X=0,Pos_fenetre_X=Origine_X;Pos_X<16;Pos_X++,Pos_fenetre_X+=(Menu_Facteur_X*10)) Block(Pos_fenetre_X,Origine_Y,Menu_Facteur_X*3,Menu_Facteur_Y*80,CM_Clair); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Origine_X,Origine_Y,ToWinL(160),ToWinH(80)); +#endif } @@ -1254,7 +1268,9 @@ void Tagger_intervalle_palette(byte Debut,byte Fin) } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,ToWinX(Fenetre_Liste_boutons_palette->Pos_X+3),ToWinY(Fenetre_Liste_boutons_palette->Pos_Y+3),ToWinL(12*16),ToWinH(5*16)); +#endif } @@ -1292,9 +1308,11 @@ void Fenetre_Dessiner_jauge(struct Fenetre_Bouton_scroller * Enreg) Fenetre_Pos_Y+(Position_curseur_jauge*Menu_Facteur_Y), 11*Menu_Facteur_X,Enreg->Hauteur_curseur*Menu_Facteur_Y,CM_Clair/*CM_Blanc*/); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+(Enreg->Pos_X*Menu_Facteur_X), Fenetre_Pos_Y+Enreg->Pos_Y*Menu_Facteur_Y, 11*Menu_Facteur_X,(Enreg->Hauteur)*Menu_Facteur_Y); +#endif } void Fenetre_Dessiner_bouton_scroller(struct Fenetre_Bouton_scroller * Enreg) @@ -1673,8 +1691,10 @@ void Deplacer_fenetre(short Dx, short Dy) Ligne_horizontale_XOR(Nouveau_X,Nouveau_Y+Hauteur-1,Largeur); Afficher_curseur(); } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Ancien_X,Ancien_Y,Largeur,Hauteur); SDL_UpdateRect(Ecran_SDL,Nouveau_X,Nouveau_Y,Largeur,Hauteur); +#endif } Effacer_curseur(); @@ -1708,12 +1728,13 @@ void Deplacer_fenetre(short Dx, short Dy) Restaure_fond(Buffer, Nouveau_X, Nouveau_Y, Fenetre_Largeur, Fenetre_Hauteur); // Mise à jour du rectangle englobant +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL, (Nouveau_X>Fenetre_Pos_X)?Fenetre_Pos_X:Nouveau_X, (Nouveau_Y>Fenetre_Pos_Y)?Fenetre_Pos_Y:Nouveau_Y, ((Nouveau_X>Fenetre_Pos_X)?(Nouveau_X-Fenetre_Pos_X):(Fenetre_Pos_X-Nouveau_X)) + Fenetre_Largeur*Menu_Facteur_X, ((Nouveau_Y>Fenetre_Pos_Y)?(Nouveau_Y-Fenetre_Pos_Y):(Fenetre_Pos_Y-Nouveau_Y)) + Fenetre_Hauteur*Menu_Facteur_Y); - +#endif Fenetre_Pos_X=Nouveau_X; Fenetre_Pos_Y=Nouveau_Y; diff --git a/palette.c b/palette.c index 9c4e1592..0c63895f 100644 --- a/palette.c +++ b/palette.c @@ -800,7 +800,9 @@ void Bouton_Palette(void) Dessiner_zigouigoui(263,165,CM_Fonce,-1); Dessiner_zigouigoui(280,165,CM_Fonce,+1); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,299*Menu_Facteur_X,188*Menu_Facteur_Y); +#endif Afficher_curseur(); @@ -865,7 +867,9 @@ void Bouton_Palette(void) // Affichage dans le block de visu de la couleur en cours Block(Fenetre_Pos_X+(Menu_Facteur_X*264),Fenetre_Pos_Y+(Menu_Facteur_Y*93),Menu_Facteur_X<<4,Menu_Facteur_Y*64,Fore_color); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+(Menu_Facteur_X*264),Fenetre_Pos_Y+(Menu_Facteur_Y*93),Menu_Facteur_X<<4,Menu_Facteur_Y*64); +#endif memcpy(Palette_backup ,Palette_de_travail,sizeof(T_Palette)); memcpy(Palette_temporaire,Palette_de_travail,sizeof(T_Palette)); @@ -1136,8 +1140,10 @@ void Bouton_Palette(void) Palette_Reafficher_jauges(Jauge_rouge,Jauge_verte,Jauge_bleue,Palette_de_travail,Debut_block,Fin_block); // En cas de X-Swap, tout l'ecran a pu changer de couleur. +#ifndef __macosx__ if (Bouton_clicke==8) SDL_UpdateRect(Ecran_SDL,0, 0, Largeur_ecran, Menu_Ordonnee_avant_fenetre); +#endif } break; @@ -1784,7 +1790,9 @@ void Bouton_Palette(void) Block(Fenetre_Pos_X+(Menu_Facteur_X*260),Fenetre_Pos_Y+(Menu_Facteur_Y*89),Menu_Facteur_X*24,Menu_Facteur_Y*72,Back_color); Bloc_degrade_dans_fenetre(264,93,Debut_block,Fin_block); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+8*Menu_Facteur_X,Fenetre_Pos_Y+82*Menu_Facteur_Y,Menu_Facteur_X*16*10,Menu_Facteur_Y*5*16); +#endif Afficher_curseur(); Il_faut_remapper=0; @@ -1850,7 +1858,9 @@ void Bouton_Palette_secondaire(void) Fenetre_Definir_bouton_normal(10,37,180,14,"User's color series" ,14,0,SDLK_s); // 2 Fenetre_Definir_bouton_normal(60,60, 80,14,"Cancel" , 0,1,SDLK_ESCAPE); // 3 +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,Menu_Facteur_X*200,Menu_Facteur_Y*80); +#endif Afficher_curseur(); diff --git a/readline.c b/readline.c index 25928ad2..384b360e 100644 --- a/readline.c +++ b/readline.c @@ -128,8 +128,10 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type // Effacement de la chaîne Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y), Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3),COULEUR_FOND); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y), Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3)); +#endif // Mise à jour des variables se rapportant à la chaîne en fonction de la chaîne initiale strcpy(Chaine_initiale,Chaine); @@ -152,9 +154,10 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type Chaine_affichee[Taille_affichee-1]=CARACTERE_TRIANGLE_DROIT; Rafficher_toute_la_chaine(Pos_X,Pos_Y,Chaine_affichee,Position - Offset); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y), Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3)); - +#endif while ((Touche_lue!=SDLK_RETURN) && (Touche_lue!=SDLK_ESCAPE)) { @@ -292,9 +295,10 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type Chaine_affichee[Taille_affichee-1]=CARACTERE_TRIANGLE_DROIT; Rafficher_toute_la_chaine(Pos_X,Pos_Y,Chaine_affichee,Position - Offset); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y), Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3)); - +#endif } // Fin du "switch(Touche_lue)" } // Fin du "while" @@ -315,8 +319,10 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type { Print_dans_fenetre_limite(Pos_X,Pos_Y,Chaine,Taille_affichee,COULEUR_TEXTE,COULEUR_FOND); } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y), Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3)); +#endif return (Touche_lue==SDLK_RETURN); } diff --git a/sdlscreen.c b/sdlscreen.c index 8d4ed55c..694e0b0c 100644 --- a/sdlscreen.c +++ b/sdlscreen.c @@ -60,7 +60,9 @@ void Afficher_partie_de_l_ecran_SDL (word Largeur,word Hauteur,word Largeu Src+=Largeur_image; Dest+=Largeur_ecran; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,0,0,Largeur,Hauteur); +#endif } void Block_SDL (word Debut_X,word Debut_Y,word Largeur,word Hauteur,byte Couleur) @@ -164,7 +166,9 @@ void Display_brush_Color_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decala EDI = EDI + Largeur_ecran - Largeur; ESI = ESI + Largeur_brosse - Largeur; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pos_X,Pos_Y,Largeur,Hauteur); +#endif } void Display_brush_Mono_SDL (word Pos_X, word Pos_Y, @@ -196,7 +200,9 @@ void Display_brush_Mono_SDL (word Pos_X, word Pos_Y, Src+=Largeur_brosse-Largeur; Dest+=Largeur_ecran-Largeur; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pos_X,Pos_Y,Largeur,Hauteur); +#endif } void Clear_brush_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_image) @@ -215,7 +221,9 @@ void Clear_brush_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Src+=Largeur_image; Dest+=Largeur_ecran; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pos_X,Pos_Y,Largeur,Hauteur); +#endif } void Remap_screen_SDL (word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte * Table_de_conversion) @@ -237,7 +245,9 @@ void Remap_screen_SDL (word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte * Ta EDI = EDI + Largeur_ecran - Largeur; } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pos_X,Pos_Y,Largeur,Hauteur); +#endif } void Afficher_une_ligne_ecran_SDL (word Pos_X,word Pos_Y,word Largeur,byte * Ligne) @@ -299,8 +309,10 @@ void Afficher_partie_de_l_ecran_zoomee_SDL( EDX++; if(EDX==Hauteur) { +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Principal_X_Zoom,0, Largeur*Loupe_Facteur,Hauteur); +#endif return; } CX--; @@ -397,8 +409,10 @@ void Display_brush_Mono_zoom_SDL (word Pos_X, word Pos_Y, // On vérifie qu'on est pas à la ligne finale if(DX == Pos_Y_Fin) { +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL, Pos_X, Pos_Y, Largeur * Loupe_Facteur, Pos_Y_Fin - Pos_Y ); +#endif return; } BX --; @@ -432,8 +446,10 @@ void Clear_brush_zoom_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Dec DX++; if(DX==Pos_Y_Fin) { +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Pos_X,Pos_Y, Largeur*Loupe_Facteur,Pos_Y_Fin-Pos_Y); +#endif return; } bx--; diff --git a/shade.c b/shade.c index 8dc2d62c..86ec14cf 100644 --- a/shade.c +++ b/shade.c @@ -131,7 +131,9 @@ void Shade_Blocs_degrades(void) Block(Fenetre_Pos_X+(Menu_Facteur_X*225),Fenetre_Pos_Y+(Menu_Facteur_Y*36), Menu_Facteur_X*62,Menu_Facteur_Y*46,CM_Clair); } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+(Menu_Facteur_X*224),Fenetre_Pos_Y+(Menu_Facteur_Y*35),Menu_Facteur_X*64,Menu_Facteur_Y*48); +#endif } @@ -175,7 +177,9 @@ void Tagger_shades(word Select_Debut,word Select_Fin) Block(Pos_X,Pos_Y,Menu_Facteur_X<<2,Menu_Facteur_Y<<1,CM_Clair); } } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+8*Menu_Facteur_X,Fenetre_Pos_Y+131*Menu_Facteur_Y,Menu_Facteur_X*64<<2,Menu_Facteur_Y*8<<3); +#endif } @@ -249,7 +253,9 @@ void Afficher_tout_le_shade(word Select_Debut1,word Select_Fin1, Menu_Facteur_X<<2,Menu_Facteur_Y<<2, Shade_Liste[Shade_Actuel].Liste[Position]&0xFF); } +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X+7*Menu_Facteur_X,Fenetre_Pos_Y+126*Menu_Facteur_Y,Menu_Facteur_X*((64<<2)+2),Menu_Facteur_Y*((8<<2)+2)); +#endif Tagger_shades(Select_Debut2,Select_Fin2); Shade_Blocs_degrades(); Afficher_couleur_case_selectionnee(Select_Debut2,Select_Fin2); @@ -522,7 +528,9 @@ int Menu_Shade(void) memcpy(Buffer ,Shade_Liste[Shade_Actuel].Liste,512*sizeof(word)); memcpy(Buffer_Undo,Shade_Liste[Shade_Actuel].Liste,512*sizeof(word)); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,Menu_Facteur_X*310,Menu_Facteur_Y*190); +#endif Afficher_curseur(); @@ -1051,7 +1059,9 @@ void Bouton_Quick_shade_Menu(void) Num2str(Quick_shade_Step,Chaine,3); Fenetre_Contenu_bouton_saisie(Fenetre_Liste_boutons_special,Chaine); +#ifndef __macosx__ SDL_UpdateRect(Ecran_SDL,Fenetre_Pos_X,Fenetre_Pos_Y,Menu_Facteur_X*142,Menu_Facteur_Y*56); +#endif Afficher_curseur();