Changeset 30423 for lang/cplusplus

Show
Ignore:
Timestamp:
02/22/09 12:17:52 (4 years ago)
Author:
saturday06
Message:

yatto ugoita (TT)

Location:
lang/cplusplus/i3/trunk
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/i3/trunk/am/i3.am

    r30304 r30423  
    4545src/${GUI_DIR}/CompletionWindowCore.cpp 
    4646 
    47 #i3_SOURCES  = ${i3_SOURCES_NO_MAIN} src/Main.cpp 
    48 i3_SOURCES  = src/Main.cpp 
     47i3_SOURCES  = ${i3_SOURCES_NO_MAIN} src/Main.cpp 
    4948i3_CXXFLAGS = ${i3_CXXFLAGS_DEFAULT} ${i3_CXXFLAGS_RELEASE} 
    5049i3_LDFLAGS  = ${i3_LDFLAGS_DEFAULT} ${i3_LDFLAGS_RELEASE} 
  • lang/cplusplus/i3/trunk/configure.ac

    r30379 r30423  
    133133        fi 
    134134 
    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`" 
     135GNUSTEP_CXXFLAGS=`gnustep-config --objc-flags` 
     136GNUSTEP_LIBS=`gnustep-config --gui-libs` 
     137 
    140138        AC_SUBST(GNUSTEP_CXXFLAGS) 
    141139        AC_SUBST(GNUSTEP_LIBS) 
  • lang/cplusplus/i3/trunk/src/Common.cpp

    r30362 r30423  
    44namespace i3 
    55{ 
    6  { 
     6 
     7// http://www.gnu.org/software/gettext/FAQ.html#windows_setenv 
     8int my_setenv (const char * name, const char * value) 
     9{ 
    710    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    { 
    1923        return -1;  
    2024    } 
    2125#endif 
    2226#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 
    2631    } 
    27     memcpy(buffer, name, namelen); 
    28     if (value != NULL) { 
     32    memcpy(buffer,name,namelen); 
     33    if (value != NULL) 
     34    { 
    2935        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    { 
    3341        buffer[namelen] = 0; 
    3442    } 
    3543    return putenv(buffer); 
    3644#elif defined(HAVE_SETENV) 
    37     return setenv(name, value, 1); 
     45    return setenv(name,value,1); 
    3846#else 
    39     /* Uh oh, neither putenv() nor setenv() ... */ 
     47    // Uh oh, neither putenv() nor setenv() ... 
    4048    return -1; 
    4149#endif 
     
    4351 
    4452} 
    45  
    46  
  • lang/cplusplus/i3/trunk/src/Initial.h

    r30283 r30423  
    99//TODO: nest macro ? 
    1010//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) 
    1212#define _WIN32_IE    0x0200 // IE2 
    1313#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___Z17NSApplicationMainiPPKc 
    171#include <PrecompiledHeaders.h> 
    182#include "Common.h" 
     
    5236} 
    5337 
    54  
    55 */ 
    56  
  • lang/cplusplus/i3/trunk/src/ShellManager.cpp

    r27378 r30423  
    4444    sleep(5); 
    4545    Input i; 
    46     i.data = _("Hello, world!"); 
     46    i.data = gettext("Hello, world!"); 
    4747    mediator.getInputWindow().post(i); 
    4848} 
  • lang/cplusplus/i3/trunk/src/gui-gnustep/InputWindowCore.cpp

    r20479 r30423  
    33#include "InputWindowCore.h" 
    44#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 
    561 
    662namespace i3 
     
    2278void InputWindowCore<InputWindow>::createUI() 
    2379{ 
     80    [NSApplication sharedApplication]; 
     81    [NSApp setDelegate: [MyDelegate new]]; 
     82    [NSApp run]; 
    2483} 
    2584