[Haiku-commits] r31209 - haiku/trunk/src/bin/keymap

stippi at BerliOS stippi at mail.berlios.de
Tue Jun 23 16:05:02 CEST 2009


Author: stippi
Date: 2009-06-23 16:05:01 +0200 (Tue, 23 Jun 2009)
New Revision: 31209
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31209&view=rev

Modified:
   haiku/trunk/src/bin/keymap/Keymap.cpp
   haiku/trunk/src/bin/keymap/Keymap.h
Log:
This stuff is actually used on the build host platform as well...


Modified: haiku/trunk/src/bin/keymap/Keymap.cpp
===================================================================
--- haiku/trunk/src/bin/keymap/Keymap.cpp	2009-06-23 13:32:28 UTC (rev 31208)
+++ haiku/trunk/src/bin/keymap/Keymap.cpp	2009-06-23 14:05:01 UTC (rev 31209)
@@ -20,7 +20,6 @@
 #include <FindDirectory.h>
 #include <Path.h>
 #include <String.h>
-#include <TextView.h>
 
 
 #define CHARS_TABLE_MAXSIZE  10000
@@ -620,6 +619,7 @@
 	if (file == NULL)
 		return errno;
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	text_run_array* textRuns;
 	_SaveSourceText(file, &textRuns);
 
@@ -635,6 +635,9 @@
 
 		BTextView::FreeRunArray(textRuns);
 	}
+#else
+	_SaveSourceText(file);
+#endif
 
 	return B_OK;
 }
@@ -643,7 +646,7 @@
 status_t
 Keymap::SaveAsSource(FILE* file)
 {
-	_SaveSourceText(file, NULL);
+	_SaveSourceText(file);
 	return B_OK;
 }
 
@@ -1128,6 +1131,7 @@
 }
 
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 void
 Keymap::_SaveSourceText(FILE* file, text_run_array** _textRuns)
 {
@@ -1136,9 +1140,16 @@
 		runs = BTextView::AllocRunArray(8);
 		*_textRuns = runs;
 	}
+#else
+void
+Keymap::_SaveSourceText(FILE* file)
+{
+#endif
 
 	static const rgb_color kCommentColor = (rgb_color){200, 92, 92, 255};
 	static const rgb_color kTextColor = (rgb_color){0, 0, 0, 255};
+
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	BFont font = *be_fixed_font;
 
 	if (runs != NULL) {
@@ -1146,17 +1157,20 @@
 		runs->runs[0].font = font;
 		runs->runs[0].color = kCommentColor;
 	}
+#endif
 
 	int bytes = fprintf(file, "#!/bin/keymap -l\n"
 		"#\n"
 		"#\tRaw key numbering for 101 keyboard...\n");
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	if (runs != NULL) {
 		runs->runs[1].offset = bytes;
 		runs->runs[1].font = font;
 		runs->runs[1].font.SetSize(9);
 		runs->runs[1].color = kCommentColor;
 	}
+#endif
 
 	bytes += fprintf(file, "#                                                                                        [sys]       [brk]\n"
 		"#                                                                                         0x7e        0x7f\n"
@@ -1178,11 +1192,13 @@
 		"# [ctr]             [cmd]             [  space  ]             [cmd]             [ctr]    [lft] [dwn] [rgt]    [ 0 ] [ . ]\n"
 		"#  0x5c              0x5d                 0x5e                 0x5f              0x60     0x61  0x62  0x63     0x64  0x65\n");
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	if (runs != NULL) {
 		runs->runs[2].offset = bytes;
 		runs->runs[2].font = font;
 		runs->runs[2].color = kCommentColor;
 	}
+#endif
 
 	bytes += fprintf(file, "#\n"
 		"#\tNOTE: On a Microsoft Natural Keyboard:\n"
@@ -1195,11 +1211,13 @@
 		"#\t\t\tkeypad '='   = 0x6a\n"
 		"#\t\t\tpower key    = 0x6b\n");
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	if (runs != NULL) {
 		runs->runs[3].offset = bytes;
 		runs->runs[3].font = *be_fixed_font;
 		runs->runs[3].color = kTextColor;
 	}
+#endif
 
 	bytes += fprintf(file, "Version = %ld\n"
 		"CapsLock = 0x%02lx\n"
@@ -1219,11 +1237,13 @@
 		fKeys.right_command_key, fKeys.left_control_key, fKeys.right_control_key,
 		fKeys.left_option_key, fKeys.right_option_key, fKeys.menu_key);
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	if (runs != NULL) {
 		runs->runs[4].offset = bytes;
 		runs->runs[4].font = *be_fixed_font;
 		runs->runs[4].color = kCommentColor;
 	}
+#endif
 
 	bytes += fprintf(file, "#\n"
 		"# Lock settings\n"
@@ -1234,11 +1254,13 @@
 		"#   LockSettings = CapsLock NumLock ScrollLock\n"
 		"#\n");
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	if (runs != NULL) {
 		runs->runs[5].offset = bytes;
 		runs->runs[5].font = *be_fixed_font;
 		runs->runs[5].color = kTextColor;
 	}
+#endif
 
 	bytes += fprintf(file, "LockSettings = ");
 	if ((fKeys.lock_settings & B_CAPS_LOCK) != 0)
@@ -1249,11 +1271,13 @@
 		bytes += fprintf(file, "ScrollLock ");
 	bytes += fprintf(file, "\n");
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	if (runs != NULL) {
 		runs->runs[6].offset = bytes;
 		runs->runs[6].font = *be_fixed_font;
 		runs->runs[6].color = kCommentColor;
 	}
+#endif
 
 	bytes += fprintf(file, "# Legend:\n"
 		"#   n = Normal\n"
@@ -1263,11 +1287,13 @@
 		"#   o = Option\n"
 		"# Key      n        s        c        o        os       C        Cs       Co       Cos     \n");
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
 	if (runs != NULL) {
 		runs->runs[7].offset = bytes;
 		runs->runs[7].font = *be_fixed_font;
 		runs->runs[7].color = kTextColor;
 	}
+#endif
 
 	for (int idx = 0; idx < 128; idx++) {
 		char normalKey[32];

Modified: haiku/trunk/src/bin/keymap/Keymap.h
===================================================================
--- haiku/trunk/src/bin/keymap/Keymap.h	2009-06-23 13:32:28 UTC (rev 31208)
+++ haiku/trunk/src/bin/keymap/Keymap.h	2009-06-23 14:05:01 UTC (rev 31209)
@@ -11,8 +11,11 @@
 
 
 #include <InterfaceDefs.h>
-#include <TextView.h>
 
+#if (defined(__BEOS__) || defined(__HAIKU__))
+#	include <TextView.h>
+#endif
+
 #include <stdio.h>
 #include <regex.h>
 
@@ -47,8 +50,12 @@
 	static	void			GetKey(char* chars, int32 offset, char* string);
 
 private:
+#if (defined(__BEOS__) || defined(__HAIKU__))
 			void			_SaveSourceText(FILE* file,
-								text_run_array** _textRuns);
+								text_run_array** _textRuns = NULL);
+#else
+			void			_SaveSourceText(FILE* file);
+#endif
 			void			_ComputeChars(const char* buffer,
 								struct re_registers& regs, int i, int& offset);
 			void			_ComputeTables(const char* buffer,




More information about the Haiku-commits mailing list