Changeset 113

Show
Ignore:
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
  • trunk/QControl/QControlTableView.m

    r106 r113  
    9494    else { 
    9595        pointClicked = NSZeroPoint; 
    96         [super mouseDown: event]; 
     96               [super mouseDown: event]; 
    9797    } 
    9898} 
  • trunk/QControl/QControlTableViewController.m

    r112 r113  
    7979- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex 
    8080{ 
    81         Q_DEBUG(@"tableView"); 
     81        Q_DEBUG(@"tableView: objectValueForTableColumn: row:%D", rowIndex); 
    8282 
    8383    id VM; 
  • trunk/QDocument/QDocument.m

    r109 r113  
    6262                        NSLog(@"QEditVM.nib not loaded!"); 
    6363                } 
    64                 //[[editPC editPCPanel] center]; 
    6564         
    6665        // Todo, define some globals 
    6766        // 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]; 
    6968 
    7069    } 
     
    467466                        [self setVMState:QDocumentSaving]; 
    468467            [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]]; 
    470469                        data =[bitmapImageRep representationUsingType: NSPNGFileType properties: nil]; 
    471470                        fileManager = [NSFileManager defaultManager]; 
  • trunk/QDocument/QDocumentOpenGLView.m

    r112 r113  
    246246    // disabnle drag'n'drop 
    247247    [self unregisterDraggedTypes]; 
    248  
     248/* TODO: freezes Q up to several minutes (Lock on screenBuffer?) 
    249249    if (screenProperties.screenBufferSize > 0) { 
    250250                if (munmap(screenBuffer, screenProperties.screenBufferSize) == -1) { 
     
    254254                } 
    255255        } 
    256  
     256*/ 
    257257    [super dealloc]; 
    258258} 
     
    277277        screenProperties.screenBufferSize = 0; 
    278278         
     279        displayProperties.x = 0.0; 
     280        displayProperties.y = ICON_BAR_HEIGHT; 
     281        displayProperties.width = 640; 
     282        displayProperties.height = 480; 
    279283        displayProperties.zoom = 1.0; 
    280284         
     
    290294    mouseGrabed = FALSE; // we start non grabbed 
    291295    is_graphic_console = TRUE; // we start in grafic mode 
     296 
    292297} 
    293298 
     
    313318    onePixel[0] = 2.0 / displayProperties.width; 
    314319    onePixel[1] = 2.0 / displayProperties.height; 
    315          
    316         if ([document VMState] == QDocumentSaved) { 
     320 
     321        if ([document VMState] == QDocumentShutdown) { 
    317322 
    318323                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); 
    320330 
    321331                // draw saved image 
     
    535545                glGetTexLevelParameteriv( GL_TEXTURE_RECTANGLE_ARB, 0, GL_TEXTURE_HEIGHT, (GLint*)&screenProperties.height );    
    536546        } 
    537         [self resizeContentToWidth:screenProperties.width height:screenProperties.height]; 
     547        [self resizeContentToWidth:screenProperties.width height:screenProperties.height ]; 
    538548} 
    539549 
     
    542552        Q_DEBUG(@"screenshot NSSize(%f,  %f)", size.width, size.height); 
    543553 
    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)  
    546556                size = [self bounds].size; 
    547557 
     
    657667                displayProperties.width = rect.size.width; 
    658668                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; 
    661671        } 
    662672 
  • trunk/QDocument/QDocumentWindowController.m

    r106 r113  
    2828#import "QDocumentOpenGLView.h" 
    2929 
    30 // #define QDOCUMENTWINDOWCONTROLLER_DEBUG 1 
     30 
    3131 
    3232@implementation QDocumentWindowController 
     
    6868    if ([document VMPauseWhileInactive]) 
    6969        [document VMUnpause:self]; 
    70  
    7170} 
    7271 
  • trunk/QShared/QWindow.m

    r106 r113  
    4949#define FOOTER_INACTIVE NSMakeRect(3 * (IMG_WIDTH + 2) + 1, 0, IMG_WIDTH, BG_BOTTOM) 
    5050 
    51 // #define QWINDOWDEBUG 1 
     51 
    5252 
    5353@implementation QWindow 
     
    5656- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag 
    5757{ 
    58         Q_DEBUG(@" initWithContentRect"); 
     58        Q_DEBUG(@"initWithContentRect"); 
    5959     
    6060    // Conditionally add textured window flag to stylemask 
     
    9191- (void)dealloc 
    9292{ 
    93         Q_DEBUG(@" dealloc"); 
     93        Q_DEBUG(@"dealloc"); 
    9494     
    9595    [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:self]; 
     
    105105- (void) setYellow:(id)sender 
    106106{ 
    107         Q_DEBUG(@" setYellow"); 
     107        Q_DEBUG(@"setYellow"); 
    108108 
    109109        yellow = [[NSUserDefaults standardUserDefaults] boolForKey:@"yellow"]; 
     
    115115- (void)setToolbar:(NSToolbar *)toolbar 
    116116{ 
    117         Q_DEBUG(@" setToolbar"); 
     117        Q_DEBUG(@"setToolbar"); 
    118118     
    119119    // Only actually call this if we respond to it on this machine 
     
    128128-(void)awakeFromNib 
    129129{ 
    130         Q_DEBUG(@" awakeFromNib"); 
     130        Q_DEBUG(@"awakeFromNib"); 
    131131 
    132132    [self setBackgroundColor:[self sizedPolishedBackground]]; 
     
    136136- (void)windowNeedsUpdate:(NSNotification *)aNotification 
    137137{ 
    138         Q_DEBUG(@" windowNeedsUpdate: %@", aNotification); 
     138        Q_DEBUG(@"windowNeedsUpdate: %@", aNotification); 
    139139 
    140140    [self setBackgroundColor:[self sizedPolishedBackground]]; 
     
    146146- (void)setMinSize:(NSSize)aSize 
    147147{ 
    148         Q_DEBUG(@" setMinSize"); 
     148        Q_DEBUG(@"setMinSize"); 
    149149     
    150150    [super setMinSize:NSMakeSize(MAX(aSize.width, 128.0), MAX(aSize.height, 128.0))]; 
     
    153153- (void)setFrame:(NSRect)frameRect display:(BOOL)displayFlag animate:(BOOL)animationFlag 
    154154{ 
    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); 
    156156 
    157157    forceDisplay = YES; 
     
    162162- (NSColor *)sizedPolishedBackground 
    163163{ 
    164         Q_DEBUG(@" sizedPolishedBackground"); 
     164        Q_DEBUG(@"sizedPolishedBackground"); 
    165165     
    166166    NSImage *bg = [[NSImage alloc] initWithSize:[self frame].size]; 
     
    189189                footer = FOOTER_INACTIVE; 
    190190        } 
    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 
    202192    // header 
    203193    [template 
  • trunk/Q_Prefix.pch

    r106 r113  
    1616 
    1717#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