diff --git a/src/prefs/dun/DUNView.cpp b/src/prefs/dun/DUNView.cpp index c9f70d793b..29e60cd9ef 100644 --- a/src/prefs/dun/DUNView.cpp +++ b/src/prefs/dun/DUNView.cpp @@ -17,6 +17,7 @@ Authors: Sikosis (beos@gravity24hr.com) #include "DUNWindow.h" #include "DUNView.h" #include "SettingsWindow.h" +#include "NewConnectionWindow.h" // DUNView -- the view so we can put objects like text boxes on it DUNView::DUNView (BRect frame) : BView (frame, "DUNView", B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW ) { @@ -36,4 +37,12 @@ SettingsView::SettingsView (BRect frame) : BView (frame, "SettingsView", B_FOLLO // Set the Background Color SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } + +NewConnectionWindowView::NewConnectionWindowView (BRect frame) : BView (frame, "NewConnectionWindowView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW ) +{ + // Set the Background Color + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} + + // end diff --git a/src/prefs/dun/DUNWindow.cpp b/src/prefs/dun/DUNWindow.cpp index 33470732e2..62da9b6c49 100644 --- a/src/prefs/dun/DUNWindow.cpp +++ b/src/prefs/dun/DUNWindow.cpp @@ -10,6 +10,7 @@ Authors: Sikosis (beos@gravity24hr.com) */ /*-----WARNING MESSY CODE AHEAD :-)------*/ #include "DUNWindow.h" +#include "NewConnectionWindow.h" // Add these to Constants file const int DUN_WINDOW_STATE_DEFAULT = 0; // default - closed @@ -125,8 +126,7 @@ void DUNWindow::InitWindow() { topframe->SetLabel(top_frame_label); top_frame_label->AddChild(connectionmenufield); - passmeon = new BStringView(BRect(24,31,284,49),"tvConnectionProfile", - ""); + passmeon = new BStringView(BRect(24,31,284,49),"tvConnectionProfile", ""); passmeon->SetViewColor(255,0,0); @@ -378,11 +378,13 @@ void DUNWindow::MessageReceived (BMessage *message) { case BTN_CONNECT: { - disconnectbutton->SetEnabled(true); - connectbutton->SetEnabled(false); - BAlert *errormsg = new BAlert("errormsg", "Chaos reigns within.\nReflect, repent, and retry.\nConnect shall return.", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT); - errormsg->SetShortcut(0, B_ESCAPE); - errormsg->Go(); + //disconnectbutton->SetEnabled(true); + //connectbutton->SetEnabled(false); + //BAlert *errormsg = new BAlert("errormsg", "Chaos reigns within.\nReflect, repent, and retry.\nConnect shall return.", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT); + //errormsg->SetShortcut(0, B_ESCAPE); + //errormsg->Go(); + //debug + ptrNewConnectionWindow = new NewConnectionWindow(BRect(0,0,260,73)); } break; case BTN_DISCONNECT: { @@ -393,9 +395,15 @@ void DUNWindow::MessageReceived (BMessage *message) errormsg->Go(); } break; + case MENU_CON_NEW: + { + ptrNewConnectionWindow = new NewConnectionWindow(BRect(0,0,250,50)); + } break; case BTN_MODEM: + { modemWindow = new ModemWindow(windowRectModem); - break; + + } break; case BTN_SETTINGS: settingsWindow = new SettingsWindow(BRect(367.0, 268.0, 657.0, 500.0)); break; diff --git a/src/prefs/dun/DUNWindow.h b/src/prefs/dun/DUNWindow.h index 2c8d97bff8..e6780af478 100644 --- a/src/prefs/dun/DUNWindow.h +++ b/src/prefs/dun/DUNWindow.h @@ -24,6 +24,7 @@ Authors: Sikosis (beos@gravity24hr.com) #include #include "ModemWindow.h" #include "DUNView.h" +#include "NewConnectionWindow.h" #include "SettingsWindow.h" #include "DetailsView.h" #include "TreeView.h" @@ -70,6 +71,7 @@ private: void InitWindow(); DUNView* aDUNview; + NewConnectionWindow* ptrNewConnectionWindow; SettingsWindow *settingsWindow; BBox *topframe; BBox *middleframe; diff --git a/src/prefs/dun/NewConnectionWindow.cpp b/src/prefs/dun/NewConnectionWindow.cpp index 8ef94bc230..5ca9a5cfd6 100644 --- a/src/prefs/dun/NewConnectionWindow.cpp +++ b/src/prefs/dun/NewConnectionWindow.cpp @@ -26,7 +26,7 @@ Author: Sikosis (beos@gravity24hr.com) #include "DUNView.h" // Constants ------------------------------------------------------------------------------------------------- // -const uint32 BTN_OKAY = 'BOky'; +const uint32 BTN_ADD = 'BAdd'; const uint32 BTN_CANCEL = 'BCnl'; const uint32 TXT_NEW_CONNECTION = 'TxCx'; // ---------------------------------------------------------------------------------------------------------- // @@ -68,26 +68,29 @@ void NewConnectionWindow::InitWindow(void) BRect r; r = Bounds(); // the whole view - int LeftMargin = 6; - int OkayButtonSize = 60; - int CancelButtonSize = 60; + int LeftMargin = 14; + int AddButtonSize = 75; + int CancelButtonSize = 75; - float CancelLeftMargin = (r.right / 2) - ((OkayButtonSize + 20 + CancelButtonSize) / 2); - float OkayLeftMargin = CancelLeftMargin + CancelButtonSize + 20;; + //float CancelLeftMargin = (r.right / 2) - ((AddButtonSize + 20 + CancelButtonSize) / 2); + //float AddLeftMargin = CancelLeftMargin + CancelButtonSize + 20;; - int NewConnectionTop = 20; + float AddLeftMargin = r.right - (AddButtonSize + 10); + float CancelLeftMargin = AddLeftMargin - (CancelButtonSize + 11); - txtNewConnection = new BTextControl(BRect(LeftMargin,NewConnectionTop,r.right-LeftMargin+2,NewConnectionTop+10), "txtNewConnection","New Connection:","New Connection",new BMessage(TXT_NEW_CONNECTION), B_FOLLOW_LEFT | B_FOLLOW_TOP , B_WILL_DRAW | B_NAVIGABLE); - txtNewConnection->SetDivider(65); + int NewConnectionTop = 10; + + txtNewConnection = new BTextControl(BRect(LeftMargin,NewConnectionTop,r.right-10,NewConnectionTop+10), "txtNewConnection","Connection name:","New Connection",new BMessage(TXT_NEW_CONNECTION), B_FOLLOW_LEFT | B_FOLLOW_TOP , B_WILL_DRAW | B_NAVIGABLE); + txtNewConnection->SetDivider(88); - btnCancel = new BButton(BRect (CancelLeftMargin,r.bottom-35,CancelLeftMargin+CancelButtonSize,r.bottom-15),"Cancel","Cancel", new BMessage(BTN_CANCEL), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); - btnOkay = new BButton(BRect (OkayLeftMargin,r.bottom-35,OkayLeftMargin+OkayButtonSize,r.bottom-15),"Okay","Okay", new BMessage(BTN_OKAY), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); - btnOkay->MakeDefault(true); + btnCancel = new BButton(BRect (CancelLeftMargin,r.bottom-34,CancelLeftMargin+CancelButtonSize,r.bottom-14),"Cancel","Cancel", new BMessage(BTN_CANCEL), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); + btnAdd = new BButton(BRect (AddLeftMargin,r.bottom-34,AddLeftMargin+AddButtonSize,r.bottom-14),"Add","Add", new BMessage(BTN_ADD), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); + btnAdd->MakeDefault(true); - //AddChild(ptrNewConnectionWindowView = new NewConnectionWindowView(r)); - AddChild(txtNewConnection); - AddChild(btnCancel); - AddChild(btnOkay); + AddChild(ptrNewConnectionWindowView = new NewConnectionWindowView(r)); + ptrNewConnectionWindowView->AddChild(txtNewConnection); + ptrNewConnectionWindowView->AddChild(btnCancel); + ptrNewConnectionWindowView->AddChild(btnAdd); txtNewConnection->MakeFocus(true); } // ---------------------------------------------------------------------------------------------------------- // @@ -97,14 +100,21 @@ void NewConnectionWindow::MessageReceived (BMessage *message) { switch(message->what) { - case BTN_OKAY: + case BTN_ADD: char tmp[256]; sprintf(tmp,"%s",txtNewConnection->Text()); (new BAlert("",tmp,"tmp"))->Go(); - Hide(); // change later + + // need to create a new file called txtNewConnection->Text() and + // place it in the /boot/home/config/settings/DUN/DUNCONNECT directory + + // before closing we need to change the main window to state 1 + + Quit(); break; case BTN_CANCEL: - Hide(); // change later + Quit(); + //Hide(); // change later break; default: BWindow::MessageReceived(message); diff --git a/src/prefs/dun/NewConnectionWindow.h b/src/prefs/dun/NewConnectionWindow.h index a403b424cb..aaef4b5af1 100644 --- a/src/prefs/dun/NewConnectionWindow.h +++ b/src/prefs/dun/NewConnectionWindow.h @@ -35,7 +35,7 @@ class NewConnectionWindow : public BWindow void InitWindow(void); NewConnectionWindowView* ptrNewConnectionWindowView; - BButton *btnOkay; + BButton *btnAdd; BButton *btnCancel; BTextControl *txtNewConnection;