diff --git a/src/prefs/dun/DUNView.h b/src/prefs/dun/DUNView.h index f8ff9ae4a6..7167cfb724 100644 --- a/src/prefs/dun/DUNView.h +++ b/src/prefs/dun/DUNView.h @@ -12,18 +12,28 @@ Authors: Sikosis (beos@gravity24hr.com) #ifndef __DUNVIEW_H__ #define __DUNVIEW_H__ -class DUNView : public BView { -public: - DUNView(BRect frame); +class DUNView : public BView +{ + public: + DUNView(BRect frame); }; -class ModemView : public BView { -public: - ModemView(BRect frame); +class ModemView : public BView +{ + public: + ModemView(BRect frame); }; -class SettingsView : public BView { -public: - SettingsView(BRect frame); +class SettingsView : public BView +{ + public: + SettingsView(BRect frame); }; + +class NewConnectionWindowView : public BView +{ + public: + NewConnectionWindowView(BRect frame); +}; + #endif diff --git a/src/prefs/dun/Jamfile b/src/prefs/dun/Jamfile index 50e5832989..cea155ff41 100644 --- a/src/prefs/dun/Jamfile +++ b/src/prefs/dun/Jamfile @@ -2,6 +2,6 @@ SubDir OBOS_TOP src prefs dun ; AddResources DialUpNetworking : DUN.rsrc ; -Preference DialUpNetworking : DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp ; +Preference DialUpNetworking : DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp NewConnectionWindow.cpp; LinkSharedOSLibs DialUpNetworking : be tracker stdc++.r4 ; \ No newline at end of file diff --git a/src/prefs/dun/NewConnectionWindow.cpp b/src/prefs/dun/NewConnectionWindow.cpp new file mode 100644 index 0000000000..8ef94bc230 --- /dev/null +++ b/src/prefs/dun/NewConnectionWindow.cpp @@ -0,0 +1,116 @@ +/* + +NewConnectionWindow - DialUp Networking + +Author: Sikosis (beos@gravity24hr.com) + +(C) 2002 OpenBeOS under MIT license + +*/ + +// Includes -------------------------------------------------------------------------------------------------- // +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "NewConnectionWindow.h" +#include "DUNView.h" + +// Constants ------------------------------------------------------------------------------------------------- // +const uint32 BTN_OKAY = 'BOky'; +const uint32 BTN_CANCEL = 'BCnl'; +const uint32 TXT_NEW_CONNECTION = 'TxCx'; +// ---------------------------------------------------------------------------------------------------------- // + + +// CenterWindowOnScreen -- Centers the BWindow to the Current Screen +static void CenterWindowOnScreen(BWindow* w) +{ + BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame()); + BPoint pt; + pt.x = screenFrame.Width()/2 - w->Bounds().Width()/2; + pt.y = screenFrame.Height()/2 - w->Bounds().Height()/2; + + if (screenFrame.Contains(pt)) + w->MoveTo(pt); +} +// ---------------------------------------------------------------------------------------------------------- // + + +// NewConnectionWindow - Constructor +NewConnectionWindow::NewConnectionWindow(BRect frame) : BWindow (frame, "NewConnectionWindow", B_MODAL_WINDOW , B_NOT_RESIZABLE , 0) +{ + InitWindow(); + CenterWindowOnScreen(this); + Show(); +} + + +// NewConnectionWindow - Destructor +NewConnectionWindow::~NewConnectionWindow() +{ + //exit(0); +} + + +// NewConnectionWindow::InitWindow +void NewConnectionWindow::InitWindow(void) +{ + BRect r; + r = Bounds(); // the whole view + + int LeftMargin = 6; + int OkayButtonSize = 60; + int CancelButtonSize = 60; + + float CancelLeftMargin = (r.right / 2) - ((OkayButtonSize + 20 + CancelButtonSize) / 2); + float OkayLeftMargin = CancelLeftMargin + CancelButtonSize + 20;; + + int NewConnectionTop = 20; + + 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); + + 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); + + //AddChild(ptrNewConnectionWindowView = new NewConnectionWindowView(r)); + AddChild(txtNewConnection); + AddChild(btnCancel); + AddChild(btnOkay); + txtNewConnection->MakeFocus(true); +} +// ---------------------------------------------------------------------------------------------------------- // + +// NewConnectionWindow::MessageReceived -- receives messages +void NewConnectionWindow::MessageReceived (BMessage *message) +{ + switch(message->what) + { + case BTN_OKAY: + char tmp[256]; + sprintf(tmp,"%s",txtNewConnection->Text()); + (new BAlert("",tmp,"tmp"))->Go(); + Hide(); // change later + break; + case BTN_CANCEL: + Hide(); // change later + break; + default: + BWindow::MessageReceived(message); + break; + } +} +// ---------------------------------------------------------------------------------------------------------- // + + diff --git a/src/prefs/dun/README b/src/prefs/dun/README index b6a6b1967c..0b6e87a3ff 100644 --- a/src/prefs/dun/README +++ b/src/prefs/dun/README @@ -3,13 +3,20 @@ I put this "stdc++.r4" in the Jamfile so it links against libstdc++.r4.so in /sy Added some simple makefiles :-) TODO +-Save Preferences in Home/Work profiles +-Add NewConnectionWindow functions (window added) +-Fix ModemWindow dropdowns -Integrate the code for DunApplet into the main app. -enable NAT checkbox - todo - a redial if disconnected checkbox - - plus commands on disconnection, connection like in ~/config/etc/ppp-script +- plus commands on disconnection, connection like in ~/config/etc/ppp-script DONE Resizing window with the TreeView "controls" AND Saving window state and position work perfectly now! yeah baby!!!!! -NEARLY THERE! :-) \ No newline at end of file +NEARLY THERE! :-) + + +Sikosis - Phil Greenway +Mizsa - Brent Mizsa \ No newline at end of file diff --git a/src/prefs/dun/makefile b/src/prefs/dun/makefile index 9ac7988fc3..77e2f6fc82 100644 --- a/src/prefs/dun/makefile +++ b/src/prefs/dun/makefile @@ -30,7 +30,7 @@ TYPE := APP # if two source files with the same name (source.c or source.cpp) # are included from different directories. Also note that spaces # in folder names do not work well with this makefile. -SRCS := DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp +SRCS := DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp NewConnectionWindow.cpp # specify the resource files to use # full path or a relative path to the resource file can be used.