diff --git a/Versionen neu b/Versionen neu new file mode 100644 index 0000000..4a5304c --- /dev/null +++ b/Versionen neu @@ -0,0 +1,16 @@ +Erledigt in Version 0.3 + +* Fehler aus Video 0.3-1 behoben +* Menü "Projekt" hinzugefügt +* ASL Requester implementiert +* Funktion zu Menüpunkt "Neu" implementiert +* Funktion zu Menüpunkt "Laden ..." implementiert +* Funktion zu Menüpunkt "Speichern" implementiert +* Funktion zu Menüpunkt "Speichern als ..." implementiert +* Funktion zu Menüpunkt "Beenden" implementiert + +Planung für Version 0.4 + +- Titel dem Dateinamen anpasst +- Bei Änderung "*" hinter den Dateinamen +- Menüpunkt für Zeilennummer einfügen \ No newline at end of file diff --git a/phED b/phED index 0e6ba26..b3acfae 100644 Binary files a/phED and b/phED differ diff --git a/phED.link b/phED.link index 5306a30..acc7d62 100644 --- a/phED.link +++ b/phED.link @@ -4,6 +4,7 @@ - 3,1,0,16,data "Projekte:phED/phed.o" -0,0,180,1972,code_68k -1,1,16,24,data -!0,864 ; _main +0,0,180,3404,code_68k +1,1,16,208,data +2,2,0,256,bss +!0,1356 ; _main diff --git a/phED.map b/phED.map index 56dd4b0..7b5d854 100644 --- a/phED.map +++ b/phED.map @@ -18,194 +18,202 @@ No Global PPC Destruktors M68K Code - Hunk #0 ( Far Public ) 16192 Bytes (0x3f40) + Hunk #0 ( Far Public ) 17772 Bytes (0x456c) _exit = 132 (0x84) referenced 2 times File HD0:StormC/StormC/StormSYS/startups/startup.o _closeLibraries = 180 (0xb4) unused, maybe local File Projekte:phED/phed.o - _openLibraries = 282 (0x11a) unused, maybe local + _openLibraries = 306 (0x132) unused, maybe local File Projekte:phED/phed.o - _saveText = 428 (0x1ac) unused, maybe local + _neuText = 484 (0x1e4) unused, maybe local File Projekte:phED/phed.o - _loadText = 522 (0x20a) unused, maybe local + _neuASL = 506 (0x1fa) unused, maybe local File Projekte:phED/phed.o - _requesterNew = 692 (0x2b4) unused, maybe local + _saveText = 856 (0x358) unused, maybe local File Projekte:phED/phed.o - _OpenRequesterTags = 746 (0x2ea) unused, maybe local + _loadText = 950 (0x3b6) unused, maybe local File Projekte:phED/phed.o - _beendenReq = 804 (0x324) unused, maybe local + _requesterNew = 1122 (0x462) unused, maybe local File Projekte:phED/phed.o - _main = 864 (0x360) referenced 2 times + _OpenRequesterTags = 1176 (0x498) unused, maybe local File Projekte:phED/phed.o - _fopen = 2154 (0x86a) referenced 1 times + _beendenReq = 1234 (0x4d2) unused, maybe local + File Projekte:phED/phed.o + _frageReq = 1294 (0x50e) unused, maybe local + File Projekte:phED/phed.o + _main = 1356 (0x54c) referenced 2 times + File Projekte:phED/phed.o + _fopen = 3586 (0xe02) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _fclose = 2312 (0x908) referenced 1 times + _fclose = 3744 (0xea0) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _fflush = 2384 (0x950) referenced 1 times + _fflush = 3816 (0xee8) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _setvbuf = 2468 (0x9a4) referenced 3 times + _setvbuf = 3900 (0xf3c) referenced 3 times File HD0:StormC/StormC/Lib/storm.lib - _amigaopen = 2688 (0xa80) referenced 1 times + _amigaopen = 4120 (0x1018) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _amigaread = 3660 (0xe4c) referenced 7 times + _amigaread = 5092 (0x13e4) referenced 7 times File HD0:StormC/StormC/Lib/storm.lib - _amigareadunget = 4128 (0x1020) referenced 1 times + _amigareadunget = 5560 (0x15b8) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _amigawrite = 4228 (0x1084) referenced 5 times + _amigawrite = 5660 (0x161c) referenced 5 times File HD0:StormC/StormC/Lib/storm.lib - _amigaeof = 4780 (0x12ac) referenced 4 times + _amigaeof = 6212 (0x1844) referenced 4 times File HD0:StormC/StormC/Lib/storm.lib - _amigaseek = 4804 (0x12c4) referenced 4 times + _amigaseek = 6236 (0x185c) referenced 4 times File HD0:StormC/StormC/Lib/storm.lib - _amigagetc = 5092 (0x13e4) referenced 6 times + _amigagetc = 6524 (0x197c) referenced 6 times File HD0:StormC/StormC/Lib/storm.lib - _amigagetcunget = 5148 (0x141c) referenced 1 times + _amigagetcunget = 6580 (0x19b4) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _amigaungetc = 5180 (0x143c) referenced 4 times + _amigaungetc = 6612 (0x19d4) referenced 4 times File HD0:StormC/StormC/Lib/storm.lib - _amigaputc = 5212 (0x145c) referenced 4 times + _amigaputc = 6644 (0x19f4) referenced 4 times File HD0:StormC/StormC/Lib/storm.lib - _amigaflush = 5272 (0x1498) referenced 9 times + _amigaflush = 6704 (0x1a30) referenced 9 times File HD0:StormC/StormC/Lib/storm.lib - _amigaclose = 5504 (0x1580) referenced 4 times + _amigaclose = 6936 (0x1b18) referenced 4 times File HD0:StormC/StormC/Lib/storm.lib - _INIT_0_InitFiles = 5628 (0x15fc) unused, maybe local + _INIT_0_InitFiles = 7060 (0x1b94) unused, maybe local File HD0:StormC/StormC/Lib/storm.lib - _EXIT_5_InitFiles = 5700 (0x1644) unused, maybe local + _EXIT_5_InitFiles = 7132 (0x1bdc) unused, maybe local File HD0:StormC/StormC/Lib/storm.lib - _memcpy = 5788 (0x169c) referenced 3 times + _memcpy = 7220 (0x1c34) referenced 3 times File HD0:StormC/StormC/Lib/storm.lib - _malloc = 5860 (0x16e4) referenced 4 times + _malloc = 7292 (0x1c7c) referenced 4 times File HD0:StormC/StormC/Lib/storm.lib - _free = 6280 (0x1888) referenced 6 times + _free = 7712 (0x1e20) referenced 6 times File HD0:StormC/StormC/Lib/storm.lib - _EXIT_4_free = 6476 (0x194c) unused, maybe local + _EXIT_4_free = 7908 (0x1ee4) unused, maybe local File HD0:StormC/StormC/Lib/storm.lib - _realloc = 6596 (0x19c4) referenced 1 times + _realloc = 8028 (0x1f5c) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _formatted_out = 7188 (0x1c14) referenced 1 times + _formatted_out = 8712 (0x2208) referenced 2 times File HD0:StormC/StormC/Lib/storm.lib - _printf = 9176 (0x23d8) referenced 1 times + _printf = 10692 (0x29c4) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _fread = 9228 (0x240c) referenced 1 times + _sprintf = 10744 (0x29f8) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _fwrite = 9288 (0x2448) referenced 1 times + _fread = 10808 (0x2a38) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _INIT_5_InitStdIOFiles = 9340 (0x247c) unused, maybe local + _fwrite = 10868 (0x2a74) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _EXIT_5_InitStdIOFiles = 9606 (0x2586) unused, maybe local + _INIT_5_InitStdIOFiles = 10920 (0x2aa8) unused, maybe local File HD0:StormC/StormC/Lib/storm.lib - _strcpy = 9652 (0x25b4) referenced 1 times + _EXIT_5_InitStdIOFiles = 11186 (0x2bb2) unused, maybe local File HD0:StormC/StormC/Lib/storm.lib - _strcat = 9680 (0x25d0) referenced 1 times + _strcpy = 11232 (0x2be0) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _strcmp = 9716 (0x25f4) referenced 1 times + _strcat = 11260 (0x2bfc) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _strlen = 9772 (0x262c) referenced 5 times + _strcmp = 11296 (0x2c20) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _signed_out = 9796 (0x2644) referenced 1 times + _strlen = 11352 (0x2c58) referenced 5 times File HD0:StormC/StormC/Lib/storm.lib - _signed_out_l = 10454 (0x28d6) referenced 1 times + _signed_out = 11376 (0x2c70) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _unsigned_out = 10544 (0x2930) referenced 1 times + _signed_out_l = 12034 (0x2f02) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _unsigned_out_l = 11140 (0x2b84) referenced 2 times + _unsigned_out = 12124 (0x2f5c) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _char_out = 11668 (0x2d94) referenced 1 times + _unsigned_out_l = 12720 (0x31b0) referenced 2 times File HD0:StormC/StormC/Lib/storm.lib - _string_out = 11808 (0x2e20) referenced 1 times + _char_out = 13248 (0x33c0) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib - _DoMethod = 12000 (0x2ee0) referenced 1 times + _string_out = 13388 (0x344c) referenced 1 times + File HD0:StormC/StormC/Lib/storm.lib + _DoMethod = 13580 (0x350c) referenced 1 times File HD0:StormC/StormC/Lib/amiga.lib - _DoSuperMethod = 12020 (0x2ef4) unused, maybe local + _DoSuperMethod = 13600 (0x3520) unused, maybe local File HD0:StormC/StormC/Lib/amiga.lib - _CoerceMethod = 12046 (0x2f0e) unused, maybe local + _CoerceMethod = 13626 (0x353a) unused, maybe local File HD0:StormC/StormC/Lib/amiga.lib - _CoerceMethodA = 12068 (0x2f24) unused, maybe local + _CoerceMethodA = 13648 (0x3550) unused, maybe local File HD0:StormC/StormC/Lib/amiga.lib - _DoMethodA = 12104 (0x2f48) referenced 1 times + _DoMethodA = 13684 (0x3574) referenced 1 times File HD0:StormC/StormC/Lib/amiga.lib - _DoSuperMethodA = 12124 (0x2f5c) unused, maybe local + _DoSuperMethodA = 13704 (0x3588) unused, maybe local File HD0:StormC/StormC/Lib/amiga.lib - _SetSuperAttrs = 12150 (0x2f76) unused, maybe local + _SetSuperAttrs = 13730 (0x35a2) unused, maybe local File HD0:StormC/StormC/Lib/amiga.lib - _floor = 12208 (0x2fb0) referenced 1 times + _floor = 13788 (0x35dc) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/math000.lib - _frexp = 12232 (0x2fc8) referenced 1 times + _frexp = 13812 (0x35f4) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/math000.lib - _double_out = 12900 (0x3264) referenced 1 times + _double_out = 14480 (0x3890) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/math000.lib - main() = 14380 (0x382c) referenced 2 times + main() = 15960 (0x3e58) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - main(int,char **) = 14388 (0x3834) referenced 2 times + main(int,char **) = 15968 (0x3e60) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - wbmain(WBStartup *) = 14396 (0x383c) referenced 2 times + wbmain(WBStartup *) = 15976 (0x3e68) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _wbmain = 14404 (0x3844) referenced 2 times + _wbmain = 15984 (0x3e70) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - main(int,char *) = 14408 (0x3848) referenced 1 times + main(int,char *) = 15988 (0x3e74) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _EXIT_0_Main = 14900 (0x3a34) unused, maybe local + _EXIT_0_Main = 16480 (0x4060) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _INIT_1_DOS_c__DOSBase = 14952 (0x3a68) unused, maybe local + _INIT_1_DOS_c__DOSBase = 16532 (0x4094) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _EXIT_1_DOS_c__DOSBase = 14984 (0x3a88) unused, maybe local + _EXIT_1_DOS_c__DOSBase = 16564 (0x40b4) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _InitModules = 15052 (0x3acc) referenced 1 times + _InitModules = 16632 (0x40f8) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _CleanupModules = 15128 (0x3b18) referenced 2 times + _CleanupModules = 16708 (0x4144) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _INIT_2_Intuition_c__IntuitionBase = 15192 (0x3b58) unused, maybe local + _INIT_2_Intuition_c__IntuitionBase = 16772 (0x4184) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _EXIT_2_Intuition_c__IntuitionBase = 15224 (0x3b78) unused, maybe local + _EXIT_2_Intuition_c__IntuitionBase = 16804 (0x41a4) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - LibBaseC::LibBaseC(char *,unsigned long,short) = 15300 (0x3bc4) referenced 3 times + LibBaseC::LibBaseC(char *,unsigned long,short) = 16880 (0x41f0) referenced 3 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - LibBaseC::~LibBaseC() = 15756 (0x3d8c) referenced 3 times + LibBaseC::~LibBaseC() = 17336 (0x43b8) referenced 3 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _INIT_2_MathIEEEDoubBas_c__MathIeeeDoubBasBase = 15796 (0x3db4) unused, maybe local + _INIT_2_MathIEEEDoubBas_c__MathIeeeDoubBasBase = 17376 (0x43e0) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _EXIT_2_MathIEEEDoubBas_c__MathIeeeDoubBasBase = 15828 (0x3dd4) unused, maybe local + _EXIT_2_MathIEEEDoubBas_c__MathIeeeDoubBasBase = 17408 (0x4400) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - uintmult = 15868 (0x3dfc) referenced 2 times + uintmult = 17448 (0x4428) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - intmult = 15868 (0x3dfc) unused, maybe local + intmult = 17448 (0x4428) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___uintmult32 = 15868 (0x3dfc) unused, maybe local + ___uintmult32 = 17448 (0x4428) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___intmult32 = 15868 (0x3dfc) unused, maybe local + ___intmult32 = 17448 (0x4428) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - intdiv = 15900 (0x3e1c) unused, maybe local + intdiv = 17480 (0x4448) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - uintdiv = 15938 (0x3e42) unused, maybe local + uintdiv = 17518 (0x446e) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - lib_div_uint = 15938 (0x3e42) referenced 3 times + lib_div_uint = 17518 (0x446e) referenced 3 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___uintdivmod32 = 15938 (0x3e42) unused, maybe local + ___uintdivmod32 = 17518 (0x446e) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - lib_div_int = 15900 (0x3e1c) referenced 2 times + lib_div_int = 17480 (0x4448) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___intdivmod32 = 15900 (0x3e1c) unused, maybe local + ___intdivmod32 = 17480 (0x4448) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - Neg64 = 16020 (0x3e94) referenced 1 times + Neg64 = 17600 (0x44c0) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___neg64 = 16020 (0x3e94) unused, maybe local + ___neg64 = 17600 (0x44c0) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - SDiv64 = 16028 (0x3e9c) referenced 1 times + SDiv64 = 17608 (0x44c8) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - UDiv64 = 16068 (0x3ec4) referenced 1 times + UDiv64 = 17648 (0x44f0) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___uintdivmod64 = 16068 (0x3ec4) unused, maybe local + ___uintdivmod64 = 17648 (0x44f0) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___intdivmod64 = 16028 (0x3e9c) unused, maybe local + ___intdivmod64 = 17608 (0x44c8) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - UMod64 = 16168 (0x3f28) referenced 1 times + UMod64 = 17748 (0x4554) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___uintmod64 = 16168 (0x3f28) unused, maybe local + ___uintmod64 = 17748 (0x4554) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - SMod64 = 16180 (0x3f34) referenced 1 times + SMod64 = 17760 (0x4560) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib - ___intmod64 = 16180 (0x3f34) unused, maybe local + ___intmod64 = 17760 (0x4560) unused, maybe local File HD0:StormC/StormC/StormSYS/lib/stormcsupport000.lib PowerPC Code @@ -214,41 +222,47 @@ PowerPC Code Data - Hunk #1 ( Far Public ) 584 Bytes (0x248) + Hunk #1 ( Far Public ) 768 Bytes (0x300) _SysBase = 0 (0x0) referenced 11 times File HD0:StormC/StormC/StormSYS/startups/startup.o - _WindowBase = 16 (0x10) unused, maybe local + _WindowBase = 20 (0x14) unused, maybe local File Projekte:phED/phed.o - _LayoutBase = 20 (0x14) unused, maybe local + _LayoutBase = 24 (0x18) unused, maybe local File Projekte:phED/phed.o - _RequesterBase = 24 (0x18) unused, maybe local + _RequesterBase = 28 (0x1c) unused, maybe local File Projekte:phED/phed.o - _TextFieldBase = 28 (0x1c) unused, maybe local + _AslBase = 32 (0x20) unused, maybe local File Projekte:phED/phed.o - _std__out = 40 (0x28) referenced 3 times + _TextFieldBase = 36 (0x24) unused, maybe local + File Projekte:phED/phed.o + _mainMenu = 40 (0x28) unused, maybe local + File Projekte:phED/phed.o + _std__out = 224 (0xe0) referenced 3 times File HD0:StormC/StormC/Lib/storm.lib - _std__in = 128 (0x80) referenced 2 times + _std__in = 312 (0x138) referenced 2 times File HD0:StormC/StormC/Lib/storm.lib - _std__err = 216 (0xd8) referenced 2 times + _std__err = 400 (0x190) referenced 2 times File HD0:StormC/StormC/Lib/storm.lib - _DOSBase = 496 (0x1f0) referenced 10 times + _DOSBase = 680 (0x2a8) referenced 10 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _IntuitionBase = 508 (0x1fc) referenced 2 times + _IntuitionBase = 692 (0x2b4) referenced 2 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _not_open__LibBaseC = 512 (0x200) referenced 1 times + _not_open__LibBaseC = 696 (0x2b8) referenced 1 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - _MathIeeeDoubBasBase = 516 (0x204) referenced 5 times + _MathIeeeDoubBasBase = 700 (0x2bc) referenced 5 times File HD0:StormC/StormC/StormSYS/lib/stormcstartup000.lib - ___init_table68k = 520 (0x208) referenced 2 times + ___init_table68k = 704 (0x2c0) referenced 2 times File - ___exit_table68k = 552 (0x228) referenced 1 times + ___exit_table68k = 736 (0x2e0) referenced 1 times File BSS - Hunk #2 ( Far Public ) 568 Bytes (0x238) - _errno = 0 (0x0) referenced 1 times + Hunk #2 ( Far Public ) 824 Bytes (0x338) + _phed = 0 (0x0) unused, maybe local + File Projekte:phED/phed.o + _errno = 256 (0x100) referenced 1 times File HD0:StormC/StormC/Lib/storm.lib END diff --git a/phED.¶ b/phED.¶ index 930c7bd..cedb6fb 100644 --- a/phED.¶ +++ b/phED.¶ @@ -45,6 +45,8 @@ File "Projekte:phED/phed-init.h" "Projekte:phED/phed-file.h" "Projekte:phED/phed-req.h" +"Projekte:phED/phed-utils.h" +"Projekte:phED/phed-menu.h" Storm Shell Project (Dependencies) "phed.o" "phed.debug" "" @@ -69,6 +71,18 @@ File Storm Shell Project (Dependencies) "" "" "" +File +2 "phed-menu.h" +"phed-menu.h" +Storm Shell Project (Dependencies) +"" "" +"" +File +2 "phed-utils.h" +"phed-utils.h" +Storm Shell Project (Dependencies) +"" "" +"" Section 2 1 95 File diff --git a/phed-init.h b/phed-init.h index 407c4ff..e2b2196 100644 --- a/phed-init.h +++ b/phed-init.h @@ -1,6 +1,20 @@ +static const char *version = "$VER: phED Version 0.3"; + +enum +{ + GID_TEXTEDITOR = 0, + GID_LAST +}; + +struct phED +{ + char dateiname[256]; +} phed; + struct Library *WindowBase = NULL, *LayoutBase = NULL, *RequesterBase = NULL, + *AslBase = NULL, *TextFieldBase = NULL; void closeLibraries() @@ -9,6 +23,7 @@ void closeLibraries() if(TextFieldBase) CloseLibrary((struct Library *) TextFieldBase); if(LayoutBase) CloseLibrary((struct Library *) LayoutBase); if(RequesterBase) CloseLibrary((struct Library *) RequesterBase); + if(AslBase) CloseLibrary((struct Library *) AslBase); } @@ -24,7 +39,10 @@ BOOL openLibraries() { if(RequesterBase = (struct Library *) OpenLibrary("requester.class", 0L)) { - ret = TRUE; + if(AslBase = (struct Library *) OpenLibrary("asl.library", 0L)) + { + ret = TRUE; + } } } } diff --git a/phed-menu.h b/phed-menu.h new file mode 100644 index 0000000..c56d18d --- /dev/null +++ b/phed-menu.h @@ -0,0 +1,18 @@ +struct NewMenu mainMenu[] = +{ + { NM_TITLE, "Projekt", NULL, 0, 0, NULL }, + { NM_ITEM, "Neu", "N", 0, 0, NULL }, + { NM_ITEM, "Laden...", "L", 0, 0, NULL }, + { NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL }, + { NM_ITEM, "Speichern", "S", 0, 0, NULL }, + { NM_ITEM, "Speichern als...", "A", 0, 0, NULL }, + { NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL }, + { NM_ITEM, "Beenden", "Q", 0, 0, NULL }, + { NM_END, NULL, NULL, 0, 0, NULL } +}; + +#define MENU_PROJEKT_NEU FULLMENUNUM(0, 0, NOSUB) +#define MENU_PROJEKT_LADEN FULLMENUNUM(0, 1, NOSUB) +#define MENU_PROJEKT_SPEICHERN FULLMENUNUM(0, 3, NOSUB) +#define MENU_PROJEKT_SPEICHERNALS FULLMENUNUM(0, 4, NOSUB) +#define MENU_PROJEKT_BEENDEN FULLMENUNUM(0, 6, NOSUB) diff --git a/phed-req.h b/phed-req.h index bc95f5d..f1f1caa 100644 --- a/phed-req.h +++ b/phed-req.h @@ -29,4 +29,14 @@ ULONG beendenReq(char *text, Object *obj, struct Window *win) REQ_BodyText, text, REQ_GadgetText, "_Ja|_Nein|_Abbruch", TAG_DONE); +} + +ULONG frageReq(char *text, char *gadgets, Object *obj, struct Window *win) +{ + return OpenRequesterTags( obj, + win, + REQ_Type, REQTYPE_INFO, + REQ_BodyText, text, + REQ_GadgetText, gadgets, + TAG_DONE); } \ No newline at end of file diff --git a/phed-utils.h b/phed-utils.h new file mode 100644 index 0000000..2846db6 --- /dev/null +++ b/phed-utils.h @@ -0,0 +1,45 @@ +void neuText() +{ + strcpy(phed.dateiname, "phED\0"); +} + +char *neuASL(struct Window *win, char *dir, char *text, char *okText, BOOL dirOnly) +{ + struct FileRequester *fr; + + char *ret; + + if(fr = AllocFileRequest()) + { + if(AslRequestTags(fr, + ASL_Dir, dir, + ASL_Window, win, + ASL_Hail, text, + ASL_OKText, okText, + ASLFR_DrawersOnly, dirOnly, + TAG_END)) + { + if(dirOnly) + { + ret = (char *) malloc(strlen(fr->rf_Dir) + 1); + sprintf(ret, "%s", fr->rf_Dir); + } + else + { + if(strlen(fr->rf_Dir) > 0) + { + ret = (char *) malloc(strlen(fr->rf_Dir) + 1 + strlen(fr->rf_File) + 1); + sprintf(ret, "%s/%s", fr->rf_Dir, fr->rf_File); + } + else + { + ret = (char *) malloc(strlen(fr->rf_File) + 1); + sprintf(ret, "%s", fr->rf_File); + } + } + } + FreeFileRequest(fr); + + return ret; + } +} \ No newline at end of file diff --git a/phed.c b/phed.c index 1ee49f2..37cb2c5 100644 --- a/phed.c +++ b/phed.c @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -17,43 +18,37 @@ #include +#include +#include + #include "phed-init.h" +#include "phed-utils.h" #include "phed-file.h" #include "phed-req.h" +#include "phed-menu.h" -static const char *version = "$VER: phED Version 0.2"; - -enum -{ - GID_TEXTEDITOR = 0, - GID_LAST -}; int main(int argc, char *argv[]) { struct Window *window; struct Gadget *gadgets[GID_LAST]; - Object *Win_Object, *beenden_object; + Object *Win_Object, *beenden_object, *neu_object; ULONG signal, result; ULONG done = FALSE; - char *buf, *titel; + char *buf, *retASL; if(argc > 1) { - titel = (char *) malloc(strlen(argv[1])); - strcpy(titel, argv[1]); - titel[strlen(argv[1])] = '\0'; + strcpy(phed.dateiname, argv[1]); - buf = loadText(argv[1]); + buf = loadText(phed.dateiname); } else { - titel = (char *) malloc(strlen("phED")); - strcpy(titel, "phED"); - titel[strlen("phED")] = '\0'; + neuText(); buf = (char *) malloc(0); } @@ -61,10 +56,11 @@ int main(int argc, char *argv[]) if(openLibraries()) { beenden_object = requesterNew("Beenden"); + neu_object = requesterNew("Neu"); Win_Object = WindowObject, WA_ScreenTitle, "Projekt Hirnfrei", - WA_Title, titel, + WA_Title, phed.dateiname, WA_SizeGadget, TRUE, WA_DepthGadget, TRUE, WA_DragBar, TRUE, @@ -72,6 +68,8 @@ int main(int argc, char *argv[]) WA_Activate, TRUE, WA_Width, 400, WA_Height, 400, + WA_NewLookMenus, TRUE, + WINDOW_NewMenu, mainMenu, WINDOW_ParentGroup, HGroupObject, StartVGroup, StartMember, gadgets[GID_TEXTEDITOR] = TextEditorObject, @@ -104,6 +102,7 @@ int main(int argc, char *argv[]) switch(result & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: + { GetAttr(GA_TEXTEDITOR_HasChanged, gadgets[GID_TEXTEDITOR], &changed); if(changed) @@ -129,7 +128,99 @@ int main(int argc, char *argv[]) } else done = TRUE; break; + } + case WMHI_MENUPICK: + { + switch(result & WMHI_MENUMASK) + { + case MENU_PROJEKT_BEENDEN: + { + GetAttr(GA_TEXTEDITOR_HasChanged, gadgets[GID_TEXTEDITOR], &changed); + if(changed) + { + ret = beendenReq("\033cDer Text wurde verändert!\n\nSoll der Text gespeichert werden?", beenden_object, window); + + if(ret == 1) + { + buffer = (UBYTE *) DoGadgetMethod(gadgets[GID_TEXTEDITOR], window, NULL, GM_TEXTEDITOR_ExportText, NULL); + + if(!argv[1]) saveText("unbenannt.txt", buffer); + else saveText(argv[1], buffer); + done = TRUE; + } + if(ret == 2) + { + done = TRUE; + } + if(ret == 0) + { + done = FALSE; + } + } + else done = TRUE; + break; + } + case MENU_PROJEKT_NEU: + { + GetAttr(GA_TEXTEDITOR_HasChanged, gadgets[GID_TEXTEDITOR], &changed); + + if(changed) + { + ret = frageReq("\033cSoll der Text wirklich gelöscht werden?", "_Ja|_Nein", neu_object, window); + + if(ret == 1) + { + DoGadgetMethod(gadgets[GID_TEXTEDITOR], window, NULL, GM_TEXTEDITOR_ClearText, NULL); + neuText(); + } + } + else + { + DoGadgetMethod(gadgets[GID_TEXTEDITOR], window, NULL, GM_TEXTEDITOR_ClearText, NULL); + neuText(); + } + break; + } + case MENU_PROJEKT_SPEICHERN: + { + buffer = (UBYTE *) DoGadgetMethod(gadgets[GID_TEXTEDITOR], window, NULL, GM_TEXTEDITOR_ExportText, NULL); + + if(!phed.dateiname) saveText("unbenannt.txt", buffer); + else saveText(phed.dateiname, buffer); + + SetGadgetAttrs(gadgets[GID_TEXTEDITOR], window, NULL, GA_TEXTEDITOR_HasChanged, FALSE, TAG_DONE); + + break; + } + case MENU_PROJEKT_LADEN: + { + retASL = neuASL(window, "", "Datei zum laden auswählen", "Auswählen", FALSE); + + strcpy(phed.dateiname, retASL); + + buf = loadText(phed.dateiname); + + SetGadgetAttrs(gadgets[GID_TEXTEDITOR], window, NULL, GA_TEXTEDITOR_Contents, (APTR) buf, TAG_DONE); + + break; + } + case MENU_PROJEKT_SPEICHERNALS: + { + retASL = neuASL(window, "", "Datei zum speichern angeben", "Speichern als", FALSE); + + strcpy(phed.dateiname, retASL); + + buffer = (UBYTE *) DoGadgetMethod(gadgets[GID_TEXTEDITOR], window, NULL, GM_TEXTEDITOR_ExportText, NULL); + + saveText(phed.dateiname, buffer); + + SetGadgetAttrs(gadgets[GID_TEXTEDITOR], window, NULL, GA_TEXTEDITOR_HasChanged, FALSE, TAG_DONE); + + break; + } + } + } case WMHI_GADGETUP: { switch(result & WMHI_GADGETMASK) @@ -149,11 +240,12 @@ int main(int argc, char *argv[]) } } DisposeObject(beenden_object); + DisposeObject(neu_object); DisposeObject(Win_Object); } } closeLibraries(); - if(titel) free(titel); if(buf) free(buf); + if(retASL) free(retASL); } \ No newline at end of file diff --git a/phed.debug b/phed.debug index afe6479..3ef72c7 100644 Binary files a/phed.debug and b/phed.debug differ diff --git a/phed.o b/phed.o index 8c01f1f..734449a 100644 Binary files a/phed.o and b/phed.o differ diff --git a/unbenannt.txt b/unbenannt.txt index 299fd95..7262844 100644 --- a/unbenannt.txt +++ b/unbenannt.txt @@ -1 +1 @@ -Hello you bang bang! \ No newline at end of file +Geil, scheint ja zu funktionieren! \ No newline at end of file