diff --git a/src/prefs/print/AddPrinterDialog.cpp b/src/prefs/print/AddPrinterDialog.cpp new file mode 100644 index 0000000000..a8b107b86c --- /dev/null +++ b/src/prefs/print/AddPrinterDialog.cpp @@ -0,0 +1,118 @@ +/* + * Printers Preference Application. + * Copyright (C) 2001 OpenBeOS. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "AddPrinterDialog.h" +#include "PrinterListView.h" +#include "pr_server.h" +#include "Globals.h" +#include "Messages.h" + +// BeOS API +#include +#include +#include +#include +#include + +status_t AddPrinterDialog::Start() { + AddPrinterDialog* dialog = new AddPrinterDialog(); + return B_OK; +} + +AddPrinterDialog::AddPrinterDialog() + : Inherited(BRect(78.0, 71.0, 561.0, 409.0), "Add Printer", B_MODAL_WINDOW, B_NOT_H_RESIZABLE) +{ + BuildGUI(0); + + Show(); +} + + +void AddPrinterDialog::MessageReceived(BMessage* msg) +{ + switch(msg->what) + { + default: + Inherited::MessageReceived(msg); + } +} + +void AddPrinterDialog::BuildGUI(int stage) +{ + const float boxInset = 10.0; + BRect r(Bounds()); + +// ------------------------ First of all, create a nice grey backdrop + BBox * backdrop = new BBox(Bounds(), "backdrop", B_FOLLOW_ALL_SIDES, + B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, + B_PLAIN_BORDER); + AddChild(backdrop); + +// Stage == 0 +// init_icon 64x114 Add a Local or Network Printer +// ------------------------------ +// I would like to add a... +// Local Printer +// Network Printer +// ------------------------------------------------ +// Cancel Continue + +// Add local printer: + +// Stage == 1 +// local_icon Add a Local Printer +// ------------------------------ +// Printer Name: ________________ +// Printer Type: pick one +// Connected to: pick one +// ------------------------------------------------ +// Cancel Add + +// This seems to be hard coded into the preferences dialog: +// Don't show Network transport add-on in Printer Type menu. +// If Printer Type == Preview disable Connect to popup menu. +// If Printer Type == Serial Port add a submenu to menu item +// with names in /dev/ports (if empty remove item from menu) +// If Printer Type == Parallel Port add a submenu to menu item +// with names in /dev/parallel (if empty remove item from menu) + +// Printer Driver Setup + +// Dialog Info +// Would you like to make X the default printer? +// No Yes + +// Add network printer: + +// Dialog Info +// Apple Talk networking isn't currenty enabled. If you +// wish to install a network printer you should enable +// AppleTalk in the Network preferences. +// Cancel Open Network + +// Stage == 2 + +// network_icon Add a Network Printer +// ------------------------------ +// Printer Name: ________________ +// Printer Type: pick one +// AppleTalk Printer: pick one +// ------------------------------------------------ +// Cancel Add +} diff --git a/src/prefs/print/AddPrinterDialog.h b/src/prefs/print/AddPrinterDialog.h index b9549ca7f8..a76e789138 100644 --- a/src/prefs/print/AddPrinterDialog.h +++ b/src/prefs/print/AddPrinterDialog.h @@ -12,8 +12,11 @@ public: static status_t Start(); private: - AddPrinterDialog(); - void BuildGUI(); + AddPrinterDialog(); + void MessageReceived(BMessage* msg); + + void BuildGUI(int stage); + }; #endif diff --git a/src/prefs/print/Globals.cpp b/src/prefs/print/Globals.cpp index 3b947ad926..1bedea622b 100644 --- a/src/prefs/print/Globals.cpp +++ b/src/prefs/print/Globals.cpp @@ -3,11 +3,14 @@ #include +#include + status_t GetPrinterServerMessenger(BMessenger& msgr) { // If print server is not yet running, start it - if (!be_roster->IsRunning(PSRV_SIGNATURE_TYPE)) + if (!be_roster->IsRunning(PSRV_SIGNATURE_TYPE)) { be_roster->Launch(PSRV_SIGNATURE_TYPE); + } msgr = BMessenger(PSRV_SIGNATURE_TYPE); diff --git a/src/prefs/print/Jamfile b/src/prefs/print/Jamfile index f279cce93e..4bb3fa7ca8 100644 --- a/src/prefs/print/Jamfile +++ b/src/prefs/print/Jamfile @@ -5,6 +5,7 @@ UsePrivateHeaders interface ; AddResources Printers : Printers.FileTypes.rsrc ; Preference Printers : + AddPrinterDialog.cpp Printers.cpp PrintersWindow.cpp PrinterListView.cpp diff --git a/src/prefs/print/PrintersWindow.cpp b/src/prefs/print/PrintersWindow.cpp index 82b4d76d5d..3ce6908c97 100644 --- a/src/prefs/print/PrintersWindow.cpp +++ b/src/prefs/print/PrintersWindow.cpp @@ -85,7 +85,7 @@ void PrintersWindow::MessageReceived(BMessage* msg) break; case MSG_ADD_PRINTER: - //if (AddPrinterDialog::Start() == B_OK) + if (AddPrinterDialog::Start() == B_OK); break; case MSG_REMOVE_PRINTER: