Update the 'release' branch
git-svn-id: svn://pulkomandy.tk/GrafX2/branches/release@1027 416bcca6-2ee7-4201-b75f-2eb2f807beb1
@ -12,6 +12,12 @@
|
||||
002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A2C09D0888800EBEB88 /* SDLMain.m */; };
|
||||
002F3A3F09D088BA00EBEB88 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A3E09D088BA00EBEB88 /* main.c */; };
|
||||
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 */; };
|
||||
@ -52,8 +58,6 @@
|
||||
F5B19BA30EA4BE3E003F4BA4 /* shade.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B8B0EA4BE3E003F4BA4 /* shade.c */; };
|
||||
F5B19BA40EA4BE3E003F4BA4 /* special.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B8C0EA4BE3E003F4BA4 /* special.c */; };
|
||||
F5B19BE10EA4C65A003F4BA4 /* gfx2.cfg in Resources */ = {isa = PBXBuildFile; fileRef = F5B19BDF0EA4C65A003F4BA4 /* gfx2.cfg */; };
|
||||
F5B19BE10EA4C65A003F4BA5 /* base.gif in Copy skins */ = {isa = PBXBuildFile; fileRef = F5B19BDF0EA4C65A003F4BA5 /* base.gif */; };
|
||||
F5B19BE10EA4C65A003F4BA6 /* ilkke.png in Copy skins */ = {isa = PBXBuildFile; fileRef = F5B19BDF0EA4C65A003F4BA6 /* ilkke.png */; };
|
||||
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 */; };
|
||||
@ -104,6 +108,22 @@
|
||||
name = "Copy Frameworks into .app bundle";
|
||||
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;
|
||||
@ -119,18 +139,6 @@
|
||||
name = "Copy fonts";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F5A33F1D0EC8A26C00F8052E /* Copy skins */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = skins;
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
F5B19BE10EA4C65A003F4BA5 /* base.gif in Copy skins */,
|
||||
F5B19BE10EA4C65A003F4BA6 /* ilkke.png in Copy skins */,
|
||||
);
|
||||
name = "Copy skins";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -145,6 +153,12 @@
|
||||
32CA4F630368D1EE00C91783 /* Grafx2_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Grafx2_Prefix.pch; sourceTree = "<group>"; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
F514264E101F6CB8006CF3C4 /* font_Fairlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_Fairlight.png; path = skins/font_Fairlight.png; sourceTree = "<group>"; };
|
||||
F514264F101F6CB9006CF3C4 /* font_Fun.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_Fun.png; path = skins/font_Fun.png; sourceTree = "<group>"; };
|
||||
F5142650101F6CB9006CF3C4 /* font_Melon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_Melon.png; path = skins/font_Melon.png; sourceTree = "<group>"; };
|
||||
F5142651101F6CB9006CF3C4 /* skin_classic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skin_classic.png; path = skins/skin_classic.png; sourceTree = "<group>"; };
|
||||
F5142652101F6CB9006CF3C4 /* skin_modern.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skin_modern.png; path = skins/skin_modern.png; sourceTree = "<group>"; };
|
||||
F51CBD2B0EC8A3E1005C06AC /* 5pxtinyfont.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 5pxtinyfont.png; path = fonts/5pxtinyfont.png; sourceTree = "<group>"; };
|
||||
F51CBD2C0EC8A3E1005C06AC /* colorfont.pcx */ = {isa = PBXFileReference; lastKnownFileType = file; name = colorfont.pcx; path = fonts/colorfont.pcx; sourceTree = "<group>"; };
|
||||
F51CBD2D0EC8A3E1005C06AC /* Tuffy.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = Tuffy.ttf; path = fonts/Tuffy.ttf; sourceTree = "<group>"; };
|
||||
@ -186,8 +200,6 @@
|
||||
F5B19B8B0EA4BE3E003F4BA4 /* shade.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = shade.c; sourceTree = "<group>"; };
|
||||
F5B19B8C0EA4BE3E003F4BA4 /* special.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = special.c; sourceTree = "<group>"; };
|
||||
F5B19BDF0EA4C65A003F4BA4 /* gfx2.cfg */ = {isa = PBXFileReference; lastKnownFileType = file; path = gfx2.cfg; sourceTree = "<group>"; };
|
||||
F5B19BDF0EA4C65A003F4BA5 /* base.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = base.gif; path = skins/base.gif; sourceTree = "<group>"; };
|
||||
F5B19BDF0EA4C65A003F4BA6 /* ilkke.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ilkke.png; path = skins/ilkke.png; sourceTree = "<group>"; };
|
||||
F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
F5B19C3C0EA4DC91003F4BA4 /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
F5B1EE840EAD0F4E00B087B5 /* gfx2def.ini */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = gfx2def.ini; sourceTree = "<group>"; };
|
||||
@ -260,6 +272,12 @@
|
||||
29B97314FDCFA39411CA2CEA /* Grafx2 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
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 */,
|
||||
@ -294,8 +312,6 @@
|
||||
F5B19C3B0EA4DC91003F4BA4 /* InfoPlist.strings */,
|
||||
F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */,
|
||||
F5B19BDF0EA4C65A003F4BA4 /* gfx2.cfg */,
|
||||
F5B19BDF0EA4C65A003F4BA5 /* base.gif */,
|
||||
F5B19BDF0EA4C65A003F4BA6 /* ilkke.png */,
|
||||
F5B19B7B0EA4BE3E003F4BA4 /* graph.c */,
|
||||
F5B19B7C0EA4BE3E003F4BA4 /* init.c */,
|
||||
F5B19B7D0EA4BE3E003F4BA4 /* io.c */,
|
||||
@ -366,7 +382,7 @@
|
||||
002F39FD09D0883400EBEB89 /* Copy Frameworks into .app bundle */,
|
||||
002F39FD09D0883400EBEB8A /* Copy Frameworks into .app bundle */,
|
||||
F5A33F1D0EC8A26C00F8052D /* Copy fonts */,
|
||||
F5A33F1D0EC8A26C00F8052E /* Copy skins */,
|
||||
F514264B101F6C5B006CF3C4 /* Copy skins */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
};
|
||||
002F3A3E09D088BA00EBEB88 /* main.c */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1060, 11476}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 0}, {867, 536}}";
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1044, 15086}}";
|
||||
sepNavSelRange = "{19535, 0}";
|
||||
sepNavVisRect = "{{0, 10961}, {867, 536}}";
|
||||
sepNavWindowFrame = "{{14, 76}, {906, 665}}";
|
||||
};
|
||||
};
|
||||
@ -29,7 +29,6 @@
|
||||
activeExecutable = F5B19B5D0EA4BD57003F4BA4 /* Grafx2 */;
|
||||
activeTarget = 8D1107260486CEB800E47090 /* Grafx2 */;
|
||||
addToTargets = (
|
||||
8D1107260486CEB800E47090 /* Grafx2 */,
|
||||
);
|
||||
breakpointsGroup = F5B19B700EA4BDA9003F4BA4 /* XCBreakpointsBucket */;
|
||||
codeSenseManager = F5B19B6A0EA4BD79003F4BA4 /* Code sense */;
|
||||
@ -70,14 +69,15 @@
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Built_ColumnID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
229,
|
||||
99,
|
||||
20,
|
||||
48,
|
||||
43,
|
||||
43,
|
||||
20,
|
||||
79,
|
||||
88,
|
||||
264,
|
||||
10,
|
||||
20,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXFileDataSource_FiletypeID,
|
||||
@ -89,6 +89,7 @@
|
||||
PBXFileDataSource_Target_ColumnID,
|
||||
PBXFileDataSource_Path_ColumnID,
|
||||
PBXFileDataSource_Comments_ColumnID,
|
||||
PBXFileDataSource_SCM_ColumnID,
|
||||
);
|
||||
};
|
||||
PBXConfiguration.PBXFileTableDataSource3.PBXFindDataSource = {
|
||||
@ -165,8 +166,8 @@
|
||||
PBXFileDataSource_Warnings_ColumnID,
|
||||
);
|
||||
};
|
||||
PBXPerProjectTemplateStateSaveDate = 266433807;
|
||||
PBXWorkspaceStateSaveDate = 266433807;
|
||||
PBXPerProjectTemplateStateSaveDate = 270495112;
|
||||
PBXWorkspaceStateSaveDate = 270495112;
|
||||
};
|
||||
sourceControlManager = F5B19B690EA4BD79003F4BA4 /* Source Control */;
|
||||
userBuildSettings = {
|
||||
@ -187,6 +188,11 @@
|
||||
F5B19B5D0EA4BD57003F4BA4 /* Grafx2 */,
|
||||
);
|
||||
};
|
||||
F51CBD2B0EC8A3E1005C06AC /* 5pxtinyfont.png */ = {
|
||||
uiCtxt = {
|
||||
sepNavWindowFrame = "{{15, 25}, {971, 716}}";
|
||||
};
|
||||
};
|
||||
F5A33E690EC893F800F8052D /* 8pxfont.png */ = {
|
||||
uiCtxt = {
|
||||
sepNavWindowFrame = "{{15, 76}, {906, 665}}";
|
||||
@ -256,10 +262,10 @@
|
||||
};
|
||||
F5B19B7B0EA4BE3E003F4BA4 /* graph.c */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1620, 118579}}";
|
||||
sepNavSelRange = "{16112, 36}";
|
||||
sepNavVisRect = "{{0, 9964}, {867, 536}}";
|
||||
sepNavWindowFrame = "{{15, 76}, {906, 665}}";
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1140, 52782}}";
|
||||
sepNavSelRange = "{6769, 0}";
|
||||
sepNavVisRect = "{{0, 0}, {867, 536}}";
|
||||
sepNavWindowFrame = "{{14, 76}, {906, 665}}";
|
||||
};
|
||||
};
|
||||
F5B19B7C0EA4BE3E003F4BA4 /* init.c */ = {
|
||||
@ -296,10 +302,10 @@
|
||||
};
|
||||
F5B19B890EA4BE3E003F4BA4 /* sdlscreen.c */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1580, 11571}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 0}, {867, 536}}";
|
||||
sepNavWindowFrame = "{{61, 34}, {906, 665}}";
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1396, 4351}}";
|
||||
sepNavSelRange = "{2375, 0}";
|
||||
sepNavVisRect = "{{0, 1072}, {867, 536}}";
|
||||
sepNavWindowFrame = "{{35, 15}, {906, 665}}";
|
||||
};
|
||||
};
|
||||
F5B19C3C0EA4DC91003F4BA4 /* English */ = {
|
||||
|
||||
@ -188,9 +188,9 @@
|
||||
<array/>
|
||||
<key>PerspectiveWidths</key>
|
||||
<array>
|
||||
<integer>970</integer>
|
||||
<integer>970</integer>
|
||||
<integer>970</integer>
|
||||
<integer>971</integer>
|
||||
<integer>971</integer>
|
||||
<integer>971</integer>
|
||||
</array>
|
||||
<key>Perspectives</key>
|
||||
<array>
|
||||
@ -247,7 +247,7 @@
|
||||
<dict>
|
||||
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
|
||||
<array>
|
||||
<real>305</real>
|
||||
<real>345</real>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
|
||||
<array>
|
||||
@ -259,7 +259,10 @@
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
|
||||
<array>
|
||||
<string>29B97314FDCFA39411CA2CEA</string>
|
||||
<string>29B97317FDCFA39411CA2CEA</string>
|
||||
<string>1C37FBAC04509CD000000102</string>
|
||||
<string>F56B73F7101F6D9500B6D9A4</string>
|
||||
<string>F56B7443101FA1C600B6D9A4</string>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
||||
<array>
|
||||
@ -268,7 +271,7 @@
|
||||
</array>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
||||
<string>{{0, 124}, {305, 575}}</string>
|
||||
<string>{{0, 0}, {345, 600}}</string>
|
||||
</dict>
|
||||
<key>PBXTopSmartGroupGIDs</key>
|
||||
<array/>
|
||||
@ -278,17 +281,17 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {322, 593}}</string>
|
||||
<string>{{0, 0}, {362, 618}}</string>
|
||||
<key>GroupTreeTableConfiguration</key>
|
||||
<array>
|
||||
<string>MainColumn</string>
|
||||
<real>305</real>
|
||||
<real>345</real>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXSmartGroupTreeModule</string>
|
||||
<key>Proportion</key>
|
||||
<string>322pt</string>
|
||||
<string>362pt</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Dock</key>
|
||||
@ -299,7 +302,7 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>F5A33EBD0EC89C3000F8052D</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>asm pthread_mutex_lock 0x90001a38</string>
|
||||
<string></string>
|
||||
<key>PBXSplitModuleInNavigatorKey</key>
|
||||
<dict>
|
||||
<key>Split0</key>
|
||||
@ -307,7 +310,7 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>F5A33EBE0EC89C3000F8052D</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>asm pthread_mutex_lock 0x90001a38</string>
|
||||
<string></string>
|
||||
</dict>
|
||||
<key>SplitCount</key>
|
||||
<string>1</string>
|
||||
@ -320,7 +323,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {643, 0}}</string>
|
||||
<string>{{0, 0}, {604, 0}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXNavigatorGroup</string>
|
||||
@ -329,7 +332,7 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Proportion</key>
|
||||
<string>588pt</string>
|
||||
<string>613pt</string>
|
||||
<key>Tabs</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -343,7 +346,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {643, 561}}</string>
|
||||
<string>{{10, 27}, {604, 586}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>XCDetailModule</string>
|
||||
@ -359,7 +362,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {650, 590}}</string>
|
||||
<string>{{10, 27}, {644, 586}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXProjectFindModule</string>
|
||||
@ -375,7 +378,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 31}, {603, 297}}</string>
|
||||
<string>{{10, 27}, {644, 586}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXCVSModule</string>
|
||||
@ -384,7 +387,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>Proportion</key>
|
||||
<string>643pt</string>
|
||||
<string>604pt</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Name</key>
|
||||
@ -402,11 +405,11 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>F5D646000F487ECB007E515F</string>
|
||||
<string>F56B7444101FA1C600B6D9A4</string>
|
||||
<string>1CA23ED40692098700951B8B</string>
|
||||
<string>F5D646010F487ECB007E515F</string>
|
||||
<string>F56B7445101FA1C600B6D9A4</string>
|
||||
<string>F5A33EBD0EC89C3000F8052D</string>
|
||||
<string>F5D646020F487ECB007E515F</string>
|
||||
<string>F56B7446101FA1C600B6D9A4</string>
|
||||
<string>1CA23EDF0692099D00951B8B</string>
|
||||
<string>1CA23EE00692099D00951B8B</string>
|
||||
<string>1CA23EE10692099D00951B8B</string>
|
||||
@ -468,18 +471,24 @@
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
|
||||
<array>
|
||||
<string>29B97314FDCFA39411CA2CEA</string>
|
||||
<string>F5B19C3B0EA4DC91003F4BA4</string>
|
||||
<string>080E96DDFE201D6D7F000001</string>
|
||||
<string>29B97315FDCFA39411CA2CEA</string>
|
||||
<string>29B97317FDCFA39411CA2CEA</string>
|
||||
<string>29B97323FDCFA39411CA2CEA</string>
|
||||
<string>1058C7A0FEA54F0111CA2CBB</string>
|
||||
<string>1058C7A2FEA54F0111CA2CBB</string>
|
||||
<string>19C28FACFE9D520D11CA2CBB</string>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
||||
<array>
|
||||
<array>
|
||||
<integer>42</integer>
|
||||
<integer>0</integer>
|
||||
</array>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
||||
<string>{{0, 0}, {275, 583}}</string>
|
||||
<string>{{0, 475}, {275, 600}}</string>
|
||||
</dict>
|
||||
<key>PBXTopSmartGroupGIDs</key>
|
||||
<array/>
|
||||
@ -489,14 +498,14 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {292, 601}}</string>
|
||||
<string>{{0, 0}, {292, 618}}</string>
|
||||
<key>GroupTreeTableConfiguration</key>
|
||||
<array>
|
||||
<string>MainColumn</string>
|
||||
<real>275</real>
|
||||
</array>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>65 75 944 642 0 0 1024 746 </string>
|
||||
<string>151 75 971 659 0 0 1024 746 </string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXSmartGroupTreeModule</string>
|
||||
@ -533,9 +542,9 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {647, 0}}</string>
|
||||
<string>{{0, 0}, {674, 0}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>65 75 944 642 0 0 1024 746 </string>
|
||||
<string>151 75 971 659 0 0 1024 746 </string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXNavigatorGroup</string>
|
||||
@ -544,14 +553,14 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Proportion</key>
|
||||
<string>596pt</string>
|
||||
<string>613pt</string>
|
||||
<key>Tabs</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>ContentConfiguration</key>
|
||||
<dict>
|
||||
<key>PBXBuildLogShowsTranscriptDefaultKey</key>
|
||||
<string>{{0, 5}, {647, 564}}</string>
|
||||
<string>{{0, 5}, {674, 581}}</string>
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>XCMainBuildResultsModuleGUID</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
@ -564,9 +573,9 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {647, 569}}</string>
|
||||
<string>{{10, 27}, {674, 586}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>65 75 944 642 0 0 1024 746 </string>
|
||||
<string>151 75 971 659 0 0 1024 746 </string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXBuildResultsModule</string>
|
||||
@ -628,7 +637,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>Proportion</key>
|
||||
<string>647pt</string>
|
||||
<string>674pt</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Name</key>
|
||||
@ -646,14 +655,14 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>F53931560FE170BC003CB103</string>
|
||||
<string>F56B7447101FA1C600B6D9A4</string>
|
||||
<string>1CA23EE50692099D00951B8B</string>
|
||||
<string>F53931570FE170BC003CB103</string>
|
||||
<string>F56B7448101FA1C600B6D9A4</string>
|
||||
<string>F5A33EC20EC89C3000F8052D</string>
|
||||
<string>F53931580FE170BC003CB103</string>
|
||||
<string>F56B7449101FA1C600B6D9A4</string>
|
||||
<string>XCMainBuildResultsModuleGUID</string>
|
||||
<string>1CA23EE80692099D00951B8B</string>
|
||||
<string>F53931590FE170BC003CB103</string>
|
||||
<string>F56B744A101FA1C600B6D9A4</string>
|
||||
</array>
|
||||
<key>ToolbarConfiguration</key>
|
||||
<string>xcode.toolbar.config.buildAndRun</string>
|
||||
@ -697,7 +706,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {1323, 0}}</string>
|
||||
<string>{{0, 0}, {971, 0}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXDebugCLIModule</string>
|
||||
@ -721,8 +730,8 @@
|
||||
<string>yes</string>
|
||||
<key>sizes</key>
|
||||
<array>
|
||||
<string>{{0, 0}, {641, 197}}</string>
|
||||
<string>{{641, 0}, {682, 197}}</string>
|
||||
<string>{{0, 0}, {470, 295}}</string>
|
||||
<string>{{470, 0}, {501, 295}}</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>VerticalSplitView</key>
|
||||
@ -737,8 +746,8 @@
|
||||
<string>yes</string>
|
||||
<key>sizes</key>
|
||||
<array>
|
||||
<string>{{0, 0}, {1323, 197}}</string>
|
||||
<string>{{0, 197}, {1323, 211}}</string>
|
||||
<string>{{0, 0}, {971, 295}}</string>
|
||||
<string>{{0, 295}, {971, 318}}</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -760,12 +769,12 @@
|
||||
<key>DebugSTDIOWindowFrame</key>
|
||||
<string>{{200, 200}, {500, 300}}</string>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 5}, {1323, 408}}</string>
|
||||
<string>{{0, 5}, {971, 613}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXDebugSessionModule</string>
|
||||
<key>Proportion</key>
|
||||
<string>408pt</string>
|
||||
<string>613pt</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Name</key>
|
||||
@ -784,15 +793,15 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>F5AED0700F1999130090A93F</string>
|
||||
<string>F56B744B101FA1C600B6D9A4</string>
|
||||
<string>1CCC7628064C1048000F2A68</string>
|
||||
<string>1CCC7629064C1048000F2A68</string>
|
||||
<string>F5AED0710F1999130090A93F</string>
|
||||
<string>F5AED0720F1999130090A93F</string>
|
||||
<string>F5AED0730F1999130090A93F</string>
|
||||
<string>F5AED0740F1999130090A93F</string>
|
||||
<string>F5AED0410F1989EC0090A93F</string>
|
||||
<string>F5AED0750F1999130090A93F</string>
|
||||
<string>F56B744C101FA1C600B6D9A4</string>
|
||||
<string>F56B744D101FA1C600B6D9A4</string>
|
||||
<string>F56B744E101FA1C600B6D9A4</string>
|
||||
<string>F56B744F101FA1C600B6D9A4</string>
|
||||
<string>F56B7409101F6DEB00B6D9A4</string>
|
||||
<string>F56B7450101FA1C600B6D9A4</string>
|
||||
</array>
|
||||
<key>ToolbarConfiguration</key>
|
||||
<string>xcode.toolbar.config.debug</string>
|
||||
@ -801,7 +810,7 @@
|
||||
<key>PerspectivesBarVisible</key>
|
||||
<true/>
|
||||
<key>PinnedNavigatorIdentifier</key>
|
||||
<string>F539315B0FE170D5003CB103</string>
|
||||
<string>F56B743E101F7E4F00B6D9A4</string>
|
||||
<key>ShelfIsVisible</key>
|
||||
<false/>
|
||||
<key>SourceDescription</key>
|
||||
@ -824,10 +833,11 @@
|
||||
<integer>5</integer>
|
||||
<key>WindowOrderList</key>
|
||||
<array>
|
||||
<string>F56B7450101FA1C600B6D9A4</string>
|
||||
<string>/Users/xx/Grafx2/Grafx2.xcodeproj</string>
|
||||
</array>
|
||||
<key>WindowString</key>
|
||||
<string>65 75 944 642 0 0 1024 746 </string>
|
||||
<string>151 75 971 659 0 0 1024 746 </string>
|
||||
<key>WindowTools</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<string>Grafx2</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>http://grafx2.googlecode.com/</string>
|
||||
<string>com.googlecode.grafx2</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<string>Grafx2</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
||||
89
Makefile
@ -1,5 +1,6 @@
|
||||
# Grafx2 - The Ultimate 256-color bitmap paint program
|
||||
#
|
||||
# Copyright 2009 Per Olofsson
|
||||
# Copyright 2008 Peter Gordon
|
||||
# Copyright 2008 Yves Rizoud
|
||||
# Copyright 2007 Adrien Destugues
|
||||
@ -31,6 +32,8 @@
|
||||
|
||||
### PLATFORM DETECTION AND CONFIGURATION ###
|
||||
|
||||
PLATFORMOBJ =
|
||||
|
||||
# There is no uname under windows, but we can guess we are there with the COMSPEC env.var
|
||||
# Windows specific
|
||||
ifdef COMSPEC
|
||||
@ -45,8 +48,7 @@ ifdef COMSPEC
|
||||
OBJDIR = obj/win32
|
||||
# Resources (icon)
|
||||
WINDRES = windres.exe
|
||||
OBJRES = $(OBJDIR)/winres.o
|
||||
CFGOBJRES = $(OBJDIR)/wincfgres.o
|
||||
PLATFORMOBJ = $(OBJDIR)/winres.o
|
||||
PLATFORM = win32
|
||||
PLATFORMFILES = SDL.dll SDL_image.dll libpng13.dll zlib1.dll gfx2.ico $(TTFLIBS) #some misc files we have to add to the release archive under windows.
|
||||
ZIP = zip
|
||||
@ -62,13 +64,36 @@ else
|
||||
RMDIR = rmdir
|
||||
CP = cp
|
||||
BIN = grafx2
|
||||
COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` -D__USE_INLINE__ $(TTFCOPT)
|
||||
COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` -I/SDK/Local/common/include/SDL -D__USE_INLINE__ $(TTFCOPT)
|
||||
LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lft2
|
||||
CC = gcc
|
||||
OBJDIR = obj/amiga
|
||||
ZIP = lha
|
||||
ZIPOPT = a
|
||||
|
||||
else ifeq ($(PLATFORM),Darwin)
|
||||
#Mac OS X specific
|
||||
DELCOMMAND = rm -rf
|
||||
MKDIR = mkdir -p
|
||||
RMDIR = rmdir
|
||||
CP = cp
|
||||
ZIP = zip
|
||||
PLATFORMFILES = gfx2.png
|
||||
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__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
|
||||
|
||||
else ifeq ($(PLATFORM),AROS)
|
||||
#AROS specific
|
||||
DELCOMMAND = rm -rf
|
||||
@ -185,7 +210,7 @@ else
|
||||
|
||||
# Compiles a regular linux exectutable for the native platform
|
||||
BIN = grafx2
|
||||
COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
|
||||
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
|
||||
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng
|
||||
# Use gcc for compiling. Use ncc to build a callgraph and analyze the code.
|
||||
CC = gcc
|
||||
@ -225,9 +250,30 @@ endif
|
||||
.PHONY : all debug release clean depend zip version force install uninstall
|
||||
|
||||
# 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
|
||||
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 $(PLATFORMOBJ)
|
||||
|
||||
SKIN_FILES = skins/skin_classic.png skins/skin_modern.png skins/font_Classic.png skins/font_Fun.png
|
||||
|
||||
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
|
||||
echo 'APPL????' > Grafx2.app/Contents/PkgInfo
|
||||
cp Info.plist Grafx2.app/Contents
|
||||
cp -r English.lproj Grafx2.app/Contents/Resources
|
||||
cp -r fonts Grafx2.app/Contents/Resources
|
||||
cp -r skins Grafx2.app/Contents/Resources
|
||||
cp -r gfx2.cfg Grafx2.app/Contents/Resources
|
||||
cp -r 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 $(BIN) $(MACAPPEXE)
|
||||
else
|
||||
all : $(BIN)
|
||||
endif
|
||||
|
||||
|
||||
debug : $(BIN)
|
||||
|
||||
@ -237,17 +283,22 @@ release : version $(BIN)
|
||||
|
||||
# Create a zip archive ready for upload to the website, including binaries and sourcecode
|
||||
ziprelease: version $(BIN) release
|
||||
tar cvzf src-svn`svnversion | sed 's/:/-/'`.tgz --transform 's,^,src/,g' *.c *.h Makefile Makefile.dep gfx2.ico
|
||||
$(ZIP) $(ZIPOPT) grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-$(PLATFORM).$(ZIP) $(BIN) gfx2def.ini skins/base.gif gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-svn`svnversion | sed 's/:/-/'`.tgz $(PLATFORMFILES)
|
||||
$(DELCOMMAND) src-svn`svnversion | sed 's/:/-/'`.tgz
|
||||
tar cvzf grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-src.tgz --transform 's,^,grafx2/,g' *.c *.h Makefile Makefile.dep gfx2def.ini skins/base.gif gfx2.ico gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt misc/grafx2.1 misc/grafx2.xpm misc/grafx2.desktop fonts/8pxfont.png fonts/Tuffy.ttf
|
||||
echo `sed "s/.*=\"\(.*\)\";/\1/" pversion.c`.`svnversion` | tr " :" "_-" | sed -e s/\\(wip\\)\\\\./\\1/I > $(OBJDIR)/versiontag
|
||||
|
||||
$(BIN) : $(OBJ) $(OBJRES)
|
||||
$(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT)
|
||||
tar cvzf "src-`cat $(OBJDIR)/versiontag`.tgz" --transform 's,^,src/,g' *.c *.h Makefile Makefile.dep gfx2.ico
|
||||
$(ZIP) $(ZIPOPT) "grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-$(PLATFORM).$(ZIP)" $(BIN) gfx2def.ini $(SKIN_FILES) gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-`cat $(OBJDIR)/versiontag`.tgz $(PLATFORMFILES)
|
||||
$(DELCOMMAND) "src-`cat $(OBJDIR)/versiontag`.tgz"
|
||||
tar cvzf "grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-src.tgz" --transform 's,^,grafx2/,g' *.c *.h Makefile Makefile.dep gfx2def.ini $(SKIN_FILES) gfx2.ico gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt misc/grafx2.1 misc/grafx2.xpm misc/grafx2.desktop fonts/8pxfont.png fonts/Tuffy.ttf
|
||||
$(DELCOMMAND) "$(OBJDIR)/versiontag"
|
||||
|
||||
testsed :
|
||||
|
||||
$(BIN) : $(OBJ)
|
||||
$(CC) $(OBJ) -o $(BIN) $(LOPT)
|
||||
|
||||
# SVN revision number
|
||||
version.c :
|
||||
echo "char SVN_revision[]=\"`svnversion`\";" > version.c
|
||||
echo "char SVN_revision[]=\"`svnversion .`\";" > version.c
|
||||
ifeq ($(LABEL),)
|
||||
else
|
||||
echo "char Program_version[]=\"$(LABEL)\";" > pversion.c
|
||||
@ -265,10 +316,14 @@ else
|
||||
$(DELCOMMAND) pversion.c
|
||||
endif
|
||||
|
||||
$(OBJDIR)/%.o :
|
||||
$(OBJDIR)/%.o : %.c
|
||||
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
|
||||
$(CC) $(COPT) -c $*.c -o $(OBJDIR)/$*.o
|
||||
|
||||
$(OBJDIR)/%.o : %.m
|
||||
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
|
||||
$(CC) $(COPT) -c $*.m -o $(OBJDIR)/$*.o
|
||||
|
||||
depend :
|
||||
$(CC) -MM *.c | sed 's:^[^ ]:$$(OBJDIR)/&:' > Makefile.dep
|
||||
|
||||
@ -277,7 +332,7 @@ $(OBJDIR)/winres.o : gfx2.ico
|
||||
echo "1 ICON \"gfx2.ico\"" | $(WINDRES) -o $(OBJDIR)/winres.o
|
||||
|
||||
clean :
|
||||
$(DELCOMMAND) $(OBJ) $(OBJDIR)/version.o $(OBJRES)
|
||||
$(DELCOMMAND) $(OBJ)
|
||||
$(DELCOMMAND) $(BIN)
|
||||
|
||||
# Linux installation of the program
|
||||
@ -298,7 +353,7 @@ install : $(BIN)
|
||||
$(CP) gfx2def.ini $(DESTDIR)$(datadir)/grafx2/
|
||||
$(CP) gfx2.gif $(DESTDIR)$(datadir)/grafx2/
|
||||
$(CP) fonts/* $(DESTDIR)$(datadir)/grafx2/fonts/
|
||||
$(CP) skins/base.gif $(DESTDIR)$(datadir)/grafx2/skins/
|
||||
$(CP) $(SKIN_FILES) $(DESTDIR)$(datadir)/grafx2/skins/
|
||||
# Icon and desktop file for debian
|
||||
$(CP) misc/grafx2.desktop $(DESTDIR)$(datadir)/applications/
|
||||
$(CP) misc/grafx2.xpm $(DESTDIR)$(datadir)/icons/
|
||||
@ -312,7 +367,9 @@ uninstall :
|
||||
$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/gfx2.gif
|
||||
$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/fonts/*
|
||||
$(if $(wildcard $(DESTDIR)$(datadir)/grafx2/fonts),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/fonts)
|
||||
$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/skins/base.gif
|
||||
cd $(DESTDIR)$(datadir)/grafx2
|
||||
$(DELCOMMAND) $(SKIN_FILES)
|
||||
cd ..
|
||||
$(if $(wildcard $(DESTDIR)$(datadir)/grafx2/skins),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/skins)
|
||||
# Icon and desktop file for debian
|
||||
$(DELCOMMAND) $(DESTDIR)$(datadir)/applications/grafx2.desktop
|
||||
|
||||
205
brush.c
@ -123,7 +123,8 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
int position;
|
||||
byte * temp;
|
||||
|
||||
if (!(is_preview && Mouse_K)) // Si bouton enfoncé & preview > pas de dessin
|
||||
if (is_preview==0 || Mouse_K==0) // pas de curseur si on est en preview et
|
||||
// en train de cliquer
|
||||
switch (Paintbrush_shape)
|
||||
{
|
||||
case PAINTBRUSH_SHAPE_POINT : // !!! TOUJOURS EN PREVIEW !!!
|
||||
@ -151,7 +152,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
end_counter_x=start_x_counter+width;
|
||||
end_counter_y=start_y_counter+height;
|
||||
|
||||
if (is_preview)
|
||||
if (is_preview != 0)
|
||||
{
|
||||
if ( (width>0) && (height>0) )
|
||||
Display_brush_color(
|
||||
@ -165,7 +166,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
Brush_width
|
||||
);
|
||||
|
||||
if (Main_magnifier_mode)
|
||||
if (Main_magnifier_mode != 0)
|
||||
{
|
||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,
|
||||
&height
|
||||
@ -196,9 +197,9 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Smear_mode) && (Shade_table==Shade_table_left))
|
||||
if ((Smear_mode != 0) && (Shade_table==Shade_table_left))
|
||||
{
|
||||
if (Smear_start)
|
||||
if (Smear_start != 0)
|
||||
{
|
||||
if ((width>0) && (height>0))
|
||||
{
|
||||
@ -275,7 +276,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
start_y_counter=start_y-(y-Brush_offset_Y);
|
||||
end_counter_x=start_x_counter+width;
|
||||
end_counter_y=start_y_counter+height;
|
||||
if (is_preview)
|
||||
if (is_preview != 0)
|
||||
{
|
||||
if ( (width>0) && (height>0) )
|
||||
Display_brush_mono(start_x-Main_offset_X,
|
||||
@ -285,7 +286,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
Back_color,Fore_color,
|
||||
Brush_width);
|
||||
|
||||
if (Main_magnifier_mode)
|
||||
if (Main_magnifier_mode != 0)
|
||||
{
|
||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||
start_x_counter=start_x-(x-Brush_offset_X);
|
||||
@ -314,9 +315,9 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Smear_mode) && (Shade_table==Shade_table_left))
|
||||
if ((Smear_mode != 0) && (Shade_table==Shade_table_left))
|
||||
{
|
||||
if (Smear_start)
|
||||
if (Smear_start != 0)
|
||||
{
|
||||
if ((width>0) && (height>0))
|
||||
{
|
||||
@ -377,7 +378,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
start_y_counter=start_y-(y-Paintbrush_offset_Y);
|
||||
end_counter_x=start_x_counter+width;
|
||||
end_counter_y=start_y_counter+height;
|
||||
if (is_preview)
|
||||
if (is_preview != 0)
|
||||
{
|
||||
temp=Brush;
|
||||
Brush=Paintbrush_sprite;
|
||||
@ -390,7 +391,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
0,Fore_color,
|
||||
MAX_PAINTBRUSH_SIZE);
|
||||
|
||||
if (Main_magnifier_mode)
|
||||
if (Main_magnifier_mode != 0)
|
||||
{
|
||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||
start_x_counter=start_x-(x-Paintbrush_offset_X);
|
||||
@ -419,9 +420,9 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Smear_mode) && (Shade_table==Shade_table_left))
|
||||
if ((Smear_mode != 0) && (Shade_table==Shade_table_left))
|
||||
{
|
||||
if (Smear_start)
|
||||
if (Smear_start != 0)
|
||||
{
|
||||
if ((width>0) && (height>0))
|
||||
{
|
||||
@ -444,10 +445,13 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
{
|
||||
temp_color=Read_pixel_from_current_screen(x_pos,y_pos);
|
||||
position=(counter_y*Smear_brush_width)+counter_x;
|
||||
if ( (Paintbrush_sprite[(MAX_PAINTBRUSH_SIZE*counter_y)+counter_x]) // Le pinceau sert de masque pour dire quels pixels on doit traiter dans le rectangle
|
||||
&& (counter_y<Smear_max_Y) && (counter_x<Smear_max_X) // On clippe l'effet smear entre Smear_Min et Smear_Max
|
||||
&& (counter_y>=Smear_min_Y) && (counter_x>=Smear_min_X) )
|
||||
Display_pixel(x_pos,y_pos,Smear_brush[position]);
|
||||
if ( (Paintbrush_sprite[(MAX_PAINTBRUSH_SIZE*counter_y)+counter_x] != 0)
|
||||
// Le pinceau sert de masque pour dire quels pixels on doit traiter dans le rectangle
|
||||
&& (counter_y<Smear_max_Y) && (counter_x<Smear_max_X)
|
||||
&& (counter_y>=Smear_min_Y) && (counter_x>=Smear_min_X)
|
||||
// On clippe l'effet smear entre Smear_Min et Smear_Max
|
||||
)
|
||||
Display_pixel(x_pos,y_pos,Smear_brush[position]);
|
||||
Smear_brush[position]=temp_color;
|
||||
}
|
||||
Update_part_of_screen(start_x, start_y, width, height);
|
||||
@ -464,7 +468,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
for (y_pos=start_y,counter_y=start_y_counter;counter_y<end_counter_y;y_pos++,counter_y++)
|
||||
for (x_pos=start_x,counter_x=start_x_counter;counter_x<end_counter_x;x_pos++,counter_x++)
|
||||
{
|
||||
if (Paintbrush_sprite[(MAX_PAINTBRUSH_SIZE*counter_y)+counter_x])
|
||||
if (Paintbrush_sprite[(MAX_PAINTBRUSH_SIZE*counter_y)+counter_x] != 0)
|
||||
Display_pixel(x_pos,y_pos,color);
|
||||
}
|
||||
Update_part_of_screen(start_x,start_y,width,height);
|
||||
@ -473,6 +477,69 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Changes the Brush size, discarding its previous content.
|
||||
/// @return 0 OK, 1 Failed
|
||||
byte Realloc_brush(word new_brush_width, word new_brush_height)
|
||||
{
|
||||
byte return_code=0;
|
||||
|
||||
if ( (((long)Brush_height)*Brush_width) !=
|
||||
(((long)new_brush_height)*new_brush_width) )
|
||||
{
|
||||
free(Brush);
|
||||
Brush=(byte *)malloc(((long)new_brush_height)*new_brush_width);
|
||||
if (Brush == NULL)
|
||||
{
|
||||
Error(0);
|
||||
return_code=1;
|
||||
|
||||
Brush=(byte *)malloc(1*1);
|
||||
if(Brush == NULL)
|
||||
{
|
||||
Error(ERROR_MEMORY);
|
||||
exit(ERROR_MEMORY);
|
||||
}
|
||||
new_brush_height=new_brush_width=1;
|
||||
*Brush=Fore_color;
|
||||
}
|
||||
}
|
||||
Brush_width=new_brush_width;
|
||||
Brush_height=new_brush_height;
|
||||
|
||||
free(Smear_brush);
|
||||
Smear_brush_width=(Brush_width>MAX_PAINTBRUSH_SIZE)?Brush_width:MAX_PAINTBRUSH_SIZE;
|
||||
Smear_brush_height=(Brush_height>MAX_PAINTBRUSH_SIZE)?Brush_height:MAX_PAINTBRUSH_SIZE;
|
||||
Smear_brush=(byte *)malloc(((long)Smear_brush_height)*Smear_brush_width);
|
||||
|
||||
if (Smear_brush == NULL) // Failed to allocate the smear brush
|
||||
{
|
||||
Error(0);
|
||||
return_code=1;
|
||||
|
||||
free(Brush);
|
||||
Brush=(byte *)malloc(1*1);
|
||||
if(Brush == NULL)
|
||||
{
|
||||
Error(ERROR_MEMORY);
|
||||
exit(ERROR_MEMORY);
|
||||
}
|
||||
Brush_height=1;
|
||||
Brush_width=1;
|
||||
|
||||
Smear_brush=(byte *)malloc(MAX_PAINTBRUSH_SIZE*MAX_PAINTBRUSH_SIZE);
|
||||
if(Smear_brush == NULL)
|
||||
{
|
||||
Error(ERROR_MEMORY);
|
||||
exit(ERROR_MEMORY);
|
||||
}
|
||||
Smear_brush_height=MAX_PAINTBRUSH_SIZE;
|
||||
Smear_brush_width=MAX_PAINTBRUSH_SIZE;
|
||||
}
|
||||
return return_code;
|
||||
}
|
||||
|
||||
|
||||
// -- Effacer le pinceau -- //
|
||||
//
|
||||
void Hide_paintbrush(short x,short y)
|
||||
@ -495,11 +562,11 @@ void Hide_paintbrush(short x,short y)
|
||||
//short counter_x; // Position X (dans la brosse/pinceau) en cours
|
||||
//d'affichage
|
||||
//short counter_y; // Position Y (dans la brosse/pinceau) en cours d'affichage
|
||||
short end_counter_x; // Position X ou s'arrête l'affichade de la brosse/pinceau
|
||||
short end_counter_y; // Position Y ou s'arrête l'affichade de la brosse/pinceau
|
||||
short end_counter_x; // Position X ou s'arrête l'affichage de la brosse/pinceau
|
||||
short end_counter_y; // Position Y ou s'arrête l'affichage de la brosse/pinceau
|
||||
byte * temp;
|
||||
|
||||
if (!Mouse_K)
|
||||
if (Mouse_K == 0)
|
||||
switch (Paintbrush_shape)
|
||||
{
|
||||
case PAINTBRUSH_SHAPE_POINT :
|
||||
@ -531,7 +598,7 @@ void Hide_paintbrush(short x,short y)
|
||||
width,height,Back_color,
|
||||
Main_image_width);
|
||||
|
||||
if (Main_magnifier_mode)
|
||||
if (Main_magnifier_mode != 0)
|
||||
{
|
||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||
start_x_counter=start_x;
|
||||
@ -577,7 +644,7 @@ void Hide_paintbrush(short x,short y)
|
||||
Main_image_width);
|
||||
}
|
||||
|
||||
if (Main_magnifier_mode)
|
||||
if (Main_magnifier_mode != 0)
|
||||
{
|
||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||
start_x_counter=start_x;
|
||||
@ -651,46 +718,12 @@ void Capture_brush(short start_x,short start_y,short end_x,short end_y,short cle
|
||||
if (start_y+new_brush_height>Main_image_height)
|
||||
new_brush_height=Main_image_height-start_y;
|
||||
|
||||
if ( (((long)Brush_height)*Brush_width) !=
|
||||
(((long)new_brush_height)*new_brush_width) )
|
||||
{
|
||||
free(Brush);
|
||||
Brush=(byte *)malloc(((long)new_brush_height)*new_brush_width);
|
||||
if (!Brush)
|
||||
{
|
||||
Error(0);
|
||||
|
||||
Brush=(byte *)malloc(1*1);
|
||||
new_brush_height=new_brush_width=1;
|
||||
*Brush=Fore_color;
|
||||
}
|
||||
}
|
||||
Brush_width=new_brush_width;
|
||||
Brush_height=new_brush_height;
|
||||
|
||||
free(Smear_brush);
|
||||
Smear_brush_width=(Brush_width>MAX_PAINTBRUSH_SIZE)?Brush_width:MAX_PAINTBRUSH_SIZE;
|
||||
Smear_brush_height=(Brush_height>MAX_PAINTBRUSH_SIZE)?Brush_height:MAX_PAINTBRUSH_SIZE;
|
||||
Smear_brush=(byte *)malloc(((long)Smear_brush_height)*Smear_brush_width);
|
||||
|
||||
if (!Smear_brush) // On ne peut même pas allouer la brosse du smear!
|
||||
{
|
||||
Error(0);
|
||||
|
||||
free(Brush);
|
||||
Brush=(byte *)malloc(1*1);
|
||||
Brush_height=1;
|
||||
Brush_width=1;
|
||||
|
||||
Smear_brush=(byte *)malloc(MAX_PAINTBRUSH_SIZE*MAX_PAINTBRUSH_SIZE);
|
||||
Smear_brush_height=MAX_PAINTBRUSH_SIZE;
|
||||
Smear_brush_width=MAX_PAINTBRUSH_SIZE;
|
||||
}
|
||||
Realloc_brush(new_brush_width, new_brush_height);
|
||||
|
||||
Copy_image_to_brush(start_x,start_y,Brush_width,Brush_height,Main_image_width);
|
||||
|
||||
// On regarde s'il faut effacer quelque chose:
|
||||
if (clear)
|
||||
if (clear != 0)
|
||||
{
|
||||
for (y_pos=start_y;y_pos<start_y+Brush_height;y_pos++)
|
||||
for (x_pos=start_x;x_pos<start_x+Brush_width;x_pos++)
|
||||
@ -716,7 +749,7 @@ void Rotate_90_deg()
|
||||
new_brush=(byte *)malloc(((long)Brush_height)*Brush_width);
|
||||
if (new_brush)
|
||||
{
|
||||
Rotate_90_deg_lowlevel(Brush,new_brush,Brush_width,Brush_height);
|
||||
Rotate_90_deg_lowlevel(Brush,/*@out@*/ new_brush,Brush_width,Brush_height);
|
||||
free(Brush);
|
||||
Brush=new_brush;
|
||||
|
||||
@ -767,7 +800,7 @@ void Remap_brush(void)
|
||||
// conversion puisque elles n'existent pas dans la brosse, donc elles
|
||||
// ne seront pas utilisées par Remap_brush_LOWLEVEL.
|
||||
for (color=0;color<=255;color++)
|
||||
if (used[color])
|
||||
if (used[color] != 0)
|
||||
used[color]=Best_color(Spare_palette[color].R,Spare_palette[color].G,Spare_palette[color].B);
|
||||
|
||||
// Il reste une couleur non calculée dans la table qu'il faut mettre à
|
||||
@ -808,13 +841,9 @@ void Outline_brush(void)
|
||||
|
||||
// On copie la brosse courante dans la nouvelle
|
||||
Copy_part_of_image_to_another(Brush, // source
|
||||
0, 0,
|
||||
Brush_width,
|
||||
Brush_height,
|
||||
Brush_width,
|
||||
new_brush, // Destination
|
||||
1, 1,
|
||||
width);
|
||||
0, 0, Brush_width, Brush_height, Brush_width,
|
||||
new_brush, // Destination
|
||||
1, 1, width);
|
||||
|
||||
// On intervertit la nouvelle et l'ancienne brosse:
|
||||
temp=Brush;
|
||||
@ -835,23 +864,20 @@ void Outline_brush(void)
|
||||
{
|
||||
if (temp[((y_pos-1)*width)+x_pos-1]==Back_color)
|
||||
{
|
||||
if (state)
|
||||
if (state != 0)
|
||||
{
|
||||
Pixel_in_brush(x_pos,y_pos,Fore_color);
|
||||
state=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (state == 0)
|
||||
{
|
||||
if (!state)
|
||||
{
|
||||
Pixel_in_brush(x_pos-1,y_pos,Fore_color);
|
||||
state=1;
|
||||
}
|
||||
Pixel_in_brush(x_pos-1,y_pos,Fore_color);
|
||||
state=1;
|
||||
}
|
||||
}
|
||||
// Cas du dernier pixel à droite de la ligne
|
||||
if (state)
|
||||
if (state != 0)
|
||||
Pixel_in_brush(x_pos,y_pos,Fore_color);
|
||||
}
|
||||
|
||||
@ -863,23 +889,20 @@ void Outline_brush(void)
|
||||
{
|
||||
if (temp[((y_pos-1)*width)+x_pos-1]==Back_color)
|
||||
{
|
||||
if (state)
|
||||
if (state != 0)
|
||||
{
|
||||
Pixel_in_brush(x_pos,y_pos,Fore_color);
|
||||
state=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (state == 0)
|
||||
{
|
||||
if (!state)
|
||||
{
|
||||
Pixel_in_brush(x_pos,y_pos-1,Fore_color);
|
||||
state=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cas du dernier pixel en bas de la colonne
|
||||
if (state)
|
||||
if (state != 0)
|
||||
Pixel_in_brush(x_pos,y_pos,Fore_color);
|
||||
}
|
||||
}
|
||||
@ -903,7 +926,7 @@ void Outline_brush(void)
|
||||
|
||||
void Nibble_brush(void)
|
||||
{
|
||||
long /*Pos,*/x_pos,y_pos;
|
||||
long x_pos,y_pos;
|
||||
byte state;
|
||||
byte * new_brush;
|
||||
byte * temp;
|
||||
@ -946,7 +969,7 @@ void Nibble_brush(void)
|
||||
{
|
||||
if (temp[((y_pos+1)*width)+x_pos+1]==Back_color)
|
||||
{
|
||||
if (state)
|
||||
if (state != 0)
|
||||
{
|
||||
if (x_pos>0)
|
||||
Pixel_in_brush(x_pos-1,y_pos,Back_color);
|
||||
@ -955,7 +978,7 @@ void Nibble_brush(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!state)
|
||||
if (state == 0)
|
||||
{
|
||||
Pixel_in_brush(x_pos,y_pos,Back_color);
|
||||
state=1;
|
||||
@ -984,7 +1007,7 @@ void Nibble_brush(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!state)
|
||||
if (state == 0)
|
||||
{
|
||||
Pixel_in_brush(x_pos,y_pos,Back_color);
|
||||
state=1;
|
||||
@ -1021,7 +1044,7 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
|
||||
short start_y=Limit_bottom+1;
|
||||
short end_x=Limit_left-1;
|
||||
short end_y=Limit_top-1;
|
||||
short temp;
|
||||
unsigned short temp;
|
||||
short x_pos;
|
||||
short y_pos;
|
||||
word new_brush_width;
|
||||
@ -1029,10 +1052,10 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
|
||||
|
||||
|
||||
// On recherche les bornes de la brosse:
|
||||
for (temp=0; temp<vertices; temp++)
|
||||
for (temp=0; temp<2*vertices; temp+=2)
|
||||
{
|
||||
x_pos=points[temp<<1];
|
||||
y_pos=points[(temp<<1)+1];
|
||||
x_pos=points[temp];
|
||||
y_pos=points[temp+1];
|
||||
if (x_pos<start_x)
|
||||
start_x=x_pos;
|
||||
if (x_pos>end_x)
|
||||
@ -1079,6 +1102,7 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
|
||||
Error(0);
|
||||
|
||||
Brush=(byte *)malloc(1*1);
|
||||
if(Brush==NULL) Error(ERROR_MEMORY);
|
||||
new_brush_height=new_brush_width=1;
|
||||
*Brush=Fore_color;
|
||||
}
|
||||
@ -1097,6 +1121,7 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
|
||||
|
||||
free(Brush);
|
||||
Brush=(byte *)malloc(1*1);
|
||||
if(Brush==NULL) Error(ERROR_MEMORY);
|
||||
Brush_height=1;
|
||||
Brush_width=1;
|
||||
|
||||
|
||||
8
brush.h
@ -105,4 +105,12 @@ void Nibble_brush(void);
|
||||
*/
|
||||
void Capture_brush_with_lasso(int vertices, short * points,short clear);
|
||||
|
||||
|
||||
///
|
||||
/// Changes the Brush size, discarding its previous content.
|
||||
/// @return 0 OK, 1 Failed
|
||||
byte Realloc_brush(word new_brush_width, word new_brush_height);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
25
buttons.h
@ -353,6 +353,11 @@ void Button_Snap_mode(void);
|
||||
*/
|
||||
void Button_Grid_menu(void);
|
||||
|
||||
/*!
|
||||
Callback to toggle the grid visible in the magnified view.
|
||||
*/
|
||||
void Button_Show_grid(void);
|
||||
|
||||
// Mode trame (Sieve)
|
||||
|
||||
/*!
|
||||
@ -425,6 +430,17 @@ void Button_Tiling_mode(void);
|
||||
Displays the tiling setup menu.
|
||||
*/
|
||||
void Button_Tiling_menu(void);
|
||||
|
||||
/*!
|
||||
Callback for the command that turns off all drawaing effects.
|
||||
*/
|
||||
void Effects_off(void);
|
||||
|
||||
/*!
|
||||
Command that sets the transparency level.
|
||||
*/
|
||||
void Transparency_set(byte amount);
|
||||
|
||||
// Menu des effets
|
||||
|
||||
/*!
|
||||
@ -568,6 +584,11 @@ void Button_Autosave(void);
|
||||
*/
|
||||
void Button_Settings(void);
|
||||
|
||||
/*!
|
||||
Display the skin selector window.
|
||||
*/
|
||||
void Button_Skins(void);
|
||||
|
||||
// Annulation de la dernière modification
|
||||
|
||||
/*!
|
||||
@ -621,7 +642,7 @@ void Save_picture(byte image);
|
||||
/*!
|
||||
Generic color tagging menu, for various effects.
|
||||
*/
|
||||
void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_cancel, const char *help_section);
|
||||
void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_cancel, const char *help_section, word close_shortcut );
|
||||
|
||||
|
||||
/*!
|
||||
@ -635,5 +656,7 @@ void Button_Smooth_menu(void);
|
||||
*/
|
||||
void Button_Smear_mode(void);
|
||||
|
||||
void Button_Brush_container(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
56
const.h
@ -33,7 +33,7 @@
|
||||
#define BETA1 98 ///< Version number for gfx2.cfg (3/4)
|
||||
#define BETA2 0 ///< Version number for gfx2.cfg (4/4)
|
||||
#define MAX_VIDEO_MODES 100 ///< Maximum number of video modes Grafx2 can propose.
|
||||
#define NB_SHORTCUTS 134 ///< Number of actions that can have a key combination associated to it.
|
||||
#define NB_SHORTCUTS 159 ///< Number of actions that can have a key combination associated to it.
|
||||
#define NB_ZOOM_FACTORS 12 ///< Number of zoom levels available in the magnifier.
|
||||
#define MENU_WIDTH 254 ///< Width of the menu (not counting the palette)
|
||||
#define MENU_HEIGHT 44 ///< Height of the menu.
|
||||
@ -58,13 +58,18 @@
|
||||
#define DEFAULT_ZOOM_FACTOR 4 ///< Initial zoom factor for the magnifier.
|
||||
#define MAX_PATH_CHARACTERS 260 ///< Number of characters for a file+complete path. Adapt to your OS...
|
||||
#define NB_BOOKMARKS 4 ///< Number of bookmark buttons in Save/Load screen.
|
||||
// Character to show a right arrow, used when editing long strings. It's present in ::GFX_system_font
|
||||
// Character to show a right arrow, used when editing long strings. It's present in ::Gfx->System_font
|
||||
#define RIGHT_TRIANGLE_CHARACTER 16
|
||||
// Character to show a left arrow, used when editing long strings. It's present in ::GFX_system_font
|
||||
// Character to show a left arrow, used when editing long strings. It's present in ::Gfx->System_font
|
||||
#define LEFT_TRIANGLE_CHARACTER 17
|
||||
/// Character to display in menus for an ellipsis.
|
||||
#define ELLIPSIS_CHARACTER '…'
|
||||
|
||||
#define BRUSH_CONTAINER_PREVIEW_WIDTH 16 ///< Size for preview of a brush in Brush container
|
||||
#define BRUSH_CONTAINER_PREVIEW_HEIGHT 16 ///< Size for preview of a brush in Brush container
|
||||
#define BRUSH_CONTAINER_COLUMNS 4 ///< Number of columns in the Brush container
|
||||
#define BRUSH_CONTAINER_ROWS 3 ///< Number of rows in the Brush container
|
||||
|
||||
///
|
||||
/// We force the dynamic backup page allocation to leave a minimum of
|
||||
/// 256Kb of free memory, to allow the rest of the program to work safely.
|
||||
@ -90,14 +95,14 @@
|
||||
// -- File formats
|
||||
|
||||
#ifndef __no_pnglib__
|
||||
#define NB_KNOWN_FORMATS 13 ///< Total number of known file formats.
|
||||
#define NB_FORMATS_LOAD 13 ///< Number of file formats that grafx2 can load.
|
||||
#define NB_FORMATS_SAVE 13 ///< Number of file formats that grafx2 can save.
|
||||
#define NB_KNOWN_FORMATS 15 ///< Total number of known file formats.
|
||||
#define NB_FORMATS_LOAD 15 ///< Number of file formats that grafx2 can load.
|
||||
#define NB_FORMATS_SAVE 15 ///< Number of file formats that grafx2 can save.
|
||||
#else
|
||||
// Without pnglib
|
||||
#define NB_KNOWN_FORMATS 12 ///< Total number of known file formats.
|
||||
#define NB_FORMATS_LOAD 12 ///< Number of file formats that grafx2 can load.
|
||||
#define NB_FORMATS_SAVE 12 ///< Number of file formats that grafx2 can save.
|
||||
#define NB_KNOWN_FORMATS 14 ///< Total number of known file formats.
|
||||
#define NB_FORMATS_LOAD 14 ///< Number of file formats that grafx2 can load.
|
||||
#define NB_FORMATS_SAVE 14 ///< Number of file formats that grafx2 can save.
|
||||
#endif
|
||||
|
||||
/// List of file formats recognized by grafx2
|
||||
@ -114,8 +119,10 @@ enum FILE_FORMATS
|
||||
FORMAT_PI1,
|
||||
FORMAT_PC1,
|
||||
FORMAT_CEL,
|
||||
FORMAT_NEO,
|
||||
FORMAT_KCF,
|
||||
FORMAT_PAL,
|
||||
FORMAT_C64,
|
||||
FORMAT_PNG
|
||||
};
|
||||
|
||||
@ -209,7 +216,8 @@ enum PAINTBRUSH_SHAPES
|
||||
PAINTBRUSH_SHAPE_MISC, ///< A raw monochrome bitmap, can't be resized. This must be the last of the preset paintbrush types.
|
||||
PAINTBRUSH_SHAPE_POINT, ///< Used to reduce the paintbrush to a single pixel, during operations like colorpicker.
|
||||
PAINTBRUSH_SHAPE_COLOR_BRUSH, ///< User's brush, in color mode
|
||||
PAINTBRUSH_SHAPE_MONO_BRUSH ///< User's brush, in mono mode
|
||||
PAINTBRUSH_SHAPE_MONO_BRUSH, ///< User's brush, in mono mode
|
||||
PAINTBRUSH_SHAPE_MAX ///< Upper limit.
|
||||
};
|
||||
|
||||
/// Normal resting state for a menu button.
|
||||
@ -241,7 +249,7 @@ enum CHUNKS_CFG
|
||||
CHUNK_MAX
|
||||
};
|
||||
|
||||
/// Identifiers for the 8x8 icons of ::GFX_icon_sprite (these are unused now)
|
||||
/// Identifiers for the 8x8 icons of ::Gfx->Icon_sprite (most are unused now)
|
||||
enum ICON_TYPES
|
||||
{
|
||||
ICON_FLOPPY_3_5=0, ///< 3½" Floppy disk
|
||||
@ -271,7 +279,6 @@ enum BUTTON_NUMBERS
|
||||
BUTTON_CIRCLES,
|
||||
BUTTON_FILLCIRC,
|
||||
BUTTON_GRADRECT,
|
||||
BUTTON_GRADMENU,
|
||||
BUTTON_SPHERES,
|
||||
BUTTON_BRUSH,
|
||||
BUTTON_POLYBRUSH,
|
||||
@ -374,8 +381,33 @@ enum SPECIAL_ACTIONS
|
||||
SPECIAL_SMOOTH_MODE,
|
||||
SPECIAL_SMOOTH_MENU,
|
||||
SPECIAL_SMEAR_MODE,
|
||||
SPECIAL_EFFECTS_OFF,
|
||||
SPECIAL_TILING_MODE,
|
||||
SPECIAL_TRANSPARENCY_1,
|
||||
SPECIAL_TRANSPARENCY_2,
|
||||
SPECIAL_TRANSPARENCY_3,
|
||||
SPECIAL_TRANSPARENCY_4,
|
||||
SPECIAL_TRANSPARENCY_5,
|
||||
SPECIAL_TRANSPARENCY_6,
|
||||
SPECIAL_TRANSPARENCY_7,
|
||||
SPECIAL_TRANSPARENCY_8,
|
||||
SPECIAL_TRANSPARENCY_9,
|
||||
SPECIAL_TRANSPARENCY_0,
|
||||
SPECIAL_TILING_MENU, ///< This must be the last of the "effects" family
|
||||
SPECIAL_ZOOM_1,
|
||||
SPECIAL_ZOOM_2,
|
||||
SPECIAL_ZOOM_3,
|
||||
SPECIAL_ZOOM_4,
|
||||
SPECIAL_ZOOM_5,
|
||||
SPECIAL_ZOOM_6,
|
||||
SPECIAL_ZOOM_8,
|
||||
SPECIAL_ZOOM_10,
|
||||
SPECIAL_ZOOM_12,
|
||||
SPECIAL_ZOOM_14,
|
||||
SPECIAL_ZOOM_16,
|
||||
SPECIAL_ZOOM_18,
|
||||
SPECIAL_ZOOM_20,
|
||||
SPECIAL_SHOW_GRID,
|
||||
NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts
|
||||
};
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ executable; You can normally find it in a packed archive whose name begins by
|
||||
the Subversion repository:
|
||||
http://grafx2.googlecode.com/svn/trunk/
|
||||
or you can find the latest versions as packed archives:
|
||||
http://code.google.com/p/grafx2/downloads/list
|
||||
http://code.google.com/p/grafx2/wiki/Downloads
|
||||
|
||||
=== COMPILING ===
|
||||
|
||||
@ -76,17 +76,18 @@ Sends greetings and glops to pouet.net : http://pouet.net/prod.php?which=51865
|
||||
=== HISTORY ===
|
||||
|
||||
Short revision history :
|
||||
* 06/2009 2.0 Completed the features planned by Sunset Design.
|
||||
* 04/2009 2.0b99.0% Many new features and critical fixes.
|
||||
* 01/2009 2.0b98.0% Now running Linux, Windows, Mac OS X, BeOS, Haiku,
|
||||
AmigaOS 3.x and 4, MorphOS, SkyOS and gp2x.
|
||||
* 10/2008 2.0b97.0% Our first public beta release.
|
||||
* 07/2008 Our first public alpha release, Windows and Linux only
|
||||
* 04/2007 Start of this project and port to SDL.
|
||||
* 2001 Sunset Design releases the source under the GNU GPL.
|
||||
* 12/1999 2.0b96.5% Last release from Sunset Design.
|
||||
* 11/1996 2.0b90% First public release, at the Wired'96.
|
||||
* 09/1995 Project starts.
|
||||
* 09/2009 2.1 GUI improvements and some new features.
|
||||
* 06/2009 2.0 Completed the features planned by Sunset Design.
|
||||
* 04/2009 2.0b99.0% Many new features and critical fixes.
|
||||
* 01/2009 2.0b98.0% Now running Linux, Windows, Mac OS X, BeOS, Haiku,
|
||||
AmigaOS 3.x and 4, MorphOS, SkyOS and gp2x.
|
||||
* 10/2008 2.0b97.0% Our first public beta release.
|
||||
* 07/2008 Our first public alpha release, Windows and Linux only
|
||||
* 04/2007 Start of this project and port to SDL.
|
||||
* 2001 Sunset Design releases the source under the GNU GPL.
|
||||
* 12/1999 2.0b96.5% Last release from Sunset Design.
|
||||
* 11/1996 2.0b90% First public release, at the Wired'96.
|
||||
* 09/1995 Project starts.
|
||||
|
||||
Check http://code.google.com/p/grafx2/source/list for (very) detailed changelog.
|
||||
Check http://code.google.com/p/grafx2/wiki/History for an overview of the new
|
||||
|
||||
708
engine.c
@ -75,8 +75,7 @@ char * Menu_tooltip[NB_BUTTONS]=
|
||||
"Filled rectangles ",
|
||||
"Empty circles / ellipses",
|
||||
"Filled circles / ellips.",
|
||||
"Grad. rectangles ",
|
||||
"Gradation menu ",
|
||||
"Grad. rect / Grad. menu ",
|
||||
"Grad. spheres / ellipses",
|
||||
"Brush grab. / Restore ",
|
||||
"Lasso / Restore brush ",
|
||||
@ -89,13 +88,13 @@ char * Menu_tooltip[NB_BUTTONS]=
|
||||
"Go / Copy to other page ",
|
||||
"Save as / Save ",
|
||||
"Load / Re-load ",
|
||||
"Settings ",
|
||||
"Settings / Skins ",
|
||||
"Clear / with backcolor ",
|
||||
"Help / Statistics ",
|
||||
"Undo / Redo ",
|
||||
"Kill current page ",
|
||||
"Quit ",
|
||||
"Palette editor ",
|
||||
"Palette editor / setup ",
|
||||
"Scroll pal. bkwd / Fast ",
|
||||
"Scroll pal. fwd / Fast ",
|
||||
"Color #" ,
|
||||
@ -108,6 +107,7 @@ void Save_background(byte **buffer, int x_pos, int y_pos, int width, int height)
|
||||
int index;
|
||||
if(*buffer != NULL) DEBUG("WARNING : buffer already allocated !!!",0);
|
||||
*buffer=(byte *) malloc(width*Menu_factor_X*height*Menu_factor_Y*Pixel_width);
|
||||
if(*buffer==NULL) Error(0);
|
||||
for (index=0; index<(height*Menu_factor_Y); index++)
|
||||
Read_line(x_pos,y_pos+index,width*Menu_factor_X,(*buffer)+((int)index*width*Menu_factor_X*Pixel_width));
|
||||
}
|
||||
@ -119,6 +119,7 @@ void Restore_background(byte *buffer, int x_pos, int y_pos, int width, int heigh
|
||||
for (index=0; index<height*Menu_factor_Y; index++)
|
||||
Display_line_fast(x_pos,y_pos+index,width*Menu_factor_X,buffer+((int)index*width*Menu_factor_X*Pixel_width));
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
|
||||
///Draw a pixel in a saved screen block (when you sort colors in the palette, for example)
|
||||
@ -211,74 +212,74 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
|
||||
case BUTTON_SHAPE_RECTANGLE :
|
||||
// On colorie le point haut droit
|
||||
Pixel_in_menu(end_x,start_y,color_diagonal);
|
||||
GFX_menu_block[start_y][end_x]=color_diagonal;
|
||||
Gfx->Menu_block[start_y][end_x]=color_diagonal;
|
||||
// On colorie le point bas gauche
|
||||
Pixel_in_menu(start_x,end_y,color_diagonal);
|
||||
GFX_menu_block[end_y][start_x]=color_diagonal;
|
||||
Gfx->Menu_block[end_y][start_x]=color_diagonal;
|
||||
// On colorie la partie haute
|
||||
for (x_pos=start_x;x_pos<=end_x-1;x_pos++)
|
||||
{
|
||||
Pixel_in_menu(x_pos,start_y,color_top_left);
|
||||
GFX_menu_block[start_y][x_pos]=color_top_left;
|
||||
Gfx->Menu_block[start_y][x_pos]=color_top_left;
|
||||
}
|
||||
for (y_pos=start_y+1;y_pos<=end_y-1;y_pos++)
|
||||
{
|
||||
// On colorie la partie gauche
|
||||
Pixel_in_menu(start_x,y_pos,color_top_left);
|
||||
GFX_menu_block[y_pos][start_x]=color_top_left;
|
||||
Gfx->Menu_block[y_pos][start_x]=color_top_left;
|
||||
// On colorie la partie droite
|
||||
Pixel_in_menu(end_x,y_pos,color_bottom_right);
|
||||
GFX_menu_block[y_pos][end_x]=color_bottom_right;
|
||||
Gfx->Menu_block[y_pos][end_x]=color_bottom_right;
|
||||
}
|
||||
// On colorie la partie basse
|
||||
for (x_pos=start_x+1;x_pos<=end_x;x_pos++)
|
||||
{
|
||||
Pixel_in_menu(x_pos,end_y,color_bottom_right);
|
||||
GFX_menu_block[end_y][x_pos]=color_bottom_right;
|
||||
Gfx->Menu_block[end_y][x_pos]=color_bottom_right;
|
||||
}
|
||||
break;
|
||||
case BUTTON_SHAPE_TRIANGLE_TOP_LEFT:
|
||||
// On colorie le point haut droit
|
||||
Pixel_in_menu(end_x,start_y,color_diagonal);
|
||||
GFX_menu_block[start_y][end_x]=color_diagonal;
|
||||
Gfx->Menu_block[start_y][end_x]=color_diagonal;
|
||||
// On colorie le point bas gauche
|
||||
Pixel_in_menu(start_x,end_y,color_diagonal);
|
||||
GFX_menu_block[end_y][start_x]=color_diagonal;
|
||||
Gfx->Menu_block[end_y][start_x]=color_diagonal;
|
||||
// On colorie le coin haut gauche
|
||||
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu(start_x+x_pos,start_y,color_top_left);
|
||||
GFX_menu_block[start_y][start_x+x_pos]=color_top_left;
|
||||
Gfx->Menu_block[start_y][start_x+x_pos]=color_top_left;
|
||||
Pixel_in_menu(start_x,start_y+x_pos,color_top_left);
|
||||
GFX_menu_block[start_y+x_pos][start_x]=color_top_left;
|
||||
Gfx->Menu_block[start_y+x_pos][start_x]=color_top_left;
|
||||
}
|
||||
// On colorie la diagonale
|
||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu(start_x+x_pos,end_y-x_pos,color_bottom_right);
|
||||
GFX_menu_block[end_y-x_pos][start_x+x_pos]=color_bottom_right;
|
||||
Gfx->Menu_block[end_y-x_pos][start_x+x_pos]=color_bottom_right;
|
||||
}
|
||||
break;
|
||||
case BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT:
|
||||
// On colorie le point haut droit
|
||||
Pixel_in_menu(end_x,start_y,color_diagonal);
|
||||
GFX_menu_block[start_y][end_x]=color_diagonal;
|
||||
Gfx->Menu_block[start_y][end_x]=color_diagonal;
|
||||
// On colorie le point bas gauche
|
||||
Pixel_in_menu(start_x,end_y,color_diagonal);
|
||||
GFX_menu_block[end_y][start_x]=color_diagonal;
|
||||
Gfx->Menu_block[end_y][start_x]=color_diagonal;
|
||||
// On colorie la diagonale
|
||||
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu(start_x+x_pos,end_y-x_pos,color_top_left);
|
||||
GFX_menu_block[end_y-x_pos][start_x+x_pos]=color_top_left;
|
||||
Gfx->Menu_block[end_y-x_pos][start_x+x_pos]=color_top_left;
|
||||
}
|
||||
// On colorie le coin bas droite
|
||||
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
|
||||
{
|
||||
Pixel_in_menu(end_x-x_pos,end_y,color_bottom_right);
|
||||
GFX_menu_block[end_y][end_x-x_pos]=color_bottom_right;
|
||||
Gfx->Menu_block[end_y][end_x-x_pos]=color_bottom_right;
|
||||
Pixel_in_menu(end_x,end_y-x_pos,color_bottom_right);
|
||||
GFX_menu_block[end_y-x_pos][end_x]=color_bottom_right;
|
||||
Gfx->Menu_block[end_y-x_pos][end_x]=color_bottom_right;
|
||||
}
|
||||
}
|
||||
if (Menu_is_visible)
|
||||
@ -372,6 +373,9 @@ void Select_button(int btn_number,byte click)
|
||||
// the unselection of all "Tool" buttons.
|
||||
if (btn_number==BUTTON_ADJUST && click==RIGHT_SIDE)
|
||||
break;
|
||||
// Same case with the Grad. Rectangle button.
|
||||
if (btn_number==BUTTON_GRADRECT && click==RIGHT_SIDE)
|
||||
break;
|
||||
// Pour chaque bouton:
|
||||
for (b=0; b<NB_BUTTONS; b++)
|
||||
// S'il est de la même famille
|
||||
@ -774,7 +778,7 @@ void Main_handler(void)
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_EXCLUDE_COLORS_MENU : // Exclude colors menu
|
||||
Menu_tag_colors("Tag colors to exclude",Exclude_color,&temp,1, NULL);
|
||||
Menu_tag_colors("Tag colors to exclude",Exclude_color,&temp,1, NULL, SPECIAL_EXCLUDE_COLORS_MENU);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_INVERT_SIEVE :
|
||||
@ -821,6 +825,10 @@ void Main_handler(void)
|
||||
Button_Grid_menu();
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_SHOW_GRID :
|
||||
Button_Show_grid();
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_SIEVE_MODE :
|
||||
Button_Sieve_mode();
|
||||
Key=0;
|
||||
@ -857,6 +865,102 @@ void Main_handler(void)
|
||||
Button_Tiling_menu();
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_EFFECTS_OFF :
|
||||
Effects_off();
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_1 :
|
||||
Transparency_set(1);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_2 :
|
||||
Transparency_set(2);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_3 :
|
||||
Transparency_set(3);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_4 :
|
||||
Transparency_set(4);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_5 :
|
||||
Transparency_set(5);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_6 :
|
||||
Transparency_set(6);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_7 :
|
||||
Transparency_set(7);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_8 :
|
||||
Transparency_set(8);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_9 :
|
||||
Transparency_set(9);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_TRANSPARENCY_0 :
|
||||
Transparency_set(0);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_1 :
|
||||
Zoom_set(-1);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_2 :
|
||||
Zoom_set(0);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_3 :
|
||||
Zoom_set(1);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_4 :
|
||||
Zoom_set(2);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_5 :
|
||||
Zoom_set(3);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_6 :
|
||||
Zoom_set(4);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_8 :
|
||||
Zoom_set(5);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_10 :
|
||||
Zoom_set(6);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_12 :
|
||||
Zoom_set(7);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_14 :
|
||||
Zoom_set(8);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_16 :
|
||||
Zoom_set(9);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_18 :
|
||||
Zoom_set(10);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_20 :
|
||||
Zoom_set(11);
|
||||
Key=0;
|
||||
break;
|
||||
default : // Gestion des touches de raccourci de bouton:
|
||||
// Pour chaque bouton
|
||||
shortcut_button=-1;
|
||||
@ -1132,6 +1236,7 @@ void Close_window(void)
|
||||
T_Scroller_button * temp3;
|
||||
T_Special_button * temp4;
|
||||
T_Dropdown_button * temp5;
|
||||
T_List_button * temp6;
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
@ -1166,6 +1271,12 @@ void Close_window(void)
|
||||
free(Window_dropdown_button_list);
|
||||
Window_dropdown_button_list=temp5;
|
||||
}
|
||||
while (Window_list_button_list)
|
||||
{
|
||||
temp6=Window_list_button_list->Next;
|
||||
free(Window_list_button_list);
|
||||
Window_list_button_list=temp6;
|
||||
}
|
||||
|
||||
if (Windows_open != 1)
|
||||
{
|
||||
@ -1613,6 +1724,42 @@ void Window_dropdown_clear_items(T_Dropdown_button * dropdown)
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------- Create a List control -----------------------
|
||||
// These controls are special. They work over two controls previously created:
|
||||
// - 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 *temp;
|
||||
|
||||
temp=(T_List_button *)malloc(sizeof(T_List_button));
|
||||
temp->Number =++Window_nb_buttons;
|
||||
temp->List_start = 0;
|
||||
temp->Cursor_position = 0;
|
||||
temp->Entry_button = entry_button;
|
||||
temp->Scroller = scroller;
|
||||
temp->Draw_list_item = draw_list_item;
|
||||
|
||||
temp->Next=Window_list_button_list;
|
||||
Window_list_button_list=temp;
|
||||
return temp;
|
||||
}
|
||||
|
||||
void Window_redraw_list(T_List_button * list)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=Min(list->Scroller->Nb_visibles-1, list->Scroller->Nb_elements-1); i>=0; i--)
|
||||
{
|
||||
list->Draw_list_item(
|
||||
list->Entry_button->Pos_X,
|
||||
list->Entry_button->Pos_Y + i * 8,
|
||||
list->List_start + i,
|
||||
i == list->Cursor_position);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------- Ouverture d'un pop-up -----------------------
|
||||
|
||||
void Open_popup(word x_pos, word y_pos, word width,word height)
|
||||
@ -1676,7 +1823,8 @@ void Close_popup(void)
|
||||
T_Palette_button * temp2;
|
||||
T_Scroller_button * temp3;
|
||||
T_Special_button * temp4;
|
||||
T_Dropdown_button * temp5;
|
||||
T_Dropdown_button * temp5;
|
||||
T_List_button * temp6;
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
@ -1711,6 +1859,12 @@ void Close_popup(void)
|
||||
free(Window_dropdown_button_list);
|
||||
Window_dropdown_button_list=temp5;
|
||||
}
|
||||
while (Window_list_button_list)
|
||||
{
|
||||
temp6=Window_list_button_list->Next;
|
||||
free(Window_list_button_list);
|
||||
Window_list_button_list=temp6;
|
||||
}
|
||||
|
||||
if (Windows_open != 1)
|
||||
{
|
||||
@ -1843,6 +1997,7 @@ void Get_color_behind_window(byte * color, byte * click)
|
||||
char str[25];
|
||||
byte cursor_was_hidden;
|
||||
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
cursor_was_hidden=Cursor_hidden;
|
||||
@ -1933,15 +2088,15 @@ void Move_window(short dx, short dy)
|
||||
{
|
||||
short new_x=Mouse_X-dx;
|
||||
short new_y=Mouse_Y-dy;
|
||||
short old_x;
|
||||
short old_y;
|
||||
short width=Window_width*Menu_factor_X;
|
||||
short height=Window_height*Menu_factor_Y;
|
||||
short a;
|
||||
byte b;
|
||||
byte *buffer=NULL;
|
||||
short old_x;
|
||||
short old_y;
|
||||
short width=Window_width*Menu_factor_X;
|
||||
short height=Window_height*Menu_factor_Y;
|
||||
short a;
|
||||
byte b;
|
||||
byte *buffer=NULL;
|
||||
|
||||
Hide_cursor();
|
||||
Hide_cursor();
|
||||
|
||||
Horizontal_XOR_line(new_x,new_y,width);
|
||||
Vertical_XOR_line(new_x,new_y+1,height-2);
|
||||
@ -2179,8 +2334,11 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
|
||||
Window_attribute2=item->Number;
|
||||
if (Button->Display_choice)
|
||||
{
|
||||
// Mettre à jour automatiquement le libellé de la dropdown
|
||||
Print_in_window(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,item->Label,MC_Black,MC_Light);
|
||||
// Automatically update the label of the dropdown list.
|
||||
int text_length = (Button->Width-4-(Button->Display_arrow?8:0))/8;
|
||||
// Clear original label area
|
||||
Window_rectangle(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,text_length*8,8,MC_Light);
|
||||
Print_in_window_limited(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,item->Label,text_length ,MC_Black,MC_Light);
|
||||
}
|
||||
return Button->Number;
|
||||
}
|
||||
@ -2221,7 +2379,7 @@ short Window_normal_button_onclick(word x_pos, word y_pos, word width, word heig
|
||||
}
|
||||
}
|
||||
|
||||
// --- Renvoie le numéro du bouton clicke (-1:hors de la fenêtre, 0:aucun) ---
|
||||
// --- Returns the number of the clicked button (-1:out of the window, 0:none) ---
|
||||
short Window_get_clicked_button(void)
|
||||
{
|
||||
T_Normal_button * temp1;
|
||||
@ -2234,11 +2392,13 @@ short Window_get_clicked_button(void)
|
||||
|
||||
Window_attribute1=Mouse_K;
|
||||
|
||||
// Test du click sur les boutons normaux
|
||||
// Test click on normal buttons
|
||||
for (temp1=Window_normal_button_list; temp1; temp1=temp1->Next)
|
||||
{
|
||||
if (Window_click_in_rectangle(temp1->Pos_X,temp1->Pos_Y,temp1->Pos_X+temp1->Width-1,temp1->Pos_Y+temp1->Height-1))
|
||||
if ((Input_sticky_control == 0 || Input_sticky_control == temp1->Number)
|
||||
&& Window_click_in_rectangle(temp1->Pos_X,temp1->Pos_Y,temp1->Pos_X+temp1->Width-1,temp1->Pos_Y+temp1->Height-1))
|
||||
{
|
||||
Input_sticky_control = temp1->Number;
|
||||
if (temp1->Repeatable)
|
||||
{
|
||||
Hide_cursor();
|
||||
@ -2254,135 +2414,145 @@ short Window_get_clicked_button(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Test du click sur les zones "palette"
|
||||
// Test click on "Palette" buttons
|
||||
for (temp2=Window_palette_button_list; temp2; temp2=temp2->Next)
|
||||
{
|
||||
if (Window_click_in_rectangle(temp2->Pos_X+5,temp2->Pos_Y+3,temp2->Pos_X+160,temp2->Pos_Y+82))
|
||||
if ((Input_sticky_control == 0 || Input_sticky_control == temp2->Number)
|
||||
&& Window_click_in_rectangle(temp2->Pos_X+5,temp2->Pos_Y+3,temp2->Pos_X+160,temp2->Pos_Y+82))
|
||||
{
|
||||
// On stocke dans Attribut2 le numero de couleur cliqué
|
||||
Input_sticky_control = temp2->Number;
|
||||
// We store the clicked color in Attribute2
|
||||
Window_attribute2 = (((Mouse_X-Window_pos_X)/Menu_factor_X)-(temp2->Pos_X+2)) / 10 * 16 +
|
||||
(((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-(temp2->Pos_Y+3)) / 5;
|
||||
return temp2->Number;
|
||||
}
|
||||
}
|
||||
|
||||
// Test du click sur les barres de défilement
|
||||
// Test click oin slider/scroller bars
|
||||
for (temp3=Window_scroller_button_list; temp3; temp3=temp3->Next)
|
||||
{
|
||||
if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-1))
|
||||
// Button Up arrow
|
||||
if ((Input_sticky_control == 0 || Input_sticky_control == (temp3->Number|1024))
|
||||
&& Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y,temp3->Pos_X+10,temp3->Pos_Y+10))
|
||||
{
|
||||
// Button flèche Haut
|
||||
if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y,temp3->Pos_X+10,temp3->Pos_Y+10))
|
||||
{
|
||||
Hide_cursor();
|
||||
Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
|
||||
Input_sticky_control = temp3->Number | 1024;
|
||||
Hide_cursor();
|
||||
Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
|
||||
|
||||
if (temp3->Position)
|
||||
if (temp3->Position)
|
||||
{
|
||||
temp3->Position--;
|
||||
Window_attribute1=1;
|
||||
Window_attribute2=temp3->Position;
|
||||
Window_draw_slider(temp3);
|
||||
}
|
||||
else
|
||||
Window_attribute1=0;
|
||||
|
||||
Display_cursor();
|
||||
|
||||
Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
|
||||
|
||||
Hide_cursor();
|
||||
Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
|
||||
Display_cursor();
|
||||
|
||||
return (Window_attribute1)? temp3->Number : 0;
|
||||
}
|
||||
|
||||
// Button Down arrow
|
||||
if ((Input_sticky_control == 0 || Input_sticky_control == (temp3->Number|2048))
|
||||
&& Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-1))
|
||||
{
|
||||
Input_sticky_control = temp3->Number | 2048;
|
||||
Hide_cursor();
|
||||
Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
|
||||
|
||||
if (temp3->Position+temp3->Nb_visibles<temp3->Nb_elements)
|
||||
{
|
||||
temp3->Position++;
|
||||
Window_attribute1=2;
|
||||
Window_attribute2=temp3->Position;
|
||||
Window_draw_slider(temp3);
|
||||
}
|
||||
else
|
||||
Window_attribute1=0;
|
||||
|
||||
Display_cursor();
|
||||
|
||||
Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
|
||||
|
||||
Hide_cursor();
|
||||
Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
|
||||
Display_cursor();
|
||||
|
||||
return (Window_attribute1)? temp3->Number : 0;
|
||||
}
|
||||
// Middle slider
|
||||
if ((Input_sticky_control == temp3->Number) || (Input_sticky_control==0 &&
|
||||
Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+12,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-13)))
|
||||
{
|
||||
Input_sticky_control = temp3->Number;
|
||||
if (temp3->Nb_elements>temp3->Nb_visibles)
|
||||
{
|
||||
// If there is enough room to make the cursor move:
|
||||
|
||||
max_slider_height=(temp3->Height-24);
|
||||
|
||||
// Window_attribute2 receives the position of the cursor.
|
||||
Window_attribute2 =(Mouse_Y-Window_pos_Y) / Menu_factor_Y;
|
||||
Window_attribute2-=(temp3->Pos_Y+12+((temp3->Cursor_height-1)>>1));
|
||||
Window_attribute2*=(temp3->Nb_elements-temp3->Nb_visibles);
|
||||
|
||||
if (Window_attribute2<0)
|
||||
Window_attribute2=0;
|
||||
else
|
||||
{
|
||||
temp3->Position--;
|
||||
Window_attribute1=1;
|
||||
Window_attribute2=temp3->Position;
|
||||
Window_attribute2 =Round_div(Window_attribute2,max_slider_height-temp3->Cursor_height);
|
||||
if (Window_attribute2+temp3->Nb_visibles>temp3->Nb_elements)
|
||||
Window_attribute2=temp3->Nb_elements-temp3->Nb_visibles;
|
||||
}
|
||||
|
||||
// If the cursor moved
|
||||
|
||||
if (temp3->Position!=Window_attribute2)
|
||||
{
|
||||
temp3->Position=Window_attribute2;
|
||||
Window_attribute1=3;
|
||||
Hide_cursor();
|
||||
Window_draw_slider(temp3);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
Window_attribute1=0;
|
||||
|
||||
Display_cursor();
|
||||
|
||||
Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
|
||||
|
||||
Hide_cursor();
|
||||
Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
// Button flèche Bas
|
||||
if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-1))
|
||||
{
|
||||
Hide_cursor();
|
||||
Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
|
||||
|
||||
if (temp3->Position+temp3->Nb_visibles<temp3->Nb_elements)
|
||||
{
|
||||
temp3->Position++;
|
||||
Window_attribute1=2;
|
||||
Window_attribute2=temp3->Position;
|
||||
Window_draw_slider(temp3);
|
||||
}
|
||||
else
|
||||
Window_attribute1=0;
|
||||
|
||||
Display_cursor();
|
||||
|
||||
Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
|
||||
|
||||
Hide_cursor();
|
||||
Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
// Jauge
|
||||
if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+12,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-13))
|
||||
{
|
||||
if (temp3->Nb_elements>temp3->Nb_visibles)
|
||||
{
|
||||
// S'il y a la place de faire scroller le curseur:
|
||||
|
||||
max_slider_height=(temp3->Height-24);
|
||||
|
||||
// Window_attribute2 reçoit la position dans la jauge correspondant au click
|
||||
Window_attribute2 =(Mouse_Y-Window_pos_Y) / Menu_factor_Y;
|
||||
Window_attribute2-=(temp3->Pos_Y+12+((temp3->Cursor_height-1)>>1));
|
||||
Window_attribute2*=(temp3->Nb_elements-temp3->Nb_visibles);
|
||||
|
||||
if (Window_attribute2<0)
|
||||
Window_attribute2=0;
|
||||
else
|
||||
{
|
||||
Window_attribute2 =Round_div(Window_attribute2,max_slider_height-temp3->Cursor_height);
|
||||
if (Window_attribute2+temp3->Nb_visibles>temp3->Nb_elements)
|
||||
Window_attribute2=temp3->Nb_elements-temp3->Nb_visibles;
|
||||
}
|
||||
|
||||
// Si le curseur de la jauge bouge:
|
||||
|
||||
if (temp3->Position!=Window_attribute2)
|
||||
{
|
||||
temp3->Position=Window_attribute2;
|
||||
Window_attribute1=3;
|
||||
Hide_cursor();
|
||||
Window_draw_slider(temp3);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
// Si le curseur de la jauge ne bouge pas:
|
||||
Window_attribute1=0;
|
||||
}
|
||||
else
|
||||
// S'il n'y a pas la place de bouger le curseur de la jauge:
|
||||
// If the cursor moved
|
||||
Window_attribute1=0;
|
||||
}
|
||||
else
|
||||
// Le click se situe dans la zone de la jauge mais n'est sur aucune
|
||||
// des 3 parties importantes de la jauge
|
||||
// If there's not enough room to make the cursor move:
|
||||
Window_attribute1=0;
|
||||
|
||||
return (Window_attribute1)? temp3->Number : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Test du click sur une zone spéciale
|
||||
// Test click on a special button
|
||||
for (temp4=Window_special_button_list; temp4; temp4=temp4->Next)
|
||||
{
|
||||
if (Window_click_in_rectangle(temp4->Pos_X,temp4->Pos_Y,temp4->Pos_X+temp4->Width-1,temp4->Pos_Y+temp4->Height-1))
|
||||
return temp4->Number;
|
||||
if ((Input_sticky_control == 0 || Input_sticky_control == temp4->Number)
|
||||
&& Window_click_in_rectangle(temp4->Pos_X,temp4->Pos_Y,temp4->Pos_X+temp4->Width-1,temp4->Pos_Y+temp4->Height-1))
|
||||
{
|
||||
Input_sticky_control = temp4->Number;
|
||||
return temp4->Number;
|
||||
}
|
||||
}
|
||||
|
||||
// Test du click sur une dropdown
|
||||
// Test click on a dropdown box
|
||||
for (temp5=Window_dropdown_button_list; temp5; temp5=temp5->Next)
|
||||
{
|
||||
if (Window_click_in_rectangle(temp5->Pos_X,temp5->Pos_Y,temp5->Pos_X+temp5->Width-1,temp5->Pos_Y+temp5->Height-1))
|
||||
if ((Input_sticky_control == 0 || Input_sticky_control == temp5->Number)
|
||||
&& Window_click_in_rectangle(temp5->Pos_X,temp5->Pos_Y,temp5->Pos_X+temp5->Width-1,temp5->Pos_Y+temp5->Height-1))
|
||||
{
|
||||
Input_sticky_control = temp5->Number;
|
||||
if (Mouse_K & temp5->Active_button)
|
||||
return Window_dropdown_on_click(temp5);
|
||||
else
|
||||
@ -2441,6 +2611,24 @@ short Window_get_button_shortcut(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Handle arrow keys, end/home, and mouse wheel that have
|
||||
// a certain behavior if a list control is present.
|
||||
if (Window_list_button_list)
|
||||
{
|
||||
T_List_button *list = Window_list_button_list;
|
||||
// If there's more than one of such control, only capture
|
||||
// events if the mouse cursor is over it.
|
||||
if (list->Next)
|
||||
{
|
||||
// to do
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2450,31 +2638,275 @@ short Window_clicked_button(void)
|
||||
|
||||
if(!Get_input())SDL_Delay(20);
|
||||
|
||||
// Gestion des clicks
|
||||
// Handle clicks
|
||||
if (Mouse_K)
|
||||
{
|
||||
if ((Mouse_X<Window_pos_X) || (Mouse_Y<Window_pos_Y)
|
||||
|| (Mouse_X>=Window_pos_X+(Window_width*Menu_factor_X))
|
||||
|| (Mouse_Y>=Window_pos_Y+(Window_height*Menu_factor_Y)))
|
||||
return -1;
|
||||
{
|
||||
if (Input_sticky_control == 0 || Input_sticky_control == -1)
|
||||
{
|
||||
Input_sticky_control = -1;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Input_sticky_control && Mouse_Y < Window_pos_Y+(12*Menu_factor_Y))
|
||||
{
|
||||
Move_window(Mouse_X-Window_pos_X,Mouse_Y-Window_pos_Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Mouse_Y < Window_pos_Y+(12*Menu_factor_Y))
|
||||
Move_window(Mouse_X-Window_pos_X,Mouse_Y-Window_pos_Y);
|
||||
else
|
||||
return Window_get_clicked_button();
|
||||
short clicked_button;
|
||||
T_List_button * list;
|
||||
|
||||
// Check which controls was clicked (by rectangular area)
|
||||
clicked_button = Window_get_clicked_button();
|
||||
|
||||
// Check if it's part of a list control
|
||||
for (list=Window_list_button_list; list!=NULL; list=list->Next)
|
||||
{
|
||||
if (list->Entry_button->Number == clicked_button)
|
||||
{
|
||||
// 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
|
||||
return 0;
|
||||
|
||||
Hide_cursor();
|
||||
// Redraw one item as disabled
|
||||
if (list->Cursor_position>=0 && list->Cursor_position<list->Scroller->Nb_visibles)
|
||||
list->Draw_list_item(
|
||||
list->Entry_button->Pos_X,
|
||||
list->Entry_button->Pos_Y + list->Cursor_position * 8,
|
||||
list->List_start + list->Cursor_position,
|
||||
0);
|
||||
list->Cursor_position = clicked_line;
|
||||
// Redraw one item as enabled
|
||||
if (list->Cursor_position>=0 && list->Cursor_position<list->Scroller->Nb_visibles)
|
||||
list->Draw_list_item(
|
||||
list->Entry_button->Pos_X,
|
||||
list->Entry_button->Pos_Y + list->Cursor_position * 8,
|
||||
list->List_start + list->Cursor_position,
|
||||
1);
|
||||
Display_cursor();
|
||||
|
||||
// Store the selected value as attribute2
|
||||
Window_attribute2=list->List_start + list->Cursor_position;
|
||||
// Return the control ID of the list.
|
||||
return list->Number;
|
||||
}
|
||||
else if (list->Scroller->Number == clicked_button)
|
||||
{
|
||||
// Click in the scroller part of a list
|
||||
if (list->List_start == list->Scroller->Position)
|
||||
return 0; // Didn't actually move
|
||||
// Update scroller indices
|
||||
list->Cursor_position += list->List_start;
|
||||
list->List_start = list->Scroller->Position;
|
||||
list->Cursor_position -= list->List_start;
|
||||
// Need to redraw all
|
||||
Hide_cursor();
|
||||
Window_redraw_list(list);
|
||||
Display_cursor();
|
||||
}
|
||||
}
|
||||
return clicked_button;
|
||||
}
|
||||
}
|
||||
|
||||
// Gestion des touches
|
||||
// Intercept keys
|
||||
if (Key)
|
||||
{
|
||||
T_List_button * list;
|
||||
|
||||
Button=Window_get_button_shortcut();
|
||||
if (Button)
|
||||
{
|
||||
Key=0;
|
||||
return Button;
|
||||
}
|
||||
// Check if there's a list control and the keys can control it
|
||||
for (list=Window_list_button_list; list!=NULL; list=list->Next)
|
||||
{
|
||||
// FIXME: Make only one list have the keyboard focus.
|
||||
if (1)
|
||||
{
|
||||
if (Key==SDLK_UP && (list->Cursor_position+list->List_start)>0)
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
list->Cursor_position--;
|
||||
if (list->Cursor_position<0)
|
||||
{
|
||||
list->List_start=list->List_start+list->Cursor_position;
|
||||
list->Cursor_position=0;
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
}
|
||||
Window_redraw_list(list);
|
||||
Display_cursor();
|
||||
// Store the selected value as attribute2
|
||||
Window_attribute2=list->List_start + list->Cursor_position;
|
||||
// Return the control ID of the list.
|
||||
return list->Number;
|
||||
}
|
||||
if (Key==SDLK_DOWN && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
list->Cursor_position++;
|
||||
if (list->Cursor_position>(list->Scroller->Nb_visibles-1))
|
||||
{
|
||||
list->List_start=list->List_start+list->Cursor_position-(list->Scroller->Nb_visibles-1);
|
||||
list->Cursor_position=(list->Scroller->Nb_visibles-1);
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
}
|
||||
Window_redraw_list(list);
|
||||
Display_cursor();
|
||||
// Store the selected value as attribute2
|
||||
Window_attribute2=list->List_start + list->Cursor_position;
|
||||
// Return the control ID of the list.
|
||||
return list->Number;
|
||||
}
|
||||
if (Key==SDLK_HOME && (list->Cursor_position!=0 || list->List_start!=0))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
list->Cursor_position=0;
|
||||
list->List_start=0;
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
Window_redraw_list(list);
|
||||
Display_cursor();
|
||||
// Store the selected value as attribute2
|
||||
Window_attribute2=list->List_start + list->Cursor_position;
|
||||
// Return the control ID of the list.
|
||||
return list->Number;
|
||||
}
|
||||
if (Key==SDLK_END && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
list->Cursor_position=(list->Scroller->Nb_elements-1)-list->List_start;
|
||||
if (list->Cursor_position>(list->Scroller->Nb_visibles-1))
|
||||
{
|
||||
list->List_start=list->List_start+list->Cursor_position-(list->Scroller->Nb_visibles-1);
|
||||
list->Cursor_position=(list->Scroller->Nb_visibles-1);
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
}
|
||||
Window_redraw_list(list);
|
||||
Display_cursor();
|
||||
// Store the selected value as attribute2
|
||||
Window_attribute2=list->List_start + list->Cursor_position;
|
||||
// Return the control ID of the list.
|
||||
return list->Number;
|
||||
}
|
||||
if (Key==SDLK_PAGEDOWN && (list->Cursor_position+list->List_start)<(list->Scroller->Nb_elements-1))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
if (list->Scroller->Nb_elements<list->Scroller->Nb_visibles)
|
||||
{
|
||||
list->Cursor_position=list->Scroller->Nb_elements-1;
|
||||
}
|
||||
else if(list->Cursor_position!=list->Scroller->Nb_visibles-1)
|
||||
{
|
||||
list->Cursor_position=list->Scroller->Nb_visibles-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->List_start+=list->Scroller->Nb_visibles;
|
||||
if (list->List_start+list->Scroller->Nb_visibles>list->Scroller->Nb_elements)
|
||||
{
|
||||
list->List_start=list->Scroller->Nb_elements-list->Scroller->Nb_visibles;
|
||||
}
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
}
|
||||
Window_redraw_list(list);
|
||||
Display_cursor();
|
||||
// Store the selected value as attribute2
|
||||
Window_attribute2=list->List_start + list->Cursor_position;
|
||||
// Return the control ID of the list.
|
||||
return list->Number;
|
||||
}
|
||||
if (Key==SDLK_PAGEUP && (list->Cursor_position+list->List_start)>0)
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
if(list->Cursor_position!=0)
|
||||
{
|
||||
list->Cursor_position=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->List_start-=list->Scroller->Nb_visibles;
|
||||
if (list->List_start<0)
|
||||
{
|
||||
list->List_start=0;
|
||||
}
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
}
|
||||
Window_redraw_list(list);
|
||||
Display_cursor();
|
||||
// Store the selected value as attribute2
|
||||
Window_attribute2=list->List_start + list->Cursor_position;
|
||||
// Return the control ID of the list.
|
||||
return list->Number;
|
||||
}
|
||||
if (Key == KEY_MOUSEWHEELUP && list->List_start>0)
|
||||
{
|
||||
list->Cursor_position+=list->List_start;
|
||||
if (list->List_start>=3)
|
||||
list->List_start-=3;
|
||||
else
|
||||
list->List_start=0;
|
||||
list->Cursor_position-=list->List_start;
|
||||
// On affiche à nouveau la liste
|
||||
Hide_cursor();
|
||||
Window_redraw_list(list);
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
Display_cursor();
|
||||
}
|
||||
if (Key==KEY_MOUSEWHEELDOWN && list->List_start<list->Scroller->Nb_elements-list->Scroller->Nb_visibles)
|
||||
{
|
||||
list->Cursor_position+=list->List_start;
|
||||
list->List_start+=3;
|
||||
if (list->List_start+list->Scroller->Nb_visibles>list->Scroller->Nb_elements)
|
||||
{
|
||||
list->List_start=list->Scroller->Nb_elements-list->Scroller->Nb_visibles;
|
||||
}
|
||||
list->Cursor_position-=list->List_start;
|
||||
// On affiche à nouveau la liste
|
||||
Hide_cursor();
|
||||
Window_redraw_list(list);
|
||||
// Mise à jour du scroller
|
||||
list->Scroller->Position=list->List_start;
|
||||
Window_draw_slider(list->Scroller);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
34
engine.h
@ -22,6 +22,11 @@
|
||||
/// Utility functions for the menu and all windows.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __ENGINE_H__
|
||||
#define __ENGINE_H__
|
||||
|
||||
#include "struct.h"
|
||||
|
||||
void Main_handler (void);
|
||||
void Draw_menu_button_frame(byte btn_number,byte pressed);
|
||||
void Unselect_button (int btn_number);
|
||||
@ -33,7 +38,7 @@ void Open_popup (word x_pos, word y_pos, word width, word height);
|
||||
void Close_popup (void);
|
||||
|
||||
void Window_draw_normal_bouton(word x_pos,word y_pos,word width,word height,
|
||||
char * title,byte undersc_letter,byte clickable);
|
||||
char * title,byte undersc_letter,byte clickable);
|
||||
void Window_select_normal_button(word x_pos,word y_pos,word width,word height);
|
||||
void Window_unselect_normal_button(word x_pos,word y_pos,word width,word height);
|
||||
void Window_draw_palette_bouton(word x_pos,word y_pos);
|
||||
@ -60,16 +65,23 @@ void Window_clear_tags(void);
|
||||
void Tag_color_range(byte start,byte end);
|
||||
|
||||
T_Scroller_button * Window_set_scroller_button(word x_pos, word y_pos,
|
||||
word height,
|
||||
word nb_elements,
|
||||
word nb_elements_visible,
|
||||
word initial_position);
|
||||
T_Special_button * Window_set_special_button(word x_pos,word y_pos,word width,word height);
|
||||
T_Special_button * Window_set_input_button(word x_pos,word y_pos,word width_in_characters);
|
||||
T_Dropdown_button * Window_set_dropdown_button(word x_pos,word y_pos,word width,word height,word dropdown_width,const char *label,byte display_choice,byte display_centered,byte display_arrow,byte active_button);
|
||||
void Window_dropdown_add_item(T_Dropdown_button * dropdown, word btn_number, const char *label);
|
||||
word height, word nb_elements, word nb_elements_visible,
|
||||
word initial_position);
|
||||
T_Special_button * Window_set_special_button(word x_pos,word y_pos,word width,
|
||||
word height);
|
||||
T_Special_button * Window_set_input_button(word x_pos,word y_pos,
|
||||
word width_in_characters);
|
||||
T_Dropdown_button * Window_set_dropdown_button(word x_pos,word y_pos,word width,
|
||||
word height,word dropdown_width,const char *label,byte display_choice,
|
||||
byte display_centered,byte display_arrow,byte active_button);
|
||||
void Window_dropdown_add_item(T_Dropdown_button * dropdown, word btn_number,
|
||||
const char *label);
|
||||
void Window_dropdown_clear_items(T_Dropdown_button * dropdown);
|
||||
byte Window_click_in_rectangle(short start_x,short start_y,short end_x,short end_y);
|
||||
T_List_button * Window_set_list_button(T_Special_button * entry_button,
|
||||
T_Scroller_button * scroller, Func_draw_list_item draw_list_item);
|
||||
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);
|
||||
short Wait_click_in_palette(T_Palette_button * button);
|
||||
void Get_color_behind_window(byte * color, byte * click);
|
||||
|
||||
@ -78,3 +90,5 @@ int Button_under_mouse(void);
|
||||
short Window_get_clicked_button(void);
|
||||
void Remap_window_backgrounds(byte * conversion_table, int Min_Y, int Max_Y);
|
||||
void Pixel_background(int x_pos, int y_pos, byte color);
|
||||
|
||||
#endif
|
||||
|
||||
346
filesel.c
@ -64,14 +64,58 @@
|
||||
#define SELECTED_DIRECTORY_COLOR MC_Light // color du texte pour une ligne de repértoire sélectionnée
|
||||
#define SELECTED_BACKGROUND_COLOR MC_Dark // color du fond pour une ligne sélectionnée
|
||||
|
||||
// -- Fileselector data
|
||||
|
||||
T_Fileselector Filelist;
|
||||
|
||||
// Conventions:
|
||||
//
|
||||
// * Le fileselect modifie le répertoire courant. Ceci permet de n'avoir
|
||||
// qu'un findfirst dans le répertoire courant à faire:
|
||||
|
||||
void Recount_files(T_Fileselector *list)
|
||||
{
|
||||
T_Fileselector_item *item;
|
||||
|
||||
// -- Déstruction de la liste chaînée ---------------------------------------
|
||||
void Free_fileselector_list(void)
|
||||
list->Nb_files=0;
|
||||
list->Nb_directories=0;
|
||||
list->Nb_elements=0;
|
||||
|
||||
for (item = list->First; item != NULL; item = item->Next)
|
||||
{
|
||||
if (item->Type == 0)
|
||||
list->Nb_files ++;
|
||||
else
|
||||
list->Nb_directories ++;
|
||||
list->Nb_elements ++;
|
||||
}
|
||||
|
||||
if (list->Index)
|
||||
{
|
||||
free(list->Index);
|
||||
list->Index = NULL;
|
||||
}
|
||||
|
||||
if (list->Nb_elements>0)
|
||||
{
|
||||
int i;
|
||||
|
||||
list->Index = (T_Fileselector_item **) malloc(list->Nb_elements * sizeof(T_Fileselector_item **));
|
||||
if (list->Index)
|
||||
{
|
||||
// Fill the index
|
||||
for (item = list->First, i=0; item != NULL; item = item->Next, i++)
|
||||
{
|
||||
list->Index[i] = item;
|
||||
}
|
||||
}
|
||||
// If the malloc failed, we're probably in trouble, but I don't know
|
||||
// how to recover from that..I'll just make the index bulletproof.
|
||||
}
|
||||
}
|
||||
|
||||
// -- Destruction de la liste chaînée ---------------------------------------
|
||||
void Free_fileselector_list(T_Fileselector *list)
|
||||
// Cette procédure détruit la chaine des fichiers. Elle doit être appelée
|
||||
// avant de rappeler la fonction Read_list_of_files, ainsi qu'en fin de
|
||||
// programme.
|
||||
@ -79,23 +123,19 @@ void Free_fileselector_list(void)
|
||||
// Pointeur temporaire de destruction
|
||||
T_Fileselector_item * temp_item;
|
||||
|
||||
while (Filelist!=NULL)
|
||||
while (list->First!=NULL)
|
||||
{
|
||||
// On mémorise l'adresse du premier élément de la liste
|
||||
temp_item =Filelist;
|
||||
temp_item =list->First;
|
||||
// On fait avancer la tête de la liste
|
||||
Filelist=Filelist->Next;
|
||||
list->First=list->First->Next;
|
||||
// Et on efface l'ancien premier élément de la liste
|
||||
free(temp_item);
|
||||
}
|
||||
Recount_files(list);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Formats a display name for a file, directory, or similar name (drive, volume).
|
||||
/// The returned value is a pointer to a single static buffer of 19 characters
|
||||
/// including the '\0'.
|
||||
char * Format_filename(char * fname, int type)
|
||||
char * Format_filename(const char * fname, int type)
|
||||
{
|
||||
static char result[19];
|
||||
int c;
|
||||
@ -148,7 +188,7 @@ char * Format_filename(char * fname, int type)
|
||||
|
||||
|
||||
// -- Rajouter a la liste des elements de la liste un element ---------------
|
||||
void Add_element_to_list(char * fname, int type)
|
||||
void Add_element_to_list(T_Fileselector *list, const char * fname, int type)
|
||||
// Cette procedure ajoute a la liste chainee un fichier passé en argument.
|
||||
{
|
||||
// Pointeur temporaire d'insertion
|
||||
@ -162,12 +202,12 @@ void Add_element_to_list(char * fname, int type)
|
||||
strcpy(temp_item->Full_name,fname);
|
||||
temp_item->Type = type;
|
||||
|
||||
temp_item->Next =Filelist;
|
||||
temp_item->Next =list->First;
|
||||
temp_item->Previous=NULL;
|
||||
|
||||
if (Filelist!=NULL)
|
||||
Filelist->Previous=temp_item;
|
||||
Filelist=temp_item;
|
||||
if (list->First!=NULL)
|
||||
list->First->Previous=temp_item;
|
||||
list->First=temp_item;
|
||||
}
|
||||
|
||||
// -- Vérification si un fichier a l'extension demandée.
|
||||
@ -203,11 +243,11 @@ int Check_extension(const char *filename, char * filter)
|
||||
|
||||
|
||||
// -- Lecture d'une liste de fichiers ---------------------------------------
|
||||
void Read_list_of_files(byte selected_format)
|
||||
void Read_list_of_files(T_Fileselector *list, byte selected_format)
|
||||
// Cette procédure charge dans la liste chainée les fichiers dont l'extension
|
||||
// correspond au format demandé.
|
||||
{
|
||||
DIR* Repertoire_Courant; //Répertoire courant
|
||||
DIR* current_directory; //Répertoire courant
|
||||
struct dirent* entry; // Structure de lecture des éléments
|
||||
char * filter = "*"; // Extension demandée
|
||||
struct stat Infos_enreg;
|
||||
@ -218,15 +258,13 @@ void Read_list_of_files(byte selected_format)
|
||||
filter = File_formats[selected_format-1].Extension;
|
||||
|
||||
// Ensuite, on vide la liste actuelle:
|
||||
Free_fileselector_list();
|
||||
Free_fileselector_list(list);
|
||||
// Après effacement, il ne reste ni fichier ni répertoire dans la liste
|
||||
Filelist_nb_files=0;
|
||||
Filelist_nb_directories=0;
|
||||
|
||||
// On lit tous les répertoires:
|
||||
current_path=getcwd(NULL,0);
|
||||
Repertoire_Courant=opendir(current_path);
|
||||
while ((entry=readdir(Repertoire_Courant)))
|
||||
current_directory=opendir(current_path);
|
||||
while ((entry=readdir(current_directory)))
|
||||
{
|
||||
// On ignore le répertoire courant
|
||||
if ( !strcmp(entry->d_name, "."))
|
||||
@ -243,8 +281,8 @@ void Read_list_of_files(byte selected_format)
|
||||
!isHidden(entry)))
|
||||
{
|
||||
// On rajoute le répertoire à la liste
|
||||
Add_element_to_list(entry->d_name, 1);
|
||||
Filelist_nb_directories++;
|
||||
Add_element_to_list(list, entry->d_name, 1);
|
||||
list->Nb_directories++;
|
||||
}
|
||||
else if (S_ISREG(Infos_enreg.st_mode) && //Il s'agit d'un fichier
|
||||
(Config.Show_hidden_files || //Il n'est pas caché
|
||||
@ -253,21 +291,21 @@ void Read_list_of_files(byte selected_format)
|
||||
if (Check_extension(entry->d_name, filter))
|
||||
{
|
||||
// On rajoute le fichier à la liste
|
||||
Add_element_to_list(entry->d_name, 0);
|
||||
Filelist_nb_files++;
|
||||
Add_element_to_list(list, entry->d_name, 0);
|
||||
list->Nb_files++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__MORPHOS__) || defined(__AROS__) || defined (__amigaos4__) || defined(__amigaos__)
|
||||
Add_element_to_list("/",1); // on amiga systems, / means parent. And there is no ..
|
||||
Filelist_nb_directories ++;
|
||||
Add_element_to_list(list, "/",1); // on amiga systems, / means parent. And there is no ..
|
||||
list->Nb_directories ++;
|
||||
#endif
|
||||
|
||||
closedir(Repertoire_Courant);
|
||||
closedir(current_directory);
|
||||
free(current_path);
|
||||
|
||||
Filelist_nb_elements=Filelist_nb_directories+Filelist_nb_files;
|
||||
Recount_files(list);
|
||||
}
|
||||
|
||||
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
|
||||
@ -290,14 +328,14 @@ void bstrtostr( BSTR in, STRPTR out, TEXT max )
|
||||
#endif
|
||||
|
||||
// -- Lecture d'une liste de lecteurs / volumes -----------------------------
|
||||
void Read_list_of_drives(void)
|
||||
void Read_list_of_drives(T_Fileselector *list)
|
||||
{
|
||||
|
||||
// Empty the current content of fileselector:
|
||||
Free_fileselector_list();
|
||||
Free_fileselector_list(list);
|
||||
// Reset number of items
|
||||
Filelist_nb_files=0;
|
||||
Filelist_nb_directories=0;
|
||||
list->Nb_files=0;
|
||||
list->Nb_directories=0;
|
||||
|
||||
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
|
||||
{
|
||||
@ -311,8 +349,8 @@ void Read_list_of_drives(void)
|
||||
{
|
||||
bstrtostr( dl->dol_Name, tmp, 254 );
|
||||
strcat( tmp, ":" );
|
||||
Add_element_to_list( tmp, 2 );
|
||||
Filelist_nb_directories++;
|
||||
Add_element_to_list(list, tmp, 2 );
|
||||
list->Nb_directories++;
|
||||
}
|
||||
UnLockDosList( LDF_VOLUMES | LDF_READ );
|
||||
}
|
||||
@ -354,8 +392,8 @@ void Read_list_of_drives(void)
|
||||
break;
|
||||
}
|
||||
drive_name[0]='A'+bit_index;
|
||||
Add_element_to_list(drive_name,2);
|
||||
Filelist_nb_directories++;
|
||||
Add_element_to_list(list, drive_name,2);
|
||||
list->Nb_directories++;
|
||||
drive_index++;
|
||||
}
|
||||
}
|
||||
@ -368,7 +406,7 @@ void Read_list_of_drives(void)
|
||||
|
||||
// Ensuite on utilise read_file_system_list pour compléter
|
||||
|
||||
struct mount_entry* Liste_points_montage;
|
||||
struct mount_entry* mount_points_list;
|
||||
struct mount_entry* next;
|
||||
|
||||
#if defined(__BEOS__) || defined(__HAIKU__)
|
||||
@ -376,42 +414,42 @@ void Read_list_of_drives(void)
|
||||
#else
|
||||
char * home_dir = getenv("HOME");
|
||||
#endif
|
||||
Add_element_to_list("/", 2);
|
||||
Filelist_nb_directories++;
|
||||
Add_element_to_list(list, "/", 2);
|
||||
list->Nb_directories++;
|
||||
if(home_dir)
|
||||
{
|
||||
Add_element_to_list(home_dir, 2);
|
||||
Filelist_nb_directories++;
|
||||
Add_element_to_list(list, home_dir, 2);
|
||||
list->Nb_directories++;
|
||||
}
|
||||
|
||||
Liste_points_montage = read_file_system_list(0);
|
||||
mount_points_list = read_file_system_list(0);
|
||||
|
||||
while(Liste_points_montage != NULL)
|
||||
while(mount_points_list != NULL)
|
||||
{
|
||||
if(Liste_points_montage->me_dummy == 0 && strcmp(Liste_points_montage->me_mountdir,"/") && strcmp(Liste_points_montage->me_mountdir,"/home"))
|
||||
if(mount_points_list->me_dummy == 0 && strcmp(mount_points_list->me_mountdir,"/") && strcmp(mount_points_list->me_mountdir,"/home"))
|
||||
{
|
||||
Add_element_to_list(Liste_points_montage->me_mountdir,2);
|
||||
Filelist_nb_directories++;
|
||||
Add_element_to_list(list, mount_points_list->me_mountdir,2);
|
||||
list->Nb_directories++;
|
||||
}
|
||||
next = Liste_points_montage -> me_next;
|
||||
next = mount_points_list -> me_next;
|
||||
#if !(defined(__macosx__) || defined(__FreeBSD__))
|
||||
free(Liste_points_montage -> me_type);
|
||||
free(mount_points_list -> me_type);
|
||||
#endif
|
||||
free(Liste_points_montage -> me_devname);
|
||||
free(Liste_points_montage -> me_mountdir);
|
||||
free(Liste_points_montage);
|
||||
Liste_points_montage = next;
|
||||
free(mount_points_list -> me_devname);
|
||||
free(mount_points_list -> me_mountdir);
|
||||
free(mount_points_list);
|
||||
mount_points_list = next;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
Filelist_nb_elements=Filelist_nb_directories+Filelist_nb_files;
|
||||
Recount_files(list);
|
||||
}
|
||||
|
||||
|
||||
// -- Tri de la liste des fichiers et répertoires ---------------------------
|
||||
void Sort_list_of_files(void)
|
||||
void Sort_list_of_files(T_Fileselector *list)
|
||||
// Tri la liste chainée existante dans l'ordre suivant:
|
||||
//
|
||||
// * Les répertoires d'abord, dans l'ordre alphabétique de leur nom
|
||||
@ -424,16 +462,15 @@ void Sort_list_of_files(void)
|
||||
T_Fileselector_item * next_item;
|
||||
T_Fileselector_item * next_to_next_item;
|
||||
|
||||
// Avant de trier quoi que ce soit, on vérifie qu'il y ait suffisamment
|
||||
// d'éléments pour qu'il soit possibles qu'ils soient en désordre:
|
||||
if (Filelist_nb_elements>1)
|
||||
// Check there are at least two elements before sorting
|
||||
if (list->First && list->First->Next)
|
||||
{
|
||||
do
|
||||
{
|
||||
// Par défaut, on considère que la liste est triée
|
||||
list_is_sorted=1;
|
||||
|
||||
current_item=Filelist;
|
||||
current_item=list->First;
|
||||
next_item=current_item->Next;
|
||||
|
||||
while ( (current_item!=NULL) && (next_item!=NULL) )
|
||||
@ -478,8 +515,8 @@ void Sort_list_of_files(void)
|
||||
next_to_next_item->Previous=current_item;
|
||||
|
||||
// On fait bien attention à modifier la tête de liste en cas de besoin
|
||||
if (current_item==Filelist)
|
||||
Filelist=next_item;
|
||||
if (current_item==list->First)
|
||||
list->First=next_item;
|
||||
|
||||
// Ensuite, on se prépare à étudier les éléments précédents:
|
||||
current_item=prev_item;
|
||||
@ -499,11 +536,38 @@ void Sort_list_of_files(void)
|
||||
}
|
||||
while (!list_is_sorted);
|
||||
}
|
||||
// Force a recount / re-index
|
||||
Recount_files(list);
|
||||
}
|
||||
|
||||
T_Fileselector_item * Get_item_by_index(T_Fileselector *list, short index)
|
||||
{
|
||||
// Safety
|
||||
if (index >= list->Nb_elements)
|
||||
index=list->Nb_elements-1;
|
||||
|
||||
if (list->Index)
|
||||
{
|
||||
return list->Index[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Index not available.
|
||||
// Can only happen in case of malloc error.
|
||||
// Fall back anyway on iterative search
|
||||
|
||||
T_Fileselector_item * item = list->First;
|
||||
for (;index>0;index--)
|
||||
item = item->Next;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// -- Affichage des éléments de la liste de fichier / répertoire ------------
|
||||
void Display_file_list(short offset_first,short selector_offset)
|
||||
void Display_file_list(T_Fileselector *list, short offset_first,short selector_offset)
|
||||
//
|
||||
// offset_first = Décalage entre le premier fichier visible dans le
|
||||
// sélecteur et le premier fichier de la liste
|
||||
@ -519,12 +583,10 @@ void Display_file_list(short offset_first,short selector_offset)
|
||||
|
||||
|
||||
// On vérifie s'il y a au moins 1 fichier dans la liste:
|
||||
if (Filelist_nb_elements>0)
|
||||
if (list->Nb_elements>0)
|
||||
{
|
||||
// On commence par chercher à pointer sur le premier fichier visible:
|
||||
current_item=Filelist;
|
||||
for (;offset_first>0;offset_first--)
|
||||
current_item=current_item->Next;
|
||||
current_item = Get_item_by_index(list, offset_first);
|
||||
|
||||
// Pour chacun des 10 éléments inscriptibles à l'écran
|
||||
for (index=0;index<10;index++)
|
||||
@ -566,7 +628,7 @@ void Display_file_list(short offset_first,short selector_offset)
|
||||
|
||||
|
||||
// -- Récupérer le libellé d'un élément de la liste -------------------------
|
||||
void Get_selected_item(short offset_first,short selector_offset,char * label,int *type)
|
||||
void Get_selected_item(T_Fileselector *list, short offset_first,short selector_offset,char * label,int *type)
|
||||
//
|
||||
// offset_first = Décalage entre le premier fichier visible dans le
|
||||
// sélecteur et le premier fichier de la liste
|
||||
@ -582,13 +644,11 @@ void Get_selected_item(short offset_first,short selector_offset,char * label,int
|
||||
T_Fileselector_item * current_item;
|
||||
|
||||
// On vérifie s'il y a au moins 1 fichier dans la liste:
|
||||
if (Filelist_nb_elements>0)
|
||||
if (list->Nb_elements>0)
|
||||
{
|
||||
int i;
|
||||
|
||||
current_item=Filelist;
|
||||
for (i=0; i<Filelist_nb_elements && i<(offset_first+selector_offset);i++)
|
||||
current_item=current_item->Next;
|
||||
// On commence par chercher à pointer sur le premier fichier visible:
|
||||
// Ensuite, on saute autant d'éléments que le décalage demandé:
|
||||
current_item = Get_item_by_index(list, offset_first + selector_offset);
|
||||
|
||||
// On recopie la chaîne
|
||||
strcpy(label, current_item->Full_name);
|
||||
@ -605,12 +665,12 @@ void Selector_scroll_down(short * offset_first,short * selector_offset)
|
||||
// Fait scroller vers le bas le sélecteur de fichier... (si possible)
|
||||
{
|
||||
if ( ((*selector_offset)<9)
|
||||
&& ( (*selector_offset)+1 < Filelist_nb_elements ) )
|
||||
&& ( (*selector_offset)+1 < Filelist.Nb_elements ) )
|
||||
// Si la sélection peut descendre
|
||||
Display_file_list(*offset_first,++(*selector_offset));
|
||||
Display_file_list(&Filelist, *offset_first,++(*selector_offset));
|
||||
else // Sinon, descendre la fenêtre (si possible)
|
||||
if ((*offset_first)+10<Filelist_nb_elements)
|
||||
Display_file_list(++(*offset_first),*selector_offset);
|
||||
if ((*offset_first)+10<Filelist.Nb_elements)
|
||||
Display_file_list(&Filelist, ++(*offset_first),*selector_offset);
|
||||
}
|
||||
|
||||
|
||||
@ -619,38 +679,38 @@ void Selector_scroll_up(short * offset_first,short * selector_offset)
|
||||
{
|
||||
if ((*selector_offset)>0)
|
||||
// Si la sélection peut monter
|
||||
Display_file_list(*offset_first,--(*selector_offset));
|
||||
Display_file_list(&Filelist, *offset_first,--(*selector_offset));
|
||||
else // Sinon, monter la fenêtre (si possible)
|
||||
if ((*offset_first)>0)
|
||||
Display_file_list(--(*offset_first),*selector_offset);
|
||||
Display_file_list(&Filelist, --(*offset_first),*selector_offset);
|
||||
}
|
||||
|
||||
|
||||
void Selector_page_down(short * offset_first,short * selector_offset, short lines)
|
||||
{
|
||||
if (Filelist_nb_elements-1>*offset_first+*selector_offset)
|
||||
if (Filelist.Nb_elements-1>*offset_first+*selector_offset)
|
||||
{
|
||||
if (*selector_offset<9)
|
||||
{
|
||||
if (Filelist_nb_elements<10)
|
||||
if (Filelist.Nb_elements<10)
|
||||
{
|
||||
*offset_first=0;
|
||||
*selector_offset=Filelist_nb_elements-1;
|
||||
*selector_offset=Filelist.Nb_elements-1;
|
||||
}
|
||||
else *selector_offset=9;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Filelist_nb_elements>*offset_first+18)
|
||||
if (Filelist.Nb_elements>*offset_first+18)
|
||||
*offset_first+=lines;
|
||||
else
|
||||
{
|
||||
*offset_first=Filelist_nb_elements-10;
|
||||
*offset_first=Filelist.Nb_elements-10;
|
||||
*selector_offset=9;
|
||||
}
|
||||
}
|
||||
}
|
||||
Display_file_list(*offset_first,*selector_offset);
|
||||
Display_file_list(&Filelist, *offset_first,*selector_offset);
|
||||
}
|
||||
|
||||
|
||||
@ -668,29 +728,29 @@ void Selector_page_up(short * offset_first,short * selector_offset, short lines)
|
||||
*offset_first=0;
|
||||
}
|
||||
}
|
||||
Display_file_list(*offset_first,*selector_offset);
|
||||
Display_file_list(&Filelist, *offset_first,*selector_offset);
|
||||
}
|
||||
|
||||
|
||||
void Selector_end(short * offset_first,short * selector_offset)
|
||||
{
|
||||
if (Filelist_nb_elements<10)
|
||||
if (Filelist.Nb_elements<10)
|
||||
{
|
||||
*offset_first=0;
|
||||
*selector_offset=Filelist_nb_elements-1;
|
||||
*selector_offset=Filelist.Nb_elements-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*offset_first=Filelist_nb_elements-10;
|
||||
*offset_first=Filelist.Nb_elements-10;
|
||||
*selector_offset=9;
|
||||
}
|
||||
Display_file_list(*offset_first,*selector_offset);
|
||||
Display_file_list(&Filelist, *offset_first,*selector_offset);
|
||||
}
|
||||
|
||||
|
||||
void Selector_home(short * offset_first,short * selector_offset)
|
||||
{
|
||||
Display_file_list((*offset_first)=0,(*selector_offset)=0);
|
||||
Display_file_list(&Filelist, (*offset_first)=0,(*selector_offset)=0);
|
||||
}
|
||||
|
||||
|
||||
@ -705,8 +765,8 @@ short Compute_click_offset_in_fileselector(void)
|
||||
short computed_offset;
|
||||
|
||||
computed_offset=(((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-95)>>3;
|
||||
if (computed_offset>=Filelist_nb_elements)
|
||||
computed_offset=Filelist_nb_elements-1;
|
||||
if (computed_offset>=Filelist.Nb_elements)
|
||||
computed_offset=Filelist.Nb_elements-1;
|
||||
|
||||
return computed_offset;
|
||||
}
|
||||
@ -800,22 +860,21 @@ void Print_filename_in_fileselector(void)
|
||||
int Selected_type; // Utilisé pour mémoriser le type d'entrée choisi
|
||||
// dans le selecteur de fichier.
|
||||
|
||||
void Prepare_and_display_filelist(short Position, short offset,
|
||||
T_Scroller_button * button)
|
||||
void Prepare_and_display_filelist(short Position, short offset, T_Scroller_button * button)
|
||||
{
|
||||
button->Nb_elements=Filelist_nb_elements;
|
||||
button->Nb_elements=Filelist.Nb_elements;
|
||||
button->Position=Position;
|
||||
Compute_slider_cursor_height(button);
|
||||
Window_draw_slider(button);
|
||||
// On efface les anciens noms de fichier:
|
||||
Window_rectangle(8-1,95-1,144+2,80+2,MC_Black);
|
||||
// On affiche les nouveaux:
|
||||
Display_file_list(Position,offset);
|
||||
Display_file_list(&Filelist, Position,offset);
|
||||
|
||||
Update_window_area(8-1,95-1,144+2,80+2);
|
||||
|
||||
// On récupère le nom du schmilblick à "accéder"
|
||||
Get_selected_item(Position,offset,Main_filename,&Selected_type);
|
||||
Get_selected_item(&Filelist, Position,offset,Main_filename,&Selected_type);
|
||||
// On affiche le nouveau nom de fichier
|
||||
Print_filename_in_fileselector();
|
||||
// On affiche le nom du répertoire courant
|
||||
@ -825,8 +884,8 @@ void Prepare_and_display_filelist(short Position, short offset,
|
||||
|
||||
void Reload_list_of_files(byte filter, T_Scroller_button * button)
|
||||
{
|
||||
Read_list_of_files(filter);
|
||||
Sort_list_of_files();
|
||||
Read_list_of_files(&Filelist, filter);
|
||||
Sort_list_of_files(&Filelist);
|
||||
//
|
||||
// Check and fix the fileselector positions, because
|
||||
// the directory content may have changed.
|
||||
@ -834,20 +893,20 @@ void Reload_list_of_files(byte filter, T_Scroller_button * button)
|
||||
// Make the offset absolute
|
||||
Main_fileselector_offset += Main_fileselector_position;
|
||||
// Ensure it's within limits
|
||||
if (Main_fileselector_offset >= Filelist_nb_elements)
|
||||
if (Main_fileselector_offset >= Filelist.Nb_elements)
|
||||
{
|
||||
Main_fileselector_offset = Filelist_nb_elements-1;
|
||||
Main_fileselector_offset = Filelist.Nb_elements-1;
|
||||
}
|
||||
// Ensure the position doesn't show "too many files"
|
||||
if (Main_fileselector_position!=0 && Main_fileselector_position>(Filelist_nb_elements-10))
|
||||
if (Main_fileselector_position!=0 && Main_fileselector_position>(Filelist.Nb_elements-10))
|
||||
{
|
||||
if (Filelist_nb_elements<10)
|
||||
if (Filelist.Nb_elements<10)
|
||||
{
|
||||
Main_fileselector_position=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main_fileselector_position=Filelist_nb_elements-10;
|
||||
Main_fileselector_position=Filelist.Nb_elements-10;
|
||||
}
|
||||
}
|
||||
// Restore the offset as relative to the position.
|
||||
@ -870,7 +929,7 @@ void Scroll_fileselector(T_Scroller_button * file_scroller)
|
||||
Window_draw_slider(file_scroller);
|
||||
}
|
||||
// On récupére le nom du schmilblick à "accéder"
|
||||
Get_selected_item(Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
if (strcmp(old_filename,Main_filename))
|
||||
New_preview_is_needed=1;
|
||||
|
||||
@ -880,12 +939,12 @@ void Scroll_fileselector(T_Scroller_button * file_scroller)
|
||||
}
|
||||
|
||||
|
||||
short Find_file_in_fileselector(char * fname)
|
||||
short Find_file_in_fileselector(T_Fileselector *list, char * fname)
|
||||
{
|
||||
T_Fileselector_item * current_item;
|
||||
short index;
|
||||
|
||||
for (index=0, current_item=Filelist;
|
||||
for (index=0, current_item=list->First;
|
||||
((current_item!=NULL) && (strcmp(current_item->Full_name,fname)));
|
||||
index++,current_item=current_item->Next);
|
||||
|
||||
@ -897,18 +956,18 @@ void Highlight_file(char * fname)
|
||||
{
|
||||
short index;
|
||||
|
||||
index=Find_file_in_fileselector(fname);
|
||||
index=Find_file_in_fileselector(&Filelist, fname);
|
||||
|
||||
if ((Filelist_nb_elements<=10) || (index<5))
|
||||
if ((Filelist.Nb_elements<=10) || (index<5))
|
||||
{
|
||||
Main_fileselector_position=0;
|
||||
Main_fileselector_offset=index;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index>=Filelist_nb_elements-5)
|
||||
if (index>=Filelist.Nb_elements-5)
|
||||
{
|
||||
Main_fileselector_position=Filelist_nb_elements-10;
|
||||
Main_fileselector_position=Filelist.Nb_elements-10;
|
||||
Main_fileselector_offset=index-Main_fileselector_position;
|
||||
}
|
||||
else
|
||||
@ -920,18 +979,16 @@ void Highlight_file(char * fname)
|
||||
}
|
||||
|
||||
|
||||
char FFF_best_name[MAX_PATH_CHARACTERS];
|
||||
char * Find_filename_match(char * fname)
|
||||
char * Find_filename_match(T_Fileselector *list, char * fname)
|
||||
{
|
||||
char * best_name_ptr;
|
||||
T_Fileselector_item * current_item;
|
||||
byte matching_letters=0;
|
||||
byte counter;
|
||||
|
||||
strcpy(FFF_best_name,Main_filename);
|
||||
best_name_ptr=NULL;
|
||||
|
||||
for (current_item=Filelist; current_item!=NULL; current_item=current_item->Next)
|
||||
for (current_item=list->First; current_item!=NULL; current_item=current_item->Next)
|
||||
{
|
||||
if ( (!Config.Find_file_fast)
|
||||
|| (Config.Find_file_fast==(current_item->Type+1)) )
|
||||
@ -941,7 +998,6 @@ char * Find_filename_match(char * fname)
|
||||
if (counter>matching_letters)
|
||||
{
|
||||
matching_letters=counter;
|
||||
strcpy(FFF_best_name,current_item->Full_name);
|
||||
best_name_ptr=current_item->Full_name;
|
||||
}
|
||||
}
|
||||
@ -974,6 +1030,12 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
char quicksearch_filename[MAX_PATH_CHARACTERS]="";
|
||||
char save_filename[MAX_PATH_CHARACTERS];
|
||||
char * most_matching_filename;
|
||||
short window_shortcut;
|
||||
|
||||
if (image)
|
||||
window_shortcut = load?(0x100+BUTTON_LOAD):(0x100+BUTTON_SAVE);
|
||||
else
|
||||
window_shortcut = load?SPECIAL_LOAD_BRUSH:SPECIAL_SAVE_BRUSH;
|
||||
|
||||
initial_palette=(T_Components *)malloc(sizeof(T_Palette));
|
||||
memcpy(initial_palette,Main_palette,sizeof(T_Palette));
|
||||
@ -1140,12 +1202,12 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
break;
|
||||
|
||||
case 3 : // Delete
|
||||
if (Filelist_nb_elements && (*Main_filename!='.') && Selected_type!=2)
|
||||
if (Filelist.Nb_elements && (*Main_filename!='.') && Selected_type!=2)
|
||||
{
|
||||
char * message;
|
||||
Hide_cursor();
|
||||
// On affiche une demande de confirmation
|
||||
if (Main_fileselector_position+Main_fileselector_offset>=Filelist_nb_directories)
|
||||
if (Main_fileselector_position+Main_fileselector_offset>=Filelist.Nb_directories)
|
||||
{
|
||||
message="Delete file ?";
|
||||
}
|
||||
@ -1156,7 +1218,7 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
if (Confirmation_box(message))
|
||||
{
|
||||
// Si c'est un fichier
|
||||
if (Main_fileselector_position+Main_fileselector_offset>=Filelist_nb_directories)
|
||||
if (Main_fileselector_position+Main_fileselector_offset>=Filelist.Nb_directories)
|
||||
// On efface le fichier (si on peut)
|
||||
temp=(!remove(Main_filename));
|
||||
else // Si c'est un repertoire
|
||||
@ -1166,7 +1228,7 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
if (temp) // temp indique si l'effacement s'est bien passé
|
||||
{
|
||||
// On remonte si c'était le dernier élément de la liste
|
||||
if (Main_fileselector_position+Main_fileselector_offset==Filelist_nb_elements-1)
|
||||
if (Main_fileselector_position+Main_fileselector_offset==Filelist.Nb_elements-1)
|
||||
{
|
||||
if (Main_fileselector_position)
|
||||
Main_fileselector_position--;
|
||||
@ -1177,7 +1239,7 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
else // Si ce n'était pas le dernier, il faut faire gaffe à ce
|
||||
{ // que ses copains d'en dessous ne remontent pas trop.
|
||||
if ( (Main_fileselector_position)
|
||||
&& (Main_fileselector_position+10==Filelist_nb_elements) )
|
||||
&& (Main_fileselector_position+10==Filelist.Nb_elements) )
|
||||
{
|
||||
Main_fileselector_position--;
|
||||
Main_fileselector_offset++;
|
||||
@ -1214,11 +1276,11 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
Main_fileselector_offset=temp;
|
||||
|
||||
// On récupére le nom du schmilblick à "accéder"
|
||||
Get_selected_item(Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
// On affiche le nouveau nom de fichier
|
||||
Print_filename_in_fileselector();
|
||||
// On affiche à nouveau la liste
|
||||
Display_file_list(Main_fileselector_position,Main_fileselector_offset);
|
||||
Display_file_list(&Filelist, Main_fileselector_position,Main_fileselector_offset);
|
||||
|
||||
// On vient de changer de nom de fichier, donc on doit s'appreter
|
||||
// a rafficher une preview
|
||||
@ -1231,8 +1293,8 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
// faut mettre le nom de fichier au nom du répertoire. Sinon, dans
|
||||
// certains cas, on risque de sauvegarder avec le nom du fichier
|
||||
// actuel au lieu de changer de répertoire.
|
||||
if (Main_fileselector_position+Main_fileselector_offset<Filelist_nb_directories)
|
||||
Get_selected_item(Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
if (Main_fileselector_position+Main_fileselector_offset<Filelist.Nb_directories)
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
|
||||
has_clicked_ok=1;
|
||||
New_preview_is_needed=1;
|
||||
@ -1247,11 +1309,11 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
Hide_cursor();
|
||||
Main_fileselector_position=Window_attribute2;
|
||||
// On récupére le nom du schmilblick à "accéder"
|
||||
Get_selected_item(Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Main_filename,&Selected_type);
|
||||
// On affiche le nouveau nom de fichier
|
||||
Print_filename_in_fileselector();
|
||||
// On affiche à nouveau la liste
|
||||
Display_file_list(Main_fileselector_position,Main_fileselector_offset);
|
||||
Display_file_list(&Filelist, Main_fileselector_position,Main_fileselector_offset);
|
||||
Display_cursor();
|
||||
New_preview_is_needed=1;
|
||||
*quicksearch_filename=0;
|
||||
@ -1345,8 +1407,8 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
Main_fileselector_position=0;
|
||||
Main_fileselector_offset=0;
|
||||
// Affichage des premiers fichiers visibles:
|
||||
Read_list_of_drives();
|
||||
Sort_list_of_files();
|
||||
Read_list_of_drives(&Filelist);
|
||||
Sort_list_of_files(&Filelist);
|
||||
Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,file_scroller);
|
||||
Display_cursor();
|
||||
New_preview_is_needed=1;
|
||||
@ -1485,7 +1547,7 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
case SDLK_BACKSPACE : // Backspace
|
||||
*quicksearch_filename=0;
|
||||
// Si le choix ".." est bien en tête des propositions...
|
||||
if (!strcmp(Filelist->Full_name,PARENT_DIR))
|
||||
if (!strcmp(Filelist.First->Full_name,PARENT_DIR))
|
||||
{
|
||||
// On va dans le répertoire parent.
|
||||
strcpy(Main_filename,PARENT_DIR);
|
||||
@ -1494,7 +1556,7 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
}
|
||||
Key=0;
|
||||
break;
|
||||
default: // Autre => On se place sur le nom de fichier qui correspond
|
||||
default:
|
||||
if (clicked_button<=0)
|
||||
{
|
||||
if (Is_shortcut(Key,0x100+BUTTON_HELP))
|
||||
@ -1502,12 +1564,18 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
Window_help(load?BUTTON_LOAD:BUTTON_SAVE, NULL);
|
||||
break;
|
||||
}
|
||||
if (Is_shortcut(Key,window_shortcut))
|
||||
{
|
||||
clicked_button=2;
|
||||
break;
|
||||
}
|
||||
// Autre => On se place sur le nom de fichier qui correspond
|
||||
temp=strlen(quicksearch_filename);
|
||||
if (Key_ANSI>= ' ' && Key_ANSI < 255 && temp<50)
|
||||
{
|
||||
quicksearch_filename[temp]=Key_ANSI;
|
||||
quicksearch_filename[temp+1]='\0';
|
||||
most_matching_filename=Find_filename_match(quicksearch_filename);
|
||||
most_matching_filename=Find_filename_match(&Filelist, quicksearch_filename);
|
||||
if ( (most_matching_filename) )
|
||||
{
|
||||
temp=Main_fileselector_position+Main_fileselector_offset;
|
||||
@ -1552,8 +1620,8 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
getcwd(Main_current_directory,256);
|
||||
|
||||
// On lit le nouveau répertoire
|
||||
Read_list_of_files(Main_format);
|
||||
Sort_list_of_files();
|
||||
Read_list_of_files(&Filelist, Main_format);
|
||||
Sort_list_of_files(&Filelist);
|
||||
// On place la barre de sélection sur le répertoire d'où l'on vient
|
||||
Highlight_file(previous_directory);
|
||||
}
|
||||
@ -1614,7 +1682,7 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
|
||||
if (Timer_state==1) // Il faut afficher la preview
|
||||
{
|
||||
if ( (Main_fileselector_position+Main_fileselector_offset>=Filelist_nb_directories) && (Filelist_nb_elements) )
|
||||
if ( (Main_fileselector_position+Main_fileselector_offset>=Filelist.Nb_directories) && (Filelist.Nb_elements) )
|
||||
{
|
||||
strcpy(Main_file_directory,Main_current_directory);
|
||||
|
||||
@ -1661,7 +1729,7 @@ byte Button_Load_or_Save(byte load, byte image)
|
||||
|
||||
Unselect_button((load)?BUTTON_LOAD:BUTTON_SAVE);
|
||||
Display_cursor();
|
||||
Free_fileselector_list();
|
||||
Free_fileselector_list(&Filelist);
|
||||
|
||||
Pixel_load_function=Pixel_load_in_current_screen;
|
||||
|
||||
|
||||
23
filesel.h
@ -21,5 +21,28 @@
|
||||
///@file filesel.h
|
||||
/// Fileselector window, used for loading and saving images and brushes.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __FILESEL_H__
|
||||
#define __FILESEL_H__
|
||||
|
||||
#include "struct.h"
|
||||
|
||||
byte Button_Load_or_Save(byte load, byte image);
|
||||
|
||||
void Add_element_to_list(T_Fileselector *list, const char * fname, int type);
|
||||
///
|
||||
/// Formats a display name for a file, directory, or similar name (drive, volume).
|
||||
/// The returned value is a pointer to a single static buffer of 19 characters
|
||||
/// including the '\0'.
|
||||
char * Format_filename(const char * fname, int type);
|
||||
|
||||
void Free_fileselector_list(T_Fileselector *list);
|
||||
|
||||
void Sort_list_of_files(T_Fileselector *list);
|
||||
|
||||
void Recount_files(T_Fileselector *list);
|
||||
|
||||
T_Fileselector_item * Get_item_by_index(T_Fileselector *list, short index);
|
||||
|
||||
short Find_file_in_fileselector(T_Fileselector *list, char * fname);
|
||||
|
||||
#endif
|
||||
|
||||
54
gfx2def.ini
@ -76,13 +76,6 @@
|
||||
; 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 hidden files and | Afficher les fichiers et répertoires
|
||||
@ -269,12 +262,15 @@
|
||||
Default_window_size = 640,480 ; (default '640,480')
|
||||
|
||||
; This setting allows you merge successive mouse movements into a single
|
||||
; mouse movement. Ideally you should leave it at zero, but if you have an
|
||||
; extremely fast mouse and you see the mouse cursor lagging WHEN YOU'RE NOT
|
||||
; DRAWING, you may want to set it to 1, 2 or more, so that GrafX2 skips small
|
||||
; steps. A very high value (100) guarantees that Grafx2 merges all the mouse
|
||||
; steps into a single one.
|
||||
Merge_movement = 100 ; (default 100)
|
||||
; mouse movement. You should only use it if you are using a mouse which
|
||||
; reports at 200Hz or more, and you experience lag when using discontinuous
|
||||
; hand-drawing with large brushes (this tool tries to paste the brush and
|
||||
; update the screen on each new mouse position) In this case, set this to 2
|
||||
; or more, to ignore some intermediate mouse reports when a more recent one
|
||||
; is present.
|
||||
; Note that with a value superior to 1, you lose precision with continuous
|
||||
; hand-drawing, as intermediate mouse positions are skipped.
|
||||
Merge_movement = 0 ; (default 0)
|
||||
|
||||
; Number of columns in the palette of the menu bar. Can be any number from
|
||||
; 1 to 256. If there is not enough room, the program will display less
|
||||
@ -312,4 +308,36 @@
|
||||
; OS isn't able to do it by itself. (ie: Windows)
|
||||
Window_position = 9999,9999; (Default 9999,9999 which means: NA)
|
||||
|
||||
; This is the time (in milliseconds) between two clicks for Grafx2 to
|
||||
; recognize a double-click. Double-click is used mostly in the palette
|
||||
; area of the menu: double-click a color to open the palette.
|
||||
Double_click_speed = 500; (Default 500)
|
||||
|
||||
; When you press two digit keys in rapid succession (ex: 3 8), Grafx2
|
||||
; sets transparency to 38% (instead of 30% then 80%). This setting
|
||||
; allows you to set the maximum delay between two keypresses for
|
||||
; GrafX2 to recognize them as a combo.
|
||||
Double_key_speed = 500; (Default 500)
|
||||
|
||||
; Name of the skinfile you want to | Nom du fichier skin que vous voulez
|
||||
; use. | utiliser.
|
||||
; Default : (empty to let the program choose)
|
||||
Skin_file =
|
||||
|
||||
; Name of the font file (8x8) you | Nom du fichier police de caractère
|
||||
; want to use. | 8x8 utilisée dans les menus.
|
||||
; Default : (empty to let the program choose)
|
||||
Font_file =
|
||||
|
||||
; This determines the color value for the grid. Each pixel of
|
||||
; the grid will be displayed by XOR-ing the original color with
|
||||
; the value of this setting.
|
||||
; For example, if you always paint 16-color images, you can set it
|
||||
; to 16 so the color of the grid are 16 for 0, 17 for 1, etc.
|
||||
; Then you can set colors 16-31 as lighter/darker variants
|
||||
; of your original palette, resulting in a pretty grid !
|
||||
;
|
||||
; Valid values are 1 to 255.
|
||||
Grid_XOR_color = 255; (Default 255)
|
||||
|
||||
; end of configuration
|
||||
|
||||
85
global.h
@ -63,9 +63,6 @@ GFX2_GLOBAL T_Video_mode Video_mode[MAX_VIDEO_MODES];
|
||||
/// Actual number of video modes in ::Video_mode.
|
||||
GFX2_GLOBAL int Nb_video_modes;
|
||||
|
||||
/// A default 256-color palette.
|
||||
GFX2_GLOBAL T_Palette Default_palette;
|
||||
|
||||
// -- Menu colors
|
||||
|
||||
GFX2_GLOBAL byte MC_Black; ///< Index of color to use as "black" in the GUI menus.
|
||||
@ -81,6 +78,7 @@ GFX2_GLOBAL T_Components Fav_menu_colors[4];
|
||||
GFX2_GLOBAL word Mouse_X; ///< Current mouse cursor position.
|
||||
GFX2_GLOBAL word Mouse_Y; ///< Current mouse cursor position.
|
||||
GFX2_GLOBAL byte Mouse_K; ///< Current mouse buttons state. Bitfield: 1 for RMB, 2 for LMB.
|
||||
GFX2_GLOBAL byte Keyboard_click_allowed; ///< Set to 0 when you edit a textfield so you can use space without exiting it
|
||||
|
||||
/// Helper macro to take only one button when both are pressed (LMB has priority)
|
||||
#define Mouse_K_unique (Mouse_K==0?0:(Mouse_K&1?1:(Mouse_K&2?2:0)))
|
||||
@ -139,14 +137,8 @@ GFX2_GLOBAL byte Cursor_hidden;
|
||||
GFX2_GLOBAL byte Cursor_in_menu;
|
||||
/// Boolean, means the cursor was hovering over a menu GUI element.
|
||||
GFX2_GLOBAL byte Cursor_in_menu_previous;
|
||||
/// X coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_WIDTH
|
||||
GFX2_GLOBAL word Cursor_offset_X[NB_CURSOR_SPRITES];
|
||||
/// Y coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_HEIGHT
|
||||
GFX2_GLOBAL word Cursor_offset_Y[NB_CURSOR_SPRITES];
|
||||
/// Graphic resources for the mouse cursor.
|
||||
GFX2_GLOBAL byte GFX_cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
|
||||
/// Storage for the graphics under the mouse cursor. Used by ::Hide_cursor and ::Display_cursor
|
||||
GFX2_GLOBAL byte CURSOR_BACKGROUND[CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
|
||||
GFX2_GLOBAL byte Cursor_background[CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
|
||||
|
||||
// -- Paintbrush data
|
||||
|
||||
@ -164,18 +156,6 @@ GFX2_GLOBAL byte Paintbrush_hidden;
|
||||
GFX2_GLOBAL short Paintbrush_X;
|
||||
/// Cordinate of the preview paintbrush in image space.
|
||||
GFX2_GLOBAL short Paintbrush_Y;
|
||||
/// Graphic resources for the preset paintbrushes.
|
||||
GFX2_GLOBAL byte GFX_paintbrush_sprite [NB_PAINTBRUSH_SPRITES][PAINTBRUSH_HEIGHT][PAINTBRUSH_WIDTH];
|
||||
/// Width of the preset paintbrushes.
|
||||
GFX2_GLOBAL word Preset_paintbrush_width[NB_PAINTBRUSH_SPRITES];
|
||||
/// Height of the preset paintbrushes.
|
||||
GFX2_GLOBAL word Preset_paintbrush_height[NB_PAINTBRUSH_SPRITES];
|
||||
/// Type of the preset paintbrush: index in enum PAINTBRUSH_SHAPES
|
||||
GFX2_GLOBAL byte Paintbrush_type[NB_PAINTBRUSH_SPRITES];
|
||||
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_width[]/2
|
||||
GFX2_GLOBAL word Preset_paintbrush_offset_X[NB_PAINTBRUSH_SPRITES];
|
||||
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_height[]/2
|
||||
GFX2_GLOBAL word Preset_paintbrush_offset_Y[NB_PAINTBRUSH_SPRITES];
|
||||
/// Pixel data of the current brush
|
||||
GFX2_GLOBAL byte * Paintbrush_sprite;
|
||||
/// Current paintbrush's width
|
||||
@ -548,6 +528,11 @@ GFX2_GLOBAL T_Dropdown_button * Window_stack_dropdown_button_list[8];
|
||||
/// List of dropdown buttons in the topmost window.
|
||||
#define Window_dropdown_button_list Window_stack_dropdown_button_list[Windows_open-1]
|
||||
|
||||
GFX2_GLOBAL T_List_button * Window_stack_list_button_list[8];
|
||||
/// List of list buttons in the topmost window.
|
||||
#define Window_list_button_list Window_stack_list_button_list[Windows_open-1]
|
||||
|
||||
|
||||
|
||||
GFX2_GLOBAL int Window_stack_attribute1[8];
|
||||
///
|
||||
@ -660,6 +645,8 @@ GFX2_GLOBAL byte Stencil[256];
|
||||
|
||||
/// Boolean, true when the Grid mode is active.
|
||||
GFX2_GLOBAL byte Snap_mode;
|
||||
/// Boolean, true when the Grid is displayed in zoomed view.
|
||||
GFX2_GLOBAL byte Show_grid;
|
||||
/// Width of the grid in Grid mode.
|
||||
GFX2_GLOBAL word Snap_width;
|
||||
/// Height of the grid in Grid mode.
|
||||
@ -675,8 +662,6 @@ GFX2_GLOBAL word Snap_offset_Y;
|
||||
GFX2_GLOBAL byte Sieve_mode;
|
||||
/// Sprite of the sieve pattern. It's actually an array of booleans.
|
||||
GFX2_GLOBAL byte Sieve[16][16];
|
||||
/// Preset sieve patterns, stored as binary (one word per line)
|
||||
GFX2_GLOBAL word GFX_sieve_pattern[12][16];
|
||||
/// Width of the sieve pattern, in Sieve mode.
|
||||
GFX2_GLOBAL short Sieve_width;
|
||||
/// Height of the sieve pattern, in Sieve mode.
|
||||
@ -810,40 +795,14 @@ GFX2_GLOBAL byte File_in_command_line;
|
||||
/// Boolean, true if Grafx2 was run with a command-line argument to set a resolution on startup (overrides config)
|
||||
GFX2_GLOBAL byte Resolution_in_command_line;
|
||||
|
||||
// - Graphic skin data
|
||||
// - Graphic
|
||||
|
||||
/// Bitmap data for the menu, a single rectangle.
|
||||
GFX2_GLOBAL byte GFX_menu_block[MENU_HEIGHT][MENU_WIDTH];
|
||||
/// Bitmap data for the icons that are displayed over the menu.
|
||||
GFX2_GLOBAL byte GFX_menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
|
||||
/// Bitmap data for the different "effects" icons.
|
||||
GFX2_GLOBAL byte GFX_effect_sprite[NB_EFFECTS_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
|
||||
/// Bitmap data for the Grafx2 logo that appears on splash screen. All 256 colors allowed.
|
||||
GFX2_GLOBAL byte * GFX_logo_grafx2;
|
||||
/// Bitmap data for the classic 8x8 font used in menus etc.
|
||||
GFX2_GLOBAL byte GFX_system_font[256*8*8];
|
||||
/// Bitmap data for the "fun" 8x8 font used in menus etc.
|
||||
GFX2_GLOBAL byte GFX_fun_font [256*8*8];
|
||||
/// Bitmap data for the 6x8 font used in help screens.
|
||||
GFX2_GLOBAL byte GFX_help_font_norm [256][6][8];
|
||||
/// Bitmap data for the 6x8 font used in help screens ("bold" verstion).
|
||||
GFX2_GLOBAL byte GFX_bold_font [256][6][8];
|
||||
// 12
|
||||
// 34
|
||||
/// Bitmap data for the title font used in help screens. Top-left quarter.
|
||||
GFX2_GLOBAL byte GFX_help_font_t1 [64][6][8];
|
||||
/// Bitmap data for the title font used in help screens. Top-right quarter.
|
||||
GFX2_GLOBAL byte GFX_help_font_t2 [64][6][8];
|
||||
/// Bitmap data for the title font used in help screens. Bottom-left quarter.
|
||||
GFX2_GLOBAL byte GFX_help_font_t3 [64][6][8];
|
||||
/// Bitmap data for the title font used in help screens. Bottom-right quarter.
|
||||
GFX2_GLOBAL byte GFX_help_font_t4 [64][6][8];
|
||||
/// Bitmap data for the small 8x8 icons.
|
||||
GFX2_GLOBAL byte GFX_icon_sprite[NB_ICON_SPRITES][ICON_SPRITE_HEIGHT][ICON_SPRITE_WIDTH];
|
||||
|
||||
/// Pointer to the font selected for menus. It's either ::GFX_system_font or ::GFX_fun_font
|
||||
/// Pointer to the font selected for menus.
|
||||
GFX2_GLOBAL byte * Menu_font;
|
||||
|
||||
/// Pointer to the current active skin.
|
||||
GFX2_GLOBAL T_Gui_skin * Gfx;
|
||||
|
||||
// -- Help data
|
||||
|
||||
/// Index of the ::Help_section shown by the Help screen.
|
||||
@ -873,6 +832,8 @@ GFX2_GLOBAL short Colorpicker_X;
|
||||
/// Position of the colorpicker tool, in image coordinates.
|
||||
GFX2_GLOBAL short Colorpicker_Y;
|
||||
|
||||
/// Brush container
|
||||
GFX2_GLOBAL T_Brush_template Brush_container[BRUSH_CONTAINER_COLUMNS*BRUSH_CONTAINER_ROWS];
|
||||
|
||||
#ifdef GLOBAL_VARIABLES
|
||||
byte CURSOR_FOR_OPERATION[NB_OPERATIONS]=
|
||||
@ -921,21 +882,11 @@ GFX2_GLOBAL short Colorpicker_Y;
|
||||
/// each operation, and for each mouse state (no button,left button,right button)
|
||||
GFX2_GLOBAL struct
|
||||
{
|
||||
byte Hide_cursor; ///< Boolean: Need to hide/unhide cursor during this step
|
||||
Func_action Action; ///< Function to call
|
||||
byte Hide_cursor; ///< Boolean: Need to hide/unhide cursor during this step
|
||||
byte Fast_mouse; ///< Operation should take shortcuts with mouse movements
|
||||
} Operation[NB_OPERATIONS][3][OPERATION_STACK_SIZE];
|
||||
|
||||
// -- Fileselector data
|
||||
|
||||
/// Number of elements in the current fileselector's ::Filelist
|
||||
GFX2_GLOBAL short Filelist_nb_elements;
|
||||
/// Number of files in the current fileselector's ::Filelist
|
||||
GFX2_GLOBAL short Filelist_nb_files;
|
||||
/// Number of directories in the current fileselector's ::Filelist
|
||||
GFX2_GLOBAL short Filelist_nb_directories;
|
||||
/// Head of the linked list for the fileselector.
|
||||
GFX2_GLOBAL T_Fileselector_item * Filelist;
|
||||
|
||||
// -- misc
|
||||
|
||||
///
|
||||
|
||||
269
graph.c
@ -107,6 +107,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
||||
|
||||
if(effective_Y + effective_h > Menu_Y)
|
||||
effective_h = Menu_Y - effective_Y;
|
||||
|
||||
/*
|
||||
SDL_Rect r;
|
||||
r.x=effective_X;
|
||||
@ -136,7 +137,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
||||
}
|
||||
else
|
||||
effective_X += Main_separator_position + SEPARATOR_WIDTH*Menu_factor_X;
|
||||
diff = effective_X+effective_w-Screen_width;
|
||||
diff = effective_X+effective_w-Min(Screen_width, Main_X_zoom+(Main_image_width-Main_magnifier_offset_X)*Main_magnifier_factor);
|
||||
if (diff>0)
|
||||
{
|
||||
effective_w -=diff;
|
||||
@ -153,7 +154,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
||||
return;
|
||||
effective_Y = 0;
|
||||
}
|
||||
diff = effective_Y+effective_h-Menu_Y;
|
||||
diff = effective_Y+effective_h-Min(Menu_Y, (Main_image_height-Main_magnifier_offset_Y)*Main_magnifier_factor);
|
||||
if (diff>0)
|
||||
{
|
||||
effective_h -=diff;
|
||||
@ -161,6 +162,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Très utile pour le debug :)
|
||||
/*SDL_Rect r;
|
||||
r.x=effective_X;
|
||||
@ -169,6 +171,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
||||
r.w=effective_w;
|
||||
SDL_FillRect(Screen_SDL,&r,3);*/
|
||||
|
||||
Redraw_grid(effective_X,effective_Y,effective_w,effective_h);
|
||||
Update_rect(effective_X,effective_Y,effective_w,effective_h);
|
||||
}
|
||||
}
|
||||
@ -468,7 +471,7 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
||||
|
||||
Clear_border(MC_Black); // Requires up-to-date Screen_* and Pixel_*
|
||||
|
||||
// Taille des menus
|
||||
// Set menu size (software zoom)
|
||||
if (Screen_width/320 > Screen_height/200)
|
||||
factor=Screen_height/200;
|
||||
else
|
||||
@ -476,28 +479,32 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
||||
|
||||
switch (Config.Ratio)
|
||||
{
|
||||
case 1: // adapter tout
|
||||
case 1: // Always the biggest possible
|
||||
Menu_factor_X=factor;
|
||||
Menu_factor_Y=factor;
|
||||
break;
|
||||
case 2: // adapter légèrement
|
||||
case 2: // Only keep the aspect ratio
|
||||
Menu_factor_X=factor-1;
|
||||
if (Menu_factor_X<1) Menu_factor_X=1;
|
||||
Menu_factor_Y=factor-1;
|
||||
if (Menu_factor_Y<1) Menu_factor_Y=1;
|
||||
break;
|
||||
default: // ne pas adapter
|
||||
case 0: // Always smallest possible
|
||||
Menu_factor_X=1;
|
||||
Menu_factor_Y=1;
|
||||
break;
|
||||
default: // Stay below some reasonable size
|
||||
Menu_factor_X=Min(factor,abs(Config.Ratio));
|
||||
Menu_factor_Y=Min(factor,abs(Config.Ratio));
|
||||
}
|
||||
if (Pixel_height>Pixel_width && Screen_width>=Menu_factor_X*2*320)
|
||||
Menu_factor_X*=2;
|
||||
else if (Pixel_width>Pixel_height && Screen_height>=Menu_factor_Y*2*200)
|
||||
Menu_factor_Y*=2;
|
||||
|
||||
if (Horizontal_line_buffer)
|
||||
free(Horizontal_line_buffer);
|
||||
Horizontal_line_buffer=(byte *)malloc(Pixel_width*((Screen_width>Main_image_width)?Screen_width:Main_image_width));
|
||||
free(Horizontal_line_buffer);
|
||||
Horizontal_line_buffer=(byte *)malloc(Pixel_width *
|
||||
((Screen_width>Main_image_width)?Screen_width:Main_image_width));
|
||||
|
||||
Set_palette(Main_palette);
|
||||
|
||||
@ -677,6 +684,7 @@ void Get_colors_from_brush(void)
|
||||
Display_all_screen();
|
||||
Display_menu();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
|
||||
Main_image_is_modified=1;
|
||||
}
|
||||
@ -994,7 +1002,18 @@ void Fill_general(byte fill_color)
|
||||
// par l'utilisation de "Display_pixel()", et que les autres... eh bein
|
||||
// on n'y a jamais touché à l'écran les autres: ils sont donc corrects.
|
||||
|
||||
if(Main_magnifier_mode)
|
||||
{
|
||||
short w,h;
|
||||
|
||||
w=Min(Screen_width-Main_X_zoom, (Main_image_width-Main_magnifier_offset_X)*Main_magnifier_factor);
|
||||
h=Min(Menu_Y, (Main_image_height-Main_magnifier_offset_Y)*Main_magnifier_factor);
|
||||
|
||||
Redraw_grid(Main_X_zoom,0,w,h);
|
||||
}
|
||||
|
||||
Update_rect(0,0,0,0);
|
||||
End_of_modification();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1005,11 +1024,32 @@ void Fill_general(byte fill_color)
|
||||
////////////////////////// avec gestion de previews //////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Data used by ::Init_permanent_draw() and ::Pixel_figure_permanent()
|
||||
static Uint32 Permanent_draw_next_refresh=0;
|
||||
static int Permanent_draw_count=0;
|
||||
|
||||
void Init_permanent_draw(void)
|
||||
{
|
||||
Permanent_draw_count = 0;
|
||||
Permanent_draw_next_refresh = SDL_GetTicks() + 100;
|
||||
}
|
||||
|
||||
// Affichage d'un point de façon définitive (utilisation du pinceau)
|
||||
void Pixel_figure_permanent(word x_pos,word y_pos,byte color)
|
||||
{
|
||||
Display_paintbrush(x_pos,y_pos,color,0);
|
||||
Permanent_draw_count ++;
|
||||
|
||||
// Check every 8 pixels
|
||||
if (! (Permanent_draw_count&7))
|
||||
{
|
||||
Uint32 now = SDL_GetTicks();
|
||||
if (now>= Permanent_draw_next_refresh)
|
||||
{
|
||||
Permanent_draw_next_refresh = now+100;
|
||||
Flush_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Affichage d'un point de façon définitive
|
||||
@ -1151,6 +1191,7 @@ void Draw_empty_circle_general(short center_x,short center_y,short radius,byte c
|
||||
void Draw_empty_circle_permanent(short center_x,short center_y,short radius,byte color)
|
||||
{
|
||||
Pixel_figure=Pixel_figure_permanent;
|
||||
Init_permanent_draw();
|
||||
Draw_empty_circle_general(center_x,center_y,radius,color);
|
||||
Update_part_of_screen(center_x - radius, center_y - radius, 2* radius+1, 2*radius+1);
|
||||
}
|
||||
@ -1293,6 +1334,7 @@ void Draw_empty_ellipse_general(short center_x,short center_y,short horizontal_r
|
||||
void Draw_empty_ellipse_permanent(short center_x,short center_y,short horizontal_radius,short vertical_radius,byte color)
|
||||
{
|
||||
Pixel_figure=Pixel_figure_permanent;
|
||||
Init_permanent_draw();
|
||||
Draw_empty_ellipse_general(center_x,center_y,horizontal_radius,vertical_radius,color);
|
||||
Update_part_of_screen(center_x - horizontal_radius, center_y - vertical_radius, 2* horizontal_radius+1, 2*vertical_radius+1);
|
||||
}
|
||||
@ -1356,46 +1398,132 @@ void Draw_filled_ellipse(short center_x,short center_y,short horizontal_radius,s
|
||||
* TRACÉ DE LIGNES *
|
||||
******************/
|
||||
|
||||
void Clamp_coordinates_45_degrees(short ax, short ay, short* bx, short* by)
|
||||
// Modifie bx et by pour que la ligne AXAY - BXBY soit
|
||||
// - une droite horizontale
|
||||
// - une droite verticale
|
||||
// - une droite avec une pente de 45 degrés
|
||||
/// Alters bx and by so the (AX,AY)-(BX,BY) segment becomes either horizontal,
|
||||
/// vertical, 45degrees, or isometrical for pixelart (ie 2:1 ratio)
|
||||
void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
|
||||
{
|
||||
int dx, dy;
|
||||
float tan;
|
||||
int dx, dy;
|
||||
float angle;
|
||||
|
||||
dx = (*bx)-ax;
|
||||
dy = ay- *by; // On prend l'opposée car à l'écran les Y sont positifs en bas, et en maths, positifs en haut
|
||||
dx = *bx-ax;
|
||||
dy = *by-ay;
|
||||
|
||||
if (dx==0) return; // On est en lockx et de toutes façons le X n'a pas bougé, on sort tout de suite pour éviter une méchante division par 0
|
||||
// No mouse move: no need to clamp anything
|
||||
if (dx==0 || dy == 0) return;
|
||||
|
||||
tan = (float)dy/(float)dx;
|
||||
// Determine angle (heading)
|
||||
angle = atan2(dx, dy);
|
||||
|
||||
if (tan <= 0.4142 && tan >= -0.4142)
|
||||
{
|
||||
// Cas 1 : Lock Y
|
||||
*by = ay;
|
||||
}
|
||||
else if ( tan > 0.4142 && tan < 2.4142)
|
||||
{
|
||||
// Cas 2 : dy=dx
|
||||
*by = (*by + ay - dx)/2;
|
||||
*bx = ax + ay - *by;
|
||||
}
|
||||
else if (tan < -0.4142 && tan >= -2.4142)
|
||||
{
|
||||
// Cas 8 : dy = -dx
|
||||
*by = (*by + ay + dx)/2;
|
||||
*bx = ax - ay + *by;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cas 3 : Lock X
|
||||
*bx = ax;
|
||||
}
|
||||
// Get absolute values, useful from now on:
|
||||
//dx=abs(dx);
|
||||
//dy=abs(dy);
|
||||
|
||||
return;
|
||||
// Negative Y
|
||||
if (angle < M_PI*(-15.0/16.0) || angle > M_PI*(15.0/16.0))
|
||||
{
|
||||
*bx=ax;
|
||||
*by=ay + dy;
|
||||
}
|
||||
// Iso close to negative Y
|
||||
else if (angle < M_PI*(-13.0/16.0))
|
||||
{
|
||||
dy=dy | 1; // Round up to next odd number
|
||||
*bx=ax + dy/2;
|
||||
*by=ay + dy;
|
||||
}
|
||||
// 45deg
|
||||
else if (angle < M_PI*(-11.0/16.0))
|
||||
{
|
||||
*by = (*by + ay + dx)/2;
|
||||
*bx = ax - ay + *by;
|
||||
}
|
||||
// Iso close to negative X
|
||||
else if (angle < M_PI*(-9.0/16.0))
|
||||
{
|
||||
dx=dx | 1; // Round up to next odd number
|
||||
*bx=ax + dx;
|
||||
*by=ay + dx/2;
|
||||
}
|
||||
// Negative X
|
||||
else if (angle < M_PI*(-7.0/16.0))
|
||||
{
|
||||
*bx=ax + dx;
|
||||
*by=ay;
|
||||
}
|
||||
// Iso close to negative X
|
||||
else if (angle < M_PI*(-5.0/16.0))
|
||||
{
|
||||
dx=dx | 1; // Round up to next odd number
|
||||
*bx=ax + dx;
|
||||
*by=ay - dx/2;
|
||||
}
|
||||
// 45 degrees
|
||||
else if (angle < M_PI*(-3.0/16.0))
|
||||
{
|
||||
*by = (*by + ay - dx)/2;
|
||||
*bx = ax + ay - *by;
|
||||
}
|
||||
// Iso close to positive Y
|
||||
else if (angle < M_PI*(-1.0/16.0))
|
||||
{
|
||||
dy=dy | 1; // Round up to next odd number
|
||||
*bx=ax - dy/2;
|
||||
*by=ay + dy;
|
||||
}
|
||||
// Positive Y
|
||||
else if (angle < M_PI*(1.0/16.0))
|
||||
{
|
||||
*bx=ax;
|
||||
*by=ay + dy;
|
||||
}
|
||||
// Iso close to positive Y
|
||||
else if (angle < M_PI*(3.0/16.0))
|
||||
{
|
||||
dy=dy | 1; // Round up to next odd number
|
||||
*bx=ax + dy/2;
|
||||
*by=ay + dy;
|
||||
}
|
||||
// 45 degrees
|
||||
else if (angle < M_PI*(5.0/16.0))
|
||||
{
|
||||
*by = (*by + ay + dx)/2;
|
||||
*bx = ax - ay + *by;
|
||||
}
|
||||
// Iso close to positive X
|
||||
else if (angle < M_PI*(7.0/16.0))
|
||||
{
|
||||
dx=dx | 1; // Round up to next odd number
|
||||
*bx=ax + dx;
|
||||
*by=ay + dx/2;
|
||||
}
|
||||
// Positive X
|
||||
else if (angle < M_PI*(9.0/16.0))
|
||||
{
|
||||
*bx=ax + dx;
|
||||
*by=ay;
|
||||
}
|
||||
// Iso close to positive X
|
||||
else if (angle < M_PI*(11.0/16.0))
|
||||
{
|
||||
dx=dx | 1; // Round up to next odd number
|
||||
*bx=ax + dx;
|
||||
*by=ay - dx/2;
|
||||
}
|
||||
// 45 degrees
|
||||
else if (angle < M_PI*(13.0/16.0))
|
||||
{
|
||||
*by = (*by + ay - dx)/2;
|
||||
*bx = ax + ay - *by;
|
||||
}
|
||||
// Iso close to negative Y
|
||||
else //if (angle < M_PI*(15.0/16.0))
|
||||
{
|
||||
dy=dy | 1; // Round up to next odd number
|
||||
*bx=ax - dy/2;
|
||||
*by=ay + dy;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// -- Tracer général d'une ligne ------------------------------------------
|
||||
@ -1407,7 +1535,6 @@ void Draw_line_general(short start_x,short start_y,short end_x,short end_y, byte
|
||||
short i,cumul;
|
||||
short delta_x,delta_y;
|
||||
|
||||
|
||||
x_pos=start_x;
|
||||
y_pos=start_y;
|
||||
|
||||
@ -1471,11 +1598,12 @@ void Draw_line_general(short start_x,short start_y,short end_x,short end_y, byte
|
||||
|
||||
// -- Tracer définitif d'une ligne --
|
||||
|
||||
void Draw_line_permanet(short start_x,short start_y,short end_x,short end_y, byte color)
|
||||
void Draw_line_permanent(short start_x,short start_y,short end_x,short end_y, byte color)
|
||||
{
|
||||
|
||||
int w = end_x-start_x, h = end_y - start_y;
|
||||
Pixel_figure=Pixel_figure_permanent;
|
||||
Init_permanent_draw();
|
||||
Draw_line_general(start_x,start_y,end_x,end_y,color);
|
||||
Update_part_of_screen((start_x<end_x)?start_x:end_x,(start_y<end_y)?start_y:end_y,abs(w)+1,abs(h)+1);
|
||||
}
|
||||
@ -1555,18 +1683,20 @@ void Draw_empty_rectangle(short start_x,short start_y,short end_x,short end_y,by
|
||||
}
|
||||
|
||||
// On trace le rectangle:
|
||||
Init_permanent_draw();
|
||||
|
||||
for (x_pos=start_x;x_pos<=end_x;x_pos++)
|
||||
Display_paintbrush(x_pos,start_y,color,0);
|
||||
{
|
||||
Pixel_figure_permanent(x_pos,start_y,color);
|
||||
Pixel_figure_permanent(x_pos, end_y,color);
|
||||
}
|
||||
|
||||
for (y_pos=start_y+1;y_pos<end_y;y_pos++)
|
||||
{
|
||||
Display_paintbrush(start_x,y_pos,color,0);
|
||||
Display_paintbrush( end_x,y_pos,color,0);
|
||||
Pixel_figure_permanent(start_x,y_pos,color);
|
||||
Pixel_figure_permanent( end_x,y_pos,color);
|
||||
}
|
||||
|
||||
for (x_pos=start_x;x_pos<=end_x;x_pos++)
|
||||
Display_paintbrush(x_pos, end_y,color,0);
|
||||
#if defined(__macosx__) || defined(__FreeBSD__)
|
||||
Update_part_of_screen(start_x,end_x,end_x-start_x,end_y-start_y);
|
||||
#endif
|
||||
@ -1670,6 +1800,7 @@ void Draw_curve_permanent(short x1, short y1,
|
||||
byte color)
|
||||
{
|
||||
Pixel_figure=Pixel_figure_permanent;
|
||||
Init_permanent_draw();
|
||||
Draw_curve_general(x1,y1,x2,y2,x3,y3,x4,y4,color);
|
||||
}
|
||||
|
||||
@ -2685,3 +2816,41 @@ byte Effect_smooth(word x,word y,__attribute__((unused)) byte color)
|
||||
Read_pixel_from_current_screen(x,y); // C'est bien l'écran courant et pas
|
||||
// l'écran feedback car il s'agit de ne
|
||||
} // pas modifier l'écran courant.
|
||||
|
||||
void Horizontal_grid_line(word x_pos,word y_pos,word width)
|
||||
{
|
||||
int x;
|
||||
|
||||
for (x=!(x_pos&1);x<width;x+=2)
|
||||
Pixel(x_pos+x, y_pos, *((y_pos-1)*Pixel_height*VIDEO_LINE_WIDTH+x_pos*Pixel_width+Screen_pixels+x*Pixel_width)^Config.Grid_XOR_color);
|
||||
}
|
||||
|
||||
void Vertical_grid_line(word x_pos,word y_pos,word height)
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y=!(y_pos&1);y<height;y+=2)
|
||||
Pixel(x_pos, y_pos+y, *(Screen_pixels+(x_pos*Pixel_width-1)+(y_pos*Pixel_height+y*Pixel_height)*VIDEO_LINE_WIDTH)^Config.Grid_XOR_color);
|
||||
}
|
||||
|
||||
// Tile Grid
|
||||
void Redraw_grid(short x, short y, unsigned short w, unsigned short h)
|
||||
{
|
||||
int row, col;
|
||||
if (!Show_grid)
|
||||
return;
|
||||
|
||||
row=y+((Snap_height*1000-(y-0)/Main_magnifier_factor-Main_magnifier_offset_Y+Snap_offset_Y-1)%Snap_height)*Main_magnifier_factor+Main_magnifier_factor-1;
|
||||
while (row < y+h)
|
||||
{
|
||||
Horizontal_grid_line(x, row, w);
|
||||
row+= Snap_height*Main_magnifier_factor;
|
||||
}
|
||||
|
||||
col=x+((Snap_width*1000-(x-Main_X_zoom)/Main_magnifier_factor-Main_magnifier_offset_X+Snap_offset_X-1)%Snap_width)*Main_magnifier_factor+Main_magnifier_factor-1;
|
||||
while (col < x+w)
|
||||
{
|
||||
Vertical_grid_line(col, y, h);
|
||||
col+= Snap_width*Main_magnifier_factor;
|
||||
}
|
||||
}
|
||||
6
graph.h
@ -66,9 +66,9 @@ void Draw_empty_ellipse_preview (short center_x,short center_y,short horizontal
|
||||
void Hide_empty_ellipse_preview (short center_x,short center_y,short horizontal_radius,short vertical_radius);
|
||||
void Draw_filled_ellipse (short center_x,short center_y,short horizontal_radius,short vertical_radius,byte color);
|
||||
|
||||
void Clamp_coordinates_45_degrees(short ax, short ay, short* bx, short* by);
|
||||
void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by);
|
||||
void Draw_line_general(short start_x,short start_y,short end_x,short end_y, byte color);
|
||||
void Draw_line_permanet (short start_x,short start_y,short end_x,short end_y,byte color);
|
||||
void Draw_line_permanent (short start_x,short start_y,short end_x,short end_y,byte color);
|
||||
void Draw_line_preview (short start_x,short start_y,short end_x,short end_y,byte color);
|
||||
void Draw_line_preview_xor(short start_x,short start_y,short end_x,short end_y,byte color);
|
||||
void Draw_line_preview_xorback(short start_x,short start_y,short end_x,short end_y,byte color);
|
||||
@ -108,3 +108,5 @@ void Remap_picture(void);
|
||||
extern Func_pixel Pixel_figure;
|
||||
|
||||
void Update_part_of_screen(short x, short y, short width, short height);
|
||||
|
||||
void Redraw_grid(short x, short y, unsigned short w, unsigned short h);
|
||||
|
||||
43
help.c
@ -119,7 +119,7 @@ void Window_set_shortcut(int action_id)
|
||||
while (Ordering[order_index]!=action_id)
|
||||
{
|
||||
order_index++;
|
||||
if (order_index>=134)
|
||||
if (order_index>=NB_SHORTCUTS)
|
||||
{
|
||||
Error(0);
|
||||
return;
|
||||
@ -130,7 +130,7 @@ void Window_set_shortcut(int action_id)
|
||||
while (ConfigKey[config_index].Number!=order_index)
|
||||
{
|
||||
config_index++;
|
||||
if (config_index>=134)
|
||||
if (config_index>=NB_SHORTCUTS)
|
||||
{
|
||||
Error(0);
|
||||
return;
|
||||
@ -278,7 +278,21 @@ void Display_help(void)
|
||||
else if (line_type == 'K')
|
||||
{
|
||||
const char *hyperlink;
|
||||
const char * escaped_percent_pos;
|
||||
// Determine link position:
|
||||
link_position = strstr(line,"%s") - line;
|
||||
// Adjust for any escaped %% that would precede it.
|
||||
escaped_percent_pos = line;
|
||||
do
|
||||
{
|
||||
escaped_percent_pos = strstr(escaped_percent_pos,"%%");
|
||||
if (escaped_percent_pos && escaped_percent_pos - line < link_position)
|
||||
{
|
||||
link_position--;
|
||||
escaped_percent_pos+=2;
|
||||
}
|
||||
} while (escaped_percent_pos);
|
||||
//
|
||||
hyperlink=Keyboard_shortcut_value(Help_section[Current_help_section].Help_table[start_line + line_index].Line_parameter);
|
||||
link_size=strlen(hyperlink);
|
||||
snprintf(buffer, 44, line, hyperlink);
|
||||
@ -309,27 +323,27 @@ void Display_help(void)
|
||||
if (line_type=='T')
|
||||
{
|
||||
if (line[char_index/2]>'_' || line[char_index/2]<' ')
|
||||
char_pixel=&(GFX_help_font_norm['!'][0][0]); // Caractère pas géré
|
||||
char_pixel=&(Gfx->Help_font_norm['!'][0][0]); // Caractère pas géré
|
||||
else if (char_index & 1)
|
||||
char_pixel=&(GFX_help_font_t2[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
char_pixel=&(Gfx->Help_font_t2[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
else
|
||||
char_pixel=&(GFX_help_font_t1[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
char_pixel=&(Gfx->Help_font_t1[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
}
|
||||
else if (line_type=='-')
|
||||
{
|
||||
if (line[char_index/2]>'_' || line[char_index/2]<' ')
|
||||
char_pixel=&(GFX_help_font_norm['!'][0][0]); // Caractère pas géré
|
||||
char_pixel=&(Gfx->Help_font_norm['!'][0][0]); // Caractère pas géré
|
||||
else if (char_index & 1)
|
||||
char_pixel=&(GFX_help_font_t4[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
char_pixel=&(Gfx->Help_font_t4[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
else
|
||||
char_pixel=&(GFX_help_font_t3[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
char_pixel=&(Gfx->Help_font_t3[(unsigned char)(line[char_index/2])-' '][0][0]);
|
||||
}
|
||||
else if (line_type=='S')
|
||||
char_pixel=&(GFX_bold_font[(unsigned char)(line[char_index])][0][0]);
|
||||
char_pixel=&(Gfx->Bold_font[(unsigned char)(line[char_index])][0][0]);
|
||||
else if (line_type=='N' || line_type=='K')
|
||||
char_pixel=&(GFX_help_font_norm[(unsigned char)(line[char_index])][0][0]);
|
||||
char_pixel=&(Gfx->Help_font_norm[(unsigned char)(line[char_index])][0][0]);
|
||||
else
|
||||
char_pixel=&(GFX_help_font_norm['!'][0][0]); // Un garde-fou en cas de probleme
|
||||
char_pixel=&(Gfx->Help_font_norm['!'][0][0]); // Un garde-fou en cas de probleme
|
||||
|
||||
for (x=0;x<6;x++)
|
||||
for (repeat_menu_x_factor=0;repeat_menu_x_factor<Menu_factor_X;repeat_menu_x_factor++)
|
||||
@ -571,11 +585,12 @@ void Window_help(int section, const char *sub_section)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (Is_shortcut(Key,0x100+BUTTON_HELP))
|
||||
clicked_button=1;
|
||||
}
|
||||
while ((clicked_button!=1) && (Key!=SDLK_RETURN));
|
||||
|
||||
if(Key==SDLK_RETURN) Key=0;
|
||||
Key=0;
|
||||
Close_window();
|
||||
Unselect_button(BUTTON_HELP);
|
||||
Display_cursor();
|
||||
@ -684,6 +699,8 @@ void Button_Stats(void)
|
||||
do
|
||||
{
|
||||
clicked_button=Window_clicked_button();
|
||||
if (Is_shortcut(Key,0x200+BUTTON_HELP))
|
||||
clicked_button=1;
|
||||
}
|
||||
while ( (clicked_button!=1) && (Key!=SDLK_RETURN) );
|
||||
|
||||
|
||||
249
helpfile.h
@ -24,7 +24,7 @@
|
||||
///
|
||||
/// Note: The source code is kept on a public website, so keep this in mind
|
||||
/// if you're thinking of putting an e-mail address in there. At least, use
|
||||
/// "\100" instead of @, to help against the most basic email address harversters.
|
||||
/// "\100" instead of @, to help against the most basic email address harvesters.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "const.h" // Uses enumerations BUTTON_NUMBERS and SPECIAL_ACTIONS
|
||||
@ -153,12 +153,13 @@ static const T_Help_table helptable_help[] =
|
||||
HELP_LINK ("Polyfill: %s", 0x100+BUTTON_POLYFILL)
|
||||
HELP_LINK ("Filled polyform: %s", 0x200+BUTTON_POLYFILL)
|
||||
HELP_LINK ("Gradient rectangle: %s", 0x100+BUTTON_GRADRECT)
|
||||
HELP_LINK ("Gradation menu: %s", 0x100+BUTTON_GRADMENU)
|
||||
HELP_LINK ("Gradation menu: %s", 0x200+BUTTON_GRADRECT)
|
||||
HELP_LINK ("Spheres: %s", 0x100+BUTTON_SPHERES)
|
||||
HELP_LINK ("Gradient ellipses: %s", 0x200+BUTTON_SPHERES)
|
||||
HELP_LINK ("Adjust picture: %s", 0x100+BUTTON_ADJUST)
|
||||
HELP_LINK ("Flip picture menu: %s", 0x200+BUTTON_ADJUST)
|
||||
HELP_LINK ("Effects menu: %s", 0x100+BUTTON_EFFECTS)
|
||||
HELP_LINK ("Effects all off %s", SPECIAL_EFFECTS_OFF)
|
||||
HELP_LINK ("Shade mode: %s", SPECIAL_SHADE_MODE)
|
||||
HELP_LINK ("Shade menu: %s", SPECIAL_SHADE_MENU)
|
||||
HELP_LINK ("Quick-shade mode: %s", SPECIAL_QUICK_SHADE_MODE)
|
||||
@ -169,10 +170,21 @@ static const T_Help_table helptable_help[] =
|
||||
HELP_LINK ("Mask menu: %s", SPECIAL_MASK_MENU)
|
||||
HELP_LINK ("Grid mode: %s", SPECIAL_GRID_MODE)
|
||||
HELP_LINK ("Grid menu: %s", SPECIAL_GRID_MENU)
|
||||
HELP_LINK ("Grid view: %s", SPECIAL_SHOW_GRID)
|
||||
HELP_LINK ("Sieve mode: %s", SPECIAL_SIEVE_MODE)
|
||||
HELP_LINK ("Sieve menu: %s", SPECIAL_SIEVE_MENU)
|
||||
HELP_LINK ("Invert Sieve: %s", SPECIAL_INVERT_SIEVE)
|
||||
HELP_LINK ("Colorize mode: %s", SPECIAL_COLORIZE_MODE)
|
||||
HELP_LINK (" At opacity 10%%: %s", SPECIAL_TRANSPARENCY_1)
|
||||
HELP_LINK (" At opacity 20%%: %s", SPECIAL_TRANSPARENCY_2)
|
||||
HELP_LINK (" At opacity 30%%: %s", SPECIAL_TRANSPARENCY_3)
|
||||
HELP_LINK (" At opacity 40%%: %s", SPECIAL_TRANSPARENCY_4)
|
||||
HELP_LINK (" At opacity 50%%: %s", SPECIAL_TRANSPARENCY_5)
|
||||
HELP_LINK (" At opacity 60%%: %s", SPECIAL_TRANSPARENCY_6)
|
||||
HELP_LINK (" At opacity 70%%: %s", SPECIAL_TRANSPARENCY_7)
|
||||
HELP_LINK (" At opacity 80%%: %s", SPECIAL_TRANSPARENCY_8)
|
||||
HELP_LINK (" At opacity 90%%: %s", SPECIAL_TRANSPARENCY_9)
|
||||
HELP_LINK (" At opacity 100%%: %s", SPECIAL_TRANSPARENCY_0)
|
||||
HELP_LINK ("Colorize menu: %s", SPECIAL_COLORIZE_MENU)
|
||||
HELP_LINK ("Smooth mode: %s", SPECIAL_SMOOTH_MODE)
|
||||
HELP_LINK ("Smooth menu: %s", SPECIAL_SMOOTH_MENU)
|
||||
@ -195,10 +207,24 @@ static const T_Help_table helptable_help[] =
|
||||
HELP_LINK ("Rotate brush: %s", SPECIAL_ROTATE_ANY_ANGLE)
|
||||
HELP_LINK ("Pipette: %s", 0x100+BUTTON_COLORPICKER)
|
||||
HELP_LINK ("Swap fore/back color:%s", 0x200+BUTTON_COLORPICKER)
|
||||
HELP_LINK ("Magnifier mode: %s", 0x100+BUTTON_MAGNIFIER)
|
||||
HELP_LINK ("Zoom factor menu: %s", 0x200+BUTTON_MAGNIFIER)
|
||||
HELP_LINK ("Zoom in: %s", SPECIAL_ZOOM_IN)
|
||||
HELP_LINK ("Zoom out: %s", SPECIAL_ZOOM_OUT)
|
||||
HELP_TEXT ("Magnifier mode")
|
||||
HELP_LINK (" Toggle: %s", 0x100+BUTTON_MAGNIFIER)
|
||||
HELP_LINK (" Zoom factor menu: %s", 0x200+BUTTON_MAGNIFIER)
|
||||
HELP_LINK (" Zoom in: %s", SPECIAL_ZOOM_IN)
|
||||
HELP_LINK (" Zoom out: %s", SPECIAL_ZOOM_OUT)
|
||||
HELP_LINK (" 1:1 (off) %s", SPECIAL_ZOOM_1)
|
||||
HELP_LINK (" 2:1 %s", SPECIAL_ZOOM_2)
|
||||
HELP_LINK (" 3:1 %s", SPECIAL_ZOOM_3)
|
||||
HELP_LINK (" 4:1 %s", SPECIAL_ZOOM_4)
|
||||
HELP_LINK (" 5:1 %s", SPECIAL_ZOOM_5)
|
||||
HELP_LINK (" 6:1 %s", SPECIAL_ZOOM_6)
|
||||
HELP_LINK (" 8:1 %s", SPECIAL_ZOOM_8)
|
||||
HELP_LINK (" 10:1 %s", SPECIAL_ZOOM_10)
|
||||
HELP_LINK (" 12:1 %s", SPECIAL_ZOOM_12)
|
||||
HELP_LINK (" 14:1 %s", SPECIAL_ZOOM_14)
|
||||
HELP_LINK (" 16:1 %s", SPECIAL_ZOOM_16)
|
||||
HELP_LINK (" 18:1 %s", SPECIAL_ZOOM_18)
|
||||
HELP_LINK (" 20:1 %s", SPECIAL_ZOOM_20)
|
||||
HELP_LINK ("Brush effects menu: %s", 0x100+BUTTON_BRUSH_EFFECTS)
|
||||
HELP_LINK ("Text: %s", 0x100+BUTTON_TEXT)
|
||||
HELP_LINK ("Resolution menu: %s", 0x100+BUTTON_RESOL)
|
||||
@ -263,85 +289,106 @@ static const T_Help_table helptable_credits[] =
|
||||
//HELP_TEXT ("0----5----0----5----0----5----0----5----0--X")
|
||||
HELP_TITLE(" GRAFX2 IS CREATED BY")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" THE GRAFX2 PROJECT TEAM")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Adrien Destugues (pulkomandy)")
|
||||
HELP_TEXT (" Yves Rizoud (yrizoud)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Got the source back to life in 2006")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" SUNSET DESIGN")
|
||||
HELP_BOLD (" AUTHORS OF GRAFX2.0 BETA 96.5%")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Guillaume Dorme alias \"Robinson\" (code)")
|
||||
HELP_TEXT (" Karl Maritaud alias \"X-Man\" (code&gfx)")
|
||||
//HELP_TEXT ("0----5----0----5----0----5----0----5----0--X")
|
||||
HELP_TEXT (" (k.maritaud\100laposte.net)") // there is an \100 so the line is shorter than it looks
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Re-licensed GrafX2 under the GPL in 2001")
|
||||
HELP_TEXT (" Huge thanks to them for their work !")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" THE GRAFX2 PROJECT TEAM")
|
||||
HELP_BOLD (" OTHER CODE CONTRIBUTORS")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Adrien Destugues (pulkomandy\100gmail.com)")
|
||||
HELP_TEXT (" Yves Rizoud (yrizoud\100gmail.com)")
|
||||
HELP_TEXT (" Karl Bartel")
|
||||
HELP_TEXT (" SFont: bitmap fonts rendering")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Got the source back to life in 2006")
|
||||
HELP_TEXT (" Petter Lindquist")
|
||||
HELP_TEXT (" C64 file and image formats")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" ART")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" GrafX2 logo by Made (www.m4de.com)")
|
||||
HELP_TEXT (" Icons and fonts by X-Man ")
|
||||
HELP_TEXT (" Additional graphics by iLKke")
|
||||
HELP_TITLE(" ART")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Pixelled all the graphics")
|
||||
HELP_TEXT (" Made (www.m4de.com)")
|
||||
HELP_TEXT (" Logo (classic)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" X-Man")
|
||||
HELP_TEXT (" Buttons and fonts (classic)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" iLKke (ilkke.blogspot.com)")
|
||||
HELP_TEXT (" Buttons and logo (modern), extra fonts")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" ...Pixelled all the graphics")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE(" OTHER MACHINES PORTS")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" AMIGA OS 3 PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Artur Jarosik (arturjarosik\100gmail.com)")
|
||||
HELP_TEXT (" Artur Jarosik")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" AMIGA OS 4 PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Peter Gordon (pete\100petergordon.org.uk)")
|
||||
HELP_TEXT (" Peter Gordon (www.petergordon.org.uk)")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" AROS PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Fernando Mastandrea (masta.uy\100gmail.com)")
|
||||
HELP_TEXT (" Markus Weiss (mweiss\100id-architekten.de)")
|
||||
HELP_TEXT (" Fernando Mastandrea (masta.uy)")
|
||||
HELP_TEXT (" Markus Weiss")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" FREEBSD PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Jean-Baptiste Berlioz")
|
||||
HELP_TEXT (" (tobe\100freemind-tobe.com)")
|
||||
HELP_TEXT (" Jean-Baptiste Berlioz (Tobe)")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" HAIKU OS AND BEOS PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Luc Schrijvers (begasus\100skynet.be)")
|
||||
HELP_TEXT (" Luc Schrijvers (Begasus)")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" LINUX BINARIES")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Gentoo : Matteo 'Peach' Pescarin")
|
||||
HELP_TEXT (" Debian : Gürkan Sengün")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" MAC OS X PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Franck Charlet (hitchhikr\100australia.edu)")
|
||||
HELP_TEXT (" Franck Charlet (hitchhikr)")
|
||||
HELP_TEXT (" Per Olofsson (MagerValp)")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" MORPHOS PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Rusback (rusback\100wanadoo.fr)")
|
||||
HELP_TEXT (" Rusback")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" SKYOS PORT")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Luc Schrijvers (begasus\100skynet.be)")
|
||||
HELP_TEXT (" Luc Schrijvers (Begasus)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Made it work on your favourite toaster")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" ... made it work on your favourite toaster")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE(" BUGFINDERS")
|
||||
HELP_TEXT ("")
|
||||
//HELP_TEXT ("0----5----0----5----0----5----0----5----0--X")
|
||||
HELP_TEXT (" BDCIron Ced El Topo ")
|
||||
HELP_TEXT (" fallenblood Frost Grimmy ")
|
||||
HELP_TEXT (" Gürkan Sengün HoraK-FDF iLKke ")
|
||||
HELP_TEXT (" keito kusma Lord Graga ")
|
||||
HELP_TEXT (" MagerValp mind MooZ ")
|
||||
HELP_TEXT (" richienyhus TeeEmCee tempest ")
|
||||
HELP_TEXT (" Timo Kurrpa titus^Rab Tobé ")
|
||||
HELP_TEXT (" 00ai99 00.rgb.studios")
|
||||
HELP_TEXT (" blumunkee BDCIron Ced ")
|
||||
HELP_TEXT (" El Topo fallenblood Frost ")
|
||||
HELP_TEXT (" Grimmy Gürkan Sengün Hatch ")
|
||||
HELP_TEXT (" HoraK-FDF iLKke Jamon ")
|
||||
HELP_TEXT (" keito kusma Lord Graga ")
|
||||
HELP_TEXT (" MagerValp mind MooZ ")
|
||||
HELP_TEXT (" the Peach petter richienyhus ")
|
||||
HELP_TEXT (" tape.wyrm TeeEmCee tempest ")
|
||||
HELP_TEXT (" Timo Kurrpa titus^Rab Tobé ")
|
||||
HELP_TEXT (" 00ai99")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Posted the annoying bug reports.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" ... posted the annoying bug reports.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE(" FILE FORMATS CREDITS")
|
||||
HELP_TEXT ("")
|
||||
@ -358,14 +405,16 @@ static const T_Help_table helptable_credits[] =
|
||||
HELP_TEXT (" SCx : Colorix (?)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE (" OUR HOMEPAGE")
|
||||
HELP_TITLE(" OUR HOMEPAGE")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" http://grafx2.codegoogle.com")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Please report any bug you may find there")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE (" GREETINGS")
|
||||
HELP_TITLE(" GREETINGS")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD ("Pulkomandy:")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" To the Pouet.net BBS posters, the #CPC")
|
||||
HELP_TEXT (" trolls and the bitfellas")
|
||||
@ -373,7 +422,9 @@ static const T_Help_table helptable_credits[] =
|
||||
HELP_TEXT (" To all guys making nice pixelled pictures")
|
||||
HELP_TEXT (" (with or without GrafX2)")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" We send our best regards to...")
|
||||
HELP_BOLD ("Sunset Designs:")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" We send our best regards to...")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Access Filter Pink")
|
||||
HELP_TEXT (" Ace Fiver Pixel")
|
||||
@ -428,21 +479,6 @@ static const T_Help_table helptable_credits[] =
|
||||
HELP_TEXT (" and all #pixel, #demofr and #coders.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE (" SNAIL MAIL")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" (From 2001, current status: unknown)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" GUILLAUME DORME (Robinson)")
|
||||
HELP_TEXT (" 15, rue de l'observatoire")
|
||||
HELP_TEXT (" 87000 LIMOGES (FRANCE)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" KARL MARITAUD (X-Man)")
|
||||
HELP_TEXT (" 10, rue de la Brasserie")
|
||||
HELP_TEXT (" 87000 LIMOGES (FRANCE)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE(" THANKS")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" Some information taken from several docs")
|
||||
HELP_TEXT (" (PCGPE, Intervue, PC Interdit...)")
|
||||
HELP_TEXT (" gave us an invaluable help.")
|
||||
@ -461,7 +497,27 @@ static const T_Help_table helptable_credits[] =
|
||||
HELP_TEXT (" We also would like to thank all the")
|
||||
HELP_TEXT (" people who gave us ideas to improve")
|
||||
HELP_TEXT (" GrafX2.")
|
||||
HELP_TITLE("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE (" SNAIL MAIL")
|
||||
HELP_TEXT ("")
|
||||
//HELP_TEXT ("0----5----0----5----0----5----0----5----0--X")
|
||||
HELP_TEXT (" ADRIEN DESTUGUES (PulkoMandy)")
|
||||
HELP_TEXT (" 3, rue Lapouble")
|
||||
HELP_TEXT (" 64000 PAU")
|
||||
HELP_TEXT (" (Send emails! Welcome in 21th century!)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" GUILLAUME DORME (Robinson)")
|
||||
HELP_TEXT (" 15, rue de l'observatoire")
|
||||
HELP_TEXT (" 87000 LIMOGES (FRANCE)")
|
||||
HELP_TEXT (" (May take some years to get an answer)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" KARL MARITAUD (X-Man)")
|
||||
HELP_TEXT (" 10, rue de la Brasserie")
|
||||
HELP_TEXT (" 87000 LIMOGES (FRANCE)")
|
||||
HELP_TEXT (" (From 2001, current status: unknown)")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
};
|
||||
static const T_Help_table helptable_paintbrush[] =
|
||||
{
|
||||
@ -523,6 +579,18 @@ static const T_Help_table helptable_paintbrush[] =
|
||||
HELP_TEXT ("to the \"miscellaneous\" family and their size")
|
||||
HELP_TEXT ("cannot be modified.")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD ("BRUSH CONTAINER")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("The bottom row, initially showing empty")
|
||||
HELP_TEXT ("buttons, is the brush container. You can")
|
||||
HELP_TEXT ("right-click a button to store the current")
|
||||
HELP_TEXT ("brush in it, and then whenever you need the")
|
||||
HELP_TEXT ("brush back, open this menu again and")
|
||||
HELP_TEXT ("left-click the button.")
|
||||
HELP_TEXT ("The container can memorize resizable brushes")
|
||||
HELP_TEXT ("as well as brushes grabbed from the image.")
|
||||
HELP_TEXT ("Brushes are lost when you exit the program.")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD (" RIGHT CLICK ")
|
||||
HELP_LINK ("(Key:%s)",0x200+BUTTON_PAINTBRUSHES)
|
||||
HELP_TEXT ("")
|
||||
@ -947,6 +1015,7 @@ static const T_Help_table helptable_grad_rect[] =
|
||||
{
|
||||
HELP_TITLE("GRAD RECTANGLE")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD ("LEFT CLICK")
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_GRADRECT)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Selects the rectangle with gradations as")
|
||||
@ -967,12 +1036,10 @@ static const T_Help_table helptable_grad_rect[] =
|
||||
HELP_TEXT ("button. You can press SHIFT to enforce your")
|
||||
HELP_TEXT ("line to be vertical, horizontal, or")
|
||||
HELP_TEXT ("diagonal.")
|
||||
};
|
||||
static const T_Help_table helptable_grad_menu[] =
|
||||
{
|
||||
HELP_TITLE("GRAD MENU")
|
||||
HELP_TEXT ("")
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_GRADMENU)
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD ("RIGHT CLICK")
|
||||
HELP_LINK ("(Key:%s)",0x200+BUTTON_GRADRECT)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Opens a window where you can define the way")
|
||||
HELP_TEXT ("gradations are processed. The different")
|
||||
@ -1447,11 +1514,11 @@ static const T_Help_table helptable_effects[] =
|
||||
HELP_TEXT ("of the same size such as a font or tiles,")
|
||||
HELP_TEXT ("or for drawing figures or grabbing brushes")
|
||||
HELP_TEXT ("with their dimensions multiple of the step")
|
||||
HELP_TEXT ("of the grid.');")
|
||||
HELP_TEXT ("of the grid.")
|
||||
HELP_BOLD ("LEFT CLICK")
|
||||
HELP_LINK ("(Key: %s)", SPECIAL_GRID_MODE)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Switches the Grid mode.")
|
||||
HELP_TEXT ("Switches the Snap-to-grid mode.")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD ("RIGHT CLICK")
|
||||
HELP_LINK ("(Key: %s)", SPECIAL_GRID_MENU)
|
||||
@ -1464,6 +1531,13 @@ static const T_Help_table helptable_effects[] =
|
||||
HELP_TEXT ("- dX,dY: Offsets of the grid.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("The following shortcut hides or shows the")
|
||||
HELP_TEXT ("grid in the magnified view:")
|
||||
HELP_LINK ("%s", SPECIAL_SHOW_GRID)
|
||||
HELP_TEXT ("The grid size will be according to your")
|
||||
HELP_TEXT ("snap-to-grid settings.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE("SIEVE")
|
||||
HELP_TEXT (" This effect allows you, by defining a")
|
||||
HELP_TEXT ("pattern, to draw only on particular points")
|
||||
@ -1524,6 +1598,24 @@ static const T_Help_table helptable_effects[] =
|
||||
HELP_TEXT ("paintbrush with the colors of the picture.")
|
||||
HELP_TEXT ("It's used to make transparency effects like")
|
||||
HELP_TEXT ("with watercolors.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("You can also use the following shortcuts to")
|
||||
HELP_TEXT ("activate transparency mode and assign an")
|
||||
HELP_TEXT ("amount of opacity:")
|
||||
HELP_LINK (" 10%% : %s", SPECIAL_TRANSPARENCY_1)
|
||||
HELP_LINK (" 20%% : %s", SPECIAL_TRANSPARENCY_2)
|
||||
HELP_LINK (" 30%% : %s", SPECIAL_TRANSPARENCY_3)
|
||||
HELP_LINK (" 40%% : %s", SPECIAL_TRANSPARENCY_4)
|
||||
HELP_LINK (" 50%% : %s", SPECIAL_TRANSPARENCY_5)
|
||||
HELP_LINK (" 60%% : %s", SPECIAL_TRANSPARENCY_6)
|
||||
HELP_LINK (" 70%% : %s", SPECIAL_TRANSPARENCY_7)
|
||||
HELP_LINK (" 80%% : %s", SPECIAL_TRANSPARENCY_8)
|
||||
HELP_LINK (" 90%% : %s", SPECIAL_TRANSPARENCY_9)
|
||||
HELP_LINK (" 100%% : %s", SPECIAL_TRANSPARENCY_0)
|
||||
HELP_TEXT ("If you use two of these shortcuts quickly,")
|
||||
HELP_TEXT ("the second will set the units for finer")
|
||||
HELP_TEXT ("control. Ie: 4 5 makes 45%, 0 9 makes 9%.")
|
||||
HELP_TEXT ("")
|
||||
HELP_BOLD ("LEFT CLICK")
|
||||
HELP_LINK ("(Key: %s)", SPECIAL_COLORIZE_MODE)
|
||||
HELP_TEXT ("")
|
||||
@ -1931,10 +2023,6 @@ static const T_Help_table helptable_settings[] =
|
||||
HELP_TEXT ("pages. To flick through these pages, use the")
|
||||
HELP_TEXT ("\"Oops\" button (Undo/Redo).")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("- Font: determines whether you want to use")
|
||||
HELP_TEXT ("GrafX2 with a classical font, or another one")
|
||||
HELP_TEXT ("a bit funnier.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("- Mouse sensibility: Modifies the speed of")
|
||||
HELP_TEXT ("the mouse when you're in fullscreen. With")
|
||||
HELP_TEXT ("the normal setting (slider on top), you may")
|
||||
@ -1978,10 +2066,6 @@ static const T_Help_table helptable_settings[] =
|
||||
HELP_TEXT ("the name of the backup file, no backup file")
|
||||
HELP_TEXT ("will be created (of course!) ;).")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("- Cursor: allows you to choose whether you")
|
||||
HELP_TEXT ("prefer a solid cursor or a transparent")
|
||||
HELP_TEXT ("cursor.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("- Safety colors: Brings back the 4 default")
|
||||
HELP_TEXT ("colors of the menus if you run an operation")
|
||||
HELP_TEXT ("that passes the image in less than four")
|
||||
@ -2031,6 +2115,30 @@ static const T_Help_table helptable_settings[] =
|
||||
HELP_TEXT ("- Save: saves the configuration at once.")
|
||||
HELP_TEXT (" All modifications will be effective just")
|
||||
HELP_TEXT ("after closing the menu.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TITLE("SKINS")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("This window allow you to change the look and")
|
||||
HELP_TEXT ("feel of the program.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("- Font: determines whether you want to use")
|
||||
HELP_TEXT ("GrafX2 with a classical font, or another one")
|
||||
HELP_TEXT ("a bit funnier.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("- Cursor: allows you to choose whether you")
|
||||
HELP_TEXT ("prefer a solid cursor or a transparent")
|
||||
HELP_TEXT ("cursor.")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("- Graphic file: you can change the whole")
|
||||
HELP_TEXT ("interface by selecting where the sprites for")
|
||||
HELP_TEXT ("all buttons are. Look at the files in the")
|
||||
HELP_TEXT ("\"skin\" directory if you want to create your")
|
||||
HELP_TEXT ("own. There are two skins available, the")
|
||||
HELP_TEXT ("default for 2.1 is called modern. Classic is")
|
||||
HELP_TEXT ("for nostalgics who wish to remember the old")
|
||||
HELP_TEXT ("days of Sunset Design. If you create a good")
|
||||
HELP_TEXT ("skin, feel free to share it with us! We may")
|
||||
HELP_TEXT ("include it in a future release...")
|
||||
};
|
||||
static const T_Help_table helptable_clear[] =
|
||||
{
|
||||
@ -2362,7 +2470,6 @@ T_Help_section Help_section[] =
|
||||
HELP_TABLE_DECLARATION(helptable_circles)
|
||||
HELP_TABLE_DECLARATION(helptable_filled_circles)
|
||||
HELP_TABLE_DECLARATION(helptable_grad_rect)
|
||||
HELP_TABLE_DECLARATION(helptable_grad_menu)
|
||||
HELP_TABLE_DECLARATION(helptable_spheres)
|
||||
HELP_TABLE_DECLARATION(helptable_brush)
|
||||
HELP_TABLE_DECLARATION(helptable_polybrush)
|
||||
|
||||
293
hotkeys.c
@ -1094,6 +1094,206 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
|
||||
true,
|
||||
SDLK_PERIOD, // .> (:/ en AZERTY)
|
||||
0},
|
||||
{134,
|
||||
"Effects off",
|
||||
"Turns off all drawing effects. This",
|
||||
"is the same as the 'All off' button",
|
||||
"in the Effects screen",
|
||||
true,
|
||||
SDLK_e|MOD_SHIFT, // Shift-E
|
||||
0},
|
||||
{135,
|
||||
"Transparency 10%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 10%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_1, // 1
|
||||
0},
|
||||
{136,
|
||||
"Transparency 20%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 20%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_2, // 2
|
||||
0},
|
||||
{137,
|
||||
"Transparency 30%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 30%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_3, // 3
|
||||
0},
|
||||
{138,
|
||||
"Transparency 40%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 40%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_4, // 4
|
||||
0},
|
||||
{139,
|
||||
"Transparency 50%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 50%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_5, // 5
|
||||
0},
|
||||
{140,
|
||||
"Transparency 60%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 60%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_6, // 6
|
||||
0},
|
||||
{141,
|
||||
"Transparency 70%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 70%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_7, // 7
|
||||
0},
|
||||
{142,
|
||||
"Transparency 80%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 80%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_8, // 8
|
||||
0},
|
||||
{143,
|
||||
"Transparency 90%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 90%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_9, // 9
|
||||
0},
|
||||
{144,
|
||||
"Transparency 0%",
|
||||
"Turns transparency on and sets its",
|
||||
"opacity at 0%.",
|
||||
"",
|
||||
true,
|
||||
SDLK_0, // 0
|
||||
0},
|
||||
{145,
|
||||
"Zoom 1:1",
|
||||
"Turns magnifier mode off.",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
SDLK_1|MOD_CTRL, /* Ctrl + 1 */
|
||||
0},
|
||||
{146,
|
||||
"Zoom 2:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 2:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_2|MOD_CTRL, /* Ctrl + 2 */
|
||||
0},
|
||||
{147,
|
||||
"Zoom 3:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 3:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_3|MOD_CTRL, /* Ctrl + 3 */
|
||||
0},
|
||||
{148,
|
||||
"Zoom 4:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 4:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_4|MOD_CTRL, /* Ctrl + 4 */
|
||||
0},
|
||||
{149,
|
||||
"Zoom 5:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 5:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_5|MOD_CTRL, /* Ctrl + 5 */
|
||||
0},
|
||||
{150,
|
||||
"Zoom 6:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 6:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_6|MOD_CTRL, /* Ctrl + 6 */
|
||||
0},
|
||||
{151,
|
||||
"Zoom 8:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 8:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_7|MOD_CTRL, /* Ctrl + 7 */
|
||||
0},
|
||||
{152,
|
||||
"Zoom 10:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 10:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_8|MOD_CTRL, /* Ctrl + 8 */
|
||||
0},
|
||||
{153,
|
||||
"Zoom 12:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 12:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{154,
|
||||
"Zoom 14:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 14:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{155,
|
||||
"Zoom 16:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 16:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{156,
|
||||
"Zoom 18:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 18:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{157,
|
||||
"Zoom 20:1",
|
||||
"Turns magnifier mode on and set its",
|
||||
"factor to 20:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{158,
|
||||
"Show/Hide Grid",
|
||||
"Turns on or off the visible grid in ",
|
||||
"the magnified view. Grid cells match",
|
||||
"the size ",
|
||||
true,
|
||||
SDLK_g|MOD_SHIFT|MOD_ALT, // Shift + Alt + G,
|
||||
0},
|
||||
};
|
||||
|
||||
word Ordering[NB_SHORTCUTS]=
|
||||
@ -1116,39 +1316,39 @@ word Ordering[NB_SHORTCUTS]=
|
||||
SPECIAL_MOUSE_RIGHT, // Emulate mouse right
|
||||
SPECIAL_CLICK_LEFT, // Emulate mouse click left
|
||||
SPECIAL_CLICK_RIGHT, // Emulate mouse click right
|
||||
0x100+BUTTON_HIDE, // Show / Hide menu
|
||||
0x100+BUTTON_HIDE, // Show / Hide menu
|
||||
SPECIAL_SHOW_HIDE_CURSOR, // Show / Hide cursor
|
||||
SPECIAL_DOT_PAINTBRUSH, // Paintbrush = "."
|
||||
0x100+BUTTON_PAINTBRUSHES, // Paintbrush choice
|
||||
0x200+BUTTON_PAINTBRUSHES, // Monochrome brush
|
||||
0x100+BUTTON_DRAW, // Freehand drawing
|
||||
0x200+BUTTON_DRAW, // Switch freehand drawing mode
|
||||
SPECIAL_CONTINUOUS_DRAW, // Continuous freehand drawing
|
||||
0x100+BUTTON_LINES, // Line
|
||||
0x200+BUTTON_LINES, // Knotted lines
|
||||
0x100+BUTTON_AIRBRUSH, // Spray
|
||||
0x200+BUTTON_AIRBRUSH, // Spray menu
|
||||
SPECIAL_DOT_PAINTBRUSH, // Paintbrush = "."
|
||||
0x100+BUTTON_PAINTBRUSHES, // Paintbrush choice
|
||||
0x200+BUTTON_PAINTBRUSHES, // Monochrome brush
|
||||
0x100+BUTTON_DRAW, // Freehand drawing
|
||||
0x200+BUTTON_DRAW, // Switch freehand drawing mode
|
||||
SPECIAL_CONTINUOUS_DRAW, // Continuous freehand drawing
|
||||
0x100+BUTTON_LINES, // Line
|
||||
0x200+BUTTON_LINES, // Knotted lines
|
||||
0x100+BUTTON_AIRBRUSH, // Spray
|
||||
0x200+BUTTON_AIRBRUSH, // Spray menu
|
||||
0x100+BUTTON_FLOODFILL, // Floodfill
|
||||
0x200+BUTTON_FLOODFILL, // Replace color
|
||||
0x100+BUTTON_CURVES, // Bézier's curves
|
||||
0x200+BUTTON_CURVES, // Bézier's curve with 3 or 4 points
|
||||
0x100+BUTTON_CURVES, // Bézier's curves
|
||||
0x200+BUTTON_CURVES, // Bézier's curve with 3 or 4 points
|
||||
0x100+BUTTON_RECTANGLES, // Empty rectangle
|
||||
0x100+BUTTON_FILLRECT, // Filled rectangle
|
||||
0x100+BUTTON_CIRCLES, // Empty circle
|
||||
0x200+BUTTON_CIRCLES, // Empty ellipse
|
||||
0x100+BUTTON_FILLCIRC, // Filled circle
|
||||
0x200+BUTTON_FILLCIRC, // Filled ellipse
|
||||
0x100+BUTTON_POLYGONS, // Empty polygon
|
||||
0x200+BUTTON_POLYGONS, // Empty polyform
|
||||
0x100+BUTTON_POLYGONS, // Empty polygon
|
||||
0x200+BUTTON_POLYGONS, // Empty polyform
|
||||
0x100+BUTTON_POLYFILL, // Polyfill
|
||||
0x200+BUTTON_POLYFILL, // Filled polyform
|
||||
0x100+BUTTON_GRADRECT, // Gradient rectangle
|
||||
0x100+BUTTON_GRADMENU, // Gradation menu
|
||||
0x200+BUTTON_GRADRECT, // Gradation menu
|
||||
0x100+BUTTON_SPHERES, // Spheres
|
||||
0x200+BUTTON_SPHERES, // Gradient ellipses
|
||||
0x100+BUTTON_ADJUST, // Adjust picture
|
||||
0x200+BUTTON_ADJUST, // Flip picture menu
|
||||
0x100+BUTTON_EFFECTS, // Menu des effets
|
||||
0x100+BUTTON_ADJUST, // Adjust picture
|
||||
0x200+BUTTON_ADJUST, // Flip picture menu
|
||||
0x100+BUTTON_EFFECTS, // Menu des effets
|
||||
SPECIAL_SHADE_MODE, // Shade mode
|
||||
SPECIAL_SHADE_MENU, // Shade menu
|
||||
SPECIAL_QUICK_SHADE_MODE, // Quick-shade mode
|
||||
@ -1169,9 +1369,9 @@ word Ordering[NB_SHORTCUTS]=
|
||||
SPECIAL_SMEAR_MODE, // Smear mode
|
||||
SPECIAL_TILING_MODE, // Tiling mode
|
||||
SPECIAL_TILING_MENU, // Tiling menu
|
||||
0x100+BUTTON_BRUSH, // Pick brush
|
||||
0x100+BUTTON_POLYBRUSH, // Pick polyform brush
|
||||
0x200+BUTTON_BRUSH, // Restore brush
|
||||
0x100+BUTTON_BRUSH, // Pick brush
|
||||
0x100+BUTTON_POLYBRUSH, // Pick polyform brush
|
||||
0x200+BUTTON_BRUSH, // Restore brush
|
||||
SPECIAL_FLIP_X, // Flip X
|
||||
SPECIAL_FLIP_Y, // Flip Y
|
||||
SPECIAL_ROTATE_90, // 90° brush rotation
|
||||
@ -1183,27 +1383,27 @@ word Ordering[NB_SHORTCUTS]=
|
||||
SPECIAL_GET_BRUSH_COLORS, // Get colors from brush
|
||||
SPECIAL_RECOLORIZE_BRUSH, // Recolorize brush
|
||||
SPECIAL_ROTATE_ANY_ANGLE, // Rotate brush by any angle
|
||||
0x100+BUTTON_COLORPICKER, // Pipette
|
||||
0x200+BUTTON_COLORPICKER, // Swap fore/back color
|
||||
0x100+BUTTON_MAGNIFIER, // Magnifier mode
|
||||
0x200+BUTTON_MAGNIFIER, // Zoom factor menu
|
||||
0x100+BUTTON_COLORPICKER, // Pipette
|
||||
0x200+BUTTON_COLORPICKER, // Swap fore/back color
|
||||
0x100+BUTTON_MAGNIFIER, // Magnifier mode
|
||||
0x200+BUTTON_MAGNIFIER, // Zoom factor menu
|
||||
SPECIAL_ZOOM_IN, // Zoom in
|
||||
SPECIAL_ZOOM_OUT, // Zoom out
|
||||
0x100+BUTTON_BRUSH_EFFECTS, // Brush effects menu
|
||||
0x100+BUTTON_TEXT, // Text
|
||||
0x100+BUTTON_TEXT, // Text
|
||||
0x100+BUTTON_RESOL, // Resolution menu
|
||||
0x200+BUTTON_RESOL, // Safety resolution
|
||||
0x100+BUTTON_HELP, // Help & credits
|
||||
0x200+BUTTON_HELP, // Statistics
|
||||
0x100+BUTTON_PAGE, // Go to spare page
|
||||
0x200+BUTTON_PAGE, // Copy to spare page
|
||||
0x100+BUTTON_SAVE, // Save as
|
||||
0x200+BUTTON_SAVE, // Save
|
||||
0x100+BUTTON_LOAD, // Load
|
||||
0x200+BUTTON_LOAD, // Re-load
|
||||
0x100+BUTTON_SAVE, // Save as
|
||||
0x200+BUTTON_SAVE, // Save
|
||||
0x100+BUTTON_LOAD, // Load
|
||||
0x200+BUTTON_LOAD, // Re-load
|
||||
SPECIAL_SAVE_BRUSH, // Save brush
|
||||
SPECIAL_LOAD_BRUSH, // Load brush
|
||||
0x100+BUTTON_SETTINGS, // Settings
|
||||
0x100+BUTTON_SETTINGS, // Settings
|
||||
0x100+BUTTON_UNDO, // Undo
|
||||
0x200+BUTTON_UNDO, // Redo
|
||||
0x100+BUTTON_KILL, // Kill
|
||||
@ -1230,6 +1430,31 @@ word Ordering[NB_SHORTCUTS]=
|
||||
SPECIAL_PREVIOUS_USER_FORECOLOR, // Previous user-defined foreground color
|
||||
SPECIAL_NEXT_USER_BACKCOLOR, // Next user-defined background color
|
||||
SPECIAL_PREVIOUS_USER_BACKCOLOR, // Previous user-defined background color
|
||||
SPECIAL_SMALLER_PAINTBRUSH, // Rétrécir le pinceau
|
||||
SPECIAL_BIGGER_PAINTBRUSH // Grossir le pinceau
|
||||
SPECIAL_SMALLER_PAINTBRUSH, // Sets paintbrush size: smaller
|
||||
SPECIAL_BIGGER_PAINTBRUSH, // Sets paintbrush size: bigger
|
||||
SPECIAL_EFFECTS_OFF, // Turns off all effects
|
||||
SPECIAL_TRANSPARENCY_1, // Sets transparency level 10%
|
||||
SPECIAL_TRANSPARENCY_2, // Sets transparency level 20%
|
||||
SPECIAL_TRANSPARENCY_3, // Sets transparency level 30%
|
||||
SPECIAL_TRANSPARENCY_4, // Sets transparency level 40%
|
||||
SPECIAL_TRANSPARENCY_5, // Sets transparency level 50%
|
||||
SPECIAL_TRANSPARENCY_6, // Sets transparency level 60%
|
||||
SPECIAL_TRANSPARENCY_7, // Sets transparency level 70%
|
||||
SPECIAL_TRANSPARENCY_8, // Sets transparency level 80%
|
||||
SPECIAL_TRANSPARENCY_9, // Sets transparency level 90%
|
||||
SPECIAL_TRANSPARENCY_0, // Sets transparency level 00%
|
||||
SPECIAL_ZOOM_1, /**< Sets zoom factor to 1:1 (no magnification) */
|
||||
SPECIAL_ZOOM_2, /**< Sets zoom factor to 2:1 */
|
||||
SPECIAL_ZOOM_3, /**< Sets zoom factor to 3:1 */
|
||||
SPECIAL_ZOOM_4, /**< Sets zoom factor to 4:1 */
|
||||
SPECIAL_ZOOM_5, /**< Sets zoom factor to 5:1 */
|
||||
SPECIAL_ZOOM_6, /**< Sets zoom factor to 6:1 */
|
||||
SPECIAL_ZOOM_8, /**< Sets zoom factor to 8:1 */
|
||||
SPECIAL_ZOOM_10, /**< Sets zoom factor to 10:1 */
|
||||
SPECIAL_ZOOM_12, /**< Sets zoom factor to 12:1 */
|
||||
SPECIAL_ZOOM_14, /**< Sets zoom factor to 14:1 */
|
||||
SPECIAL_ZOOM_16, /**< Sets zoom factor to 16:1 */
|
||||
SPECIAL_ZOOM_18, /**< Sets zoom factor to 18:1 */
|
||||
SPECIAL_ZOOM_20, /**< Sets zoom factor to 20:1 */
|
||||
SPECIAL_SHOW_GRID,
|
||||
};
|
||||
|
||||
13
init.h
@ -22,11 +22,22 @@
|
||||
/// Initialization (and some de-initialization) functions.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Load_graphics(const char * skin_file);
|
||||
T_Gui_skin *Load_graphics(const char * skin_file);
|
||||
void Init_buttons(void);
|
||||
void Init_operations(void);
|
||||
void Init_brush_container(void);
|
||||
int Load_CFG(int reload_all);
|
||||
int Save_CFG(void);
|
||||
void Set_all_video_modes(void);
|
||||
void Set_config_defaults(void);
|
||||
void Init_sighandler(void);
|
||||
|
||||
extern char Gui_loading_error_message[512];
|
||||
|
||||
///
|
||||
/// Loads a 8x8 monochrome font, the kind used in all menus and screens.
|
||||
/// This function allocates the memory, and returns a pointer to it when
|
||||
/// successful.
|
||||
/// If an error is encountered, it frees what needs it, prints an error message
|
||||
/// in ::Gui_loading_error_message, and returns NULL.
|
||||
byte * Load_font(const char * font_name);
|
||||
|
||||
133
input.c
@ -31,6 +31,15 @@
|
||||
void Handle_window_resize(SDL_ResizeEvent event);
|
||||
void Handle_window_exit(SDL_QuitEvent event);
|
||||
|
||||
// public Globals (available as extern)
|
||||
|
||||
int Input_sticky_control = 0;
|
||||
int Snap_axis = 0;
|
||||
int Snap_axis_origin_X;
|
||||
int Snap_axis_origin_Y;
|
||||
|
||||
// --
|
||||
|
||||
byte Directional_up;
|
||||
byte Directional_up_right;
|
||||
byte Directional_right;
|
||||
@ -39,10 +48,12 @@ byte Directional_down;
|
||||
byte Directional_down_left;
|
||||
byte Directional_left;
|
||||
byte Directional_up_left;
|
||||
byte Directional_click;
|
||||
|
||||
long Directional_delay;
|
||||
long Directional_last_move;
|
||||
long Directional_step;
|
||||
short Mouse_count; // Number of mouse movements received in the current Get_input()
|
||||
int Mouse_moved; ///< Boolean, Set to true if any cursor movement occurs.
|
||||
|
||||
word Input_new_mouse_X;
|
||||
word Input_new_mouse_Y;
|
||||
@ -71,7 +82,7 @@ short Joybutton_right_click=0; // Button number that serves as right-click
|
||||
|
||||
int Is_shortcut(word Key, word function)
|
||||
{
|
||||
if (Key == 0)
|
||||
if (Key == 0 || function == 0xFFFF)
|
||||
return 0;
|
||||
|
||||
if (function & 0x100)
|
||||
@ -101,19 +112,20 @@ int Is_shortcut(word Key, word function)
|
||||
int Move_cursor_with_constraints()
|
||||
{
|
||||
int feedback=0;
|
||||
byte bl=0;//BL va indiquer si on doit corriger la position du curseur
|
||||
int mouse_blocked=0; ///< Boolean, Set to true if mouse movement was clipped.
|
||||
|
||||
|
||||
// Clip mouse to the editing area. There can be a border when using big
|
||||
// pixels, if the SDL screen dimensions are not factors of the pixel size.
|
||||
if (Input_new_mouse_Y>=Screen_height)
|
||||
{
|
||||
Input_new_mouse_Y=Screen_height-1;
|
||||
bl=1;
|
||||
mouse_blocked=1;
|
||||
}
|
||||
if (Input_new_mouse_X>=Screen_width)
|
||||
{
|
||||
Input_new_mouse_X=Screen_width-1;
|
||||
bl=1;
|
||||
mouse_blocked=1;
|
||||
}
|
||||
//Gestion "avancée" du curseur: interdire la descente du curseur dans le
|
||||
//menu lorsqu'on est en train de travailler dans l'image
|
||||
@ -125,7 +137,7 @@ int Move_cursor_with_constraints()
|
||||
if(Menu_Y<=Input_new_mouse_Y)
|
||||
{
|
||||
//On bloque le curseur en fin d'image
|
||||
bl++;
|
||||
mouse_blocked=1;
|
||||
Input_new_mouse_Y=Menu_Y-1; //La ligne !!au-dessus!! du menu
|
||||
}
|
||||
|
||||
@ -135,7 +147,7 @@ int Move_cursor_with_constraints()
|
||||
{
|
||||
if(Input_new_mouse_X>=Main_separator_position)
|
||||
{
|
||||
bl++;
|
||||
mouse_blocked=1;
|
||||
Input_new_mouse_X=Main_separator_position-1;
|
||||
}
|
||||
}
|
||||
@ -143,7 +155,7 @@ int Move_cursor_with_constraints()
|
||||
{
|
||||
if(Input_new_mouse_X<Main_X_zoom)
|
||||
{
|
||||
bl++;
|
||||
mouse_blocked=1;
|
||||
Input_new_mouse_X=Main_X_zoom;
|
||||
}
|
||||
}
|
||||
@ -153,25 +165,36 @@ int Move_cursor_with_constraints()
|
||||
(Input_new_mouse_Y != Mouse_Y) ||
|
||||
(Input_new_mouse_K != Mouse_K))
|
||||
{
|
||||
// On every change of mouse state
|
||||
if ((Input_new_mouse_K != Mouse_K))
|
||||
{
|
||||
feedback=1;
|
||||
Hide_cursor(); // On efface le curseur AVANT de le déplacer...
|
||||
|
||||
if (Input_new_mouse_K == 0)
|
||||
Input_sticky_control = 0;
|
||||
}
|
||||
// Hide cursor, because even just a click change needs it
|
||||
if (!Mouse_moved)
|
||||
{
|
||||
Mouse_moved++;
|
||||
// Hide cursor (erasing icon and brush on screen
|
||||
// before changing the coordinates.
|
||||
Hide_cursor();
|
||||
}
|
||||
if (Input_new_mouse_X != Mouse_X || Input_new_mouse_Y != Mouse_Y)
|
||||
{
|
||||
Mouse_X=Input_new_mouse_X;
|
||||
Mouse_Y=Input_new_mouse_Y;
|
||||
if (bl)
|
||||
Set_mouse_position();
|
||||
}
|
||||
Mouse_K=Input_new_mouse_K;
|
||||
Compute_paintbrush_coordinates();
|
||||
Display_cursor();
|
||||
|
||||
Mouse_count++;
|
||||
if (Mouse_count>Config.Mouse_merge_movement)
|
||||
feedback=1;
|
||||
if (Mouse_moved > Config.Mouse_merge_movement)
|
||||
if (! Operation[Current_operation][Mouse_K_unique]
|
||||
[Operation_stack_size].Fast_mouse)
|
||||
feedback=1;
|
||||
}
|
||||
|
||||
if (mouse_blocked)
|
||||
Set_mouse_position();
|
||||
return feedback;
|
||||
}
|
||||
|
||||
@ -296,6 +319,7 @@ int Handle_mouse_release(SDL_MouseButtonEvent event)
|
||||
Input_new_mouse_K &= ~2;
|
||||
break;
|
||||
}
|
||||
|
||||
return Move_cursor_with_constraints();
|
||||
}
|
||||
|
||||
@ -327,14 +351,16 @@ int Handle_key_press(SDL_KeyboardEvent event)
|
||||
Directional_right=1;
|
||||
return 0;
|
||||
}
|
||||
else if(Is_shortcut(Key,SPECIAL_CLICK_LEFT))
|
||||
else if(Is_shortcut(Key,SPECIAL_CLICK_LEFT) && Keyboard_click_allowed > 0)
|
||||
{
|
||||
Input_new_mouse_K=1;
|
||||
Directional_click=1;
|
||||
return Move_cursor_with_constraints();
|
||||
}
|
||||
else if(Is_shortcut(Key,SPECIAL_CLICK_RIGHT))
|
||||
else if(Is_shortcut(Key,SPECIAL_CLICK_RIGHT) && Keyboard_click_allowed > 0)
|
||||
{
|
||||
Input_new_mouse_K=2;
|
||||
Directional_click=2;
|
||||
return Move_cursor_with_constraints();
|
||||
}
|
||||
|
||||
@ -344,44 +370,60 @@ int Handle_key_press(SDL_KeyboardEvent event)
|
||||
|
||||
int Release_control(int key_code, int modifier)
|
||||
{
|
||||
int need_feedback = 0;
|
||||
|
||||
if(key_code == (Config_Key[SPECIAL_MOUSE_UP][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_UP][0]&modifier) ||
|
||||
key_code == (Config_Key[SPECIAL_MOUSE_UP][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_UP][1]&modifier))
|
||||
if (modifier == MOD_SHIFT)
|
||||
{
|
||||
// Disable "snap axis" mode
|
||||
Snap_axis = 0;
|
||||
need_feedback = 1;
|
||||
}
|
||||
|
||||
if((key_code && key_code == (Config_Key[SPECIAL_MOUSE_UP][0]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_UP][0]&modifier) ||
|
||||
(key_code && key_code == (Config_Key[SPECIAL_MOUSE_UP][1]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_UP][1]&modifier))
|
||||
{
|
||||
Directional_up=0;
|
||||
}
|
||||
if(key_code == (Config_Key[SPECIAL_MOUSE_DOWN][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_DOWN][0]&modifier) ||
|
||||
key_code == (Config_Key[SPECIAL_MOUSE_DOWN][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_DOWN][1]&modifier))
|
||||
if((key_code && key_code == (Config_Key[SPECIAL_MOUSE_DOWN][0]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_DOWN][0]&modifier) ||
|
||||
(key_code && key_code == (Config_Key[SPECIAL_MOUSE_DOWN][1]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_DOWN][1]&modifier))
|
||||
{
|
||||
Directional_down=0;
|
||||
}
|
||||
if(key_code == (Config_Key[SPECIAL_MOUSE_LEFT][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_LEFT][0]&modifier) ||
|
||||
key_code == (Config_Key[SPECIAL_MOUSE_LEFT][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_LEFT][1]&modifier))
|
||||
if((key_code && key_code == (Config_Key[SPECIAL_MOUSE_LEFT][0]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_LEFT][0]&modifier) ||
|
||||
(key_code && key_code == (Config_Key[SPECIAL_MOUSE_LEFT][1]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_LEFT][1]&modifier))
|
||||
{
|
||||
Directional_left=0;
|
||||
}
|
||||
if(key_code == (Config_Key[SPECIAL_MOUSE_RIGHT][0]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_RIGHT][0]&modifier) ||
|
||||
key_code == (Config_Key[SPECIAL_MOUSE_RIGHT][1]&0x0FFF) || (Config_Key[SPECIAL_MOUSE_RIGHT][1]&modifier))
|
||||
if((key_code && key_code == (Config_Key[SPECIAL_MOUSE_RIGHT][0]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_RIGHT][0]&modifier) ||
|
||||
(key_code && key_code == (Config_Key[SPECIAL_MOUSE_RIGHT][1]&0x0FFF)) || (Config_Key[SPECIAL_MOUSE_RIGHT][1]&modifier))
|
||||
{
|
||||
Directional_right=0;
|
||||
}
|
||||
if(key_code == (Config_Key[SPECIAL_CLICK_LEFT][0]&0x0FFF) || (Config_Key[SPECIAL_CLICK_LEFT][0]&modifier) ||
|
||||
key_code == (Config_Key[SPECIAL_CLICK_LEFT][1]&0x0FFF) || (Config_Key[SPECIAL_CLICK_LEFT][1]&modifier))
|
||||
if((key_code && key_code == (Config_Key[SPECIAL_CLICK_LEFT][0]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_LEFT][0]&modifier) ||
|
||||
(key_code && key_code == (Config_Key[SPECIAL_CLICK_LEFT][1]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_LEFT][1]&modifier))
|
||||
{
|
||||
Input_new_mouse_K &= ~1;
|
||||
return Move_cursor_with_constraints();
|
||||
if (Directional_click & 1)
|
||||
{
|
||||
Directional_click &= ~1;
|
||||
Input_new_mouse_K &= ~1;
|
||||
return Move_cursor_with_constraints() || need_feedback;
|
||||
}
|
||||
}
|
||||
if(key_code == (Config_Key[SPECIAL_CLICK_RIGHT][0]&0x0FFF) || (Config_Key[SPECIAL_CLICK_RIGHT][0]&modifier) ||
|
||||
key_code == (Config_Key[SPECIAL_CLICK_RIGHT][1]&0x0FFF) || (Config_Key[SPECIAL_CLICK_RIGHT][1]&modifier))
|
||||
if((key_code && key_code == (Config_Key[SPECIAL_CLICK_RIGHT][0]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_RIGHT][0]&modifier) ||
|
||||
(key_code && key_code == (Config_Key[SPECIAL_CLICK_RIGHT][1]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_RIGHT][1]&modifier))
|
||||
{
|
||||
Input_new_mouse_K &= ~2;
|
||||
return Move_cursor_with_constraints();
|
||||
if (Directional_click & 2)
|
||||
{
|
||||
Directional_click &= ~2;
|
||||
Input_new_mouse_K &= ~2;
|
||||
return Move_cursor_with_constraints() || need_feedback;
|
||||
}
|
||||
}
|
||||
|
||||
// Other keys don't need to be released : they are handled as "events" and procesed only once.
|
||||
// These clicks are apart because they need to be continuous (ie move while key pressed)
|
||||
// We are relying on "hardware" keyrepeat to achieve that.
|
||||
return 0;
|
||||
return need_feedback;
|
||||
}
|
||||
|
||||
|
||||
@ -617,7 +659,9 @@ int Get_input(void)
|
||||
|
||||
Key_ANSI = 0;
|
||||
Key = 0;
|
||||
Mouse_count=0;
|
||||
Mouse_moved=0;
|
||||
Input_new_mouse_X = Mouse_X;
|
||||
Input_new_mouse_Y = Mouse_Y;
|
||||
|
||||
// Process as much events as possible without redrawing the screen.
|
||||
// This mostly allows us to merge mouse events for people with an high
|
||||
@ -734,11 +778,20 @@ int Get_input(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Vidage de toute mise à jour de l'affichage à l'écran qui serait encore en attente.
|
||||
// (c'est fait ici car on est sur que cette function est apellée partout ou on a besoin d'interragir avec l'utilisateur)
|
||||
// If the cursor was moved since last update,
|
||||
// it was erased, so we need to redraw it (with the preview brush)
|
||||
if (Mouse_moved)
|
||||
{
|
||||
Compute_paintbrush_coordinates();
|
||||
Display_cursor();
|
||||
}
|
||||
// Commit any pending screen update.
|
||||
// This is done in this function because it's called after reading
|
||||
// some user input.
|
||||
Flush_update();
|
||||
|
||||
return user_feedback_required;
|
||||
|
||||
return (Mouse_moved!=0) || user_feedback_required;
|
||||
}
|
||||
|
||||
void Adjust_mouse_sensitivity(word fullscreen)
|
||||
|
||||
14
input.h
@ -40,3 +40,17 @@ int Is_shortcut(word Key, word function);
|
||||
void Adjust_mouse_sensitivity(word fullscreen);
|
||||
|
||||
void Set_mouse_position(void);
|
||||
|
||||
///
|
||||
/// This holds the ID of the GUI control that the mouse
|
||||
/// is manipulating. The input system will reset it to zero
|
||||
/// when mouse button is released, but it's the engine
|
||||
/// that will record and retrieve a real control ID.
|
||||
extern int Input_sticky_control;
|
||||
|
||||
/// Allows locking movement to X or Y axis: 0=normal, 1=lock on next move, 2=locked horizontally, 3=locked vertically.
|
||||
extern int Snap_axis;
|
||||
/// For the :Snap_axis mode, sets the origin's point (in image coordinates)
|
||||
extern int Snap_axis_origin_X;
|
||||
/// For the :Snap_axis mode, sets the origin's point (in image coordinates)
|
||||
extern int Snap_axis_origin_Y;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
;Name and file
|
||||
Name "Grafx2"
|
||||
OutFile "grafx2-2.0-svn853-win32.exe"
|
||||
OutFile "grafx2-2.1.1026.win32.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$PROGRAMFILES\Grafx2"
|
||||
@ -60,7 +60,7 @@ Section "Grafx2" SecProgram
|
||||
SetOutPath "$INSTDIR"
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
File ..\grafx2.exe
|
||||
File ..\src-svn853.tgz
|
||||
File ..\src-2.1.1026.tgz
|
||||
File ..\gfx2.gif
|
||||
File ..\gfx2def.ini
|
||||
File ..\SDL_image.dll
|
||||
@ -70,7 +70,10 @@ Section "Grafx2" SecProgram
|
||||
File ..\zlib1.dll
|
||||
File ..\libpng13.dll
|
||||
SetOutPath "$INSTDIR\skins"
|
||||
File ..\skins\base.gif
|
||||
File ..\skins\font_Classic.png
|
||||
File ..\skins\font_Fun.png
|
||||
File ..\skins\skin_classic.png
|
||||
File ..\skins\skin_modern.png
|
||||
SetOutPath "$INSTDIR\doc"
|
||||
File ..\doc\README.txt
|
||||
File ..\doc\COMPILING.txt
|
||||
@ -97,7 +100,7 @@ Section "Grafx2" SecProgram
|
||||
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.0 final"
|
||||
"DisplayVersion" "2.1.1026"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \
|
||||
"NoModify" 1
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Grafx2-SDL" \
|
||||
@ -139,7 +142,7 @@ Section "un.SecProgram"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
Delete "$INSTDIR\grafx2.exe"
|
||||
Delete "$INSTDIR\src-svn853.tgz"
|
||||
Delete "$INSTDIR\src-2.1.1026.tgz"
|
||||
Delete "$INSTDIR\gfx2.gif"
|
||||
Delete "$INSTDIR\gfx2def.ini"
|
||||
Delete "$INSTDIR\SDL_image.dll"
|
||||
@ -159,7 +162,10 @@ Section "un.SecProgram"
|
||||
Delete "$INSTDIR\fonts\8pxfont.png"
|
||||
Delete "$INSTDIR\fonts\Tuffy.ttf"
|
||||
RMDir "$INSTDIR\fonts"
|
||||
Delete "$INSTDIR\skins\base.gif"
|
||||
Delete "$INSTDIR\skins\font_Classic.png"
|
||||
Delete "$INSTDIR\skins\font_Fun.png"
|
||||
Delete "$INSTDIR\skins\skin_classic.png"
|
||||
Delete "$INSTDIR\skins\skin_modern.png"
|
||||
RMDir "$INSTDIR\skins"
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
|
||||
10
io.c
@ -243,16 +243,16 @@ int File_length_file(FILE * file)
|
||||
void For_each_file(const char * directory_name, void Callback(const char *))
|
||||
{
|
||||
// Pour scan de répertoire
|
||||
DIR* Repertoire_Courant; //Répertoire courant
|
||||
DIR* current_directory; //Répertoire courant
|
||||
struct dirent* entry; // Structure de lecture des éléments
|
||||
char full_filename[MAX_PATH_CHARACTERS];
|
||||
int filename_position;
|
||||
strcpy(full_filename, directory_name);
|
||||
Repertoire_Courant=opendir(directory_name);
|
||||
if(Repertoire_Courant == NULL) return; // Répertoire invalide ...
|
||||
current_directory=opendir(directory_name);
|
||||
if(current_directory == NULL) return; // Répertoire invalide ...
|
||||
strcat(full_filename, PATH_SEPARATOR);
|
||||
filename_position = strlen(full_filename);
|
||||
while ((entry=readdir(Repertoire_Courant)))
|
||||
while ((entry=readdir(current_directory)))
|
||||
{
|
||||
struct stat Infos_enreg;
|
||||
strcpy(&full_filename[filename_position], entry->d_name);
|
||||
@ -262,6 +262,6 @@ void For_each_file(const char * directory_name, void Callback(const char *))
|
||||
Callback(full_filename);
|
||||
}
|
||||
}
|
||||
closedir(Repertoire_Courant);
|
||||
closedir(current_directory);
|
||||
}
|
||||
|
||||
|
||||
1091
loadsave.c
@ -55,3 +55,6 @@ extern T_Format File_formats[NB_KNOWN_FORMATS];
|
||||
/// Function which attempts to save backups of the images (main and spare),
|
||||
/// called in case of SIGSEGV.
|
||||
void Image_emergency_backup(void);
|
||||
|
||||
/// Pixel ratio of last loaded image: one of :PIXEL_SIMPLE, :PIXEL_WIDE or :PIXEL_TALL
|
||||
extern enum PIXEL_RATIO Ratio_of_loaded_image;
|
||||
|
||||
81
main.c
@ -76,7 +76,7 @@
|
||||
#endif
|
||||
|
||||
// filename for the current GUI skin file.
|
||||
static char Gui_skin_file[MAX_PATH_CHARACTERS]= "skins" PATH_SEPARATOR "base.gif";
|
||||
static char Gui_skin_file[MAX_PATH_CHARACTERS];
|
||||
|
||||
//--- Affichage de la syntaxe, et de la liste des modes vidéos disponibles ---
|
||||
void Display_syntax(void)
|
||||
@ -344,6 +344,7 @@ int Init_program(int argc,char * argv[])
|
||||
strcpy(Main_file_directory,Main_current_directory);
|
||||
strcpy(Main_filename,"NO_NAME.GIF");
|
||||
Main_fileformat=DEFAULT_FILEFORMAT;
|
||||
|
||||
// On initialise les données sur le nom de fichier de l'image de brouillon:
|
||||
strcpy(Spare_current_directory,Main_current_directory);
|
||||
strcpy(Spare_file_directory,Main_file_directory);
|
||||
@ -355,7 +356,7 @@ int Init_program(int argc,char * argv[])
|
||||
Brush_fileformat =Main_fileformat;
|
||||
|
||||
// On initialise ce qu'il faut pour que les fileselects ne plantent pas:
|
||||
Filelist=NULL; // Au début, il n'y a pas de fichiers dans la liste
|
||||
|
||||
Main_fileselector_position=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||
Main_fileselector_offset=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||
Main_format=0;
|
||||
@ -398,6 +399,7 @@ int Init_program(int argc,char * argv[])
|
||||
Spare_magnifier_width=0;
|
||||
Spare_magnifier_offset_X=0;
|
||||
Spare_magnifier_offset_Y=0;
|
||||
Keyboard_click_allowed = 0;
|
||||
|
||||
// SDL
|
||||
if(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0)
|
||||
@ -406,6 +408,7 @@ int Init_program(int argc,char * argv[])
|
||||
printf("Couldn't initialize SDL.\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
Joystick = SDL_JoystickOpen(0);
|
||||
SDL_EnableKeyRepeat(250, 32);
|
||||
SDL_EnableUNICODE(SDL_ENABLE);
|
||||
@ -439,18 +442,18 @@ int Init_program(int argc,char * argv[])
|
||||
Set_all_video_modes();
|
||||
Pixel_ratio=PIXEL_SIMPLE;
|
||||
// On initialise les données sur l'état du programme:
|
||||
// Donnée sur la sortie du programme:
|
||||
// Donnée sur la sortie du programme:
|
||||
Quit_is_required=0;
|
||||
Quitting=0;
|
||||
// Données sur l'état du menu:
|
||||
// Données sur l'état du menu:
|
||||
Pixel_in_menu=Pixel_in_toolbar;
|
||||
Menu_is_visible=1;
|
||||
// Données sur les couleurs et la palette:
|
||||
// Données sur les couleurs et la palette:
|
||||
First_color_in_palette=0;
|
||||
// Données sur le curseur:
|
||||
// Données sur le curseur:
|
||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||
Cursor_hidden=0;
|
||||
// Données sur le pinceau:
|
||||
// Données sur le pinceau:
|
||||
Paintbrush_X=0;
|
||||
Paintbrush_Y=0;
|
||||
Paintbrush_shape=PAINTBRUSH_SHAPE_ROUND;
|
||||
@ -510,10 +513,14 @@ int Init_program(int argc,char * argv[])
|
||||
// Initialisation des opérations
|
||||
Init_operations();
|
||||
|
||||
// Initialize the brush container
|
||||
Init_brush_container();
|
||||
|
||||
Windows_open=0;
|
||||
|
||||
// Charger la configuration des touches
|
||||
Set_config_defaults();
|
||||
|
||||
switch(Load_CFG(1))
|
||||
{
|
||||
case ERROR_CFG_MISSING:
|
||||
@ -533,30 +540,41 @@ int Init_program(int argc,char * argv[])
|
||||
|
||||
Analyze_command_line(argc,argv);
|
||||
|
||||
// Charger les sprites et la palette
|
||||
Load_graphics(Gui_skin_file);
|
||||
|
||||
// Load sprites, palette etc.
|
||||
strcpy(Gui_skin_file,Config.Skin_file);
|
||||
Gfx = Load_graphics(Gui_skin_file);
|
||||
if (Gfx == NULL)
|
||||
{
|
||||
Gfx = Load_graphics("skin_modern.png");
|
||||
if (Gfx == NULL)
|
||||
{
|
||||
printf("%s", Gui_loading_error_message);
|
||||
Error(ERROR_GUI_MISSING);
|
||||
}
|
||||
}
|
||||
// Infos sur les trames (Sieve)
|
||||
Sieve_mode=0;
|
||||
Copy_preset_sieve(0);
|
||||
|
||||
// Transfert des valeurs du .INI qui ne changent pas dans des variables
|
||||
// plus accessibles:
|
||||
Default_palette[MC_Black]=Fav_menu_colors[0]=Config.Fav_menu_colors[0];
|
||||
Default_palette[MC_Dark] =Fav_menu_colors[1]=Config.Fav_menu_colors[1];
|
||||
Default_palette[MC_Light]=Fav_menu_colors[2]=Config.Fav_menu_colors[2];
|
||||
Default_palette[MC_White]=Fav_menu_colors[3]=Config.Fav_menu_colors[3];
|
||||
Compute_optimal_menu_colors(Default_palette);
|
||||
Gfx->Default_palette[MC_Black]=Fav_menu_colors[0]=Config.Fav_menu_colors[0];
|
||||
Gfx->Default_palette[MC_Dark] =Fav_menu_colors[1]=Config.Fav_menu_colors[1];
|
||||
Gfx->Default_palette[MC_Light]=Fav_menu_colors[2]=Config.Fav_menu_colors[2];
|
||||
Gfx->Default_palette[MC_White]=Fav_menu_colors[3]=Config.Fav_menu_colors[3];
|
||||
Compute_optimal_menu_colors(Gfx->Default_palette);
|
||||
Fore_color=MC_White;
|
||||
Back_color=MC_Black;
|
||||
|
||||
// Prise en compte de la fonte
|
||||
if (Config.Font)
|
||||
Menu_font=GFX_fun_font;
|
||||
else
|
||||
Menu_font=GFX_system_font;
|
||||
// Font
|
||||
if (!(Menu_font=Load_font(Config.Font_file)))
|
||||
if (!(Menu_font=Load_font("font_Classic.png")))
|
||||
{
|
||||
printf("Unable to open the default font file: %s\n", "font_Classic.png");
|
||||
Error(ERROR_GUI_MISSING);
|
||||
}
|
||||
|
||||
memcpy(Main_palette,Default_palette,sizeof(T_Palette));
|
||||
memcpy(Main_palette, Gfx->Default_palette, sizeof(T_Palette));
|
||||
|
||||
// Allocation de mémoire pour la brosse
|
||||
if (!(Brush =(byte *)malloc( 1* 1))) Error(ERROR_MEMORY);
|
||||
@ -672,16 +690,23 @@ void Program_shutdown(void)
|
||||
#endif
|
||||
|
||||
// On libère le buffer de gestion de lignes
|
||||
free(Horizontal_line_buffer);
|
||||
if(Horizontal_line_buffer) free(Horizontal_line_buffer);
|
||||
|
||||
// On libère le pinceau spécial
|
||||
free(Paintbrush_sprite);
|
||||
if (Paintbrush_sprite) free(Paintbrush_sprite);
|
||||
|
||||
// On libère les différents écrans virtuels et brosse:
|
||||
free(Brush);
|
||||
if(Brush) free(Brush);
|
||||
Set_number_of_backups(0);
|
||||
free(Spare_screen);
|
||||
free(Main_screen);
|
||||
if(Spare_screen) free(Spare_screen);
|
||||
if(Main_screen) free(Main_screen);
|
||||
|
||||
// Free the skin (Gui graphics) data
|
||||
if (Gfx)
|
||||
{
|
||||
free(Gfx);
|
||||
Gfx=NULL;
|
||||
}
|
||||
|
||||
// On prend bien soin de passer dans le répertoire initial:
|
||||
if (chdir(Initial_directory)!=-1)
|
||||
@ -711,9 +736,9 @@ int main(int argc,char * argv[])
|
||||
int phoenix2_found=0;
|
||||
char phoenix_filename1[MAX_PATH_CHARACTERS];
|
||||
char phoenix_filename2[MAX_PATH_CHARACTERS];
|
||||
|
||||
if(!Init_program(argc,argv))
|
||||
{
|
||||
Program_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -733,6 +758,7 @@ int main(int argc,char * argv[])
|
||||
strcpy(Main_file_directory,Config_directory);
|
||||
strcpy(Main_filename,"phoenix2.img");
|
||||
chdir(Main_file_directory);
|
||||
|
||||
Button_Reload();
|
||||
Main_image_is_modified=1;
|
||||
Warning_message("Spare page recovered");
|
||||
@ -756,7 +782,6 @@ int main(int argc,char * argv[])
|
||||
{
|
||||
if (Config.Opening_message && (!File_in_command_line))
|
||||
Button_Message_initial();
|
||||
free(GFX_logo_grafx2); // Pas encore utilisé dans le About
|
||||
|
||||
if (File_in_command_line)
|
||||
{
|
||||
|
||||
1
misc.h
@ -35,6 +35,7 @@ void Slider_timer(byte speed);
|
||||
dword Round_div(dword numerator,dword divisor);
|
||||
word Count_used_colors(dword * usage);
|
||||
word Count_used_colors_area(dword* usage, word start_x, word start_y, word width, word height);
|
||||
word Count_used_colors_screen_area(dword* usage, word start_x, word start_y, word width, word height);
|
||||
void Pixel_in_current_screen (word x,word y,byte color);
|
||||
void Pixel_in_brush (word x,word y,byte color);
|
||||
byte Read_pixel_from_current_screen (word x,word y);
|
||||
|
||||
570
op_c.c
@ -16,6 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -315,24 +316,24 @@ void OT_inc(T_Occurrence_table * t,int r,int g,int b)
|
||||
t->table[index]++;
|
||||
}
|
||||
|
||||
void OT_count_occurrences(T_Occurrence_table * t,T_Bitmap24B image,int size)
|
||||
void OT_count_occurrences(T_Occurrence_table* t, T_Bitmap24B image, int size)
|
||||
{
|
||||
T_Bitmap24B ptr;
|
||||
int index;
|
||||
|
||||
for (index=size,ptr=image;index>0;index--,ptr++)
|
||||
OT_inc(t,ptr->R,ptr->G,ptr->B);
|
||||
for (index = size, ptr = image; index > 0; index--, ptr++)
|
||||
OT_inc(t, ptr->R, ptr->G, ptr->B);
|
||||
}
|
||||
|
||||
int OT_count_colors(T_Occurrence_table * t)
|
||||
{
|
||||
int val; // Valeur de retour
|
||||
int nb; // Nombre de couleurs … tester
|
||||
int i; // Compteur de couleurs test‚es
|
||||
int nb; // Nombre de couleurs … tester
|
||||
int i; // Compteur de couleurs test‚es
|
||||
|
||||
val=0;
|
||||
val = 0;
|
||||
nb=(t->rng_r)*(t->rng_g)*(t->rng_b);
|
||||
for (i=0;i<nb;i++)
|
||||
for (i = 0; i < nb; i++)
|
||||
if (t->table[i]>0)
|
||||
val++;
|
||||
|
||||
@ -345,7 +346,7 @@ int OT_count_colors(T_Occurrence_table * t)
|
||||
///////////////////////////////////////// M‚thodes de gestion des clusters //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Cluster_analyser(T_Cluster * c,T_Occurrence_table * to)
|
||||
void Cluster_pack(T_Cluster * c,T_Occurrence_table * to)
|
||||
{
|
||||
int rmin,rmax,vmin,vmax,bmin,bmax;
|
||||
int r,g,b;
|
||||
@ -495,21 +496,22 @@ ENDCRUSH:
|
||||
}
|
||||
}
|
||||
|
||||
void Cluster_split(T_Cluster * c,T_Cluster * c1,T_Cluster * c2,int hue,T_Occurrence_table * to)
|
||||
void Cluster_split(T_Cluster * c, T_Cluster * c1, T_Cluster * c2, int hue,
|
||||
T_Occurrence_table * to)
|
||||
{
|
||||
int limit;
|
||||
int cumul;
|
||||
int r,g,b;
|
||||
int r, g, b;
|
||||
|
||||
limit=(c->occurences)/2;
|
||||
cumul=0;
|
||||
if (hue==0)
|
||||
limit = c->occurences / 2;
|
||||
cumul = 0;
|
||||
if (hue == 0)
|
||||
{
|
||||
for (r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
|
||||
for (r = c->rmin<<16; r<=c->rmax<<16; r+=1<<16)
|
||||
{
|
||||
for (g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
|
||||
for (g = c->vmin<<8; g<=c->vmax<<8; g+=1<<8)
|
||||
{
|
||||
for (b=c->bmin;b<=c->bmax;b++)
|
||||
for (b = c->bmin; b<=c->bmax; b++)
|
||||
{
|
||||
cumul+=to->table[r + g + b];
|
||||
if (cumul>=limit)
|
||||
@ -535,6 +537,7 @@ void Cluster_split(T_Cluster * c,T_Cluster * c1,T_Cluster * c2,int hue,T_Occurre
|
||||
c1->vmin=c->vmin; c1->vmax=c->vmax;
|
||||
c1->Bmin=c->Bmin; c1->Bmax=c->Bmax;
|
||||
c1->bmin=c->bmin; c1->bmax=c->bmax;
|
||||
|
||||
c2->Rmin=r; c2->Rmax=c->Rmax;
|
||||
c2->rmin=r; c2->rmax=c->rmax;
|
||||
c2->Gmin=c->Gmin; c2->Vmax=c->Vmax;
|
||||
@ -575,6 +578,7 @@ void Cluster_split(T_Cluster * c,T_Cluster * c1,T_Cluster * c2,int hue,T_Occurre
|
||||
c1->vmin=c->vmin; c1->vmax=g-1;
|
||||
c1->Bmin=c->Bmin; c1->Bmax=c->Bmax;
|
||||
c1->bmin=c->bmin; c1->bmax=c->bmax;
|
||||
|
||||
c2->Rmin=c->Rmin; c2->Rmax=c->Rmax;
|
||||
c2->rmin=c->rmin; c2->rmax=c->rmax;
|
||||
c2->Gmin=g; c2->Vmax=c->Vmax;
|
||||
@ -614,6 +618,7 @@ void Cluster_split(T_Cluster * c,T_Cluster * c1,T_Cluster * c2,int hue,T_Occurre
|
||||
c1->vmin=c->vmin; c1->vmax=c->vmax;
|
||||
c1->Bmin=c->Bmin; c1->Bmax=b-1;
|
||||
c1->bmin=c->bmin; c1->bmax=b-1;
|
||||
|
||||
c2->Rmin=c->Rmin; c2->Rmax=c->Rmax;
|
||||
c2->rmin=c->rmin; c2->rmax=c->rmax;
|
||||
c2->Gmin=c->Gmin; c2->Vmax=c->Vmax;
|
||||
@ -648,7 +653,7 @@ void Cluster_compute_hue(T_Cluster * c,T_Occurrence_table * to)
|
||||
c->r=(cumul_r<<to->red_r)/c->occurences;
|
||||
c->g=(cumul_g<<to->red_g)/c->occurences;
|
||||
c->b=(cumul_b<<to->red_b)/c->occurences;
|
||||
RGB_to_HSL(c->r,c->g,c->b,&c->h,&s,&c->l);
|
||||
RGB_to_HSL(c->r, c->g, c->b, &c->h, &s, &c->l);
|
||||
}
|
||||
|
||||
|
||||
@ -657,112 +662,136 @@ void Cluster_compute_hue(T_Cluster * c,T_Occurrence_table * to)
|
||||
//////////////////////////// M‚thodes de gestion des ensembles de clusters //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CS_Init(T_Cluster_set * cs,T_Occurrence_table * to)
|
||||
// Debug helper : check if a cluster set has the right count value
|
||||
/*
|
||||
void CS_Check(T_Cluster_set* cs)
|
||||
{
|
||||
cs->clusters[0].Rmin=cs->clusters[0].rmin=0;
|
||||
cs->clusters[0].Gmin=cs->clusters[0].vmin=0;
|
||||
cs->clusters[0].Bmin=cs->clusters[0].bmin=0;
|
||||
cs->clusters[0].Rmax=cs->clusters[0].rmax=to->rng_r-1;
|
||||
cs->clusters[0].Vmax=cs->clusters[0].vmax=to->rng_g-1;
|
||||
cs->clusters[0].Bmax=cs->clusters[0].bmax=to->rng_b-1;
|
||||
Cluster_analyser(cs->clusters+0,to);
|
||||
// Et hop : le 1er ensemble de couleurs est initialis‚
|
||||
cs->nb=1;
|
||||
int i;
|
||||
T_Cluster* c = cs->clusters;
|
||||
for (i = cs->nb; i > 0; i--)
|
||||
{
|
||||
assert( c != NULL);
|
||||
c = c->next;
|
||||
}
|
||||
|
||||
assert(c == NULL);
|
||||
}
|
||||
*/
|
||||
|
||||
/// Setup the first cluster before we start the operations
|
||||
void CS_Init(T_Cluster_set * cs, T_Occurrence_table * to)
|
||||
{
|
||||
cs->clusters->Rmin = cs->clusters->rmin = 0;
|
||||
cs->clusters->Gmin = cs->clusters->vmin = 0;
|
||||
cs->clusters->Bmin = cs->clusters->bmin = 0;
|
||||
cs->clusters->Rmax = cs->clusters->rmax = to->rng_r - 1;
|
||||
cs->clusters->Vmax = cs->clusters->vmax = to->rng_g - 1;
|
||||
cs->clusters->Bmax = cs->clusters->bmax = to->rng_b - 1;
|
||||
cs->clusters->next = NULL;
|
||||
Cluster_pack(cs->clusters, to);
|
||||
cs->nb = 1;
|
||||
}
|
||||
|
||||
T_Cluster_set * CS_New(int nbmax,T_Occurrence_table * to)
|
||||
/// Allocate a new cluster set
|
||||
T_Cluster_set * CS_New(int nbmax, T_Occurrence_table * to)
|
||||
{
|
||||
T_Cluster_set * n;
|
||||
|
||||
n=(T_Cluster_set *)malloc(sizeof(T_Cluster_set));
|
||||
if (n!=0)
|
||||
if (n != NULL)
|
||||
{
|
||||
// On recopie les paramŠtres demand‚s
|
||||
n->nb_max=OT_count_colors(to);
|
||||
n->nb_max = OT_count_colors(to);
|
||||
|
||||
// On vient de compter le nombre de couleurs existantes, s'il est plus grand que 256 on limit à 256 (nombre de couleurs voulu au final)
|
||||
if (n->nb_max>nbmax)
|
||||
// On vient de compter le nombre de couleurs existantes, s'il est plus grand
|
||||
// que 256 on limite à 256
|
||||
// (nombre de couleurs voulu au final)
|
||||
if (n->nb_max > nbmax)
|
||||
{
|
||||
n->nb_max=nbmax;
|
||||
n->nb_max = nbmax;
|
||||
}
|
||||
|
||||
// On tente d'allouer la table
|
||||
n->clusters=(T_Cluster *)malloc(nbmax*sizeof(T_Cluster));
|
||||
if (n->clusters!=NULL)
|
||||
// On tente d'allouer le premier cluster
|
||||
n->clusters=(T_Cluster *)malloc(sizeof(T_Cluster));
|
||||
if (n->clusters != NULL)
|
||||
// C'est bon! On initialise
|
||||
CS_Init(n,to);
|
||||
CS_Init(n, to);
|
||||
else
|
||||
{
|
||||
// Table impossible … allouer
|
||||
free(n);
|
||||
n=0;
|
||||
n = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/// Free a cluster set
|
||||
void CS_Delete(T_Cluster_set * cs)
|
||||
{
|
||||
free(cs->clusters);
|
||||
free(cs);
|
||||
T_Cluster* nxt;
|
||||
while (cs->clusters != NULL)
|
||||
{
|
||||
nxt = cs->clusters->next;
|
||||
free(cs->clusters);
|
||||
cs->clusters = nxt;
|
||||
}
|
||||
free(cs);
|
||||
}
|
||||
|
||||
void CS_Get(T_Cluster_set * cs,T_Cluster * c)
|
||||
void CS_Get(T_Cluster_set * cs, T_Cluster * c)
|
||||
{
|
||||
int index;
|
||||
T_Cluster* current = cs->clusters;
|
||||
T_Cluster* prev = NULL;
|
||||
|
||||
// On cherche un cluster que l'on peut couper en deux, donc avec au moins deux valeurs
|
||||
// différentes sur l'une des composantes
|
||||
for (index=0;index<cs->nb;index++)
|
||||
if ( (cs->clusters[index].rmin<cs->clusters[index].rmax) ||
|
||||
(cs->clusters[index].vmin<cs->clusters[index].vmax) ||
|
||||
(cs->clusters[index].bmin<cs->clusters[index].bmax) )
|
||||
// Search a cluster with at least 2 distinct colors so we can split it
|
||||
do
|
||||
{
|
||||
if ( (current->rmin < current->rmax) ||
|
||||
(current->vmin < current->vmax) ||
|
||||
(current->bmin < current->bmax) )
|
||||
break;
|
||||
|
||||
// On le recopie dans c
|
||||
*c=cs->clusters[index];
|
||||
prev = current;
|
||||
|
||||
// On décrémente le nombre et on décale tous les clusters suivants
|
||||
// Sachant qu'on va réinsérer juste après, il me semble que ça serait une bonne idée de gérer les clusters
|
||||
// comme une liste chainée... on n'a aucun accès direct dedans, que des parcours ...
|
||||
} while((current = current -> next));
|
||||
|
||||
// copy it to c
|
||||
*c = *current;
|
||||
|
||||
// remove it from the list
|
||||
cs->nb--;
|
||||
memcpy((cs->clusters+index),(cs->clusters+index+1),(cs->nb-index)*sizeof(T_Cluster));
|
||||
|
||||
if(prev)
|
||||
prev->next = current->next;
|
||||
else
|
||||
cs->clusters = current->next;
|
||||
free(current);
|
||||
current = NULL;
|
||||
}
|
||||
|
||||
void CS_Set(T_Cluster_set * cs,T_Cluster * c)
|
||||
{
|
||||
int index;
|
||||
// int decalage;
|
||||
T_Cluster* current = cs->clusters;
|
||||
T_Cluster* prev = NULL;
|
||||
|
||||
// Le tableau des clusters est trié par nombre d'occurences. Donc on cherche la position du premier cluster
|
||||
// qui est plus grand que le notre
|
||||
for (index=0;index<cs->nb;index++)
|
||||
if (cs->clusters[index].occurences<c->occurences)
|
||||
/*
|
||||
if (((OPTPAL_Cluster[index].rmax-OPTPAL_Cluster[index].rmin+1)*
|
||||
(OPTPAL_Cluster[index].gmax-OPTPAL_Cluster[index].gmin+1)*
|
||||
(OPTPAL_Cluster[index].bmax-OPTPAL_Cluster[index].bmin+1))
|
||||
<
|
||||
((Set->rmax-Set->rmin+1)*
|
||||
(Set->gmax-Set->gmin+1)*
|
||||
(Set->bmax-Set->bmin+1))
|
||||
)
|
||||
*/
|
||||
break;
|
||||
|
||||
if (index<cs->nb)
|
||||
// Search the first cluster that is smaller than ours
|
||||
while (current && current->occurences > c->occurences)
|
||||
{
|
||||
// On distingue ici une insertion plutot qu'un placement en fin de liste.
|
||||
// On doit donc décaler les ensembles suivants vers la fin pour se faire
|
||||
// une place dans la liste.
|
||||
|
||||
//for (decalage=cs->nb;decalage>index;decalage--)
|
||||
// memcpy((cs->clusters+decalage),(cs->clusters+decalage-1),sizeof(T_Cluster));
|
||||
memmove(cs->clusters+index+1,cs->clusters+index,(cs->nb-index)*sizeof(T_Cluster));
|
||||
prev = current;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
cs->clusters[index]=*c;
|
||||
// Now insert our cluster just before the one we found
|
||||
c -> next = current;
|
||||
|
||||
current = malloc(sizeof(T_Cluster));
|
||||
*current = *c ;
|
||||
|
||||
if (prev) prev->next = current;
|
||||
else cs->clusters = current;
|
||||
|
||||
cs->nb++;
|
||||
}
|
||||
|
||||
@ -770,10 +799,11 @@ void CS_Set(T_Cluster_set * cs,T_Cluster * c)
|
||||
// 1) On considère l'espace (R,G,B) comme 1 boîte
|
||||
// 2) On cherche les extrêmes de la boîte en (R,G,B)
|
||||
// 3) On trie les pixels de l'image selon l'axe le plus long parmi (R,G,B)
|
||||
// 4) On coupe la boîte en deux au milieu, et on compacte pour que chaque bord corresponde bien à un pixel extreme
|
||||
// 4) On coupe la boîte en deux au milieu, et on compacte pour que chaque bord
|
||||
// corresponde bien à un pixel extreme
|
||||
// 5) On recommence à couper selon le plus grand axe toutes boîtes confondues
|
||||
// 6) On s'arrête quand on a le nombre de couleurs voulu
|
||||
void CS_Generate(T_Cluster_set * cs,T_Occurrence_table * to)
|
||||
void CS_Generate(T_Cluster_set * cs, T_Occurrence_table * to)
|
||||
{
|
||||
T_Cluster current;
|
||||
T_Cluster Nouveau1;
|
||||
@ -786,112 +816,109 @@ void CS_Generate(T_Cluster_set * cs,T_Occurrence_table * to)
|
||||
CS_Get(cs,¤t);
|
||||
|
||||
// On le coupe en deux
|
||||
Cluster_split(¤t,&Nouveau1,&Nouveau2,current.plus_large,to);
|
||||
Cluster_split(¤t, &Nouveau1, &Nouveau2, current.plus_large, to);
|
||||
|
||||
// On compacte ces deux nouveaux (il peut y avoir un espace entre l'endroit de la coupure et les premiers pixels du cluster)
|
||||
Cluster_analyser(&Nouveau1,to);
|
||||
Cluster_analyser(&Nouveau2,to);
|
||||
// On compacte ces deux nouveaux (il peut y avoir un espace entre l'endroit
|
||||
// de la coupure et les premiers pixels du cluster)
|
||||
Cluster_pack(&Nouveau1, to);
|
||||
Cluster_pack(&Nouveau2, to);
|
||||
|
||||
// On met ces deux nouveaux clusters dans le clusterSet... sauf s'ils sont vides
|
||||
if(Nouveau1.occurences>0)
|
||||
CS_Set(cs,&Nouveau1);
|
||||
if(Nouveau2.occurences>0)
|
||||
CS_Set(cs,&Nouveau2);
|
||||
// On les remet dans le set
|
||||
CS_Set(cs,&Nouveau1);
|
||||
CS_Set(cs,&Nouveau2);
|
||||
}
|
||||
}
|
||||
|
||||
void CS_Compute_colors(T_Cluster_set * cs,T_Occurrence_table * to)
|
||||
void CS_Compute_colors(T_Cluster_set * cs, T_Occurrence_table * to)
|
||||
{
|
||||
int index;
|
||||
T_Cluster * c;
|
||||
|
||||
for (index=0,c=cs->clusters;index<cs->nb;index++,c++)
|
||||
for (c=cs->clusters;c!=NULL;c=c->next)
|
||||
Cluster_compute_hue(c,to);
|
||||
}
|
||||
|
||||
void CS_Sort_by_chrominance(T_Cluster_set * cs)
|
||||
{
|
||||
int byte_used[256];
|
||||
int decalages[256];
|
||||
int index;
|
||||
T_Cluster * nc;
|
||||
T_Cluster* nc;
|
||||
T_Cluster* prev = NULL;
|
||||
T_Cluster* place;
|
||||
T_Cluster* newlist = NULL;
|
||||
|
||||
nc=(T_Cluster *)malloc(cs->nb_max*sizeof(T_Cluster));
|
||||
while (cs->clusters)
|
||||
{
|
||||
// Remove the first cluster from the original list
|
||||
nc = cs->clusters;
|
||||
cs->clusters = cs->clusters->next;
|
||||
|
||||
// Initialisation de la table d'occurence de chaque octet
|
||||
for (index=0;index<256;index++)
|
||||
byte_used[index]=0;
|
||||
// Find his position in the new list
|
||||
for (place = newlist; place != NULL; place = place->next)
|
||||
{
|
||||
if (place->h > nc->h) break;
|
||||
prev = place;
|
||||
}
|
||||
|
||||
// Comptage du nombre d'occurences de chaque octet
|
||||
for (index=0;index<cs->nb;index++)
|
||||
byte_used[cs->clusters[index].h]++;
|
||||
// Chain it there
|
||||
nc->next = place;
|
||||
if (prev) prev->next = nc;
|
||||
else newlist = nc;
|
||||
|
||||
// Calcul de la table des d‚calages
|
||||
decalages[0]=0;
|
||||
for (index=1;index<256;index++)
|
||||
decalages[index]=decalages[index-1]+byte_used[index-1];
|
||||
prev = NULL;
|
||||
}
|
||||
|
||||
// Copie r‚ordonn‚e dans la nouvelle liste
|
||||
for (index=0;index<cs->nb;index++)
|
||||
{
|
||||
nc[decalages[cs->clusters[index].h]]=cs->clusters[index];
|
||||
decalages[cs->clusters[index].h]++;
|
||||
}
|
||||
|
||||
// Remplacement de la liste d‚sordonn‚e par celle tri‚e
|
||||
free(cs->clusters);
|
||||
cs->clusters=nc;
|
||||
// Put the new list bavk in place
|
||||
cs->clusters = newlist;
|
||||
}
|
||||
|
||||
void CS_Sort_by_luminance(T_Cluster_set * cs)
|
||||
{
|
||||
int byte_used[256];
|
||||
int decalages[256];
|
||||
int index;
|
||||
T_Cluster * nc;
|
||||
T_Cluster* nc;
|
||||
T_Cluster* prev = NULL;
|
||||
T_Cluster* place;
|
||||
T_Cluster* newlist = NULL;
|
||||
|
||||
nc=(T_Cluster *)malloc(cs->nb_max*sizeof(T_Cluster));
|
||||
while (cs->clusters)
|
||||
{
|
||||
// Remove the first cluster from the original list
|
||||
nc = cs->clusters;
|
||||
cs->clusters = cs->clusters->next;
|
||||
|
||||
// Initialisation de la table d'occurence de chaque octet
|
||||
for (index=0;index<256;index++)
|
||||
byte_used[index]=0;
|
||||
// Find its position in the new list
|
||||
for (place = newlist; place != NULL; place = place->next)
|
||||
{
|
||||
if (place->l > nc->l) break;
|
||||
prev = place;
|
||||
}
|
||||
|
||||
// Comptage du nombre d'occurences de chaque octet
|
||||
for (index=0;index<cs->nb;index++)
|
||||
byte_used[cs->clusters[index].l]++;
|
||||
// Chain it there
|
||||
nc->next = place;
|
||||
if (prev) prev->next = nc;
|
||||
else newlist = nc;
|
||||
|
||||
// Calcul de la table des d‚calages
|
||||
decalages[0]=0;
|
||||
for (index=1;index<256;index++)
|
||||
decalages[index]=decalages[index-1]+byte_used[index-1];
|
||||
// reset prev pointer
|
||||
prev = NULL;
|
||||
}
|
||||
|
||||
// Copie r‚ordonn‚e dans la nouvelle liste
|
||||
for (index=0;index<cs->nb;index++)
|
||||
{
|
||||
nc[decalages[cs->clusters[index].l]]=cs->clusters[index];
|
||||
decalages[cs->clusters[index].l]++;
|
||||
}
|
||||
|
||||
// Remplacement de la liste d‚sordonn‚e par celle tri‚e
|
||||
free(cs->clusters);
|
||||
cs->clusters=nc;
|
||||
// Put the new list back in place
|
||||
cs->clusters = newlist;
|
||||
}
|
||||
|
||||
void CS_Generate_color_table_and_palette(T_Cluster_set * cs,T_Conversion_table * tc,T_Components * palette)
|
||||
{
|
||||
int index;
|
||||
int r,g,b;
|
||||
T_Cluster* current = cs->clusters;
|
||||
|
||||
for (index=0;index<cs->nb;index++)
|
||||
{
|
||||
palette[index].R=cs->clusters[index].r;
|
||||
palette[index].G=cs->clusters[index].g;
|
||||
palette[index].B=cs->clusters[index].b;
|
||||
palette[index].R=current->r;
|
||||
palette[index].G=current->g;
|
||||
palette[index].B=current->b;
|
||||
|
||||
for (r=cs->clusters[index].Rmin;r<=cs->clusters[index].Rmax;r++)
|
||||
for (g=cs->clusters[index].Gmin;g<=cs->clusters[index].Vmax;g++)
|
||||
for (b=cs->clusters[index].Bmin;b<=cs->clusters[index].Bmax;b++)
|
||||
for (r=current->Rmin; r<=current->Rmax; r++)
|
||||
for (g=current->Gmin;g<=current->Vmax;g++)
|
||||
for (b=current->Bmin;b<=current->Bmax;b++)
|
||||
CT_set(tc,r,g,b,index);
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -902,9 +929,9 @@ void CS_Generate_color_table_and_palette(T_Cluster_set * cs,T_Conversion_table *
|
||||
void GS_Init(T_Gradient_set * ds,T_Cluster_set * cs)
|
||||
{
|
||||
ds->gradients[0].nb_colors=1;
|
||||
ds->gradients[0].min=cs->clusters[0].h;
|
||||
ds->gradients[0].max=cs->clusters[0].h;
|
||||
ds->gradients[0].hue=cs->clusters[0].h;
|
||||
ds->gradients[0].min=cs->clusters->h;
|
||||
ds->gradients[0].max=cs->clusters->h;
|
||||
ds->gradients[0].hue=cs->clusters->h;
|
||||
// Et hop : le 1er ensemble de d‚grad‚s est initialis‚
|
||||
ds->nb=1;
|
||||
}
|
||||
@ -943,118 +970,129 @@ void GS_Delete(T_Gradient_set * ds)
|
||||
|
||||
void GS_Generate(T_Gradient_set * ds,T_Cluster_set * cs)
|
||||
{
|
||||
int ic,id; // Les indexs de parcours des ensembles
|
||||
int id; // Les indexs de parcours des ensembles
|
||||
int best_gradient; // Meilleur d‚grad‚
|
||||
int best_diff; // Meilleure diff‚rence de chrominance
|
||||
int diff; // difference de chrominance courante
|
||||
T_Cluster * current = cs->clusters;
|
||||
|
||||
// Pour chacun des clusters … traiter
|
||||
for (ic=0;ic<cs->nb;ic++)
|
||||
{
|
||||
// On recherche le d‚grad‚ le plus proche de la chrominance du cluster
|
||||
best_gradient=-1;
|
||||
best_diff=99999999;
|
||||
for (id=0;id<ds->nb;id++)
|
||||
{
|
||||
diff=abs(cs->clusters[ic].h - ds->gradients[id].hue);
|
||||
if ((best_diff>diff) && (diff<16))
|
||||
{
|
||||
best_gradient=id;
|
||||
best_diff=diff;
|
||||
}
|
||||
}
|
||||
do
|
||||
{
|
||||
// On recherche le d‚grad‚ le plus proche de la chrominance du cluster
|
||||
best_gradient=-1;
|
||||
best_diff=99999999;
|
||||
for (id=0;id<ds->nb;id++)
|
||||
{
|
||||
diff=abs(current->h - ds->gradients[id].hue);
|
||||
if ((best_diff>diff) && (diff<16))
|
||||
{
|
||||
best_gradient=id;
|
||||
best_diff=diff;
|
||||
}
|
||||
}
|
||||
|
||||
// Si on a trouv‚ un d‚grad‚ dans lequel inclure le cluster
|
||||
if (best_gradient!=-1)
|
||||
{
|
||||
// On met … jour le d‚grad‚
|
||||
if (cs->clusters[ic].h < ds->gradients[best_gradient].min)
|
||||
ds->gradients[best_gradient].min=cs->clusters[ic].h;
|
||||
if (cs->clusters[ic].h > ds->gradients[best_gradient].max)
|
||||
ds->gradients[best_gradient].max=cs->clusters[ic].h;
|
||||
ds->gradients[best_gradient].hue=((ds->gradients[best_gradient].hue*
|
||||
ds->gradients[best_gradient].nb_colors)
|
||||
+cs->clusters[ic].h)
|
||||
/(ds->gradients[best_gradient].nb_colors+1);
|
||||
ds->gradients[best_gradient].nb_colors++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On cr‚e un nouveau d‚grad‚
|
||||
best_gradient=ds->nb;
|
||||
ds->gradients[best_gradient].nb_colors=1;
|
||||
ds->gradients[best_gradient].min=cs->clusters[ic].h;
|
||||
ds->gradients[best_gradient].max=cs->clusters[ic].h;
|
||||
ds->gradients[best_gradient].hue=cs->clusters[ic].h;
|
||||
ds->nb++;
|
||||
}
|
||||
cs->clusters[ic].h=best_gradient;
|
||||
}
|
||||
// Si on a trouv‚ un d‚grad‚ dans lequel inclure le cluster
|
||||
if (best_gradient!=-1)
|
||||
{
|
||||
// On met … jour le d‚grad‚
|
||||
if (current->h < ds->gradients[best_gradient].min)
|
||||
ds->gradients[best_gradient].min=current->h;
|
||||
if (current->h > ds->gradients[best_gradient].max)
|
||||
ds->gradients[best_gradient].max=current->h;
|
||||
ds->gradients[best_gradient].hue=((ds->gradients[best_gradient].hue*
|
||||
ds->gradients[best_gradient].nb_colors)
|
||||
+current->h)
|
||||
/(ds->gradients[best_gradient].nb_colors+1);
|
||||
ds->gradients[best_gradient].nb_colors++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On cr‚e un nouveau d‚grad‚
|
||||
best_gradient=ds->nb;
|
||||
ds->gradients[best_gradient].nb_colors=1;
|
||||
ds->gradients[best_gradient].min=current->h;
|
||||
ds->gradients[best_gradient].max=current->h;
|
||||
ds->gradients[best_gradient].hue=current->h;
|
||||
ds->nb++;
|
||||
}
|
||||
current->h=best_gradient;
|
||||
} while((current = current->next));
|
||||
|
||||
// On redistribue les valeurs dans les clusters
|
||||
for (ic=0;ic<cs->nb;ic++)
|
||||
cs->clusters[ic].h=ds->gradients[cs->clusters[ic].h].hue;
|
||||
// On redistribue les valeurs dans les clusters
|
||||
current = cs -> clusters;
|
||||
do
|
||||
current->h=ds->gradients[current->h].hue;
|
||||
while((current = current ->next));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
T_Conversion_table * Optimize_palette(T_Bitmap24B image,int size,T_Components * palette,int r,int g,int b)
|
||||
T_Conversion_table * Optimize_palette(T_Bitmap24B image, int size,
|
||||
T_Components * palette, int r, int g, int b)
|
||||
{
|
||||
T_Occurrence_table * to;
|
||||
T_Occurrence_table * to;
|
||||
T_Conversion_table * tc;
|
||||
T_Cluster_set * cs;
|
||||
T_Gradient_set * ds;
|
||||
T_Cluster_set * cs;
|
||||
T_Gradient_set * ds;
|
||||
|
||||
// Création des éléments nécessaires au calcul de palette optimisée:
|
||||
to=0; tc=0; cs=0; ds=0;
|
||||
to = 0; tc = 0; cs = 0; ds = 0;
|
||||
|
||||
to=OT_new(r,g,b);
|
||||
if (to!=0)
|
||||
to = OT_new(r, g, b);
|
||||
if (to == NULL)
|
||||
return 0;
|
||||
|
||||
tc = CT_new(r, g, b);
|
||||
if (tc == NULL)
|
||||
{
|
||||
tc=CT_new(r,g,b);
|
||||
if (tc!=0)
|
||||
{
|
||||
|
||||
// Première étape : on compte les pixels de chaque couleur pour pouvoir trier là dessus
|
||||
OT_count_occurrences(to,image,size);
|
||||
|
||||
cs=CS_New(256,to);
|
||||
if (cs!=0)
|
||||
{
|
||||
// C'est bon, on a pu tout allouer
|
||||
|
||||
// On génère les clusters (avec l'algo du median cut)
|
||||
CS_Generate(cs,to);
|
||||
|
||||
// On calcule la teinte de chaque pixel (Luminance et chrominance)
|
||||
CS_Compute_colors(cs,to);
|
||||
|
||||
ds=GS_New(cs);
|
||||
if (ds!=0)
|
||||
{
|
||||
GS_Generate(ds,cs);
|
||||
GS_Delete(ds);
|
||||
}
|
||||
|
||||
// Enfin on trie les clusters (donc les couleurs de la palette) dans un ordre sympa : par couleur, et par luminosité pour chaque couleur
|
||||
CS_Sort_by_luminance(cs);
|
||||
CS_Sort_by_chrominance(cs);
|
||||
|
||||
// Enfin on génère la palette et la table de correspondance entre chaque couleur 24b et sa couleur palette associée.
|
||||
CS_Generate_color_table_and_palette(cs,tc,palette);
|
||||
|
||||
CS_Delete(cs);
|
||||
OT_delete(to);
|
||||
return tc;
|
||||
}
|
||||
CT_delete(tc);
|
||||
}
|
||||
OT_delete(to);
|
||||
OT_delete(to);
|
||||
return 0;
|
||||
}
|
||||
// Si on arrive ici c'est que l'allocation n'a pas réussi,
|
||||
// l'appelant devra recommencer avec une précision plus faible (3 derniers paramètres)
|
||||
return 0;
|
||||
|
||||
// Première étape : on compte les pixels de chaque couleur pour pouvoir trier là dessus
|
||||
OT_count_occurrences(to, image, size);
|
||||
|
||||
cs = CS_New(256, to);
|
||||
if (cs == NULL)
|
||||
{
|
||||
CT_delete(tc);
|
||||
OT_delete(to);
|
||||
return 0;
|
||||
}
|
||||
//CS_Check(cs);
|
||||
// C'est bon, on a pu tout allouer
|
||||
|
||||
// On génère les clusters (avec l'algo du median cut)
|
||||
CS_Generate(cs, to);
|
||||
//CS_Check(cs);
|
||||
|
||||
// On calcule la teinte de chaque pixel (Luminance et chrominance)
|
||||
CS_Compute_colors(cs, to);
|
||||
//CS_Check(cs);
|
||||
|
||||
ds = GS_New(cs);
|
||||
if (ds!= NULL)
|
||||
{
|
||||
GS_Generate(ds, cs);
|
||||
GS_Delete(ds);
|
||||
}
|
||||
// Enfin on trie les clusters (donc les couleurs de la palette) dans un ordre
|
||||
// sympa : par couleur, et par luminosité pour chaque couleur
|
||||
CS_Sort_by_luminance(cs);
|
||||
//CS_Check(cs);
|
||||
CS_Sort_by_chrominance(cs);
|
||||
//CS_Check(cs);
|
||||
|
||||
// Enfin on génère la palette et la table de correspondance entre chaque
|
||||
// couleur 24b et sa couleur palette associée.
|
||||
CS_Generate_color_table_and_palette(cs, tc, palette);
|
||||
//CS_Check(cs);
|
||||
|
||||
CS_Delete(cs);
|
||||
OT_delete(to);
|
||||
return tc;
|
||||
}
|
||||
|
||||
int Modified_value(int value,int modif)
|
||||
@ -1164,9 +1202,42 @@ void Convert_24b_bitmap_to_256_Floyd_Steinberg(T_Bitmap256 dest,T_Bitmap24B sour
|
||||
d++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Convert_24b_bitmap_to_256_nearest_neighbor(T_Bitmap256 dest,
|
||||
T_Bitmap24B source, int width, int height, T_Components * palette,
|
||||
T_Conversion_table * tc)
|
||||
{
|
||||
T_Bitmap24B current;
|
||||
T_Bitmap256 d;
|
||||
int x_pos, y_pos;
|
||||
int red, green, blue;
|
||||
|
||||
// On initialise les variables de parcours:
|
||||
current =source; // Le pixel dont on s'occupe
|
||||
|
||||
d =dest;
|
||||
|
||||
// On parcours chaque pixel:
|
||||
for (y_pos = 0; y_pos < height; y_pos++)
|
||||
{
|
||||
for (x_pos = 0 ;x_pos < width; x_pos++)
|
||||
{
|
||||
// On prends la meilleure couleur de la palette qui traduit la couleur
|
||||
// 24 bits de la source:
|
||||
red = current->R;
|
||||
green = current->G;
|
||||
blue = current->B;
|
||||
// Cherche la couleur correspondant dans la palette et la range dans
|
||||
// l'image de destination
|
||||
*d = CT_get(tc, red, green, blue);
|
||||
|
||||
// On passe au pixel suivant :
|
||||
current++;
|
||||
d++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const byte precision_24b[]=
|
||||
@ -1207,7 +1278,8 @@ int Convert_24b_bitmap_to_256(T_Bitmap256 dest,T_Bitmap24B source,int width,int
|
||||
|
||||
if (table!=0)
|
||||
{
|
||||
Convert_24b_bitmap_to_256_Floyd_Steinberg(dest,source,width,height,palette,table);
|
||||
//Convert_24b_bitmap_to_256_Floyd_Steinberg(dest,source,width,height,palette,table);
|
||||
Convert_24b_bitmap_to_256_nearest_neighbor(dest,source,width,height,palette,table);
|
||||
CT_delete(table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
6
op_c.h
@ -88,7 +88,7 @@ typedef struct
|
||||
|
||||
///////////////////////////////////////// Définition d'un ensemble de couleur
|
||||
|
||||
typedef struct
|
||||
typedef struct S_Cluster
|
||||
{
|
||||
int occurences; // Nb total d'occurences des couleurs de l'ensemble
|
||||
|
||||
@ -106,6 +106,8 @@ typedef struct
|
||||
byte r,g,b; // color synthétisant l'ensemble
|
||||
byte h; // Chrominance
|
||||
byte l; // Luminosité
|
||||
|
||||
struct S_Cluster* next;
|
||||
} T_Cluster;
|
||||
|
||||
|
||||
@ -174,7 +176,7 @@ void OT_count_occurrences(T_Occurrence_table * t,T_Bitmap24B image,int size);
|
||||
///////////////////////////////////////// Méthodes de gestion des clusters //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Cluster_analyser(T_Cluster * c,T_Occurrence_table * to);
|
||||
void Cluster_pack(T_Cluster * c,T_Occurrence_table * to);
|
||||
void Cluster_split(T_Cluster * c,T_Cluster * c1,T_Cluster * c2,int hue,T_Occurrence_table * to);
|
||||
void Cluster_compute_hue(T_Cluster * c,T_Occurrence_table * to);
|
||||
|
||||
|
||||
217
operatio.c
@ -39,7 +39,8 @@
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
/// Time (in SDL ticks) when the next airbrush drawing should be done. Also used for discontinuous freehand drawing.
|
||||
/// Time (in SDL ticks) when the next airbrush drawing should be done. Also used
|
||||
/// for discontinuous freehand drawing.
|
||||
Uint32 Airbrush_next_time;
|
||||
|
||||
void Start_operation_stack(word new_operation)
|
||||
@ -223,7 +224,7 @@ void Freehand_mode1_1_2(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Print_coordinates();
|
||||
Draw_line_permanet(start_x,start_y,Paintbrush_X,Paintbrush_Y,Fore_color);
|
||||
Draw_line_permanent(start_x,start_y,Paintbrush_X,Paintbrush_Y,Fore_color);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
@ -240,6 +241,7 @@ void Freehand_mode12_0_2(void)
|
||||
// Souris effacée: Non
|
||||
{
|
||||
Operation_stack_size=0;
|
||||
End_of_modification();
|
||||
}
|
||||
|
||||
|
||||
@ -277,7 +279,7 @@ void Freehand_mode1_2_2(void)
|
||||
{
|
||||
Print_coordinates();
|
||||
Hide_cursor();
|
||||
Draw_line_permanet(start_x,start_y,Paintbrush_X,Paintbrush_Y,Back_color);
|
||||
Draw_line_permanent(start_x,start_y,Paintbrush_X,Paintbrush_Y,Back_color);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
@ -430,6 +432,7 @@ void Freehand_mode3_0_1(void)
|
||||
//
|
||||
// Souris effacée: Non
|
||||
{
|
||||
End_of_modification();
|
||||
Operation_stack_size--;
|
||||
}
|
||||
|
||||
@ -482,26 +485,33 @@ void Line_12_5(void)
|
||||
//
|
||||
// Souris effacée: Non
|
||||
|
||||
// Poursuite du tracé d'une ligne (déplacement de la souris en gardant le curseur appuyé)
|
||||
// Poursuite du tracé d'une ligne (déplacement de la souris en gardant le
|
||||
// curseur appuyé)
|
||||
{
|
||||
short start_x;
|
||||
short start_y;
|
||||
short end_x;
|
||||
short end_y;
|
||||
|
||||
short cursor_x;
|
||||
short cursor_y;
|
||||
|
||||
Operation_pop(&end_y);
|
||||
Operation_pop(&end_x);
|
||||
Operation_pop(&start_y);
|
||||
Operation_pop(&start_x);
|
||||
|
||||
cursor_x = Paintbrush_X;
|
||||
cursor_y = Paintbrush_Y;
|
||||
|
||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||
if(SDL_GetModState() & KMOD_SHIFT)
|
||||
{
|
||||
Clamp_coordinates_45_degrees(start_x,start_y,&Paintbrush_X,&Paintbrush_Y);
|
||||
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
|
||||
}
|
||||
|
||||
// On vient de bouger
|
||||
if ((Paintbrush_X!=end_x) || (Paintbrush_Y!=end_y))
|
||||
if ((cursor_x!=end_x) || (cursor_y!=end_y))
|
||||
{
|
||||
Hide_cursor();
|
||||
|
||||
@ -511,18 +521,18 @@ void Line_12_5(void)
|
||||
if (Mouse_K==LEFT_SIDE)
|
||||
{
|
||||
Pixel_figure_preview (start_x,start_y,Fore_color);
|
||||
Draw_line_preview (start_x,start_y,Paintbrush_X,Paintbrush_Y,Fore_color);
|
||||
Draw_line_preview (start_x,start_y,cursor_x,cursor_y,Fore_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pixel_figure_preview (start_x,start_y,Back_color);
|
||||
Draw_line_preview (start_x,start_y,Paintbrush_X,Paintbrush_Y,Back_color);
|
||||
Draw_line_preview (start_x,start_y,cursor_x,cursor_y,Back_color);
|
||||
}
|
||||
|
||||
Operation_push(start_x);
|
||||
Operation_push(start_y);
|
||||
Operation_push(Paintbrush_X);
|
||||
Operation_push(Paintbrush_Y);
|
||||
Operation_push(cursor_x);
|
||||
Operation_push(cursor_y);
|
||||
|
||||
Display_cursor();
|
||||
}
|
||||
@ -557,17 +567,14 @@ void Line_0_5(void)
|
||||
Operation_pop(&start_x);
|
||||
Operation_pop(&color);
|
||||
|
||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||
if(SDL_GetModState() & KMOD_SHIFT)
|
||||
Clamp_coordinates_45_degrees(start_x,start_y,&end_x,&end_y);
|
||||
|
||||
Paintbrush_shape=Paintbrush_shape_before_operation;
|
||||
|
||||
Pixel_figure_preview_auto (start_x,start_y);
|
||||
Hide_line_preview (start_x,start_y,end_x,end_y);
|
||||
Display_paintbrush (start_x,start_y,color,0);
|
||||
Draw_line_permanet(start_x,start_y,end_x,end_y,color);
|
||||
Draw_line_permanent(start_x,start_y,end_x,end_y,color);
|
||||
|
||||
End_of_modification();
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -688,7 +695,7 @@ void K_line_0_6(void)
|
||||
Display_paintbrush(start_x,start_y,color,0);
|
||||
direction=(direction & 0x7F);
|
||||
}
|
||||
Draw_line_permanet(start_x,start_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
Draw_line_permanent(start_x,start_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
Paintbrush_shape=PAINTBRUSH_SHAPE_POINT;
|
||||
|
||||
Operation_push(direction);
|
||||
@ -746,6 +753,7 @@ void K_line_12_7(void)
|
||||
Hide_cursor();
|
||||
Paintbrush_shape=Paintbrush_shape_before_operation;
|
||||
|
||||
End_of_modification();
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -921,6 +929,8 @@ void Empty_rectangle_0_5(void)
|
||||
Paintbrush_X=old_paintbrush_x;
|
||||
Paintbrush_Y=old_paintbrush_y;
|
||||
|
||||
End_of_modification();
|
||||
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
Print_in_menu("X: Y:",0);
|
||||
Print_coordinates();
|
||||
@ -966,6 +976,7 @@ void Filled_rectangle_0_5(void)
|
||||
Paintbrush_X=old_paintbrush_x;
|
||||
Paintbrush_Y=old_paintbrush_y;
|
||||
|
||||
End_of_modification();
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y:",0);
|
||||
@ -1098,6 +1109,8 @@ void Empty_circle_0_5(void)
|
||||
|
||||
Draw_empty_circle_permanent(center_x,center_y,radius,color);
|
||||
|
||||
End_of_modification();
|
||||
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y:",0);
|
||||
@ -1137,6 +1150,7 @@ void Filled_circle_0_5(void)
|
||||
|
||||
Draw_filled_circle(center_x,center_y,radius,color);
|
||||
|
||||
End_of_modification();
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y:",0);
|
||||
@ -1267,6 +1281,8 @@ void Empty_ellipse_0_5(void)
|
||||
|
||||
Draw_empty_ellipse_permanent(center_x,center_y,horizontal_radius,vertical_radius,color);
|
||||
|
||||
End_of_modification();
|
||||
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -1308,6 +1324,7 @@ void Filled_ellipse_0_5(void)
|
||||
|
||||
Draw_filled_ellipse(center_x,center_y,horizontal_radius,vertical_radius,color);
|
||||
|
||||
End_of_modification();
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -1336,6 +1353,7 @@ void Fill_1_0(void)
|
||||
Shade_table=Shade_table_left;
|
||||
Fill_general(Fore_color);
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
|
||||
@ -1357,6 +1375,7 @@ void Fill_2_0(void)
|
||||
Shade_table=Shade_table_right;
|
||||
Fill_general(Back_color);
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
|
||||
@ -1381,6 +1400,7 @@ void Replace_1_0(void)
|
||||
// Shade_table=Shade_table_left;
|
||||
Replace(Fore_color);
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
|
||||
@ -1402,6 +1422,7 @@ void Replace_2_0(void)
|
||||
// Shade_table=Shade_table_right;
|
||||
Replace(Back_color);
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
|
||||
@ -1891,6 +1912,7 @@ void Curve_4_points_2_9(void)
|
||||
Draw_curve_permanent(x1,y1,x2,y2,x3,y3,x4,y4,color);
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
|
||||
@ -2045,6 +2067,7 @@ void Curve_3_points_12_11(void)
|
||||
Compute_3_point_curve(x1,y1,x4,y4,&x2,&y2,&x3,&y3);
|
||||
Draw_curve_permanent(x1,y1,x2,y2,x3,y3,x4,y4,color);
|
||||
|
||||
End_of_modification();
|
||||
Display_cursor();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
@ -2132,6 +2155,7 @@ void Airbrush_0_2(void)
|
||||
//
|
||||
{
|
||||
Operation_stack_size-=2;
|
||||
End_of_modification();
|
||||
}
|
||||
|
||||
|
||||
@ -2218,10 +2242,11 @@ void Polygon_12_9(void)
|
||||
Paintbrush_shape=Paintbrush_shape_before_operation;
|
||||
// Le pied aurait été de ne pas repasser sur le 1er point de la 1ère ligne
|
||||
// mais c'est pas possible :(
|
||||
Draw_line_permanet(start_x,start_y,end_x,end_y,color);
|
||||
Draw_line_permanent(start_x,start_y,end_x,end_y,color);
|
||||
Paintbrush_shape=PAINTBRUSH_SHAPE_POINT;
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
Hide_cursor();
|
||||
|
||||
@ -2420,6 +2445,7 @@ void Polyfill_12_9(void)
|
||||
Polyfill(Polyfill_number_of_points,Polyfill_table_of_points,color);
|
||||
free(Polyfill_table_of_points);
|
||||
|
||||
End_of_modification();
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -2508,7 +2534,7 @@ void Polyform_12_8(void)
|
||||
Hide_line_preview(start_x,start_y,end_x,end_y);
|
||||
|
||||
// On l'affiche de façon définitive:
|
||||
Draw_line_permanet(start_x,start_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
Draw_line_permanent(start_x,start_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
|
||||
// Et on affiche un pixel de preview en (Paintbrush_X,Paintbrush_Y):
|
||||
Pixel_figure_preview(Paintbrush_X,Paintbrush_Y,color);
|
||||
@ -2539,9 +2565,10 @@ void Polyform_12_8(void)
|
||||
Hide_line_preview(start_x,start_y,end_x,end_y);
|
||||
|
||||
// On affiche de façon définitive le bouclage du polygone:
|
||||
Draw_line_permanet(start_x,start_y,initial_x,initial_y,color);
|
||||
Draw_line_permanent(start_x,start_y,initial_x,initial_y,color);
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
}
|
||||
@ -2751,6 +2778,7 @@ void Filled_polyform_12_8(void)
|
||||
Paintbrush_hidden=0;
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
}
|
||||
@ -2834,6 +2862,7 @@ void Filled_contour_0_8(void)
|
||||
Paintbrush_hidden=0;
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////// OPERATION_GRAB_BRUSH
|
||||
@ -2976,6 +3005,7 @@ void Brush_0_5(void)
|
||||
Brush_offset_Y=(Brush_offset_Y/Snap_height)*Snap_height;
|
||||
}
|
||||
|
||||
End_of_modification();
|
||||
Return_to_draw_mode();
|
||||
}
|
||||
|
||||
@ -3099,6 +3129,8 @@ void Polybrush_12_8(void)
|
||||
Brush_offset_Y=(Brush_offset_Y/Snap_height)*Snap_height;
|
||||
}
|
||||
|
||||
if (click==RIGHT_SIDE)
|
||||
End_of_modification();
|
||||
Return_to_draw_mode();
|
||||
Display_cursor();
|
||||
}
|
||||
@ -3948,6 +3980,7 @@ void Scroll_0_4(void)
|
||||
{
|
||||
Operation_stack_size-=4;
|
||||
Cursor_hidden=Cursor_hidden_before_scroll;
|
||||
End_of_modification();
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -4113,6 +4146,7 @@ void Grad_circle_0_6(void)
|
||||
|
||||
Draw_filled_circle(center_x,center_y,radius,Back_color);
|
||||
|
||||
End_of_modification();
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -4164,6 +4198,7 @@ void Grad_circle_12_8(void)
|
||||
Draw_grad_circle(center_x,center_y,radius,Paintbrush_X,Paintbrush_Y);
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
@ -4367,6 +4402,7 @@ void Grad_ellipse_0_6(void)
|
||||
|
||||
Draw_filled_ellipse(center_x,center_y,horizontal_radius,vertical_radius,Back_color);
|
||||
|
||||
End_of_modification();
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
{
|
||||
Print_in_menu("X: Y: ",0);
|
||||
@ -4419,7 +4455,7 @@ void Grad_ellipse_12_8(void)
|
||||
Draw_grad_ellipse(center_x,center_y,horizontal_radius,vertical_radius,Paintbrush_X,Paintbrush_Y);
|
||||
|
||||
Display_cursor();
|
||||
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
@ -4546,40 +4582,67 @@ void Grad_rectangle_0_5(void)
|
||||
Paintbrush_Y = ray;
|
||||
Hide_cursor();
|
||||
|
||||
width = abs(rbx-rax);
|
||||
height = abs(rby-ray);
|
||||
width = abs(rbx - rax);
|
||||
height = abs(rby - ray);
|
||||
|
||||
if (Max(rax,rbx)-Main_offset_X > Min(Main_image_width,Main_magnifier_mode?Main_separator_position:Screen_width)) // Tous les clippings à gérer sont là
|
||||
offset_width = Max(rax,rbx) - Min(Main_image_width,Main_magnifier_mode?Main_separator_position:Screen_width);
|
||||
// Check if the rectangle is not fully outside the picture
|
||||
if (Min(rax, rbx) > Main_image_width || Min(ray, rby) > Main_image_height)
|
||||
{
|
||||
Operation_pop(&rby); // reset the stack
|
||||
return; // cancel the operation
|
||||
}
|
||||
|
||||
if (Max(ray,rby)-Main_offset_Y > Min(Main_image_height,Menu_Y))
|
||||
offset_height = Max(ray,rby) - Min(Main_image_height,Menu_Y);
|
||||
// Handle clipping
|
||||
if (Max(rax, rbx)-Main_offset_X > Min(Main_image_width,
|
||||
Main_magnifier_mode?Main_separator_position:Screen_width))
|
||||
{
|
||||
offset_width = Max(rax, rbx) - Min(Main_image_width,
|
||||
Main_magnifier_mode?Main_separator_position:Screen_width);
|
||||
}
|
||||
|
||||
// Dessin dans la zone de dessin normale
|
||||
Horizontal_XOR_line(Min(rax,rbx)-Main_offset_X,Min(ray,rby)-Main_offset_Y,width - offset_width);
|
||||
if(offset_height == 0)
|
||||
Horizontal_XOR_line(Min(rax,rbx)-Main_offset_X,Max(ray,rby)-1-Main_offset_Y,width - offset_width);
|
||||
if (Max(ray, rby)-Main_offset_Y > Min(Main_image_height, Menu_Y))
|
||||
offset_height = Max(ray, rby) - Min(Main_image_height, Menu_Y);
|
||||
|
||||
Vertical_XOR_line(Min(rax,rbx)-Main_offset_X,Min(ray,rby)-Main_offset_Y,height-offset_height);
|
||||
if (offset_width == 0) // Sinon cette ligne est en dehors de la zone image, inutile de la dessiner
|
||||
Vertical_XOR_line(Max(rax,rbx)-1-Main_offset_X,Min(ray,rby)-Main_offset_Y,height-offset_height);
|
||||
// Dessin dans la zone de dessin normale
|
||||
Horizontal_XOR_line(Min(rax, rbx)-Main_offset_X,
|
||||
Min(ray, rby) - Main_offset_Y, width - offset_width);
|
||||
|
||||
Update_rect(Min(rax,rbx)-Main_offset_X,Min(ray,rby)-Main_offset_Y,width+1-offset_width,height+1-offset_height);
|
||||
// If not, this line is out of the picture so there is no need to draw it
|
||||
if (offset_height == 0)
|
||||
{
|
||||
Horizontal_XOR_line(Min(rax, rbx) - Main_offset_X, Max(ray, rby) - 1
|
||||
- Main_offset_Y, width - offset_width);
|
||||
}
|
||||
|
||||
Vertical_XOR_line(Min(rax, rbx)-Main_offset_X, Min(ray, rby)
|
||||
- Main_offset_Y, height - offset_height);
|
||||
|
||||
if (offset_width == 0)
|
||||
{
|
||||
Vertical_XOR_line(Max(rax, rbx) - 1 - Main_offset_X, Min(ray, rby)
|
||||
- Main_offset_Y, height - offset_height);
|
||||
}
|
||||
|
||||
Update_rect(Min(rax, rbx) - Main_offset_X, Min(ray, rby) - Main_offset_Y,
|
||||
width + 1 - offset_width, height + 1 - offset_height);
|
||||
|
||||
// Dessin dans la zone zoomée
|
||||
if(Main_magnifier_mode && Min(rax,rbx)<Limit_visible_right_zoom && Max(rax,rbx)>Limit_left_zoom && Min(ray,rby)<Limit_visible_bottom_zoom && Max(ray,rby)>Limit_top_zoom )
|
||||
if (Main_magnifier_mode && Min(rax, rbx) <= Limit_right_zoom
|
||||
&& Max(rax, rbx) > Limit_left_zoom
|
||||
&& Min(ray, rby) <= Limit_bottom_zoom
|
||||
&& Max(ray, rby) > Limit_top_zoom )
|
||||
{
|
||||
offset_width = 0;
|
||||
offset_height=0;
|
||||
offset_width = 0;
|
||||
offset_height = 0;
|
||||
|
||||
if(Min(rax,rbx)<Limit_left_zoom) // On dépasse du zoom à gauche
|
||||
{
|
||||
offset_width += Limit_left_zoom - Min(rax,rbx);
|
||||
offset_left = Limit_left_zoom;
|
||||
}
|
||||
if (Min(rax, rbx)<=Limit_left_zoom) // On dépasse du zoom à gauche
|
||||
{
|
||||
offset_width += Limit_left_zoom - Min(rax, rbx);
|
||||
offset_left = Limit_left_zoom;
|
||||
}
|
||||
|
||||
if(Max(rax,rbx)>Limit_visible_right_zoom) // On dépasse du zoom à droite
|
||||
offset_width += Max(rax,rbx) - Limit_visible_right_zoom;
|
||||
if(Max(rax,rbx)>Limit_right_zoom) // On dépasse du zoom à droite
|
||||
offset_width += Max(rax,rbx) - Limit_right_zoom - 1;
|
||||
|
||||
if(Min(ray,rby)<Limit_top_zoom) // On dépasse du zoom en haut
|
||||
{
|
||||
@ -4587,15 +4650,15 @@ void Grad_rectangle_0_5(void)
|
||||
offset_top = Limit_top_zoom;
|
||||
}
|
||||
|
||||
if(Max(ray,rby)>Limit_visible_bottom_zoom) // On dépasse du zoom en bas
|
||||
offset_height += Max(ray,rby) - Limit_visible_bottom_zoom;
|
||||
if(Max(ray,rby)>Limit_bottom_zoom) // On dépasse du zoom en bas
|
||||
offset_height += Max(ray,rby) - Limit_bottom_zoom - 1;
|
||||
|
||||
if(width > offset_width)
|
||||
{
|
||||
if(offset_top==0) // La ligne du haut est visible
|
||||
Horizontal_XOR_line_zoom(offset_left>0?offset_left:Min(rax,rbx),Min(ray,rby),width-offset_width);
|
||||
|
||||
if(Max(ray,rby)<Limit_visible_bottom_zoom) // La ligne du bas est visible
|
||||
if(Max(ray,rby)<=Limit_bottom_zoom) // La ligne du bas est visible
|
||||
Horizontal_XOR_line_zoom(offset_left>0?offset_left:Min(rax,rbx),Max(ray,rby),width-offset_width);
|
||||
}
|
||||
|
||||
@ -4604,7 +4667,7 @@ void Grad_rectangle_0_5(void)
|
||||
if(offset_left==0) // La ligne de gauche est visible
|
||||
Vertical_XOR_line_zoom(Min(rax,rbx),offset_top>0?offset_top:Min(ray,rby),height-offset_height);
|
||||
|
||||
if(Max(rax,rbx)<Limit_visible_right_zoom) // La ligne de droite est visible
|
||||
if(Max(rax,rbx)<=Limit_right_zoom) // La ligne de droite est visible
|
||||
Vertical_XOR_line_zoom(Max(rax,rbx),offset_top>0?offset_top:Min(ray,rby),height-offset_height);
|
||||
}
|
||||
}
|
||||
@ -4701,7 +4764,9 @@ void Grad_rectangle_12_7(void)
|
||||
Update_rect(Min(rax,rbx)-Main_offset_X,Min(ray,rby)-Main_offset_Y,width+1-offset_width,height+1-offset_height);
|
||||
|
||||
// Dessin dans la zone zoomée
|
||||
if(Main_magnifier_mode && Min(rax,rbx)<Limit_visible_right_zoom && Max(rax,rbx)>Limit_left_zoom && Min(ray,rby)<Limit_visible_bottom_zoom && Max(ray,rby)>Limit_top_zoom )
|
||||
if (Main_magnifier_mode && Min(rax, rbx) <= Limit_right_zoom
|
||||
&& Max(rax, rbx)>Limit_left_zoom && Min(ray, rby) <= Limit_bottom_zoom
|
||||
&& Max(ray,rby)>Limit_top_zoom )
|
||||
{
|
||||
offset_width = 0;
|
||||
offset_height=0;
|
||||
@ -4712,8 +4777,8 @@ void Grad_rectangle_12_7(void)
|
||||
offset_left = Limit_left_zoom;
|
||||
}
|
||||
|
||||
if(Max(rax,rbx)>Limit_visible_right_zoom) // On dépasse du zoom à droite
|
||||
offset_width += Max(rax,rbx) - Limit_visible_right_zoom;
|
||||
if(Max(rax,rbx)>Limit_right_zoom) // On dépasse du zoom à droite
|
||||
offset_width += Max(rax,rbx) - Limit_right_zoom - 1;
|
||||
|
||||
if(Min(ray,rby)<Limit_top_zoom) // On dépasse du zoom en haut
|
||||
{
|
||||
@ -4721,15 +4786,15 @@ void Grad_rectangle_12_7(void)
|
||||
offset_top = Limit_top_zoom;
|
||||
}
|
||||
|
||||
if(Max(ray,rby)>Limit_visible_bottom_zoom) // On dépasse du zoom en bas
|
||||
offset_height += Max(ray,rby) - Limit_visible_bottom_zoom;
|
||||
if(Max(ray,rby)>Limit_bottom_zoom) // On dépasse du zoom en bas
|
||||
offset_height += Max(ray,rby) - Limit_bottom_zoom - 1;
|
||||
|
||||
if(width > offset_width)
|
||||
{
|
||||
if(offset_top==0) // La ligne du haut est visible
|
||||
Horizontal_XOR_line_zoom(offset_left>0?offset_left:Min(rax,rbx),Min(ray,rby),width-offset_width);
|
||||
|
||||
if(Max(ray,rby)<Limit_visible_bottom_zoom) // La ligne du bas est visible
|
||||
if(Max(ray,rby)<Limit_bottom_zoom) // La ligne du bas est visible
|
||||
Horizontal_XOR_line_zoom(offset_left>0?offset_left:Min(rax,rbx),Max(ray,rby),width-offset_width);
|
||||
}
|
||||
|
||||
@ -4738,7 +4803,7 @@ void Grad_rectangle_12_7(void)
|
||||
if(offset_left==0) // La ligne de gauche est visible
|
||||
Vertical_XOR_line_zoom(Min(rax,rbx),offset_top>0?offset_top:Min(ray,rby),height-offset_height);
|
||||
|
||||
if(Max(rax,rbx)<Limit_visible_right_zoom) // La ligne de droite est visible
|
||||
if(Max(rax,rbx)<=Limit_right_zoom) // La ligne de droite est visible
|
||||
Vertical_XOR_line_zoom(Max(rax,rbx),offset_top>0?offset_top:Min(ray,rby),height-offset_height);
|
||||
}
|
||||
}
|
||||
@ -4758,30 +4823,34 @@ void Grad_rectangle_12_9(void)
|
||||
short start_y;
|
||||
short end_x;
|
||||
short end_y;
|
||||
short cursor_x;
|
||||
short cursor_y;
|
||||
|
||||
Operation_pop(&end_y);
|
||||
Operation_pop(&end_x);
|
||||
Operation_pop(&start_y);
|
||||
Operation_pop(&start_x);
|
||||
|
||||
if ((Paintbrush_X!=end_x) || (Paintbrush_Y!=end_y))
|
||||
{
|
||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||
if(SDL_GetModState() & KMOD_SHIFT)
|
||||
Clamp_coordinates_45_degrees(start_x,start_y,&Paintbrush_X,&Paintbrush_Y);
|
||||
cursor_x = Paintbrush_X;
|
||||
cursor_y = Paintbrush_Y;
|
||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||
if(SDL_GetModState() & KMOD_SHIFT)
|
||||
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
|
||||
|
||||
if ((cursor_x!=end_x) || (cursor_y!=end_y))
|
||||
{
|
||||
Display_coords_rel_or_abs(start_x,start_y);
|
||||
|
||||
Draw_line_preview_xor(start_x,start_y,end_x,end_y,0);
|
||||
Draw_line_preview_xor(start_x,start_y,Paintbrush_X,Paintbrush_Y,0);
|
||||
Draw_line_preview_xor(start_x,start_y,cursor_x,cursor_y,0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Operation_push(start_x);
|
||||
Operation_push(start_y);
|
||||
Operation_push(Paintbrush_X);
|
||||
Operation_push(Paintbrush_Y);
|
||||
Operation_push(cursor_x);
|
||||
Operation_push(cursor_y);
|
||||
}
|
||||
|
||||
void Grad_rectangle_0_9(void)
|
||||
@ -4849,7 +4918,11 @@ void Grad_rectangle_0_9(void)
|
||||
Update_rect(Min(rect_start_x,rect_end_x)-Main_offset_X,Min(rect_start_y,rect_end_y)-Main_offset_Y,width+1-offset_width,height+1-offset_height);
|
||||
|
||||
// Dessin dans la zone zoomée
|
||||
if(Main_magnifier_mode && Min(rect_start_x,rect_end_x)<Limit_visible_right_zoom && Max(rect_start_x,rect_end_x)>Limit_left_zoom && Min(rect_start_y,rect_end_y)<Limit_visible_bottom_zoom && Max(rect_start_y,rect_end_y)>Limit_top_zoom )
|
||||
if (Main_magnifier_mode
|
||||
&& Min(rect_start_x, rect_end_x) <= Limit_right_zoom
|
||||
&& Max(rect_start_x, rect_end_x) > Limit_left_zoom
|
||||
&& Min(rect_start_y, rect_end_y) <= Limit_bottom_zoom
|
||||
&& Max(rect_start_y, rect_end_y) > Limit_top_zoom )
|
||||
{
|
||||
offset_width = 0;
|
||||
offset_height=0;
|
||||
@ -4860,8 +4933,8 @@ void Grad_rectangle_0_9(void)
|
||||
offset_left = Limit_left_zoom;
|
||||
}
|
||||
|
||||
if(Max(rect_start_x,rect_end_x)>Limit_visible_right_zoom) // On dépasse du zoom à droite
|
||||
offset_width += Max(rect_start_x,rect_end_x) - Limit_visible_right_zoom;
|
||||
if(Max(rect_start_x,rect_end_x)>Limit_right_zoom) // On dépasse du zoom à droite
|
||||
offset_width += Max(rect_start_x,rect_end_x) - Limit_right_zoom;
|
||||
|
||||
if(Min(rect_start_y,rect_end_y)<Limit_top_zoom) // On dépasse du zoom en haut
|
||||
{
|
||||
@ -4869,15 +4942,15 @@ void Grad_rectangle_0_9(void)
|
||||
offset_top = Limit_top_zoom;
|
||||
}
|
||||
|
||||
if(Max(rect_start_y,rect_end_y)>Limit_visible_bottom_zoom) // On dépasse du zoom en bas
|
||||
offset_height += Max(rect_start_y,rect_end_y) - Limit_visible_bottom_zoom;
|
||||
if(Max(rect_start_y,rect_end_y)>Limit_bottom_zoom) // On dépasse du zoom en bas
|
||||
offset_height += Max(rect_start_y,rect_end_y) - Limit_bottom_zoom;
|
||||
|
||||
if(width > offset_width)
|
||||
{
|
||||
if(offset_top==0) // La ligne du haut est visible
|
||||
Horizontal_XOR_line_zoom(offset_left>0?offset_left:Min(rect_start_x,rect_end_x),Min(rect_start_y,rect_end_y),width-offset_width);
|
||||
|
||||
if(Max(rect_start_y,rect_end_y)<Limit_visible_bottom_zoom) // La ligne du bas est visible
|
||||
if(Max(rect_start_y,rect_end_y) <= Limit_bottom_zoom) // La ligne du bas est visible
|
||||
Horizontal_XOR_line_zoom(offset_left>0?offset_left:Min(rect_start_x,rect_end_x),Max(rect_start_y,rect_end_y),width-offset_width);
|
||||
}
|
||||
|
||||
@ -4886,7 +4959,7 @@ void Grad_rectangle_0_9(void)
|
||||
if(offset_left==0) // La ligne de gauche est visible
|
||||
Vertical_XOR_line_zoom(Min(rect_start_x,rect_end_x),offset_top>0?offset_top:Min(rect_start_y,rect_end_y),height-offset_height);
|
||||
|
||||
if(Max(rect_start_x,rect_end_x)<Limit_visible_right_zoom) // La ligne de droite est visible
|
||||
if(Max(rect_start_x,rect_end_x) <= Limit_right_zoom) // La ligne de droite est visible
|
||||
Vertical_XOR_line_zoom(Max(rect_start_x,rect_end_x),offset_top>0?offset_top:Min(rect_start_y,rect_end_y),height-offset_height);
|
||||
}
|
||||
}
|
||||
@ -4895,6 +4968,7 @@ void Grad_rectangle_0_9(void)
|
||||
Draw_grad_rectangle(rect_start_x,rect_start_y,rect_end_x,rect_end_y,vector_start_x,vector_start_y,vector_end_x,vector_end_y);
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
@ -5015,7 +5089,7 @@ void Centered_lines_12_7(void)
|
||||
|
||||
Smear_start=1;
|
||||
Display_paintbrush (start_x,start_y,color,0);
|
||||
Draw_line_permanet(start_x,start_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
Draw_line_permanent(start_x,start_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
|
||||
Paintbrush_shape=PAINTBRUSH_SHAPE_POINT;
|
||||
Pixel_figure_preview(Paintbrush_X,Paintbrush_Y,color);
|
||||
@ -5048,6 +5122,7 @@ void Centered_lines_12_7(void)
|
||||
}
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
Wait_end_of_click();
|
||||
}
|
||||
}
|
||||
|
||||
122
pages.c
@ -49,21 +49,6 @@ void Init_page(T_Page * page)
|
||||
page->File_directory[0]='\0';
|
||||
page->Filename[0]='\0';
|
||||
page->File_format=DEFAULT_FILEFORMAT;
|
||||
/*
|
||||
page->X_offset=0;
|
||||
page->Y_offset=0;
|
||||
page->old_offset_x=0;
|
||||
page->old_offset_y=0;
|
||||
page->Split=0;
|
||||
page->X_zoom=0;
|
||||
page->Separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
||||
page->Main_magnifier_mode=0;
|
||||
page->Main_magnifier_factor=DEFAULT_ZOOM_FACTOR;
|
||||
page->Main_magnifier_height=0;
|
||||
page->Main_magnifier_width=0;
|
||||
page->Main_magnifier_offset_X=0;
|
||||
page->Main_magnifier_offset_Y=0;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,35 +71,7 @@ void Download_infos_page_main(T_Page * page)
|
||||
strcpy(Main_file_directory,page->File_directory);
|
||||
strcpy(Main_filename,page->Filename);
|
||||
Main_fileformat=page->File_format;
|
||||
/*
|
||||
Main_offset_X=page->X_offset;
|
||||
Main_offset_Y=page->Y_offset;
|
||||
|
||||
// On corrige les décalages en fonction de la dimension de l'écran
|
||||
if ( (Main_offset_X>0) &&
|
||||
(Main_offset_X+Screen_width>Main_image_width) )
|
||||
Main_offset_X=Max(0,Main_image_width-Screen_width);
|
||||
if ( (Main_offset_Y>0) &&
|
||||
(Main_offset_Y+Menu_Y>Main_image_height) )
|
||||
Main_offset_Y=Max(0,Main_image_height-Menu_Y);
|
||||
|
||||
Old_main_offset_X=page->old_offset_x;
|
||||
Old_main_offset_Y=page->old_offset_y;
|
||||
Main_separator_position=page->Split;
|
||||
Main_X_zoom=page->X_zoom;
|
||||
Main_separator_proportion=page->Separator_proportion;
|
||||
Main_magnifier_mode=page->Main_magnifier_mode;
|
||||
Main_magnifier_factor=page->Main_magnifier_factor;
|
||||
Main_magnifier_height=page->Main_magnifier_height;
|
||||
Main_magnifier_width=page->Main_magnifier_width;
|
||||
Main_magnifier_offset_X=page->Main_magnifier_offset_X;
|
||||
Main_magnifier_offset_Y=page->Main_magnifier_offset_Y;
|
||||
|
||||
// Comme le facteur de zoom a des chances d'avoir changé, on appelle
|
||||
// "Change_magnifier_factor".
|
||||
for (factor_index=0; ZOOM_FACTOR[factor_index]!=Main_magnifier_factor; factor_index++);
|
||||
Change_magnifier_factor(factor_index);
|
||||
*/
|
||||
if (size_is_modified)
|
||||
{
|
||||
Main_magnifier_mode=0;
|
||||
@ -140,21 +97,6 @@ void Upload_infos_page_main(T_Page * page)
|
||||
strcpy(page->File_directory,Main_file_directory);
|
||||
strcpy(page->Filename,Main_filename);
|
||||
page->File_format=Main_fileformat;
|
||||
/*
|
||||
page->X_offset=Main_offset_X;
|
||||
page->Y_offset=Main_offset_Y;
|
||||
page->old_offset_x=Old_main_offset_X;
|
||||
page->old_offset_x=Old_main_offset_Y;
|
||||
page->Split=Main_separator_position;
|
||||
page->X_zoom=Main_X_zoom;
|
||||
page->Separator_proportion=Main_separator_proportion;
|
||||
page->Main_magnifier_mode=Main_magnifier_mode;
|
||||
page->Main_magnifier_factor=Main_magnifier_factor;
|
||||
page->Main_magnifier_height=Main_magnifier_height;
|
||||
page->Main_magnifier_width=Main_magnifier_width;
|
||||
page->Main_magnifier_offset_X=Main_magnifier_offset_X;
|
||||
page->Main_magnifier_offset_Y=Main_magnifier_offset_Y;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,21 +112,6 @@ void Download_infos_page_spare(T_Page * page)
|
||||
strcpy(Spare_file_directory,page->File_directory);
|
||||
strcpy(Spare_filename,page->Filename);
|
||||
Spare_fileformat=page->File_format;
|
||||
/*
|
||||
Spare_offset_X=page->X_offset;
|
||||
Spare_offset_Y=page->Y_offset;
|
||||
Old_spare_offset_X=page->old_offset_x;
|
||||
Old_spare_offset_Y=page->old_offset_y;
|
||||
Spare_separator_position=page->Split;
|
||||
Spare_X_zoom=page->X_zoom;
|
||||
Spare_separator_proportion=page->Separator_proportion;
|
||||
Spare_magnifier_mode=page->Main_magnifier_mode;
|
||||
Spare_magnifier_factor=page->Main_magnifier_factor;
|
||||
Spare_magnifier_height=page->Main_magnifier_height;
|
||||
Spare_magnifier_width=page->Main_magnifier_width;
|
||||
Spare_magnifier_offset_X=page->Main_magnifier_offset_X;
|
||||
Spare_magnifier_offset_Y=page->Main_magnifier_offset_Y;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,21 +127,6 @@ void Upload_infos_page_spare(T_Page * page)
|
||||
strcpy(page->File_directory,Spare_file_directory);
|
||||
strcpy(page->Filename,Spare_filename);
|
||||
page->File_format=Spare_fileformat;
|
||||
/*
|
||||
page->X_offset=Spare_offset_X;
|
||||
page->Y_offset=Spare_offset_Y;
|
||||
page->old_offset_x=Old_spare_offset_X;
|
||||
page->old_offset_y=Old_spare_offset_Y;
|
||||
page->Split=Spare_separator_position;
|
||||
page->X_zoom=Spare_X_zoom;
|
||||
page->Separator_proportion=Spare_separator_proportion;
|
||||
page->Main_magnifier_mode=Spare_magnifier_mode;
|
||||
page->Main_magnifier_factor=Spare_magnifier_factor;
|
||||
page->Main_magnifier_height=Spare_magnifier_height;
|
||||
page->Main_magnifier_width=Spare_magnifier_width;
|
||||
page->Main_magnifier_offset_X=Spare_magnifier_offset_X;
|
||||
page->Main_magnifier_offset_Y=Spare_magnifier_offset_Y;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,14 +238,14 @@ void Backward_in_list_of_pages(T_List_of_pages * list)
|
||||
{
|
||||
// Cette fonction fait l'équivalent d'un "Undo" dans la liste de pages.
|
||||
// Elle effectue une sorte de ROL (Rotation Left) sur la liste:
|
||||
// ÉÍËÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍ» |
|
||||
// º0º1³2³3³4³5³6³7³8³9³Aº |
|
||||
// ÈÍÊÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏͼ | 0=page courante
|
||||
// ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ |_ A=page la plus ancienne
|
||||
// v v v v v v v v v v v | 1=Dernière page (1er backup)
|
||||
// ÉÍËÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍ» |
|
||||
// º1º2³3³4³5³6³7³8³9³A³0º |
|
||||
// ÈÍÊÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏͼ |
|
||||
// +---+-+-+-+-+-+-+-+-+-+ |
|
||||
// ¦0¦1¦2¦3¦4¦5¦6¦7¦8¦9¦A¦ |
|
||||
// +---+-+-+-+-+-+-+-+-+-+ | 0=page courante
|
||||
// ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ |_ A=page la plus ancienne
|
||||
// v v v v v v v v v v v | 1=DerniÞre page (1er backup)
|
||||
// +---+-+-+-+-+-+-+-+-+-+ |
|
||||
// ¦1¦2¦3¦4¦5¦6¦7¦8¦9¦A¦0¦ |
|
||||
// +---+-+-+-+-+-+-+-+-+-+ |
|
||||
|
||||
// Pour simuler un véritable Undo, l'appelant doit mettre la structure
|
||||
// de page courante à jour avant l'appel, puis en réextraire les infos en
|
||||
@ -369,14 +281,14 @@ void Advance_in_list_of_pages(T_List_of_pages * list)
|
||||
{
|
||||
// Cette fonction fait l'équivalent d'un "Redo" dans la liste de pages.
|
||||
// Elle effectue une sorte de ROR (Rotation Right) sur la liste:
|
||||
// ÉÍËÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍ» |
|
||||
// º0º1³2³3³4³5³6³7³8³9³Aº |
|
||||
// ÈÍÊÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏͼ | 0=page courante
|
||||
// ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ |_ A=page la plus ancienne
|
||||
// +-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
// |0|1|2|3|4|5|6|7|8|9|A| |
|
||||
// +-+-+-+-+-+-+-+-+-+-+-+ | 0=page courante
|
||||
// | | | | | | | | | | | |_ A=page la plus ancienne
|
||||
// v v v v v v v v v v v | 1=Dernière page (1er backup)
|
||||
// ÉÍËÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍÑÍ» |
|
||||
// ºAº0³1³2³3³4³5³6³7³8³9º |
|
||||
// ÈÍÊÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏÍÏͼ |
|
||||
// +-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
// |A|0|1|2|3|4|5|6|7|8|9| |
|
||||
// +-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
|
||||
// Pour simuler un véritable Redo, l'appelant doit mettre la structure
|
||||
// de page courante à jour avant l'appel, puis en réextraire les infos en
|
||||
@ -1018,3 +930,7 @@ void * Borrow_memory_from_page(int size)
|
||||
// Pour que le compilateur ne dise pas qu'il manque une valeur de sortie:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void End_of_modification(void)
|
||||
{
|
||||
}
|
||||
|
||||
39
pages.h
@ -27,17 +27,19 @@
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////// GESTION DU BACKUP ////////////////////////////
|
||||
/////////////////////////// BACKUP ///////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///
|
||||
/// GESTION DES PAGES
|
||||
///
|
||||
///
|
||||
/// INDIVIDUAL PAGES
|
||||
///
|
||||
|
||||
void Init_page(T_Page * page);
|
||||
void Download_infos_page_main(T_Page * page);
|
||||
void Upload_infos_page_main(T_Page * page);
|
||||
|
||||
// private
|
||||
void Init_page(T_Page * page);
|
||||
void Download_infos_page_spare(T_Page * page);
|
||||
void Upload_infos_page_spare(T_Page * page);
|
||||
void Download_infos_backup(T_List_of_pages * list);
|
||||
@ -47,11 +49,12 @@ int Size_of_a_page(T_Page * page);
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// GESTION DES LISTES DE PAGES
|
||||
///
|
||||
///
|
||||
/// LISTS OF PAGES
|
||||
///
|
||||
|
||||
void Init_list_of_pages(T_List_of_pages * list);
|
||||
// private
|
||||
int Allocate_list_of_pages(T_List_of_pages * list,int size);
|
||||
void Free_a_list_of_pages(T_List_of_pages * list);
|
||||
int Size_of_a_list_of_pages(T_List_of_pages * list);
|
||||
@ -65,9 +68,9 @@ void Free_page_of_a_list(T_List_of_pages * list);
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// GESTION DES BACKUPS
|
||||
///
|
||||
///
|
||||
/// BACKUP HIGH-LEVEL FUNCTIONS
|
||||
///
|
||||
|
||||
int Init_all_backup_lists(int size,int width,int height);
|
||||
void Set_number_of_backups(int nb_backups);
|
||||
@ -76,18 +79,18 @@ int Backup_and_resize_the_spare(int width,int height);
|
||||
void Backup(void);
|
||||
void Undo(void);
|
||||
void Redo(void);
|
||||
void Free_current_page(void);
|
||||
void Free_current_page(void); // 'Kill' button
|
||||
void Exchange_main_and_spare(void);
|
||||
void End_of_modification(void);
|
||||
|
||||
|
||||
///
|
||||
/// BORROWING MEMORY FROM PAGE
|
||||
///
|
||||
|
||||
///
|
||||
/// GESTION DES EMPRUNTS DE MEMOIRE DE PAGE
|
||||
///
|
||||
|
||||
int Can_borrow_memory_from_page(int size);
|
||||
void * Borrow_memory_from_page(int size);
|
||||
|
||||
// private
|
||||
int Can_borrow_memory_from_page(int size);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
52
palette.c
@ -815,13 +815,21 @@ void Button_Palette(void)
|
||||
Block(Window_pos_X+(Menu_factor_X*206),Window_pos_Y+(Menu_factor_Y*141),Menu_factor_X*17,Menu_factor_Y,MC_Dark);
|
||||
Block(Window_pos_X+(Menu_factor_X*233),Window_pos_Y+(Menu_factor_Y*141),Menu_factor_X*17,Menu_factor_Y,MC_Dark);
|
||||
// Jauges de couleur
|
||||
Palette_view_is_RGB=1;
|
||||
red_slider = Window_set_scroller_button(182, 81, 88,Color_count,1,Color_max-working_palette[Fore_color].R*Color_max/255);// 2
|
||||
green_slider = Window_set_scroller_button(209, 81, 88,Color_count,1,Color_max-working_palette[Fore_color].G*Color_max/255);// 3
|
||||
blue_slider = Window_set_scroller_button(236, 81, 88,Color_count,1,Color_max-working_palette[Fore_color].B*Color_max/255);// 4
|
||||
Print_in_window(184,71,"R",MC_Dark,MC_Light);
|
||||
Print_in_window(211,71,"G",MC_Dark,MC_Light);
|
||||
Print_in_window(238,71,"B",MC_Dark,MC_Light);
|
||||
|
||||
if(Palette_view_is_RGB==1) {
|
||||
Print_in_window(184,71,"R",MC_Dark,MC_Light);
|
||||
Print_in_window(211,71,"G",MC_Dark,MC_Light);
|
||||
Print_in_window(238,71,"B",MC_Dark,MC_Light);
|
||||
Componant_unit(RGB_scale);
|
||||
} else {
|
||||
Print_in_window(184,71,"H",MC_Dark,MC_Light);
|
||||
Print_in_window(211,71,"S",MC_Dark,MC_Light);
|
||||
Print_in_window(238,71,"L",MC_Dark,MC_Light);
|
||||
Componant_unit(256);
|
||||
}
|
||||
|
||||
first_color=last_color=block_start=block_end=Fore_color;
|
||||
Tag_color_range(block_start,block_end);
|
||||
@ -831,12 +839,7 @@ void Button_Palette(void)
|
||||
Block(Window_pos_X+(Menu_factor_X*264),Window_pos_Y+(Menu_factor_Y*93),Menu_factor_X<<4,Menu_factor_Y*64,Fore_color);
|
||||
|
||||
// Affichage des valeurs de la couleur courante (pour 1 couleur)
|
||||
Format_componant(Main_palette[Fore_color].R*Color_max/255,str);
|
||||
Print_counter(176,172,str,MC_Black,MC_Light);
|
||||
Format_componant(Main_palette[Fore_color].G*Color_max/255,str);
|
||||
Print_counter(203,172,str,MC_Black,MC_Light);
|
||||
Format_componant(Main_palette[Fore_color].B*Color_max/255,str);
|
||||
Print_counter(230,172,str,MC_Black,MC_Light);
|
||||
Display_sliders(red_slider,green_slider,blue_slider,(block_start!=block_end),working_palette);
|
||||
|
||||
Print_in_window(129,58,"Color number:",MC_Dark,MC_Light);
|
||||
Num2str(Fore_color,str,3);
|
||||
@ -1227,9 +1230,9 @@ void Button_Palette(void)
|
||||
|
||||
case 5 : // Default
|
||||
memcpy(backup_palette,working_palette,sizeof(T_Palette));
|
||||
memcpy(working_palette,Default_palette,sizeof(T_Palette));
|
||||
memcpy(temp_palette,Default_palette,sizeof(T_Palette));
|
||||
Set_palette(Default_palette);
|
||||
memcpy(working_palette,Gfx->Default_palette,sizeof(T_Palette));
|
||||
memcpy(temp_palette,Gfx->Default_palette,sizeof(T_Palette));
|
||||
Set_palette(Gfx->Default_palette);
|
||||
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
|
||||
// On prépare la "modifiabilité" des nouvelles couleurs
|
||||
memcpy(temp_palette,working_palette,sizeof(T_Palette));
|
||||
@ -1315,7 +1318,10 @@ void Button_Palette(void)
|
||||
|
||||
// En cas de X-Swap, tout l'ecran a pu changer de couleur.
|
||||
if (clicked_button==8)
|
||||
{
|
||||
Update_rect(0, 0, Screen_width, Menu_Y_before_window);
|
||||
End_of_modification();
|
||||
}
|
||||
Wait_end_of_click();
|
||||
}
|
||||
break;
|
||||
@ -1415,6 +1421,7 @@ void Button_Palette(void)
|
||||
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
|
||||
memcpy(temp_palette,working_palette,sizeof(T_Palette));
|
||||
|
||||
End_of_modification();
|
||||
need_to_remap=1;
|
||||
break;
|
||||
|
||||
@ -1779,6 +1786,7 @@ void Button_Palette(void)
|
||||
Hide_cursor();
|
||||
Remap_image_highlevel(conversion_table);
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
// On prépare la "modifiabilité" des nouvelles couleurs
|
||||
Set_palette(working_palette);
|
||||
@ -1814,7 +1822,7 @@ void Button_Palette(void)
|
||||
|
||||
// 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));
|
||||
memcpy(backup_palette, working_palette,sizeof(T_Palette));
|
||||
|
||||
Palette_view_is_RGB = !Palette_view_is_RGB;
|
||||
|
||||
@ -1940,6 +1948,8 @@ 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);
|
||||
|
||||
End_of_modification();
|
||||
need_to_remap=1;
|
||||
}
|
||||
break;
|
||||
@ -2030,6 +2040,8 @@ void Button_Palette(void)
|
||||
memcpy(temp_palette,working_palette,sizeof(T_Palette));
|
||||
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
|
||||
Update_color_count(&used_colors,color_usage);
|
||||
// End_of_modification();
|
||||
// Not really needed, the change was in palette entries
|
||||
need_to_remap=1;
|
||||
Key=0;
|
||||
break;
|
||||
@ -2085,6 +2097,8 @@ void Button_Palette(void)
|
||||
Window_help(BUTTON_PALETTE, NULL);
|
||||
break;
|
||||
}
|
||||
else if (Is_shortcut(Key,0x100+BUTTON_PALETTE))
|
||||
clicked_button=14;
|
||||
}
|
||||
|
||||
if (need_to_remap)
|
||||
@ -2114,6 +2128,8 @@ void Button_Palette(void)
|
||||
&& memcmp(Main_palette,working_palette,sizeof(T_Palette)) )
|
||||
Backup();
|
||||
memcpy(Main_palette,working_palette,sizeof(T_Palette));
|
||||
// End_of_modification();
|
||||
// Not really needed, the change was in palette entries
|
||||
}
|
||||
|
||||
Compute_optimal_menu_colors(Main_palette);
|
||||
@ -2160,7 +2176,8 @@ void Button_Secondary_palette(void)
|
||||
T_Scroller_button * rgb_scale_slider;
|
||||
char str[4];
|
||||
byte palette_vertical = Config.Palette_vertical;
|
||||
byte palette_cols, palette_lines, rgb_scale;
|
||||
byte palette_cols, palette_lines;
|
||||
word rgb_scale;
|
||||
byte palette_needs_redraw=0;
|
||||
|
||||
Open_window(200,146,"Palettes");
|
||||
@ -2207,6 +2224,9 @@ void Button_Secondary_palette(void)
|
||||
Key=0;
|
||||
Window_help(BUTTON_PALETTE, "PALETTE OPTIONS");
|
||||
}
|
||||
else if (Is_shortcut(Key,0x200+BUTTON_PALETTE))
|
||||
clicked_button=3;
|
||||
|
||||
switch(clicked_button)
|
||||
{
|
||||
case 5:
|
||||
@ -2284,7 +2304,7 @@ void Button_Secondary_palette(void)
|
||||
|
||||
if (clicked_button==1)
|
||||
{
|
||||
Menu_tag_colors("Tag colors to exclude",Exclude_color,&dummy,1, NULL);
|
||||
Menu_tag_colors("Tag colors to exclude",Exclude_color,&dummy,1, NULL, SPECIAL_EXCLUDE_COLORS_MENU);
|
||||
}
|
||||
else if (clicked_button==2)
|
||||
{
|
||||
|
||||
@ -1 +1 @@
|
||||
char Program_version[]="2.0";
|
||||
char Program_version[]="2.1";
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxdouble.h"
|
||||
#include "pxwide.h" // for Display_transparent_line_on_screen_wide()
|
||||
|
||||
@ -366,6 +367,8 @@ void Display_part_of_screen_scaled_double(
|
||||
y++;
|
||||
if(y==height)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -447,6 +450,8 @@ void Display_brush_mono_zoom_double(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos*ZOOMY)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -483,6 +488,8 @@ void Clear_brush_scaled_double(word x_pos,word y_pos,word x_offset,word y_offset
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
|
||||
7
pxquad.c
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxquad.h"
|
||||
|
||||
#define ZOOMX 4
|
||||
@ -383,6 +384,8 @@ void Display_part_of_screen_scaled_quad(
|
||||
y++;
|
||||
if(y==height/**ZOOMY*/)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -481,6 +484,8 @@ void Display_brush_mono_zoom_quad(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos*ZOOMY)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -518,6 +523,8 @@ void Clear_brush_scaled_quad(word x_pos,word y_pos,word x_offset,word y_offset,w
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxsimple.h"
|
||||
|
||||
void Pixel_simple (word x,word y,byte color)
|
||||
@ -324,6 +325,8 @@ void Display_part_of_screen_scaled_simple(
|
||||
y++;
|
||||
if(y==height)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -421,6 +424,8 @@ void Display_brush_mono_zoom_simple(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -456,6 +461,8 @@ void Clear_brush_scaled_simple(word x_pos,word y_pos,word x_offset,word y_offset
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
@ -466,5 +473,3 @@ void Clear_brush_scaled_simple(word x_pos,word y_pos,word x_offset,word y_offset
|
||||
src+= image_width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
7
pxtall.c
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxtall.h"
|
||||
#include "pxsimple.h"
|
||||
|
||||
@ -325,6 +326,8 @@ void Display_part_of_screen_scaled_tall(
|
||||
y++;
|
||||
if(y==height*ZOOMY)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -406,6 +409,8 @@ void Display_brush_mono_zoom_tall(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos*ZOOMY)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -441,6 +446,8 @@ void Clear_brush_scaled_tall(word x_pos,word y_pos,word x_offset,word y_offset,w
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxtall2.h"
|
||||
|
||||
#define ZOOMX 2
|
||||
@ -375,6 +376,8 @@ void Display_part_of_screen_scaled_tall2(
|
||||
y++;
|
||||
if(y==height/**ZOOMY*/)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -473,6 +476,8 @@ void Display_brush_mono_zoom_tall2(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos*ZOOMY)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -510,6 +515,8 @@ void Clear_brush_scaled_tall2(word x_pos,word y_pos,word x_offset,word y_offset,
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxtriple.h"
|
||||
|
||||
#define ZOOMX 3
|
||||
@ -373,6 +374,8 @@ void Display_part_of_screen_scaled_triple(
|
||||
y++;
|
||||
if(y==height/**ZOOMY*/)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -469,6 +472,8 @@ void Display_brush_mono_zoom_triple(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos*ZOOMY)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -506,6 +511,8 @@ void Clear_brush_scaled_triple(word x_pos,word y_pos,word x_offset,word y_offset
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
|
||||
7
pxwide.c
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxwide.h"
|
||||
|
||||
#define ZOOMX 2
|
||||
@ -359,6 +360,8 @@ void Display_part_of_screen_scaled_wide(
|
||||
y++;
|
||||
if(y==height)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -457,6 +460,8 @@ void Display_brush_mono_zoom_wide(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos*ZOOMY)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -492,6 +497,8 @@ void Clear_brush_scaled_wide(word x_pos,word y_pos,word x_offset,word y_offset,w
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "misc.h"
|
||||
#include "graph.h"
|
||||
#include "pxwide2.h"
|
||||
|
||||
#define ZOOMX 4
|
||||
@ -369,6 +370,8 @@ void Display_part_of_screen_scaled_wide2(
|
||||
y++;
|
||||
if(y==height/**ZOOMY*/)
|
||||
{
|
||||
Redraw_grid(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
Update_rect(Main_X_zoom,0,
|
||||
width*Main_magnifier_factor,height);
|
||||
return;
|
||||
@ -463,6 +466,8 @@ void Display_brush_mono_zoom_wide2(word x_pos, word y_pos,
|
||||
// On vérifie qu'on est pas à la ligne finale
|
||||
if(y == end_y_pos*ZOOMY)
|
||||
{
|
||||
Redraw_grid( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
Update_rect( x_pos, y_pos,
|
||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
||||
return;
|
||||
@ -500,6 +505,8 @@ void Clear_brush_scaled_wide2(word x_pos,word y_pos,word x_offset,word y_offset,
|
||||
y++;
|
||||
if(y==end_y_pos)
|
||||
{
|
||||
Redraw_grid(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
Update_rect(x_pos,y_pos,
|
||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
||||
return;
|
||||
|
||||
46
readini.c
@ -519,17 +519,10 @@ int Load_INI(T_Config * conf)
|
||||
|
||||
if ((return_code=Load_INI_get_values (file,buffer,"Menu_ratio",1,values)))
|
||||
goto Erreur_Retour;
|
||||
if ((values[0]<0) || (values[0]>2))
|
||||
if (values[0]>2)
|
||||
goto Erreur_ERREUR_INI_CORROMPU;
|
||||
conf->Ratio=values[0];
|
||||
|
||||
if ((return_code=Load_INI_get_values (file,buffer,"Font",1,values)))
|
||||
goto Erreur_Retour;
|
||||
if ((values[0]<1) || (values[0]>2))
|
||||
goto Erreur_ERREUR_INI_CORROMPU;
|
||||
conf->Font=values[0]-1;
|
||||
|
||||
|
||||
if ((return_code=Load_INI_reach_group(file,buffer,"[FILE_SELECTOR]")))
|
||||
goto Erreur_Retour;
|
||||
|
||||
@ -788,7 +781,7 @@ int Load_INI(T_Config * conf)
|
||||
break;
|
||||
}
|
||||
conf->Palette_vertical=0;
|
||||
// Optionnel, vertical palette option (>98.0%)
|
||||
// Optional, vertical palette option (>98.0%)
|
||||
if (!Load_INI_get_values (file,buffer,"Palette_vertical",1,values))
|
||||
{
|
||||
if ((values[0]<0) || (values[0]>1))
|
||||
@ -805,6 +798,41 @@ int Load_INI(T_Config * conf)
|
||||
conf->Window_pos_y = values[1];
|
||||
}
|
||||
|
||||
conf->Double_click_speed=500;
|
||||
// Optional, speed of double-click (>2.0)
|
||||
if (!Load_INI_get_values (file,buffer,"Double_click_speed",1,values))
|
||||
{
|
||||
if ((values[0]>0) || (values[0]<=2000))
|
||||
conf->Double_click_speed=values[0];
|
||||
}
|
||||
|
||||
conf->Double_key_speed=500;
|
||||
// Optional, speed of double-keypress (>2.0)
|
||||
if (!Load_INI_get_values (file,buffer,"Double_key_speed",1,values))
|
||||
{
|
||||
if ((values[0]>0) || (values[0]<=2000))
|
||||
conf->Double_key_speed=values[0];
|
||||
}
|
||||
|
||||
// Optional, name of skin file. (>2.0)
|
||||
if(!Load_INI_get_string(file,buffer,"Skin_file",value_label,1))
|
||||
conf->Skin_file = strdup(value_label);
|
||||
else
|
||||
conf->Skin_file = strdup("skin_modern.png");
|
||||
|
||||
// Optional, name of font file. (>2.0)
|
||||
if(!Load_INI_get_string(file,buffer,"Font_file",value_label,1))
|
||||
conf->Font_file = strdup(value_label);
|
||||
else
|
||||
conf->Font_file = strdup("font_Classic.png");
|
||||
|
||||
conf->Grid_XOR_color=255;
|
||||
// Optional, XOR color for grid overlay (>2.0)
|
||||
if (!Load_INI_get_values (file,buffer,"Grid_XOR_color",1,values))
|
||||
{
|
||||
if ((values[0]>0) || (values[0]<=255))
|
||||
conf->Grid_XOR_color=values[0];
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
|
||||
23
readline.c
@ -142,7 +142,16 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
|
||||
|
||||
byte offset=0; // index du premier caractère affiché
|
||||
|
||||
// Si on a commencé à editer par un clic-droit, on vide la chaine.
|
||||
if (Mouse_K==RIGHT_SIDE)
|
||||
str[0]='\0';
|
||||
else if (input_type==1)
|
||||
snprintf(str,10,"%d",atoi(str)); // On tasse la chaine à gauche
|
||||
|
||||
Wait_end_of_click();
|
||||
Keyboard_click_allowed = 0;
|
||||
Hide_cursor();
|
||||
|
||||
// Effacement de la chaîne
|
||||
Block(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y),
|
||||
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
|
||||
@ -152,13 +161,6 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
|
||||
// Mise à jour des variables se rapportant à la chaîne en fonction de la chaîne initiale
|
||||
strcpy(initial_string,str);
|
||||
|
||||
// Si on a commencé à editer par un clic-droit, on vide la chaine.
|
||||
if (Mouse_K==RIGHT_SIDE)
|
||||
str[0]='\0';
|
||||
else if (input_type==1)
|
||||
snprintf(str,10,"%d",atoi(str)); // On tasse la chaine à gauche
|
||||
|
||||
|
||||
size=strlen(str);
|
||||
position=(size<max_size)? size:size-1;
|
||||
if (position-offset>visible_size)
|
||||
@ -176,14 +178,14 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
|
||||
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3));
|
||||
Flush_update();
|
||||
|
||||
while ((input_key!=SDLK_RETURN) && (input_key!=KEY_ESC))
|
||||
while ((input_key!=SDLK_RETURN) && (input_key!=KEY_ESC) && Mouse_K == 0)
|
||||
{
|
||||
Display_cursor();
|
||||
do
|
||||
{
|
||||
if(!Get_input()) SDL_Delay(20);
|
||||
input_key=Key_ANSI;
|
||||
} while(input_key==0);
|
||||
} while(input_key==0 && Mouse_K == 0);
|
||||
Hide_cursor();
|
||||
switch (input_key)
|
||||
{
|
||||
@ -325,6 +327,7 @@ affichage:
|
||||
Flush_update();
|
||||
|
||||
} // End du "while"
|
||||
Keyboard_click_allowed = 1;
|
||||
|
||||
// Effacement de la chaîne
|
||||
Block(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y),
|
||||
@ -346,5 +349,5 @@ affichage:
|
||||
Update_rect(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y),
|
||||
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3));
|
||||
|
||||
return (input_key==SDLK_RETURN);
|
||||
return (input_key==SDLK_RETURN || Mouse_K != 0);
|
||||
}
|
||||
|
||||
23
saveini.c
@ -93,6 +93,7 @@ int Save_INI_char_in_value_alphabet(char c)
|
||||
(c<='z')
|
||||
) ||
|
||||
(c == '$') // Symbole d'hexadécimal
|
||||
|| (c== '.') // Point (dans les noms de fichiers)
|
||||
)
|
||||
return 1;
|
||||
else
|
||||
@ -475,11 +476,6 @@ int Save_INI(T_Config * conf)
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Menu_ratio",1,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
values[0]=(conf->Font)+1;
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Font",1,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
|
||||
if ((return_code=Save_INI_reach_group(Ancien_fichier,Nouveau_fichier,buffer,"[FILE_SELECTOR]")))
|
||||
goto Erreur_Retour;
|
||||
|
||||
@ -635,6 +631,23 @@ int Save_INI(T_Config * conf)
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Window_position",2,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
values[0]=(conf->Double_click_speed);
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Double_click_speed",1,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
values[0]=(conf->Double_key_speed);
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Double_key_speed",1,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
if ((return_code=Save_INI_set_strings (Ancien_fichier,Nouveau_fichier,buffer,"Skin_file",conf->Skin_file)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
if ((return_code=Save_INI_set_strings (Ancien_fichier,Nouveau_fichier,buffer,"Font_file",conf->Font_file)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
values[0]=(conf->Grid_XOR_color);
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Grid_XOR_color",1,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
Save_INI_flush(Ancien_fichier,Nouveau_fichier,buffer);
|
||||
|
||||
|
||||
@ -61,8 +61,9 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
|
||||
Screen_pixels=Screen_SDL->pixels;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG("Error: Unable to change video mode!",0);
|
||||
|
||||
}
|
||||
SDL_ShowCursor(0); // Hide the SDL mouse cursor, we use our own
|
||||
}
|
||||
|
||||
|
||||
19
setup.c
@ -57,7 +57,8 @@ int Create_ConfigDirectory(char * config_dir)
|
||||
// Determine which directory contains the executable.
|
||||
// IN: Main's argv[0], some platforms need it, some don't.
|
||||
// OUT: Write into program_dir. Trailing / or \ is kept.
|
||||
// Note : in fact this is only used to check for the datafiles and fonts in this same directory.
|
||||
// Note : in fact this is only used to check for the datafiles and fonts in
|
||||
// this same directory.
|
||||
void Set_program_directory(ARG_UNUSED const char * argv0,char * program_dir)
|
||||
{
|
||||
#undef ARG_UNUSED
|
||||
@ -76,9 +77,9 @@ void Set_program_directory(ARG_UNUSED const char * argv0,char * program_dir)
|
||||
|
||||
// Others: The part of argv[0] before the executable name.
|
||||
// Keep the last \ or /.
|
||||
// Note that on Unix, once installed, the executable is called from a shell script
|
||||
// sitting in /usr/local/bin/, this allows argv[0] to contain the full path.
|
||||
// On Windows, Mingw32 already provides the full path in all cases.
|
||||
// Note that on Unix, once installed, the executable is called from a shell
|
||||
// script sitting in /usr/local/bin/, this allows argv[0] to contain the full
|
||||
// path. On Windows, Mingw32 already provides the full path in all cases.
|
||||
#else
|
||||
Extract_path(program_dir, argv0);
|
||||
#endif
|
||||
@ -110,12 +111,8 @@ void Set_data_directory(const char * program_dir, char * data_dir)
|
||||
// OUT: Write into config_dir. Trailing / or \ is kept.
|
||||
void Set_config_directory(const char * program_dir, char * config_dir)
|
||||
{
|
||||
// MacOSX
|
||||
#if defined(__macosx__)
|
||||
strcpy(config_dir,program_dir);
|
||||
strcat(config_dir,"Contents/Resources/");
|
||||
// AmigaOS4
|
||||
#elif defined(__amigaos4__) || defined(__AROS__)
|
||||
#if defined(__amigaos4__) || defined(__AROS__)
|
||||
strcpy(config_dir,"PROGDIR:");
|
||||
// GP2X
|
||||
#elif defined(__GP2X__)
|
||||
@ -141,6 +138,10 @@ void Set_config_directory(const char * program_dir, char * config_dir)
|
||||
// "~/.grafx2", the BeOS way
|
||||
const char* Config_SubDir = ".grafx2";
|
||||
config_parent_dir = getenv("$HOME");
|
||||
#elif defined(__macosx__)
|
||||
// "~/Library/Preferences/com.googlecode.grafx2"
|
||||
const char* Config_SubDir = "Library/Preferences/com.googlecode.grafx2";
|
||||
config_parent_dir = getenv("HOME");
|
||||
#else
|
||||
// "~/.grafx2"
|
||||
const char* Config_SubDir = ".grafx2";
|
||||
|
||||
4
shade.c
@ -978,6 +978,8 @@ int Menu_shade(void)
|
||||
Key=0;
|
||||
Window_help(BUTTON_EFFECTS, "SHADE");
|
||||
}
|
||||
else if (Is_shortcut(Key,SPECIAL_SHADE_MENU))
|
||||
clicked_button=5;
|
||||
}
|
||||
}
|
||||
while ((clicked_button!=4) && (clicked_button!=5));
|
||||
@ -1097,6 +1099,8 @@ void Button_Quick_shade_menu(void)
|
||||
}
|
||||
if (Is_shortcut(Key,0x100+BUTTON_HELP))
|
||||
Window_help(BUTTON_EFFECTS, "QUICK SHADE");
|
||||
else if (Is_shortcut(Key,SPECIAL_QUICK_SHADE_MENU))
|
||||
clicked_button=1;
|
||||
}
|
||||
while ((clicked_button!=1) && (clicked_button!=2));
|
||||
|
||||
|
||||
BIN
skins/base.gif
|
Before Width: | Height: | Size: 21 KiB |
BIN
skins/font_Classic.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
skins/font_Fairlight.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
skins/font_Fun.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
skins/font_Melon.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
skins/ilkke.png
|
Before Width: | Height: | Size: 21 KiB |
BIN
skins/skin_classic.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
skins/skin_modern.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
103
special.c
@ -30,11 +30,26 @@
|
||||
|
||||
//---------------------- Modifier le pinceau spécial -------------------------
|
||||
|
||||
int Circle_squared_diameter(int diameter)
|
||||
{
|
||||
int result = diameter*diameter;
|
||||
// Trick to make some circles rounder, even though
|
||||
// mathematically incorrect.
|
||||
if (diameter==3 || diameter==9)
|
||||
return result-2;
|
||||
if (diameter==11)
|
||||
return result-6;
|
||||
if (diameter==14)
|
||||
return result-4;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Set_paintbrush_size(int width, int height)
|
||||
{
|
||||
int x_pos,y_pos;
|
||||
int x,y;
|
||||
float radius2;
|
||||
int radius2;
|
||||
|
||||
if (width<1) width=1;
|
||||
if (height<1) height=1;
|
||||
@ -47,14 +62,12 @@ void Set_paintbrush_size(int width, int height)
|
||||
switch (Paintbrush_shape)
|
||||
{
|
||||
case PAINTBRUSH_SHAPE_ROUND :
|
||||
radius2=Paintbrush_offset_X+0.414213562; // [0.410..0.415[
|
||||
radius2*=radius2;
|
||||
for (y_pos=0; y_pos<Paintbrush_height; y_pos++)
|
||||
for (x_pos=0; x_pos<Paintbrush_width; x_pos++)
|
||||
radius2=Circle_squared_diameter(Paintbrush_width);
|
||||
|
||||
for (y_pos=0, y=1-Paintbrush_height; y_pos<Paintbrush_height; y_pos++,y+=2)
|
||||
for (x_pos=0, x=1-Paintbrush_width; x_pos<Paintbrush_width; x_pos++,x+=2)
|
||||
{
|
||||
x=x_pos-Paintbrush_offset_X;
|
||||
y=y_pos-Paintbrush_offset_Y;
|
||||
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=( ((x*x)+(y*y)) < radius2 );
|
||||
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=( ((x*x)+(y*y)) <= radius2 );
|
||||
}
|
||||
break;
|
||||
case PAINTBRUSH_SHAPE_SQUARE :
|
||||
@ -62,16 +75,20 @@ void Set_paintbrush_size(int width, int height)
|
||||
memset(Paintbrush_sprite+y_pos,1,Paintbrush_width);
|
||||
break;
|
||||
case PAINTBRUSH_SHAPE_SIEVE_ROUND :
|
||||
radius2=Paintbrush_offset_X+0.414213562; // [0.410..0.415[
|
||||
radius2*=radius2;
|
||||
for (y_pos=0; y_pos<Paintbrush_height; y_pos++)
|
||||
for (x_pos=0; x_pos<Paintbrush_width; x_pos++)
|
||||
{
|
||||
int reminder=0;
|
||||
if (Paintbrush_width==1)
|
||||
reminder = 1;
|
||||
|
||||
radius2=Circle_squared_diameter(Paintbrush_width);
|
||||
|
||||
for (y_pos=0, y=1-Paintbrush_height; y_pos<Paintbrush_height; y_pos++,y+=2)
|
||||
for (x_pos=0, x=1-Paintbrush_width; x_pos<Paintbrush_width; x_pos++,x+=2)
|
||||
{
|
||||
x=x_pos-Paintbrush_offset_X;
|
||||
y=y_pos-Paintbrush_offset_Y;
|
||||
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=( (!((x_pos+y_pos)&1)) && (((x*x)+(y*y)) < radius2));
|
||||
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=( ((x_pos+y_pos+reminder)&1) && (((x*x)+(y*y)) < radius2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PAINTBRUSH_SHAPE_SIEVE_SQUARE:
|
||||
for (y_pos=0; y_pos<Paintbrush_height; y_pos++)
|
||||
for (x_pos=0; x_pos<Paintbrush_width; x_pos++)
|
||||
@ -125,14 +142,24 @@ void Set_paintbrush_size(int width, int height)
|
||||
}
|
||||
break;
|
||||
case PAINTBRUSH_SHAPE_RANDOM:
|
||||
radius2=Paintbrush_offset_X+0.414213562; // [0.410..0.415[
|
||||
radius2*=radius2;
|
||||
// Init with blank
|
||||
for (y_pos=0; y_pos<Paintbrush_height; y_pos++)
|
||||
for (x_pos=0; x_pos<Paintbrush_width; x_pos++)
|
||||
memset(Paintbrush_sprite+y_pos*MAX_PAINTBRUSH_SIZE,0,Paintbrush_width);
|
||||
|
||||
radius2=Circle_squared_diameter(Paintbrush_width);
|
||||
|
||||
for (y_pos=0, y=1-Paintbrush_height; y_pos<Paintbrush_height; y_pos++,y+=2)
|
||||
for (x_pos=0, x=1-Paintbrush_width; x_pos<Paintbrush_width; x_pos++,x+=2)
|
||||
{
|
||||
x=x_pos-Paintbrush_offset_X;
|
||||
y=y_pos-Paintbrush_offset_Y;
|
||||
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=( (((x*x)+(y*y)) < radius2) && (!(rand()&7)) );
|
||||
if ((x*x)+(y*y) < radius2 && !(rand()&7))
|
||||
{
|
||||
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=1;
|
||||
// This prevents having a pixels that touch each other.
|
||||
if (x_pos>0)
|
||||
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos-1]=0;
|
||||
if (y_pos>0)
|
||||
Paintbrush_sprite[((y_pos-1)*MAX_PAINTBRUSH_SIZE)+x_pos]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,12 +173,9 @@ void Smaller_paintbrush(void)
|
||||
Hide_cursor();
|
||||
switch (Paintbrush_shape)
|
||||
{
|
||||
case PAINTBRUSH_SHAPE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_SIEVE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_CROSS:
|
||||
case PAINTBRUSH_SHAPE_PLUS:
|
||||
case PAINTBRUSH_SHAPE_DIAMOND:
|
||||
case PAINTBRUSH_SHAPE_RANDOM:
|
||||
if (Paintbrush_width&1)
|
||||
Set_paintbrush_size(Paintbrush_width-2,Paintbrush_height-2);
|
||||
else
|
||||
@ -161,6 +185,9 @@ void Smaller_paintbrush(void)
|
||||
case PAINTBRUSH_SHAPE_SLASH:
|
||||
case PAINTBRUSH_SHAPE_ANTISLASH:
|
||||
case PAINTBRUSH_SHAPE_SIEVE_SQUARE:
|
||||
case PAINTBRUSH_SHAPE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_SIEVE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_RANDOM:
|
||||
Set_paintbrush_size(Paintbrush_width-1,Paintbrush_height-1);
|
||||
break;
|
||||
case PAINTBRUSH_SHAPE_HORIZONTAL_BAR:
|
||||
@ -183,9 +210,6 @@ void Bigger_paintbrush(void)
|
||||
Hide_cursor();
|
||||
switch (Paintbrush_shape)
|
||||
{
|
||||
case PAINTBRUSH_SHAPE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_SIEVE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_RANDOM:
|
||||
case PAINTBRUSH_SHAPE_CROSS:
|
||||
case PAINTBRUSH_SHAPE_PLUS:
|
||||
case PAINTBRUSH_SHAPE_DIAMOND:
|
||||
@ -198,6 +222,9 @@ void Bigger_paintbrush(void)
|
||||
case PAINTBRUSH_SHAPE_SLASH:
|
||||
case PAINTBRUSH_SHAPE_ANTISLASH:
|
||||
case PAINTBRUSH_SHAPE_SIEVE_SQUARE:
|
||||
case PAINTBRUSH_SHAPE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_SIEVE_ROUND:
|
||||
case PAINTBRUSH_SHAPE_RANDOM:
|
||||
Set_paintbrush_size(Paintbrush_width+1,Paintbrush_height+1);
|
||||
break;
|
||||
case PAINTBRUSH_SHAPE_HORIZONTAL_BAR:
|
||||
@ -362,3 +389,25 @@ void Zoom(short delta)
|
||||
Display_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Set zoom value. Negative value means no zoom.
|
||||
*/
|
||||
void Zoom_set(int index)
|
||||
{
|
||||
Hide_cursor();
|
||||
if (index<0)
|
||||
{
|
||||
/* Zoom 1:1 */
|
||||
if (Main_magnifier_mode)
|
||||
Unselect_button(BUTTON_MAGNIFIER);
|
||||
}
|
||||
else
|
||||
{
|
||||
Change_magnifier_factor(index);
|
||||
if (!Main_magnifier_mode)
|
||||
Select_button(BUTTON_MAGNIFIER,1);
|
||||
Display_all_screen();
|
||||
}
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
@ -41,3 +41,8 @@ void Scroll_screen(short delta_x,short delta_y);
|
||||
void Scroll_magnifier(short delta_x,short delta_y);
|
||||
|
||||
void Zoom(short delta);
|
||||
void Zoom_set(int index);
|
||||
|
||||
void Display_stored_brush_in_window(word x,word y,int number);
|
||||
void Store_brush(int index);
|
||||
byte Restore_brush(int index);
|
||||
129
struct.h
@ -33,6 +33,12 @@
|
||||
|
||||
#include "const.h"
|
||||
|
||||
|
||||
// POSIX calls it strcasecmp, Windows uses stricmp... no ANSI standard.
|
||||
#ifdef WIN32
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
// Definition of the base data types
|
||||
/// 8bit unsigned integer
|
||||
#define byte uint8_t
|
||||
@ -61,6 +67,7 @@ typedef void (* Func_display_zoom) (word,word,word,byte *);
|
||||
typedef void (* Func_display_brush_color_zoom) (word,word,word,word,word,word,byte,word,byte *);
|
||||
typedef void (* Func_display_brush_mono_zoom) (word,word,word,word,word,word,byte,byte,word,byte *);
|
||||
typedef void (* Func_draw_brush) (byte *,word,word,word,word,word,word,byte,word);
|
||||
typedef void (* Func_draw_list_item) (word,word,word,byte);
|
||||
|
||||
/// A set of RGB values.
|
||||
typedef struct
|
||||
@ -157,6 +164,35 @@ typedef struct T_Fileselector_item
|
||||
struct T_Fileselector_item * Previous;///< Pointer to previous item of the current fileselector.
|
||||
} T_Fileselector_item;
|
||||
|
||||
/// Data for a fileselector
|
||||
typedef struct T_Fileselector
|
||||
{
|
||||
/// Number of elements in the current fileselector's ::Filelist
|
||||
short Nb_elements;
|
||||
/// Number of files in the current fileselector's ::Filelist
|
||||
short Nb_files;
|
||||
/// Number of directories in the current fileselector's ::Filelist
|
||||
short Nb_directories;
|
||||
/// Head of the linked list for the fileselector.
|
||||
T_Fileselector_item * First;
|
||||
/// Index for direct access to element number N
|
||||
T_Fileselector_item ** Index;
|
||||
} T_Fileselector;
|
||||
|
||||
typedef struct T_List_button
|
||||
{
|
||||
short Number; ///< Unique identifier for all controls
|
||||
short List_start; ///< Index of the font to appear as first line
|
||||
short Cursor_position; ///< Index of the selected line (0=top)
|
||||
|
||||
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; ///<
|
||||
|
||||
struct T_List_button * Next; ///< Pointer to the next list button of current window.
|
||||
} T_List_button;
|
||||
|
||||
/// Data for one line of the "Help" screens.
|
||||
typedef struct {
|
||||
char Line_type; ///< Kind of line: 'N' for normal line, 'S' for a bold line, 'K' for a line with keyboard shortcut, 'T' and '-' for upper and lower titles.
|
||||
@ -222,10 +258,11 @@ typedef struct
|
||||
word Key2; ///< Alternate keyboard shortcut: SDLK_something, or -1 for none
|
||||
} __attribute__((__packed__)) T_Config_shortcut_info;
|
||||
|
||||
/// This structure holds all the settings which are saved and loaded as gfx2.ini.
|
||||
/// This structure holds all the settings saved and loaded as gfx2.ini.
|
||||
typedef struct
|
||||
{
|
||||
byte Font; ///< Boolean, true to use the "fun" font in menus, false to use the classic one.
|
||||
char *Font_file; ///< Name of the font used in the menus. Matches file skins/font_*.png (Case-sensitive on some filesystems)
|
||||
char *Skin_file; ///< String, name of the file where all the graphic data is stored
|
||||
int Show_hidden_files; ///< Boolean, true to show hidden files in fileselectors.
|
||||
int Show_hidden_directories; ///< Boolean, true to show hidden directories in fileselectors.
|
||||
// int Show_system_directories; ///< (removed when converted from DOS)
|
||||
@ -250,7 +287,7 @@ typedef struct
|
||||
int Nb_max_vertices_per_polygon; ///< Limit for the number of vertices in polygon tools.
|
||||
byte Clear_palette; ///< Boolean, true to reset the palette (to black) before loading an image.
|
||||
byte Set_resolution_according_to; ///< When Auto_set_res is on, this determines if the mode should be chosen according to the "original screen" information in the file (1) or the picture dimensons (2)
|
||||
byte Ratio; ///< Determines the scaling of menu and windows: 0 no scaling, 1 scaling, 2 slight scaling.
|
||||
int8_t Ratio; ///< Determines the scaling of menu and windows: 0 no scaling, 1 scaling, 2 slight scaling, negative= opposite of max scaling
|
||||
byte Fast_zoom; ///< Boolean, true if the magnifier shortcut should automatically view the mouse area.
|
||||
byte Find_file_fast; ///< In fileselectors, this determines which entries should be sought when typing letters: 0 all, 1 files only, 2 directories only.
|
||||
byte Separate_colors; ///< Boolean, true if the menu palette should separate color cells with a black outline.
|
||||
@ -269,6 +306,9 @@ typedef struct
|
||||
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)
|
||||
word Double_click_speed; ///< Maximum delay for double-click, in ms.
|
||||
word Double_key_speed; ///< Maximum delay for double-keypress, in ms.
|
||||
byte Grid_XOR_color; ///< XOR value to apply for grid color.
|
||||
} T_Config;
|
||||
|
||||
// Structures utilisées pour les descriptions de pages et de liste de pages.
|
||||
@ -297,11 +337,88 @@ typedef struct
|
||||
/// Collection of undo/redo steps.
|
||||
typedef struct
|
||||
{
|
||||
int List_size; /// Number of ::T_Page in the vector "Pages".
|
||||
int Nb_pages_allocated;/// Number of ::T_Page used so far in the vector "Pages".
|
||||
T_Page * Pages; /// Vector of Pages, each one being a undo/redo step.
|
||||
int List_size; ///< Number of ::T_Page in the vector "Pages".
|
||||
int Nb_pages_allocated;///< Number of ::T_Page used so far in the vector "Pages".
|
||||
T_Page * Pages; ///< Vector of Pages, each one being a undo/redo step.
|
||||
} T_List_of_pages;
|
||||
|
||||
/// A single memorized brush from the Brush Container
|
||||
typedef struct
|
||||
{
|
||||
byte Paintbrush_shape; ///< Kind of brush
|
||||
byte Thumbnail[BRUSH_CONTAINER_PREVIEW_WIDTH][BRUSH_CONTAINER_PREVIEW_HEIGHT];
|
||||
// Data for color brush
|
||||
word Width;
|
||||
word Height;
|
||||
byte * Brush; /// < Color brush (if any)
|
||||
T_Palette Palette;
|
||||
byte Transp_color;
|
||||
} T_Brush_template;
|
||||
|
||||
|
||||
/// GUI skin data
|
||||
typedef struct
|
||||
{
|
||||
// Mouse
|
||||
|
||||
/// X coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_WIDTH
|
||||
word Cursor_offset_X[NB_CURSOR_SPRITES];
|
||||
/// Y coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_HEIGHT
|
||||
word Cursor_offset_Y[NB_CURSOR_SPRITES];
|
||||
/// Graphic resources for the mouse cursor.
|
||||
byte Cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
|
||||
|
||||
// Preset paintbrushes
|
||||
|
||||
/// Graphic resources for the preset paintbrushes.
|
||||
byte Paintbrush_sprite [NB_PAINTBRUSH_SPRITES][PAINTBRUSH_HEIGHT][PAINTBRUSH_WIDTH];
|
||||
/// Width of the preset paintbrushes.
|
||||
word Preset_paintbrush_width[NB_PAINTBRUSH_SPRITES];
|
||||
/// Height of the preset paintbrushes.
|
||||
word Preset_paintbrush_height[NB_PAINTBRUSH_SPRITES];
|
||||
/// Type of the preset paintbrush: index in enum PAINTBRUSH_SHAPES
|
||||
byte Paintbrush_type[NB_PAINTBRUSH_SPRITES];
|
||||
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_width[]/2
|
||||
word Preset_paintbrush_offset_X[NB_PAINTBRUSH_SPRITES];
|
||||
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_height[]/2
|
||||
word Preset_paintbrush_offset_Y[NB_PAINTBRUSH_SPRITES];
|
||||
|
||||
// Sieve patterns
|
||||
|
||||
/// Preset sieve patterns, stored as binary (one word per line)
|
||||
word Sieve_pattern[12][16];
|
||||
|
||||
// Menu and other graphics
|
||||
|
||||
/// Bitmap data for the menu, a single rectangle.
|
||||
byte Menu_block[MENU_HEIGHT][MENU_WIDTH];
|
||||
/// Bitmap data for the icons that are displayed over the menu.
|
||||
byte Menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
|
||||
/// Bitmap data for the different "effects" icons.
|
||||
byte Effect_sprite[NB_EFFECTS_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
|
||||
/// Bitmap data for the Grafx2 logo that appears on splash screen. All 256 colors allowed.
|
||||
byte Logo_grafx2[231*56];
|
||||
/// Bitmap data for the 6x8 font used in help screens.
|
||||
byte Help_font_norm [256][6][8];
|
||||
/// Bitmap data for the 6x8 font used in help screens ("bold" verstion).
|
||||
byte Bold_font [256][6][8];
|
||||
// 12
|
||||
// 34
|
||||
/// Bitmap data for the title font used in help screens. Top-left quarter.
|
||||
byte Help_font_t1 [64][6][8];
|
||||
/// Bitmap data for the title font used in help screens. Top-right quarter.
|
||||
byte Help_font_t2 [64][6][8];
|
||||
/// Bitmap data for the title font used in help screens. Bottom-left quarter.
|
||||
byte Help_font_t3 [64][6][8];
|
||||
/// Bitmap data for the title font used in help screens. Bottom-right quarter.
|
||||
byte Help_font_t4 [64][6][8];
|
||||
/// Bitmap data for the small 8x8 icons.
|
||||
byte Icon_sprite[NB_ICON_SPRITES][ICON_SPRITE_HEIGHT][ICON_SPRITE_WIDTH];
|
||||
|
||||
/// A default 256-color palette.
|
||||
T_Palette Default_palette;
|
||||
|
||||
|
||||
} T_Gui_skin;
|
||||
|
||||
#endif
|
||||
|
||||
@ -196,6 +196,9 @@ void Button_Transform_menu(void)
|
||||
Key=0;
|
||||
Window_help(BUTTON_ADJUST, "PICTURE TRANSFORM");
|
||||
}
|
||||
else if (Is_shortcut(Key,0x200+BUTTON_ADJUST))
|
||||
clicked_button=1;
|
||||
|
||||
else switch(clicked_button)
|
||||
{
|
||||
case 9: // Unit
|
||||
|
||||
293
windows.c
@ -32,6 +32,7 @@
|
||||
#include "misc.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "errors.h"
|
||||
#include "input.h"
|
||||
|
||||
// L'encapsulation tente une percée...ou un dernier combat.
|
||||
|
||||
@ -409,8 +410,7 @@ int Pick_color_in_palette()
|
||||
return color;
|
||||
}
|
||||
|
||||
// -- Afficher tout le menu --
|
||||
|
||||
/// Display the whole menu
|
||||
void Display_menu(void)
|
||||
{
|
||||
word x_pos;
|
||||
@ -420,17 +420,17 @@ void Display_menu(void)
|
||||
|
||||
if (Menu_is_visible)
|
||||
{
|
||||
// Affichage du sprite du menu
|
||||
// display menu sprite
|
||||
for (y_pos=0;y_pos<MENU_HEIGHT;y_pos++)
|
||||
for (x_pos=0;x_pos<MENU_WIDTH;x_pos++)
|
||||
Pixel_in_menu(x_pos,y_pos,GFX_menu_block[y_pos][x_pos]);
|
||||
// Affichage de la bande grise sous la palette
|
||||
Pixel_in_menu(x_pos,y_pos,Gfx->Menu_block[y_pos][x_pos]);
|
||||
// Grey area for filename below palette
|
||||
Block(MENU_WIDTH*Menu_factor_X,Menu_status_Y-Menu_factor_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),9*Menu_factor_Y,MC_Light);
|
||||
|
||||
// Affichage de la palette
|
||||
// Display palette
|
||||
Display_menu_palette();
|
||||
|
||||
// Affichage des couleurs de travail
|
||||
// Display selected colors
|
||||
Display_foreback();
|
||||
|
||||
|
||||
@ -439,12 +439,14 @@ void Display_menu(void)
|
||||
if ((Mouse_Y<Menu_Y) && // Souris dans l'image
|
||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ))
|
||||
{
|
||||
// Dans ces deux cas, on met dans la barre les XY courant, même s'il y a des chances que ça soit recouvert si la souris est sur un bouton (trop chiant à vérifier)
|
||||
// Prepare display of XY coordinates even if in some cases they will be
|
||||
// erased with some other text
|
||||
if ( (Current_operation!=OPERATION_COLORPICK)
|
||||
&& (Current_operation!=OPERATION_REPLACE) )
|
||||
Print_in_menu("X: Y: ",0);
|
||||
else
|
||||
{
|
||||
// The colorpicker display the color id between the parentheses
|
||||
Print_in_menu("X: Y: ( )",0);
|
||||
Num2str(Colorpicker_color,str,3);
|
||||
Print_in_menu(str,20);
|
||||
@ -454,7 +456,8 @@ void Display_menu(void)
|
||||
}
|
||||
Print_filename();
|
||||
}
|
||||
Update_rect(0,Menu_Y,Screen_width,MENU_HEIGHT*Menu_factor_Y); // on met toute la largur à jour, ça inclut la palette et la zone d'état avec le nom du fichier
|
||||
// Now update the area: menu height and whole screen width (including palette)
|
||||
Update_rect(0,Menu_Y,Screen_width,MENU_HEIGHT*Menu_factor_Y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -834,7 +837,7 @@ byte Confirmation_box(char * message)
|
||||
|
||||
|
||||
|
||||
//---- Fenêtre avertissant de quelque chose et attendant un click sur OK -----
|
||||
/// Window that show a warning message and wait for a click on the OK button
|
||||
void Warning_message(char * message)
|
||||
{
|
||||
short clicked_button;
|
||||
@ -860,6 +863,47 @@ void Warning_message(char * message)
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
/// Window that shows a big message, and waits for a click on OK
|
||||
void Verbose_error_message(char * message)
|
||||
{
|
||||
short clicked_button;
|
||||
int line;
|
||||
int i;
|
||||
char buffer[36]; // 35 characters + \0
|
||||
|
||||
Open_window(300,160,"Error!");
|
||||
|
||||
// Word-wrap the message
|
||||
for (line=0; line < 10; line++)
|
||||
{
|
||||
for (i=0;i<35 && *message!='\0';i++)
|
||||
{
|
||||
if (*message == '\n')
|
||||
{
|
||||
message++;
|
||||
break;
|
||||
}
|
||||
buffer[i]=*message;
|
||||
message++;
|
||||
}
|
||||
buffer[i]='\0';
|
||||
Print_in_window(10,20+line*8,buffer,MC_Black,MC_Light);
|
||||
if (*message=='\0')
|
||||
break;
|
||||
}
|
||||
|
||||
Window_set_normal_button(300/2-20,160-23,40,14,"OK",1,1,SDLK_RETURN); // 1
|
||||
Update_window_area(0,0,Window_width,Window_height);
|
||||
Display_cursor();
|
||||
|
||||
do
|
||||
clicked_button=Window_clicked_button();
|
||||
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=SDLK_o));
|
||||
Key=0;
|
||||
|
||||
Close_window();
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
// -- Redessiner le sprite d'un bouton dans le menu --
|
||||
@ -883,9 +927,9 @@ void Display_sprite_in_menu(int btn_number,int sprite_number)
|
||||
for (y_pos=0;y_pos<MENU_SPRITE_HEIGHT;y_pos++)
|
||||
for (x_pos=0;x_pos<MENU_SPRITE_WIDTH;x_pos++)
|
||||
{
|
||||
color=GFX_menu_sprite[sprite_number][y_pos][x_pos];
|
||||
color=Gfx->Menu_sprite[sprite_number][y_pos][x_pos];
|
||||
Pixel_in_menu(menu_x_pos+x_pos,menu_y_pos+y_pos,color);
|
||||
GFX_menu_block[menu_y_pos+y_pos][menu_x_pos+x_pos]=color;
|
||||
Gfx->Menu_block[menu_y_pos+y_pos][menu_x_pos+x_pos]=color;
|
||||
}
|
||||
Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset+1),
|
||||
(Buttons_Pool[btn_number].Y_offset+1)*Menu_factor_Y+Menu_Y,
|
||||
@ -909,9 +953,9 @@ void Display_paintbrush_in_menu(void)
|
||||
for (menu_y_pos=2,y_pos=0;y_pos<MENU_SPRITE_HEIGHT;menu_y_pos++,y_pos++)
|
||||
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
|
||||
{
|
||||
color=GFX_menu_sprite[4][y_pos][x_pos];
|
||||
color=Gfx->Menu_sprite[4][y_pos][x_pos];
|
||||
Pixel_in_menu(menu_x_pos,menu_y_pos,color);
|
||||
GFX_menu_block[menu_y_pos][menu_x_pos]=color;
|
||||
Gfx->Menu_block[menu_y_pos][menu_x_pos]=color;
|
||||
}
|
||||
break;
|
||||
default : // Pinceau
|
||||
@ -920,7 +964,7 @@ void Display_paintbrush_in_menu(void)
|
||||
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
|
||||
{
|
||||
Pixel_in_menu(menu_x_pos,menu_y_pos,MC_Light);
|
||||
GFX_menu_block[menu_y_pos][menu_x_pos]=MC_Light;
|
||||
Gfx->Menu_block[menu_y_pos][menu_x_pos]=MC_Light;
|
||||
}
|
||||
// On affiche le nouveau
|
||||
menu_start_x=8-Paintbrush_offset_X;
|
||||
@ -946,7 +990,7 @@ void Display_paintbrush_in_menu(void)
|
||||
{
|
||||
color=(Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos])?MC_Black:MC_Light;
|
||||
Pixel_in_menu(menu_x_pos,menu_y_pos,color);
|
||||
GFX_menu_block[menu_y_pos][menu_x_pos]=color;
|
||||
Gfx->Menu_block[menu_y_pos][menu_x_pos]=color;
|
||||
}
|
||||
}
|
||||
Update_rect(0,Menu_Y,MENU_SPRITE_WIDTH*Menu_factor_X+3,MENU_SPRITE_HEIGHT*Menu_factor_Y+3);
|
||||
@ -973,18 +1017,18 @@ void Display_paintbrush_in_window(word x,word y,int number)
|
||||
if (y_size<1)
|
||||
y_size=1;
|
||||
|
||||
origin_x = (x + 8)*Menu_factor_X - (Preset_paintbrush_offset_X[number])*x_size+Window_pos_X;
|
||||
origin_y = (y + 8)*Menu_factor_Y - (Preset_paintbrush_offset_Y[number])*y_size+Window_pos_Y;
|
||||
origin_x = (x + 8)*Menu_factor_X - (Gfx->Preset_paintbrush_offset_X[number])*x_size+Window_pos_X;
|
||||
origin_y = (y + 8)*Menu_factor_Y - (Gfx->Preset_paintbrush_offset_Y[number])*y_size+Window_pos_Y;
|
||||
|
||||
for (window_y_pos=0,y_pos=0; y_pos<Preset_paintbrush_height[number]; window_y_pos++,y_pos++)
|
||||
for (window_x_pos=0,x_pos=0; x_pos<Preset_paintbrush_width[number]; window_x_pos++,x_pos++)
|
||||
Block(origin_x+window_x_pos*x_size,origin_y+window_y_pos*y_size,x_size,y_size,(GFX_paintbrush_sprite[number][y_pos][x_pos])?MC_Black:MC_Light);
|
||||
for (window_y_pos=0,y_pos=0; y_pos<Gfx->Preset_paintbrush_height[number]; window_y_pos++,y_pos++)
|
||||
for (window_x_pos=0,x_pos=0; x_pos<Gfx->Preset_paintbrush_width[number]; window_x_pos++,x_pos++)
|
||||
Block(origin_x+window_x_pos*x_size,origin_y+window_y_pos*y_size,x_size,y_size,(Gfx->Paintbrush_sprite[number][y_pos][x_pos])?MC_Black:MC_Light);
|
||||
// On n'utilise pas Pixel_in_window() car on ne dessine pas
|
||||
// forcément avec la même taille de pixel.
|
||||
|
||||
Update_rect( ToWinX(origin_x), ToWinY(origin_y),
|
||||
ToWinL(Preset_paintbrush_width[number]),
|
||||
ToWinH(Preset_paintbrush_height[number])
|
||||
ToWinL(Gfx->Preset_paintbrush_width[number]),
|
||||
ToWinH(Gfx->Preset_paintbrush_height[number])
|
||||
);
|
||||
}
|
||||
|
||||
@ -1041,7 +1085,7 @@ void Window_display_icon_sprite(word x_pos,word y_pos,byte type)
|
||||
|
||||
for (j=0; j<ICON_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<ICON_SPRITE_WIDTH; i++)
|
||||
Pixel_in_window(x_pos+i,y_pos+j,GFX_icon_sprite[type][j][i]);
|
||||
Pixel_in_window(x_pos+i,y_pos+j,Gfx->Icon_sprite[type][j][i]);
|
||||
Update_rect(ToWinX(x_pos),ToWinY(y_pos),ToWinL(ICON_SPRITE_WIDTH),ToWinH(ICON_SPRITE_HEIGHT));
|
||||
}
|
||||
|
||||
@ -1234,6 +1278,46 @@ void Compute_paintbrush_coordinates(void)
|
||||
Paintbrush_X=(((Paintbrush_X+(Snap_width>>1)-Snap_offset_X)/Snap_width)*Snap_width)+Snap_offset_X;
|
||||
Paintbrush_Y=(((Paintbrush_Y+(Snap_height>>1)-Snap_offset_Y)/Snap_height)*Snap_height)+Snap_offset_Y;
|
||||
}
|
||||
|
||||
// Handling the snap axis mode, when shift is pressed.
|
||||
switch (Current_operation)
|
||||
{
|
||||
// Operations that don't implement it
|
||||
case OPERATION_LINE:
|
||||
Snap_axis=0;
|
||||
break;
|
||||
// Operations that implement it
|
||||
default:
|
||||
if (Snap_axis==0 && (SDL_GetModState() & KMOD_SHIFT))
|
||||
{
|
||||
// Start "Snap axis" mode
|
||||
Snap_axis=1;
|
||||
Snap_axis_origin_X=Paintbrush_X;
|
||||
Snap_axis_origin_Y=Paintbrush_Y;
|
||||
}
|
||||
}
|
||||
|
||||
if (Snap_axis==1)
|
||||
{
|
||||
// Cursor moved
|
||||
if (Paintbrush_X != Snap_axis_origin_X || Paintbrush_Y != Snap_axis_origin_Y)
|
||||
{
|
||||
if ((Paintbrush_X-Snap_axis_origin_X)*(Paintbrush_X-Snap_axis_origin_X) >
|
||||
(Paintbrush_Y-Snap_axis_origin_Y)*(Paintbrush_Y-Snap_axis_origin_Y))
|
||||
// Displacement was bigger on X axis: lock Y
|
||||
Snap_axis=2;
|
||||
else
|
||||
Snap_axis=3;
|
||||
}
|
||||
}
|
||||
if (Snap_axis==2)
|
||||
{
|
||||
Paintbrush_Y = Snap_axis_origin_Y;
|
||||
}
|
||||
else if (Snap_axis==3)
|
||||
{
|
||||
Paintbrush_X = Snap_axis_origin_X;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1522,7 +1606,7 @@ void Display_cursor(void)
|
||||
short end_y;
|
||||
short x_pos;
|
||||
short y_pos;
|
||||
short counter_x;
|
||||
short counter_x = 0;
|
||||
short counter_y;
|
||||
int temp;
|
||||
byte color;
|
||||
@ -1567,21 +1651,23 @@ void Display_cursor(void)
|
||||
else
|
||||
{
|
||||
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_TARGET:CURSOR_SHAPE_TARGET;
|
||||
start_x=Mouse_X-Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Cursor_offset_Y[temp];
|
||||
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
||||
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15 && x_pos < Screen_width;x_pos++,counter_x++)
|
||||
{
|
||||
if( x_pos < 0 ) continue;
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15 && y_pos < Screen_height;y_pos++,counter_y++)
|
||||
{
|
||||
if( y_pos < 0 || y_pos >= Screen_height) continue;
|
||||
color=GFX_cursor_sprite[temp][counter_y][counter_x];
|
||||
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||
if (color!=MC_Trans)
|
||||
Pixel(x_pos,y_pos,color);
|
||||
for (y_pos=start_y,counter_y=0; counter_y<15 && y_pos < Screen_height;
|
||||
y_pos++,counter_y++)
|
||||
{
|
||||
if( y_pos < 0 ) continue;
|
||||
for (x_pos=start_x,counter_x=0;
|
||||
counter_x<15 && x_pos < Screen_width; x_pos++,counter_x++)
|
||||
{
|
||||
if( x_pos < 0 ) continue;
|
||||
color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
|
||||
Cursor_background[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||
if (color!=MC_Trans)
|
||||
Pixel(x_pos,y_pos,color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y);
|
||||
}
|
||||
@ -1634,25 +1720,24 @@ void Display_cursor(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG("B",0);
|
||||
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER;
|
||||
start_x=Mouse_X-Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Cursor_offset_Y[temp];
|
||||
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
||||
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
{
|
||||
if(x_pos<0) continue;
|
||||
if(x_pos>=Screen_width) break;
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
color=GFX_cursor_sprite[temp][counter_y][counter_x];
|
||||
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
|
||||
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||
if (color!=MC_Trans)
|
||||
Pixel(x_pos,y_pos,color);
|
||||
}
|
||||
color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
|
||||
// On sauvegarde dans Cursor_background pour restaurer plus tard
|
||||
Cursor_background[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||
if (color!=MC_Trans)
|
||||
Pixel(x_pos,y_pos,color);
|
||||
}
|
||||
}
|
||||
Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y);
|
||||
}
|
||||
@ -1666,20 +1751,20 @@ void Display_cursor(void)
|
||||
|
||||
case CURSOR_SHAPE_ARROW :
|
||||
case CURSOR_SHAPE_HOURGLASS :
|
||||
start_x=Mouse_X-Cursor_offset_X[shape];
|
||||
start_y=Mouse_Y-Cursor_offset_Y[shape];
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
|
||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(x_pos<0) continue;
|
||||
if(x_pos>=Screen_width) break;
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
color=GFX_cursor_sprite[shape][counter_y][counter_x];
|
||||
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
|
||||
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||
if (color!=MC_Trans)
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
{
|
||||
if(x_pos<0) continue;
|
||||
if(x_pos>=Screen_width) break;
|
||||
color=Gfx->Cursor_sprite[shape][counter_y][counter_x];
|
||||
// On sauvegarde dans Cursor_background pour restaurer plus tard
|
||||
Cursor_background[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||
if (color!=MC_Trans)
|
||||
Pixel(x_pos,y_pos,color);
|
||||
}
|
||||
}
|
||||
@ -1826,14 +1911,11 @@ void Hide_cursor(void)
|
||||
int start_y;
|
||||
short end_x;
|
||||
short end_y;
|
||||
int x_pos;
|
||||
int x_pos = 0;
|
||||
int y_pos;
|
||||
short counter_x;
|
||||
short counter_x = 0;
|
||||
short counter_y;
|
||||
//short end_counter_x; // Position X ou s'arrête l'affichage de la brosse/pinceau
|
||||
//short end_counter_y; // Position Y ou s'arrête l'affichage de la brosse/pinceau
|
||||
int temp;
|
||||
//byte color;
|
||||
float cos_a,sin_a;
|
||||
short x1,y1,x2,y2,x3,y3,x4,y4;
|
||||
|
||||
@ -1873,17 +1955,18 @@ void Hide_cursor(void)
|
||||
else
|
||||
{
|
||||
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_TARGET:CURSOR_SHAPE_TARGET;
|
||||
start_x=Mouse_X-Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Cursor_offset_Y[temp];
|
||||
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
||||
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(y_pos < 0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
{
|
||||
if ( (x_pos<0) || (y_pos < 0)) continue;
|
||||
if(x_pos < 0) continue;
|
||||
else if (x_pos>=Screen_width) break;
|
||||
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
||||
Pixel(x_pos,y_pos,Cursor_background[counter_y][counter_x]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1941,21 +2024,21 @@ void Hide_cursor(void)
|
||||
else
|
||||
{
|
||||
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER;
|
||||
start_x=Mouse_X-Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Cursor_offset_Y[temp];
|
||||
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
||||
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
{
|
||||
if(x_pos<0) continue;
|
||||
if(x_pos>=Screen_width) break;
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
||||
}
|
||||
Pixel(x_pos,y_pos,Cursor_background[counter_y][counter_x]);
|
||||
}
|
||||
Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y);
|
||||
}
|
||||
Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y);
|
||||
}
|
||||
}
|
||||
if (!Paintbrush_hidden)
|
||||
@ -1969,18 +2052,18 @@ void Hide_cursor(void)
|
||||
|
||||
case CURSOR_SHAPE_ARROW :
|
||||
case CURSOR_SHAPE_HOURGLASS :
|
||||
start_x=Mouse_X-Cursor_offset_X[shape];
|
||||
start_y=Mouse_Y-Cursor_offset_Y[shape];
|
||||
start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
|
||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
|
||||
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(x_pos<0) continue;
|
||||
if(x_pos>=Screen_width) break;
|
||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||
{
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
||||
if(y_pos<0) continue;
|
||||
if(y_pos>=Screen_height) break;
|
||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||
{
|
||||
if(x_pos<0) continue;
|
||||
if(x_pos>=Screen_width) break;
|
||||
Pixel(x_pos,y_pos,Cursor_background[counter_y][counter_x]);
|
||||
}
|
||||
}
|
||||
Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y);
|
||||
@ -2492,52 +2575,52 @@ void Compute_optimal_menu_colors(T_Components * palette)
|
||||
for (k=0; k<NB_CURSOR_SPRITES; k++)
|
||||
for (j=0; j<CURSOR_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<CURSOR_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&GFX_cursor_sprite[k][j][i]);
|
||||
Remap_pixel(&Gfx->Cursor_sprite[k][j][i]);
|
||||
// Le menu
|
||||
for (j=0; j<MENU_HEIGHT; j++)
|
||||
for (i=0; i<MENU_WIDTH; i++)
|
||||
Remap_pixel(&GFX_menu_block[j][i]);
|
||||
Remap_pixel(&Gfx->Menu_block[j][i]);
|
||||
// Sprites du menu
|
||||
for (k=0; k<NB_MENU_SPRITES; k++)
|
||||
for (j=0; j<MENU_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<MENU_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&GFX_menu_sprite[k][j][i]);
|
||||
Remap_pixel(&Gfx->Menu_sprite[k][j][i]);
|
||||
// Sprites d'effets
|
||||
for (k=0; k<NB_EFFECTS_SPRITES; k++)
|
||||
for (j=0; j<MENU_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<MENU_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&GFX_effect_sprite[k][j][i]);
|
||||
Remap_pixel(&Gfx->Effect_sprite[k][j][i]);
|
||||
// Fontes de l'aide
|
||||
for (k=0; k<256; k++)
|
||||
for (j=0; j<8; j++)
|
||||
for (i=0; i<6; i++)
|
||||
Remap_pixel(&GFX_help_font_norm[k][i][j]);
|
||||
Remap_pixel(&Gfx->Help_font_norm[k][i][j]);
|
||||
for (k=0; k<256; k++)
|
||||
for (j=0; j<8; j++)
|
||||
for (i=0; i<6; i++)
|
||||
Remap_pixel(&GFX_bold_font[k][i][j]);
|
||||
Remap_pixel(&Gfx->Bold_font[k][i][j]);
|
||||
for (k=0; k<64; k++)
|
||||
for (j=0; j<8; j++)
|
||||
for (i=0; i<6; i++)
|
||||
Remap_pixel(&GFX_help_font_t1[k][i][j]);
|
||||
Remap_pixel(&Gfx->Help_font_t1[k][i][j]);
|
||||
for (k=0; k<64; k++)
|
||||
for (j=0; j<8; j++)
|
||||
for (i=0; i<6; i++)
|
||||
Remap_pixel(&GFX_help_font_t2[k][i][j]);
|
||||
Remap_pixel(&Gfx->Help_font_t2[k][i][j]);
|
||||
for (k=0; k<64; k++)
|
||||
for (j=0; j<8; j++)
|
||||
for (i=0; i<6; i++)
|
||||
Remap_pixel(&GFX_help_font_t3[k][i][j]);
|
||||
Remap_pixel(&Gfx->Help_font_t3[k][i][j]);
|
||||
for (k=0; k<64; k++)
|
||||
for (j=0; j<8; j++)
|
||||
for (i=0; i<6; i++)
|
||||
Remap_pixel(&GFX_help_font_t4[k][i][j]);
|
||||
Remap_pixel(&Gfx->Help_font_t4[k][i][j]);
|
||||
|
||||
// Sprites de lecteurs (drives)
|
||||
for (k=0; k<NB_ICON_SPRITES; k++)
|
||||
for (j=0; j<ICON_SPRITE_HEIGHT; j++)
|
||||
for (i=0; i<ICON_SPRITE_WIDTH; i++)
|
||||
Remap_pixel(&GFX_icon_sprite[k][j][i]);
|
||||
Remap_pixel(&Gfx->Icon_sprite[k][j][i]);
|
||||
}
|
||||
Clear_border(MC_Black);
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ void Print_counter(short x,short y,const char * str,byte text_color,byte backgro
|
||||
|
||||
byte Confirmation_box(char * message);
|
||||
void Warning_message(char * message);
|
||||
void Verbose_error_message(char * message);
|
||||
|
||||
void Display_image_limits(void);
|
||||
void Display_all_screen(void);
|
||||
|
||||