Changeset 30423 for lang/cplusplus
- Timestamp:
- 02/22/09 12:17:52 (4 years ago)
- Location:
- lang/cplusplus/i3/trunk
- Files:
-
- 7 modified
-
am/i3.am (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
src/Common.cpp (modified) (2 diffs)
-
src/Initial.h (modified) (1 diff)
-
src/Main.cpp (modified) (2 diffs)
-
src/ShellManager.cpp (modified) (1 diff)
-
src/gui-gnustep/InputWindowCore.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/i3/trunk/am/i3.am
r30304 r30423 45 45 src/${GUI_DIR}/CompletionWindowCore.cpp 46 46 47 #i3_SOURCES = ${i3_SOURCES_NO_MAIN} src/Main.cpp 48 i3_SOURCES = src/Main.cpp 47 i3_SOURCES = ${i3_SOURCES_NO_MAIN} src/Main.cpp 49 48 i3_CXXFLAGS = ${i3_CXXFLAGS_DEFAULT} ${i3_CXXFLAGS_RELEASE} 50 49 i3_LDFLAGS = ${i3_LDFLAGS_DEFAULT} ${i3_LDFLAGS_RELEASE} -
lang/cplusplus/i3/trunk/configure.ac
r30379 r30423 133 133 fi 134 134 135 GNUSTEP_CXXFLAGS=`gnustep-config --objc-flags` 136 # GNUSTEP_LIBS=`gnustep-config --objc-libs --base-libs --gui-libs` 137 GNUSTEP_LIBS=`gnustep-config --gui-libs` 138 # GNUSTEP_LIBS="$GNUSTEP_LIBS `gnustep-config --base-libs`" 139 # GNUSTEP_LIBS="$GNUSTEP_LIBS `gnustep-config --gui-libs`" 135 GNUSTEP_CXXFLAGS=`gnustep-config --objc-flags` 136 GNUSTEP_LIBS=`gnustep-config --gui-libs` 137 140 138 AC_SUBST(GNUSTEP_CXXFLAGS) 141 139 AC_SUBST(GNUSTEP_LIBS) -
lang/cplusplus/i3/trunk/src/Common.cpp
r30362 r30423 4 4 namespace i3 5 5 { 6 { 6 7 // http://www.gnu.org/software/gettext/FAQ.html#windows_setenv 8 int my_setenv (const char * name, const char * value) 9 { 7 10 size_t namelen = strlen(name); 8 size_t valuelen = (value == NULL ? 0 : strlen(value)); 9 #ifdef MOL_OS_WINDOWS 10 /* On Woe32, each process has two copies of the environment variables, 11 one managed by the OS and one managed by the C library. We set 12 the value in both locations, so that other software that looks in 13 one place or the other is guaranteed to see the value. Even if it's 14 a bit slow. See also 15 <http://article.gmane.org/gmane.comp.gnu.mingw.user/8272> 16 <http://article.gmane.org/gmane.comp.gnu.mingw.user/8273> 17 <http://www.cygwin.com/ml/cygwin/1999-04/msg00478.html> */ 18 if (!SetEnvironmentVariableA(name, value)) { 11 size_t valuelen = (value==NULL ? 0 : strlen(value)); 12 #if defined(MOL_OS_WINDOWS) 13 // On Woe32, each process has two copies of the environment variables, 14 // one managed by the OS and one managed by the C library. We set 15 // the value in both locations, so that other software that looks in 16 // one place or the other is guaranteed to see the value. Even if it's 17 // a bit slow. See also 18 // <http://article.gmane.org/gmane.comp.gnu.mingw.user/8272> 19 // <http://article.gmane.org/gmane.comp.gnu.mingw.user/8273> 20 // <http://www.cygwin.com/ml/cygwin/1999-04/msg00478.html> */ 21 if (!SetEnvironmentVariableA(name,value)) 22 { 19 23 return -1; 20 24 } 21 25 #endif 22 26 #if defined(HAVE_PUTENV) 23 char* buffer = (char*)malloc(namelen + 1 + valuelen + 1); 24 if (!buffer) { 25 return -1; /* no need to set errno = ENOMEM */ 27 char* buffer = (char*)malloc(namelen+1+valuelen+1); 28 if (!buffer) 29 { 30 return -1; // no need to set errno = ENOMEM 26 31 } 27 memcpy(buffer, name, namelen); 28 if (value != NULL) { 32 memcpy(buffer,name,namelen); 33 if (value != NULL) 34 { 29 35 buffer[namelen] = '='; 30 memcpy(buffer + namelen + 1, value, valuelen); 31 buffer[namelen + 1 + valuelen] = 0; 32 } else { 36 memcpy(buffer+namelen+1,value,valuelen); 37 buffer[namelen+1+valuelen] = 0; 38 } 39 else 40 { 33 41 buffer[namelen] = 0; 34 42 } 35 43 return putenv(buffer); 36 44 #elif defined(HAVE_SETENV) 37 return setenv(name, value,1);45 return setenv(name,value,1); 38 46 #else 39 / * Uh oh, neither putenv() nor setenv() ... */47 // Uh oh, neither putenv() nor setenv() ... 40 48 return -1; 41 49 #endif … … 43 51 44 52 } 45 46 -
lang/cplusplus/i3/trunk/src/Initial.h
r30283 r30423 9 9 //TODO: nest macro ? 10 10 //XXX 11 #if defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)11 #if (defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)) && !defined(MOL_GUI_GNUSTEP) 12 12 #define _WIN32_IE 0x0200 // IE2 13 13 #define _WIN32_WINNT 0x0400 // NT4.0 -
lang/cplusplus/i3/trunk/src/Main.cpp
r30362 r30423 1 extern "C" {2 #import <Cocoa/Cocoa.h>3 }4 5 int main(int argc, const char** argv)6 {7 return NSApplicationMain(argc, argv);8 //[NSApplication sharedApplication];9 // [NSApp run];10 // [NSApplication sharedApplication];11 // [NSApp setDelegate: [MyDelegate new]];12 // return 0;13 }14 15 /*16 __imp___Z17NSApplicationMainiPPKc17 1 #include <PrecompiledHeaders.h> 18 2 #include "Common.h" … … 52 36 } 53 37 54 55 */56 -
lang/cplusplus/i3/trunk/src/ShellManager.cpp
r27378 r30423 44 44 sleep(5); 45 45 Input i; 46 i.data = _("Hello, world!");46 i.data = gettext("Hello, world!"); 47 47 mediator.getInputWindow().post(i); 48 48 } -
lang/cplusplus/i3/trunk/src/gui-gnustep/InputWindowCore.cpp
r20479 r30423 3 3 #include "InputWindowCore.h" 4 4 #include "InputWindow.h" 5 6 @interface MyDelegate : NSObject 7 { 8 NSWindow *myWindow; 9 } 10 - (void) createMenu; 11 - (void) createWindow; 12 - (void) applicationWillFinishLaunching: (NSNotification *)not; 13 - (void) applicationDidFinishLaunching: (NSNotification *)not; 14 @end 15 16 @implementation MyDelegate : NSObject 17 - (void) dealloc 18 { 19 RELEASE (myWindow); 20 } 21 22 - (void) createMenu 23 { 24 NSMenu *menu; 25 26 menu = AUTORELEASE ([NSMenu new]); 27 28 [menu addItemWithTitle: @"Quit" 29 action: @selector (terminate:) 30 keyEquivalent: @"q"]; 31 32 [NSApp setMainMenu: menu]; 33 } 34 35 - (void) createWindow 36 { 37 NSRect rect = NSMakeRect (100, 100, 200, 200); 38 unsigned int styleMask = NSTitledWindowMask 39 | NSMiniaturizableWindowMask; 40 41 42 myWindow = [NSWindow alloc]; 43 myWindow = [myWindow initWithContentRect: rect 44 styleMask: styleMask 45 backing: NSBackingStoreBuffered 46 defer: NO]; 47 [myWindow setTitle: @"This is a test window"]; 48 } 49 50 - (void) applicationWillFinishLaunching: (NSNotification *)not 51 { 52 [self createMenu]; 53 [self createWindow]; 54 } 55 56 - (void) applicationDidFinishLaunching: (NSNotification *)not; 57 { 58 [myWindow makeKeyAndOrderFront: nil]; 59 } 60 @end 5 61 6 62 namespace i3 … … 22 78 void InputWindowCore<InputWindow>::createUI() 23 79 { 80 [NSApplication sharedApplication]; 81 [NSApp setDelegate: [MyDelegate new]]; 82 [NSApp run]; 24 83 } 25 84
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)