Terminal-0.9.9004075500017500000144000000000001314040461000124635ustar multixusersTerminal-0.9.9/French.lproj004075500017500000144000000000001277071464000150345ustar multixusersTerminal-0.9.9/French.lproj/Localizable.strings010064400017500000144000000231051277071464000207450ustar multixusers/* French translation by fabien */ /*** French.lproj/Localizable.strings updated by make_strings 2016-01-24 21:58:13 +0100 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:658 */ "Command line:" = "Ligne de commande :"; /* File: TerminalWindow.m:200 */ /* File: TerminalWindow.m:204 */ " (idle)" = " (en attente)"; /* File: main.m:329 */ /* File: main.m:350 */ "Quit?" = "Quitter ?"; /* File: TerminalView.m:1135 */ /* File: TerminalView.m:1864 */ "Unexpected error while writing." = "Erreur inattendue durant l'écriture."; /*** Unmatched/untranslated keys ***/ /* File: PreferencesWindowController.m:89 */ "Revert" = "Revenir"; /* File: ServicesPrefs.m:563 */ "No input" = "Pas d'entrée"; /* File: ServicesPrefs.m:564 */ "Input in stdin" = "Entrée dans stdin"; /* File: ServicesPrefs.m:607 */ "Plain text" = "Texte seul"; /* File: TerminalParser_LinuxPrefs.m:43 */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:44 */ "West Europe, latin1" = "Europe de l'Ouest, latin1"; /* File: TerminalParser_LinuxPrefs.m:45 */ "East Europe, latin2" = "Europe de l'Est, latin2"; /* File: TerminalParser_LinuxPrefs.m:46 */ "Chinese" = "Chinois"; /* File: TerminalParser_LinuxPrefs.m:47 */ "Custom, leave unchanged" = "Propre, laisser inchangé"; /* File: TerminalParser_LinuxPrefs.m:106 */ "'linux' terminal parser" = "analyseur de terminal 'linux'"; /* File: TerminalParser_LinuxPrefs.m:111 */ "'linux'\nparser" = "analyseur\n'linux'"; /* File: TerminalParser_LinuxPrefs.m:154 */ "Character set:" = "Jeu de caractères :"; /* File: TerminalView.m:1611 */ /* Flag: unmatched */ "Unable to open pipe for input: %m." = "Impossible d'ouvrire un pipe pour l'entrée : %m."; /* File: TerminalView.m:1623 */ /* Flag: unmatched */ "Unable to fork: %m." = "Impossible de forker : %m."; /* File: TerminalView.m:1960 */ "Unable to open pipe for input." = "Impossible d'ouvrir un pipe pour l'entrée."; /* File: TerminalView.m:1972 */ "Unable to fork." = "Impossible de forker"; /* File: TerminalView.m:2000 */ "Unable to set non-blocking mode." = "Impossible d'enclencher le mode non bloquant"; /* File: TerminalViewPrefs.m:289 */ "Line" = "Ligne"; /* File: TerminalViewPrefs.m:304 */ "Scroll-back length in lines :" = "Nombre de lignes de marche arrière :"; /* File: TerminalViewPrefs.m:332 */ "Style:" = "Style :"; /* File: TerminalViewPrefs.m:396 */ "Handle wide (multi-cell) glyphs" = "Utiliser des glyphes larges (multi-cellule)"; /* File: TerminalViewPrefs.m:403 */ "Display black on white text" = "Afficher le texte en noir sur blanc"; /* File: TerminalViewPrefs.m:616 */ /* Flag: untranslated */ "Shell:" = "Shell :"; /* File: TerminalViewPrefs.m:747 */ "Treat the Alt key as Alt and not Meta.\nUseful if command is used as Meta\nAnd the keyboard has AltGr and not right Alt\n" = "Traiter la touche Alt en tant que Alt et non en tant que Meta.\nUtile si Commande est utilisée en tant que Meta\net si le clavier a AltGr et non la touche Alt de droite.\n"; /* File: TerminalViewPrefs.m:763 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "Envoyer l'échappement en double pour la touche Echappement.\n\nCela signifie que la touche Echappement sera reconnue plus vite par \nde nombreux programmes mais vous ne pourrez l'utiliser pour remplacer Meta."; /* File: main.m:156 */ /* Flag: untranslated */ "Benchmark" = "Benchmark"; /* File: main.m:168 */ "New window" = "Nouvelle fenêtre"; /* File: main.m:171 */ "New tab" = "Nouvel onglet"; /* File: main.m:194 */ "Show tab bar" = "Montrer la barre d'onglets"; /* File: main.m:197 */ "View" = "Vue"; /* File: main.m:193 */ "Miniaturize all" = "Tout miniaturiser"; /* File: main.m:201 */ "Services" = "Services"; /* File: main.m:202 */ "Close window" = "Fermer la fenêtre"; /* File: main.m:205 */ "Close tab" = "Fermer l'onglet"; /* File: main.m:208 */ "Show previous tab" = "Montrer l'onglet précédent"; /* File: main.m:211 */ "Show next tab" = "Montrer l'onglet suivant"; /* File: main.m:214 */ "Move tab left" = "Déplacer l'onglet à gauche"; /* File: main.m:217 */ "Move tab right" = "Déplacer l'onglet à droite"; /* File: main.m:280 */ "Quit anyway" = "Quitter vraiment"; /* File: main.m:288 */ "Don't quit" = "Ne pas quitter"; /* File: main.m:305 */ "There are active windows. Quitting will close them." = "Certaines fenêtres sont actives. Quitter va les fermer."; /*** Strings from PreferencesWindowController.m ***/ /* File: PreferencesWindowController.m:97 */ "Apply and save" = "Appliquer et sauvegarder"; /* File: PreferencesWindowController.m:142 */ "Preferences" = "Panneau des Préférences"; /*** Strings from Services.m ***/ /* File: Services.m:151 */ "Service aborted by user." = "Service annulé par l'utilisateur."; /* File: Services.m:59 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = "Il n'y a aucun service de terminal appelé '%@'.\nVotre liste de services n'est probabement pas à jour.\nLancer 'make_services' pour la mettre à jour."; /*** Strings from ServicesParameterWindowController.m ***/ /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "Annuler"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "OK"; /* File: ServicesParameterWindowController.m:118 */ "Parameter for service %@" = "Paramètre pour le service %@"; /*** Strings from ServicesPrefs.m ***/ /* File: ServicesPrefs.m:590 */ "Accept types" = "Accepte les types"; /* File: ServicesPrefs.m:504 */ "Add" = "Ajouter"; /* File: ServicesPrefs.m:352 */ "Error importing services" = "erreur durant l'import des services"; /* File: ServicesPrefs.m:405 */ "Export services" = "Exporter les services"; /* File: ServicesPrefs.m:528 */ "Export..." = "Exporter..."; /* File: ServicesPrefs.m:599 */ "Filenames" = "Noms de fichiers"; /* File: ServicesPrefs.m:554 */ "Ignore output" = "Ignorer la sortie"; /* File: ServicesPrefs.m:258 */ "Import services" = "Importer des services"; /* File: ServicesPrefs.m:520 */ "Import..." = "Importer..."; /* File: ServicesPrefs.m:565 */ "Input on command line" = "Entrée standard sur la ligne de commande"; /* File: ServicesPrefs.m:645 */ "Key:" = "Touche :"; /* File: ServicesPrefs.m:632 */ "Name:" = "Nom :"; /* File: ServicesPrefs.m:512 */ "Remove" = "Supprimer"; /* File: ServicesPrefs.m:555 */ "Return output" = "Retourner la sortie standard"; /* File: ServicesPrefs.m:573 */ "Run in background" = "Exécuter en arrière plan"; /* File: ServicesPrefs.m:575 */ "Run in idle window" = "Exécuter dans une fenêtre en attente"; /* File: ServicesPrefs.m:574 */ "Run in new window" = "Exécuter dans une nouvelle fenêtre"; /* File: ServicesPrefs.m:473 */ "Terminal services" = "Services de Terminal"; /* File: ServicesPrefs.m:478 */ "Terminal\nservices" = "Services de \nTerminal"; /* File: ServicesPrefs.m:353 */ "The file '%@' doesn't contain valid terminal services." = "Le fichier '%@' contient des services qui ne sont pas valides."; /* File: ServicesPrefs.m:239 */ "Unnamed service" = "Service Inconnu"; /*** Strings from TerminalView.m ***/ /* File: TerminalView.m:1772 */ "[Process exited]" = "[Fin de processus]"; /*** Strings from TerminalViewPrefs.m ***/ /* File: TerminalViewPrefs.m:414 */ "Bold font:" = "Texte gras :"; /* File: TerminalViewPrefs.m:373 */ "Color:" = "Couleur :"; /* File: TerminalViewPrefs.m:327 */ "Cursor" = "Curseur"; /* File: TerminalViewPrefs.m:278 */ /* File: TerminalViewPrefs.m:273 */ "Display" = "Affichage"; /* File: TerminalViewPrefs.m:711 */ /* File: TerminalViewPrefs.m:706 */ "Keyboard" = "Clavier"; /* File: TerminalViewPrefs.m:441 */ "Normal font:" = "Texte normal :"; /* File: TerminalViewPrefs.m:453 */ /* File: TerminalViewPrefs.m:426 */ "Pick font..." = "Définir la police..."; /* File: TerminalViewPrefs.m:583 */ /* File: TerminalViewPrefs.m:578 */ "Shell" = "Shell par d\u00e9faut"; /* File: TerminalViewPrefs.m:604 */ "Start as login-shell" = "Démarrer comme login-shell"; /* File: TerminalViewPrefs.m:736 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Traiter la touche Command comme Meta.\n\nNotez qu'avec cette touche activée, vous\nn'aurez plus accès au menu."; /*** Strings from TerminalWindowPrefs.m ***/ /* File: TerminalWindowPrefs.m:216 */ "Add top and bottom border" = "Ajouter une bordure en haut et en bas"; /* File: TerminalWindowPrefs.m:154 */ "Close new windows when idle" = "Fermer les nouvelles fenêtres lorsque le shell se termine"; /* File: TerminalWindowPrefs.m:178 */ "Default size" = "Taille par défaut"; /* File: TerminalWindowPrefs.m:155 */ "Don't close new windows" = "Ne pas fermer les nouvelles fenêtres"; /* File: TerminalWindowPrefs.m:192 */ "Height:" = "Hauteur :"; /* File: TerminalWindowPrefs.m:116 */ "Terminal Window" = "Fenêtre Terminal"; /* File: TerminalWindowPrefs.m:121 */ "Terminal\nWindow" = "Fenêtre\nTerminal"; /* File: TerminalWindowPrefs.m:182 */ "Width:" = "Largeur :"; /*** Strings from main.m ***/ /* File: main.m:190 */ "Close" = "Fermer"; /* File: main.m:179 */ "Copy" = "Copier"; /* File: main.m:176 */ "Cut" = "Couper"; /* File: main.m:185 */ "Edit" = "Editer"; /* File: main.m:205 */ "Hide" = "Masquer"; /* File: main.m:158 */ "Info" = "Information"; /* File: main.m:152 */ "Info..." = "Panneaux d'informations"; /* File: main.m:182 */ "Paste" = "Coller"; /* File: main.m:154 */ "Preferences..." = "Préférences..."; /* File: main.m:209 */ "Quit" = "Quitter"; /* File: main.m:196 */ "Windows" = "Fenêtres"; Terminal-0.9.9/charmaps.h010064400017500000144000000216631264654375400145450ustar multixusers#define GRAF_MAP 1 #define LAT1_MAP 0 #define IBMPC_MAP 2 #define USER_MAP 3 /* staight from linux/drivers/char/consolemap.c, GNU GPL:ed */ static const unichar translate_maps[4][256]={ /* 8-bit Latin-1 mapped to Unicode -- trivial mapping */ { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff }, /* VT100 graphics mapped to Unicode */ { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x2192, 0x2190, 0x2191, 0x2193, 0x002f, 0x2588, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x00a0, 0x25c6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 0x00b1, 0x2591, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0xf800, 0xf801, 0x2500, 0xf803, 0xf804, 0x251c, 0x2524, 0x2534, 0x252c, 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff }, /* IBM Codepage 437 mapped to Unicode */ { 0x0000, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25d8, 0x25cb, 0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c, 0x25b6, 0x25c0, 0x2195, 0x203c, 0x00b6, 0x00a7, 0x25ac, 0x21a8, 0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194, 0x25b2, 0x25bc, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x2302, 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, 0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192, 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, 0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, 0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229, 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0 }, /* User mapping -- default to codes for direct font mapping */ { 0xf000, 0xf001, 0xf002, 0xf003, 0xf004, 0xf005, 0xf006, 0xf007, 0xf008, 0xf009, 0xf00a, 0xf00b, 0xf00c, 0xf00d, 0xf00e, 0xf00f, 0xf010, 0xf011, 0xf012, 0xf013, 0xf014, 0xf015, 0xf016, 0xf017, 0xf018, 0xf019, 0xf01a, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf020, 0xf021, 0xf022, 0xf023, 0xf024, 0xf025, 0xf026, 0xf027, 0xf028, 0xf029, 0xf02a, 0xf02b, 0xf02c, 0xf02d, 0xf02e, 0xf02f, 0xf030, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf03a, 0xf03b, 0xf03c, 0xf03d, 0xf03e, 0xf03f, 0xf040, 0xf041, 0xf042, 0xf043, 0xf044, 0xf045, 0xf046, 0xf047, 0xf048, 0xf049, 0xf04a, 0xf04b, 0xf04c, 0xf04d, 0xf04e, 0xf04f, 0xf050, 0xf051, 0xf052, 0xf053, 0xf054, 0xf055, 0xf056, 0xf057, 0xf058, 0xf059, 0xf05a, 0xf05b, 0xf05c, 0xf05d, 0xf05e, 0xf05f, 0xf060, 0xf061, 0xf062, 0xf063, 0xf064, 0xf065, 0xf066, 0xf067, 0xf068, 0xf069, 0xf06a, 0xf06b, 0xf06c, 0xf06d, 0xf06e, 0xf06f, 0xf070, 0xf071, 0xf072, 0xf073, 0xf074, 0xf075, 0xf076, 0xf077, 0xf078, 0xf079, 0xf07a, 0xf07b, 0xf07c, 0xf07d, 0xf07e, 0xf07f, 0xf080, 0xf081, 0xf082, 0xf083, 0xf084, 0xf085, 0xf086, 0xf087, 0xf088, 0xf089, 0xf08a, 0xf08b, 0xf08c, 0xf08d, 0xf08e, 0xf08f, 0xf090, 0xf091, 0xf092, 0xf093, 0xf094, 0xf095, 0xf096, 0xf097, 0xf098, 0xf099, 0xf09a, 0xf09b, 0xf09c, 0xf09d, 0xf09e, 0xf09f, 0xf0a0, 0xf0a1, 0xf0a2, 0xf0a3, 0xf0a4, 0xf0a5, 0xf0a6, 0xf0a7, 0xf0a8, 0xf0a9, 0xf0aa, 0xf0ab, 0xf0ac, 0xf0ad, 0xf0ae, 0xf0af, 0xf0b0, 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xf0b6, 0xf0b7, 0xf0b8, 0xf0b9, 0xf0ba, 0xf0bb, 0xf0bc, 0xf0bd, 0xf0be, 0xf0bf, 0xf0c0, 0xf0c1, 0xf0c2, 0xf0c3, 0xf0c4, 0xf0c5, 0xf0c6, 0xf0c7, 0xf0c8, 0xf0c9, 0xf0ca, 0xf0cb, 0xf0cc, 0xf0cd, 0xf0ce, 0xf0cf, 0xf0d0, 0xf0d1, 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, 0xf0d7, 0xf0d8, 0xf0d9, 0xf0da, 0xf0db, 0xf0dc, 0xf0dd, 0xf0de, 0xf0df, 0xf0e0, 0xf0e1, 0xf0e2, 0xf0e3, 0xf0e4, 0xf0e5, 0xf0e6, 0xf0e7, 0xf0e8, 0xf0e9, 0xf0ea, 0xf0eb, 0xf0ec, 0xf0ed, 0xf0ee, 0xf0ef, 0xf0f0, 0xf0f1, 0xf0f2, 0xf0f3, 0xf0f4, 0xf0f5, 0xf0f6, 0xf0f7, 0xf0f8, 0xf0f9, 0xf0fa, 0xf0fb, 0xf0fc, 0xf0fd, 0xf0fe, 0xf0ff } }; Terminal-0.9.9/main.m010064400017500000144000000334541271743237200136710ustar multixusers/* copyright 2002, 2003 Alexander Malmberg 2009-2016 GAP Project Authors: Alexander Malmberg Riccardo Mottola Tim Sheridan This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import /* For the quit panel: */ #import #import #import #import #import #import #import #import #import "Label.h" #import "PreferencesWindowController.h" #import "Services.h" #import "ServicesPrefs.h" #import "TerminalView.h" #import "TerminalViewPrefs.h" #import "TerminalWindow.h" #import "TerminalWindowPrefs.h" #import "TerminalParser_LinuxPrefs.h" @interface NSMenu (helpers) -(id ) addItemWithTitle: (NSString *)s; -(id ) addItemWithTitle: (NSString *)s action: (SEL)sel; @end @implementation NSMenu (im_lazy) -(id ) addItemWithTitle: (NSString *)s { return [self addItemWithTitle: s action: NULL keyEquivalent: nil]; } -(id ) addItemWithTitle: (NSString *)s action: (SEL)sel { return [self addItemWithTitle: s action: sel keyEquivalent: nil]; } @end @interface Terminal : NSObject { PreferencesWindowController *pwc; NSPanel *quitPanel; BOOL quitPanelOpen; } @end @implementation Terminal - init { if (!(self=[super init])) return nil; return self; } -(void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; DESTROY(pwc); [super dealloc]; } -(void) openPreferences: (id)sender { if (!pwc) { NSObject *pb; pwc=[[PreferencesWindowController alloc] init]; pb=[[TerminalViewDisplayPrefs alloc] init]; [pwc addPrefBox: pb]; DESTROY(pb); pb=[[TerminalViewShellPrefs alloc] init]; [pwc addPrefBox: pb]; DESTROY(pb); pb=[[TerminalViewKeyboardPrefs alloc] init]; [pwc addPrefBox: pb]; DESTROY(pb); pb=[[TerminalWindowPrefs alloc] init]; [pwc addPrefBox: pb]; DESTROY(pb); pb=[[TerminalServicesPrefs alloc] init]; [pwc addPrefBox: pb]; DESTROY(pb); pb=[[TerminalParser_LinuxPrefs alloc] init]; [pwc addPrefBox: pb]; DESTROY(pb); } [pwc showWindow: self]; } -(void) applicationWillTerminate: (NSNotification *)n { } -(void) applicationWillFinishLaunching: (NSNotification *)n { NSMenu *menu,*m/*,*m2*/; [TerminalView registerPasteboardTypes]; menu=[[NSMenu alloc] init]; /* 'Info' menu */ m=[[NSMenu alloc] init]; [m addItemWithTitle: _(@"Info...") action: @selector(orderFrontStandardInfoPanel:)]; [m addItemWithTitle: _(@"Preferences...") action: @selector(openPreferences:)]; [m addItemWithTitle: _(@"Benchmark") action: @selector(benchmark:)]; [menu setSubmenu: m forItem: [menu addItemWithTitle: _(@"Info")]]; [m release]; /* 'Terminal' menu */ m=[[NSMenu alloc] init]; [m addItemWithTitle: _(@"New window") action: @selector(openWindow:) keyEquivalent: @"n"]; [m addItemWithTitle: _(@"New tab") action: @selector(openTab:) keyEquivalent: @"t"]; [menu setSubmenu: m forItem: [menu addItemWithTitle: _(@"Shell")]]; [m release]; /* 'Edit' menu */ m=[[NSMenu alloc] init]; [m addItemWithTitle: _(@"Cut") action: @selector(cut:) keyEquivalent: @"x"]; [m addItemWithTitle: _(@"Copy") action: @selector(copy:) keyEquivalent: @"c"]; [m addItemWithTitle: _(@"Paste") action: @selector(paste:) keyEquivalent: @"v"]; [menu setSubmenu: m forItem: [menu addItemWithTitle: _(@"Edit")]]; [m release]; /* 'View' menu */ m=[[NSMenu alloc] init]; [m addItemWithTitle: _(@"Show tab bar") action: @selector(showTabBarToggle:) keyEquivalent: @"T"]; [menu setSubmenu: m forItem: [menu addItemWithTitle: _(@"View")]]; [m release]; /* 'Windows' menu */ m=[[NSMenu alloc] init]; [m addItemWithTitle: _(@"Close window") action: @selector(performClose:) keyEquivalent: @"W"]; [m addItemWithTitle: _(@"Close tab") action: @selector(closeTab:) keyEquivalent: @"w"]; [m addItemWithTitle: _(@"Show previous tab") action: @selector(showPreviousTab:) keyEquivalent: @"{"]; [m addItemWithTitle: _(@"Show next tab") action: @selector(showNextTab:) keyEquivalent: @"}"]; [m addItemWithTitle: _(@"Move tab left") action: @selector(moveTabLeft:) keyEquivalent: @"("]; [m addItemWithTitle: _(@"Move tab right") action: @selector(moveTabRight:) keyEquivalent: @")"]; [m addItemWithTitle: _(@"Miniaturize all") action: @selector(miniaturizeAll:) keyEquivalent: @"m"]; [menu setSubmenu: m forItem: [menu addItemWithTitle: _(@"Windows")]]; [NSApp setWindowsMenu: m]; [m release]; m=[[NSMenu alloc] init]; [menu setSubmenu: m forItem: [menu addItemWithTitle: _(@"Services")]]; [NSApp setServicesMenu: m]; [m release]; [menu addItemWithTitle: _(@"Hide") action: @selector(hide:) keyEquivalent: @"h"]; [menu addItemWithTitle: _(@"Quit") action: @selector(terminate:) keyEquivalent: @"q"]; [NSApp setMainMenu: menu]; [menu release]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(noMoreActiveWindows:) name: TerminalWindowNoMoreActiveWindowsNotification object: nil]; } -(void) openWindow: (id)sender { TerminalWindowController *twc; twc=[TerminalWindowController newTerminalWindow]; [[twc frontTerminalView] runShell]; } -(void) openTab: (id)sender { TerminalWindowController *twc = [[NSApp keyWindow] windowController]; [twc newTerminalTabInWindow:[NSApp keyWindow]]; [[twc frontTerminalView] runShell]; } -(void) closeTab: (id)sender { TerminalWindowController *twc = [[NSApp keyWindow] windowController]; TerminalView *tv = [twc frontTerminalView]; [twc closeTerminalTab:tv inWindow:[NSApp keyWindow]]; } -(void) showTabBarToggle: (id)sender { TerminalWindowController *twc = [[NSApp keyWindow] windowController]; [twc setShowTabBar:(! [twc showTabBar]) inWindow:[NSApp keyWindow]]; } -(void) showPreviousTab: (id)sender { TerminalWindowController *twc = [[NSApp keyWindow] windowController]; [twc showPreviousTab]; } -(void) showNextTab: (id)sender { TerminalWindowController *twc = [[NSApp keyWindow] windowController]; [twc showNextTab]; } -(void) moveTabLeft: (id)sender { TerminalWindowController *twc = [[NSApp keyWindow] windowController]; [twc moveTabLeft]; } -(void) moveTabRight: (id)sender { TerminalWindowController *twc = [[NSApp keyWindow] windowController]; [twc moveTabRight]; } -(void) applicationDidFinishLaunching: (NSNotification *)n { NSArray *args=[[NSProcessInfo processInfo] arguments]; [TerminalServices updateServicesPlist]; [NSApp setServicesProvider: [[TerminalServices alloc] init]]; if ([args count]>1) { TerminalWindowController *twc; NSString *cmdline; args=[args subarrayWithRange: NSMakeRange(1,[args count]-1)]; cmdline=[args componentsJoinedByString: @" "]; twc=[TerminalWindowController newTerminalWindow]; [[twc frontTerminalView] runProgram: @"/bin/sh" withArguments: [NSArray arrayWithObjects: @"-c",cmdline,nil] initialInput: nil]; [twc release]; } else [self openWindow: self]; } -(NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *)sender { if (![TerminalWindowController numberOfActiveWindows]) return NSTerminateNow; if (!quitPanel) { NSButton *b_quit,*b_dont; { GSVbox *vb=[[GSVbox alloc] init]; [vb setBorder: 10.0]; { NSButton *butt; GSHbox *hb; hb=[[GSHbox alloc] init]; [hb setAutoresizingMask: NSViewMinXMargin]; butt=b_quit=[[NSButton alloc] init]; [butt setTitle: _(@"Quit anyway")]; [butt setTarget: self]; [butt setAction: @selector(quitAnyway:)]; [butt sizeToFit]; [hb addView: butt enablingXResizing: NO]; DESTROY(butt); butt=b_dont=[[NSButton alloc] init]; [butt setTitle: _(@"Don't quit")]; [butt setImagePosition: NSImageRight]; [butt setImage: [NSImage imageNamed: @"common_ret"]]; [butt setTarget: self]; [butt setAction: @selector(dontQuit:)]; [butt sizeToFit]; [hb addView: butt enablingXResizing: NO withMinXMargin: 8.0]; DESTROY(butt); [vb addView: hb enablingYResizing: NO]; DESTROY(hb); } { NSTextField *text; text=[NSTextField newLabel: _(@"There are active windows. Quitting will close them.")]; [text setAutoresizingMask: NSViewWidthSizable|NSViewMinYMargin]; [text sizeToFit]; [vb addView: text enablingYResizing: YES withMinYMargin: 8.0]; DESTROY(text); } [vb addSeparatorWithMinYMargin: 8.0]; { NSImageView *iv; NSTextField *title; GSHbox *hb; hb=[[GSHbox alloc] init]; iv=[[NSImageView alloc] init]; [iv setImage: [NSApp applicationIconImage]]; [iv setEditable: NO]; [iv sizeToFit]; [hb addView: iv enablingXResizing: NO]; DESTROY(iv); title=[NSTextField newLabel: _(@"Quit?")]; [title setAutoresizingMask: NSViewMinYMargin|NSViewMaxYMargin]; [title setFont: [NSFont systemFontOfSize: 18.0]]; [title sizeToFit]; [hb addView: title enablingXResizing: NO withMinXMargin: 8.0]; DESTROY(title); [vb addView: hb enablingYResizing: NO withMinYMargin: 8.0]; DESTROY(hb); } [vb sizeToFit]; quitPanel=[[NSPanel alloc] initWithContentRect: [vb frame] styleMask: NSTitledWindowMask backing: NSBackingStoreRetained defer: YES]; [quitPanel setContentView: vb]; DESTROY(vb); } [quitPanel setTitle: _(@"Quit?")]; [quitPanel setOneShot: YES]; [quitPanel setHidesOnDeactivate: NO]; [quitPanel setExcludedFromWindowsMenu: NO]; [quitPanel setInitialFirstResponder: b_dont]; [b_dont setNextKeyView: b_quit]; [b_quit setNextKeyView: b_dont]; } { /* TODO: always using +mainScreen is probably incorrect */ NSRect r=[[NSScreen mainScreen] frame]; NSPoint o; o.x=r.origin.x+r.size.width/2.0-[quitPanel frame].size.width/2.0; o.y=r.origin.y+r.size.height/2.0-[quitPanel frame].size.height/2.0; [quitPanel setFrameOrigin: o]; } [quitPanel setExcludedFromWindowsMenu: NO]; [quitPanel makeKeyAndOrderFront: self]; quitPanelOpen=YES; return NSTerminateLater; } -(void) quitAnyway: (id)sender { [NSApp replyToApplicationShouldTerminate: YES]; } -(void) dontQuit: (id)sender { [NSApp replyToApplicationShouldTerminate: NO]; quitPanelOpen=NO; [quitPanel orderOut: self]; [quitPanel setExcludedFromWindowsMenu: YES]; } -(void) noMoreActiveWindows: (NSNotification *)n { if (quitPanelOpen) [NSApp replyToApplicationShouldTerminate: YES]; } -(BOOL) application: (NSApplication *)sender openFile: (NSString *)filename { TerminalWindowController *twc; NSDebugLLog(@"Application",@"openFile: '%@'",filename); /* TODO: shouldn't ignore other apps */ [NSApp activateIgnoringOtherApps: YES]; twc=[TerminalWindowController newTerminalWindow]; [[twc frontTerminalView] runProgram: filename withArguments: nil initialInput: nil]; return YES; } -(BOOL) terminalRunProgram: (NSString *)path withArguments: (NSArray *)args inDirectory: (NSString *)directory properties: (NSDictionary *)properties { TerminalWindowController *twc; NSDebugLLog(@"Application", @"terminalRunProgram: %@ withArguments: %@ inDirectory: %@ properties: %@", path,args,directory,properties); /* TODO: shouldn't ignore other apps */ [NSApp activateIgnoringOtherApps: YES]; { id o; o=[properties objectForKey: @"CloseOnExit"]; if (o && [o respondsToSelector: @selector(boolValue)] && ![o boolValue]) { twc=[TerminalWindowController idleTerminalWindow]; } else { twc=[TerminalWindowController newTerminalWindow]; } } [[twc frontTerminalView] runProgram: path withArguments: args inDirectory: directory initialInput: nil arg0: nil]; return YES; } -(BOOL) terminalRunCommand: (NSString *)cmdline inDirectory: (NSString *)directory properties: (NSDictionary *)properties { NSDebugLLog(@"Application", @"terminalRunCommand: %@ inDirectory: %@ properties: %@", cmdline,directory,properties); return [self terminalRunProgram: @"/bin/sh" withArguments: [NSArray arrayWithObjects: @"-c",cmdline,nil] inDirectory: directory properties: properties]; } @end /* TODO */ #include #include @interface NSWindow (avoid_warnings) -(void) sendEvent: (NSEvent *)e; @end @interface TerminalApplication : NSApplication @end @implementation TerminalApplication -(void) sendEvent: (NSEvent *)e { if ([e type]==NSKeyDown && [e modifierFlags]&NSCommandKeyMask && [TerminalViewKeyboardPrefs commandAsMeta]) { NSDebugLLog(@"key",@"intercepting key equivalent"); [[e window] sendEvent: e]; return; } [super sendEvent: e]; } @end int main(int argc, char **argv) { Terminal *term; CREATE_AUTORELEASE_POOL(arp); /* [NSObject enableDoubleReleaseCheck: YES];*/ [TerminalApplication sharedApplication]; term = [[Terminal alloc] init]; [NSApp setDelegate: term]; [NSApp run]; [term release]; DESTROY(arp); return 0; } Terminal-0.9.9/Swedish.lproj004075500017500000144000000000001264654375400152455ustar multixusersTerminal-0.9.9/Swedish.lproj/Localizable.strings010064400017500000144000000177401264654375400211660ustar multixusers/*** Swedish.lproj/Localizable.strings updated by make_strings 2002-12-09 18:39:09 +0100 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:653 */ "Command line:" = "Kommandorad:"; /*** Unmatched/untranslated keys ***/ /* File: TerminalView.m:1611 */ /* Flag: untranslated */ "Unable to open pipe for input: %m." = "Unable to open pipe for input: %m."; /* File: TerminalViewPrefs.m:319 */ /* Flag: untranslated */ "Handle wide (multi-cell) glyphs" = "Hantera breda (fler-celliga) tecken."; /* File: main.m:167 */ /* Flag: unmatched */ "Terminal" = "Terminal"; /*** Strings from PreferencesWindowController.m ***/ /* File: PreferencesWindowController.m:78 */ "Apply and save" = "Verkst\u00e4ll och spara"; /* File: PreferencesWindowController.m:122 */ "Preferences" = "Inst\u00e4llningar"; /* File: PreferencesWindowController.m:70 */ "Revert" = "\u00c5terst\u00e4ll"; /*** Strings from Services.m ***/ /* File: Services.m:152 */ "Service aborted by user." = "Tj\u00e4nsten avbr\u00f6ts av anv\u00e4ndaren."; /* File: Services.m:60 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = "Det finns ingen terminaltj\u00e4nst '%@'.\nDin tj\u00e4nstlista \u00e4r troligen gammal.\nK\u00f6r 'make_services' f\u00f6r att uppdatera den."; /*** Strings from ServicesParameterWindowController.m ***/ /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "Avbryt"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "OK"; /* File: ServicesParameterWindowController.m:118 */ "Parameter for service %@" = "Parameter f\u00e4r tj\u00e4nst %@"; /*** Strings from ServicesPrefs.m ***/ /* File: ServicesPrefs.m:585 */ "Accept types" = "Acceptera typer"; /* File: ServicesPrefs.m:499 */ "Add" = "L\u00e4gg till"; /* File: ServicesPrefs.m:348 */ "Error importing services" = "Fel vid importering av tj\u00e4nster"; /* File: ServicesPrefs.m:401 */ "Export services" = "Exportera tj\u00e4nster"; /* File: ServicesPrefs.m:523 */ "Export..." = "Exportera..."; /* File: ServicesPrefs.m:594 */ "Filenames" = "Filnamn"; /* File: ServicesPrefs.m:549 */ "Ignore output" = "Ignorera utdata"; /* File: ServicesPrefs.m:254 */ "Import services" = "Importera tj\u00e4nster"; /* File: ServicesPrefs.m:515 */ "Import..." = "Importera..."; /* File: ServicesPrefs.m:559 */ "Input in stdin" = "Indata till stdin"; /* File: ServicesPrefs.m:560 */ "Input on command line" = "Indata p\u00e5 kommandoraden"; /* File: ServicesPrefs.m:640 */ "Key:" = "Tangent:"; /* File: ServicesPrefs.m:627 */ "Name:" = "Namn:"; /* File: ServicesPrefs.m:558 */ "No input" = "Ingen indata"; /* File: ServicesPrefs.m:602 */ "Plain text" = "Vanlig text"; /* File: ServicesPrefs.m:507 */ "Remove" = "Ta bort"; /* File: ServicesPrefs.m:550 */ "Return output" = "Returnera utdata"; /* File: ServicesPrefs.m:568 */ "Run in background" = "K\u00f6r i bakgrunden"; /* File: ServicesPrefs.m:570 */ "Run in idle window" = "K\u00f6r i ledigt f\u00f6nster"; /* File: ServicesPrefs.m:569 */ "Run in new window" = "K\u00f6r i nytt f\u00f6nster"; /* File: ServicesPrefs.m:468 */ "Terminal services" = "Terminaltj\u00e4nster"; /* File: ServicesPrefs.m:473 */ "Terminal\nservices" = "Terminal-\ntj\u00e4nster"; /* File: ServicesPrefs.m:349 */ "The file '%@' doesn't contain valid terminal services." = "Filen '%@' inneh\u00e5ller inte giltiga terminaltj\u00e4nster."; /* File: ServicesPrefs.m:235 */ "Unnamed service" = "Icke namngiven tj\u00e4nst"; /*** Strings from TerminalParser_LinuxPrefs.m ***/ /* File: TerminalParser_LinuxPrefs.m:103 */ "'linux' terminal parser" = "'linux' terminal-emulator"; /* File: TerminalParser_LinuxPrefs.m:108 */ "'linux'\nparser" = "'linux'\nemulator"; /* File: TerminalParser_LinuxPrefs.m:151 */ "Character set:" = "Teckenupps\u00e4ttning:"; /* File: TerminalParser_LinuxPrefs.m:43 */ "Chinese" = "Kinesiska"; /* File: TerminalParser_LinuxPrefs.m:44 */ "Custom, leave unchanged" = "Egen, l\u00e4mna of\u00f6r\u00e4ndrad"; /* File: TerminalParser_LinuxPrefs.m:42 */ "East Europe, latin2" = "\u00d6stra europa, latin2"; /* File: TerminalParser_LinuxPrefs.m:40 */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:41 */ "West Europe, latin1" = "V\u00e4stra europa, latin1"; /*** Strings from TerminalView.m ***/ /* File: TerminalView.m:1623 */ "Unable to fork: %m." = "Kunde inte starta ny process: %m."; /* File: TerminalView.m:1476 */ "[Process exited]" = "[Processen avslutade]"; /*** Strings from TerminalViewPrefs.m ***/ /* File: TerminalViewPrefs.m:330 */ "Bold font:" = "Fett typsnitt:"; /* File: TerminalViewPrefs.m:298 */ "Color:" = "F\u00e4rg:"; /* File: TerminalViewPrefs.m:277 */ "Cursor" = "Mark\u00f6r"; /* File: TerminalViewPrefs.m:230 */ /* File: TerminalViewPrefs.m:225 */ "Display" = "Uppritning"; /* File: TerminalViewPrefs.m:291 */ "Filled block" = "Fyllt block"; /* File: TerminalViewPrefs.m:292 */ "Inverted block" = "Inverterat block"; /* File: TerminalViewPrefs.m:607 */ /* File: TerminalViewPrefs.m:602 */ "Keyboard" = "Tangentbord"; /* File: TerminalViewPrefs.m:289 */ "Line" = "Streck"; /* File: TerminalViewPrefs.m:357 */ "Normal font:" = "Normalt typsnitt:"; /* File: TerminalViewPrefs.m:369 */ /* File: TerminalViewPrefs.m:342 */ "Pick font..." = "V\u00e4lj typsnitt..."; /* File: TerminalViewPrefs.m:255 */ "Scroll-back length in lines:" = "Scroll-back l\u00e4ngd i rader:"; /* File: TerminalViewPrefs.m:651 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "Skicka dubbel-escape f\u00f6r escape-tangenten.\n\nDetta inneb\u00e4r att escape tangenten\nkommer att k\u00e4nnas igen snabbare av m\u00e4nga\nprogram, men du kommer inte kunda anv\u00e4nda\nden som ers\u00e4ttning f\u00f6r meta."; /* File: TerminalViewPrefs.m:492 */ /* File: TerminalViewPrefs.m:487 */ "Shell" = "Skal"; /* File: TerminalViewPrefs.m:527 */ "Shell:" = "Skal:"; /* File: TerminalViewPrefs.m:515 */ "Start as login-shell" = "Starta som login-skal"; /* File: TerminalViewPrefs.m:290 */ "Stroked block" = "Ih\u00e5ligt block"; /* File: TerminalViewPrefs.m:282 */ "Style:" = "Stil:"; /* File: TerminalViewPrefs.m:634 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Behandla kommand-tangenten som meta.\n\nObservera att med denna inst\u00e4llningen\nkommer du inte kunna komma \u00e4t menyn\nmed tangentbordet."; /*** Strings from TerminalWindow.m ***/ /* File: TerminalWindow.m:192 */ /* File: TerminalWindow.m:188 */ " (idle)" = " (ledig)"; /*** Strings from TerminalWindowPrefs.m ***/ /* File: TerminalWindowPrefs.m:192 */ "Add top and bottom border" = "L\u00e4gg till undre och \u00f6vre kant"; /* File: TerminalWindowPrefs.m:143 */ "Close new windows when idle" = "St\u00e4ng inaktiva nya f\u00f6nster"; /* File: TerminalWindowPrefs.m:156 */ "Default size" = "Standardstorlek"; /* File: TerminalWindowPrefs.m:144 */ "Don't close new windows" = "St\u00e4ng inte nya f\u00f6nster"; /* File: TerminalWindowPrefs.m:169 */ "Height:" = "H\u00f6jd:"; /* File: TerminalWindowPrefs.m:112 */ "Terminal Window" = "Terminal F\u00f6nster"; /* File: TerminalWindowPrefs.m:117 */ "Terminal\nWindow" = "Terminal\nF\u00f6nster"; /* File: TerminalWindowPrefs.m:160 */ "Width:" = "Bredd:"; /*** Strings from main.m ***/ /* File: main.m:157 */ "Benchmark" = "Benchmark"; /* File: main.m:191 */ "Close" = "St\u00e4ng"; /* File: main.m:180 */ "Copy" = "Kopiera"; /* File: main.m:177 */ "Cut" = "Klipp"; /* File: main.m:186 */ "Edit" = "Redigera"; /* File: main.m:203 */ "Hide" = "G\u00f6m"; /* File: main.m:159 */ "Info" = "Info"; /* File: main.m:153 */ "Info..." = "Info..."; /* File: main.m:171 */ "New terminal" = "Ny terminal"; /* File: main.m:183 */ "Paste" = "Klistra"; /* File: main.m:155 */ "Preferences..." = "Inst\u00e4llningar..."; /* File: main.m:207 */ "Quit" = "Avsluta"; /* File: main.m:199 */ "Services" = "Tj\u00e4nster"; /* File: main.m:194 */ "Windows" = "F\u00f6nster"; Terminal-0.9.9/German.lproj004075500017500000144000000000001264654375400150505ustar multixusersTerminal-0.9.9/German.lproj/Localizable.strings010064400017500000144000000201471264654375400207640ustar multixusers/* German translation by Chris B. Vetter Additions and modifications by Axel Katerbau */ /*** German.lproj/Localizable.strings updated by make_strings 2002-12-09 18:39:09 +0100 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:653 */ "Command line:" = "Befehlszeile:"; /* File: TerminalViewPrefs.m:487 */ /* Flag: untranslated */ /* File: TerminalViewPrefs.m:492 */ /* Flag: untranslated */ "Shell" = "Shell"; /* File: TerminalViewPrefs.m:602 */ /* File: TerminalViewPrefs.m:607 */ "Keyboard" = "Tastatur"; /*** Unmatched/untranslated keys ***/ /* File: TerminalParser_LinuxPrefs.m:40 */ /* Flag: untranslated */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:41 */ "West Europe, latin1" = "Westeurop\u00e4isch, latin-1"; /* File: TerminalParser_LinuxPrefs.m:42 */ "East Europe, latin2" = "Osteurop\u00e4isch, latin-2"; /* File: TerminalParser_LinuxPrefs.m:43 */ "Chinese" = "Chinesisch"; /* File: TerminalParser_LinuxPrefs.m:44 */ "Custom, leave unchanged" = "Benutzerdefiniert, unver\u00e4ndert lassen"; /* File: TerminalParser_LinuxPrefs.m:103 */ "'linux' terminal parser" = "'Linux' Terminal Parser"; /* File: TerminalParser_LinuxPrefs.m:108 */ "'linux'\nparser" = "'Linux'\nParser"; /* File: TerminalParser_LinuxPrefs.m:151 */ "Character set:" = "Zeichensatz:"; /* File: TerminalViewPrefs.m:255 */ "Scroll-back length in lines:" = "Anzahl zur\u00fcckrollbarer Zeilen:"; /* File: TerminalViewPrefs.m:319 */ "Handle wide (multi-cell) glyphs" = "Behandle breite (multi-cell) Glyphen"; /* File: TerminalViewPrefs.m:515 */ "Start as login-shell" = "Als Login-Shell starten"; /* File: TerminalViewPrefs.m:527 */ /* Flag: untranslated */ "Shell:" = "Shell:"; /* File: TerminalViewPrefs.m:634 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Behandle die 'Command'-Taste als 'Meta'-Taste.\n\nWenn dies gew\u00e4hlt ist, dann k\u00f6nnen Men\u00fceintr\u00e4ge nicht mehr per\nTastatur bedient werden."; /* File: TerminalViewPrefs.m:651 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "F\u00fcr jedes 'Escape' ein doppeltes 'Escape' senden.\n\nDas bewirkt, dass 'Escape' von vielen Programmen schneller\nerkannt wird, aber nicht mehr als Ersatz f\u00fcr die\n'Meta'-Taste benutzt werden kann."; /* File: TerminalWindowPrefs.m:112 */ "Terminal Window" = "Terminal-Fenster"; /* File: TerminalWindowPrefs.m:117 */ "Terminal\nWindow" = "Terminal-\nFenster"; /* File: TerminalWindowPrefs.m:143 */ "Close new windows when idle" = "Neue unbenutzte Fenster schlie\u00dfen"; /* File: TerminalWindowPrefs.m:144 */ "Don't close new windows" = "Neue Fenster nicht schlie\u00dfen"; /* File: TerminalWindowPrefs.m:156 */ "Default size" = "Standardgr\u00f6\u00dfe"; /* File: TerminalWindowPrefs.m:160 */ "Width:" = "Breite:"; /* File: TerminalWindowPrefs.m:169 */ "Height:" = "H\u00f6he:"; /* File: TerminalWindowPrefs.m:192 */ "Add top and bottom border" = "F\u00fcge oberen und unteren Rand hinzu"; /* File: main.m:157 */ /* Flag: untranslated */ "Benchmark" = "Benchmark"; /* File: main.m:164 */ "New window" = "Neues Fenster"; /* File: main.m:167 */ /* Flag: unmatched */ "Terminal" = "Terminal"; /* File: main.m:171 */ "New terminal" = "Neues Fenster"; /*** Strings from PreferencesWindowController.m ***/ /* File: PreferencesWindowController.m:78 */ "Apply and save" = "\u00dcbernehmen und Speichern"; /* File: PreferencesWindowController.m:122 */ "Preferences" = "Einstellungen"; /* File: PreferencesWindowController.m:70 */ "Revert" = "Zur\u00fccksetzen"; /*** Strings from Services.m ***/ /* File: Services.m:152 */ "Service aborted by user." = "Dienst vom Benutzer unterbrochen."; /* File: Services.m:60 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = "Es gibt keinen Terminal-Dienst namens '%@.\nDie Dienste sind vermutlich nicht auf neuestem Stand.\nStarte zum Aktualisieren 'make_services'"; /*** Strings from ServicesParameterWindowController.m ***/ /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "Abbrechen"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "OK"; /* File: ServicesParameterWindowController.m:118 */ "Parameter for service %@" = "Parameter f\u00fcr Dienst %@"; /*** Strings from ServicesPrefs.m ***/ /* File: ServicesPrefs.m:585 */ "Accept types" = "Akzeptierte Typen"; /* File: ServicesPrefs.m:499 */ "Add" = "Hinzuf\u00fcgen"; /* File: ServicesPrefs.m:348 */ "Error importing services" = "Fehler beim Importieren von Diensten"; /* File: ServicesPrefs.m:401 */ "Export services" = "Dienste exportieren"; /* File: ServicesPrefs.m:523 */ "Export..." = "Exportieren..."; /* File: ServicesPrefs.m:594 */ "Filenames" = "Dateinamen"; /* File: ServicesPrefs.m:549 */ "Ignore output" = "Ausgabe ignorieren"; /* File: ServicesPrefs.m:254 */ "Import services" = "Dienste importieren"; /* File: ServicesPrefs.m:515 */ "Import..." = "Importieren..."; /* File: ServicesPrefs.m:559 */ "Input in stdin" = "Eingabe in 'stdin'"; /* File: ServicesPrefs.m:560 */ "Input on command line" = "Eingabe in Befehlszeile"; /* File: ServicesPrefs.m:640 */ "Key:" = "Schl\u00fcssel:"; /* File: ServicesPrefs.m:627 */ "Name:" = "Name:"; /* File: ServicesPrefs.m:558 */ "No input" = "Keine Eingabe"; /* File: ServicesPrefs.m:602 */ "Plain text" = "Normaler Text"; /* File: ServicesPrefs.m:507 */ "Remove" = "Entfernen"; /* File: ServicesPrefs.m:550 */ "Return output" = "Ausgabe zur\u00fcckgeben"; /* File: ServicesPrefs.m:568 */ "Run in background" = "Im Hintergrund laufen"; /* File: ServicesPrefs.m:570 */ "Run in idle window" = "In unbenutztem Fenster starten"; /* File: ServicesPrefs.m:569 */ "Run in new window" = "In neuem Fenster starten"; /* File: ServicesPrefs.m:468 */ "Terminal services" = "Terminal-Dienste"; /* File: ServicesPrefs.m:473 */ "Terminal\nservices" = "Terminal-\nDienste"; /* File: ServicesPrefs.m:349 */ "The file '%@' doesn't contain valid terminal services." = "Die Datei '%@' enth\u00e4lt keine g\u00fcltigen Terminal-Dienste."; /* File: ServicesPrefs.m:235 */ "Unnamed service" = "Unbenannter Dienst"; /*** Strings from TerminalView.m ***/ /* File: TerminalView.m:1623 */ "Unable to fork: %m." = "Prozess kann nicht gestartet werden: %m."; /* File: TerminalView.m:1611 */ "Unable to open pipe for input: %m." = "Kann 'Pipe' nicht zur Eingabe benutzen: %m."; /* File: TerminalView.m:1476 */ "[Process exited]" = "[Prozess beendet]"; /*** Strings from TerminalViewPrefs.m ***/ /* File: TerminalViewPrefs.m:330 */ "Bold font:" = "Fettschrift:"; /* File: TerminalViewPrefs.m:298 */ "Color:" = "Farbe:"; /* File: TerminalViewPrefs.m:277 */ "Cursor" = "Cursor"; /* File: TerminalViewPrefs.m:230 */ /* File: TerminalViewPrefs.m:225 */ "Display" = "Darstellung"; /* File: TerminalViewPrefs.m:291 */ "Filled block" = "Gef\u00fcllter Block"; /* File: TerminalViewPrefs.m:292 */ "Inverted block" = "Invertierter Block"; /* File: TerminalViewPrefs.m:289 */ "Line" = "Linie"; /* File: TerminalViewPrefs.m:357 */ "Normal font:" = "Normalschrift:"; /* File: TerminalViewPrefs.m:369 */ /* File: TerminalViewPrefs.m:342 */ "Pick font..." = "Schriftauswahl..."; /* File: TerminalViewPrefs.m:290 */ "Stroked block" = "Hohler Block"; /* File: TerminalViewPrefs.m:282 */ "Style:" = "Stil:"; /*** Strings from TerminalWindow.m ***/ /* File: TerminalWindow.m:192 */ /* File: TerminalWindow.m:188 */ " (idle)" = " (unbenutzt)"; /*** Strings from main.m ***/ /* File: main.m:191 */ "Close" = "Schlie\u00dfen"; /* File: main.m:180 */ "Copy" = "Kopieren"; /* File: main.m:177 */ "Cut" = "Ausschneiden"; /* File: main.m:186 */ "Edit" = "Bearbeiten"; /* File: main.m:203 */ "Hide" = "Ausblenden"; /* File: main.m:159 */ "Info" = "Info"; /* File: main.m:153 */ "Info..." = "\u00dcber..."; /* File: main.m:183 */ "Paste" = "Einf\u00fcgen"; /* File: main.m:155 */ "Preferences..." = "Einstellungen..."; /* File: main.m:207 */ "Quit" = "Beenden"; /* File: main.m:199 */ "Services" = "Dienste"; /* File: main.m:194 */ "Windows" = "Fenster"; Terminal-0.9.9/PreferencesWindowController.h010064400017500000144000000014041264654375400204330ustar multixusers/* Copyright 2002 Alexander Malmberg 2012 Free Software Foundation, Inc Authros: Alexander Malmberg Riccardo Mottola This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import "PrefBox.h" @class GSHbox,NSBox; @interface PreferencesWindowController : NSWindowController { GSHbox *button_box; NSBox *pref_box; NSObject *current; NSMutableArray *pref_boxes; NSMutableArray *pref_buttons; } -(void) addPrefBox: (NSObject *)pb; @end Terminal-0.9.9/cursor_filled.tiff010064400017500000144000000026241264654375400163000ustar multixusersMM*  (Terminal-0.9.9/PreferencesWindowController.m010064400017500000144000000133331264654375400204440ustar multixusers/* Copyright 2002, 2003 Alexander Malmberg Copyright 2009-2012 Free Software Foundation Inc. Authors: Alexander Malmberg Riccardo Mottola This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import #import #import #import #import #import #import #import #import #import #import #import #import "autokeyviewchain.h" #import "PreferencesWindowController.h" #import "PrefBox.h" /* Changing the font in TerminalViewPrefs won't work unless the panel can be the main window (the font panel gets confused about where to send the -changeFont:), hence this class. When per-window preferences are done, this won't be necessary. */ @interface PreferencesPanel : NSPanel @end @implementation PreferencesPanel -(BOOL) canBecomeMainWindow { return YES; } @end @implementation PreferencesWindowController -(void) save: (id)sender { [pref_boxes makeObjectsPerformSelector: @selector(save)]; } -(void) revert: (id)sender { [pref_boxes makeObjectsPerformSelector: @selector(revert)]; } - init { NSWindow *win; win=[[PreferencesPanel alloc] initWithContentRect: NSMakeRect(100,100,290,400) styleMask: NSClosableWindowMask|NSTitledWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask backing: NSBackingStoreRetained defer: YES]; if (!(self=[super initWithWindow: win])) return nil; { GSVbox *vbox; vbox=[[GSVbox alloc] init]; [vbox setBorder: 4]; [vbox setDefaultMinYMargin: 4]; { NSButton *b; GSHbox *hbox; hbox=[[GSHbox alloc] init]; [hbox setDefaultMinXMargin: 4]; [hbox setAutoresizingMask: NSViewMinXMargin]; b=[[NSButton alloc] init]; [b setTitle: _(@"Revert")]; [b setTarget: self]; [b setAction: @selector(revert:)]; [b sizeToFit]; [hbox addView: b]; [b release]; b=[[NSButton alloc] init]; [b setTitle: _(@"Apply and save")]; [b setKeyEquivalent: @"\r"]; [b setTarget: self]; [b setAction: @selector(save:)]; [b sizeToFit]; [hbox addView: b]; [b release]; [vbox addView: hbox enablingYResizing: NO]; [hbox release]; } { pref_box=[[NSBox alloc] initWithFrame: NSMakeRect(0,0,1,1)]; [pref_box setTitle: @""]; [pref_box setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable]; [pref_box setAutoresizesSubviews: YES]; [vbox addView: pref_box enablingYResizing: YES]; } { NSScrollView *sv; NSSize s; button_box=[[GSHbox alloc] init]; s=[NSScrollView frameSizeForContentSize: NSMakeSize(1,68) hasHorizontalScroller: YES hasVerticalScroller: YES borderType: NSNoBorder]; /* TODO? */ sv=[[NSScrollView alloc] initWithFrame: NSMakeRect(0,0,1,s.height)]; [sv setDocumentView: button_box]; [sv setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable]; [sv setHasHorizontalScroller: YES]; [sv setBorderType: NSBezelBorder]; [vbox addView: sv enablingYResizing: NO]; DESTROY(sv); } [win setContentView: vbox]; [vbox release]; } [win setDelegate: self]; [win setTitle: _(@"Preferences")]; [win setMinSize: NSMakeSize(410,430)]; [win setFrameUsingName: @"Preferences"]; [win setFrameAutosaveName: @"Preferences"]; [win autoSetupKeyViewChain]; [win release]; pref_boxes=[[NSMutableArray alloc] init]; pref_buttons=[[NSMutableArray alloc] init]; return self; } -(void) dealloc { if (current) { [current willHide]; current=nil; } DESTROY(pref_boxes); DESTROY(pref_buttons); DESTROY(button_box); [super dealloc]; } -(void) _displayBox: (NSObject *)pb { NSUInteger idx; idx = [pref_boxes indexOfObjectIdenticalTo: pb]; if (idx==NSNotFound) return; if (current==pb) return; if (current) { [[pref_buttons objectAtIndex: [pref_boxes indexOfObjectIdenticalTo: current]] setState: 0]; [current willHide]; current=nil; } [[pref_buttons objectAtIndex: idx] setState: 1]; [pref_box setTitle: [pb name]]; [pref_box setContentView: [pb willShow]]; current=pb; [[self window] autoSetupKeyViewChain]; } -(void) _displayBoxButton: (id)sender { NSUInteger idx; idx = [pref_buttons indexOfObjectIdenticalTo: sender]; if (idx==NSNotFound) return; if ([pref_boxes objectAtIndex: idx]==current) { [sender setState: 1]; return; } [self _displayBox: [pref_boxes objectAtIndex: idx]]; } -(void) addPrefBox: (NSObject *)pb { NSButton *b=[[NSButton alloc] init]; [pref_boxes addObject: pb]; [pref_buttons addObject: b]; [pb setupButton: b]; if ([b frame].size.height<=64) [b setFrame: NSMakeRect(0,0,[b frame].size.width,64)]; [b setTarget: self]; [b setAction: @selector(_displayBoxButton:)]; [b setButtonType: NSPushOnPushOffButton]; [button_box addView: b]; [b release]; [button_box sizeToFit]; if (!current) [self _displayBox: pb]; else [[self window] autoSetupKeyViewChain]; } /* well, it works */ -(BOOL) respondsToSelector: (SEL)s { if ([super respondsToSelector: s]) return YES; if (current) return [current respondsToSelector: s]; return NO; } -(void) forwardInvocation: (NSInvocation *)i { if (current) if ([current respondsToSelector: [i selector]]) { [i invokeWithTarget: current]; return; } [super forwardInvocation: i]; } -(NSMethodSignature *) methodSignatureForSelector: (SEL)sel { return [super methodSignatureForSelector: sel]; } @end Terminal-0.9.9/TerminalWindow.h010064400017500000144000000025221272657673600157100ustar multixusers/* Copyright 2002, 2003 Alexander Malmberg 2016 Riccardo Mottola 2016 Tim Sheridan This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef TerminalWindow_h #define TerminalWindow_h @class TerminalView; #import #import NSString *TerminalWindowNoMoreActiveWindowsNotification; @interface TerminalWindowController : NSWindowController { NSMutableArray *terminal_views; NSTabView *tab_view; BOOL isShowingTabs; BOOL close_on_idle; } +(TerminalWindowController *) newTerminalWindow; +(TerminalWindowController *) idleTerminalWindow; +(int) numberOfActiveWindows; +(void) checkActiveWindows; - init; -(TerminalView *) frontTerminalView; -(void) setShouldCloseWhenIdle: (BOOL)should_close; -(BOOL) showTabBar; -(void) setShowTabBar:(BOOL)visible inWindow:(NSWindow *)window; -(void) newTerminalTabInWindow:(NSWindow *)window; -(void) closeTerminalTab:(TerminalView *)tv inWindow:(NSWindow *)window; -(void) showPreviousTab; -(void) showNextTab; -(void) moveTabLeft; -(void) moveTabRight; @end #endif Terminal-0.9.9/TerminalWindowPrefs.h010064400017500000144000000013521264654375400167030ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef TerminalWindowPrefs_h #define TerminalWindowPrefs_h #include "PrefBox.h" @class GSVbox,NSTextField,NSButton,NSMatrix; @interface TerminalWindowPrefs : NSObject { GSVbox *top; NSMatrix *m_close; NSTextField *tf_width,*tf_height; NSButton *b_addYBorders; } +(int) windowCloseBehavior; +(int) defaultWindowWidth; +(int) defaultWindowHeight; +(BOOL) addYBorders; @end #endif Terminal-0.9.9/Italian.lproj004075500017500000144000000000001272660512500152065ustar multixusersTerminal-0.9.9/Italian.lproj/Localizable.strings010064400017500000144000000220111272660512500211120ustar multixusers/*** Italian.lproj/Localizable.strings updated by make_strings 2010-01-15 20:49:22 +0100 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:654 */ "Command line:" = "Linea di Comando:"; /* File: TerminalView.m:1130 */ /* File: TerminalView.m:1857 */ "Unexpected error while writing: %m." = "Errore inatteso scrivendo: %m."; /* File: main.m:324 */ /* Flag: untranslated */ /* File: main.m:345 */ "Quit?" = "Uscire?"; /*** Unmatched/untranslated keys ***/ /* File: ServicesParameterWindowController.m:118 */ /* Flag: untranslated */ "Parameter for service %@" = "Parametro per il servizio %@"; /* File: TerminalView.m:1992 */ /* Flag: untranslated */ "Unable to set non-blocking mode: %m." = "Impossibile impostare modalit\U00E0 non bloccante: %m."; /* File: TerminalViewPrefs.m:289 */ /* Flag: unmatched */ "Line" = "Linea"; /* File: TerminalViewPrefs.m:290 */ /* Flag: unmatched */ "Stroked block" = "Blocco contornato"; /* File: TerminalViewPrefs.m:291 */ /* Flag: unmatched */ "Filled block" = "Blocco solido"; /* File: TerminalViewPrefs.m:292 */ /* Flag: unmatched */ "Inverted block" = "Blocco invertito"; /* File: TerminalViewPrefs.m:397 */ /* Flag: untranslated */ "Display black on white text" = "Mostra testo bianco su nero"; /* File: main.m:189 */ /* Flag: untranslated */ "Miniaturize all" = "Contrai tutte"; /* File: main.m:275 */ /* Flag: untranslated */ "Quit anyway" = "Esci comunque"; /* File: main.m:283 */ /* Flag: untranslated */ "Don't quit" = "Non uscire."; /* File: main.m:300 */ /* Flag: untranslated */ "There are active windows. Quitting will close them." = "Ci sono finestre attive, verranno chiuse in uscita."; /*** Strings from PreferencesWindowController.m ***/ /* File: PreferencesWindowController.m:95 */ "Apply and save" = "Applica e salva"; /* File: PreferencesWindowController.m:140 */ "Preferences" = "Preferenze"; /* File: PreferencesWindowController.m:87 */ "Revert" = "Ripristina"; /*** Strings from Services.m ***/ /* File: Services.m:151 */ "Service aborted by user." = "Servizio interrotto dall'utente."; /* File: Services.m:59 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = "Servizio '%@' non esistente.\nL'elenco dei servizi \U00E8 probabilmente non aggiornato.\nLanciare il comando 'make_services' per aggiornarlo."; /*** Strings from ServicesParameterWindowController.m ***/ /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "Annulla"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "OK"; /*** Strings from ServicesPrefs.m ***/ /* File: ServicesPrefs.m:586 */ "Accept types" = "Tipi accettati"; /* File: ServicesPrefs.m:500 */ "Add" = "Aggiungi"; /* File: ServicesPrefs.m:348 */ "Error importing services" = "Errore di importazione dei servizi"; /* File: ServicesPrefs.m:401 */ "Export services" = "Esporta servizi"; /* File: ServicesPrefs.m:524 */ "Export..." = "Esporta..."; /* File: ServicesPrefs.m:595 */ "Filenames" = "Archivi:"; /* File: ServicesPrefs.m:550 */ "Ignore output" = "Ignora output"; /* File: ServicesPrefs.m:254 */ "Import services" = "Importa servizi"; /* File: ServicesPrefs.m:516 */ "Import..." = "Importa..."; /* File: ServicesPrefs.m:560 */ "Input in stdin" = "Input nello stdin"; /* File: ServicesPrefs.m:561 */ "Input on command line" = "Input dalla linea di comando"; /* File: ServicesPrefs.m:641 */ "Key:" = "Chiave:"; /* File: ServicesPrefs.m:628 */ "Name:" = "Nome:"; /* File: ServicesPrefs.m:559 */ "No input" = "Nessun input"; /* File: ServicesPrefs.m:603 */ "Plain text" = "Testo semplice"; /* File: ServicesPrefs.m:508 */ "Remove" = "Rimuovi"; /* File: ServicesPrefs.m:551 */ "Return output" = "Output di ritorno"; /* File: ServicesPrefs.m:569 */ "Run in background" = "Esegui in background"; /* File: ServicesPrefs.m:571 */ "Run in idle window" = "Esegui nella finestra inattiva"; /* File: ServicesPrefs.m:570 */ "Run in new window" = "Esegui in una nuova finestra"; /* File: ServicesPrefs.m:469 */ "Terminal services" = "Servizi di terminale"; /* File: ServicesPrefs.m:474 */ "Terminal\nservices" = "Servizi\ndi terminale"; /* File: ServicesPrefs.m:349 */ "The file '%@' doesn't contain valid terminal services." = "Il file '%@' non contiene servizi di terminale validi."; /* File: ServicesPrefs.m:235 */ "Unnamed service" = "Servizio senza nome"; /*** Strings from TerminalParser_LinuxPrefs.m ***/ /* File: TerminalParser_LinuxPrefs.m:104 */ "'linux' terminal parser" = "Interprete di terminale 'linux'"; /* File: TerminalParser_LinuxPrefs.m:109 */ "'linux'\nparser" = "Interprete\n'linux'"; /* File: TerminalParser_LinuxPrefs.m:152 */ "Character set:" = "Codifica caratteri:"; /* File: TerminalParser_LinuxPrefs.m:44 */ "Chinese" = "Cinese"; /* File: TerminalParser_LinuxPrefs.m:45 */ "Custom, leave unchanged" = "Personalizzata, non modificata"; /* File: TerminalParser_LinuxPrefs.m:43 */ "East Europe, latin2" = "Est Europa, latin2"; /* File: TerminalParser_LinuxPrefs.m:41 */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:42 */ "West Europe, latin1" = "Ovest Europa , latin1"; /*** Strings from TerminalView.m ***/ /* File: TerminalView.m:1965 */ "Unable to fork: %m." = "Fork non riuscita: %m."; /* File: TerminalView.m:1953 */ "Unable to open pipe for input: %m." = "Pipe non disponibile per input: %m."; /* File: TerminalView.m:1765 */ "[Process exited]" = "[Processo terminato]"; /*** Strings from TerminalViewPrefs.m ***/ /* File: TerminalViewPrefs.m:408 */ "Bold font:" = "Grassetto :"; /* File: TerminalViewPrefs.m:367 */ "Color:" = "Colore:"; /* File: TerminalViewPrefs.m:322 */ "Cursor" = "Cursore"; /* File: TerminalViewPrefs.m:273 */ /* File: TerminalViewPrefs.m:268 */ "Display" = "Display"; /* File: TerminalViewPrefs.m:390 */ "Handle wide (multi-cell) glyphs" = "Gestisci glifi estesi (cella multipla)"; /* File: TerminalViewPrefs.m:690 */ /* File: TerminalViewPrefs.m:685 */ "Keyboard" = "Tastiera"; /* File: TerminalViewPrefs.m:435 */ "Normal font:" = "Carattere normale:"; /* File: TerminalViewPrefs.m:447 */ /* File: TerminalViewPrefs.m:420 */ "Pick font..." = "Scegli carattere..."; /* File: TerminalViewPrefs.m:299 */ "Scroll-back length in lines:" = "Lunghezza scorrimento in linee:"; /* File: TerminalViewPrefs.m:730 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "Invia un doppio escape per il tasto escape.\n\nSignifica che il carattere di escape sar\U00E0\nriconosciuto piu velocemente da molti programmi, ma\nnon si pu\U00F2 usare come sostituto di meta."; /* File: TerminalViewPrefs.m:577 */ /* File: TerminalViewPrefs.m:572 */ "Shell" = "Shell"; /* File: TerminalViewPrefs.m:610 */ "Shell:" = "Shell:"; /* File: TerminalViewPrefs.m:598 */ "Start as login-shell" = "Inizio come shell di login"; /* File: TerminalViewPrefs.m:327 */ "Style:" = "Stile:"; /* File: TerminalViewPrefs.m:715 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Tratta il tasto comando come meta.\n\nNota che con questo abilitato,\nnon potrai accedere ai menu con la\ntastiera."; /*** Strings from TerminalWindow.m ***/ /* File: TerminalWindow.m:203 */ /* File: TerminalWindow.m:199 */ " (idle)" = " (inattivo)"; /*** Strings from TerminalWindowPrefs.m ***/ /* File: TerminalWindowPrefs.m:212 */ "Add top and bottom border" = "Aggiungi bordo in alto e in basso"; /* File: TerminalWindowPrefs.m:152 */ "Close new windows when idle" = "Chiudi le nuove finestre quando inattive"; /* File: TerminalWindowPrefs.m:176 */ "Default size" = "Dimensione di default"; /* File: TerminalWindowPrefs.m:153 */ "Don't close new windows" = "Non chiudere le nuove finestre"; /* File: TerminalWindowPrefs.m:189 */ "Height:" = "Altezza:"; /* File: TerminalWindowPrefs.m:114 */ "Terminal Window" = "Finestra Terminale"; /* File: TerminalWindowPrefs.m:119 */ "Terminal\nWindow" = "Finestra\nTerminale"; /* File: TerminalWindowPrefs.m:180 */ "Width:" = "Larghezza:"; /*** Strings from main.m ***/ /* File: main.m:152 */ "Benchmark" = "Benchmark"; /* File: main.m:186 */ "Close" = "Chiudi"; /* File: main.m:175 */ "Copy" = "Copia"; /* File: main.m:172 */ "Cut" = "Taglia"; /* File: main.m:181 */ "Edit" = "Modifica"; "View"="Vista"; /* File: main.m:201 */ "Hide" = "Nascondi"; /* File: main.m:154 */ "Info" = "Informazioni"; /* File: main.m:148 */ "Info..." = "Informazioni..."; /* File: main.m:166 */ "New window" = "Nuova finestra"; "New tab" = "Nuova linguetta"; /* File: main.m:178 */ "Paste" = "Incolla"; /* File: main.m:150 */ "Preferences..." = "Preferenze..."; /* File: main.m:205 */ "Quit" = "Esci"; /* File: main.m:197 */ "Services" = "Servizi"; /* File: main.m:192 */ "Windows" = "Finestre"; "Show tab bar"="Mostra barra linguette"; "Close window"="Chiudi finestra"; "Close tab"="Chiudi linguetta"; "Show previous tab"="Mostra linguetta precedente"; "Show next tab"="Mostra prossima linguetta"; "Move tab left"="Sposta linguetta a sinistra"; "Move tab right"="Sposta linguetta a destra";Terminal-0.9.9/TerminalView.h010064400017500000144000000050171272134664300153400ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef TerminalView_h #define TerminalView_h #import extern NSString *TerminalViewBecameIdleNotification, *TerminalViewBecameNonIdleNotification, *TerminalViewTitleDidChangeNotification; #include "Terminal.h" /* TODO: this is slightly ugly */ @class TerminalParser_Linux; @class NSScroller; struct selection_range { int location,length; }; @interface TerminalView : NSView { NSScroller *scroller; NSFont *font,*boldFont; int font_encoding,boldFont_encoding; CGFloat fx,fy,fx0,fy0; BOOL use_multi_cell_glyphs; BOOL blackOnWhite; struct { int x0,y0,x1,y1; } dirty; int master_fd; unsigned char *write_buf; int write_buf_len,write_buf_size; int max_scrollback; int sb_length,current_scroll; screen_char_t *sbuf; int sx,sy; screen_char_t *screen; int cursor_x,cursor_y; int current_x,current_y; NSString *title_window,*title_miniwindow,*title_filename; NSObject *tp; int draw_all; /* 0=only lazy, 1=don't know, do all, 2=do all */ BOOL draw_cursor; struct selection_range selection; /* scrolling by compositing takes a long while, so we break out of such loops fairly often to process other events */ int num_scrolls; /* To avoid doing lots of scrolling compositing, we combine multiple full-screen scrolls. pending_scroll is the combined pending line delta */ int pending_scroll; BOOL ignore_resize; CGFloat border_x,border_y; } -(void) setIgnoreResize: (BOOL)ignore; -(void) setBorder: (CGFloat)x : (CGFloat)y; -(NSString *) windowTitle; -(NSString *) miniwindowTitle; -(NSString *) representedFilename; +(NSSize) characterCellSize; +(void) registerPasteboardTypes; @end @interface TerminalView (display) -(void) setNeedsLazyDisplayInRect: (NSRect)r; @end /* TODO: this is ugly */ @interface TerminalView (scrolling_2) -(void) setScroller: (NSScroller *)sc; @end @interface TerminalView (input_2) -(void) closeProgram; -(void) runShell; -(void) runProgram: (NSString *)path withArguments: (NSArray *)args initialInput: (NSString *)d; -(void) runProgram: (NSString *)path withArguments: (NSArray *)args inDirectory: (NSString *)directory initialInput: (NSString *)d arg0: (NSString *)arg0; @end #endif Terminal-0.9.9/TerminalWindowPrefs.m010064400017500000144000000117571264654375400167220ustar multixusers/* copyright 2002, 2003 Alexander Malmberg 2009-2010 GAP Project This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import #import #import #import #import #import #import #import #import "Label.h" #include "TerminalWindowPrefs.h" static NSUserDefaults *ud; static NSString *WindowCloseBehaviorKey=@"WindowCloseBehavior", *WindowHeightKey=@"WindowHeight", *WindowWidthKey=@"WindowWidth", *AddYBordersKey=@"AddYBorders"; static int windowCloseBehavior; static int windowWidth,windowHeight; static BOOL addYBorders; @implementation TerminalWindowPrefs +(void) initialize { if (!ud) { ud=[NSUserDefaults standardUserDefaults]; windowCloseBehavior=[ud integerForKey: WindowCloseBehaviorKey]; windowWidth=[ud integerForKey: WindowWidthKey]; windowHeight=[ud integerForKey: WindowHeightKey]; addYBorders=[ud boolForKey: AddYBordersKey]; if (windowWidth<=0) windowWidth=80; if (windowHeight<=0) windowHeight=25; } } +(int) windowCloseBehavior { return windowCloseBehavior; } +(int) defaultWindowWidth { return windowWidth; } +(int) defaultWindowHeight { return windowHeight; } +(BOOL) addYBorders { return addYBorders; } -(void) save { if (!top) return; windowCloseBehavior=[[m_close selectedCell] tag]; [ud setInteger: windowCloseBehavior forKey: WindowCloseBehaviorKey]; addYBorders=[b_addYBorders state]; [ud setBool: addYBorders forKey: AddYBordersKey]; windowWidth=[tf_width intValue]; windowHeight=[tf_height intValue]; if (windowWidth<=0) windowWidth=80; if (windowHeight<=0) windowHeight=25; [ud setInteger: windowWidth forKey: WindowWidthKey]; [ud setInteger: windowHeight forKey: WindowHeightKey]; } -(void) revert { [m_close selectCellWithTag: windowCloseBehavior]; [tf_width setIntValue: windowWidth]; [tf_height setIntValue: windowHeight]; [b_addYBorders setState: addYBorders]; } -(NSString *) name { return _(@"Terminal Window"); } -(void) setupButton: (NSButton *)b { [b setTitle: _(@"Terminal\nWindow")]; [b sizeToFit]; } -(void) willHide { } -(NSView *) willShow { if (!top) { top=[[GSVbox alloc] init]; [top setDefaultMinYMargin: 1]; { NSTextField *f; { NSMatrix *m; NSButtonCell *b=[NSButtonCell new]; NSSize s,s2; [b setButtonType: NSRadioButton]; m=m_close=[[NSMatrix alloc] initWithFrame: NSMakeRect(0,0,1,1) mode: NSRadioModeMatrix prototype: b numberOfRows: 2 numberOfColumns: 1]; [m setAutoresizingMask: NSViewMinXMargin|NSViewMaxXMargin| NSViewMinYMargin|NSViewMaxYMargin]; [[m cellAtRow: 0 column: 0] setTitle: _(@"Close new windows when idle")]; [[m cellAtRow: 1 column: 0] setTitle: _(@"Don't close new windows")]; [[m cellAtRow: 0 column: 0] setTag: 0]; [[m cellAtRow: 1 column: 0] setTag: 1]; s=[[m cellAtRow: 0 column: 0] cellSize]; s2=[[m cellAtRow: 0 column: 0] cellSize]; if (s2.width>s.width) s.width=s2.width; [m setCellSize: s]; [m setIntercellSpacing: NSMakeSize(0,3)]; [m sizeToCells]; [top addView: m enablingYResizing: YES]; DESTROY(m); } { NSBox *b; GSTable *t; b=[[NSBox alloc] init]; [b setAutoresizingMask: NSViewWidthSizable|NSViewMinYMargin|NSViewMaxYMargin]; [b setTitle: _(@"Default size")]; t=[[GSTable alloc] initWithNumberOfRows: 2 numberOfColumns: 2]; f=[NSTextField newLabel: _(@"Width:")]; [f setAutoresizingMask: NSViewMinXMargin|NSViewMinYMargin|NSViewMaxYMargin]; [t putView: f atRow: 1 column: 0 withXMargins: 2 yMargins: 2]; tf_width=f=[[NSTextField alloc] init]; [f setAutoresizingMask: NSViewWidthSizable]; [f sizeToFit]; [t putView: f atRow: 1 column: 1]; [f release]; f=[NSTextField newLabel: _(@"Height:")]; [f setAutoresizingMask: NSViewMinXMargin|NSViewMinYMargin|NSViewMaxYMargin]; [t putView: f atRow: 0 column: 0 withXMargins: 2 yMargins: 2]; tf_height=f=[[NSTextField alloc] init]; [f setAutoresizingMask: NSViewWidthSizable]; [f sizeToFit]; [t putView: f atRow: 0 column: 1]; [f release]; [b setContentView: t]; [b sizeToFit]; DESTROY(t); [top addView: b enablingYResizing: YES]; DESTROY(b); } { NSButton *b; b=b_addYBorders=[[NSButton alloc] init]; [b setAutoresizingMask: NSViewMinXMargin|NSViewMaxXMargin|NSViewMinYMargin|NSViewMaxYMargin]; [b setButtonType: NSSwitchButton]; [b setTitle: _(@"Add top and bottom border")]; [b sizeToFit]; [top addView: b enablingYResizing: YES]; } } [self revert]; } return top; } -(void) dealloc { DESTROY(top); [super dealloc]; } @end Terminal-0.9.9/TerminalWindow.m010064400017500000144000000351451272657673700157250ustar multixusers/* Copyright 2002, 2003 Alexander Malmberg 2016 Riccardo Mottola 2016 Tim Sheridan This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #include #include #import #import #import #import #import #import #import #import #import #import #import "TerminalWindow.h" #import "TerminalWindowPrefs.h" #import "TerminalView.h" /* TODO: this needs cleaning up. chances are this will interfere with NSTask */ static void get_zombies(void) { int status,pid; while ((pid=waitpid(-1,&status,WNOHANG))>0) { // printf("got %i\n",pid); } } static int num_instances; NSString *TerminalWindowNoMoreActiveWindowsNotification= @"TerminalWindowNoMoreActiveWindowsNotification"; @implementation TerminalWindowController - init { if ((self = [super init])) { NSWindow *win; NSScroller *scroller; GSHbox *hb; CGFloat fx,fy; CGFloat scroller_width; NSRect contentRect,windowRect; NSSize contentSize,minSize; NSTabViewItem *tab_item; TerminalView *tv; int sx,sy; isShowingTabs = NO; if ([self showTabBar]) isShowingTabs = YES; { NSSize size=[TerminalView characterCellSize]; fx=size.width; fy=size.height; } sx=[TerminalWindowPrefs defaultWindowWidth]; sy=[TerminalWindowPrefs defaultWindowHeight]; scroller_width=[NSScroller scrollerWidth]; // calc the rects for our window contentSize = NSMakeSize (fx * sx + scroller_width + 1, fy * sy + 1); minSize = NSMakeSize (fx * 20 + scroller_width + 1, fy * 4 + 1); // add the borders to the size contentSize.width += 8; minSize.width += 8; if ([TerminalWindowPrefs addYBorders]) { contentSize.height += 8; minSize.height += 8; } contentRect = NSMakeRect (100, 100, contentSize.width, contentSize.height); win=[[NSWindow alloc] initWithContentRect: contentRect styleMask: NSClosableWindowMask|NSTitledWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask backing: NSBackingStoreRetained defer: YES]; if (!(self=[super initWithWindow: win])) return nil; num_instances++; windowRect = [win frame]; minSize.width += windowRect.size.width - contentSize.width; minSize.height += windowRect.size.height - contentSize.height; [win setTitle: @"Terminal"]; [win setDelegate: self]; [win setContentSize: contentSize]; [win setResizeIncrements: NSMakeSize (fx , fy)]; [win setMinSize: minSize]; hb=[[GSHbox alloc] init]; scroller=[[NSScroller alloc] initWithFrame: NSMakeRect(0,0,[NSScroller scrollerWidth],fy)]; [scroller setArrowsPosition: NSScrollerArrowsMaxEnd]; [scroller setEnabled: YES]; [scroller setAutoresizingMask: NSViewHeightSizable]; [hb addView: scroller enablingXResizing: NO]; [scroller release]; tab_view = [[NSTabView alloc] init]; [tab_view setDelegate:self]; tab_item = [[NSTabViewItem alloc] init]; [tab_item setLabel:@"Terminal"]; if (isShowingTabs) [tab_item setView:hb]; [tab_view addTabViewItem:tab_item]; [tab_item release]; tv = [[TerminalView alloc] init]; [tv setIgnoreResize: YES]; [tv setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; [tv setScroller: scroller]; [hb addView: tv]; [tv release]; [win makeFirstResponder: tv]; [tv setIgnoreResize: NO]; terminal_views = [[NSMutableArray alloc] init]; [terminal_views addObject:tv]; if ([TerminalWindowPrefs addYBorders]) [tv setBorder: 4 : 4]; else [tv setBorder: 4 : 0]; if (isShowingTabs) { [win setContentView: tab_view]; } else { [win setContentView: hb]; } DESTROY(hb); [win release]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_becameIdle:) name: TerminalViewBecameIdleNotification object: tv]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_becameNonIdle:) name: TerminalViewBecameNonIdleNotification object: tv]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_updateTitle:) name: TerminalViewTitleDidChangeNotification object: tv]; } return self; } -(void) _updateTitleFromTerminalView: (TerminalView *)tv { NSUInteger index; index = [terminal_views indexOfObjectIdenticalTo:tv]; if (index == NSNotFound) { NSLog(@"updateTitle view not found: %@ %@", [tv windowTitle], [tv representedFilename]); NSLog(@"view is: %@, views are: %@", tv, terminal_views); return; } [[tab_view tabViewItemAtIndex:index] setLabel:[tv windowTitle]]; [tab_view display]; if (tv == [self frontTerminalView]) { [[self window] setTitle: [tv windowTitle]]; [[self window] setMiniwindowTitle: [tv miniwindowTitle]]; [[self window] setRepresentedFilename: [tv representedFilename]]; } } -(void) _updateTitle: (NSNotification *)n { TerminalView *tv = [n object]; [self _updateTitleFromTerminalView:tv]; } -(void) dealloc { num_instances--; [TerminalWindowController checkActiveWindows]; [[NSNotificationCenter defaultCenter] removeObserver: self]; [terminal_views release]; [super dealloc]; } static NSMutableArray *idle_list; -(void) windowWillClose: (NSNotification *)n { get_zombies(); [idle_list removeObject: self]; [self autorelease]; } -(void) _becameIdle: (NSNotification *)n { NSDebugLLog(@"idle",@"%@ _becameIdle",self); if (close_on_idle) { TerminalView *tv = [n object]; [self closeTerminalTab:tv inWindow:[self window]]; return; } [idle_list addObject: self]; NSDebugLLog(@"idle",@"idle list: %@",idle_list); { NSString *t; t=[[self window] title]; t=[t stringByAppendingString: _(@" (idle)")]; [[self window] setTitle: t]; t=[[self window] miniwindowTitle]; t=[t stringByAppendingString: _(@" (idle)")]; [[self window] setMiniwindowTitle: t]; } [TerminalWindowController checkActiveWindows]; } -(void) _becameNonIdle: (NSNotification *)n { NSDebugLLog(@"idle",@"%@ _becameNonIdle",self); [idle_list removeObject: self]; NSDebugLLog(@"idle",@"idle list: %@",idle_list); } -(TerminalView *) frontTerminalView { NSTabViewItem *item = [tab_view selectedTabViewItem]; NSInteger index = [tab_view indexOfTabViewItem:item]; return [terminal_views objectAtIndex:index]; } -(void) setShouldCloseWhenIdle: (BOOL)should { close_on_idle=should; } +(void) initialize { if (!idle_list) idle_list=[[NSMutableArray alloc] init]; } +(TerminalWindowController *) newTerminalWindow { TerminalWindowController *twc; twc=[[self alloc] init]; if ([TerminalWindowPrefs windowCloseBehavior]==0) [twc setShouldCloseWhenIdle: YES]; [twc showWindow: self]; return twc; } +(TerminalWindowController *) idleTerminalWindow { TerminalWindowController *new; NSDebugLLog(@"idle",@"get idle window from idle list: %@",idle_list); if ([idle_list count]) return [idle_list objectAtIndex: 0]; new=[[self alloc] init]; [new showWindow: self]; return new; } +(int) numberOfActiveWindows { return num_instances-[idle_list count]; } +(void) checkActiveWindows { if (![self numberOfActiveWindows]) { [[NSNotificationCenter defaultCenter] postNotificationName: TerminalWindowNoMoreActiveWindowsNotification object: self]; } } -(BOOL) showTabBar { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; return [defaults boolForKey:@"ShowTabBar"]; } -(void) setShowTabBar:(BOOL)visible inWindow:(NSWindow *)window { // TODO more explicit default value NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setBool:visible forKey:@"ShowTabBar"]; [defaults synchronize]; if ([tab_view numberOfTabViewItems] == 1) { if (visible) { NSView *view; view = [window contentView]; [view retain]; [window setContentView:tab_view]; [[tab_view tabViewItemAtIndex:0] setView:view]; [tab_view selectFirstTabViewItem:nil]; [tab_view display]; [view release]; isShowingTabs = YES; } else { NSView *view = [[tab_view selectedTabViewItem] view]; [window setContentView:view]; isShowingTabs = NO; } } } -(void) newTerminalTabInWindow:(NSWindow *)window { NSTabViewItem *tab_item; TerminalView *tv; NSScroller *scroller; GSHbox *hb; CGFloat fy; if (!isShowingTabs) { NSView *view; view = [window contentView]; [view retain]; [window setContentView:tab_view]; [[tab_view tabViewItemAtIndex:0] setView:view]; [view release]; isShowingTabs = YES; } { NSSize size=[TerminalView characterCellSize]; fy=size.height; } tab_item = [[NSTabViewItem alloc] init]; [tab_item setLabel:@"Terminal"]; [tab_view addTabViewItem:tab_item]; [tab_item release]; hb=[[GSHbox alloc] init]; scroller=[[NSScroller alloc] initWithFrame: NSMakeRect(0,0,[NSScroller scrollerWidth],fy)]; [scroller setArrowsPosition: NSScrollerArrowsMaxEnd]; [scroller setEnabled: YES]; [scroller setAutoresizingMask: NSViewHeightSizable]; [hb addView: scroller enablingXResizing: NO]; [scroller release]; tv = [[TerminalView alloc] init]; [tv setIgnoreResize: YES]; [tv setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; [tv setScroller: scroller]; [hb addView: tv]; [tv release]; [tv setIgnoreResize: NO]; [terminal_views addObject:tv]; if ([TerminalWindowPrefs addYBorders]) [tv setBorder: 4 : 4]; else [tv setBorder: 4 : 0]; [tab_item setView:hb]; DESTROY(hb); [tab_view selectLastTabViewItem:nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_becameIdle:) name: TerminalViewBecameIdleNotification object: tv]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_becameNonIdle:) name: TerminalViewBecameNonIdleNotification object: tv]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_updateTitle:) name: TerminalViewTitleDidChangeNotification object: tv]; } -(void) closeTerminalTab:(TerminalView *)tv inWindow:(NSWindow *)window { NSTabViewItem *item; NSInteger index; NSInteger first_tab_index; NSInteger last_tab_index; if ([tab_view numberOfTabViewItems] == 1) { [window performClose:nil]; return; } item = [tab_view selectedTabViewItem]; index = [tab_view indexOfTabViewItem:item]; // Select new tab before removing old one first_tab_index = 0; last_tab_index = [tab_view numberOfTabViewItems] - 1; // TODO A better tab selection heuristic (e.g. most recently used) if (index == first_tab_index) { [tab_view selectNextTabViewItem:nil]; } else if (index == last_tab_index) { [tab_view selectPreviousTabViewItem:nil]; } else { [tab_view selectNextTabViewItem:nil]; } [tab_view removeTabViewItem:item]; [terminal_views removeObjectAtIndex:index]; if ([tab_view numberOfTabViewItems] == 1) { NSView *view; view = [[tab_view tabViewItemAtIndex:0] view]; [view retain]; [window setContentView: view]; [view release]; [window makeFirstResponder:[terminal_views objectAtIndex:0]]; // Follow tab bar visible setting [self setShowTabBar:[self showTabBar] inWindow:window]; } [tab_view display]; } -(void) showPreviousTab { // Clamp NSInteger first_tab_index = 0; NSTabViewItem *item = [tab_view selectedTabViewItem]; NSInteger index = [tab_view indexOfTabViewItem:item]; if (index == first_tab_index) { return; } [tab_view selectPreviousTabViewItem:nil]; } -(void) showNextTab { // Clamp NSInteger last_tab_index = [tab_view numberOfTabViewItems] - 1; NSTabViewItem *item = [tab_view selectedTabViewItem]; NSInteger index = [tab_view indexOfTabViewItem:item]; if (index == last_tab_index) { return; } [tab_view selectNextTabViewItem:nil]; } -(void) moveTabLeft { NSTabViewItem *old_item; // Clamp NSInteger first_tab_index = 0; NSTabViewItem *item = [tab_view selectedTabViewItem]; NSInteger index = [tab_view indexOfTabViewItem:item]; if (index == first_tab_index) { return; } NSInteger destination_index = index - 1; TerminalView *old_tv = [terminal_views objectAtIndex:destination_index]; TerminalView *new_tv = [terminal_views objectAtIndex:index]; [terminal_views replaceObjectAtIndex:destination_index withObject:new_tv]; [terminal_views replaceObjectAtIndex:index withObject:old_tv]; old_item = [tab_view tabViewItemAtIndex:destination_index]; [old_item retain]; [tab_view removeTabViewItem:old_item]; [tab_view insertTabViewItem:old_item atIndex:index]; [old_item release]; [self _updateTitleFromTerminalView:old_tv]; [self _updateTitleFromTerminalView:new_tv]; [tab_view selectTabViewItemAtIndex:destination_index]; [tab_view display]; } -(void) moveTabRight { NSTabViewItem *old_item; NSInteger destination_index; TerminalView *old_tv; TerminalView *new_tv; // Clamp NSInteger last_tab_index = [tab_view numberOfTabViewItems] - 1; NSTabViewItem *item = [tab_view selectedTabViewItem]; NSInteger index = [tab_view indexOfTabViewItem:item]; if (index == last_tab_index) { return; } destination_index = index + 1; old_tv = [terminal_views objectAtIndex:destination_index]; new_tv = [terminal_views objectAtIndex:index]; [terminal_views replaceObjectAtIndex:destination_index withObject:new_tv]; [terminal_views replaceObjectAtIndex:index withObject:old_tv]; old_item = [tab_view tabViewItemAtIndex:destination_index]; [old_item retain]; [tab_view removeTabViewItem:old_item]; [tab_view insertTabViewItem:old_item atIndex:index]; [old_item release]; [self _updateTitleFromTerminalView:old_tv]; [self _updateTitleFromTerminalView:new_tv]; [tab_view selectTabViewItemAtIndex:destination_index]; [tab_view display]; } - (void) tabView: (NSTabView*)tabView didSelectTabViewItem: (NSTabViewItem*)tabViewItem { NSInteger tab_number = [tabView indexOfTabViewItem:tabViewItem]; TerminalView *tv = [terminal_views objectAtIndex:tab_number]; [self _updateTitleFromTerminalView:tv]; [[self window] makeFirstResponder:[terminal_views objectAtIndex:tab_number]]; [tv setNeedsDisplay:YES]; } @end Terminal-0.9.9/autokeyviewchain.h010064400017500000144000000011001264654375400163060ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef autokeyviewchain_h #define autokeyviewchain_h @interface NSWindow (autokeyviewchain) -(void) autoSetupKeyViewChain; @end @interface NSView (autokeyviewchain) -(NSView *) autoSetupKeyViewChain: (NSView *) next; @end #endif Terminal-0.9.9/cursor_stroked.tiff010064400017500000144000000026241264654375400165140ustar multixusersMM*  (ȠȠȠȠTerminal-0.9.9/Terminal.h010064400017500000144000000035101264654375400145110ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef Terminal_h #define Terminal_h typedef struct { unichar ch; unsigned char color; unsigned char attr; /* bits 0,1 intensity, 0-2 2 underline 3 reverse 4 blink 5 unused 6 used as a selected flag internally 7 used as a dirty flag internally */ } screen_char_t; /* Used as a marker. */ #define MULTI_CELL_GLYPH 0xfffe @protocol TerminalScreen -(void) ts_sendCString: (const char *)str; -(void) ts_sendCString: (const char *)msg length: (int)len; -(void) ts_goto: (int)x :(int)y; -(void) ts_putChar: (screen_char_t)ch count: (int)c at: (int)x :(int)y; -(void) ts_putChar: (screen_char_t)ch count: (int)c offset: (int)ofs; /* The portions scrolled/shifted from remain unchanged. However, it's assumed that they will be cleared or overwritten before the redraw is complete. (TODO check this) */ -(void) ts_scrollUp: (int)top :(int)bottom rows: (int)nr save: (BOOL)save; -(void) ts_scrollDown: (int)top :(int)bottom rows: (int)nr; -(void) ts_shiftRow: (int)y at: (int)x0 delta: (int)d; -(screen_char_t) ts_getCharAt: (int)x :(int)y; -(void) ts_setTitle: (NSString *)new_title type: (int)title_type; -(BOOL) useMultiCellGlyphs; -(int) relativeWidthOfCharacter: (unichar)ch; @end @protocol TerminalParser - initWithTerminalScreen: (id)ats width: (int)w height: (int)h; -(void) processByte: (unsigned char)c; -(void) setTerminalScreenWidth: (int)w height: (int)h; -(void) handleKeyEvent: (NSEvent *)e; -(void) sendString: (NSString *)str; @end #endif Terminal-0.9.9/TerminalView.m010064400017500000144000001361431314040446700153450ustar multixusers/* copyright 2002-2003 Alexander Malmberg 2005-2016 Riccardo Mottola This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ /* TODO: Move pty and child process handling to another class. Make this a stupid but fast character cell display view. */ /* define this if you need the forkpty replacement and it is not automatically activated */ #undef USE_FORKPTY_REPLACEMENT /* check for solaris */ #if defined (__SVR4) && defined (__sun) #define __SOLARIS__ 1 #define USE_FORKPTY_REPLACEMENT 1 #endif #include #include #ifdef __NetBSD__ # include # include # include # include # include #define TCSETS TIOCSETA #elif defined(__FreeBSD__) # include # include # include # include # include #elif defined(__OpenBSD__) # include # include # include #elif defined (__GNU__) #else # include #endif #include #include #include #include #ifndef __FreeBSD__ #if !(defined (__NetBSD__)) && !(defined (__SOLARIS__)) && !(defined(__OpenBSD__)) # include #endif #endif #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import "TerminalView.h" #import "TerminalViewPrefs.h" #import "TerminalParser_Linux.h" /* forkpty replacement */ #ifdef USE_FORKPTY_REPLACEMENT #include /* for stderr and perror*/ #include /* for int errno */ #include #include #include #include #include #define PATH_TTY "/dev/tty" int ptyMakeControllingTty(int *slaveFd, const char *slaveName) { pid_t pgid; int fd; if (!slaveFd || *slaveFd < 0) { perror("slaveFd invalid"); return -1; } /* disconnect from the old controlling tty */ #ifdef TIOCNOTTY if ((fd = open(PATH_TTY, O_RDWR | O_NOCTTY)) >= 0 ) { ioctl(fd, TIOCNOTTY, NULL); close(fd); } #endif pgid = setsid(); /* create session and set process ID */ if (pgid == -1) { if (errno == EPERM) perror("EPERM error on setsid"); } /* Make it our controlling tty */ #ifdef TIOCSCTTY if (ioctl(*slaveFd, TIOCSCTTY, NULL) == -1) return -1; #else #warning TIOCSCTTY replacement { /* first terminal we open after setsid() is the controlling one */ char *controllingTty; int ctr_fdes; controllingTty = ttyname(*slaveFd); ctr_fdes = open(controllingTty, O_RDWR); close(ctr_fdes); } #endif /* TIOCSCTTY */ #if defined (TIOCSPGRP) ioctl (0, TIOCSPGRP, &pgid); #else #warning no TIOCSPGRP tcsetpgrp (0, pgid); #endif if ((fd = open(slaveName, O_RDWR)) >= 0) { close(*slaveFd); *slaveFd = fd; printf("Got new filedescriptor...\n"); } if ((fd = open(PATH_TTY, O_RDWR)) == -1) return -1; close(fd); return 0; } int openpty(int *amaster, int *aslave, char *name, const struct termios *termp, const struct winsize *winp) { int fdm, fds; char *slaveName; fdm = open("/dev/ptmx", O_RDWR); /* open master */ if (fdm == -1) { perror("openpty:open(master)"); return -1; } if(grantpt(fdm)) /* grant access to the slave */ { perror("openpty:grantpt(master)"); close(fdm); return -1; } if(unlockpt(fdm)) /* unlock the slave terminal */ { perror("openpty:unlockpt(master)"); close(fdm); return -1; } slaveName = ptsname(fdm); /* get name of the slave */ if (slaveName == NULL) { perror("openpty:ptsname(master)"); close(fdm); return -1; } if (name) /* of name ptr not null, copy it name back */ strcpy(name, slaveName); fds = open(slaveName, O_RDWR | O_NOCTTY); /* open slave */ if (fds == -1) { perror("openpty:open(slave)"); close (fdm); return -1; } /* ldterm and ttcompat are automatically pushed on the stack on some systems*/ #ifdef __SOLARIS__ if (ioctl(fds, I_PUSH, "ptem") == -1) /* pseudo terminal module */ { perror("openpty:ioctl(I_PUSH, ptem"); close(fdm); close(fds); return -1; } if (ioctl(fds, I_PUSH, "ldterm") == -1) /* ldterm must stay atop ptem */ { perror("forkpty:ioctl(I_PUSH, ldterm"); close(fdm); close(fds); return -1; } #endif /* set terminal parameters if present */ if (termp) ioctl(fds, TCSETS, termp); if (winp) ioctl(fds, TIOCSWINSZ, winp); *amaster = fdm; *aslave = fds; return 0; } int forkpty (int *amaster, char *slaveName, const struct termios *termp, const struct winsize *winp) { int fdm, fds; /* master and slave file descriptors */ pid_t pid; if (openpty(&fdm, &fds, slaveName, termp, winp) == -1) { perror("forkpty:openpty()"); return -1; } pid = fork(); if (pid == -1) { /* error */ perror("forkpty:fork()"); close(fdm); close(fds); return -1; } else if (pid == 0) { /* child */ ptyMakeControllingTty(&fds, slaveName); if (fds != STDIN_FILENO && dup2(fds, STDIN_FILENO) == -1) perror("error duplicationg stdin"); if (fds != STDOUT_FILENO && dup2(fds, STDOUT_FILENO) == -1) perror("error duplicationg stdout"); if (fds != STDERR_FILENO && dup2(fds, STDERR_FILENO) == -1) perror("error duplicationg stderr"); if (fds != STDIN_FILENO && fds != STDOUT_FILENO && fds != STDERR_FILENO) close(fds); close (fdm); } else { /* father */ close (fds); *amaster = fdm; } return pid; } #endif /* forpkty replacement */ /* TODO */ @interface NSView (unlockfocus) -(void) unlockFocusNeedsFlush: (BOOL)flush; @end NSString *TerminalViewBecameIdleNotification=@"TerminalViewBecameIdle", *TerminalViewBecameNonIdleNotification=@"TerminalViewBecameNonIdle", *TerminalViewTitleDidChangeNotification=@"TerminalViewTitleDidChange"; @interface TerminalView (scrolling) -(void) _updateScroller; -(void) _scrollTo: (int)new_scroll update: (BOOL)update; -(void) setScroller: (NSScroller *)sc; @end @interface TerminalView (selection) -(void) _clearSelection; @end @interface TerminalView (input) -(void) closeProgram; -(void) runShell; -(void) runProgram: (NSString *)path withArguments: (NSArray *)args initialInput: (NSString *)d; @end /** TerminalScreen protocol implementation and rendering methods **/ @implementation TerminalView (display) #define ADD_DIRTY(ax0,ay0,asx,asy) do { \ if (dirty.x0==-1) \ { \ dirty.x0=(ax0); \ dirty.y0=(ay0); \ dirty.x1=(ax0)+(asx); \ dirty.y1=(ay0)+(asy); \ } \ else \ { \ if (dirty.x0>(ax0)) dirty.x0=(ax0); \ if (dirty.y0>(ay0)) dirty.y0=(ay0); \ if (dirty.x1<(ax0)+(asx)) dirty.x1=(ax0)+(asx); \ if (dirty.y1<(ay0)+(asy)) dirty.y1=(ay0)+(asy); \ } \ } while (0) #define SCREEN(x,y) (screen[(y)*sx+(x)]) /* handle accumulated pending scrolls with a single composite */ -(void) _handlePendingScroll: (BOOL)lockFocus { float x0,y0,w,h,dx,dy; if (!pending_scroll) return; if (pending_scroll>=sy || pending_scroll<=-sy) { pending_scroll=0; return; } NSDebugLLog(@"draw",@"_handlePendingScroll %i %i",pending_scroll,lockFocus); dx=x0=0; w=fx*sx; if (pending_scroll>0) { y0=0; h=(sy-pending_scroll)*fy; dy=pending_scroll*fy; y0=sy*fy-y0-h; dy=sy*fy-dy-h; } else { pending_scroll=-pending_scroll; y0=pending_scroll*fy; h=(sy-pending_scroll)*fy; dy=0; y0=sy*fy-y0-h; dy=sy*fy-dy-h; } if (lockFocus) [self lockFocus]; DPScomposite(GSCurrentContext(),border_x+x0,border_y+y0,w,h, [self gState],border_x+dx,border_y+dy,NSCompositeCopy); if (lockFocus) [self unlockFocusNeedsFlush: NO]; num_scrolls++; pending_scroll=0; } static int total_draw=0; static const float col_h[8]={ 0,240,120,180, 0,300, 60, 0}; static const float col_s[8]={0.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0}; static void set_background(NSGraphicsContext *gc, unsigned char color,unsigned char in) { float bh,bs,bb; int bg=color>>4; if (bg==0) bb=0.0; else if (bg>=8) bg-=8,bb=1.0; else bb=0.6; bs=col_s[bg]; bh=col_h[bg]/360.0; DPSsethsbcolor(gc,bh,bs,bb); } static void set_foreground(NSGraphicsContext *gc, unsigned char color,unsigned char in, BOOL blackOnWhite) { int fg=color; float h,s,b; if (blackOnWhite) { if (color == 0) { fg = 7; in = 2; } // Black becomes white else if (color == 7) { fg = 0; in = 0; } // White becomes black //else in = 3; // Other colors are saturated } if (fg>=8) { in++; fg-=8; } if (fg==0) { if (in==2) b=0.4; else b=0.0; } else if (in==0) b=0.6; else if (in==1) b=0.8; else b=1.0; h=col_h[fg]/360.0; s=col_s[fg]; if (in==2) s*=0.75; DPSsethsbcolor(gc,h,s,b); } -(void) drawRect: (NSRect)r { int ix,iy; char buf[8]; NSGraphicsContext *cur=GSCurrentContext(); int x0,y0,x1,y1; NSFont *f,*current_font=nil; int encoding; NSDebugLLog(@"draw",@"drawRect: (%g %g)+(%g %g) %i\n", r.origin.x,r.origin.y,r.size.width,r.size.height, draw_all); if (pending_scroll) [self _handlePendingScroll: NO]; /* draw the border around the view if needed */ { float a,b; if (blackOnWhite) DPSsetgray(cur,1.0); else DPSsetgray(cur,0.0); if (r.origin.xa) DPSrectfill(cur,a,r.origin.y,b-a,r.size.height); a=border_y+sy*fy; b=r.origin.y+r.size.height; if (b>a) DPSrectfill(cur,r.origin.x,a,r.size.width,b-a); } /* figure out what character cells might need redrawing */ r.origin.x-=border_x; r.origin.y-=border_y; x0=floor(r.origin.x/fx); x1=ceil((r.origin.x+r.size.width)/fx); if (x0<0) x0=0; if (x1>=sx) x1=sx; y1=floor(r.origin.y/fy); y0=ceil((r.origin.y+r.size.height)/fy); y0=sy-y0; y1=sy-y1; if (y0<0) y0=0; if (y1>=sy) y1=sy; NSDebugLLog(@"draw",@"dirty (%i %i)-(%i %i)\n",x0,y0,x1,y1); draw_cursor=draw_cursor || draw_all || (SCREEN(cursor_x,cursor_y).attr&0x80)!=0; { int ry; screen_char_t *ch; float scr_y,scr_x,start_x; /* setting the color is slow, so we try to avoid it */ unsigned char l_color,l_attr,color; /* Fill the background of dirty cells. Since the background doesn't change that often, runs of dirty cells with the same background color are combined and drawn with a single rectfill. */ l_color=0; l_attr=0; set_foreground(cur,l_color,l_attr,blackOnWhite); for (iy=y0;iy=0) ch=&SCREEN(x0,ry); else ch=&sbuf[x0+(max_scrollback+ry)*sx]; scr_y=(sy-1-iy)*fy+border_y; /* #define R(scr_x,scr_y,fx,fy) \ DPSgsave(cur); \ DPSsetgray(cur,0.0); \ DPSrectfill(cur,scr_x,scr_y,fx,fy); \ DPSgrestore(cur); \ DPSrectstroke(cur,scr_x,scr_y,fx,fy); \ */ /* ~400 cycles/cell on average */ #define R(scr_x,scr_y,fx,fy) DPSrectfill(cur,scr_x,scr_y,fx,fy) start_x=-1; for (ix=x0;ixattr&0x80)) { if (start_x!=-1) { scr_x=ix*fx+border_x; R(start_x,scr_y,scr_x-start_x,fy); start_x=-1; } continue; } scr_x=ix*fx+border_x; if (ch->attr&0x8) { color=ch->color&0xf; if (ch->attr&0x40) color^=0xf; if (color!=l_color || (ch->attr&0x03)!=l_attr) { if (start_x!=-1) { R(start_x,scr_y,scr_x-start_x,fy); start_x=scr_x; } l_color=color; l_attr=ch->attr&0x03; set_foreground(cur,l_color,l_attr,blackOnWhite); } } else { color=ch->color&0xf0; if (ch->attr&0x40) color^=0xf0; if (color!=l_color) { if (start_x!=-1) { R(start_x,scr_y,scr_x-start_x,fy); start_x=scr_x; } l_color=color; l_attr=ch->attr&0x03; set_background(cur,l_color,l_attr); } } if (start_x==-1) start_x=scr_x; } if (start_x!=-1) { scr_x=ix*fx+border_x; R(start_x,scr_y,scr_x-start_x,fy); } } /* now draw any dirty characters */ for (iy=y0;iy=0) ch=&SCREEN(x0,ry); else ch=&sbuf[x0+(max_scrollback+ry)*sx]; scr_y=(sy-1-iy)*fy+border_y; for (ix=x0;ixattr&0x80)) continue; ch->attr&=0x7f; scr_x=ix*fx+border_x; /* ~1700 cycles/change */ if (ch->attr&0x02 || (ch->ch!=0 && ch->ch!=32)) { if (!(ch->attr&0x8)) { color=ch->color&0xf; if (ch->attr&0x40) color^=0xf; if (color!=l_color || (ch->attr&0x03)!=l_attr) { l_color=color; l_attr=ch->attr&0x03; set_foreground(cur,l_color,l_attr,blackOnWhite); } } else { color=ch->color&0xf0; if (ch->attr&0x40) color^=0xf0; if (color!=l_color) { l_color=color; l_attr=ch->attr&0x03; set_background(cur,l_color,l_attr); } } } if (ch->ch!=0 && ch->ch!=32 && ch->ch!=MULTI_CELL_GLYPH) { total_draw++; if ((ch->attr&3)==2) { encoding=boldFont_encoding; f=boldFont; } else { encoding=font_encoding; f=font; } if (f!=current_font) { /* ~190 cycles/change */ [f set]; current_font=f; } /* we short-circuit utf8 for performance with back-art */ /* TODO: short-circuit latin1 too? */ if (encoding==NSUTF8StringEncoding) { unichar uch=ch->ch; if (uch>=0x800) { buf[2]=(uch&0x3f)|0x80; uch>>=6; buf[1]=(uch&0x3f)|0x80; uch>>=6; buf[0]=(uch&0x0f)|0xe0; buf[3]=0; } else if (uch>=0x80) { buf[1]=(uch&0x3f)|0x80; uch>>=6; buf[0]=(uch&0x1f)|0xc0; buf[2]=0; } else { buf[0]=uch; buf[1]=0; } } else { unichar uch=ch->ch; if (uch<=0x80) { buf[0]=uch; buf[1]=0; } else { unsigned char *pbuf=(unsigned char *)buf; unsigned int dlen=sizeof(buf)-1; GSFromUnicode(&pbuf,&dlen,&uch,1,encoding,NULL,GSUniTerminate); } } /* ~580 cycles */ DPSmoveto(cur,scr_x+fx0,scr_y+fy0); /* baseline here for mc-case 0.65 */ /* ~3800 cycles */ DPSshow(cur,buf); /* ~95 cycles to ARTGState -DPSshow:... */ /* ~343 cycles to isEmpty */ /* ~593 cycles to currentpoint */ /* ~688 cycles to transform */ /* ~1152 cycles to FTFont -drawString:... */ /* ~1375 cycles to -drawString:... setup */ /* ~1968 cycles cmap lookup */ /* ~2718 cycles sbit lookup */ /* ~~2750 cycles blit setup */ /* ~3140 cycles blit loop, empty call */ /* ~3140 cycles blit loop, setup */ /* ~3325 cycles blit loop, no write */ /* ~3800 cycles total */ } /* underline */ if (ch->attr&0x4) DPSrectfill(cur,scr_x,scr_y,fx,1); } } } if (draw_cursor) { float x,y; [[TerminalViewDisplayPrefs cursorColor] set]; x=cursor_x*fx+border_x; y=(sy-1-cursor_y+current_scroll)*fy+border_y; switch ([TerminalViewDisplayPrefs cursorStyle]) { case CURSOR_LINE: DPSrectfill(cur,x,y,fx,fy*0.1); break; case CURSOR_BLOCK_STROKE: DPSrectstroke(cur,x+0.5,y+0.5,fx-1.0,fy-1.0); break; case CURSOR_BLOCK_FILL: DPSrectfill(cur,x,y,fx,fy); break; case CURSOR_BLOCK_INVERT: DPScompositerect(cur,x,y,fx,fy, NSCompositeHighlight); break; } draw_cursor=NO; } NSDebugLLog(@"draw",@"total_draw=%i",total_draw); draw_all=1; } -(BOOL) isOpaque { return YES; } -(void) setNeedsDisplayInRect: (NSRect)r { draw_all=2; [super setNeedsDisplayInRect: r]; } -(void) setNeedsLazyDisplayInRect: (NSRect)r { if (draw_all==1) draw_all=0; [super setNeedsDisplayInRect: r]; } -(void) benchmark: (id)sender { int i; double t1,t2; NSRect r=[self frame]; t1=[NSDate timeIntervalSinceReferenceDate]; total_draw=0; for (i=0;i<100;i++) { draw_all=2; [self lockFocus]; [self drawRect: r]; [self unlockFocusNeedsFlush: NO]; } t2=[NSDate timeIntervalSinceReferenceDate]; t2-=t1; fprintf(stderr,"%8.4f %8.5f/redraw total_draw=%i\n",t2,t2/i,total_draw); } -(void) ts_setTitle: (NSString *)new_title type: (int)title_type { NSDebugLLog(@"ts",@"setTitle: %@ type: %i",new_title,title_type); if (title_type==1 || title_type==0) ASSIGN(title_miniwindow,new_title); if (title_type==2 || title_type==0) ASSIGN(title_window,new_title); if (title_type==3) ASSIGN(title_filename,new_title); [[NSNotificationCenter defaultCenter] postNotificationName: TerminalViewTitleDidChangeNotification object: self]; } -(void) ts_goto: (int)x :(int)y { NSDebugLLog(@"ts",@"goto: %i:%i",x,y); cursor_x=x; cursor_y=y; if (cursor_x>=sx) cursor_x=sx-1; if (cursor_x<0) cursor_x=0; if (cursor_y>=sy) cursor_y=sy-1; if (cursor_y<0) cursor_y=0; } -(void) ts_putChar: (screen_char_t)ch count: (int)c at: (int)x :(int)y { int i; screen_char_t *s; NSDebugLLog(@"ts",@"putChar: '%c' %02x %02x count: %i at: %i:%i", ch.ch,ch.color,ch.attr,c,x,y); if (y<0 || y>=sy) return; if (x+c>sx) c=sx-x; if (x<0) { c-=x; x=0; } s=&SCREEN(x,y); ch.attr|=0x80; for (i=0;isx*sy) c=sx*sy-ofs; if (ofs<0) { c-=ofs; ofs=0; } s=&SCREEN(ofs,0); ch.attr|=0x80; for (i=0;imax_scrollback) sb_length=max_scrollback; } if (t+nr >= b) nr = b - t - 1; if (b > sy || t >= b || nr < 1) return; d = &SCREEN(0,t); s = &SCREEN(0,t+nr); if (current_y>=t && current_y<=b) { SCREEN(current_x,current_y).attr|=0x80; draw_cursor=YES; /* TODO: does this properly handle the case when the cursor is in an area that gets scrolled 'over'? now it does, but not in an optimal way. handling of this could be optimized in all scrolling methods, but it probably won't make much difference */ } memmove(d, s, (b-t-nr) * sx * sizeof(screen_char_t)); if (!current_scroll) { if (t==0 && b==sy) { pending_scroll-=nr; } else { float x0,y0,w,h,dx,dy; if (pending_scroll) [self _handlePendingScroll: YES]; x0=0; w=fx*sx; y0=(t+nr)*fy; h=(b-t-nr)*fy; dx=0; dy=t*fy; y0=sy*fy-y0-h; dy=sy*fy-dy-h; [self lockFocus]; DPScomposite(GSCurrentContext(),border_x+x0,border_y+y0,w,h, [self gState],border_x+dx,border_y+dy,NSCompositeCopy); [self unlockFocusNeedsFlush: NO]; num_scrolls++; } } ADD_DIRTY(0,t,sx,b-t); } -(void) ts_scrollDown: (int)t :(int)b rows: (int)nr { screen_char_t *s; unsigned int step; NSDebugLLog(@"ts",@"scrollDown: %i:%i rows: %i", t,b,nr); if (t+nr >= b) nr = b - t - 1; if (b > sy || t >= b || nr < 1) return; s = &SCREEN(0,t); step = sx * nr; if (current_y>=t && current_y<=b) { SCREEN(current_x,current_y).attr|=0x80; draw_cursor=YES; } memmove(s + step, s, (b-t-nr)*sx*sizeof(screen_char_t)); if (!current_scroll) { if (t==0 && b==sy) { pending_scroll+=nr; } else { float x0,y0,w,h,dx,dy; if (pending_scroll) [self _handlePendingScroll: YES]; x0=0; w=fx*sx; y0=(t)*fy; h=(b-t-nr)*fy; dx=0; dy=(t+nr)*fy; y0=sy*fy-y0-h; dy=sy*fy-dy-h; [self lockFocus]; DPScomposite(GSCurrentContext(),border_x+x0,border_y+y0,w,h, [self gState],border_x+dx,border_y+dy,NSCompositeCopy); [self unlockFocusNeedsFlush: NO]; num_scrolls++; } } ADD_DIRTY(0,t,sx,b-t); } -(void) ts_shiftRow: (int)y at: (int)x0 delta: (int)delta { screen_char_t *s,*d; int x1,c; NSDebugLLog(@"ts",@"shiftRow: %i at: %i delta: %i", y,x0,delta); if (y<0 || y>=sy) return; if (x0<0 || x0>=sx) return; if (current_y==y) { SCREEN(current_x,current_y).attr|=0x80; draw_cursor=YES; } s=&SCREEN(x0,y); x1=x0+delta; c=sx-x0; if (x1<0) { x0-=x1; c+=x1; x1=0; } if (x1+c>sx) c=sx-x1; d=&SCREEN(x1,y); memmove(d,s,sizeof(screen_char_t)*c); if (!current_scroll) { float cx0,y0,w,h,dx,dy; if (pending_scroll) [self _handlePendingScroll: YES]; cx0=x0*fx; w=fx*c; dx=x1*fx; y0=y*fy; h=fy; dy=y0; y0=sy*fy-y0-h; dy=sy*fy-dy-h; [self lockFocus]; DPScomposite(GSCurrentContext(),border_x+cx0,border_y+y0,w,h, [self gState],border_x+dx,border_y+dy,NSCompositeCopy); [self unlockFocusNeedsFlush: NO]; num_scrolls++; } ADD_DIRTY(0,y,sx,1); } -(screen_char_t) ts_getCharAt: (int)x :(int)y { NSDebugLLog(@"ts",@"getCharAt: %i:%i",x,y); return SCREEN(x,y); } -(void) addDataToWriteBuffer: (const char *)data length: (int)len { if (!len) return; if (!write_buf_len) { [[NSRunLoop currentRunLoop] addEvent: (void *)(intptr_t)master_fd type: ET_WDESC watcher: self forMode: NSDefaultRunLoopMode]; } if (write_buf_len+len>write_buf_size) { /* Round up to nearest multiple of 512 bytes. */ write_buf_size=(write_buf_len+len+511)&~511; write_buf=realloc(write_buf,write_buf_size); } memcpy(&write_buf[write_buf_len],data,len); write_buf_len+=len; } -(void) ts_sendCString: (const char *)msg { [self ts_sendCString: msg length: strlen(msg)]; } -(void) ts_sendCString: (const char *)msg length: (int)len { int l; if (master_fd==-1) return; if (write_buf_len) { [self addDataToWriteBuffer: msg length: len]; return; } l=write(master_fd,msg,len); if (l!=len) { if (errno!=EAGAIN) NSLog(_(@"Unexpected error while writing.")); if (l<0) l=0; [self addDataToWriteBuffer: &msg[l] length: len-l]; } } -(BOOL) useMultiCellGlyphs { return use_multi_cell_glyphs; } -(int) relativeWidthOfCharacter: (unichar)ch { int s; if (!use_multi_cell_glyphs) return 1; s=ceil([font boundingRectForGlyph: ch].size.width/fx); if (s<1) return 1; return s; } -(void) viewPrefsDidChange: (NSNotification *)n { /* TODO: handle font changes? */ [self setNeedsDisplay: YES]; } @end /** Scrolling **/ @implementation TerminalView (scrolling) -(void) _updateScroller { if (sb_length) { [scroller setEnabled: YES]; [scroller setFloatValue: (current_scroll+sb_length)/(float)(sb_length) knobProportion: sy/(float)(sy+sb_length)]; } else { [scroller setEnabled: NO]; } } -(void) _scrollTo: (int)new_scroll update: (BOOL)update { if (new_scroll>0) new_scroll=0; if (new_scroll<-sb_length) new_scroll=-sb_length; if (new_scroll==current_scroll) return; current_scroll=new_scroll; if (update) { [self _updateScroller]; } [self setNeedsDisplay: YES]; } -(void) scrollWheel: (NSEvent *)e { float delta=[e deltaY]; int new_scroll; int mult; if ([e modifierFlags]&NSShiftKeyMask) mult=1; else if ([e modifierFlags]&NSControlKeyMask) mult=sy; else mult=5; new_scroll=current_scroll-delta*mult; [self _scrollTo: new_scroll update: YES]; } -(void) _updateScroll: (id)sender { int new_scroll; int part=[scroller hitPart]; BOOL update=YES; if (part==NSScrollerKnob || part==NSScrollerKnobSlot) { float f=[scroller floatValue]; new_scroll=(f-1.0)*sb_length; update=NO; } else if (part==NSScrollerDecrementLine) new_scroll=current_scroll-1; else if (part==NSScrollerDecrementPage) new_scroll=current_scroll-sy/2; else if (part==NSScrollerIncrementLine) new_scroll=current_scroll+1; else if (part==NSScrollerIncrementPage) new_scroll=current_scroll+sy/2; else return; [self _scrollTo: new_scroll update: update]; } -(void) setScroller: (NSScroller *)sc { [scroller setTarget: nil]; ASSIGN(scroller,sc); [self _updateScroller]; [scroller setTarget: self]; [scroller setAction: @selector(_updateScroll:)]; } @end /** Keyboard events **/ @implementation TerminalView (keyboard) -(void) keyDown: (NSEvent *)e { NSString *s=[e charactersIgnoringModifiers]; NSDebugLLog(@"key",@"got key flags=%08x repeat=%i '%@' '%@' %4i %04x %li %04x %li\n", (unsigned int)[e modifierFlags],(int)[e isARepeat],[e characters],[e charactersIgnoringModifiers],[e keyCode], [[e characters] characterAtIndex: 0],[[e characters] length], [[e charactersIgnoringModifiers] characterAtIndex: 0],[[e charactersIgnoringModifiers] length]); if ([s length]==1 && ([e modifierFlags]&NSShiftKeyMask)) { unichar ch=[s characterAtIndex: 0]; if (ch==NSPageUpFunctionKey) { [self _scrollTo: current_scroll-sy+1 update: YES]; return; } if (ch==NSPageDownFunctionKey) { [self _scrollTo: current_scroll+sy-1 update: YES]; return; } } /* don't check until we get here so we handle scrollback page-up/down even when the view's idle */ if (master_fd==-1) return; [tp handleKeyEvent: e]; } -(BOOL) acceptsFirstResponder { return YES; } -(BOOL) becomeFirstResponder { return YES; } -(BOOL) resignFirstResponder { return YES; } @end /** Selection, copy/paste/services **/ @implementation TerminalView (selection) -(NSString *) _selectionAsString { int ofs=max_scrollback*sx; NSMutableString *mstr; NSString *tmp; unichar buf[32]; unichar ch; int len,ws_len; int i,j; if (selection.length==0) return nil; mstr=[[NSMutableString alloc] init]; j=selection.location+selection.length; len=0; for (i=selection.location;ij) { ws_len=0; /* make sure we break out of the outer loop */ break; } if (len) { tmp=[[NSString alloc] initWithCharacters: buf length: len]; [mstr appendString: tmp]; DESTROY(tmp); len=0; } [mstr appendString: @"\n"]; ws_len=0; continue; } } i-=ws_len; for (;i=j) break; buf[len++]=ch; if (len==32) { tmp=[[NSString alloc] initWithCharacters: buf length: 32]; [mstr appendString: tmp]; DESTROY(tmp); len=0; } } if (len) { tmp=[[NSString alloc] initWithCharacters: buf length: len]; [mstr appendString: tmp]; DESTROY(tmp); } return AUTORELEASE(mstr); } -(void) _setSelection: (struct selection_range)s { int i,j,ofs2; if (s.location<-sb_length*sx) { s.length+=sb_length*sx+s.location; s.location=-sb_length*sx; } if (s.location+s.length>sx*sy) { s.length=sx*sy-s.location; } if (!s.length && !selection.length) return; if (s.length==selection.length && s.location==selection.location) return; ofs2=max_scrollback*sx; j=selection.location+selection.length; if (j>s.location) j=s.location; for (i=selection.location;i=j;i--) { if (i<0) ch2=sbuf[ofs+i].ch; else ch2=screen[i].ch; if (ch2==0) ch2=' '; if (![cs characterIsMember: ch2]) break; } s.location=i+1; /* and forwards... */ j+=sx; for (i=pos+1;i=sx) p.x=sx-1; p.y=ceil((p.y-border_y)/fy); if (p.y<-1) p.y=-1; if (p.y>sy) p.y=sy; p.y=sy-p.y+current_scroll; ofs1=((int)p.x)+((int)p.y)*sx; r1=[self _selectionRangeAt: ofs1 granularity: g]; if (first) { ofs0=ofs1; first=0; r0=r1; } NSDebugLLog(@"select",@"ofs %i %i (%i+%i) (%i+%i)\n", ofs0,ofs1, r0.location,r0.length, r1.location,r1.length); if (ofs1>ofs0) { s.location=r0.location; s.length=r1.location+r1.length-r0.location; } else { s.location=r1.location; s.length=r0.location+r0.length-r1.location; } [self _setSelection: s]; [self displayIfNeeded]; e=[NSApp nextEventMatchingMask: NSLeftMouseDownMask|NSLeftMouseUpMask| NSLeftMouseDraggedMask|NSMouseMovedMask untilDate: [NSDate distantFuture] inMode: NSEventTrackingRunLoopMode dequeue: YES]; } if (selection.length) { [self writeSelectionToPasteboard: [NSPasteboard pasteboardWithName: @"Selection"] types: [NSArray arrayWithObject: NSStringPboardType]]; } } -(void) otherMouseUp: (NSEvent *)e { NSPasteboard *pb=[NSPasteboard pasteboardWithName: @"Selection"]; NSString *type; NSString *str; type=[pb availableTypeFromArray: [NSArray arrayWithObject: NSStringPboardType]]; if (!type) return; str=[pb stringForType: NSStringPboardType]; if (str) [tp sendString: str]; } @end /** Handle master_fd **/ @implementation TerminalView (input) -(NSDate *) timedOutEvent: (void *)data type: (RunLoopEventType)t forMode: (NSString *)mode { NSLog(@"timedOutEvent:type:forMode: ignored"); return nil; } -(void) readData { char buf[256]; int size,total,i; // get_zombies(); total=0; num_scrolls=0; dirty.x0=-1; current_x=cursor_x; current_y=cursor_y; [self _clearSelection]; /* TODO? */ NSDebugLLog(@"term",@"receiving output"); while (1) { size=read(master_fd,buf,sizeof(buf)); if (size<0 && errno==EAGAIN) break; if (size<=0) { NSString *msg; int i,c; unichar ch; // get_zombies(); [self closeProgram]; msg=_(@"[Process exited]"); c=[msg length]; for (i=0;i=8192 || (num_scrolls+abs(pending_scroll))>10) break; } if (cursor_x!=current_x || cursor_y!=current_y) { ADD_DIRTY(current_x,current_y,1,1); SCREEN(current_x,current_y).attr|=0x80; ADD_DIRTY(cursor_x,cursor_y,1,1); draw_cursor=YES; } NSDebugLLog(@"term",@"done (%i %i) (%i %i)\n", dirty.x0,dirty.y0,dirty.x1,dirty.y1); if (dirty.x0>=0) { NSRect dr; // NSLog(@"dirty=(%i %i)-(%i %i)\n",dirty.x0,dirty.y0,dirty.x1,dirty.y1); dr.origin.x=dirty.x0*fx; dr.origin.y=dirty.y0*fy; dr.size.width=(dirty.x1-dirty.x0)*fx; dr.size.height=(dirty.y1-dirty.y0)*fy; dr.origin.y=fy*sy-(dr.origin.y+dr.size.height); // NSLog(@"-> dirty=(%g %g)+(%g %g)\n",dirty.origin.x,dirty.origin.y,dirty.size.width,dirty.size.height); dr.origin.x+=border_x; dr.origin.y+=border_y; [self setNeedsLazyDisplayInRect: dr]; if (current_scroll!=0) { /* TODO */ current_scroll=0; [self setNeedsDisplay: YES]; } [self _updateScroller]; } } -(void) writePendingData { int l,new_size; l=write(master_fd,write_buf,write_buf_len); if (l<0) { if (errno!=EAGAIN) NSLog(_(@"Unexpected error while writing.")); return; } memmove(write_buf,&write_buf[l],write_buf_len-l); write_buf_len-=l; /* If less than half the buffer is empty, reallocate it, but never free it completely. */ new_size=(write_buf_len+511)&~511; if (!new_size) new_size=512; if (new_size<=write_buf_size/2) { write_buf_size=new_size; write_buf=realloc(write_buf,write_buf_size); } if (!write_buf_len) { [[NSRunLoop currentRunLoop] removeEvent: (void *)(intptr_t)master_fd type: ET_WDESC forMode: NSDefaultRunLoopMode all: YES]; } } -(void) receivedEvent: (void *)data type: (RunLoopEventType)type extra: (void *)extra forMode: (NSString *)mode { if (type==ET_WDESC) [self writePendingData]; else if (type==ET_RDESC) [self readData]; } -(void) closeProgram { if (master_fd==-1) return; NSDebugLLog(@"pty",@"closing master fd=%i\n",master_fd); [[NSRunLoop currentRunLoop] removeEvent: (void *)(intptr_t)master_fd type: ET_RDESC forMode: NSDefaultRunLoopMode all: YES]; [[NSRunLoop currentRunLoop] removeEvent: (void *)(intptr_t)master_fd type: ET_WDESC forMode: NSDefaultRunLoopMode all: YES]; write_buf_len=write_buf_size=0; free(write_buf); write_buf=NULL; close(master_fd); master_fd=-1; } -(void) runProgram: (NSString *)path withArguments: (NSArray *)args inDirectory: (NSString *)directory initialInput: (NSString *)d arg0: (NSString *)arg0 { int ret; struct winsize ws; NSRunLoop *rl; const char *cpath; const char *cargs[[args count]+2]; const char *cdirectory; int i; int pipefd[2]; int flags; NSDebugLLog(@"pty",@"-runProgram: %@ withArguments: %@ initialInput: %@", path,args,d); [self closeProgram]; cpath=[path cString]; if (arg0) cargs[0]=[arg0 cString]; else cargs[0]=cpath; cdirectory=[directory cString]; for (i=0;i<[args count];i++) { cargs[i+1]=[[args objectAtIndex: i] cString]; } cargs[i+1]=NULL; if (d) { if (pipe(pipefd)) { NSLog(_(@"Unable to open pipe for input.")); return; } NSDebugLLog(@"pty",@"creating pipe for initial data, got %i %i", pipefd[0],pipefd[1]); } ws.ws_row=sy; ws.ws_col=sx; ret=forkpty(&master_fd,NULL,NULL,&ws); if (ret<0) { NSLog(_(@"Unable to fork.")); return; } if (ret==0) { if (d) { close(pipefd[1]); dup2(pipefd[0],0); } if (cdirectory) if (chdir(cdirectory) < 0) fprintf(stderr, "Unable do set directory: %s\n", cdirectory); putenv("TERM=linux"); putenv("TERM_PROGRAM=GNUstep_Terminal"); execv(cpath,(char *const*)cargs); fprintf(stderr,"Unable to spawn process '%s': %m!",cpath); exit(1); } NSDebugLLog(@"pty",@"forked child %i, fd %i",ret,master_fd); /* Set non-blocking mode for the descriptor. */ flags=fcntl(master_fd,F_GETFL,0); if (flags==-1) { NSLog(_(@"Unable to set non-blocking mode.")); } else { flags|=O_NONBLOCK; fcntl(master_fd,F_SETFL,flags); } rl=[NSRunLoop currentRunLoop]; [rl addEvent: (void *)master_fd type: ET_RDESC watcher: self forMode: NSDefaultRunLoopMode]; [[NSNotificationCenter defaultCenter] postNotificationName: TerminalViewBecameNonIdleNotification object: self]; if (d) { const char *s=[d UTF8String]; close(pipefd[0]); write(pipefd[1],s,strlen(s)); close(pipefd[1]); } DESTROY(title_window); if (args) title_window=[[NSString stringWithFormat: @"%@ %@", path,[args componentsJoinedByString: @" "]] retain]; else title_window=[path copy]; ASSIGN(title_miniwindow,path); [[NSNotificationCenter defaultCenter] postNotificationName: TerminalViewTitleDidChangeNotification object: self]; } -(void) runProgram: (NSString *)path withArguments: (NSArray *)args initialInput: (NSString *)d { [self runProgram: path withArguments: args inDirectory: nil initialInput: d arg0: path]; } -(void) runShell { NSString *arg0; NSString *path; path=[TerminalViewShellPrefs shell]; if ([TerminalViewShellPrefs loginShell]) arg0=[@"-" stringByAppendingString: path]; else arg0=path; [self runProgram: path withArguments: nil inDirectory: nil initialInput: nil arg0: arg0]; } @end /** drag'n'drop support **/ @implementation TerminalView (drag_n_drop) static int handled_mask= NSDragOperationCopy|NSDragOperationPrivate|NSDragOperationGeneric; -(unsigned int) draggingEntered: (id)sender { NSArray *types=[[sender draggingPasteboard] types]; unsigned int mask=[sender draggingSourceOperationMask]; NSDebugLLog(@"dragndrop",@"TerminalView draggingEntered mask=%x types=%@",mask,types); if (mask&handled_mask && ([types containsObject: NSFilenamesPboardType] || [types containsObject: NSStringPboardType])) return NSDragOperationCopy; return 0; } /* TODO: should I really have to implement this? */ -(BOOL) prepareForDragOperation: (id)sender { NSDebugLLog(@"dragndrop",@"preparing for drag"); return YES; } -(BOOL) performDragOperation: (id)sender { NSPasteboard *pb=[sender draggingPasteboard]; NSArray *types=[pb types]; unsigned int mask=[sender draggingSourceOperationMask]; NSDebugLLog(@"dragndrop",@"performDrag %x %@",mask,types); if (!(mask&handled_mask)) return NO; if ([types containsObject: NSFilenamesPboardType]) { NSArray *data; int i,c; data=[pb propertyListForType: NSFilenamesPboardType]; if (!data) data=[NSUnarchiver unarchiveObjectWithData: [pb dataForType: NSFilenamesPboardType]]; c=[data count]; for (i=0;insx) copy_sx=nsx; // NSLog(@"copy %i+%i %i (%ix%i)-(%ix%i)\n",start,num,copy_sx,sx,sy,nsx,nsy); /* TODO: handle resizing and scrollback improve? */ for (iy=-sb_length;iymax_scrollback) sb_length=max_scrollback; if (sb_length<0) sb_length=0; cursor_y = nsy-(sy-cursor_y); sx=nsx; sy=nsy; free(screen); free(sbuf); screen=nscreen; sbuf=nsbuf; [self ts_goto: cursor_x : cursor_y]; [self _updateScroller]; [tp setTerminalScreenWidth: sx height: sy]; if (master_fd!=-1) { ws.ws_row=nsy; ws.ws_col=nsx; ioctl(master_fd,TIOCSWINSZ,&ws); } [self setNeedsDisplay: YES]; } -(void) setFrame: (NSRect)frame { [super setFrame: frame]; [self _resizeTerminalTo: frame.size]; } -(void) setFrameSize: (NSSize)size { [super setFrameSize: size]; [self _resizeTerminalTo: size]; } - initWithFrame: (NSRect)frame { sx=80; sy=25; if (!(self=[super initWithFrame: frame])) return nil; { NSSize s; NSRect r; font=[TerminalViewDisplayPrefs terminalFont]; [font retain]; boldFont=[TerminalViewDisplayPrefs boldTerminalFont]; [boldFont retain]; r=[font boundingRectForFont]; s=[TerminalView characterCellSize]; fx=s.width; fy=s.height; /* TODO: clear up font metrics issues with xlib/backart */ NSLog(@"NSFont %@ info %@ size %g %@ %d", font, [font fontInfo], [font pointSize], NSStringFromRect([font boundingRectForGlyph: 'A']), [font glyphIsEncoded: 'A']); fx0=-r.origin.x; fy0=-r.origin.y; NSDebugLLog(@"term",@"Bounding (%g %g)+(%g %g)",-fx0,-fy0,fx,fy); font_encoding=[font mostCompatibleStringEncoding]; boldFont_encoding=[boldFont mostCompatibleStringEncoding]; NSDebugLLog(@"term",@"encoding %i and %i", font_encoding,boldFont_encoding); } use_multi_cell_glyphs=[TerminalViewDisplayPrefs useMultiCellGlyphs]; blackOnWhite=[TerminalViewDisplayPrefs blackOnWhite]; screen=malloc(sizeof(screen_char_t)*sx*sy); memset(screen,0,sizeof(screen_char_t)*sx*sy); draw_all=2; max_scrollback=[TerminalViewDisplayPrefs scrollBackLines]; sbuf=malloc(sizeof(screen_char_t)*sx*max_scrollback); memset(sbuf,0,sizeof(screen_char_t)*sx*max_scrollback); tp=[[TerminalParser_Linux alloc] initWithTerminalScreen: self width: sx height: sy]; master_fd=-1; [self registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType,NSStringPboardType,nil]]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(viewPrefsDidChange:) name: TerminalViewDisplayPrefsDidChangeNotification object: nil]; return self; } -(void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; [self closeProgram]; DESTROY(tp); [scroller setTarget: nil]; DESTROY(scroller); free(screen); free(sbuf); screen=NULL; sbuf=NULL; DESTROY(font); DESTROY(boldFont); DESTROY(title_window); DESTROY(title_miniwindow); [super dealloc]; } -(NSString *) windowTitle { return title_window; } -(NSString *) miniwindowTitle { return title_miniwindow; } -(NSString *) representedFilename { return title_filename; } -(void) setIgnoreResize: (BOOL)ignore { ignore_resize=ignore; } -(void) setBorder: (CGFloat)x : (CGFloat)y { border_x=x; border_y=y; } +(NSSize) characterCellSize { NSFont *f=[TerminalViewDisplayPrefs terminalFont]; NSSize s; s=[f boundingRectForFont].size; if ([TerminalViewDisplayPrefs useMultiCellGlyphs]) { s.width=[f boundingRectForGlyph: 'A'].size.width; } return s; } +(void) registerPasteboardTypes { NSArray *types=[NSArray arrayWithObject: NSStringPboardType]; [NSApp registerServicesMenuSendTypes: types returnTypes: nil]; } @end Terminal-0.9.9/Terminal.tiff010064400017500000144000000223321264654375400152150ustar multixusersMM*   000$(R~}{z~zy}tvysuxrtwprstswsrvprupqwposonppoqqqqqqqrrrnnnhgi^]_TSUJIK<;?/.0%$(! # #"  " #! "(')76:EDFYXZhgiyyynmo     mop 00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00A00Q00Q00Q lno 00A00A QQqqۮ QAa00A00A00A Q Q00A Q00A Q00A Q00A Q00A Q00A mln 00Q00Q00A00Q00Q00QۮQqq00Qۮ00Q00Qۮ00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q lkm00A00Q00A00Qۮ00QQqqۮ00Qۮ00A Qۮ Q00A Q00A Q00A Q00A Q00A Q00A lkm00Q00A QQqqQqq Q QAa00AQqqۮۮQqq00Q00Q00A00Q00Q00Q00A00Q00A00Q00Q00Qhgi00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00Aihj00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Qedf00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00Adce00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00A00Q00Q00Qbae00A00A QQqqۮ QAa00A00A00A Q Q00A Q00A Q00A Q00A Q00A Q00A^]a00Q00Q00A00Q00Q00QۮQqq00Qۮ00Q00Qۮ00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q[Z^00A00Q00A00Qۮ00QQqqۮ00Qۮ00A Qۮ Q00A Q00A Q00A Q00A Q00A Q00AXW[00Q00A QQqqQqq Q QAa00AQqqۮۮQqq00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00QTSU00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00APOQ00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00QLKM00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A HGI 00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00QFEI00A00A QQqqۮ QAa00A00A00A Q Q00A Q00A Q00A Q00A Q00A Q00A A@D 00Q00Q00A00Q00Q00QۮQqq00Qۮ00Q00Qۮ00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q ?>B 00A00Q00A00Qۮ00QQqqۮ00Qۮ00A Qۮ Q00A Q00A Q00A Q00A Q00A Q00A <;? 00Q00A QQqqQqq Q QAa00AQqqۮۮQqq00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q 98< 00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A 76:|{}00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q00Q 548yxz00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A 326vuw00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00Q00Q00A00Q00A00Q00Q00Q 215utv00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A Q00A 215rqs    /.2rqs/.2rqs/.2qst.-/qst/.0HJK0/1npsmornlsposonpnnnpppmmmmmmlllkkkjjjihjhgifffeeeccaaa____]]][Z\WVXTTTRRPPPPLLLIHJGFHDCEAAA???===;;;999775664555444222111111---/.0/.00/3/.20/1/-4~uuslljbbb\Y\POQGGG@@@666102+*,#%&### vvtmmkbb`ZXYRPQIIG>><867201+*,"$%""" FHKJIMIHJKJNKJLJIKIIIFEGIIIFFFFFDDBC@>?@>?<:;8678672011/.-+**('%%#$$"#!  FEIHGIFEGFHIEEEFFDDDDIIIFDEJHI.,-&#&&#&%#$,*)$$"''%$$"--)$$ %%!%%#ECJFHKNRRGFHEEEFIFNQNGGEFDC331$$$%$(('+333'''%$&(')331%%#OOOCFCGJGFFD$$"%%#$&&,+/$#'#%%|||tsumlnddd^^^TTRNLMEEE Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. Terminal-0.9.9/Spanish.lproj004075500017500000144000000000001264654375500152455ustar multixusersTerminal-0.9.9/Spanish.lproj/Localizable.strings010064400017500000144000000165601264654375500211650ustar multixusers/* Translation by Manuel Teira. */ /*** Spanish.lproj/Localizable.strings updated by make_strings 2003-08-04 16:35:33 +0200 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:653 */ "Command line:" = "L\u00ednea de comando:"; /* File: TerminalViewPrefs.m:233 */ /* File: TerminalViewPrefs.m:238 */ "Display" = "Pantalla"; /* File: TerminalViewPrefs.m:378 */ /* File: TerminalViewPrefs.m:405 */ "Pick font..." = "Elija fuente..."; /* File: TerminalViewPrefs.m:526 */ /* File: TerminalViewPrefs.m:531 */ "Shell" = "Shell"; /* File: TerminalViewPrefs.m:639 */ /* File: TerminalViewPrefs.m:644 */ "Keyboard" = "Teclado"; /* File: TerminalWindow.m:193 */ /* File: TerminalWindow.m:197 */ " (idle)" = " (terminado)"; /*** Unmatched/untranslated keys ***/ /* File: PreferencesWindowController.m:70 */ "Revert" = "Atr\u00e1s"; /* File: PreferencesWindowController.m:78 */ "Apply and save" = "Aplicar y guardar"; /* File: PreferencesWindowController.m:122 */ "Preferences" = "Preferencias"; /* File: Services.m:60 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = "No existe ning\u00fan servicio llamado '%@'.\nSu lista de servicios est\u00e1 probablemente desactualizada.\nEjecute 'make_services' para actualizarla."; /* File: Services.m:152 */ "Service aborted by user." = "Servicio abortado por el usuario."; /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "Cancelar"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "OK"; /* File: ServicesParameterWindowController.m:118 */ "Parameter for service %@" = "Par\u00e1metro para el servicio %@"; /* File: ServicesPrefs.m:235 */ "Unnamed service" = "Servicio sin nombre"; /* File: ServicesPrefs.m:254 */ "Import services" = "Importar servicios"; /* File: ServicesPrefs.m:348 */ "Error importing services" = "Error importando servicios"; /* File: ServicesPrefs.m:349 */ "The file '%@' doesn't contain valid terminal services." = "El fichero '%@' no contiene servicios de terminal v\u00e1lidos."; /* File: ServicesPrefs.m:401 */ "Export services" = "Exportar servicios"; /* File: ServicesPrefs.m:468 */ "Terminal services" = "Servicios de terminal"; /* File: ServicesPrefs.m:473 */ "Terminal\nservices" = "Servicios"; /* File: ServicesPrefs.m:499 */ "Add" = "A\u00f1adir"; /* File: ServicesPrefs.m:507 */ "Remove" = "Borrar"; /* File: ServicesPrefs.m:515 */ "Import..." = "Importar..."; /* File: ServicesPrefs.m:523 */ "Export..." = "Exportar..."; /* File: ServicesPrefs.m:549 */ "Ignore output" = "Ignorar salida"; /* File: ServicesPrefs.m:550 */ "Return output" = "Devolver salida"; /* File: ServicesPrefs.m:558 */ "No input" = "Sin entrada"; /* File: ServicesPrefs.m:559 */ "Input in stdin" = "Entrada por stdin"; /* File: ServicesPrefs.m:560 */ "Input on command line" = "Entrada por l\u00ednea de comandos"; /* File: ServicesPrefs.m:568 */ "Run in background" = "Ejecutar en segundo plano"; /* File: ServicesPrefs.m:569 */ "Run in new window" = "Ejecutar en otra ventana"; /* File: ServicesPrefs.m:570 */ "Run in idle window" = "Ejecutar en ventana inactiva"; /* File: ServicesPrefs.m:585 */ "Accept types" = "Aceptar tipos"; /* File: ServicesPrefs.m:594 */ "Filenames" = "Nombres de fichero"; /* File: ServicesPrefs.m:602 */ "Plain text" = "Texto plano"; /* File: ServicesPrefs.m:627 */ "Name:" = "Nombre:"; /* File: ServicesPrefs.m:640 */ "Key:" = "Clave:"; /* File: TerminalParser_LinuxPrefs.m:40 */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:41 */ "West Europe, latin1" = "Europa Oeste, latin1"; /* File: TerminalParser_LinuxPrefs.m:42 */ "East Europe, latin2" = "Europa del Este, latin2"; /* File: TerminalParser_LinuxPrefs.m:43 */ "Chinese" = "Chino"; /* File: TerminalParser_LinuxPrefs.m:44 */ "Custom, leave unchanged" = "Personalizado, no cambiar"; /* File: TerminalParser_LinuxPrefs.m:103 */ "'linux' terminal parser" = "Parser de terminal 'linux'"; /* File: TerminalParser_LinuxPrefs.m:108 */ "'linux'\nparser" = "parser\n'linux'"; /* File: TerminalParser_LinuxPrefs.m:151 */ "Character set:" = "Juego de caracteres:"; /* File: TerminalView.m:1487 */ "[Process exited]" = "[Proceso terminado]"; /* File: TerminalView.m:1622 */ "Unable to open pipe for input: %m." = "Error al abrir pipe en entrada: %m."; /* File: TerminalView.m:1634 */ "Unable to fork: %m." = "Error en fork: %m."; /* File: TerminalViewPrefs.m:264 */ "Scroll-back length in lines:" = "L\u00edneas de buffer:"; /* File: TerminalViewPrefs.m:287 */ "Cursor" = "Cursor"; /* File: TerminalViewPrefs.m:292 */ "Style:" = "Estilo:"; /* File: TerminalViewPrefs.m:332 */ "Color:" = "Color:"; /* File: TerminalViewPrefs.m:355 */ "Handle wide (multi-cell) glyphs" = "Manejar glyphs multi-celda"; /* File: TerminalViewPrefs.m:366 */ "Bold font:" = "Fuente negrita:"; /* File: TerminalViewPrefs.m:393 */ "Normal font:" = "Fuente normal:"; /* File: TerminalViewPrefs.m:552 */ "Start as login-shell" = "Arrancar como shell de login"; /* File: TerminalViewPrefs.m:564 */ "Shell:" = "Shell:"; /* File: TerminalViewPrefs.m:669 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Interpretar la tecla de comando como meta.\n\nN\u00f3tese que habilitando esta opci\u00f3n\nno podr\u00e1 acceder al men\u00fa\nutilizando el teclado."; /* File: TerminalViewPrefs.m:684 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "Escape se env\u00eda dos veces.\n\nSignifica que la tecla de escape ser\u00e1\nreconocida m\u00e1s r\u00e1pido por algunos programas,\npero no se podr\u00e1 usar como sustituto de 'meta'."; /* File: TerminalWindowPrefs.m:114 */ "Terminal Window" = "Ventana de terminal"; /* File: TerminalWindowPrefs.m:119 */ "Terminal\nWindow" = "Ventana"; /* File: TerminalWindowPrefs.m:152 */ "Close new windows when idle" = "Cerrar ventanas inactivas"; /* File: TerminalWindowPrefs.m:153 */ "Don't close new windows" = "No cerrar ventanas nuevas"; /* File: TerminalWindowPrefs.m:176 */ "Default size" = "Tama\u00f1o por defecto"; /* File: TerminalWindowPrefs.m:180 */ "Width:" = "Ancho:"; /* File: TerminalWindowPrefs.m:189 */ "Height:" = "Alto:"; /* File: TerminalWindowPrefs.m:212 */ "Add top and bottom border" = "A\u00f1adir bordes superior e inferior"; /* File: main.m:154 */ "Info..." = "Informaci\u00f3n..."; /* File: main.m:156 */ "Preferences..." = "Preferencias..."; /* File: main.m:158 */ "Benchmark" = "Benchmark"; /* File: main.m:160 */ "Info" = "Informaci\u00f3n"; /* File: main.m:172 */ "New terminal" = "Nuevo terminal"; /* File: main.m:178 */ "Cut" = "Cortar"; /* File: main.m:181 */ "Copy" = "Copiar"; /* File: main.m:184 */ "Paste" = "Pegar"; /* File: main.m:187 */ "Edit" = "Editar"; /* File: main.m:192 */ "Close" = "Cerrar"; /* File: main.m:195 */ "Windows" = "Ventanas"; /* File: main.m:200 */ "Services" = "Servicios"; /* File: main.m:204 */ "Hide" = "Ocultar"; /* File: main.m:208 */ "Quit" = "Salir"; /* File: main.m:256 */ "Quit?" = "\u00bfSalir?"; /* File: main.m:257 */ "There are active windows. Quitting will close them." = "Hay ventanas activas. Al salir se cerrar\u00e1n."; /* File: main.m:258 */ "Don't quit" = "No salir"; /* File: main.m:259 */ "Quit anyway" = "Salir de todos modos"; Terminal-0.9.9/autokeyviewchain.m010064400017500000144000000034711264654375400163300ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #include #include #include #include "autokeyviewchain.h" @implementation NSWindow (autokeyviewchain) -(void) autoSetupKeyViewChain { NSView *v=[self contentView]; [self setInitialFirstResponder: [v autoSetupKeyViewChain: nil]]; /* { NSView *v=[self initialFirstResponder]; printf("window %p initial=%p\n",self,v); for (;v;v=[v nextKeyView]) { printf(" '%@'\n",v); } }*/ } @end /* just to get rid of warnings */ #include #include @implementation NSView (autokeyviewchain) -(NSView *) autoSetupKeyViewChain: (NSView *) next { if ([self acceptsFirstResponder]) { [self setNextKeyView: next]; next=self; } /* use NSScrollView to get rid of warning */ if ([self respondsToSelector: @selector(documentView)]) next=[[(NSScrollView *)self documentView] autoSetupKeyViewChain: next]; else if ([self respondsToSelector: @selector(contentView)]) next=[[(NSScrollView *)self contentView] autoSetupKeyViewChain: next]; return next; } @end #include @implementation GSTable (autokeyviewchain) -(NSView *) autoSetupKeyViewChain: (NSView *) next { int i,j; NSView *v; for (i=0;i<_numberOfRows;i++) { for (j=_numberOfColumns-1;j>=0;j--) { if (_jails[i*_numberOfColumns+j]) { v=[[(NSView *)_jails[i*_numberOfColumns+j] subviews] objectAtIndex: 0]; next=[v autoSetupKeyViewChain: next]; } } } return next; } @end Terminal-0.9.9/cursor_line.tiff010064400017500000144000000026241264654375400157700ustar multixusersMM*  (08H08H08H08H08H08H08HTerminal-0.9.9/Hungarian.lproj004075500017500000144000000000001264654375500155545ustar multixusersTerminal-0.9.9/Hungarian.lproj/Localizable.strings010064400017500000144000000204711264654375500214700ustar multixusers/* - * - * * Hungarian translation by Varga P\u00e9ter * - * - */ /*** English.lproj/Localizable.strings updated by make_strings 2002-12-09 18:39:08 +0100 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:653 */ "Command line:" = "Parancssor:"; /*** Strings from PreferencesWindowController.m ***/ /* File: PreferencesWindowController.m:78 */ "Apply and save" = "Alkalmaz \u00e9s ment"; /* File: PreferencesWindowController.m:122 */ "Preferences" = "Be\u00e1ll\u00edt\u00e1sok"; /* File: PreferencesWindowController.m:70 */ "Revert" = "Vissza\u00e1ll\u00edt"; /*** Strings from Services.m ***/ /* File: Services.m:152 */ "Service aborted by user." = "A szolg\u00e1ltat\u00e1st a felhaszn\u00e1l\u00f3 f\u00e9lbeszak\u00edtotta."; /* File: Services.m:60 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = "Nincs '%@' nev\u00fc termin\u00e1lszolg\u00e1ltat\u00e1s.\nA lista val\u00f3sz\u00edn\u00fcleg elavult..\nFuttatsd a 'make_services'-t a friss\u00edt\u00e9s\u00e9hez."; /*** Strings from ServicesParameterWindowController.m ***/ /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "Vissza"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "OK"; /* File: ServicesParameterWindowController.m:118 */ "Parameter for service %@" = "%@ szolg\u00e1ltat\u00e1s param\u00e9tere"; /*** Strings from ServicesPrefs.m ***/ /* File: ServicesPrefs.m:585 */ "Accept types" = "Enged\u00e9lyezett t\u00edpusok"; /* File: ServicesPrefs.m:499 */ "Add" = "Hozz\u00e1ad"; /* File: ServicesPrefs.m:348 */ "Error importing services" = "Hiba a szolg\u00e1ltat\u00e1sok import\u00e1l\u00e1sakor"; /* File: ServicesPrefs.m:401 */ "Export services" = "Szolg\u00e1ltat\u00e1sok export\u00e1l\u00e1sa"; /* File: ServicesPrefs.m:523 */ "Export..." = "Export..."; /* File: ServicesPrefs.m:594 */ "Filenames" = "File-nevek"; /* File: ServicesPrefs.m:549 */ "Ignore output" = "Output figyelmen k\u00edv\u00fcl hagy\u00e1sa"; /* File: ServicesPrefs.m:254 */ "Import services" = "Szolg\u00e1ltat\u00e1sok import\u00e1l\u00e1sa"; /* File: ServicesPrefs.m:515 */ "Import..." = "Import..."; /* File: ServicesPrefs.m:559 */ "Input in stdin" = "Input az stdin-r\u00f6l"; /* File: ServicesPrefs.m:560 */ "Input on command line" = "Input a parancssorbol"; /* File: ServicesPrefs.m:640 */ "Key:" = "Kulcs:"; /* File: ServicesPrefs.m:627 */ "Name:" = "N\u00e9v:"; /* File: ServicesPrefs.m:558 */ "No input" = "Nincs input"; /* File: ServicesPrefs.m:602 */ "Plain text" = "Plaintext"; /* File: ServicesPrefs.m:507 */ "Remove" = "T\u00f6r\u00f6l"; /* File: ServicesPrefs.m:550 */ "Return output" = "Output-ot ad"; /* File: ServicesPrefs.m:568 */ "Run in background" = "V\u00e9grehajt\u00e1s h\u00e1tt\u00e9rben"; /* File: ServicesPrefs.m:570 */ "Run in idle window" = "V\u00e9grehajt\u00e1s szabad ablakban"; /* File: ServicesPrefs.m:569 */ "Run in new window" = "V\u00e9grehajt\u00e1s \u00faj ablakban"; /* File: ServicesPrefs.m:468 */ "Terminal services" = "Termin\u00e1lszolg\u00e1ltat\u00e1sok"; /* File: ServicesPrefs.m:473 */ "Terminal\nservices" = "Termin\u00e1l-\nszolg\u00e1ltat\u00e1sok"; /* File: ServicesPrefs.m:349 */ "The file '%@' doesn't contain valid terminal services." = "A '%@'-ban nincsenek \u00e9rv\u00e9nyes termin\u00e1lszolg\u00e1ltat\u00e1sok."; /* File: ServicesPrefs.m:235 */ "Unnamed service" = "Ismeretlen szolg\u00e1ltat\u00e1s"; /*** Strings from TerminalParser_LinuxPrefs.m ***/ /* File: TerminalParser_LinuxPrefs.m:103 */ "'linux' terminal parser" = "'linux' terminal parser"; /* File: TerminalParser_LinuxPrefs.m:108 */ "'linux'\nparser" = "'linux'\nparser"; /* File: TerminalParser_LinuxPrefs.m:151 */ "Character set:" = "Karakterk\u00e9szlet:"; /* File: TerminalParser_LinuxPrefs.m:43 */ "Chinese" = "K\u00ednai"; /* File: TerminalParser_LinuxPrefs.m:44 */ "Custom, leave unchanged" = "Saj\u00e1t, ne v\u00e1ltoztass rajta"; /* File: TerminalParser_LinuxPrefs.m:42 */ "East Europe, latin2" = "Kelet-Eur\u00f3pa, latin2"; /* File: TerminalParser_LinuxPrefs.m:40 */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:41 */ "West Europe, latin1" = "Nyugat-Eur\u00f3pa, latin1"; /*** Strings from TerminalView.m ***/ /* File: TerminalView.m:1623 */ "Unable to fork: %m." = "Nem ind\u00edthat\u00f3: %m."; /* File: TerminalView.m:1611 */ "Unable to open pipe for input: %m." = "A %m pipe nem olvashat\u00f3."; /* File: TerminalView.m:1476 */ "[Process exited]" = "[A program kil\u00e9pett]"; /*** Strings from TerminalViewPrefs.m ***/ /* File: TerminalViewPrefs.m:330 */ "Bold font:" = "F\u00e9lk\u00f6v\u00e9r bet\u00fc:"; /* File: TerminalViewPrefs.m:298 */ "Color:" = "Sz\u00edn:"; /* File: TerminalViewPrefs.m:277 */ "Cursor" = "Kurzor"; /* File: TerminalViewPrefs.m:230 */ /* File: TerminalViewPrefs.m:225 */ "Display" = "K\u00e9rerny\u00f6"; /* File: TerminalViewPrefs.m:291 */ "Filled block" = "Teli n\u00e9gyzet"; /* File: TerminalViewPrefs.m:319 */ "Handle wide (multi-cell) glyphs" = "Kezeld a sz\u00e9les (t\u00f6bb karakternyi) \u00edr\u00e1sjeleket"; /* File: TerminalViewPrefs.m:292 */ "Inverted block" = "Inverz n\u00e9gyzet"; /* File: TerminalViewPrefs.m:607 */ /* File: TerminalViewPrefs.m:602 */ "Keyboard" = "Billenty\u00fczet"; /* File: TerminalViewPrefs.m:289 */ "Line" = "Cs\u00edk"; /* File: TerminalViewPrefs.m:357 */ "Normal font:" = "Norm\u00e1l bet\u00fc:"; /* File: TerminalViewPrefs.m:369 */ /* File: TerminalViewPrefs.m:342 */ "Pick font..." = "V\u00e1lassz bet\u00fct\u00edpust..."; /* File: TerminalViewPrefs.m:255 */ "Scroll-back length in lines:" = "Visszag\u00f6rgethet\u00f6 sorok:"; /* File: TerminalViewPrefs.m:651 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "K\u00fcldj dupla ESC-et ha lenyomom az ESC billenty\u00fct.\n\n\u00cdgy az legt\u00f6bb program hamarabb reag\u00e1l az ESC-gombra,\nde\nnem haszn\u00e1lhatod a Meta (Alt) helyett."; /* File: TerminalViewPrefs.m:492 */ /* File: TerminalViewPrefs.m:487 */ "Shell" = "Shell"; /* File: TerminalViewPrefs.m:527 */ "Shell:" = "Shell:"; /* File: TerminalViewPrefs.m:515 */ "Start as login-shell" = "Ind\u00edt\u00e1s login-shell-k\u00e9nt"; /* File: TerminalViewPrefs.m:290 */ "Stroked block" = "Szeg\u00e9lyezett n\u00e9gyzet"; /* File: TerminalViewPrefs.m:282 */ "Style:" = "St\u00edlus:"; /* File: TerminalViewPrefs.m:634 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Kezeld a 'command' (Alt) gombot Meta-k\u00e9nt.\n\nHa ezt enged\u00e9lyezed,\nnem fogod tudni el\u00e9rni\na men\u00fct a billenty\u00fczetr\u00f6l."; /*** Strings from TerminalWindow.m ***/ /* File: TerminalWindow.m:192 */ /* File: TerminalWindow.m:188 */ " (idle)" = " (idle)"; /*** Strings from TerminalWindowPrefs.m ***/ /* File: TerminalWindowPrefs.m:192 */ "Add top and bottom border" = "Fels\u00f6 \u00e9s als\u00f3 szeg\u00e9ly"; /* File: TerminalWindowPrefs.m:143 */ "Close new windows when idle" = "Z\u00e1rd be az \u00faj ablakokat ha felszabadulnak"; /* File: TerminalWindowPrefs.m:156 */ "Default size" = "Alap\u00e9rtelmezett m\u00e9ret"; /* File: TerminalWindowPrefs.m:144 */ "Don't close new windows" = "Ne z\u00e1rd be az \u00faj ablakokat"; /* File: TerminalWindowPrefs.m:169 */ "Height:" = "Magass\u00e1g:"; /* File: TerminalWindowPrefs.m:112 */ "Terminal Window" = "Termin\u00e1lablak"; /* File: TerminalWindowPrefs.m:117 */ "Terminal\nWindow" = "Termin\u00e1l-\nablak"; /* File: TerminalWindowPrefs.m:160 */ "Width:" = "Sz\u00e9less\u00e9g:"; /*** Strings from main.m ***/ /* File: main.m:157 */ "Benchmark" = "Benchmark"; /* File: main.m:191 */ "Close" = "Bez\u00e1r"; /* File: main.m:180 */ "Copy" = "M\u00e1sol"; /* File: main.m:177 */ "Cut" = "Kiv\u00e1g"; /* File: main.m:186 */ "Edit" = "Szerkeszt"; /* File: main.m:203 */ "Hide" = "Elrejt"; /* File: main.m:159 */ "Info" = "Inf\u00f3"; /* File: main.m:153 */ "Info..." = "Inf\u00f3..."; /* File: main.m:171 */ "New terminal" = "\u00daj termin\u00e1l"; /* File: main.m:183 */ "Paste" = "Beilleszt"; /* File: main.m:155 */ "Preferences..." = "Be\u00e1ll\u00edt\u00e1sok..."; /* File: main.m:207 */ "Quit" = "Kil\u00e9p"; /* File: main.m:199 */ "Services" = "Szolg\u00e1ltat\u00e1sok"; /* File: main.m:194 */ "Windows" = "Ablakok"; Terminal-0.9.9/TerminalInfo.plist010064400017500000144000000011101314032331200161730ustar multixusers{ ApplicationDescription = "A Terminal Emulator"; ApplicationIcon = Terminal; ApplicationName = Terminal; ApplicationRelease = "0.9.9"; ApplicationURL = "http://gap.nongnu.org/terminal/index.html"; Authors = ("Alexander Malmberg ","Gregory Casamento ","Riccardo Mottola "); Copyright = "Copyright \u00a9 2002-2003, 2009-2017"; CopyrightDescription = "Released under the GNU GPL v2. See COPYING for details."; FullVersionID = "0.9.9"; CFBundleIdentifier = org.gap.Terminal; } Terminal-0.9.9/GNUmakefile010064400017500000144000000044441314032322100146150ustar multixusers# copyright 2002-2003 Alexander Malmberg # copyright 2008-2017 Riccardo Mottola # # This file is a part of Terminal.app. Terminal.app is free software; you # can redistribute it and/or modify it under the terms of the GNU General # Public License as published by the Free Software Foundation; version 2 # of the License. See COPYING or main.m for more information. ifeq ($(GNUSTEP_MAKEFILES),) GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null) ifeq ($(GNUSTEP_MAKEFILES),) $(warning ) $(warning Unable to obtain GNUSTEP_MAKEFILES setting from gnustep-config!) $(warning Perhaps gnustep-make is not properly installed,) $(warning so gnustep-config is not in your PATH.) $(warning ) $(warning Your PATH is currently $(PATH)) $(warning ) endif endif ifeq ($(GNUSTEP_MAKEFILES),) $(error You need to set GNUSTEP_MAKEFILES before compiling!) endif include $(GNUSTEP_MAKEFILES)/common.make APP_NAME = Terminal PACKAGE_NAME = Terminal VERSION = 0.9.9 # Useful warnings: # -W -Wformat=2 -Wno-sign-compare -Wpointer-arith \ # -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes \ # -Wmissing-prototypes -Wmissing-declarations \ # -Wnested-externs -Wno-unused-parameter Terminal_OBJC_FILES = \ main.m \ \ Services.m \ ServicesPrefs.m \ ServicesParameterWindowController.m \ \ TerminalWindow.m \ TerminalWindowPrefs.m \ \ TerminalView.m \ TerminalViewPrefs.m \ \ TerminalParser_Linux.m \ TerminalParser_LinuxPrefs.m \ \ PreferencesWindowController.m \ autokeyviewchain.m \ \ Label.m ifeq ($(findstring solaris, $(GNUSTEP_TARGET_OS)), solaris) Terminal_TOOL_LIBS += -liconv else ifeq ($(findstring freebsd, $(GNUSTEP_TARGET_OS)), freebsd) Terminal_TOOL_LIBS += -liconv endif Terminal_TOOL_LIBS += -lutil endif Terminal_LOCALIZED_RESOURCE_FILES = Localizable.strings Terminal_LANGUAGES = English Swedish German French Spanish Hungarian Turkish \ Norwegian Russian Italian Terminal_APPLICATION_ICON = Terminal.tiff Terminal_RESOURCE_FILES = \ Terminal.tiff DefaultTerminalServices.svcs \ cursor_line.tiff cursor_stroked.tiff cursor_filled.tiff \ cursor_inverted.tiff TerminalInfo.plist MAKE_STRINGS_OPTIONS = --aggressive-match --aggressive-remove include $(GNUSTEP_MAKEFILES)/application.make Terminal-0.9.9/ChangeLog010064400017500000144000000132101302606323300143130ustar multixusers2016-10-21 Ray Haleblian * TerminalView.m Draw border according to the black or white settings. 2016-05-29 Riccardo Mottola * TerminalWindow.m Remove view from contentView and put it into Tab Item and vice-versa. 2016-05-26 Riccardo Mottola * TerminalWindow.h * TerminalWindow.m Use isShowingTabs to know if tab is displayed and optimize content view setting. 2016-05-20 Riccardo Mottola * TerminalWindow.m Check that view actually gets found. 2016-05-20 Riccardo Mottola * TerminalView.h * TerminalView.m * TerminalWindow.m Transition to CGFloat 2016-05-19 Riccardo Mottola * TerminalView.m attempt to handle vertical resize and cursor placement better 2016-03-12 Riccardo Mottola * English.lproj/Localizable.strings * TerminalWindow.h * TerminalWindow.m * main.m * Services.m Add tab support. Adaptation of patch by Tim Sheridan 2016-03-01 Riccardo Mottola * French.lproj/Localizable.string Enhanced French localizations. 2014-09-09 Gregory John Casamento * TerminalParser_Linux.m: Add case to handle escape code. * TerminalView.h: Add representedFilename * TerminalView.m: Add methods. * TerminalWindow.m: Add code to call setRepresentedFilename on terminal window. 2014-09-09 Riccardo Mottola * TerminalViewPrefs.m Do not use isa pointer. 2014-01-05 Riccardo Mottola * ServicesPrefs.h Adopt NSTableViewDelegate protocol to fix warning. 2013-02-17 Riccardo Mottola * Terminal.h * TerminalView.m Method name cleanup. 2013-02-13 Riccardo Mottola * main.m Fix memory leak. 2013-02-12 Riccardo Mottola * TerminalView.m Free up memory in case of error. 2013-02-12 Riccardo Mottola * ServicesPrefs.m NSInteger transition * TerminalView.m Warning fixes 2013-01-24 Riccardo Mottola * main.m Fix warning due to missing import. 2012-04-03 Riccardo Mottola * TerminalView.m Fix GNU/HURD includes. 2012-03-28 Sebastian Reitenbach * TerminalView.m Fix warnings on 64Bit systems, cast from integer to pointer of different size 2012-03-27 Riccardo Mottola * TerminalView.m Fix OpenBSD includes. 2012-03-26 Riccardo Mottola * PreferencesWindowController.m Use NSUInteger as Index. 2012-03-26 Riccardo Mottola * PreferencesWindowController.[h,m] Clean up imports 2012-03-07 Riccardo Mottola * GNUmakefile: Use TOOL_LIBS instead of LDFLAGS to link the framework library. 2011-12-04 Riccardo Mottola * TerminalParser_Linux.m * TerminalViewPrefs.h * TerminalViewPrefs.m Add Alt is not Meta option, to enable the usage of AltGr, when left Alt is command. 2011-05-07 Riccardo Mottola * Terminal.tiff * cursor_filled.tiff * cursor_inverted.tiff * cursor_line.tiff * cursor_stroked.tiff Set resolution to 72 dpi screen. 2010-12-14 Riccardo Mottola * main.m: hide ordered out quit panel from windows menu 2010-05-14 04:37-EDT Gregory John Casamento * TerminalView.m: Correct sign issues with some pointer casts. 2010-05-14 Riccardo Mottola * ServicesPrefs.m: Added missing import * TerminalView.m: initialize to avoid warnings. 2010-03-26 Riccardo Mottola * ServicesPrefs.m, TerminalParser_Linux.m, TerminalParser_LinuxPrefs.m, TerminalViewPrefs.m: updated imports 2010-01-16 Riccardo Mottola * Italian.lproj/Localizable.strings, GNUMakefile: added italian translation, revised version of the draft provided by Guido Agostini 2009-12-24 Riccardo Mottola * PreferencesWindowController.m : correct invocation signature 2009-10-24 Riccardo Mottola * PreferencesWindowController.m : simplify methodSignatureForSelector according to David Chisnall 2009-10-20 Riccardo Mottola * main.m : regenerate services plist on startup * TerminalViewPrefs.m : remove hack about return type no longer needed 2009-08-05 Richard Frith-Macdonald * TerminalView.h * TerminalView.m * TerminalViewPrefs.h * TerminalViewPrefs.m Implementd Black on White text and its preference setting. 2009-05-27 Riccardo Mottola * TerminalParser_Linux.m: imported a patch by Jeff Teunissen, Backbone: Terminal interpreted certain UTF-8 code sequences wrong, like e2 95 9b (U+255B, which the bug transforms into e2 95 94). It turns out that it's due to the Linux console emulation, which interprets the 0x9b character (CSI, which is ESC with the high order bit set) to begin a control command. Change the terminal emulation to only switch into command scanning mode if we aren't in the middle of a multi-byte character (that is, if iconv says it's not done processing the current character 0x9b is just a byte to be consumed). This is the only 8-bit character that the console treats specially, so this should be a complete fix. 2009-05-15 17:35-EDT Gregory John Casamento * GNUmakefile: Added plist to makefile. * TerminalInfo.plist: Updated information in plist. 2009-01-02 Riccardo Mottola * TerminalView.m: OpenBSD portability 2009-01-01 Riccardo Mottola * TerminalView.m: ForkPty and OpenPty replacements 2008-07-12 Riccardo Mottola * TerminalView.m: Remove font metric hack for xlib and art backend (after fixes in backend, requires backend date 12 July 2008). Patch by Fred Kiefer Terminal-0.9.9/TerminalViewPrefs.h010064400017500000144000000033251272125353100163310ustar multixusers/* copyright 2002, 2003 Alexander Malmberg 2009-2011 GNUstep Application Project (Riccardo Mottola) This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef TerminalViewPrefs_h #define TerminalViewPrefs_h #import "PrefBox.h" @class NSString,NSFont,NSColor; @class GSVbox,NSTextField,NSColorWell,NSMatrix; extern NSString *TerminalViewDisplayPrefsDidChangeNotification; @interface TerminalViewDisplayPrefs : NSObject { GSVbox *top; NSTextField *f_terminalFont,*f_boldTerminalFont; NSColorWell *w_cursorColor; NSMatrix *m_cursorStyle; NSTextField *f_scrollBackLines; NSButton *b_useMultiCellGlyphs; NSButton *b_blackOnWhite; NSTextField *f_cur; } +(NSFont *) terminalFont; +(NSFont *) boldTerminalFont; +(BOOL) useMultiCellGlyphs; +(BOOL) blackOnWhite; +(const float *) brightnessForIntensities; +(const float *) saturationForIntensities; #define CURSOR_LINE 0 #define CURSOR_BLOCK_STROKE 1 #define CURSOR_BLOCK_FILL 2 #define CURSOR_BLOCK_INVERT 3 +(int) cursorStyle; +(NSColor *) cursorColor; +(int) scrollBackLines; @end @interface TerminalViewShellPrefs : NSObject { GSVbox *top; NSTextField *tf_shell; NSButton *b_loginShell; } +(NSString *) shell; +(BOOL) loginShell; @end @interface TerminalViewKeyboardPrefs : NSObject { GSVbox *top; NSButton *b_commandAsMeta; NSButton *b_doubleEscape; NSButton *b_altIsNotMeta; } +(BOOL) commandAsMeta; +(BOOL) altIsNotMeta; +(BOOL) doubleEscape; @end #endif Terminal-0.9.9/PrefBox.h010064400017500000144000000022101264654375500143000ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef PrefBox_h #define PrefBox_h @class NSView,NSButton,NSString; @protocol PrefBox -(void) setupButton: (NSButton *)b; /* Called when the PrefBox is added to a preferences panel. It should add a label or an image or something to the button. */ -(void) willHide; /* Called just before another PrefBox will be displayed if this one is currently displayed.*/ -(NSView *) willShow; /* Called before this PrefBox will be displayed. Should return the top-level NSView that should be displayed. (This view should probably be cached, but creating it on demand is nice.) */ -(void) save; -(void) revert; /* Called on all PrefBox:s when the user clicks the save or revert button. */ -(NSString *) name; /* Return the name that is displayed in the header of the NSBox when this PrefBox is displayed. */ @end #endif Terminal-0.9.9/TerminalParser_LinuxPrefs.h010064400017500000144000000012571272125353100200340ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef TerminalParser_LinuxPrefs_h #define TerminalParser_LinuxPrefs_h #import "PrefBox.h" @class GSVbox,NSPopUpButton; extern NSString *TerminalParser_LinuxPrefsDidChangeNotification; @interface TerminalParser_LinuxPrefs : NSObject { GSVbox *top; NSPopUpButton *pb_characterSet; } +(const char *) characterSet; @end #endif Terminal-0.9.9/TerminalParser_Linux.h010064400017500000144000000031021272125353100170230ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ /* parses escape sequences for 'TERM=linux' */ #ifndef LinuxParser_h #define LinuxParser_h #include #import "Terminal.h" @interface TerminalParser_Linux : NSObject { id ts; int width,height; unsigned int tab_stop[8]; int x,y; int top,bottom; unsigned int unich; int utf_count; unsigned char input_buf[16]; int input_buf_len; #define TITLE_BUF_SIZE 255 char title_buf[TITLE_BUF_SIZE+1]; int title_len, title_type; enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, ESpalette, EStitle_semi, EStitle_buf } ESstate; int vc_state; unsigned char decscnm,decom,decawm,deccm,decim; unsigned char ques; unsigned char charset,utf,disp_ctrl,toggle_meta; int G0_charset,G1_charset; const unichar *translate; unsigned int intensity,underline,reverse,blink; unsigned int color,def_color; #define foreground (color & 0x0f) #define background (color & 0xf0) screen_char_t video_erase_char; #define NPAR 16 int npar; int par[NPAR]; int saved_x,saved_y; unsigned int s_intensity,s_underline,s_blink,s_reverse,s_charset,s_color; int saved_G0,saved_G1; iconv_t iconv_state; iconv_t iconv_input_state; } @end #endif Terminal-0.9.9/DefaultTerminalServices.svcs010064400017500000144000000040571264654375500202610ustar multixusers{ Description = "Default terminal services"; TerminalServices = { "Arithmetic Calculation" = { Commandline = "echo \"%s\" | bc"; Input = 2; Key = ""; ReturnData = 1; Type = 0; }; "Define word" = { AcceptTypes = 1; Commandline = "dict \"%s\""; Input = 2; Key = "="; ReturnData = 0; Type = 2; }; "Fetch URL" = { AcceptTypes = 1; Commandline = "cd ~; wget \"%s\""; Input = 2; Key = ""; ReturnData = 0; Type = 2; }; "Count lines" = { Commandline = "wc -l"; Input = 1; Key = ""; ReturnData = 1; Type = 0; }; "Count words" = { Commandline = wc; Input = 1; Key = ""; ReturnData = 1; Type = 0; }; "Open shell here" = { AcceptTypes = 3; Commandline = "cd \"%s\" && exec $SHELL"; Input = 2; Key = ""; ReturnData = 0; Type = 1; }; "Four-space hard tabs" = { Commandline = "expand | unexpand -t4"; Input = 1; Key = ""; ReturnData = 1; Type = 0; }; "Sort lines" = { Commandline = sort; Input = 1; Key = ""; ReturnData = 1; Type = 0; }; Time = { Commandline = date; Input = 0; Key = ""; ReturnData = 1; Type = 0; }; "Wrap and reply" = { Commandline = "fmt -w 70 | sed -e \"s/^/> /\""; Input = 1; Key = ""; ReturnData = 1; Type = 0; }; "Wrap to 72 Columns" = { Commandline = "fmt -w 72"; Input = 1; Key = ""; ReturnData = 1; Type = 0; }; bunzip2 = { AcceptTypes = 2; Commandline = "bunzip2 %s"; Input = 2; Key = ""; ReturnData = 0; Type = 0; }; bzip2 = { AcceptTypes = 2; Commandline = "bzip2 %s"; Input = 2; Key = ""; ReturnData = 0; Type = 0; }; gunzip = { AcceptTypes = 2; Commandline = "gunzip %s"; Input = 2; Key = ""; ReturnData = 0; Type = 0; }; gzip = { AcceptTypes = 2; Commandline = "gzip %s"; Input = 2; Key = ""; ReturnData = 0; Type = 0; }; }; }Terminal-0.9.9/README010064400017500000144000000161031264654375500134500ustar multixusersTerminal.app - copyright (c) 2002 Alexander Malmberg OpenPty and ForkPty replacements written by Riccardo Mottola, 2005-2008 a terminal emulator for GNUstep This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. Installing ---------- You'll need gnustep-base and gnustep-gui (or possibly some other openstep-like system). The pty code is known to work on GNU/Linux and FreeBSD and NetBSD. Pty code replacement is provided and used by default on Solaris, where it is known to work. On other operating systems you might want to define USE_FORKPTY_REPLACEMENT in TerminalView.m Reports and/or patches for other systems are welcome. To build, run 'make'. To install, run 'make install'. (All the usual gnustep-make options apply.) Running ------- Run it just like you'd run any other GNUstep application, eg.: openapp Terminal.app An empty window with a shell will be opened when the program starts, unless you gave it a command on the command line, in which case that command will be run in the opened window. Fonts ----- You can change the fonts used for normal and bold text in the preferences panel. Terminal.app will get the metrics for the character cells from the normal font, so this font really should be a fixed pitch font or things will look messed up. The bold font should closely match the normal font. (Terminal.app assumes that all characters, bold and normal, stay inside the normal font's bounding box. If they don't, there will be visual glitches. However, it is more common that a non-fixed pitch font's bounding box is very large (since it needs to enclose _all_ characters in the font), so that the terminal window will be very wide.) Keys ---- By default, the command key is used to access key equivalents for menu entries, and thus can't be used as a meta key in the terminal. If you have command mapped to the key you want to use as meta, you can enable 'Treat the command key as meta' in the preferences panel. However, this will disable all key equivalents in Terminal.app. The 'proper' solution to this problem is to remap the command key (and possibly alternate key). The alternate key will always be treated as meta. Often, the escape key can be used to emulate a meta key. This means that in some programs, you might have to press escape twice to get a 'real' escape, or there will be a delay before it is handled. The 'Send a double escape...' option causes Terminal.app to send a double escape when you hit the escape key (ie. "\e\e"), which should work better (but you can no longer use the escape key as meta). Terminal services ----------------- Terminal.app can provide services for other applications by piping the selection through arbitrary commands. Services are configured in one of the preferences panel's tabs. The first time you open this tab, a default set of services will be loaded. They are automatically added the first time so that they appear in the services menu. This will also run make_services to update the services list, but it may take up to 30 seconds for running applications to notice the change. The 'Add' and 'Remove' buttons add and remove services. Using the 'Export' button it is possible to save a set of services to a file. These files can be imported using the 'Import' button, so it is possible for users to share terminal services definitions. The extension of the file should be '.svcs'. The default set of services is such a file located in the application wrapper's resource directory. If you import a service with the same name as an existing service, and they aren't identical, the new one will be renamed to avoid a conflict. Name This is the name of the service as it appears in the services menu. By default, terminal services will be placed in a 'Terminal' submenu of the Services menu, but you can override this by giving the name a leading '/'. In this case, you can also use a second '/' to create your own submenus. (gnustep-gui doesn't support submenus of submenus, though.) Names must be unique. Key The key equivalent for this command, if any. Note that if an application uses this key for some other menu entry, the key will activate that menu entry, not the service. Command line The command line. It is passed to /bin/sh, so any shell commands will work, and arguments may have to be quoted. A '%p' in the command line will cause a prompt to be brought up when the service is run. If input is to be placed on the command line, you can mark the place to put it at with '%s' (otherwise it will be appended to the command line). You can use '%%' to get a real '%'. Run in background/new window/idle window If a service is set to run in the background, the command will have to complete before the service will return, and the service can return output. Otherwise, the command's output will appear in a window. 'new window' causes a completely new window to be opened (and it will close automatically when the command is completed if that option is set). 'idle window' causes Terminal.app to try to reuse an existing idle window. If there is no such window it will open a new window (and that window won't close automatically). Ignore/return output (only applies to background services) If set to ignore, the output of the command will be discarded. Otherwise, it will be parsed to a string or a bunch of filenames, depending on the acceptable types. The output is assumed to be utf8 encoded. No input/Input in stdin/Input on command line If set to 'No input', the service won't accept any input. Otherwise it is necessary to select something to run it, and the selection will be either piped to the command ('in stdin') or placed on the service's command line (either at the '%s' or at the end, see above). Input will be sent to the command utf8 encoded. Accept types Plain text will be sent verbatim to the command. A list of filenames (possibly just one) will be sent separated by ' ':s (if on the command line), or newlines (if in stdin). Terminal emulation ------------------ The terminal emulation code is based on Linux's console code, and nearly all parts of it are handled. Thus, the TERM environment variable is set to 'linux'. Additionally, 'vt100', 'vt220', 'xterm', and others similar to these should mostly work. To distinguish Terminal.app from a 'real' linux console, the environment variable TERM_PROGRAM is set to 'GNUstep_Terminal'. The xterm extensions for setting the window's title are also supported. You set the title using: '\033]'+0, 1, or 2+';'+the title+'\007' 1 sets the miniwindow title, 2 sets the window title, and 0 sets both. Example (from Jeff Teunissen): export PROMPT_COMMAND='echo -ne "\033]2;Terminal - ${HOSTNAME}:${PWD}\007"' (The terminal emulation code is fairly modular. If you want to write a terminal emulation class for some other terminal, contact me and I'll do the remaining cleanups necessary to load terminal emulation classes from bundles.) Terminal-0.9.9/Russian.lproj004075500017500000144000000000001264654375500152645ustar multixusersTerminal-0.9.9/Russian.lproj/Localizable.strings010064400017500000144000000217331264654375500212020ustar multixusers /* Translated by Dmitriy Kostiuk . */ /*** Russian.lproj/Localizable.strings updated by make_strings 2002-12-09 18:39:08 +0100 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:653 */ "Command line:" = "Командная строка:"; /*** Strings from PreferencesWindowController.m ***/ /* File: PreferencesWindowController.m:78 */ "Apply and save" = "Применить и сохранить"; /* File: PreferencesWindowController.m:122 */ "Preferences" = "Настройки"; /* File: PreferencesWindowController.m:70 */ "Revert" = "Восстановить"; /*** Strings from Services.m ***/ /* File: Services.m:152 */ "Service aborted by user." = "Сервис отменен пользователем."; /* File: Services.m:60 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = "Нет сервиса терминала с именем '%@'.\nВероятно, ваш список сервисов устарел.\nВыполните 'make_services' для его обновления."; /*** Strings from ServicesParameterWindowController.m ***/ /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "Отмена"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "OK"; /* File: ServicesParameterWindowController.m:118 */ "Parameter for service %@" = "Параметр для сервиса %@"; /*** Strings from ServicesPrefs.m ***/ /* File: ServicesPrefs.m:585 */ "Accept types" = "Принимать"; /* File: ServicesPrefs.m:499 */ "Add" = "Добавить"; /* File: ServicesPrefs.m:348 */ "Error importing services" = "Ошибка импорта сервисов"; /* File: ServicesPrefs.m:401 */ "Export services" = "Экспорт сервисов"; /* File: ServicesPrefs.m:523 */ "Export..." = "Экспорт..."; /* File: ServicesPrefs.m:594 */ "Filenames" = "Имена файлов"; /* File: ServicesPrefs.m:549 */ "Ignore output" = "Игнорировать вывод"; /* File: ServicesPrefs.m:254 */ "Import services" = "Импорт сервисов"; /* File: ServicesPrefs.m:515 */ "Import..." = "Импорт..."; /* File: ServicesPrefs.m:559 */ "Input in stdin" = "Ввод из stdin"; /* File: ServicesPrefs.m:560 */ "Input on command line" = "Ввод из командной строки"; /* File: ServicesPrefs.m:640 */ "Key:" = "Клавиша:"; /* File: ServicesPrefs.m:627 */ "Name:" = "Имя:"; /* File: ServicesPrefs.m:558 */ "No input" = "Без ввода"; /* File: ServicesPrefs.m:602 */ "Plain text" = "Plain text"; /* File: ServicesPrefs.m:507 */ "Remove" = "Удалить"; /* File: ServicesPrefs.m:550 */ "Return output" = "Возвращать вывод"; /* File: ServicesPrefs.m:568 */ "Run in background" = "Запускать в фоне"; /* File: ServicesPrefs.m:570 */ "Run in idle window" = "Запускать в свободном окне"; /* File: ServicesPrefs.m:569 */ "Run in new window" = "Запускать в новом окне"; /* File: ServicesPrefs.m:468 */ "Terminal services" = "Сервисы терминала"; /* File: ServicesPrefs.m:473 */ "Terminal\nservices" = "Сервисы\nтерминала"; /* File: ServicesPrefs.m:349 */ "The file '%@' doesn't contain valid terminal services." = "Файл '%@' не содержит допустимых сервисов терминала."; /* File: ServicesPrefs.m:235 */ "Unnamed service" = "Безымянный сервис"; /*** Strings from TerminalParser_LinuxPrefs.m ***/ /* File: TerminalParser_LinuxPrefs.m:103 */ "'linux' terminal parser" = "Терминальный парсер 'linux'"; /* File: TerminalParser_LinuxPrefs.m:108 */ "'linux'\nparser" = "Парсер\n'linux'"; /* File: TerminalParser_LinuxPrefs.m:151 */ "Character set:" = "Набор символов:"; /* File: TerminalParser_LinuxPrefs.m:43 */ "Chinese" = "Chinese"; /* File: TerminalParser_LinuxPrefs.m:44 */ "Custom, leave unchanged" = "Пользовательский, оставить без изменений"; /* File: TerminalParser_LinuxPrefs.m:42 */ "East Europe, latin2" = "Восточная Европа, latin2"; /* File: TerminalParser_LinuxPrefs.m:40 */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:41 */ "West Europe, latin1" = "Западная Европа, latin1"; /*** Strings from TerminalView.m ***/ /* File: TerminalView.m:1623 */ "Unable to fork: %m." = "Не удается выполнить форк: %m."; /* File: TerminalView.m:1611 */ "Unable to open pipe for input: %m." = "Не удается открыть пайп для ввода: %m."; /* File: TerminalView.m:1476 */ "[Process exited]" = "[Процесс завершился]"; /*** Strings from TerminalViewPrefs.m ***/ /* File: TerminalViewPrefs.m:330 */ "Bold font:" = "Жирный шрифт:"; /* File: TerminalViewPrefs.m:298 */ "Color:" = "Цвет:"; /* File: TerminalViewPrefs.m:277 */ "Cursor" = "Курсор"; /* File: TerminalViewPrefs.m:230 */ /* File: TerminalViewPrefs.m:225 */ "Display" = "Дисплей"; /* File: TerminalViewPrefs.m:291 */ "Filled block" = "Заполненный блок"; /* File: TerminalViewPrefs.m:319 */ "Handle wide (multi-cell) glyphs" = "Оперировать широкими (в несколько позиций) символами"; /* File: TerminalViewPrefs.m:292 */ "Inverted block" = "Инвертированный блок"; /* File: TerminalViewPrefs.m:607 */ /* File: TerminalViewPrefs.m:602 */ "Keyboard" = "Клавиатура"; /* File: TerminalViewPrefs.m:289 */ "Line" = "Строка"; /* File: TerminalViewPrefs.m:357 */ "Normal font:" = "Нормальный шрифт:"; /* File: TerminalViewPrefs.m:369 */ /* File: TerminalViewPrefs.m:342 */ "Pick font..." = "Выбрать шрифт..."; /* File: TerminalViewPrefs.m:255 */ "Scroll-back length in lines:" = "Длина прокрутки в строках:"; /* File: TerminalViewPrefs.m:651 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "Посылать двойной escape для клавиши escape.\n\nЭто означает, что клавиша escape будет\nраспознаваться быстрее многими программами,\nно ее будет нельзя использовать вместо meta."; /* File: TerminalViewPrefs.m:492 */ /* File: TerminalViewPrefs.m:487 */ "Shell" = "Оболочка"; /* File: TerminalViewPrefs.m:527 */ "Shell:" = "Оболочка:"; /* File: TerminalViewPrefs.m:515 */ "Start as login-shell" = "Запускать как оболочку входа"; /* File: TerminalViewPrefs.m:290 */ "Stroked block" = "Заштрихованный блок"; /* File: TerminalViewPrefs.m:282 */ "Style:" = "Стиль:"; /* File: TerminalViewPrefs.m:634 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Обрабатывать command как meta.\n\nЕсли разрешить эту опцию, не будет\nдоступа к пунктам меню\nс клавиатуры."; /*** Strings from TerminalWindow.m ***/ /* File: TerminalWindow.m:192 */ /* File: TerminalWindow.m:188 */ " (idle)" = " (свободно)"; /*** Strings from TerminalWindowPrefs.m ***/ /* File: TerminalWindowPrefs.m:192 */ "Add top and bottom border" = "Добавить верхнюю и нижнюю границы"; /* File: TerminalWindowPrefs.m:143 */ "Close new windows when idle" = "Закрывать новые окна при простое"; /* File: TerminalWindowPrefs.m:156 */ "Default size" = "Размер по умолчанию"; /* File: TerminalWindowPrefs.m:144 */ "Don't close new windows" = "Не закрывать новые окна"; /* File: TerminalWindowPrefs.m:169 */ "Height:" = "Высота:"; /* File: TerminalWindowPrefs.m:112 */ "Terminal Window" = "Окно терминала"; /* File: TerminalWindowPrefs.m:117 */ "Terminal\nWindow" = "Окно\nтерминала"; /* File: TerminalWindowPrefs.m:160 */ "Width:" = "Ширина:"; /*** Strings from main.m ***/ /* File: main.m:157 */ "Benchmark" = "Производительность"; /* File: main.m:191 */ "Close" = "Закрыть"; /* File: main.m:180 */ "Copy" = "Копировать"; /* File: main.m:177 */ "Cut" = "Вырезать"; /* File: main.m:186 */ "Edit" = "Редактировать"; /* File: main.m:203 */ "Hide" = "Спрятать"; /* File: main.m:159 */ "Info" = "Информация"; /* File: main.m:153 */ "Info..." = "Информация..."; /* File: main.m:171 */ "New terminal" = "Новый терминал"; /* File: main.m:183 */ "Paste" = "Вставить"; /* File: main.m:155 */ "Preferences..." = "Настройки..."; /* File: main.m:207 */ "Quit" = "Выход"; /* File: main.m:199 */ "Services" = "Сервисы"; /* File: main.m:194 */ "Windows" = "Окна"; Terminal-0.9.9/ServicesPrefs.h010064400017500000144000000016101264654375500155210ustar multixusers/* copyright 2002 Alexander Malmberg 2014 The GAP Project This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef ServicesPrefs_h #define ServicesPrefs_h #import #import "PrefBox.h" @class NSMutableDictionary,NSMutableArray; @class GSVbox,NSTableView,NSPopUpButton,NSTextField; @interface TerminalServicesPrefs : NSObject { NSMutableDictionary *services; NSMutableArray *service_list; int current; GSVbox *top; NSTableView *list; NSPopUpButton *pb_input,*pb_output,*pb_type; NSTextField *tf_name,*tf_cmdline,*tf_key; NSButton *cb_string,*cb_filenames; } @end #endif Terminal-0.9.9/Label.h010064400017500000144000000007321264654375500137610ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import @interface NSTextField (label) + newLabel: (NSString *)title; @end Terminal-0.9.9/TerminalViewPrefs.m010064400017500000144000000416671264654375500163710ustar multixusers/* copyright 2002, 2003 Alexander Malmberg 2009-2011 GAP Project This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import "Label.h" #import "TerminalViewPrefs.h" NSString *TerminalViewDisplayPrefsDidChangeNotification= @"TerminalViewDisplayPrefsDidChangeNotification"; static NSUserDefaults *ud; static NSString *TerminalFontKey=@"TerminalFont", *TerminalFontSizeKey=@"TerminalFontSize", *BoldTerminalFontKey=@"BoldTerminalFont", *BoldTerminalFontSizeKey=@"BoldTerminalFontSize", *UseMultiCellGlyphsKey=@"UseMultiCellGlyphs", *BlackOnWhiteKey=@"BlackOnWhite", *CursorStyleKey=@"CursorStyle", *ScrollBackLinesKey=@"ScrollBackLines", *CursorColorRKey=@"CursorColorR", *CursorColorGKey=@"CursorColorG", *CursorColorBKey=@"CursorColorB", *CursorColorAKey=@"CursorColorA"; static NSFont *terminalFont,*boldTerminalFont; static BOOL useMultiCellGlyphs; static BOOL blackOnWhite; static float brightness[3]={0.6,0.8,1.0}; static float saturation[3]={1.0,1.0,0.75}; static int cursorStyle; static NSColor *cursorColor; static int scrollBackLines; @implementation TerminalViewDisplayPrefs +(void) initialize { if (!ud) ud=[NSUserDefaults standardUserDefaults]; if (!cursorColor) { NSString *s; float size; size=[ud floatForKey: TerminalFontSizeKey]; s=[ud stringForKey: TerminalFontKey]; if (!s) terminalFont=[[NSFont userFixedPitchFontOfSize: size] retain]; else { terminalFont=[[NSFont fontWithName: s size: size] retain]; if (!terminalFont) terminalFont=[[NSFont userFixedPitchFontOfSize: size] retain]; } size=[ud floatForKey: BoldTerminalFontSizeKey]; s=[ud stringForKey: BoldTerminalFontKey]; if (!s) boldTerminalFont=[[NSFont userFixedPitchFontOfSize: size] retain]; else { boldTerminalFont=[[NSFont fontWithName: s size: size] retain]; if (!boldTerminalFont) boldTerminalFont=[[NSFont userFixedPitchFontOfSize: size] retain]; } useMultiCellGlyphs=[ud boolForKey: UseMultiCellGlyphsKey]; blackOnWhite=[ud boolForKey: BlackOnWhiteKey]; cursorStyle=[ud integerForKey: CursorStyleKey]; if ([ud objectForKey: CursorColorRKey]) { float r,g,b,a; r=[ud floatForKey: CursorColorRKey]; g=[ud floatForKey: CursorColorGKey]; b=[ud floatForKey: CursorColorBKey]; a=[ud floatForKey: CursorColorAKey]; cursorColor=[[NSColor colorWithCalibratedRed: r green: g blue: b alpha: a] retain]; } else { cursorColor=[[NSColor whiteColor] retain]; } scrollBackLines=[ud integerForKey: ScrollBackLinesKey]; if (scrollBackLines<=0) scrollBackLines=256; } } +(NSFont *) terminalFont { NSFont *f=[terminalFont screenFont]; if (f) return f; return terminalFont; } +(NSFont *) boldTerminalFont { NSFont *f=[boldTerminalFont screenFont]; if (f) return f; return boldTerminalFont; } +(BOOL) useMultiCellGlyphs { return useMultiCellGlyphs; } +(BOOL) blackOnWhite { return blackOnWhite; } +(const float *) brightnessForIntensities { return brightness; } +(const float *) saturationForIntensities { return saturation; } +(int) cursorStyle { return cursorStyle; } +(NSColor *) cursorColor { return cursorColor; } +(int) scrollBackLines { return scrollBackLines; } -(void) save { BOOL newState; if (!top) return; newState = !![b_blackOnWhite state]; if (blackOnWhite != newState) { blackOnWhite = newState; [ud setBool: blackOnWhite forKey: BlackOnWhiteKey]; if (blackOnWhite == YES) { [w_cursorColor setColor: [NSColor blackColor]]; } else { [w_cursorColor setColor: [NSColor whiteColor]]; } [w_cursorColor setNeedsDisplay]; } cursorStyle=[[m_cursorStyle selectedCell] tag]; [ud setInteger: cursorStyle forKey: CursorStyleKey]; { DESTROY(cursorColor); cursorColor=[w_cursorColor color]; cursorColor=[[cursorColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace] retain]; [ud setFloat: [cursorColor redComponent] forKey: CursorColorRKey]; [ud setFloat: [cursorColor greenComponent] forKey: CursorColorGKey]; [ud setFloat: [cursorColor blueComponent] forKey: CursorColorBKey]; [ud setFloat: [cursorColor alphaComponent] forKey: CursorColorAKey]; } ASSIGN(terminalFont,[f_terminalFont font]); [ud setFloat: [terminalFont pointSize] forKey: TerminalFontSizeKey]; [ud setObject: [terminalFont fontName] forKey: TerminalFontKey]; ASSIGN(boldTerminalFont,[f_boldTerminalFont font]); [ud setFloat: [boldTerminalFont pointSize] forKey: BoldTerminalFontSizeKey]; [ud setObject: [boldTerminalFont fontName] forKey: BoldTerminalFontKey]; scrollBackLines=[f_scrollBackLines intValue]; [ud setInteger: scrollBackLines forKey: ScrollBackLinesKey]; useMultiCellGlyphs=!![b_useMultiCellGlyphs state]; [ud setBool: useMultiCellGlyphs forKey: UseMultiCellGlyphsKey]; [[NSNotificationCenter defaultCenter] postNotificationName: TerminalViewDisplayPrefsDidChangeNotification object: self]; } -(void) revert { NSFont *f; [b_useMultiCellGlyphs setState: useMultiCellGlyphs]; [b_blackOnWhite setState: blackOnWhite]; [m_cursorStyle selectCellWithTag: [[self class] cursorStyle]]; [w_cursorColor setColor: [[self class] cursorColor]]; f=[[self class] terminalFont]; [f_terminalFont setStringValue: [NSString stringWithFormat: @"%@ %0.1f",[f fontName],[f pointSize]]]; [f_terminalFont setFont: f]; f=[[self class] boldTerminalFont]; [f_boldTerminalFont setStringValue: [NSString stringWithFormat: @"%@ %0.1f",[f fontName],[f pointSize]]]; [f_boldTerminalFont setFont: f]; [f_scrollBackLines setIntValue: scrollBackLines]; } -(NSString *) name { return _(@"Display"); } -(void) setupButton: (NSButton *)b { [b setTitle: _(@"Display")]; [b sizeToFit]; } -(void) willHide { } -(NSView *) willShow { if (!top) { top=[[GSVbox alloc] init]; [top setDefaultMinYMargin: 2]; [top addView: [[[NSView alloc] init] autorelease] enablingYResizing: YES]; { NSTextField *f; NSButton *butt; GSHbox *hb; hb=[[GSHbox alloc] init]; [hb setDefaultMinXMargin: 4]; [hb setAutoresizingMask: NSViewWidthSizable]; f=[NSTextField newLabel: _(@"Scroll-back length in lines:")]; [f setAutoresizingMask: 0]; [hb addView: f enablingXResizing: NO]; DESTROY(f); f_scrollBackLines=f=[[NSTextField alloc] init]; [f setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable]; [f sizeToFit]; [hb addView: f enablingXResizing: YES]; DESTROY(f); [top addView: hb enablingYResizing: NO]; DESTROY(hb); [top addView: [[[NSView alloc] init] autorelease] enablingYResizing: YES]; { NSBox *box; GSTable *t; NSColorWell *w; box=[[NSBox alloc] init]; [box setAutoresizingMask: NSViewMinXMargin|NSViewMaxXMargin]; [box setTitle: _(@"Cursor")]; t = [[[GSTable alloc] initWithNumberOfRows: 2 numberOfColumns: 2] autorelease]; [t setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable]; f=[NSTextField newLabel: _(@"Style:")]; [f setAutoresizingMask: NSViewMinXMargin|NSViewMinYMargin|NSViewMaxYMargin]; [t putView: f atRow: 0 column: 0 withXMargins: 2 yMargins: 2]; DESTROY(f); { NSMatrix *m; NSButtonCell *bc=[NSButtonCell new]; NSSize s; [bc setImagePosition: NSImageOnly]; [bc setHighlightsBy: NSChangeBackgroundCellMask]; [bc setShowsStateBy: NSChangeBackgroundCellMask]; m=m_cursorStyle=[[NSMatrix alloc] initWithFrame: NSMakeRect(0,0,1,1) mode: NSRadioModeMatrix prototype: bc numberOfRows: 1 numberOfColumns: 4]; [bc release]; [[m cellAtRow: 0 column: 0] setImage: [NSImage imageNamed: @"cursor_line"]]; [[m cellAtRow: 0 column: 1] setImage: [NSImage imageNamed: @"cursor_stroked"]]; [[m cellAtRow: 0 column: 2] setImage: [NSImage imageNamed: @"cursor_filled"]]; [[m cellAtRow: 0 column: 3] setImage: [NSImage imageNamed: @"cursor_inverted"]]; [[m cellAtRow: 0 column: 0] setTag: 0]; [[m cellAtRow: 0 column: 1] setTag: 1]; [[m cellAtRow: 0 column: 2] setTag: 2]; [[m cellAtRow: 0 column: 3] setTag: 3]; s=[[m cellAtRow: 0 column: 0] cellSize]; s.width+=6; s.height+=6; [m setCellSize: s]; [m sizeToCells]; [t putView: m atRow: 0 column: 1 withXMargins: 2 yMargins: 2]; DESTROY(m); } f=[NSTextField newLabel: _(@"Color:")]; [f setAutoresizingMask: NSViewMinXMargin|NSViewMinYMargin|NSViewMaxYMargin]; [t putView: f atRow: 1 column: 0 withXMargins: 2 yMargins: 2]; DESTROY(f); w_cursorColor=w=[[NSColorWell alloc] initWithFrame: NSMakeRect(0,0,40,30)]; [t putView: w atRow: 1 column: 1 withXMargins: 2 yMargins: 2]; DESTROY(w); [[NSColorPanel sharedColorPanel] setShowsAlpha: YES]; [t sizeToFit]; [box setContentView: t]; [box sizeToFit]; [top addView: box enablingYResizing: NO]; DESTROY(box); } [top addView: [[[NSView alloc] init] autorelease] enablingYResizing: YES]; butt=b_useMultiCellGlyphs=[[NSButton alloc] init]; [butt setTitle: _(@"Handle wide (multi-cell) glyphs")]; [butt setButtonType: NSSwitchButton]; [butt sizeToFit]; [top addView: butt enablingYResizing: NO]; DESTROY(butt); butt=b_blackOnWhite=[[NSButton alloc] init]; [butt setTitle: _(@"Display black on white text")]; [butt setButtonType: NSSwitchButton]; [butt sizeToFit]; [top addView: butt enablingYResizing: NO]; DESTROY(butt); hb=[[GSHbox alloc] init]; [hb setDefaultMinXMargin: 4]; [hb setAutoresizingMask: NSViewWidthSizable]; f=[NSTextField newLabel: _(@"Bold font:")]; [f setAutoresizingMask: 0]; [hb addView: f enablingXResizing: NO]; DESTROY(f); f_boldTerminalFont=f=[[NSTextField alloc] init]; [f setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable]; [f setEditable: NO]; [hb addView: f enablingXResizing: YES]; DESTROY(f); butt=[[NSButton alloc] init]; [butt setTitle: _(@"Pick font...")]; [butt setTarget: self]; [butt setAction: @selector(_pickBoldTerminalFont:)]; [butt sizeToFit]; [hb addView: butt enablingXResizing: NO]; DESTROY(butt); [top addView: hb enablingYResizing: NO]; DESTROY(hb); hb=[[GSHbox alloc] init]; [hb setDefaultMinXMargin: 4]; [hb setAutoresizingMask: NSViewWidthSizable]; f=[NSTextField newLabel: _(@"Normal font:")]; [f setAutoresizingMask: 0]; [hb addView: f enablingXResizing: NO]; DESTROY(f); f_terminalFont=f=[[NSTextField alloc] init]; [f setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable]; [f setEditable: NO]; [hb addView: f enablingXResizing: YES]; DESTROY(f); butt=[[NSButton alloc] init]; [butt setTitle: _(@"Pick font...")]; [butt setTarget: self]; [butt setAction: @selector(_pickTerminalFont:)]; [butt sizeToFit]; [hb addView: butt enablingXResizing: NO]; DESTROY(butt); [top addView: hb enablingYResizing: NO]; DESTROY(hb); [top addView: [[[NSView alloc] init] autorelease] enablingYResizing: YES]; } [self revert]; } return top; } -(void) dealloc { DESTROY(top); [super dealloc]; } -(void) _pickFont { NSFontManager *fm=[NSFontManager sharedFontManager]; [fm setSelectedFont: [f_cur font] isMultiple: NO]; [fm orderFrontFontPanel: self]; } -(void) _pickTerminalFont: (id)sender { f_cur=f_terminalFont; [self _pickFont]; } -(void) _pickBoldTerminalFont: (id)sender { f_cur=f_boldTerminalFont; [self _pickFont]; } -(void) changeFont: (id)sender { NSFont *f; if (!f_cur) return; f=[sender convertFont: [f_cur font]]; if (!f) return; [f_cur setStringValue: [NSString stringWithFormat: @"%@ %0.1f",[f fontName],[f pointSize]]]; [f_cur setFont: f]; return; } @end static NSString *LoginShellKey=@"LoginShell", *ShellKey=@"Shell"; static NSString *shell; static BOOL loginShell; @implementation TerminalViewShellPrefs +(void) initialize { if (!ud) ud=[NSUserDefaults standardUserDefaults]; if (!shell) { loginShell=[ud boolForKey: LoginShellKey]; shell=[ud stringForKey: ShellKey]; if (!shell && getenv("SHELL")) shell=[NSString stringWithCString: getenv("SHELL")]; if (!shell) shell=@"/bin/sh"; shell=[shell retain]; } } +(NSString *) shell { return shell; } +(BOOL) loginShell { return loginShell; } -(void) save { if (!top) return; if ([b_loginShell state]) loginShell=YES; else loginShell=NO; [ud setBool: loginShell forKey: LoginShellKey]; DESTROY(shell); shell=[[tf_shell stringValue] copy]; [ud setObject: shell forKey: ShellKey]; } -(void) revert { [b_loginShell setState: loginShell]; [tf_shell setStringValue: shell]; } -(NSString *) name { return _(@"Shell"); } -(void) setupButton: (NSButton *)b { [b setTitle: _(@"Shell")]; [b sizeToFit]; } -(void) willHide { } -(NSView *) willShow { if (!top) { top=[[GSVbox alloc] init]; [top setDefaultMinYMargin: 4]; { NSTextField *f; NSButton *b; b=b_loginShell=[[NSButton alloc] init]; [b setAutoresizingMask: NSViewMinYMargin]; [b setTitle: _(@"Start as login-shell")]; [b setButtonType: NSSwitchButton]; [b sizeToFit]; [top addView: b enablingYResizing: YES]; DESTROY(b); tf_shell=f=[[NSTextField alloc] init]; [f sizeToFit]; [f setAutoresizingMask: NSViewWidthSizable]; [top addView: f enablingYResizing: NO]; DESTROY(f); f=[NSTextField newLabel: _(@"Shell:")]; [f setAutoresizingMask: NSViewMaxYMargin]; [f sizeToFit]; [top addView: f enablingYResizing: YES]; DESTROY(f); } [self revert]; } return top; } -(void) dealloc { DESTROY(top); [super dealloc]; } @end static NSString *CommandAsMetaKey=@"CommandAsMeta", *DoubleEscapeKey=@"DoubleEscape", *AltIsNotMetaKey=@"AltIsNotMeta"; static BOOL commandAsMeta,doubleEscape, altIsNotMeta; @implementation TerminalViewKeyboardPrefs +(void) initialize { if (!ud) ud=[NSUserDefaults standardUserDefaults]; commandAsMeta=[ud boolForKey: CommandAsMetaKey]; doubleEscape=[ud boolForKey: DoubleEscapeKey]; altIsNotMeta=[ud boolForKey: AltIsNotMetaKey]; } +(BOOL) commandAsMeta { return commandAsMeta; } +(BOOL) doubleEscape { return doubleEscape; } +(BOOL) altIsNotMeta { return altIsNotMeta; } -(void) save { if (!top) return; if ([b_commandAsMeta state]) commandAsMeta=YES; else commandAsMeta=NO; [ud setBool: commandAsMeta forKey: CommandAsMetaKey]; if ([b_doubleEscape state]) doubleEscape=YES; else doubleEscape=NO; [ud setBool: doubleEscape forKey: DoubleEscapeKey]; if ([b_altIsNotMeta state]) altIsNotMeta=YES; else altIsNotMeta=NO; [ud setBool: altIsNotMeta forKey: AltIsNotMetaKey]; } -(void) revert { [b_commandAsMeta setState: commandAsMeta]; [b_doubleEscape setState: doubleEscape]; [b_altIsNotMeta setState: altIsNotMeta]; } -(NSString *) name { return _(@"Keyboard"); } -(void) setupButton: (NSButton *)b { [b setTitle: _(@"Keyboard")]; [b sizeToFit]; } -(void) willHide { } -(NSView *) willShow { if (!top) { top=[[GSVbox alloc] init]; [top setDefaultMinYMargin: 8]; { NSButton *b; b=b_commandAsMeta=[[NSButton alloc] init]; [b setAutoresizingMask: NSViewMinYMargin|NSViewMaxYMargin|NSViewWidthSizable]; [b setTitle: _(@"Treat the command key as meta.\n" @"\n" @"Note that with this enabled, you won't be\n" @"able to access menu entries with the\n" @"keyboard.")]; [b setButtonType: NSSwitchButton]; [b sizeToFit]; [top addView: b enablingYResizing: YES]; DESTROY(b); b=b_altIsNotMeta=[[NSButton alloc] init]; [b setAutoresizingMask: NSViewMinYMargin|NSViewMaxYMargin|NSViewWidthSizable]; [b setTitle: _(@"Treat the Alt key as Alt and not Meta.\n" @"Useful if command is used as Meta\n" @"And the keyboard has AltGr and not right Alt\n")]; [b setButtonType: NSSwitchButton]; [b sizeToFit]; [top addView: b enablingYResizing: YES]; DESTROY(b); [top addSeparator]; b=b_doubleEscape=[[NSButton alloc] init]; [b setAutoresizingMask: NSViewMinYMargin|NSViewMaxYMargin|NSViewWidthSizable]; [b setTitle: _(@"Send a double escape for the escape key.\n" @"\n" @"This means that the escape key will be\n" @"recognized faster by many programs, but\n" @"you can't use it as a substitute for meta.")]; [b setButtonType: NSSwitchButton]; [b sizeToFit]; [top addView: b enablingYResizing: YES]; DESTROY(b); } [self revert]; } return top; } -(void) dealloc { DESTROY(top); [super dealloc]; } @end Terminal-0.9.9/ServicesParameterWindowController.h010064400017500000144000000013271264654375500216230ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef ServicesParameterWindowController_h #define ServicesParameterWindowController_h #include @class NSTextField; @interface TerminalServicesParameterWindowController : NSWindowController { NSTextField *tf_cmdline; } +(NSString *) getCommandlineFrom: (NSString *)cmdline selectRange: (NSRange)r service: (NSString *)service_name; @end #endif Terminal-0.9.9/TerminalParser_LinuxPrefs.m010064400017500000144000000066111264654375500200600ustar multixusers/* copyright 2002, 2003 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import #import #import #import #import #import #import #import "Label.h" #import "TerminalParser_LinuxPrefs.h" static NSUserDefaults *ud; NSString *TerminalParser_LinuxPrefsDidChangeNotification= @"TerminalParser_LinuxPrefsDidChangeNotification"; static NSString *CharacterSetKey=@"Linux_CharacterSet"; static NSString *characterSet; typedef struct { NSString *name; NSString *display_name; } character_set_choice_t; static character_set_choice_t cs_choices[]={ {@"utf-8" ,__(@"UTF-8")}, {@"iso-8859-1" ,__(@"West Europe, latin1")}, {@"iso-8859-2" ,__(@"East Europe, latin2")}, {@"big-5" ,__(@"Chinese")}, {nil ,__(@"Custom, leave unchanged")}, {nil,nil} }; @implementation TerminalParser_LinuxPrefs +(void) initialize { if (!ud) { ud=[NSUserDefaults standardUserDefaults]; characterSet=[[ud stringForKey: CharacterSetKey] retain]; if (!characterSet) characterSet=@"iso-8859-1"; } } +(const char *) characterSet { return [characterSet cString]; } -(void) save { int i; if (!top) return; i=[pb_characterSet indexOfSelectedItem]; if (cs_choices[i].name!=nil) { ASSIGN(characterSet,cs_choices[i].name); [ud setObject: characterSet forKey: CharacterSetKey]; [[NSNotificationCenter defaultCenter] postNotificationName: TerminalParser_LinuxPrefsDidChangeNotification object: self]; } } -(void) revert { int i; character_set_choice_t *c; for (i=0,c=cs_choices;c->name;i++,c++) { if (c->name && [c->name caseInsensitiveCompare: characterSet]==NSOrderedSame) break; } [pb_characterSet selectItemAtIndex: i]; } -(NSString *) name { return _(@"'linux' terminal parser"); } -(void) setupButton: (NSButton *)b { [b setTitle: _(@"'linux'\nparser")]; [b sizeToFit]; } -(void) willHide { } -(NSView *) willShow { if (!top) { GSVbox *top2; top2=[[GSVbox alloc] init]; top=[[GSVbox alloc] init]; [top setAutoresizingMask: NSViewMinXMargin|NSViewMaxXMargin|NSViewMinYMargin|NSViewMaxYMargin]; [top setDefaultMinYMargin: 2]; { NSTextField *f; NSPopUpButton *pb; int i; character_set_choice_t *c; pb_characterSet=pb=[[NSPopUpButton alloc] init]; [pb setAutoresizingMask: NSViewMinXMargin|NSViewMaxXMargin]; [pb setAutoenablesItems: NO]; for (i=0,c=cs_choices;c->display_name;i++,c++) { NSString *name; if (c->name) name=[NSString stringWithFormat: @"%@ (%@)", _(c->display_name),c->name]; else name=_(c->display_name); [pb addItemWithTitle: name]; } [pb sizeToFit]; [top addView: pb enablingYResizing: NO]; DESTROY(pb); f=[NSTextField newLabel: _(@"Character set:")]; [top addView: f enablingYResizing: NO]; DESTROY(f); } [top2 addView: top enablingYResizing: YES]; DESTROY(top); top=top2; [self revert]; } return top; } -(void) dealloc { DESTROY(top); [super dealloc]; } @end Terminal-0.9.9/TerminalParser_Linux.m010064400017500000144000000715741271743276700170710ustar multixusers/* copyright 2002, 2003 Alexander Malmberg 2009-2011 GAP Project This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ /* lots borrowed from linux/drivers/char/console.c, GNU GPL:ed */ /* * linux/drivers/char/console.c * * Copyright (C) 1991, 1992 Linus Torvalds */ #import #import #import #import #include /* TODO */ #import "TerminalViewPrefs.h" #import #import "TerminalParser_Linux.h" #import "TerminalParser_LinuxPrefs.h" #include "charmaps.h" #define set_translate(charset,foo) _set_translate(charset) static const unichar *_set_translate(int charset) { if (charset<0 || charset>=4) return translate_maps[0]; return translate_maps[charset]; } @interface TerminalParser_Linux (private) #define csi_J(foo,vpar) [self _csi_J: vpar] #define csi_K(foo,vpar) [self _csi_K: vpar] #define csi_L(foo,vpar) [self _csi_L: vpar] #define csi_M(foo,vpar) [self _csi_M: vpar] #define csi_P(foo,vpar) [self _csi_P: vpar] #define csi_X(foo,vpar) [self _csi_X: vpar] #define csi_at(foo,vpar) [self _csi_at: vpar] #define csi_m(foo) [self _csi_m] -(void) _csi_J: (int)vpar; -(void) _csi_K: (int)vpar; -(void) _csi_L: (unsigned int)vpar; -(void) _csi_M: (unsigned int)vpar; -(void) _csi_P: (unsigned int)vpar; -(void) _csi_X: (int)vpar; -(void) _csi_at: (unsigned int)vpar; -(void) _csi_m; -(void) _default_attr; -(void) _update_attr; @end #define SCREEN(x,y) ((x)+(y)*width) @implementation TerminalParser_Linux #define gotoxy(foo,new_x,new_y) do { \ int min_y, max_y; \ \ if (new_x < 0) \ x = 0; \ else \ if (new_x >= width) \ x = width - 1; \ else \ x = new_x; \ if (decom) { \ min_y = top; \ max_y = bottom; \ } else { \ min_y = 0; \ max_y = height; \ } \ if (new_y < min_y) \ y = min_y; \ else if (new_y >= max_y) \ y = max_y - 1; \ else \ y = new_y; \ [ts ts_goto: x:y]; \ } while (0) #define gotoxay(foo,nx,ny) gotoxy(foo,nx,decom?top+ny:ny) #define save_cur(foo) do { \ saved_x = x; \ saved_y = y; \ s_intensity = intensity; \ s_underline = underline; \ s_blink = blink; \ s_reverse = reverse; \ s_charset = charset; \ s_color = color; \ saved_G0 = G0_charset; \ saved_G1 = G1_charset; \ } while (0) #define restore_cur(foo) do { \ gotoxy(currcons,saved_x,saved_y); \ intensity = s_intensity; \ underline = s_underline; \ blink = s_blink; \ reverse = s_reverse; \ charset = s_charset; \ color = s_color; \ G0_charset = saved_G0; \ G1_charset = saved_G1; \ translate = set_translate(charset ? G1_charset : G0_charset,currcons); \ } while (0) -(void) _reset_terminal { top = 0; bottom = height; vc_state = ESnormal; ques = 0; translate = set_translate(LAT1_MAP,currcons); G0_charset = LAT1_MAP; G1_charset = GRAF_MAP; charset = 0; // report_mouse = 0; utf = 0; utf_count = 0; disp_ctrl = 0; toggle_meta = 0; decscnm = 0; decom = 0; decawm = 1; deccm = 1; decim = 0; #if 0 set_kbd(decarm); clr_kbd(decckm); clr_kbd(kbdapplic); clr_kbd(lnm); kbd_table[currcons].lockstate = 0; kbd_table[currcons].slockstate = 0; kbd_table[currcons].ledmode = LED_SHOW_FLAGS; kbd_table[currcons].ledflagstate = kbd_table[currcons].default_ledflagstate; set_leds(); cursor_type = CUR_DEFAULT; complement_mask = s_complement_mask; #endif [self _default_attr]; [self _update_attr]; tab_stop[0]= 0x01010100; tab_stop[1]=tab_stop[2]=tab_stop[3]=tab_stop[4]= tab_stop[5]=tab_stop[6]=tab_stop[7]=0x01010101; gotoxy(currcons,0,0); save_cur(currcons); [self _csi_J: 2]; } -(void) _csi_J: (int) vpar { unsigned int count; int start; switch (vpar) { case 0: /* erase from cursor to end of display */ count = width*height-(x+y*width); start = SCREEN(x,y); break; case 1: /* erase from start to cursor */ count = x+y*width+1; start = SCREEN(0,0); break; case 2: /* erase whole display */ count = width*height; start = SCREEN(0,0); break; default: return; } [ts ts_putChar: video_erase_char count: count offset: start]; } -(void) _csi_K: (int)vpar { unsigned int count; int start; switch (vpar) { case 0: /* erase from cursor to end of line */ count = width-x; start = SCREEN(x,y); break; case 1: /* erase from start of line to cursor */ count = x+1; start = SCREEN(0,y); break; case 2: /* erase whole line */ count = width; start = SCREEN(0,y); break; default: return; } [ts ts_putChar: video_erase_char count: count offset: start]; } -(void) _csi_X: (int)vpar /* erase the following vpar positions */ { /* not vt100? */ int count; if (!vpar) vpar++; count = (vpar > width-x) ? (width-x) : vpar; [ts ts_putChar: video_erase_char count: count offset: SCREEN(x,y)]; } -(void) _default_attr { intensity = 1; underline = 0; reverse = 0; blink = 0; color = def_color; } -(void) _update_attr { video_erase_char.color=color; video_erase_char.attr=(intensity)|(underline<<2)|(reverse<<3)|(blink<<4); } static unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7, 8,12,10,14, 9,13,11,15 }; -(void) _csi_m { int i; for (i=0;i<=npar;i++) switch (par[i]) { case 0: /* all attributes off */ [self _default_attr]; break; case 1: intensity = 2; break; case 2: intensity = 0; break; case 4: underline = 1; break; case 5: blink = 1; break; case 7: reverse = 1; break; case 10: /* ANSI X3.64-1979 (SCO-ish?) * Select primary font, don't display * control chars if defined, don't set * bit 8 on output. */ translate = set_translate(charset == 0 ? G0_charset : G1_charset,currcons); disp_ctrl = 0; toggle_meta = 0; break; case 11: /* ANSI X3.64-1979 (SCO-ish?) * Select first alternate font, lets * chars < 32 be displayed as ROM chars. */ translate = set_translate(IBMPC_MAP,currcons); disp_ctrl = 1; toggle_meta = 0; break; case 12: /* ANSI X3.64-1979 (SCO-ish?) * Select second alternate font, toggle * high bit before displaying as ROM char. */ translate = set_translate(IBMPC_MAP,currcons); disp_ctrl = 1; toggle_meta = 1; break; case 21: case 22: intensity = 1; break; case 24: underline = 0; break; case 25: blink = 0; break; case 27: reverse = 0; break; case 38: /* ANSI X3.64-1979 (SCO-ish?) * Enables underscore, white foreground * with white underscore (Linux - use * default foreground). */ color = (def_color & 0x0f) | background; underline = 1; break; case 39: /* ANSI X3.64-1979 (SCO-ish?) * Disable underline option. * Reset colour to default? It did this * before... */ color = (def_color & 0x0f) | background; underline = 0; break; case 49: color = (def_color & 0xf0) | foreground; break; default: if (par[i] >= 30 && par[i] <= 37) color = color_table[par[i]-30] | background; else if (par[i] >= 40 && par[i] <= 47) color = (color_table[par[i]-40]<<4) | foreground; break; } [self _update_attr]; } #define scrup(foo,t,b,nr,indirect_scroll) do { \ int scrup_nr=nr; \ \ if (t+scrup_nr >= b) \ scrup_nr = b - t - 1; \ if (b > height || t >= b || scrup_nr < 1) \ return; \ [ts ts_scrollUp: t:b rows: scrup_nr save: indirect_scroll]; \ [ts ts_putChar: video_erase_char count: width*scrup_nr offset: width*(b-scrup_nr)]; \ } while (0) #define scrdown(foo,t,b,nr) do { \ unsigned int step; \ int scrdown_nr=nr; \ \ if (t+scrdown_nr >= b) \ scrdown_nr = b - t - 1; \ if (b > height || t >= b || scrdown_nr < 1) \ return; \ step = width * scrdown_nr; \ [ts ts_scrollDown: t:b rows: scrdown_nr]; \ [ts ts_putChar: video_erase_char count: step offset: t*width]; \ } while (0) #define insert_char(foo,nr) do { \ [ts ts_shiftRow: y at: x delta: nr]; \ [ts ts_putChar: video_erase_char count: nr at: x:y]; \ } while (0) #define delete_char(foo,nr) do { \ [ts ts_shiftRow: y at: x+nr delta: -nr]; \ [ts ts_putChar: video_erase_char count: nr at: width-nr:y]; \ } while (0) -(void) _csi_at: (unsigned int)nr { if (nr > width - x) nr = width - x; else if (!nr) nr = 1; insert_char(currcons, nr); } -(void) _csi_L: (unsigned int)nr { if (nr > height - y) nr = height - y; else if (!nr) nr = 1; scrdown(foo,y,bottom,nr); } -(void) _csi_P: (unsigned int)nr { if (nr > width - x) nr = width - x; else if (!nr) nr = 1; delete_char(currcons, nr); } -(void) _csi_M: (unsigned int)nr { if (nr > height - y) nr = height - y; else if (!nr) nr=1; scrup(foo,y,bottom,nr,NO); } #define set_kbd(foo) #define clr_kbd(foo) #define set_mode(foo,on_off) [self _set_mode: on_off] -(void) _set_mode: (int) on_off { int i; for (i=0; i<=npar; i++) if (ques) switch(par[i]) { /* DEC private modes set/reset */ case 1: /* Cursor keys send ^[Ox/^[[x */ if (on_off) { set_kbd(decckm); } else { clr_kbd(decckm); } break; case 3: /* 80/132 mode switch unimplemented */ NSDebugLLog(@"term",@"ignore _set_mode 3"); #if 0 deccolm = on_off; (void) vc_resize(height, deccolm ? 132 : 80); /* this alone does not suffice; some user mode utility has to change the hardware regs */ #endif break; case 5: /* Inverted screen on/off */ if (decscnm != on_off) { decscnm = on_off; [self _update_attr]; /* TODO? */ } break; case 6: /* Origin relative/absolute */ decom = on_off; gotoxay(currcons,0,0); break; case 7: /* Autowrap on/off */ decawm = on_off; break; case 8: /* Autorepeat on/off */ NSDebugLLog(@"term",@"ignore _set_mode 8"); #if 0 if (on_off) set_kbd(decarm); else clr_kbd(decarm); #endif break; case 9: NSDebugLLog(@"term",@"ignore _set_mode 9"); #if 0 report_mouse = on_off ? 1 : 0; #endif break; case 25: /* Cursor on/off */ deccm = on_off; break; case 1000: NSDebugLLog(@"term",@"ignore _set_mode 1000"); #if 0 report_mouse = on_off ? 2 : 0; #endif break; } else switch(par[i]) { /* ANSI modes set/reset */ case 3: /* Monitor (display ctrls) */ disp_ctrl = on_off; break; case 4: /* Insert Mode on/off */ decim = on_off; break; case 20: /* Lf, Enter == CrLf/Lf */ NSDebugLLog(@"term",@"ignore _set_mode 20"); #if 0 if (on_off) set_kbd(lnm); else clr_kbd(lnm); #endif break; } } #define setterm_command(foo) [self _setterm_command] -(void) _setterm_command { NSDebugLLog(@"term",@"ignore _setterm_command %i\n",par[0]); /* TODO: will need _update_attr */ switch(par[0]) { #if 0 case 1: /* set color for underline mode */ if (can_do_color && par[1] < 16) { ulcolor = color_table[par[1]]; if (underline) update_attr(currcons); } break; case 2: /* set color for half intensity mode */ if (can_do_color && par[1] < 16) { halfcolor = color_table[par[1]]; if (intensity == 0) update_attr(currcons); } break; #endif case 8: /* store colors as defaults */ def_color = color; /* if (hi_font_mask == 0x100) def_color >>= 1;*/ [self _default_attr]; [self _update_attr]; break; #if 0 case 9: /* set blanking interval */ blankinterval = ((par[1] < 60) ? par[1] : 60) * 60 * HZ; poke_blanked_console(); break; case 10: /* set bell frequency in Hz */ if (npar >= 1) bell_pitch = par[1]; else bell_pitch = DEFAULT_BELL_PITCH; break; case 11: /* set bell duration in msec */ if (npar >= 1) bell_duration = (par[1] < 2000) ? par[1]*HZ/1000 : 0; else bell_duration = DEFAULT_BELL_DURATION; break; case 12: /* bring specified console to the front */ if (par[1] >= 1 && vc_cons_allocated(par[1]-1)) set_console(par[1] - 1); break; case 13: /* unblank the screen */ poke_blanked_console(); break; case 14: /* set vesa powerdown interval */ vesa_off_interval = ((par[1] < 60) ? par[1] : 60) * 60 * HZ; break; #endif } } -(void) processByte: (unsigned char)c { #define lf() do { \ if (y+1==bottom) \ { \ scrup(foo,top,bottom,1,(top==0 && bottom==height)?YES:NO); \ } \ else if (y0) \ { \ y--; \ [ts ts_goto: x:y]; \ } \ } while (0) #define cr() do { x=0; [ts ts_goto: x:y]; } while (0) #define cursor_report(foo,bar) do { \ char buf[40]; \ \ sprintf(buf, "\033[%d;%dR", y + (decom ? top+1 : 1), x+1); \ [ts ts_sendCString: buf]; \ } while (0) #define status_report(foo) do { \ [ts ts_sendCString: "\033[0n"]; \ } while (0) #define VT102ID "\033[?6c" #define respond_ID(foo) do { [ts ts_sendCString: VT102ID]; } while (0) switch (c) { case 0: return; case 7: if (vc_state==EStitle_buf) { NSString *new_title; title_buf[title_len]=0; new_title=[NSString stringWithCString: title_buf]; [ts ts_setTitle: new_title type: title_type]; vc_state=ESnormal; return; } NSBeep(); return; case 8: if (x>0) { x--; [ts ts_goto: x:y]; } return; case 9: while (x < width - 1) { x++; if (tab_stop[x >> 5] & (1 << (x & 31))) break; } [ts ts_goto: x:y]; return; case 10: case 11: case 12: lf(); /* if (!is_kbd(lnm))*/ return; case 13: cr(); return; case 14: charset = 1; translate = set_translate(G1_charset,currcons); disp_ctrl = 1; return; case 15: charset = 0; translate = set_translate(G0_charset,currcons); disp_ctrl = 0; return; case 24: case 26: vc_state = ESnormal; return; case 27: vc_state = ESesc; return; case 127: // del(currcons); return; case 128+27: // This kills UTF-8 unless we do some funky stuff if (!utf_count) { vc_state = ESsquare; return; } } switch(vc_state) { case ESesc: vc_state = ESnormal; switch (c) { case '[': vc_state = ESsquare; return; case ']': vc_state = ESnonstd; return; case '%': vc_state = ESpercent; return; case 'E': cr(); lf(); return; case 'M': ri(); return; case 'D': lf(); return; case 'H': tab_stop[x >> 5] |= (1 << (x & 31)); return; case 'Z': respond_ID(foo); return; case '7': save_cur(currcons); return; case '8': restore_cur(currcons); return; case '(': vc_state = ESsetG0; return; case ')': vc_state = ESsetG1; return; case '#': vc_state = EShash; return; case 'c': [self _reset_terminal]; return; case '>': /* Numeric keypad */ NSDebugLLog(@"term",@"ignore ESesc > keypad"); #if 0 clr_kbd(kbdapplic); #endif return; case '=': /* Appl. keypad */ NSDebugLLog(@"term",@"ignore ESesc = keypad"); #if 0 set_kbd(kbdapplic); #endif return; } return; case ESnonstd: switch (c) { case '0': case '1': case '2': case '3': vc_state=EStitle_semi; title_type=c-'0'; return; case 'P': NSDebugLLog(@"term",@"ignore ESnonstd P"); #if 0 for (npar=0; npar='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f') ) { par[npar++] = (c>'9' ? (c&0xDF)-'A'+10 : c-'0') ; if (npar==7) { int i = par[0]*3, j = 1; palette[i] = 16*par[j++]; palette[i++] += par[j++]; palette[i] = 16*par[j++]; palette[i++] += par[j++]; palette[i] = 16*par[j++]; palette[i] += par[j]; set_palette(currcons); vc_state = ESnormal; } } else #endif vc_state = ESnormal; return; case ESsquare: for(npar = 0 ; npar < NPAR ; npar++) par[npar] = 0; npar = 0; vc_state = ESgetpars; if (c == '[') { /* Function key */ vc_state=ESfunckey; return; } ques = (c=='?'); if (ques) return; case ESgetpars: if (c==';' && npar='0' && c<='9') { par[npar] *= 10; par[npar] += c-'0'; return; } else vc_state=ESgotpars; case ESgotpars: vc_state = ESnormal; switch(c) { case 'h': set_mode(currcons,1); return; case 'l': set_mode(currcons,0); return; case 'c': NSDebugLLog(@"term",@"ignore ESgotpars c"); #if 0 if (ques) { if (par[0]) cursor_type = par[0] | (par[1]<<8) | (par[2]<<16); else cursor_type = CUR_DEFAULT; return; } #endif break; case 'n': if (!ques) { if (par[0] == 5) status_report(tty); else if (par[0] == 6) cursor_report(currcons,tty); } return; } if (ques) { ques = 0; return; } switch(c) { case 'G': case '`': if (par[0]) par[0]--; gotoxy(currcons,par[0],y); return; case 'A': if (!par[0]) par[0]++; gotoxy(currcons,x,y-par[0]); return; case 'B': case 'e': if (!par[0]) par[0]++; gotoxy(currcons,x,y+par[0]); return; case 'C': case 'a': if (!par[0]) par[0]++; gotoxy(currcons,x+par[0],y); return; case 'D': if (!par[0]) par[0]++; gotoxy(currcons,x-par[0],y); return; case 'E': if (!par[0]) par[0]++; gotoxy(currcons,0,y+par[0]); return; case 'F': if (!par[0]) par[0]++; gotoxy(currcons,0,y-par[0]); return; case 'd': if (par[0]) par[0]--; gotoxay(currcons,x,par[0]); return; case 'H': case 'f': if (par[0]) par[0]--; if (par[1]) par[1]--; gotoxay(currcons,par[1],par[0]); return; case 'J': csi_J(currcons,par[0]); return; case 'K': csi_K(currcons,par[0]); return; case 'L': csi_L(currcons,par[0]); return; case 'M': csi_M(currcons,par[0]); return; case 'P': csi_P(currcons,par[0]); return; case 'c': if (!par[0]) respond_ID(tty); return; case 'g': if (!par[0]) tab_stop[x >> 5] &= ~(1 << (x & 31)); else if (par[0] == 3) { tab_stop[0] = tab_stop[1] = tab_stop[2] = tab_stop[3] = tab_stop[4] = 0; } return; case 'm': csi_m(currcons); return; case 'q': /* DECLL - but only 3 leds */ /* map 0,1,2,3 to 0,1,2,4 */ NSDebugLLog(@"term",@"ignore ESgotpars q"); #if 0 if (par[0] < 4) setledstate(kbd_table + currcons, (par[0] < 3) ? par[0] : 4); #endif return; case 'r': if (!par[0]) par[0]++; if (!par[1]) par[1] = height; /* Minimum allowed region is 2 lines */ if (par[0] < par[1] && par[1] <= height) { top=par[0]-1; bottom=par[1]; gotoxay(currcons,0,0); } return; case 's': save_cur(currcons); return; case 'u': restore_cur(currcons); return; case 'X': csi_X(currcons, par[0]); return; case '@': csi_at(currcons,par[0]); return; case ']': /* setterm functions */ setterm_command(currcons); return; } return; case ESpercent: vc_state = ESnormal; switch (c) { case '@': /* defined in ISO 2022 */ utf = 0; return; case 'G': /* prelim official escape code */ case '8': /* retained for compatibility */ utf = 1; return; } return; case ESfunckey: vc_state = ESnormal; return; case EShash: vc_state = ESnormal; NSDebugLLog(@"term",@"ignore EShash"); #if 0 if (c == '8') { /* DEC screen alignment test. kludge :-) */ video_erase_char = (video_erase_char & 0xff00) | 'E'; csi_J(currcons, 2); video_erase_char = (video_erase_char & 0xff00) | ' '; do_update_region(currcons, origin, screenbuf_size/2); } #endif return; case ESsetG0: if (c == '0') G0_charset = GRAF_MAP; else if (c == 'B') G0_charset = LAT1_MAP; else if (c == 'U') G0_charset = IBMPC_MAP; else if (c == 'K') G0_charset = USER_MAP; if (charset == 0) translate = set_translate(G0_charset,currcons); vc_state = ESnormal; return; case ESsetG1: if (c == '0') G1_charset = GRAF_MAP; else if (c == 'B') G1_charset = LAT1_MAP; else if (c == 'U') G1_charset = IBMPC_MAP; else if (c == 'K') G1_charset = USER_MAP; if (charset == 1) translate = set_translate(G1_charset,currcons); vc_state = ESnormal; return; default: vc_state = ESnormal; if (utf && c>0x7f) { if (utf_count && (c&0xc0)==0x80) { unich=(unich<<6)|(c&0x3f); utf_count--; if (utf_count) return; } else { if ((c & 0xe0) == 0xc0) { utf_count = 1; unich = (c & 0x1f); } else if ((c & 0xf0) == 0xe0) { utf_count = 2; unich = (c & 0x0f); } else if ((c & 0xf8) == 0xf0) { utf_count = 3; unich = (c & 0x07); } else if ((c & 0xfc) == 0xf8) { utf_count = 4; unich = (c & 0x03); } else if ((c & 0xfe) == 0xfc) { utf_count = 5; unich = (c & 0x01); } else utf_count = 0; return; } } else if (!iconv_state || translate!=translate_maps[0]) { if (toggle_meta) c|=0x80; unich=translate[c]; } else #define PUTCH \ if (x>=width && decawm) \ { \ cr(); \ lf(); \ } \ char_width=[ts relativeWidthOfCharacter: ch.ch]; \ if (decim) \ [ts ts_shiftRow: y at: x delta: char_width]; \ [ts ts_putChar: ch count: 1 at: x:y]; \ if (xwidth) \ char_width=width-x; \ if (char_width>0) \ { \ ch.ch=MULTI_CELL_GLYPH; \ [ts ts_putChar: ch count: char_width at: x:y]; \ x+=char_width; \ } \ [ts ts_goto: x:y]; \ } { screen_char_t ch; char *inp; size_t in_size; char *outp; size_t out_size; int char_width; int ret; if (toggle_meta) c|=0x80; /* TODO: there might be other cases where we should clear the buffer */ if (input_buf_len==sizeof(input_buf)) { NSLog(@"Warning: iconv() input buffer overrun!"); input_buf_len=0; } input_buf[input_buf_len++]=c; ch.color=color; ch.attr=(intensity)|(underline<<2)|(reverse<<3)|(blink<<4); inp=(char *)input_buf; in_size=input_buf_len; do { outp=(char *)&unich; out_size=4; utf_count=0; // reset the non-internal utf count ret=iconv(iconv_state,(char **)&inp,&in_size,&outp,&out_size); if (out_size==0) { ch.ch=ntohl(unich); PUTCH } if (ret>=0) break; if (errno==EILSEQ) { /* illegal input sequence. skip one byte and try again. */ ch.ch=0xfffd; PUTCH in_size--; inp++; } if (errno==EINVAL) { /* incomplete input sequence. wait for more input. */ utf_count=1; // FIXME: is this the right thing to do? break; } /* keep going while there's more input and the error was lack of output space */ } while (in_size>0 && errno==E2BIG); /* adjust the buffer */ if (in_size!=input_buf_len) { if (in_size) memmove(input_buf,inp,in_size); input_buf_len=in_size; } return; } { screen_char_t ch; int char_width; ch.color=color; ch.attr=(intensity)|(underline<<2)|(reverse<<3)|(blink<<4); ch.ch=unich; PUTCH } return; #undef PUTCH } } /* Translates '\n' to '\r' when sending. */ -(void) sendString: (NSString *)s { int l=[s length]; unsigned int ucs; int i; if (iconv_input_state) { unsigned int *inp; size_t insize; char *outp; char buf[16+1]; size_t outsize; for (i=0;i1) { s=[e characters]; NSDebugLLog(@"key",@" writing '%@'\n",s); [self sendString: s]; return; } ch=[s characterAtIndex: 0]; str=NULL; nstr=nil; ch2=0; switch (ch) { case '\e': if ([TerminalViewKeyboardPrefs doubleEscape]) str="\e\e"; else str="\e"; break; case NSUpArrowFunctionKey : str="\e[A"; break; case NSDownArrowFunctionKey : str="\e[B"; break; case NSLeftArrowFunctionKey : str="\e[D"; break; case NSRightArrowFunctionKey: str="\e[C"; break; case NSF1FunctionKey : str="\e[[A"; break; case NSF2FunctionKey : str="\e[[B"; break; case NSF3FunctionKey : str="\e[[C"; break; case NSF4FunctionKey : str="\e[[D"; break; case NSF5FunctionKey : str="\e[[E"; break; case NSF6FunctionKey : str="\e[17~"; break; case NSF7FunctionKey : str="\e[18~"; break; case NSF8FunctionKey : str="\e[19~"; break; case NSF9FunctionKey : str="\e[20~"; break; case NSF10FunctionKey: str="\e[21~"; break; case NSF11FunctionKey: str="\e[23~"; break; case NSF12FunctionKey: str="\e[24~"; break; case NSF13FunctionKey: str="\e[25~"; break; case NSF14FunctionKey: str="\e[26~"; break; case NSF15FunctionKey: str="\e[28~"; break; case NSF16FunctionKey: str="\e[29~"; break; case NSF17FunctionKey: str="\e[31~"; break; case NSF18FunctionKey: str="\e[32~"; break; case NSF19FunctionKey: str="\e[33~"; break; case NSF20FunctionKey: str="\e[34~"; break; case NSHomeFunctionKey : str="\e[1~"; break; case NSInsertFunctionKey : str="\e[2~"; break; case NSDeleteFunctionKey : str="\e[3~"; break; case NSEndFunctionKey : str="\e[4~"; break; case NSPageUpFunctionKey : str="\e[5~"; break; case NSPageDownFunctionKey: str="\e[6~"; break; case 9: // tab if (mask&NSShiftKeyMask) str="\e[Z"; else nstr=[e characters]; break; case 8: ch2=0x7f; break; case 3: ch2=0x0d; break; default: nstr=[e characters]; break; } { BOOL commandAsMeta=[TerminalViewKeyboardPrefs commandAsMeta]; BOOL altIsNotMeta =[TerminalViewKeyboardPrefs altIsNotMeta]; /* Thanks to different keyboard layouts and dumb default key handling in GNUstep, this is a bit complex. There seem to be two main cases: a. GNUstep has been correctly configured. Command is really command, alternate is really alternate, and is used as meta. AltGr isn't anything at all. No special options necessary. b. GNUstep is using the default settings. Left alt is command, right alt (which might be AltGr) is alternate. Users seem to actually want left alt to be meta, and, if right alt is AltGr, right alt not to be meta. Thus, when command-as-meta option is active, we intercept command presses and treat them as meta, and we ignore alternate. altIsNotMeta is needed to keep Alt as Alt and not as Meta. */ if ((commandAsMeta && (mask&NSCommandKeyMask)) || (!commandAsMeta && !altIsNotMeta && (mask&NSAlternateKeyMask))) { NSDebugLLog(@"key",@" meta"); [ts ts_sendCString: "\e"]; } } if (nstr) { NSDebugLLog(@"key",@" send NSString '%@'",nstr); [self sendString: nstr]; } else if (str) { NSDebugLLog(@"key",@" send '%s'",str); [ts ts_sendCString: str]; } else if (ch2>256) { NSDebugLLog(@"key",@" couldn't send %04x",ch2); NSBeep(); } else if (ch2>0) { unsigned char tmp; tmp=ch2; NSDebugLLog(@"key",@" send %02x",ch2); [ts ts_sendCString: (char *)&tmp length: 1]; } } - initWithTerminalScreen: (id)ats width: (int)w height: (int)h { const char *iconv_charset; if (!(self=[super init])) return nil; ts=ats; width=w; height=h; color=def_color=0x07; [self _reset_terminal]; iconv_charset=[TerminalParser_LinuxPrefs characterSet]; if (strcmp(iconv_charset,"iso-8859-1")) { iconv_state=iconv_open("ucs-4",iconv_charset); if (iconv_state==(iconv_t)-1) { iconv_state=NULL; NSLog(@"Warning: unable to create iconv handle for conversion from '%s'!", iconv_charset); NSLog(@"Falling back to iso-8859-1 (latin1)."); } iconv_input_state=iconv_open(iconv_charset,"ucs-4"); if (iconv_input_state==(iconv_t)-1) { iconv_input_state=NULL; NSLog(@"Warning: unable to create iconv handle for conversion to '%s'!", iconv_charset); NSLog(@"Falling back to iso-8859-1 (latin1)."); } } return self; } -(void) dealloc { if (iconv_state) iconv_close(iconv_state); if (iconv_input_state) iconv_close(iconv_input_state); [super dealloc]; } -(void) setTerminalScreenWidth: (int)w height: (int)h { y+=h-height; width=w; height=h; top=0; bottom=height; if (x>=width) x=width-1; if (x<0) x=0; if (y>=height) y=height-1; if (y<0) y=0; } @end Terminal-0.9.9/cursor_inverted.tiff010064400017500000144000000026241264654375500166620ustar multixusersMM*  (000000000000000000000000000000000000000000000000000000000000000Terminal-0.9.9/Turkish.lproj004075500017500000144000000000001264654375500152715ustar multixusersTerminal-0.9.9/Turkish.lproj/Localizable.strings010064400017500000144000000171751264654375500212140ustar multixusers/* Turkish translation by Ahmet Soyata */ /*** Turkish.lproj/Localizable.strings updated by make_strings 2002-12-09 18:39:08 +0100 add comments above this one ***/ /*** Keys found in multiple places ***/ /* File: ServicesParameterWindowController.m:98 */ /* File: ServicesPrefs.m:653 */ "Command line:" = "Komut satırı:"; /*** Strings from PreferencesWindowController.m ***/ /* File: PreferencesWindowController.m:78 */ "Apply and save" = "Uygula ve kaydet"; /* File: PreferencesWindowController.m:122 */ "Preferences" = "Seçenekler"; /* File: PreferencesWindowController.m:70 */ "Revert" = "Eski duruma dön"; /*** Strings from Services.m ***/ /* File: Services.m:152 */ "Service aborted by user." = "Hizmet kullanıcı tarafından iptal edildi"; /* File: Services.m:60 */ "There is no terminal service called '%@'.\nYour services list is probably out-of-date.\nRun 'make_services' to update it." = " '%@' adında bir hizmet yok.\nBelki hizmetleriniz güncellenmemiştir.\n 'make_services' komutu ile günceleyiniz."; /*** Strings from ServicesParameterWindowController.m ***/ /* File: ServicesParameterWindowController.m:66 */ "Cancel" = "İptal"; /* File: ServicesParameterWindowController.m:74 */ "OK" = "Tamam"; /* File: ServicesParameterWindowController.m:118 */ "Parameter for service %@" = " %@ servisi için parametre"; /*** Strings from ServicesPrefs.m ***/ /* File: ServicesPrefs.m:585 */ "Accept types" = "Kabul türleri"; /* File: ServicesPrefs.m:499 */ "Add" = "Ekle"; /* File: ServicesPrefs.m:348 */ "Error importing services" = "Servisleri yüklerken hata oluştu"; /* File: ServicesPrefs.m:401 */ "Export services" = "Hizmet ithal et"; /* File: ServicesPrefs.m:523 */ "Export..." = "... ithal et"; /* File: ServicesPrefs.m:594 */ "Filenames" = "Dosya isimleri"; /* File: ServicesPrefs.m:549 */ "Ignore output" = "Çıktıyı görmezden gel"; /* File: ServicesPrefs.m:254 */ "Import services" = "Hizmetler ihraç et"; /* File: ServicesPrefs.m:515 */ "Import..." = "... ihraç et"; /* File: ServicesPrefs.m:559 */ "Input in stdin" = "stdin'deki girdi"; /* File: ServicesPrefs.m:560 */ "Input on command line" = "Komut satırındaki girdi"; /* File: ServicesPrefs.m:640 */ "Key:" = "Anahtar:"; /* File: ServicesPrefs.m:627 */ "Name:" = "İsim:"; /* File: ServicesPrefs.m:558 */ "No input" = "Girdi yok"; /* File: ServicesPrefs.m:602 */ "Plain text" = "Sade yazı"; /* File: ServicesPrefs.m:507 */ "Remove" = "Kaldır"; /* File: ServicesPrefs.m:550 */ "Return output" = "Çıktıyı geri döndür"; /* File: ServicesPrefs.m:568 */ "Run in background" = "Arkaplanda çalış"; /* File: ServicesPrefs.m:570 */ "Run in idle window" = "Etkin pencerede çalış"; /* File: ServicesPrefs.m:569 */ "Run in new window" = "Yeni pencerede çalış"; /* File: ServicesPrefs.m:468 */ "Terminal services" = "Termianl hizmetleri"; /* File: ServicesPrefs.m:473 */ "Terminal\nservices" = "Terminal\nhizmetleri"; /* File: ServicesPrefs.m:349 */ "The file '%@' doesn't contain valid terminal services." = " '%@' dosyası geçerli terminal hizmetleri içermiyor."; /* File: ServicesPrefs.m:235 */ "Unnamed service" = "İsimsiz hizmet"; /*** Strings from TerminalParser_LinuxPrefs.m ***/ /* File: TerminalParser_LinuxPrefs.m:103 */ "'linux' terminal parser" = "'linux' terminal ayrıştırma"; /* File: TerminalParser_LinuxPrefs.m:108 */ "'linux'\nparser" = "'linux'\nayrıştırma"; /* File: TerminalParser_LinuxPrefs.m:151 */ "Character set:" = "Karakter kümesi:"; /* File: TerminalParser_LinuxPrefs.m:43 */ "Chinese" = "Çince"; /* File: TerminalParser_LinuxPrefs.m:44 */ "Custom, leave unchanged" = "Değiştirilmeden çık"; /* File: TerminalParser_LinuxPrefs.m:42 */ "East Europe, latin2" = "Doğu Avrupa, latin2"; /* File: TerminalParser_LinuxPrefs.m:40 */ "UTF-8" = "UTF-8"; /* File: TerminalParser_LinuxPrefs.m:41 */ "West Europe, latin1" = "Batı Avrupa, latin1"; /*** Strings from TerminalView.m ***/ /* File: TerminalView.m:1623 */ "Unable to fork: %m." = ": %m. çatallanamıyor"; /* File: TerminalView.m:1611 */ "Unable to open pipe for input: %m." = "Girdi %m. için boru açılamıyor"; /* File: TerminalView.m:1476 */ "[Process exited]" = "[Süreçten çıkıldı]"; /*** Strings from TerminalViewPrefs.m ***/ /* File: TerminalViewPrefs.m:330 */ "Bold font:" = "kalın yazıtipi:"; /* File: TerminalViewPrefs.m:298 */ "Color:" = "Renk:"; /* File: TerminalViewPrefs.m:277 */ "Cursor" = "İmleç"; /* File: TerminalViewPrefs.m:230 */ /* File: TerminalViewPrefs.m:225 */ "Display" = "Görüntü"; /* File: TerminalViewPrefs.m:291 */ "Filled block" = "Dolu blok"; /* File: TerminalViewPrefs.m:319 */ "Handle wide (multi-cell) glyphs" = "Geniş çok-hücreli glyph'ler tut"; /* File: TerminalViewPrefs.m:292 */ "Inverted block" = "Inverted block"; /* File: TerminalViewPrefs.m:607 */ /* File: TerminalViewPrefs.m:602 */ "Keyboard" = "Klavye"; /* File: TerminalViewPrefs.m:289 */ "Line" = "Satır"; /* File: TerminalViewPrefs.m:357 */ "Normal font:" = "Normal yazıtipi:"; /* File: TerminalViewPrefs.m:369 */ /* File: TerminalViewPrefs.m:342 */ "Pick font..." = "... yazıtipini al"; /* File: TerminalViewPrefs.m:255 */ "Scroll-back length in lines:" = "Satırlarda uzunluğu scroll-back et:"; /* File: TerminalViewPrefs.m:651 */ "Send a double escape for the escape key.\n\nThis means that the escape key will be\nrecognized faster by many programs, but\nyou can't use it as a substitute for meta." = "Escape tuşu için çift Esc girin.\n\nBöylece esc tuşunu programlar\n daha hızlı tanıyabilir, ama\nbunum meta için yedek olarak kullanamazsınız."; /* File: TerminalViewPrefs.m:492 */ /* File: TerminalViewPrefs.m:487 */ "Shell" = "Kabuk"; /* File: TerminalViewPrefs.m:527 */ "Shell:" = "Kabuk:"; /* File: TerminalViewPrefs.m:515 */ "Start as login-shell" = "Giriş-kabuğu olarak başla"; /* File: TerminalViewPrefs.m:290 */ "Stroked block" = "Hasarlı blok"; /* File: TerminalViewPrefs.m:282 */ "Style:" = "Stil:"; /* File: TerminalViewPrefs.m:634 */ "Treat the command key as meta.\n\nNote that with this enabled, you won't be\nable to access menu entries with the\nkeyboard." = "Komut anahtarı meta olarak davransın.\n\nBunu etkin hale getirince, klavyeyle\nmenülere\nerişemeyeceksiniz. "; /*** Strings from TerminalWindow.m ***/ /* File: TerminalWindow.m:192 */ /* File: TerminalWindow.m:188 */ " (idle)" = " (etkin değil)"; /*** Strings from TerminalWindowPrefs.m ***/ /* File: TerminalWindowPrefs.m:192 */ "Add top and bottom border" = "Sınırları ekle"; /* File: TerminalWindowPrefs.m:143 */ "Close new windows when idle" = "Etkin olmayan yeni pencereleri kapat"; /* File: TerminalWindowPrefs.m:156 */ "Default size" = "Öntanımlı boyut"; /* File: TerminalWindowPrefs.m:144 */ "Don't close new windows" = "Yeni pencereleri kapatmayın"; /* File: TerminalWindowPrefs.m:169 */ "Height:" = "Yükseklik:"; /* File: TerminalWindowPrefs.m:112 */ "Terminal Window" = "Terminal Penceresi"; /* File: TerminalWindowPrefs.m:117 */ "Terminal\nWindow" = "Terminal\nPenceresi"; /* File: TerminalWindowPrefs.m:160 */ "Width:" = "Genişlik:"; /*** Strings from main.m ***/ /* File: main.m:157 */ "Benchmark" = "Donanım testi"; /* File: main.m:191 */ "Close" = "Kapat"; /* File: main.m:180 */ "Copy" = "Kopyala"; /* File: main.m:177 */ "Cut" = "Kes"; /* File: main.m:186 */ "Edit" = "Dzüenle"; /* File: main.m:203 */ "Hide" = "Gizle"; /* File: main.m:159 */ "Info" = "Bilgi"; /* File: main.m:153 */ "Info..." = "Bilgi..."; /* File: main.m:171 */ "New terminal" = "Yeni terminal"; /* File: main.m:183 */ "Paste" = "Yapıştır"; /* File: main.m:155 */ "Preferences..." = "Seçenekler..."; /* File: main.m:207 */ "Quit" = "Çık"; /* File: main.m:199 */ "Services" = "Hizmetler"; /* File: main.m:194 */ "Windows" = "Pencereler"; Terminal-0.9.9/Services.h010064400017500000144000000015751264654375500145330ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #ifndef Services_h #define Services_h #define Key @"Key" #define ReturnData @"ReturnData" #define Commandline @"Commandline" #define Input @"Input" #define Type @"Type" #define AcceptTypes @"AcceptTypes" #define INPUT_NO 0 #define INPUT_STDIN 1 #define INPUT_CMDLINE 2 #define ACCEPT_STRING 1 #define ACCEPT_FILENAMES 2 #define TYPE_BACKGROUND 0 #define TYPE_WINDOW_NEW 1 #define TYPE_WINDOW_IDLE 2 @interface TerminalServices : NSObject { } +(void) updateServicesPlist; +(NSDictionary *) terminalServicesDictionary; @end #endif Terminal-0.9.9/ServicesPrefs.m010064400017500000144000000375041264654375500155410ustar multixusers/* copyright 2002 Alexander Malmberg 2009-2013 GAP Project This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import "Label.h" #import "ServicesPrefs.h" #import "Services.h" @implementation TerminalServicesPrefs -(void) _update { NSString *name,*new_name; NSMutableDictionary *d; int i; if (current<0) return; name=[service_list objectAtIndex: current]; new_name=[tf_name stringValue]; if (![new_name length]) new_name=name; d=[services objectForKey: name]; if (!d) d=[[NSMutableDictionary alloc] init]; [d setObject: [tf_key stringValue] forKey: Key]; [d setObject: [tf_cmdline stringValue] forKey: Commandline]; [d setObject: [NSString stringWithFormat: @"%i",[pb_input indexOfSelectedItem]] forKey: Input]; [d setObject: [NSString stringWithFormat: @"%i",[pb_output indexOfSelectedItem]] forKey: ReturnData]; [d setObject: [NSString stringWithFormat: @"%i",[pb_type indexOfSelectedItem]] forKey: Type]; i=0; if ([cb_string state]) i|=1; if ([cb_filenames state]) i|=2; [d setObject: [NSString stringWithFormat: @"%i",i] forKey: AcceptTypes]; if (![name isEqual: new_name]) { [services setObject: d forKey: new_name]; [services removeObjectForKey: name]; [service_list replaceObjectAtIndex: current withObject: new_name]; [list reloadData]; } } -(void) save { NSUserDefaults *ud; if (!services) return; if (!top) return; [self _update]; ud=[NSUserDefaults standardUserDefaults]; if (![services isEqual: [TerminalServices terminalServicesDictionary]]) { [ud setObject: [services copy] forKey: @"TerminalServices"]; [TerminalServices updateServicesPlist]; } } -(void) revert { NSDictionary *d; [list deselectAll: self]; DESTROY(services); DESTROY(service_list); services=[[NSMutableDictionary alloc] init]; d=[TerminalServices terminalServicesDictionary]; { NSEnumerator *e=[d keyEnumerator]; NSString *key; while ((key=[e nextObject])) { [services setObject: [[d objectForKey: key] mutableCopy] forKey: key]; } } service_list=[[[services allKeys] sortedArrayUsingSelector: @selector(compare:)] mutableCopy]; [list reloadData]; current=-1; [self tableViewSelectionDidChange: nil]; } -(NSInteger) numberOfRowsInTableView: (NSTableView *)tv { return [service_list count]; } -(id) tableView: (NSTableView *)tv objectValueForTableColumn: (NSTableColumn *)tc row: (NSInteger)row { return [service_list objectAtIndex: row]; } -(void) tableViewSelectionDidChange: (NSNotification *)n { NSInteger r=[list selectedRow]; if (current>=0) [self _update]; if (r>=0) { int i; NSString *name,*s; NSDictionary *d; name=[service_list objectAtIndex: r]; d=[services objectForKey: name]; [tf_name setEditable: YES]; [tf_cmdline setEditable: YES]; [tf_key setEditable: YES]; [pb_input setEnabled: YES]; [pb_output setEnabled: YES]; [pb_type setEnabled: YES]; [cb_string setEnabled: YES]; [cb_filenames setEnabled: YES]; [tf_name setStringValue: name]; s=[d objectForKey: Key]; [tf_key setStringValue: s?s:(NSString *)@""]; s=[d objectForKey: Commandline]; [tf_cmdline setStringValue: s?s:(NSString *)@""]; i=[[d objectForKey: Type] intValue]; if (i<0 || i>2) i=0; [pb_type selectItemAtIndex: i]; i=[[d objectForKey: Input] intValue]; if (i<0 || i>2) i=0; [pb_input selectItemAtIndex: i]; i=[[d objectForKey: ReturnData] intValue]; if (i<0 || i>1) i=0; [pb_output selectItemAtIndex: i]; if ([d objectForKey: AcceptTypes]) { i=[[d objectForKey: AcceptTypes] intValue]; [cb_string setState: !!(i&1)]; [cb_filenames setState: !!(i&2)]; } else { [cb_string setState: 1]; [cb_filenames setState: 0]; } } else { [tf_name setEditable: NO]; [tf_cmdline setEditable: NO]; [tf_key setEditable: NO]; [pb_input setEnabled: NO]; [pb_output setEnabled: NO]; [pb_type setEnabled: NO]; [cb_string setEnabled: NO]; [cb_filenames setEnabled: NO]; [tf_name setStringValue: @""]; [tf_key setStringValue: @""]; [tf_cmdline setStringValue: @""]; } current=r; } -(void) _removeService: (id)sender { NSString *name; if (current<0) return; [list deselectAll: self]; name=[service_list objectAtIndex: current]; [services removeObjectForKey: name]; [service_list removeObjectAtIndex: current]; [list reloadData]; current=-1; [self tableViewSelectionDidChange: nil]; } -(void) _addService: (id)sender { NSString *n=_(@"Unnamed service"); [service_list addObject: n]; [list reloadData]; [list selectRow: [service_list count]-1 byExtendingSelection: NO]; } -(void) _importServices: (id)sender { NSOpenPanel *op; NSDictionary *d; NSEnumerator *e; NSString *name; int result; [self save]; op=[NSOpenPanel openPanel]; [op setAccessoryView: nil]; [op setTitle: _(@"Import services")]; [op setAllowsMultipleSelection: NO]; [op setCanChooseDirectories: NO]; [op setCanChooseFiles: YES]; result=[op runModal]; if (result!=NSOKButton) return; d=[NSDictionary dictionaryWithContentsOfFile: [op filename]]; d=[d objectForKey: @"TerminalServices"]; if (!d) { NSString *s=[NSString stringWithContentsOfFile: [op filename]]; NSArray *lines=[s componentsSeparatedByString: @"\n"]; NSArray *parts; int c=[lines count]; int i,j,k; NSMutableDictionary *md=[[[NSMutableDictionary alloc] init] autorelease]; NSMutableDictionary *service; for (i=0;i=c) break; parts=[[lines objectAtIndex: i] componentsSeparatedByString: @" "]; if ([parts count]!=11) break; service=[[NSMutableDictionary alloc] init]; [service setObject: [lines objectAtIndex: i+2] forKey: Commandline]; j=[[parts objectAtIndex: 0] intValue]; if (j!=32) { unichar ch=j; [service setObject: [NSString stringWithCharacters: &ch length: 1] forKey: Key]; } j=[[parts objectAtIndex: 2] intValue]; k=0; if (j&3) /* TODO? why 1 and 2? */ k|=ACCEPT_STRING; if (j&8) k|=ACCEPT_FILENAMES; [service setObject: [NSString stringWithFormat: @"%i",k] forKey: AcceptTypes]; if (j==1) { k=0; } else { j=[[parts objectAtIndex: 3] intValue]; if (j==2) k=INPUT_CMDLINE; else if (j==4) k=INPUT_STDIN; else k=INPUT_NO; } [service setObject: [NSString stringWithFormat: @"%i",k] forKey: Input]; j=[[parts objectAtIndex: 8] intValue]; if (j==3) k=1; else k=0; [service setObject: [NSString stringWithFormat: @"%i",k] forKey: ReturnData]; j=[[parts objectAtIndex: 5] intValue]; if (j==2) k=TYPE_WINDOW_IDLE; else if (j==4) k=TYPE_WINDOW_NEW; else k=TYPE_BACKGROUND; [service setObject: [NSString stringWithFormat: @"%i",k] forKey: Type]; [md setObject: service forKey: [lines objectAtIndex: i+1]]; } if (i This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import "Label.h" @implementation NSTextField (label) + newLabel: (NSString *)title { NSTextField *f; f=[[self alloc] init]; [f setStringValue: title]; [f setEditable: NO]; [f setDrawsBackground: NO]; [f setBordered: NO]; [f setBezeled: NO]; [f setSelectable: NO]; [f sizeToFit]; return f; } @end Terminal-0.9.9/Services.m010064400017500000144000000227341272125353100145200ustar multixusers/* copyright 2002 Alexander Malmberg 2016 GAP Project Authors: Alexander Malmberg Riccardo Mottola Tim Sheridan This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #import #import #import #import #import #import #import #import #import #import #import "Services.h" #import "ServicesParameterWindowController.h" #import "TerminalWindow.h" #import "TerminalView.h" @implementation TerminalServices -(NSDictionary *) _serviceInfoForName: (NSString *)name { NSDictionary *d; d=[TerminalServices terminalServicesDictionary]; d=[d objectForKey: name]; if (!d || ![d isKindOfClass: [NSDictionary class]]) return nil; return d; } -(void) terminalService: (NSPasteboard *)pb userData: (NSString *)name error: (NSString **)error { NSDictionary *info=[self _serviceInfoForName: name]; int type,input,ret_data,accepttypes; NSString *cmdline; NSString *data; NSDebugLLog(@"service",@"run service %@\n",name); if (!info) { NSString *s= _(@"There is no terminal service called '%@'.\n" @"Your services list is probably out-of-date.\n" @"Run 'make_services' to update it."); *error=[[NSString stringWithFormat: s, name] retain]; return; } type=[[info objectForKey: Type] intValue]; ret_data=[[info objectForKey: ReturnData] intValue]; input=[[info objectForKey: Input] intValue]; cmdline=[info objectForKey: Commandline]; if ([info objectForKey: AcceptTypes]) accepttypes=[[info objectForKey: AcceptTypes] intValue]; else accepttypes=ACCEPT_STRING; NSDebugLLog(@"service",@"cmdline='%@' %i %i %i %i", cmdline,type,ret_data,input,accepttypes); data=nil; if (input && accepttypes&ACCEPT_STRING && (data=[pb stringForType: NSStringPboardType])) { } else if (input && accepttypes&ACCEPT_FILENAMES && (data=[pb propertyListForType: NSFilenamesPboardType])) { NSDebugLLog(@"service",@"got filenames '%@' '%@' %i",data,[data class],[data isProxy]); } NSDebugLLog(@"service",@"got data '%@'",data); NSLog(@"got data '%@'",data); if (input==INPUT_STDIN) { if ([data isKindOfClass: [NSArray class]]) data=[(NSArray *)data componentsJoinedByString: @"\n"]; } else if (input==INPUT_CMDLINE) { if (data && [data isKindOfClass: [NSArray class]]) data=[(NSArray *)data componentsJoinedByString: @" "]; } { int i; BOOL add_args; NSMutableString *str=[cmdline mutableCopy]; unichar ch; int p_pos; add_args=YES; p_pos=-1; for (i=0;i<[str length]-1;i++) { ch=[str characterAtIndex: i]; if (ch!='%') continue; ch=[str characterAtIndex: i+1]; if (ch=='%') { [str replaceCharactersInRange: NSMakeRange(i,1) withString: @""]; continue; } if (ch=='s' && data && input==2) { add_args=NO; [str replaceCharactersInRange: NSMakeRange(i,2) withString: data]; i+=[data length]; continue; } if (ch=='p') { p_pos=i; continue; } } if (input==INPUT_CMDLINE && data && add_args) { [str appendString: @" "]; [str appendString: data]; } cmdline=[str autorelease]; if (p_pos!=-1) { cmdline=[TerminalServicesParameterWindowController getCommandlineFrom: cmdline selectRange: NSMakeRange(p_pos,2) service: name]; if (!cmdline) { *error=[_(@"Service aborted by user.") retain]; return; } } } NSDebugLLog(@"service",@"final command line='%@'",cmdline); NSLog(@"final command line='%@'",cmdline); switch (type) { case TYPE_BACKGROUND: { NSTask *t=[[[NSTask alloc] init] autorelease]; NSPipe *sin,*sout; NSFileHandle *in,*out; [t setLaunchPath: @"/bin/sh"]; [t setArguments: [NSArray arrayWithObjects: @"-c",cmdline,nil]]; NSDebugLLog(@"service",@"t=%@",t); sin=[[[NSPipe alloc] init] autorelease]; [t setStandardInput: sin]; in=[sin fileHandleForWriting]; sout=[[[NSPipe alloc] init] autorelease]; [t setStandardOutput: sout]; out=[sout fileHandleForReading]; NSDebugLLog(@"service",@"launching"); [t launch]; if (data && input==INPUT_STDIN) { NSDebugLLog(@"service",@"writing data"); [in writeData: [data dataUsingEncoding: NSUTF8StringEncoding]]; } [in closeFile]; /* NSDebugLLog(@"service",@"waitUntilExit"); [t waitUntilExit];*/ if (ret_data) { NSString *s; NSData *result; NSDebugLLog(@"service",@"get result"); result=[out readDataToEndOfFile]; NSDebugLLog(@"service",@"got data |%@|",result); s=[[NSString alloc] initWithData: result encoding: NSUTF8StringEncoding]; s=[s autorelease]; NSDebugLLog(@"service",@"= '%@'",s); if (accepttypes==(ACCEPT_STRING|ACCEPT_FILENAMES)) [pb declareTypes: [NSArray arrayWithObjects: NSStringPboardType,NSFilenamesPboardType,nil] owner: self]; else if (accepttypes==ACCEPT_FILENAMES) [pb declareTypes: [NSArray arrayWithObjects: NSFilenamesPboardType,nil] owner: self]; else if (accepttypes==ACCEPT_STRING) [pb declareTypes: [NSArray arrayWithObjects: NSStringPboardType,nil] owner: self]; if (accepttypes&ACCEPT_FILENAMES) { NSMutableArray *ma=[[[NSMutableArray alloc] init] autorelease]; int i,c=[s length]; NSRange cur; for (i=0;i32;i++) ; cur.length=i-cur.location; [ma addObject: [s substringWithRange: cur]]; } NSDebugLLog(@"service",@"returning filenames: %@",ma); [pb setPropertyList: ma forType: NSFilenamesPboardType]; } if (accepttypes&ACCEPT_STRING) [pb setString: s forType: NSStringPboardType]; NSDebugLLog(@"service",@"return is set"); } else { NSDebugLLog(@"service",@"ignoring output"); [out closeFile]; [t waitUntilExit]; } NSDebugLLog(@"service",@"clean up"); } break; case TYPE_WINDOW_IDLE: case TYPE_WINDOW_NEW: { TerminalWindowController *twc=nil; if (type==TYPE_WINDOW_IDLE) twc=[TerminalWindowController idleTerminalWindow]; if (!twc) twc=[TerminalWindowController newTerminalWindow]; NSDebugLLog(@"service",@"got window %@",twc); [[twc frontTerminalView] runProgram: @"/bin/sh" withArguments: [NSArray arrayWithObjects: @"-c",cmdline,nil] initialInput: input==INPUT_STDIN?data:0]; } break; } NSDebugLLog(@"service",@"return"); } +(void) updateServicesPlist { NSMutableArray *a; NSDictionary *d; NSEnumerator *e; NSString *name; d=[TerminalServices terminalServicesDictionary]; a=[[NSMutableArray alloc] init]; e=[d keyEnumerator]; while ((name=[e nextObject])) { int i; NSString *key; NSMutableDictionary *md; NSDictionary *info; NSArray *types; NSString *menu_name; info=[d objectForKey: name]; md=[[NSMutableDictionary alloc] init]; [md setObject: @"Terminal" forKey: @"NSPortName"]; [md setObject: @"terminalService" forKey: @"NSMessage"]; [md setObject: name forKey: @"NSUserData"]; if ([name characterAtIndex: 0]=='/') menu_name=[name substringFromIndex: 1]; else menu_name=[NSString stringWithFormat: @"%@/%@",@"Terminal",name]; [md setObject: [NSDictionary dictionaryWithObjectsAndKeys: menu_name, @"default",nil] forKey: @"NSMenuItem"]; key=[info objectForKey: Key]; if (key && [key length]) { [md setObject: [NSDictionary dictionaryWithObjectsAndKeys: key,@"default",nil] forKey: @"NSKeyEquivalent"]; } if ([info objectForKey: AcceptTypes]) i=[[info objectForKey: AcceptTypes] intValue]; else i=ACCEPT_STRING; if (i==(ACCEPT_STRING|ACCEPT_FILENAMES)) types=[NSArray arrayWithObjects: NSStringPboardType,NSFilenamesPboardType,nil]; else if (i==ACCEPT_FILENAMES) types=[NSArray arrayWithObjects: NSFilenamesPboardType,nil]; else if (i==ACCEPT_STRING) types=[NSArray arrayWithObjects: NSStringPboardType,nil]; else types=nil; i=[[info objectForKey: Input] intValue]; if (types && (i==INPUT_STDIN || i==INPUT_CMDLINE)) [md setObject: types forKey: @"NSSendTypes"]; i=[[info objectForKey: Type] intValue]; if (i==TYPE_BACKGROUND) { i=[[info objectForKey: ReturnData] intValue]; if (types && i==1) [md setObject: types forKey: @"NSReturnTypes"]; } [a addObject: md]; DESTROY(md); } { NSString *path; path=[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES) lastObject]; path=[path stringByAppendingPathComponent: @"Services"]; path=[path stringByAppendingPathComponent: @"TerminalServices.plist"]; d=[NSDictionary dictionaryWithObject: a forKey: @"NSServices"]; [d writeToFile: path atomically: YES]; } /* TODO: if a submenu of services is 'held' open when services are reloaded, -gui crashes */ [[NSWorkspace sharedWorkspace] findApplications]; } +(NSDictionary *) terminalServicesDictionary { NSDictionary *d; d=[[NSUserDefaults standardUserDefaults] dictionaryForKey: @"TerminalServices"]; if (d) return d; d=[NSDictionary dictionaryWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @"DefaultTerminalServices" ofType: @"svcs"]]; d=[d objectForKey: @"TerminalServices"]; return d; } @end Terminal-0.9.9/ServicesParameterWindowController.m010064400017500000144000000070751264654375500216360ustar multixusers/* copyright 2002 Alexander Malmberg This file is a part of Terminal.app. Terminal.app is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See COPYING or main.m for more information. */ #include #include #include #include #include #include #include #include #include "ServicesParameterWindowController.h" #include "autokeyviewchain.h" @implementation TerminalServicesParameterWindowController -(void) _cancel: (id)sender { [NSApp stopModalWithCode: NSRunAbortedResponse]; } -(void) _ok: (id)sender { [NSApp stopModalWithCode: NSRunStoppedResponse]; } - initWithCommandline: (NSString *)cmdline selectRange: (NSRange)r service: (NSString *)service_name { NSWindow *win; win=[[NSPanel alloc] initWithContentRect: NSMakeRect(100,100,380,100) styleMask: NSTitledWindowMask|NSResizableWindowMask backing: NSBackingStoreRetained defer: YES]; if (!(self=[super initWithWindow: win])) return nil; { GSVbox *vbox; vbox=[[GSVbox alloc] init]; [vbox setBorder: 4]; [vbox setDefaultMinYMargin: 4]; { NSButton *b; GSHbox *hbox; hbox=[[GSHbox alloc] init]; [hbox setDefaultMinXMargin: 4]; [hbox setAutoresizingMask: NSViewMinXMargin]; b=[[NSButton alloc] init]; [b setTitle: _(@"Cancel")]; [b setTarget: self]; [b setAction: @selector(_cancel:)]; [b sizeToFit]; [hbox addView: b]; [b release]; b=[[NSButton alloc] init]; [b setTitle: _(@"OK")]; [b setKeyEquivalent: @"\r"]; [b setTarget: self]; [b setAction: @selector(_ok:)]; [b sizeToFit]; [hbox addView: b]; [b release]; [vbox addView: hbox enablingYResizing: NO]; [hbox release]; } { NSTextField *f; tf_cmdline=f=[[NSTextField alloc] init]; [f setAutoresizingMask: NSViewWidthSizable]; [f sizeToFit]; [f setStringValue: cmdline]; [vbox addView: f enablingYResizing: NO]; DESTROY(f); f=[[NSTextField alloc] init]; [f setAutoresizingMask: NSViewMaxXMargin]; [f setStringValue: _(@"Command line:")]; [f setEditable: NO]; [f setDrawsBackground: NO]; [f setBordered: NO]; [f setBezeled: NO]; [f setSelectable: NO]; [f sizeToFit]; [f setAutoresizingMask: 0]; [vbox addView: f enablingYResizing: NO]; DESTROY(f); [tf_cmdline setTarget: self]; [tf_cmdline setAction: @selector(_ok:)]; } [win setContentView: vbox]; [vbox release]; } [win setDelegate: self]; [win setTitle: [NSString stringWithFormat: _(@"Parameter for service %@"), service_name]]; [win autoSetupKeyViewChain]; [win makeFirstResponder: tf_cmdline]; /* if (r.length) { NSText *t=[win fieldEditor: NO forObject: tf_cmdline]; printf("t=%@ r=%@\n",[t text],NSStringFromRange(r)); [t setSelectedRange: r]; }*/ [win release]; return self; } -(NSString *) _cmdline { return [[[tf_cmdline stringValue] retain] autorelease]; } +(NSString *) getCommandlineFrom: (NSString *)cmdline selectRange: (NSRange)r service: (NSString *)service_name { TerminalServicesParameterWindowController *wc; NSString *s; int result; wc=[[self alloc] initWithCommandline: cmdline selectRange: r service: service_name]; [wc showWindow: self]; result=[NSApp runModalForWindow: [wc window]]; s=[wc _cmdline]; [wc close]; DESTROY(wc); if (result==NSRunStoppedResponse) return s; else return nil; } @end