mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
gui: allow choosing printer in print dialog
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32654 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3d5d4c8350
commit
dcf4511498
7 changed files with 44 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
|||
2011-03-19 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSPrintPanel.m:
|
||||
* Panels/Spanish.lproj/GSPrintPanel.gorm:
|
||||
* Panels/English.lproj/GSPrintPanel.gorm: Tweak the print panel to
|
||||
allow the user to choose the printer
|
||||
|
||||
2011-03-18 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* Documentation/GNUmakefile (DOCUMENT_TEXT_NAME, TOP_DOC_FILES):
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"_pickedPrinter:",
|
||||
"orderFrontFontPanel:"
|
||||
);
|
||||
Super = NSObject;
|
||||
|
@ -10,11 +11,12 @@
|
|||
Actions = (
|
||||
"_pickedButton:",
|
||||
"_pickedPage:",
|
||||
"_pickedPrintOp:"
|
||||
"_pickedPrintOp:",
|
||||
"_pickedPrinter:"
|
||||
);
|
||||
Outlets = (
|
||||
_optionPanel,
|
||||
_panel
|
||||
"_optionPanel",
|
||||
"_panel"
|
||||
);
|
||||
Super = NSPanel;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -2,6 +2,7 @@
|
|||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"_pickedPrinter:",
|
||||
"orderFrontFontPanel:"
|
||||
);
|
||||
Super = NSObject;
|
||||
|
@ -10,11 +11,12 @@
|
|||
Actions = (
|
||||
"_pickedButton:",
|
||||
"_pickedPage:",
|
||||
"_pickedPrintOp:"
|
||||
"_pickedPrintOp:",
|
||||
"_pickedPrinter:"
|
||||
);
|
||||
Outlets = (
|
||||
_optionPanel,
|
||||
_panel
|
||||
"_optionPanel",
|
||||
"_panel"
|
||||
);
|
||||
Super = NSPanel;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -316,6 +316,16 @@ static NSPrintPanel *shared_instance;
|
|||
[NSApp stopModalWithCode: (_picked == NSCancelButton) ? NSCancelButton : NSOKButton];
|
||||
}
|
||||
|
||||
- (void) _pickedPrinter: (id)sender
|
||||
{
|
||||
NSPrintInfo* info = [[NSPrintOperation currentOperation] printInfo];
|
||||
NSString *name = [sender titleOfSelectedItem];
|
||||
NSPrinter *printer = [NSPrinter printerWithName: name];
|
||||
|
||||
[info setPrinter: printer];
|
||||
[self updateFromPrintInfo];
|
||||
}
|
||||
|
||||
- (void) _pickedPage: (id)sender
|
||||
{
|
||||
id pageMatrix = CONTROL(self, NSPPPageChoiceMatrix);
|
||||
|
@ -381,7 +391,23 @@ static NSPrintPanel *shared_instance;
|
|||
dict = [info dictionary];
|
||||
|
||||
/* Setup printer information */
|
||||
[CONTROL(self, NSPPNameField) setStringValue: [printer name] ];
|
||||
{
|
||||
NSArray *printerNames = [NSPrinter printerNames];
|
||||
NSInteger i;
|
||||
NSPopUpButton *button = CONTROL(self, NSPPNameField);
|
||||
[button removeAllItems];
|
||||
|
||||
for (i=0; i<[printerNames count]; i++)
|
||||
{
|
||||
NSString *printerName = [printerNames objectAtIndex: i];
|
||||
[button addItemWithTitle: printerName];
|
||||
if ([[printer name] isEqual: printerName])
|
||||
{
|
||||
[button selectItemAtIndex: i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CONTROL(self, NSPPNoteField) setStringValue: [printer note] ];
|
||||
[CONTROL(self, NSPPStatusField) setStringValue: @"Idle" ];
|
||||
|
||||
|
|
Loading…
Reference in a new issue