| |
Changeset 113
- Timestamp:
- 02/06/08 22:06:34
(1 year ago)
- Author:
- mike
- Message:
[fix] QDocumentOpenGLView draw black bg if no savedImage
[fix] remove of dead code
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r106 |
r113 |
|
| 94 | 94 | else { |
|---|
| 95 | 95 | pointClicked = NSZeroPoint; |
|---|
| 96 | | [super mouseDown: event]; |
|---|
| | 96 | [super mouseDown: event]; |
|---|
| 97 | 97 | } |
|---|
| 98 | 98 | } |
|---|
| r112 |
r113 |
|
| 79 | 79 | - (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex |
|---|
| 80 | 80 | { |
|---|
| 81 | | Q_DEBUG(@"tableView"); |
|---|
| | 81 | Q_DEBUG(@"tableView: objectValueForTableColumn: row:%D", rowIndex); |
|---|
| 82 | 82 | |
|---|
| 83 | 83 | id VM; |
|---|
| r109 |
r113 |
|
| 62 | 62 | NSLog(@"QEditVM.nib not loaded!"); |
|---|
| 63 | 63 | } |
|---|
| 64 | | //[[editPC editPCPanel] center]; |
|---|
| 65 | 64 | |
|---|
| 66 | 65 | // Todo, define some globals |
|---|
| 67 | 66 | // set allowed filetypes |
|---|
| 68 | | fileTypes = [[NSMutableArray arrayWithObjects:@"qcow2", @"qcow", @"raw", @"cow", @"vmdk", @"cloop", @"img", @"iso", @"dsk", @"dmg", @"cdr", @"toast", @"flp", @"fs", nil] retain]; |
|---|
| | 67 | fileTypes = [[NSArray alloc] initWithArrayOfAllowedFileTypes]; |
|---|
| 69 | 68 | |
|---|
| 70 | 69 | } |
|---|
| … | … | |
| 467 | 466 | [self setVMState:QDocumentSaving]; |
|---|
| 468 | 467 | [distributedObject setCommand:'Z' arg1:0 arg2:0 arg3:0 arg4:0]; |
|---|
| 469 | | bitmapImageRep = [[[screenView screenshot:NSMakeSize(0,0)] representations] objectAtIndex:0]; |
|---|
| | 468 | bitmapImageRep = [NSBitmapImageRep imageRepWithData:[[screenView screenshot:NSMakeSize(0.0, 0.0)] TIFFRepresentation]]; |
|---|
| 470 | 469 | data =[bitmapImageRep representationUsingType: NSPNGFileType properties: nil]; |
|---|
| 471 | 470 | fileManager = [NSFileManager defaultManager]; |
|---|
| r112 |
r113 |
|
| 246 | 246 | // disabnle drag'n'drop |
|---|
| 247 | 247 | [self unregisterDraggedTypes]; |
|---|
| 248 | | |
|---|
| | 248 | /* TODO: freezes Q up to several minutes (Lock on screenBuffer?) |
|---|
| 249 | 249 | if (screenProperties.screenBufferSize > 0) { |
|---|
| 250 | 250 | if (munmap(screenBuffer, screenProperties.screenBufferSize) == -1) { |
|---|
| … | … | |
| 254 | 254 | } |
|---|
| 255 | 255 | } |
|---|
| 256 | | |
|---|
| | 256 | */ |
|---|
| 257 | 257 | [super dealloc]; |
|---|
| 258 | 258 | } |
|---|
| … | … | |
| 277 | 277 | screenProperties.screenBufferSize = 0; |
|---|
| 278 | 278 | |
|---|
| | 279 | displayProperties.x = 0.0; |
|---|
| | 280 | displayProperties.y = ICON_BAR_HEIGHT; |
|---|
| | 281 | displayProperties.width = 640; |
|---|
| | 282 | displayProperties.height = 480; |
|---|
| 279 | 283 | displayProperties.zoom = 1.0; |
|---|
| 280 | 284 | |
|---|
| … | … | |
| 290 | 294 | mouseGrabed = FALSE; // we start non grabbed |
|---|
| 291 | 295 | is_graphic_console = TRUE; // we start in grafic mode |
|---|
| | 296 | |
|---|
| 292 | 297 | } |
|---|
| 293 | 298 | |
|---|
| … | … | |
| 313 | 318 | onePixel[0] = 2.0 / displayProperties.width; |
|---|
| 314 | 319 | onePixel[1] = 2.0 / displayProperties.height; |
|---|
| 315 | | |
|---|
| 316 | | if ([document VMState] == QDocumentSaved) { |
|---|
| | 320 | |
|---|
| | 321 | if ([document VMState] == QDocumentShutdown) { |
|---|
| 317 | 322 | |
|---|
| 318 | 323 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|---|
| 319 | | glClearColor(1.0, 1.0, 1.0, 1.0); |
|---|
| | 324 | glClearColor(.0, .0, .0, .0); |
|---|
| | 325 | |
|---|
| | 326 | } else if ([document VMState] == QDocumentSaved) { |
|---|
| | 327 | |
|---|
| | 328 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|---|
| | 329 | glClearColor(0.0, 0.0, 0.0, 1.0); |
|---|
| 320 | 330 | |
|---|
| 321 | 331 | // draw saved image |
|---|
| … | … | |
| 535 | 545 | glGetTexLevelParameteriv( GL_TEXTURE_RECTANGLE_ARB, 0, GL_TEXTURE_HEIGHT, (GLint*)&screenProperties.height ); |
|---|
| 536 | 546 | } |
|---|
| 537 | | [self resizeContentToWidth:screenProperties.width height:screenProperties.height]; |
|---|
| | 547 | [self resizeContentToWidth:screenProperties.width height:screenProperties.height ]; |
|---|
| 538 | 548 | } |
|---|
| 539 | 549 | |
|---|
| … | … | |
| 542 | 552 | Q_DEBUG(@"screenshot NSSize(%f, %f)", size.width, size.height); |
|---|
| 543 | 553 | |
|---|
| 544 | | // if no size is set, make fullsize shot */ |
|---|
| 545 | | if (size.width == 0 || !size.height == 0) |
|---|
| | 554 | // if no size is set, make a fullsize shot |
|---|
| | 555 | if (size.width == 0.0 || size.height == 0.0) |
|---|
| 546 | 556 | size = [self bounds].size; |
|---|
| 547 | 557 | |
|---|
| … | … | |
| 657 | 667 | displayProperties.width = rect.size.width; |
|---|
| 658 | 668 | displayProperties.height = rect.size.height; |
|---|
| 659 | | displayProperties.x = 0.0;//rect.origin.x;//([self bounds].size.width - cw) / 2.0; |
|---|
| 660 | | displayProperties.y = ICON_BAR_HEIGHT;//([self bounds].size.height - ch) / 2.0; |
|---|
| | 669 | displayProperties.x = 0.0; |
|---|
| | 670 | displayProperties.y = ICON_BAR_HEIGHT; |
|---|
| 661 | 671 | } |
|---|
| 662 | 672 | |
|---|
| r106 |
r113 |
|
| 28 | 28 | #import "QDocumentOpenGLView.h" |
|---|
| 29 | 29 | |
|---|
| 30 | | // #define QDOCUMENTWINDOWCONTROLLER_DEBUG 1 |
|---|
| | 30 | |
|---|
| 31 | 31 | |
|---|
| 32 | 32 | @implementation QDocumentWindowController |
|---|
| … | … | |
| 68 | 68 | if ([document VMPauseWhileInactive]) |
|---|
| 69 | 69 | [document VMUnpause:self]; |
|---|
| 70 | | |
|---|
| 71 | 70 | } |
|---|
| 72 | 71 | |
|---|
| r106 |
r113 |
|
| 49 | 49 | #define FOOTER_INACTIVE NSMakeRect(3 * (IMG_WIDTH + 2) + 1, 0, IMG_WIDTH, BG_BOTTOM) |
|---|
| 50 | 50 | |
|---|
| 51 | | // #define QWINDOWDEBUG 1 |
|---|
| | 51 | |
|---|
| 52 | 52 | |
|---|
| 53 | 53 | @implementation QWindow |
|---|
| … | … | |
| 56 | 56 | - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag |
|---|
| 57 | 57 | { |
|---|
| 58 | | Q_DEBUG(@" initWithContentRect"); |
|---|
| | 58 | Q_DEBUG(@"initWithContentRect"); |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | // Conditionally add textured window flag to stylemask |
|---|
| … | … | |
| 91 | 91 | - (void)dealloc |
|---|
| 92 | 92 | { |
|---|
| 93 | | Q_DEBUG(@" dealloc"); |
|---|
| | 93 | Q_DEBUG(@"dealloc"); |
|---|
| 94 | 94 | |
|---|
| 95 | 95 | [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:self]; |
|---|
| … | … | |
| 105 | 105 | - (void) setYellow:(id)sender |
|---|
| 106 | 106 | { |
|---|
| 107 | | Q_DEBUG(@" setYellow"); |
|---|
| | 107 | Q_DEBUG(@"setYellow"); |
|---|
| 108 | 108 | |
|---|
| 109 | 109 | yellow = [[NSUserDefaults standardUserDefaults] boolForKey:@"yellow"]; |
|---|
| … | … | |
| 115 | 115 | - (void)setToolbar:(NSToolbar *)toolbar |
|---|
| 116 | 116 | { |
|---|
| 117 | | Q_DEBUG(@" setToolbar"); |
|---|
| | 117 | Q_DEBUG(@"setToolbar"); |
|---|
| 118 | 118 | |
|---|
| 119 | 119 | // Only actually call this if we respond to it on this machine |
|---|
| … | … | |
| 128 | 128 | -(void)awakeFromNib |
|---|
| 129 | 129 | { |
|---|
| 130 | | Q_DEBUG(@" awakeFromNib"); |
|---|
| | 130 | Q_DEBUG(@"awakeFromNib"); |
|---|
| 131 | 131 | |
|---|
| 132 | 132 | [self setBackgroundColor:[self sizedPolishedBackground]]; |
|---|
| … | … | |
| 136 | 136 | - (void)windowNeedsUpdate:(NSNotification *)aNotification |
|---|
| 137 | 137 | { |
|---|
| 138 | | Q_DEBUG(@" windowNeedsUpdate: %@", aNotification); |
|---|
| | 138 | Q_DEBUG(@"windowNeedsUpdate: %@", aNotification); |
|---|
| 139 | 139 | |
|---|
| 140 | 140 | [self setBackgroundColor:[self sizedPolishedBackground]]; |
|---|
| … | … | |
| 146 | 146 | - (void)setMinSize:(NSSize)aSize |
|---|
| 147 | 147 | { |
|---|
| 148 | | Q_DEBUG(@" setMinSize"); |
|---|
| | 148 | Q_DEBUG(@"setMinSize"); |
|---|
| 149 | 149 | |
|---|
| 150 | 150 | [super setMinSize:NSMakeSize(MAX(aSize.width, 128.0), MAX(aSize.height, 128.0))]; |
|---|
| … | … | |
| 153 | 153 | - (void)setFrame:(NSRect)frameRect display:(BOOL)displayFlag animate:(BOOL)animationFlag |
|---|
| 154 | 154 | { |
|---|
| 155 | | Q_DEBUG(@" setFrame"); |
|---|
| | 155 | Q_DEBUG(@"setFrame NSRect(%f, %f, %f, %f) display:%D animate:%D", frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height, displayFlag, animationFlag); |
|---|
| 156 | 156 | |
|---|
| 157 | 157 | forceDisplay = YES; |
|---|
| … | … | |
| 162 | 162 | - (NSColor *)sizedPolishedBackground |
|---|
| 163 | 163 | { |
|---|
| 164 | | Q_DEBUG(@" sizedPolishedBackground"); |
|---|
| | 164 | Q_DEBUG(@"sizedPolishedBackground"); |
|---|
| 165 | 165 | |
|---|
| 166 | 166 | NSImage *bg = [[NSImage alloc] initWithSize:[self frame].size]; |
|---|
| … | … | |
| 189 | 189 | footer = FOOTER_INACTIVE; |
|---|
| 190 | 190 | } |
|---|
| 191 | | /* |
|---|
| 192 | | // draw background |
|---|
| 193 | | if ([self isKeyWindow]) { |
|---|
| 194 | | [[NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.0 alpha:1.0] setFill]; |
|---|
| 195 | | } else if ([NSApp isActive]) { |
|---|
| 196 | | [[NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.75 alpha:1.0] setFill]; |
|---|
| 197 | | } else { |
|---|
| 198 | | [[NSColor colorWithDeviceWhite:1.0 alpha:1.0] setFill]; |
|---|
| 199 | | } |
|---|
| 200 | | NSRectFillUsingOperation(NSMakeRect(0, 0, [self frame].size.width, [self frame].size.height), NSCompositeSourceOver); |
|---|
| 201 | | */ |
|---|
| | 191 | |
|---|
| 202 | 192 | // header |
|---|
| 203 | 193 | [template |
|---|
| r106 |
r113 |
|
| 16 | 16 | |
|---|
| 17 | 17 | #define cgrect(nsrect) (*(CGRect *)&(nsrect)) |
|---|
| | 18 | |
|---|
| | 19 | #define initWithArrayOfAllowedFileTypes initWithObjects:@"qcow2", @"qcow", @"raw", @"cow", @"vmdk", @"cloop", @"img", @"iso", @"dsk", @"dmg", @"cdr", @"toast", @"flp", @"fs", nil |
|---|
Download in other formats:
| |