diff --git a/ChangeLog b/ChangeLog index 18634889a..6be5beeba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-02-29 Adam Fedor + + * Headers/AppKit/NSPageLayout.h: Update tags. + * Images/GNUmakefile: Add page_landscape.tiff, page_portrait.tiff. + * Panels/English.lproj/GSPageLayout.gorm: Update. + * Source/NSPageLayout.m: Internationalize gui text. Update for + gorm changes. (Patches from Fabien Vallon). + 2004-02-28 Adam Fedor * Version 0.9.2 diff --git a/Headers/AppKit/NSPageLayout.h b/Headers/AppKit/NSPageLayout.h index 019a88507..43d423d37 100644 --- a/Headers/AppKit/NSPageLayout.h +++ b/Headers/AppKit/NSPageLayout.h @@ -39,11 +39,13 @@ enum { NSPLTitleField, NSPLPaperNameButton, NSPLUnitsButton, - NSPLWidthForm, - NSPLHeightForm, + NSPLWidthField, + NSPLHeightField, NSPLOrientationMatrix, NSPLCancelButton, - NSPLOKButton + NSPLOKButton, + NSPLPageLayout, + NSPLScaleField }; @interface NSApplication (NSPageLayout) diff --git a/Images/GNUmakefile b/Images/GNUmakefile index 67132350e..14035cf78 100644 --- a/Images/GNUmakefile +++ b/Images/GNUmakefile @@ -111,7 +111,9 @@ common_ToolbarClippedItemsMark.tiff \ common_ToolbarSeparatorItem.tiff \ common_ToolbarShowColorsItem.tiff \ common_ToolbarShowFontsItem.tiff \ -common_ToolbarSpaceItem.tiff +common_ToolbarSpaceItem.tiff \ +page_landscape.tiff \ +page_portrait.tiff -include GNUmakefile.preamble diff --git a/Images/page_landscape.tiff b/Images/page_landscape.tiff new file mode 100644 index 000000000..734b67c7d Binary files /dev/null and b/Images/page_landscape.tiff differ diff --git a/Images/page_portrait.tiff b/Images/page_portrait.tiff new file mode 100644 index 000000000..4dc4fc700 Binary files /dev/null and b/Images/page_portrait.tiff differ diff --git a/Panels/English.lproj/GSPageLayout.gorm/data.classes b/Panels/English.lproj/GSPageLayout.gorm/data.classes index cc09ae5d9..f1758eea8 100644 --- a/Panels/English.lproj/GSPageLayout.gorm/data.classes +++ b/Panels/English.lproj/GSPageLayout.gorm/data.classes @@ -138,73 +138,24 @@ "useStandardKerning:", "useStandardLigatures:", "yank:", - "zoom:" - ); - Super = NSObject; - }; - NSApplication = { - Outlets = ( - delegate - ); - Super = NSResponder; - }; - NSButton = { - Super = NSControl; - }; - NSControl = { - Actions = ( - "takeDoubleValueFrom:", - "takeFloatValueFrom:", - "takeIntValueFrom:", - "takeObjectValueFrom:", - "takeStringValueFrom:" - ); - Outlets = ( - target - ); - Super = NSView; - }; - NSMenu = { - Super = NSObject; - }; - NSMenuItem = { - Outlets = ( - target + "zoom:", + "_pickedButton:", + "pickedOrientation:", + "_pickedPaper:", + "pickedUnits:" ); Super = NSObject; }; NSPageLayout = { Actions = ( "_pickedButton:", - "_pickedPaper:" + "pickedOrientation:", + "_pickedPaper:", + "pickedUnits:" ); Outlets = ( _panel ); Super = NSPanel; }; - NSPanel = { - Super = NSWindow; - }; - NSResponder = { - Super = NSObject; - }; - NSSlider = { - Super = NSControl; - }; - NSTextField = { - Outlets = ( - delegate - ); - Super = NSControl; - }; - NSView = { - Super = NSResponder; - }; - NSWindow = { - Outlets = ( - delegate - ); - Super = NSResponder; - }; } \ No newline at end of file diff --git a/Panels/English.lproj/GSPageLayout.gorm/objects.gorm b/Panels/English.lproj/GSPageLayout.gorm/objects.gorm index 14b6f375c..f94ad26e5 100644 Binary files a/Panels/English.lproj/GSPageLayout.gorm/objects.gorm and b/Panels/English.lproj/GSPageLayout.gorm/objects.gorm differ diff --git a/Source/NSPageLayout.m b/Source/NSPageLayout.m index b9e1d46cb..f9ea5e85e 100644 --- a/Source/NSPageLayout.m +++ b/Source/NSPageLayout.m @@ -98,9 +98,16 @@ static NSPageLayout *shared_instance; // - (NSArray*) _units { - return [NSArray arrayWithObjects: @"pts", @"mm", @"cm", @"in", nil]; + return [NSArray arrayWithObjects: _(@"Points"), _(@"Minimeters"), _(@"Centimeters"), _(@"Inches"), nil]; } + +- (NSArray*) _pageLayout +{ + return [NSArray arrayWithObjects: _(@"1 per page"), _(@"2 per page"), _(@"4 per page"), _(@"8 per page"),_(@"16 per page"),nil]; +} + + - (id) init { int style = NSTitledWindowMask; @@ -119,10 +126,10 @@ static NSPageLayout *shared_instance; { unsigned int i; id control; - NSForm *sizeForm; NSArray *subviews, *list; NSString *panel; NSDictionary *table; + id image; self = [super initWithContentRect: contentRect styleMask: aStyle @@ -158,24 +165,49 @@ static NSPageLayout *shared_instance; [_contentView addSubview: [subviews objectAtIndex: i]]; } DESTROY(_panel); - /* FIXME: Can't do this in Gorm yet: */ - sizeForm = CONTROL(self, NSPLWidthForm); - [[sizeForm cellAtIndex: 0] setEditable: NO]; - [[sizeForm cellAtIndex: 1] setEditable: NO]; - [[sizeForm cellAtIndex: 0] setSelectable: NO]; - [[sizeForm cellAtIndex: 1] setSelectable: NO]; - control = CONTROL(self, NSPLOKButton); - [self setDefaultButtonCell: [control cell]]; - /* Set up units popup */ - control = CONTROL(self, NSPLUnitsButton); + //Image + control = CONTROL(self,NSPLImageButton); + image = [[NSApplication sharedApplication] applicationIconImage]; + [control setImage:image]; + + //Units PopUpButton tag = 3 + control = CONTROL(self,NSPLUnitsButton); list = [self _units]; [control removeAllItems]; for (i = 0; i < [list count]; i++) { [control addItemWithTitle: [list objectAtIndex: i]]; + [[control itemAtIndex:i] setEnabled:YES]; } + [control setAutoenablesItems:YES]; + //Action ? + [control setTarget: self]; + //TODO check local and select the good Unit [control selectItemAtIndex: 0]; + + //Orientation matix (Portrait/Landscape) tag = 6 + control = CONTROL(self,NSPLOrientationMatrix); + [[control cellAtRow:0 column:0] setImage:[NSImage imageNamed:@"page_landscape.tiff"]]; + [[control cellAtRow:0 column:1] setImage:[NSImage imageNamed:@"page_portrait.tiff"]]; + + //pageLayout + control = CONTROL(self,NSPLPageLayout); + list = [self _pageLayout]; + [control removeAllItems]; + for (i = 0; i < [list count]; i++) + { + [control addItemWithTitle: [list objectAtIndex: i]]; + [[control itemAtIndex:i] setEnabled:YES]; + } + [control setAutoenablesItems:YES]; + //Action ? + [control setTarget: self]; + [control selectItemAtIndex: 0]; + + //Protrait YES ? + // _portrait = YES; + return self; } @@ -289,6 +321,7 @@ static NSPageLayout *shared_instance; - (void) _pickedButton: (id)sender { int tag = [sender tag]; + if (tag == NSPLOKButton) { _picked = NSOKButton; @@ -309,26 +342,26 @@ static NSPageLayout *shared_instance; - (void) _setNewPageSize { - NSForm *sizeForm = [[self contentView] viewWithTag: NSPLWidthForm]; + NSTextField *sizeField = [[self contentView] viewWithTag: NSPLWidthField]; + NSTextField *heightField = [[self contentView] viewWithTag: NSPLHeightField]; id control = [[self contentView] viewWithTag: NSPLUnitsButton]; double factor = [self factorForIndex: [control indexOfSelectedItem]]; - [[sizeForm cellAtIndex: 0] setDoubleValue: _size.width * factor]; - [[sizeForm cellAtIndex: 1] setDoubleValue: _size.height * factor]; + [sizeField setDoubleValue: _size.width * factor]; + [heightField setDoubleValue: _size.height * factor]; } - (void) _pickedPaper: (id)sender { - NSPrinter *printer; + NSPrinter *printer = [_printInfo printer]; int tag = [sender tag]; - printer = [_printInfo printer]; - + //tag == 2 if (tag == NSPLPaperNameButton) { - id ocontrol; + id control; _size = [printer pageSizeForPaper: [sender titleOfSelectedItem]]; - ocontrol = [[self contentView] viewWithTag: NSPLOrientationMatrix]; - if ([ocontrol selectedColumn] > 0) + control = [[self contentView] viewWithTag: NSPLOrientationMatrix]; + if ([control selectedColumn] > 0) { double temp = _size.width; _size.width = _size.height; @@ -336,10 +369,12 @@ static NSPageLayout *shared_instance; } [self _setNewPageSize]; } + //tag == 3 else if (tag == NSPLUnitsButton) { [self _setNewPageSize]; } + //tag == 6 else if (tag == NSPLOrientationMatrix) { if ([sender selectedColumn] > 0) @@ -471,9 +506,10 @@ static NSPageLayout *shared_instance; /* Set up size form */ _size = [_printInfo paperSize]; - control = [[self contentView] viewWithTag: NSPLWidthForm]; - [[control cellAtIndex: 0] setDoubleValue: _size.width]; - [[control cellAtIndex: 1] setDoubleValue: _size.height]; + control = [[self contentView] viewWithTag: NSPLWidthField]; + [control setDoubleValue: _size.width]; + control = [[self contentView] viewWithTag: NSPLHeightField]; + [control setDoubleValue: _size.height]; /* Set up the orientation */ { @@ -481,6 +517,20 @@ static NSPageLayout *shared_instance; control = [[self contentView] viewWithTag: NSPLOrientationMatrix]; [control selectCellAtRow: 0 column: (orient - NSPortraitOrientation)]; } + + //TODO Scaling + { + control = [[self contentView] viewWithTag: NSPLScaleField]; + float scale = 100; + NSNumber *scaleNumber; + if ( (scaleNumber = [dict objectForKey:NSPrintScalingFactor] ) ) + { + scale = [scaleNumber floatValue]; + } + + [control setFloatValue: scale]; + } + } /** Writes any layout information set by the user to the receiver's @@ -491,9 +541,10 @@ static NSPageLayout *shared_instance; id control; NSString *str; NSPrinter *printer; + float scale; + NSMutableDictionary *dict = [_printInfo dictionary]; printer = [_printInfo printer]; - /* Write Paper Name */ control = [[self contentView] viewWithTag: NSPLPaperNameButton]; str = [control titleOfSelectedItem]; @@ -503,6 +554,12 @@ static NSPageLayout *shared_instance; control = [[self contentView] viewWithTag: NSPLOrientationMatrix]; [_printInfo setOrientation: [control selectedColumn]+NSPortraitOrientation]; + + control = [[self contentView] viewWithTag: NSPLScaleField]; + scale = [control floatValue]; + [dict setObject: [NSNumber numberWithFloat:scale] forKey:NSPrintScalingFactor]; + + /* Write Size */ /* FIXME: Currently don't allow writing custom size. */