a few more unicode fixes and some coding style tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@24439 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-01-31 12:19:45 +00:00
parent 26792908cf
commit 6d7783d6ef
2 changed files with 97 additions and 93 deletions

View file

@ -250,8 +250,8 @@ typedef struct tagCREATESTRUCT {
NSMutableString * output= [NSMutableString stringWithString:spacer];
[output appendFormat:@"MenuRef = %d\n",flags.menuRef];
[output appendFormat:@"Main Menu %s\n",flags._is_menu ? "YES" : "NO"];
[output appendFormat:@"WINDOW title %s\n",[[theWindow title]cString]];
[output appendFormat:@"WINDOW className %s\n",[[theWindow className]cString]];
[output appendFormat:@"WINDOW title %@\n", [theWindow title]];
[output appendFormat:@"WINDOW className %@\n", [theWindow className]];
[output appendFormat:@"WINDOW isVisible: %s\n",[theWindow isVisible] ? "YES" : "NO"];
[output appendFormat:@"WINDOW isAutodisplay: %s\n",[theWindow isAutodisplay] ? "YES" : "NO"];
[output appendFormat:@"WINDOW isMiniaturized: %s\n",[theWindow isMiniaturized] ? "YES" : "NO"];
@ -262,11 +262,11 @@ typedef struct tagCREATESTRUCT {
[output appendFormat:@"WINDOW isMainWindow: %s\n",[theWindow isMainWindow] ? "YES" : "NO"];
[output appendFormat:@"WINDOW isKeyWindow: %s\n",[theWindow isKeyWindow] ? "YES" : "NO"];
[output appendFormat:@"WINDOW styleMask: %d\n",[theWindow styleMask]];
[output appendFormat:@"WINDOW frame:%s",[[self NSRectDetails:[theWindow frame]] cString]];
[output appendFormat:@"WINDOW frame:%@", [self NSRectDetails:[theWindow frame]]];
//[output appendString:[self subViewDetails:theWindow]];
[output appendFormat:@"Native Class Name %s\n",
[[self getNativeClassName:(HWND)[theWindow windowNumber]] cString]];
[output appendFormat:@"Native Class Name %@\n",
[self getNativeClassName:(HWND)[theWindow windowNumber]]];
[output appendFormat:@"Win32 GWL_EXStyle %ld\n",
GetWindowLong((HWND)[theWindow windowNumber],GWL_EXSTYLE)];
@ -286,8 +286,8 @@ typedef struct tagCREATESTRUCT {
GetWindowLong((HWND)[theWindow windowNumber],GWL_ID)];
[output appendString:spacer];
[output appendFormat:@"Win32 windowtext %s\n",
[[self getWindowtext:(HWND)[theWindow windowNumber]] cString]];
[output appendFormat:@"Win32 windowtext %@\n",
[self getWindowtext:(HWND)[theWindow windowNumber]]];
return output;
}
@ -323,18 +323,16 @@ typedef struct tagCREATESTRUCT {
NSRect svRect = [sView frame];
NSRect tRect;
NSMutableString * output =[NSMutableString stringWithString:spacer];
[output appendFormat:@"subView Details for %s\n",[[theWindow title] cString]];
[output appendFormat:@"superRect %s",
[[self NSRectDetails:svRect] cString]];
[output appendFormat:@"contentRect %s",
[[self NSRectDetails:cvRect] cString]];
[output appendFormat:@"subView Details for %@\n", [theWindow title]];
[output appendFormat:@"superRect %@", [self NSRectDetails:svRect]];
[output appendFormat:@"contentRect %@", [self NSRectDetails:cvRect]];
for (i=0;i<c;i++)
{
temp=[theViews objectAtIndex:i];
tRect =[temp frame];
[output appendFormat:@"subView %u rect %s",
i,[[self NSRectDetails:tRect] cString]];
[output appendFormat:@"subView %u rect %@",
i, [self NSRectDetails:tRect]];
}
return output;
}

View file

@ -11,14 +11,15 @@
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "w32_Events.h"
@ -156,61 +157,65 @@
- (void) ApplicationDidFinishLaunching: (NSNotification*)aNotification
{
NSMenu * theMenu = [NSApp mainMenu];
NSMenu * subMenu;
NSMenuItem * anItem;
LONG result;
// Get our MainMenu window refference:
NSMenu * theMenu = [NSApp mainMenu];
NSMenu * subMenu;
NSMenuItem * anItem;
LONG result;
// Get our MainMenu window refference:
flags.menuRef=[[theMenu window] windowNumber];
flags.HAVE_MAIN_MENU=YES;
flags.menuRef = [[theMenu window] windowNumber];
flags.HAVE_MAIN_MENU = YES;
// add an entry in the main menu to bring up the config window
// add an entry in the main menu to bring up the config window
[self initConfigWindow];
// if info does not exist add it and create a submenu for it
if ([theMenu itemWithTitle:@"Info"] ==nil)
[self initConfigWindow];
// if info does not exist add it and create a submenu for it
if ([theMenu itemWithTitle:@"Info"] == nil)
{
anItem=[NSMenuItem new];
[anItem setTitle:@"Info"];
[theMenu insertItem:anItem atIndex:0];
subMenu=[NSMenu new];
[theMenu setSubmenu:subMenu forItem:anItem];
[anItem setEnabled:YES];
anItem = [NSMenuItem new];
[anItem setTitle: @"Info"];
[theMenu insertItem: anItem atIndex: 0];
subMenu = [NSMenu new];
[theMenu setSubmenu: subMenu forItem: anItem];
[anItem setEnabled: YES];
}
// add 'Server Preference' to the 'Info' item submenu
subMenu=[[theMenu itemWithTitle:@"Info"] submenu];
[subMenu addItemWithTitle:@"Server Preferences"
action:@selector(showServerPrefs:)
keyEquivalent:nil];
// add 'Server Preference' to the 'Info' item submenu
subMenu = [[theMenu itemWithTitle: @"Info"] submenu];
[subMenu addItemWithTitle: @"Server Preferences"
action: @selector(showServerPrefs:)
keyEquivalent: nil];
anItem=(NSMenuItem *)[subMenu itemWithTitle:@"Server Preferences"];
[anItem setTarget:self];
[anItem setEnabled:YES];
if (flags.HAVE_SERVER_PREFS==NO)
{
NSRunInformationalAlertPanel(@"Server Preferences Not Set",
@"Please set server Preferences\nlook in [info]->[Server Preferences]\nto change settings",
@"OK",nil, nil);
anItem = (NSMenuItem *)[subMenu itemWithTitle: @"Server Preferences"];
[anItem setTarget: self];
[anItem setEnabled: YES];
if (flags.HAVE_SERVER_PREFS == NO)
{
NSRunInformationalAlertPanel(@"Server Preferences Not Set",
@"Please set server Preferences\nlook in "
@"[info]->[Server Preferences]\nto change settings",
@"OK", nil, nil);
[configWindow makeKeyAndOrderFront:self];
}
[configWindow makeKeyAndOrderFront: self];
}
/*
reset the style on the main menu panel so when it hides it will go the the task bar
I will use WS_EX_Left for this. Note that this is native code mixed with GNUStep
*/
if (flags.useWMStyles==YES)
* reset the style on the main menu panel so when it hides it will
* go the the task bar. I will use WS_EX_Left for this.
* Note that this is native code mixed with GNUStep
*/
if (flags.useWMStyles == YES)
{
ShowWindow((HWND)flags.menuRef,SW_HIDE);
ShowWindow((HWND)flags.menuRef, SW_HIDE);
SetLastError(0);
result=SetWindowLong((HWND)flags.menuRef,GWL_EXSTYLE,(LONG)WS_EX_LEFT);
result = SetWindowLong((HWND)flags.menuRef, GWL_EXSTYLE, (LONG)WS_EX_LEFT);
// should check error here...
result=SetWindowText((HWND)flags.menuRef,[[theMenu title] cString]);
result = SetWindowTextW((HWND)flags.menuRef,
(const unichar*)[[theMenu title]
cStringUsingEncoding: NSUnicodeStringEncoding]);
ShowWindow((HWND)flags.menuRef,SW_SHOWNORMAL);
ShowWindow((HWND)flags.menuRef, SW_SHOWNORMAL);
// set app icon image for win32
}
@ -222,7 +227,7 @@
printf("reseting menu style\n");
if (result==0)
{
printf("setting mainMenu Style: Error %ld\n",GetLastError());
printf("setting mainMenu Style: Error %ld\n", GetLastError());
}
fflush(stdout);
#endif
@ -237,7 +242,7 @@
#ifdef __WM_ACTIVE__
printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\n");
printf("got Notification: %s\n",
printf("got Notification: %s\n",
[[aNotification name] cString]);
fflush(stdout);
#endif
@ -249,50 +254,51 @@
flags.HOLD_MINI_FOR_MOVE=TRUE;
}
-(void) MenuWillTearOff:(NSNotification*)aNotification
- (void) MenuWillTearOff:(NSNotification*)aNotification
{
LONG result;
NSMutableString * iconTitle =[NSMutableString stringWithString:@"MENU "];
NSMenu * theMenu=[aNotification object];
int windowNum =[[theMenu window] windowNumber];
LONG result;
NSMutableString * iconTitle =[NSMutableString stringWithString:@"MENU "];
NSMenu * theMenu=[aNotification object];
int windowNum =[[theMenu window] windowNumber];
ShowWindow((HWND)windowNum,SW_HIDE);
SetLastError(0);
result=SetWindowLong((HWND)windowNum,GWL_EXSTYLE,(LONG)WS_EX_LEFT);
// should check error here...
ShowWindow((HWND)windowNum, SW_HIDE);
SetLastError(0);
result = SetWindowLong((HWND)windowNum, GWL_EXSTYLE, (LONG)WS_EX_LEFT);
// should check error here...
// set the icon title
[iconTitle appendString: [theMenu title]];
result=SetWindowText((HWND)windowNum,[iconTitle cString]);
ShowWindow((HWND)windowNum,SW_SHOWNORMAL);
// set the icon title
[iconTitle appendString: [theMenu title]];
result = SetWindowTextW((HWND)windowNum, (const unichar*)[iconTitle
cStringUsingEncoding: NSUnicodeStringEncoding]);
ShowWindow((HWND)windowNum, SW_SHOWNORMAL);
#ifdef __APPNOTIFICATIONS__
printf("got menu tear off Notification\n");
printf("menu title is: %s\n",[[theMenu title] cString]);
#endif
#ifdef __APPNOTIFICATIONS__
printf("got menu tear off Notification\n");
printf("menu title is: %s\n", [[theMenu title] cString]);
#endif
}
-(void) MenuwillPopUP:(NSNotification*)aNotification
- (void) MenuwillPopUP:(NSNotification*)aNotification
{
LONG result;
int windowNum=[[aNotification object] windowNumber];
LONG result;
int windowNum=[[aNotification object] windowNumber];
ShowWindow((HWND)windowNum,SW_HIDE);
SetLastError(0);
result=SetWindowLong((HWND)windowNum,GWL_EXSTYLE,(LONG)WS_EX_RIGHT);
// should check error here...
ShowWindow((HWND)windowNum, SW_HIDE);
SetLastError(0);
result=SetWindowLong((HWND)windowNum, GWL_EXSTYLE, (LONG)WS_EX_RIGHT);
// should check error here...
// set the icon title
result=SetWindowText((HWND)windowNum,"Context menu");
ShowWindow((HWND)windowNum,SW_SHOWNORMAL);
// set the icon title
result = SetWindowText((HWND)windowNum, "Context menu");
ShowWindow((HWND)windowNum, SW_SHOWNORMAL);
flags.HOLD_TRANSIENT_FOR_SIZE=TRUE;
flags.HOLD_TRANSIENT_FOR_MOVE=TRUE;
flags.HOLD_TRANSIENT_FOR_SIZE=TRUE;
flags.HOLD_TRANSIENT_FOR_MOVE=TRUE;
#ifdef __APPNOTIFICATIONS__
printf("got menu Popup Notification\n");
printf("window title is: %s\n",[[[aNotification object] title] cString]);
#endif
#ifdef __APPNOTIFICATIONS__
printf("got menu Popup Notification\n");
printf("window title is: %s\n", [[[aNotification object] title] cString]);
#endif
}
- (void) WindowDidCreateWindow:(NSNotification*)aNotification
@ -308,7 +314,7 @@
GSStyle= [[aNotification object] styleMask];
//windowNum=[[aNotification object] windowNumber];
//[self resetForGSWindowStyle:(HWND)windowNum w32Style:w32style];
//printf("GSClassName %s GS Style %u w32 Style %X\n",[GSClass cString],GSStyle,(UINT)w32style);
//printf("GSClassName %s GS Style %u w32 Style %X\n", [GSClass cString], GSStyle, (UINT)w32style);
}
}
@end