New Code by Misza and Sikosis. Special thanks to Misza !

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway
2002-09-22 23:18:24 +00:00
parent 3f6f3d2921
commit 81367b041b
19 changed files with 1674 additions and 298 deletions
+18 -17
View File
@@ -1,15 +1,18 @@
/*
DUN by Sikosis ([email protected])
DUN - DialUp Networking Preference Application
Authors: Sikosis ([email protected])
Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include "app/Application.h"
#include <Application.h>
#include <Alert.h>
#include "interface/Window.h"
#include "interface/View.h"
#include <Window.h>
#include <View.h>
#include <stdio.h>
#include "DUN.h"
@@ -40,31 +43,29 @@ float FormHeightState2 = 282;
BRect windowRect(FormTopDefault,FormLeftDefault,FormLeftDefault+FormWidthDefault,FormTopDefault+FormHeightDefault);
const uint32 MENU_CON_NEW = 'MCNu';
// DUN -- constructor for DUN Class
DUN::DUN() : BApplication (APP_SIGNATURE) {
dunWindow = new DUNWindow(windowRect);
dunWindow = new DUNWindow(windowRect);
}
// ------------------------------------------------------------------------------- //
// DUN::MessageReceived -- handles incoming messages
void DUN::MessageReceived (BMessage *message) {
switch(message->what) {
case MENU_CON_NEW:
(new BAlert("","New Connection Window","Coming Soon"))->Go();
break;
default:
BApplication::MessageReceived(message); // pass it along ...
break;
}
switch(message->what) {
default:
BApplication::MessageReceived(message); // pass it along ...
break;
}
}
// ------------------------------------------------------------------------------- //
// DUN Main
int main(void) {
DUN theApp;
theApp.Run();
return 0;
DUN theApp;
theApp.Run();
return 0;
}
// end
+5 -1
View File
@@ -1,6 +1,9 @@
/*
DUN Header by Sikosis ([email protected])
DUN Header - DialUp Networking Header
Authors: Sikosis ([email protected])
Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
@@ -10,6 +13,7 @@ DUN Header by Sikosis ([email protected])
#define __DUN_H__
#include "DUNWindow.h"
#include <iostream>
extern const char *APP_SIGNATURE;
+14 -5
View File
@@ -1,25 +1,28 @@
/*
DUNView by Sikosis ([email protected])
DUNView - DialUp Networking BView
Authors: Sikosis ([email protected])
Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include "app/Application.h"
#include "interface/Window.h"
#include "interface/View.h"
#include <Application.h>
#include <stdio.h>
#include "DUN.h"
#include "ModemWindow.h"
#include "DUNWindow.h"
#include "DUNView.h"
#include "SettingsWindow.h"
// DUNView -- the view so we can put objects like text boxes on it
DUNView::DUNView (BRect frame) : BView (frame, "DUNView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW ) {
DUNView::DUNView (BRect frame) : BView (frame, "DUNView", B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW ) {
// Set the Background Color
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
ModemView::ModemView (BRect frame) : BView (frame, "ModemView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW )
@@ -27,4 +30,10 @@ ModemView::ModemView (BRect frame) : BView (frame, "ModemView", B_FOLLOW_ALL_SID
// Set the Background Color
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
SettingsView::SettingsView (BRect frame) : BView (frame, "SettingsView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW )
{
// Set the Background Color
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
// end
+8 -1
View File
@@ -1,6 +1,9 @@
/*
DUNView by Sikosis ([email protected])
DUNView Header - DialUp Networking View Header
Authors: Sikosis ([email protected])
Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
@@ -19,4 +22,8 @@ public:
ModemView(BRect frame);
};
class SettingsView : public BView {
public:
SettingsView(BRect frame);
};
#endif
+535 -188
View File
@@ -1,53 +1,24 @@
/*
DUNWindow by Sikosis ([email protected])
DUNWindow - DialUp Networking BWindow
Authors: Sikosis ([email protected])
Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include "app/Application.h"
#include <Alert.h>
#include <Be.h>
#include <Box.h>
#include <Button.h>
#include <CheckBox.h>
#include <Entry.h>
#include <File.h>
#include <Font.h>
#include <ListItem.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Path.h>
#include <OutlineListView.h>
#include <stdio.h>
#include <TextControl.h>
#include <TextView.h>
#include <Window.h>
#include <View.h>
#include "DUN.h"
/*-----WARNING MESSY CODE AHEAD :-)------*/
#include "DUNWindow.h"
#include "ModemWindow.h"
#include "DUNView.h"
// Constants
const uint32 BTN_MODEM = 'Modm';
const uint32 BTN_DISCONNECT = 'Disc';
const uint32 BTN_CONNECT = 'Conn';
const uint32 CHK_CALLWAITING = 'Ckcw';
const uint32 CHK_DIALOUTPREFIX = 'Ckdp';
// Add these to Constants file
const int DUN_WINDOW_STATE_DEFAULT = 0; // default - closed
const int DUN_WINDOW_STATE_ONE = 1; // 1st only
const int DUN_WINDOW_STATE_TWO = 2; // 2nd only
const int DUN_WINDOW_STATE_THREE = 3; // both
const uint32 MENU_CLICKTOADD = 'MC2A';
const uint32 MENU_CON_NEW = 'MCNu';
const uint32 MENU_CON_DELETE_CURRENT = 'MCDl';
const uint32 MENU_LOC_HOME = 'MLHm';
const uint32 MENU_LOC_WORK = 'MLWk';
const uint32 MENU_LOC_NEW = 'MLNu';
const uint32 MENU_LOC_DELETE_CURRENT = 'MLDl';
int DUNWindowState;
int DUNLastWindowState;
float ModemFormTopDefault = 150;
float ModemFormLeftDefault = 150;
@@ -56,59 +27,79 @@ float ModemFormHeightDefault = 324;
BRect windowRectModem(ModemFormTopDefault,ModemFormLeftDefault,ModemFormLeftDefault+ModemFormWidthDefault,ModemFormTopDefault+ModemFormHeightDefault);
// DUNWindow -- constructor for DUNWindow Class
DUNWindow::DUNWindow(BRect frame) : BWindow (frame, "OBOS Dial-up Networking", B_TITLED_WINDOW, B_NOT_RESIZABLE , 0) {
DUNWindow::DUNWindow(BRect frame) : BWindow (frame, "OBOS Dial-up Networking", B_TITLED_WINDOW, B_NOT_RESIZABLE |B_NOT_ZOOMABLE, 0) {
InitWindow();
Show();
}
// ------------------------------------------------------------------------------- //
// DUNWindow::InitWindow -- Initialization Commands here
void DUNWindow::InitWindow(void) {
void DUNWindow::InitWindow() {
//SetStatus(0,0);//none active at beginning
BRect r;
r = Bounds();
// Add the Drawing View
aDUNview = new DUNView(r);
aDUNview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(aDUNview);
// Buttons
float ButtonTop = 217;
float ButtonWidth = 24;
BRect btn1(10,ButtonTop,83,ButtonTop+ButtonWidth);
modembutton = new BButton(btn1,"Modem","Modem...", new BMessage(BTN_MODEM), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
BRect btn2(143,ButtonTop,218,ButtonTop+ButtonWidth);
disconnectbutton = new BButton(btn2,"Disconnect","Disconnect", new BMessage(BTN_DISCONNECT), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
BRect btn3(230,ButtonTop,302,ButtonTop+ButtonWidth);
connectbutton = new BButton(btn3,"Connect","Connect", new BMessage(BTN_CONNECT), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
// Check Boxes -- Only when form in state 2
//BRect chk1(68,110,220,110);
//disablecallwaiting = new BCheckBox(chk1,"Disable call waiting","Disable call waiting:", new BMessage(CHK_CALLWAITING), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
//BRect chk2(68,137,220,110);
//dialoutprefix = new BCheckBox(chk2,"Dial out prefix","Dial out prefix:", new BMessage(CHK_DIALOUTPREFIX), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
BRect btn1(10,ButtonTop,83,ButtonTop+ButtonWidth);
modembutton = new BButton(btn1,"Modem","Modem...", new BMessage(BTN_MODEM), B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
BRect btn2(143,ButtonTop,218,ButtonTop+ButtonWidth);
disconnectbutton = new BButton(btn2,"Disconnect","Disconnect", new BMessage(BTN_DISCONNECT), B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
BRect btn3(230,ButtonTop,302,ButtonTop+ButtonWidth);
connectbutton = new BButton(btn3,"Connect","Connect", new BMessage(BTN_CONNECT), B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
connectbutton->MakeDefault(true);
disconnectbutton->SetEnabled(false);
aDUNview->AddChild(modembutton);
aDUNview->AddChild(disconnectbutton);
aDUNview->AddChild(connectbutton);
// Connection MenuField
BRect mfld1(15,8,180,28);
BRect mfld1(17,8,175,31);
BMenuItem *menuconnew;
BMenuItem *menucondelete;
top_frame_label = new BView(mfld1,"top_frame_label",B_FOLLOW_NONE,B_WILL_DRAW|B_NAVIGABLE);
top_frame_label->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
conmenufield = new BMenu("Click to add");
//conmenufield = new BPopUpMenu("Click to add");
conmenufield->AddSeparatorItem();
conmenufield->AddItem(menuconnew = new BMenuItem("New...", new BMessage(MENU_CON_NEW)));
menuconnew->SetTarget(be_app);
conmenufield->AddItem(menucondelete = new BMenuItem("Delete Current", new BMessage(MENU_CON_DELETE_CURRENT)));
menucondelete->SetEnabled(false);
menucondelete->SetTarget(be_app);
connectionmenufield = new BMenuField(mfld1,"connection_menu","Connect to:",conmenufield,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
connectionmenufield = new BMenuField(top_frame_label->Bounds(),"connection_menu","Connect to:",conmenufield,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
connectionmenufield->SetDivider(77);
connectionmenufield->SetFont(be_bold_font);
connectionmenufield->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// Location MenuField
BRect mfld2(mfld1.left,75,250,125);
BRect mfld2(17,75,205,99);//60 for small
BRect middle_rect_drp = mfld2;
BMenuItem *menulochome;
BMenuItem *menulocwork;
BMenuItem *menulocnew;
BMenuItem *menulocdelete;
locmenufield = new BMenu("Home ");
middle_frame_label = new BView(middle_rect_drp,"middle_frame_label",B_FOLLOW_NONE,B_WILL_DRAW|B_NAVIGABLE);
middle_frame_label->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
locmenufield = new BPopUpMenu("Home ");
locmenufield->AddItem(menulochome = new BMenuItem("Home", new BMessage(MENU_LOC_HOME)));
menulochome->SetTarget(be_app);
menulochome->SetMarked(true);
@@ -123,123 +114,89 @@ void DUNWindow::InitWindow(void) {
locmenufield->AddItem(menulocdelete = new BMenuItem("Delete Current", new BMessage(MENU_LOC_DELETE_CURRENT)));
menulocdelete->SetTarget(be_app);
locationmenufield = new BMenuField(mfld2,"location_menu","From location:",locmenufield,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
locationmenufield->SetDivider(88);
locationmenufield = new BMenuField(middle_frame_label->Bounds(),"location_menu","From location:",locmenufield,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
locationmenufield->SetDivider(92);
locationmenufield->SetFont(be_bold_font);
locationmenufield->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// Displays - <Create a connection profile to continue.> on the main window
BRect CPLocation(40,43,300,10);
tvConnectionProfile = new BTextView(r, "Connection Profile", CPLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvConnectionProfile->SetText("<Create a connection profile to continue.>");
tvConnectionProfile->MakeSelectable(false);
tvConnectionProfile->MakeEditable(false);
// Displays - Call waiting may be enabled.
BRect CWLocation(40,113,300,10);
tvCallWaiting = new BTextView(r, "Call waiting", CWLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvCallWaiting->SetText("Call waiting may be enabled.");
tvCallWaiting->MakeSelectable(false);
tvCallWaiting->MakeEditable(false);
// Displays - No Connection
BRect NCLocation(21,168,300,10);
tvConnection = new BTextView(r, "No Connection", NCLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvConnection->SetText("No Connection");
tvConnection->MakeSelectable(false);
tvConnection->MakeEditable(false);
// Display - Time Online ie. 00:00:00
BRect TOLocation(249,168,300,10);
tvTimeOnline = new BTextView(r, "Time Online", TOLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvTimeOnline->SetText("00:00:00");
tvTimeOnline->MakeSelectable(false);
tvTimeOnline->MakeEditable(false);
// Display - TextView of Local IP address
BRect TextLIPLocation(21,186,300,10);
tvLIP = new BTextView(r, "Local IP address", TextLIPLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvLIP->SetText("Local IP address:");
tvLIP->MakeSelectable(false);
tvLIP->MakeEditable(false);
// Display - Local IP address
BRect LIPLocation (264,186,300,10);
tvLocalIPAddress = new BTextView(r, "None", LIPLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvLocalIPAddress->SetText("None");
tvLocalIPAddress->MakeSelectable(false);
tvLocalIPAddress->MakeEditable(false);
// Outline List View - Fake ones really as we're only using them as an indicator.
BListItem *conitem;
BListItem *consubitem;
BRect lst1(20,44,100,80);
BListItem *locitem;
BListItem *locsubitem;
BRect lst2(20,114,100,170);
connectionlistitem = new BOutlineListView(lst1, "connection_list", B_MULTIPLE_SELECTION_LIST);
connectionlistitem->AddItem(conitem = new BStringItem(""));
connectionlistitem->AddUnder(consubitem = new BStringItem("\0"), conitem);
connectionlistitem->Collapse(conitem);
/* BFont myfont;
connectionlistitem->GetFont(&myfont);
myfont.SetShear(5.0);
myfont.SetSpacing(B_CHAR_SPACING);
connectionlistitem->SetFont(&myfont);*/
//connectionlistitem->Update(aDUNview,);
locationlistitem = new BOutlineListView(lst2, "location_list", B_SINGLE_SELECTION_LIST);
locationlistitem->AddItem(locitem = new BStringItem(""));
locationlistitem->AddUnder(locsubitem = new BStringItem(""), locitem);
locationlistitem->Collapse(locitem);
// Frames
BRect tf(10,18,302,67);
topframe = new BBox(tf,"Connect to:",B_FOLLOW_ALL | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
BRect mf(10,86,302,139);
middleframe = new BBox(mf,"From Location:",B_FOLLOW_ALL | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
BRect bf(10,149,302,208);
bottomframe = new BBox(bf,"Connection",B_FOLLOW_ALL | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
BRect tf(10,8,302,67);
topframe = new BBox(tf,"Connect to:",B_FOLLOW_NONE | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
topframe->SetLabel(top_frame_label);
top_frame_label->AddChild(connectionmenufield);
// Set Labels for Frames
//middleframe->SetLabel("From Location:");
bottomframe->SetLabel("Connection");
// Add our Objects to the Window
AddChild(modembutton);
AddChild(disconnectbutton);
AddChild(connectbutton);
// AddChild(disablecallwaiting);
// AddChild(dialoutprefix);
AddChild(connectionlistitem);
AddChild(topframe);
AddChild(connectionmenufield);
AddChild(locationlistitem);
AddChild(middleframe);
AddChild(locationmenufield);
AddChild(bottomframe);
AddChild(tvConnectionProfile);
AddChild(tvCallWaiting);
AddChild(tvConnection);
AddChild(tvTimeOnline);
AddChild(tvLIP);
AddChild(tvLocalIPAddress);
passmeon = new BStringView(BRect(24,31,284,49),"tvConnectionProfile",
"<Create a connection profile to continue.>");
passmeon->SetViewColor(255,0,0);
// Make Connection Menu the Focus -- otherwise it looks funny
connectionmenufield->MakeFocus(true);
// Disable Buttons that need to be
disconnectbutton->SetEnabled(false);
connectbutton->SetEnabled(false);
// Set Default Button
connectbutton->MakeDefault(true);
// Add the Drawing View
AddChild(aDUNview = new DUNView(r));
passmeon2 = new DetailsView();
//***********INTEGRAL TO GETTING SET STATE READY
//passmeon2->Hide();
topframe->AddChild(passmeon2);
topframe->AddChild(passmeon);
BRect THESPOT = BRect(10,37,19,45);
trvconnect = new TreeView(THESPOT);
trvconnect->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
topframe->AddChild(trvconnect);
aDUNview->AddChild(topframe);
BRect mf(10,76,302,139);
middleframe = new BBox(mf,"From Location:",B_FOLLOW_NONE | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
middleframe->SetLabel(middle_frame_label);
middle_frame_label->AddChild(locationmenufield);
passmeon4 = new BStringView(BRect(25,31+4,284,49+4),"tvCallWaiting","Call waiting may be enabled.");
passmeon3 = new LocationView();
//***********INTEGRAL TO GETTING SET STATE READY
//passmeon3->Hide();
middleframe->AddChild(passmeon3);
middleframe->AddChild(passmeon4);
BRect THESPOT2 = BRect(10,37+4,19,45+4);
trvlocation = new TreeView(THESPOT2);
trvlocation->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
middleframe->AddChild(trvlocation);
aDUNview->AddChild(middleframe);
BRect bf(10,149,302,208);
bottomframe = new BBox(bf,"Connection",B_FOLLOW_BOTTOM | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
bottomframe->SetLabel("Connection");
// Displays - No Connection
BRect NCLocation(10,18,80,30);
svNoConnect = new BStringView(NCLocation,"svNoConnect","No Connection");
// Displays - Text Label of Local IP address
BRect LocalIPAddressLocation(NCLocation.left,35,100,47);
svLocalIPAddress = new BStringView(LocalIPAddressLocation,"svLocalIPAddress","Local IP address:");
// Display - Time Online ie. 00:00:00
BRect TOLocation(238,NCLocation.top,288,NCLocation.bottom);
svTimeOnline = new BStringView(TOLocation,"svTimeOnline","00:00:00");
// Display - Local IP address ie. None -- might find some code to get the current ip address and
// put that in here instead ... hrmmm ;)
BRect LIPLocation (253,LocalIPAddressLocation.top,283,LocalIPAddressLocation.bottom);
svLIP = new BStringView(LIPLocation,"svLIP","None");
// Add to Bottom Frame
bottomframe->AddChild(svNoConnect);
bottomframe->AddChild(svLocalIPAddress);
bottomframe->AddChild(svTimeOnline);
bottomframe->AddChild(svLIP);
aDUNview->AddChild(bottomframe);
// Load User Settings
BPath path;
@@ -249,22 +206,63 @@ void DUNWindow::InitWindow(void) {
BMessage msg;
msg.Unflatten(&file);
LoadSettings (&msg);
}
// ------------------------------------------------------------------------------- //
//void DUNView::MouseDown(BPoint bp) {
//BString *tmp;
// (new BAlert("","Clicked","Okay"))->Go();
//}
// DUNWindow::~DUNWindow -- destructor
DUNWindow::~DUNWindow() {
DUNWindow::~DUNWindow()
{
exit(0);
}
// ------------------------------------------------------------------------------- //
void DUNWindow::DUNResizeHandler()
{ //post: window has been set to last state :-)
switch (DUNWindowState)
{
case DUN_WINDOW_STATE_DEFAULT:
{
SetStatus(0,0);
trvconnect->SetTreeViewStatus(false);
trvlocation->SetTreeViewStatus(false);
ResizeTo(312,250);
passmeon2->Hide();
passmeon3->Hide();
} break;
case DUN_WINDOW_STATE_ONE:
{
ResizeTo(312,250);
SetStatus(0,0);
trvconnect->SetTreeViewStatus(true);
trvlocation->SetTreeViewStatus(false);
DoResizeMagic();
} break;
case DUN_WINDOW_STATE_TWO:
{
ResizeTo(312,250);
SetStatus(0,0);
trvconnect->SetTreeViewStatus(false);
trvlocation->SetTreeViewStatus(true);
DoResizeMagic();
} break;
case DUN_WINDOW_STATE_THREE:
{
ResizeTo(312,250);
SetStatus(0,0);
trvconnect->SetTreeViewStatus(true);
trvlocation->SetTreeViewStatus(true);
DoResizeMagic();
} break;
}
}
//------------------------------------------------------//
// DUNWindow::LoadSettings -- Loads your current DUN settings
void DUNWindow::LoadSettings(BMessage *msg)
{
@@ -272,18 +270,81 @@ void DUNWindow::LoadSettings(BMessage *msg)
if (B_OK == msg->FindRect("windowframe",&frame)) {
MoveTo(frame.left,frame.top);
ResizeTo(frame.right-frame.left,frame.bottom-frame.top);
}
}
//load a last mode thingy to prevent cumulative resizing
int16 LoadedLastWindowState;
if (B_OK == msg->FindInt16("lastwindowstate",&LoadedLastWindowState)) {
DUNLastWindowState = LoadedLastWindowState;
cout << "From Settings: " << DUNLastWindowState << endl;
}
else
DUNLastWindowState = DUN_WINDOW_STATE_DEFAULT;
int16 LoadedWindowState;
if (B_OK == msg->FindInt16("windowstate",&LoadedWindowState)) {
DUNWindowState = LoadedWindowState;
cout << "From Settings: " << DUNWindowState << endl;
DUNResizeHandler();
}
else
{
DUNWindowState = DUN_WINDOW_STATE_DEFAULT;//setup window state as def
DUNResizeHandler();
}
//**********---SETTINGS CONFUSE ME! :P **********//
/*int16 _x,_y;
if(B_OK == msg->FindInt16("rx",0,&_x) && B_OK == msg->FindInt16("ry",0,&_y))
{
SetStatus(_x,_y);
// cout << "cool" << endl;
}*/
/*int16 stat1,stat2;
if(B_OK == msg->FindInt16("status1",0,&stat1) && B_OK == msg->FindInt16("status2",0,&stat2))
{
if(stat1)
TestBox1->SetValue(B_CONTROL_ON);
else if(!stat1)
TestBox1->SetValue(B_CONTROL_OFF);
else if(stat2)
TestBox1->SetValue(B_CONTROL_ON);
else if(!stat2)
TestBox2->SetValue(B_CONTROL_OFF);
}*/
}
// ------------------------------------------------------------------------------- //
// DUNWindow::SaveSettings -- Saves the Users DUN settings
void DUNWindow::SaveSettings(void)
void DUNWindow::SaveSettings()
{
BMessage msg;
msg.AddRect("windowframe",Frame());
msg.AddInt16("windowstate",DUNWindowState);
DUNLastWindowState = DUNWindowState;
msg.AddInt16("lastwindowstate",DUNLastWindowState);
/*msg.AddInt16("rx",last.x);
msg.AddInt16("ry",last.y);
if(TestBox1->Value() == B_CONTROL_ON)
msg.AddInt16("status1",1);
else
msg.AddInt16("status1",0);
if(TestBox2->Value() == B_CONTROL_ON)
msg.AddInt16("status2",1);
else
msg.AddInt16("status2",0);
*/
/*int selection=ListView1->CurrentSelection(0);
if (selection>=0)
msg.AddString("modulename", ((BStringItem *)(ListView1->ItemAt(selection)))->Text());
@@ -311,14 +372,300 @@ bool DUNWindow::QuitRequested() {
// DUNWindow::MessageReceived -- receives messages
void DUNWindow::MessageReceived (BMessage *message) {
switch(message->what) {
case BTN_MODEM:
modemWindow = new ModemWindow(windowRectModem);
break;
default:
BWindow::MessageReceived(message);
break;
}
void DUNWindow::MessageReceived (BMessage *message)
{
switch(message->what)
{
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();
} break;
case BTN_DISCONNECT:
{
disconnectbutton->SetEnabled(false);
connectbutton->SetEnabled(true);
BAlert *errormsg = new BAlert("errormsg", "Short little poem\nReally beats the hell out of\nAn error message", " I Love Poetry ", NULL , NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT);
errormsg->SetShortcut(0, B_ESCAPE);
errormsg->Go();
} break;
case BTN_MODEM:
modemWindow = new ModemWindow(windowRectModem);
break;
case BTN_SETTINGS:
settingsWindow = new SettingsWindow(BRect(367.0, 268.0, 657.0, 500.0));
break;
default:
BWindow::MessageReceived(message);
break;
}
}
// ------------------------------------------------------------------------------- //
// DUNWindow::InvalidateAll
void DUNWindow::InvalidateAll()
{ //redraws the top and middle BBoxen, so that DoResizeMagic()
//(InvalidateAll() is called by DoResizeMagic()) works smoothly :D
topframe->Invalidate();
middleframe->Invalidate();
}
// ------------------------------------------------------------------------------- //
// DUNWindow::DoResizeMagic -- this magical function handles the resizing of the main window,
// NOTE: it is quite messy & confusing only the brave may try to understand this code
void DUNWindow::DoResizeMagic()
{
if(trvconnect->TreeViewStatus() == 1 && trvlocation->TreeViewStatus() == 1)
{ //BOTH ON
if(last.x == 1 && last.y == 0)
{ //pre: 1,0
//post: 1,1
topframe->SetResizingMode(B_FOLLOW_TOP);
middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
if(!(passmeon->IsHidden())) passmeon->Hide();
if(!(passmeon4->IsHidden()))passmeon4->Hide();
if((passmeon2->IsHidden()))passmeon2->Show();
if((passmeon3->IsHidden()))passmeon3->Show();
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,31);
}
if(last.x == 0 && last.y == 1)
{ //pre: 0,1
//post: 1,1
topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
if(!(passmeon->IsHidden())) passmeon->Hide();
if(!(passmeon4->IsHidden()))passmeon4->Hide();
if((passmeon2->IsHidden()))passmeon2->Show();
if((passmeon3->IsHidden()))passmeon3->Show();
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,100);
}
if(last.x == 0 && last.y == 0)
{ //if loading from settings 3
//pre: 0,0
//post: 1,1
topframe->SetResizingMode(B_FOLLOW_TOP);
middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,31);
topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,100);
passmeon->Hide();
passmeon4->Hide();
DUNLastWindowState = 4;//so we don't keep doing this :P
}
DUNWindowState = DUN_WINDOW_STATE_THREE;
InvalidateAll();
SetStatus(1,1);
}
else if(trvconnect->TreeViewStatus() == 0 && trvlocation->TreeViewStatus() == 0)
{ //both off
if(last.x == 1 && last.y == 0)
{ //pre: 1,0
//post: 0,0
topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
if(!(passmeon3->IsHidden())) passmeon3->Hide();
if(!(passmeon2->IsHidden())) passmeon2->Hide();
if((passmeon->IsHidden()))passmeon->Show();
if((passmeon4->IsHidden()))passmeon4->Show();
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,-100);
}
if(last.x == 0 && last.y == 1)
{ //pre: 0,1
//post:0,0
topframe->SetResizingMode(B_FOLLOW_TOP);
middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
if(!(passmeon3->IsHidden()))passmeon3->Hide();
if(!(passmeon2->IsHidden()))passmeon2->Hide();
if((passmeon->IsHidden()))passmeon->Show();
if((passmeon4->IsHidden()))passmeon4->Show();
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,-31);
}
DUNWindowState = DUN_WINDOW_STATE_DEFAULT;
InvalidateAll();
SetStatus(0,0);
}
else if(trvconnect->TreeViewStatus() == 1 && trvlocation->TreeViewStatus() == 0)
{ //1,0
if(last.x == 0 && last.y == 0)
{ //pre: 0,0
//post: 1,0
topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
if(DUNLastWindowState == DUN_WINDOW_STATE_ONE)
{
passmeon->Hide();
passmeon3->Hide();
DUNLastWindowState = 4;//so we don't keep doing this :P
}
else
{
if(!(passmeon->IsHidden())) passmeon->Hide();
if(!(passmeon3->IsHidden()))passmeon3->Hide();
if((passmeon2->IsHidden()))passmeon2->Show();
if((passmeon4->IsHidden()))passmeon4->Show();
}
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,100);
}
if(last.x == 1 && last.y == 1)
{ //pre: 1,1
//post: 1,0
topframe->SetResizingMode(B_FOLLOW_TOP);
middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
if(!(passmeon->IsHidden())) passmeon->Hide();
if(!(passmeon3->IsHidden()))passmeon3->Hide();
if((passmeon2->IsHidden()))passmeon2->Show();
if((passmeon4->IsHidden()))passmeon4->Show();
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,-31);
}
DUNWindowState = DUN_WINDOW_STATE_ONE;
InvalidateAll();
SetStatus(1,0);
}
else if(trvconnect->TreeViewStatus() == 0 && trvlocation->TreeViewStatus() == 1)
{ //0,1
if(last.x == 0 && last.y == 0)
{ //pre:0,0
//post: 0,1
topframe->SetResizingMode(B_FOLLOW_TOP);
middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
if(DUNLastWindowState == DUN_WINDOW_STATE_TWO)
{
passmeon4->Hide();
passmeon2->Hide();
DUNLastWindowState = 4;//so we don't keep doing this :P
}
else
{
if(!(passmeon4->IsHidden())) passmeon4->Hide();
if(!(passmeon2->IsHidden()))passmeon2->Hide();
if((passmeon3->IsHidden()))passmeon3->Show();
if((passmeon->IsHidden()))passmeon->Show();
}
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,31);
}
if(last.x == 1 && last.y == 1)
{ //pre: 1,1
//post: 0,1
topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
if(!(passmeon4->IsHidden()))passmeon4->Hide();
if(!(passmeon2->IsHidden()))passmeon2->Hide();
if((passmeon3->IsHidden()))passmeon3->Show();
if((passmeon->IsHidden()))passmeon->Show();
passmeon->SetResizingMode(B_FOLLOW_TOP);
passmeon4->SetResizingMode(B_FOLLOW_TOP);
passmeon2->SetResizingMode(B_FOLLOW_TOP);
passmeon3->SetResizingMode(B_FOLLOW_TOP);
ResizeBy(0,-100);
}
DUNWindowState = DUN_WINDOW_STATE_TWO;
InvalidateAll();
SetStatus(0,1);
}
}
// ------------------------------------------------------------------------------- //
// DUNWindow::SetStatus -- Integral to how DoResizeMagic Works! :-)
void DUNWindow::SetStatus(int m,int n)
{
last.x = m;
last.y = n;
}
// ------------------------------------------------------------------------------- //
// end
+77 -27
View File
@@ -1,6 +1,9 @@
/*
DUNWindow Header by Sikosis ([email protected])
DUNWindow Header - DialUp Networking BWindow Header
Authors: Sikosis ([email protected])
Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
@@ -9,8 +12,43 @@ DUNWindow Header by Sikosis ([email protected])
#ifndef __DUNWINDOW_H__
#define __DUNWINDOW_H__
#include <Application.h>
#include <Alert.h>
#include <FindDirectory.h> // "Be.h doesn't compile on my system" - Sikosis
#include <Entry.h>
#include <File.h>
#include <Font.h>
#include <Path.h>
#include <stdio.h>
#include <iostream>
#include <InterfaceKit.h>
#include "ModemWindow.h"
#include "DUNView.h"
#include "SettingsWindow.h"
#include "DetailsView.h"
#include "TreeView.h"
#include "LocationView.h"
// Constants
const uint32 BTN_MODEM = 'Modm';
const uint32 BTN_DISCONNECT = 'Disc';
const uint32 BTN_CONNECT = 'Conn';
const uint32 CHK_CALLWAITING = 'Ckcw';
const uint32 CHK_DIALOUTPREFIX = 'Ckdp';
const uint32 MENU_CLICKTOADD = 'MC2A';
const uint32 MENU_CON_NEW = 'MCNu';
const uint32 MENU_CON_DELETE_CURRENT = 'MCDl';
const uint32 MENU_LOC_HOME = 'MLHm';
const uint32 MENU_LOC_WORK = 'MLWk';
const uint32 MENU_LOC_NEW = 'MLNu';
const uint32 MENU_LOC_DELETE_CURRENT = 'MLDl';
const uint32 TEST_BOX_1 = 'Tb1';
const uint32 TEST_BOX_2 = 'Tb2';
struct last_active { int x;int y;};
class DUNView;
class DUNWindow : public BWindow {
@@ -21,40 +59,52 @@ public:
virtual void MessageReceived(BMessage *message);
void LoadSettings(BMessage *msg);
void SaveSettings(void);
void SaveSettings();
//these functions handle the resizing of the window
void SetStatus(int m,int n);
void InvalidateAll();
void DoResizeMagic();
void DUNResizeHandler();
private:
ModemWindow *modemWindow;
void InitWindow(void);
void InitWindow();
DUNView* aDUNview;
//BMenuBar *menubar;
BBox *topframe;
BBox *middleframe;
BBox *bottomframe;
SettingsWindow *settingsWindow;
BBox *topframe;
BBox *middleframe;
BBox *bottomframe;
BButton *modembutton;
BButton *disconnectbutton;
BButton *connectbutton;
BButton *modembutton;
BButton *disconnectbutton;
BButton *connectbutton;
BCheckBox *disablecallwaiting;
BCheckBox *dialoutprefix;
BOutlineListView *connectionlistitem;
BOutlineListView *locationlistitem;
BOutlineListView *connectionlistitem;
BOutlineListView *locationlistitem;
BMenuField *connectionmenufield;
BMenuField *locationmenufield;
BMenu *conmenufield;
BMenu *locmenufield;
BTextView *tvConnectionProfile;
BTextView *tvCallWaiting;
BTextView *tvConnection;
BTextView *tvTimeOnline;
BTextView *tvLIP;
BTextView *tvLocalIPAddress;
BMenuField *connectionmenufield;
BMenuField *locationmenufield;
BMenu *conmenufield;
BMenu *locmenufield;
TreeView* trvconnect;
TreeView* trvlocation;
BView* middle_frame_label;
BView* top_frame_label;
struct last_active last;
BStringView* passmeon;//what was tvConnectionProfile
DetailsView* passmeon2;
LocationView* passmeon3;
BStringView* passmeon4;//what was tvCallWaiting
BStringView* svNoConnect;
BStringView* svLocalIPAddress;
BStringView* svTimeOnline;
BStringView* svLIP;
};
#endif
+91
View File
@@ -0,0 +1,91 @@
/*
DetailsView - View for Details
Author: Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include "DetailsView.h"
DetailsView::DetailsView() :
BView(BRect(40,31,290,157),"detailsview",B_FOLLOW_NONE,B_WILL_DRAW)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BRect btnr = Bounds();
BRect texties(0,0,239,20);
phoneno = new BTextControl(texties,"phoneno","Phone number:",NULL,
new BMessage(CHANGE_PHONENO));
phoneno->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
phoneno->SetDivider(80);
AddChild(phoneno);
texties.OffsetBy(0,24);
username = new BTextControl(texties,"username","User name:",NULL,
new BMessage(CHANGE_USERNAME));
username->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
username->SetDivider(80);
AddChild(username);
texties.OffsetBy(0,24);
passwd = new BTextControl(texties,"passwd","Password:",NULL,
new BMessage(CHANGE_PASSWORD));
passwd->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
passwd->SetDivider(80);
//we don't want any people seeing our "3y3lurveBe05" password ;)
passwd->TextView()->HideTyping(true);
AddChild(passwd);
texties.OffsetBy(0,24);
texties.left += 82;
savepasswd = new BCheckBox(texties,"savepasswd","Save Password", new BMessage(SAVEPASSWORD),B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
savepasswd->SetLabel("Save Password");
AddChild(savepasswd);
btnr.right -= 8;
btnr.bottom -= 8;
btnr.top = btnr.bottom - 24;
btnr.left = btnr.right - 70;
settingsbtn = new BButton(btnr,"Settings...","Settings...", new BMessage(BTN_SETTINGS), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
AddChild(settingsbtn);
}
void DetailsView::MessageReceived(BMessage* msg)
{
switch(msg->what)
{
case CHANGE_PHONENO:
case CHANGE_USERNAME:
case CHANGE_PASSWORD:
case SAVEPASSWORD:
cout << "\n\nPhone number: ";
cout << phoneno->Text();
cout << "\nUser name: ";
cout << username->Text();
cout << "\nPassword: ";
cout << passwd->Text();
cout << "\nSave Password? ";
if(savepasswd->Value() == B_CONTROL_ON)
cout << "YES\n" << endl;
else
cout << "NO\n" << endl;
break;
default:
BView::MessageReceived(msg);
break;
}
}
void DetailsView::AttachedToWindow()
{
phoneno->SetTarget(this);
username->SetTarget(this);
passwd->SetTarget(this);
savepasswd->SetTarget(this);
}
+41
View File
@@ -0,0 +1,41 @@
/*
DetailsView Header
Author: Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#ifndef __DETAILSVIEW_H__
#define __DETAILSVIEW_H__
#include <InterfaceKit.h>
#include <iostream>
#include <Application.h>
const uint32 CHANGE_PHONENO = 'Cphn';
const uint32 CHANGE_USERNAME = 'Cusr';
const uint32 CHANGE_PASSWORD = 'Cpwd';
const uint32 SAVEPASSWORD = 'Spwd';
const uint32 BTN_SETTINGS = 'Stng';
class DetailsView: public BView
{
public:
DetailsView();
virtual void MessageReceived(BMessage* msg);
virtual void AttachedToWindow();
private:
BTextControl* phoneno;
BTextControl* username;
BTextControl* passwd;
BCheckBox* savepasswd;
BButton* settingsbtn;
};
#endif
+2 -2
View File
@@ -2,6 +2,6 @@ SubDir OBOS_TOP src prefs dun ;
AddResources DialUpNetworking : DUN.rsrc ;
Preference DialUpNetworking : DUN.cpp DUNView.cpp ModemWindow.cpp DUNWindow.cpp ;
Preference DialUpNetworking : DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp ;
LinkSharedOSLibs DialUpNetworking : be tracker ;
LinkSharedOSLibs DialUpNetworking : be tracker stdc++.r4 ;
+157
View File
@@ -0,0 +1,157 @@
/*
LocationView - View for the Location Controls on DUNWindow
Authors: Misza ([email protected])
Sikosis ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include "LocationView.h"
// LocationView -- View inside DUNWindow
LocationView::LocationView() : BView(BRect(55,31,285,87),"locationview",B_FOLLOW_NONE,B_WILL_DRAW)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BRect line1(0,5,125,20);
disablecallwaiting = new BCheckBox(line1,"disablecallwaiting","Disable call waiting:",new BMessage(DCW_CHKBOX));
AddChild(disablecallwaiting);
line1.OffsetBy(30,0);
dcwvalue = new BTextControl(BRect(125,5,175,20),"dcwvalue",NULL,NULL,new BMessage(CHANGE_DCW));
AddChild(dcwvalue);
line1.OffsetBy(30,0);
dcwlist = new BPopUpMenu("");
dcwone = new BMenuItem("*70,",new BMessage(DCW_ITEMS));
dcwtwo = new BMenuItem("70#,",new BMessage(DCW_ITEMS));
dcwthree = new BMenuItem("1170,",new BMessage(DCW_ITEMS));
dcwlist->AddItem(dcwone);
dcwlist->AddItem(dcwtwo);
dcwlist->AddItem(dcwthree);
dcwlistfield = new BMenuField(BRect(180,5,240,20),
NULL,NULL,dcwlist);
dcwone->SetMarked(true);
AddChild(dcwlistfield);
//LINE 2
BRect line2(0,30,125,45);
dialoutprefix = new BCheckBox(line2,"dialoutprefix",
"Dial out prefix:",new BMessage(DOP_CHKBOX));
AddChild(dialoutprefix);
dopvalue = new BTextControl(BRect(125,30,175,45),"dopvalue",NULL,NULL,
new BMessage(CHANGE_DOP));
AddChild(dopvalue);
doplist = new BPopUpMenu("");
dopone = new BMenuItem("1,",new BMessage(DOP_ITEMS));
doptwo = new BMenuItem("9,",new BMessage(DOP_ITEMS));
dopthree = new BMenuItem("9,1,",new BMessage(DOP_ITEMS));
doplist->AddItem(dopone);
doplist->AddItem(doptwo);
doplist->AddItem(dopthree);
doplistfield = new BMenuField(BRect(180,30,240,45),
NULL,NULL,doplist);
dopone->SetMarked(true);
AddChild(doplistfield);
//turned off by default
dcwlistfield->SetEnabled(false);
dcwvalue->SetEnabled(false);
doplistfield->SetEnabled(false);
dopvalue->SetEnabled(false);
}
// ------------------------------------------------------------------------------- //
// LocationView::MessageReceived -- Receives Messages
void LocationView::MessageReceived(BMessage *msg)
{
switch(msg->what)
{
case DCW_CHKBOX:
if(disablecallwaiting->Value() == B_CONTROL_ON)
{
cout << "dcw on" << endl;
dcwlistfield->SetEnabled(true);
dcwvalue->SetEnabled(true);
} else {
cout << "dcw off" << endl;
dcwlistfield->SetEnabled(false);
dcwvalue->SetEnabled(false);
}
break;
case DOP_CHKBOX:
if(dialoutprefix->Value() == B_CONTROL_ON)
{
cout << "dop on" << endl;
doplistfield->SetEnabled(true);
dopvalue->SetEnabled(true);
} else {
cout << "dop off" << endl;
doplistfield->SetEnabled(false);
dopvalue->SetEnabled(false);
}
break;
case CHANGE_DOP:
cout << "DOP is set to: " << dopvalue->Text() << endl;
break;
case CHANGE_DCW:
cout << "DCW is set to: " << dcwvalue->Text() << endl;
break;
case DCW_ITEMS:
if(dcwone->IsMarked())
dcwvalue->SetText("*70,");
else if(dcwtwo->IsMarked())
dcwvalue->SetText("70#,");
else if(dcwthree->IsMarked())
dcwvalue->SetText("1170,");
dcwvalue->MakeFocus();
cout << "DCW is set to: " << dcwvalue->Text() << endl;
break;
case DOP_ITEMS:
if(dopone->IsMarked())
dopvalue->SetText("1,");
else if(doptwo->IsMarked())
dopvalue->SetText("9,");
else if(dopthree->IsMarked())
dopvalue->SetText("9,1,");
dopvalue->MakeFocus();
cout << "DOP is set to: " << dopvalue->Text() << endl;
break;
default:
BView::MessageReceived(msg);
break;
}
}
// ------------------------------------------------------------------------------- //
// LocationView::AttachedToWindow -- facilitates the LocationView to be able to receive messages in MessageReceived()
void LocationView::AttachedToWindow()
{
disablecallwaiting->SetTarget(this);
dcwvalue->SetTarget(this);
dcwone->SetTarget(this);
dcwtwo->SetTarget(this);
dcwthree->SetTarget(this);
dialoutprefix->SetTarget(this);
dopvalue->SetTarget(this);
dopone->SetTarget(this);
doptwo->SetTarget(this);
dopthree->SetTarget(this);
}
// ------------------------------------------------------------------------------- //
+51
View File
@@ -0,0 +1,51 @@
/*
LocationView Header
Authors: Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#ifndef __LOCATIONVIEW_H__
#define __LOCATIONVIEW_H__
#include <InterfaceKit.h>
#include <iostream>
#include <Application.h>
const uint32 CHANGE_DCW = 'Cdcw';
const uint32 CHANGE_DOP = 'Cdop';
const uint32 DCW_CHKBOX = 'Dcwc';
const uint32 DOP_CHKBOX = 'Dopc';
const uint32 DCW_ITEMS = 'Dcwi';
const uint32 DOP_ITEMS = 'Dopi';
class LocationView: public BView
{
public:
LocationView();
virtual void MessageReceived(BMessage *msg);
virtual void AttachedToWindow();
private:
BCheckBox *disablecallwaiting;
BTextControl* dcwvalue;
BPopUpMenu *dcwlist;
BMenuField* dcwlistfield;
BMenuItem* dcwone;
BMenuItem* dcwtwo;
BMenuItem* dcwthree;
BCheckBox *dialoutprefix;
BTextControl* dopvalue;
BPopUpMenu *doplist;
BMenuField* doplistfield;
BMenuItem* dopone;
BMenuItem* doptwo;
BMenuItem* dopthree;
};
#endif
+53 -55
View File
@@ -1,52 +1,33 @@
/*
ModemWindow by Sikosis ([email protected])
ModemWindow - Modem Settings Window
Author: Sikosis ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include "app/Application.h"
#include <Alert.h>
#include <Box.h>
#include <Button.h>
#include <CheckBox.h>
#include <Font.h>
#include <ListItem.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <OutlineListView.h>
#include <Point.h>
#include <RadioButton.h>
#include <Shape.h>
#include <stdio.h>
#include <TextControl.h>
#include <TextView.h>
#include <Window.h>
#include <View.h>
#include "DUN.h"
//#include "DUNWindow.h"
#include "ModemWindow.h"
#include "DUNView.h"
// Constants
const uint32 BTN_MODEM_WINDOW_CANCEL = 'BMWC';
const uint32 BTN_MODEM_WINDOW_CUSTOM = 'BMWU';
const uint32 BTN_MODEM_WINDOW_DONE = 'BMWD';
const uint32 MENU = 'Menu';
const uint32 CHK_MAKE_CONNECTION = 'CKMC';
const uint32 CHK_SHOW_TERMINAL = 'CKST';
const uint32 CHK_LOG_ALL = 'CKLA';
const uint32 RB_TONE_DIALING = 'RBTn';
const uint32 RB_PULSE_DIALING = 'RBPd';
// 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);
}
// ------------------------------------------------------------------------------------------ //
// ModemWindow -- constructor for ModemWindow Class
ModemWindow::ModemWindow(BRect frame) : BWindow (frame, "", B_MODAL_WINDOW, B_NOT_RESIZABLE , 0)
{
InitWindow();
CenterWindowOnScreen(this);
Show();
}
// ------------------------------------------------------------------------------- //
@@ -57,6 +38,11 @@ void ModemWindow::InitWindow(void)
BRect r;
r = Bounds();
// Add the Drawing View
aModemview = new ModemView(r);
aModemview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(aModemview);
// Buttons
BRect btn1(10,r.bottom - 34,83,r.bottom - 16);
BRect btn2(108,r.bottom - 34,184,r.bottom - 16);
@@ -102,6 +88,8 @@ void ModemWindow::InitWindow(void)
BRect RedialLocation (15,112,350,132);
tvRedial = new BTextView(r, "Redial", RedialLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvRedial->SetText("Redial");
tvRedial->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvRedial->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvRedial->MakeSelectable(false);
tvRedial->MakeEditable(false);
@@ -109,6 +97,8 @@ void ModemWindow::InitWindow(void)
BRect UseLocation (15,142,40,154);
tvUse = new BTextView(r, "Use", UseLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvUse->SetText("Use:");
tvUse->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvUse->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvUse->MakeSelectable(false);
tvUse->MakeEditable(false);
@@ -122,6 +112,8 @@ void ModemWindow::InitWindow(void)
BRect TimesBusySignalLocation (82,112,400,132);
tvTimesBusySignal = new BTextView(r, "TimesBusySignal", TimesBusySignalLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvTimesBusySignal->SetText("time(s) on busy signal");
tvTimesBusySignal->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvTimesBusySignal->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvTimesBusySignal->MakeSelectable(false);
tvTimesBusySignal->MakeEditable(false);
@@ -129,6 +121,8 @@ void ModemWindow::InitWindow(void)
BRect ReadLogPathLocation (32,238,350,258);
tvReadLogPath = new BTextView(r, "ReadLogPath", ReadLogPathLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvReadLogPath->SetText("Read log file path: /boot/var/log/ppp-read.log");
tvReadLogPath->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvReadLogPath->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvReadLogPath->MakeSelectable(false);
tvReadLogPath->MakeEditable(false);
@@ -136,6 +130,9 @@ void ModemWindow::InitWindow(void)
BRect WriteLogPathLocation (32,256,350,276);
tvWriteLogPath = new BTextView(r, "WriteLogPath", WriteLogPathLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvWriteLogPath->SetText("Write log file path: /boot/var/log/ppp-write.log");
tvWriteLogPath->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvWriteLogPath->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tvWriteLogPath->MakeSelectable(false);
tvWriteLogPath->MakeEditable(false);
@@ -153,32 +150,31 @@ void ModemWindow::InitWindow(void)
BRect chkLogAllLocation (15,215,300,235);
chkLogAll = new BCheckBox(chkLogAllLocation, "chkLogAll", "Log all bytes sent/received", new BMessage(CHK_LOG_ALL), B_FOLLOW_LEFT | B_FOLLOW_TOP , B_WILL_DRAW | B_NAVIGABLE);
chkLogAll->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// Add Objects to View
AddChild(YourModemIsMenuField);
AddChild(ConnectViaMenuField);
AddChild(SpeedMenuField);
AddChild(btnModemWindowCancel);
AddChild(btnModemWindowCustom);
AddChild(btnModemWindowDone);
AddChild(chkMakeConnection);
AddChild(chkShowTerminal);
AddChild(chkLogAll);
AddChild(rbPulse);
AddChild(rbTone);
AddChild(tvUse);
AddChild(tvRedial);
AddChild(tvTimesBusySignal);
AddChild(tvReadLogPath);
AddChild(tvWriteLogPath);
aModemview->AddChild(YourModemIsMenuField);
aModemview->AddChild(ConnectViaMenuField);
aModemview->AddChild(SpeedMenuField);
aModemview->AddChild(btnModemWindowCancel);
aModemview->AddChild(btnModemWindowCustom);
aModemview->AddChild(btnModemWindowDone);
aModemview->AddChild(chkMakeConnection);
aModemview->AddChild(chkShowTerminal);
aModemview->AddChild(chkLogAll);
aModemview->AddChild(rbPulse);
aModemview->AddChild(rbTone);
aModemview->AddChild(tvUse);
aModemview->AddChild(tvRedial);
aModemview->AddChild(tvTimesBusySignal);
aModemview->AddChild(tvReadLogPath);
aModemview->AddChild(tvWriteLogPath);
btnModemWindowDone->MakeDefault(true);
// Add the Drawing View
AddChild(aModemview = new ModemView(r));
}
// ------------------------------------------------------------------------------- //
// ModemWindow::~ModemWindow -- destructor
ModemWindow::~ModemWindow()
{
@@ -186,13 +182,15 @@ ModemWindow::~ModemWindow()
}
// ------------------------------------------------------------------------------- //
// ModemWindow::MessageReceived -- receives messages
void ModemWindow::MessageReceived (BMessage *message)
{
switch(message->what)
{
case BTN_MODEM_WINDOW_DONE:
Quit(); // debugging purposes
//Quit(); // debugging purposes
Hide();
break;
case BTN_MODEM_WINDOW_CANCEL:
Hide(); // must find a better way to close this window and not the entire application
+38 -2
View File
@@ -1,6 +1,8 @@
/*
ModemWindow Header by Sikosis ([email protected])
ModemWindow Header
Author: Sikosis ([email protected])
(C) 2002 OpenBeOS under MIT license
@@ -9,7 +11,41 @@ ModemWindow Header by Sikosis ([email protected])
#ifndef __MODEMWINDOW_H__
#define __MODEMWINDOW_H__
#include "ModemWindow.h"
#include <Application.h>
#include <Alert.h>
#include <Box.h>
#include <Button.h>
#include <CheckBox.h>
#include <Font.h>
#include <ListItem.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <OutlineListView.h>
#include <Point.h>
#include <RadioButton.h>
#include <Screen.h>
#include <Shape.h>
#include <stdio.h>
#include <TextControl.h>
#include <TextView.h>
#include <Window.h>
#include <View.h>
#include "DUNView.h"
// Constants
const uint32 BTN_MODEM_WINDOW_CANCEL = 'BMWC';
const uint32 BTN_MODEM_WINDOW_CUSTOM = 'BMWU';
const uint32 BTN_MODEM_WINDOW_DONE = 'BMWD';
const uint32 MENU = 'Menu';
const uint32 CHK_MAKE_CONNECTION = 'CKMC';
const uint32 CHK_SHOW_TERMINAL = 'CKST';
const uint32 CHK_LOG_ALL = 'CKLA';
const uint32 RB_TONE_DIALING = 'RBTn';
const uint32 RB_PULSE_DIALING = 'RBPd';
class ModemView;
+15
View File
@@ -0,0 +1,15 @@
NOTE
I put this "stdc++.r4" in the Jamfile so it links against libstdc++.r4.so in /system. This is so I can use cout :)
Added some simple makefiles :-)
TODO
-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
DONE
Resizing window with the TreeView "controls" AND Saving window state and position work perfectly now! yeah baby!!!!!
NEARLY THERE! :-)
+234
View File
@@ -0,0 +1,234 @@
/*
SettingsWindow - Window for Settings
Author: Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include <Application.h>
#include <Alert.h>
#include <Box.h>
#include <Button.h>
#include <CheckBox.h>
#include <Font.h>
#include <ListItem.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <OutlineListView.h>
#include <Point.h>
#include <RadioButton.h>
#include <Shape.h>
#include <stdio.h>
#include <TextControl.h>
#include <TextView.h>
#include <Window.h>
#include <View.h>
#include <PopUpMenu.h>
#include <StringView.h>
#include "DUN.h"
//#include "DUNWindow.h"
//#include "ModemWindow.h"
#include "DUNView.h"
#include "SettingsWindow.h"
// SettingsWindow -- constructor for SettingsWindow Class
SettingsWindow::SettingsWindow(BRect frame) : BWindow (frame, "", B_MODAL_WINDOW, B_NOT_RESIZABLE , 0)
{
InitWindow();
Show();
}
// ------------------------------------------------------------------------------- //
// Settingsview::InitWindow -- Initialization Commands here
void SettingsWindow::InitWindow()
{
BRect r;
r = Bounds();
// Add the Drawing View
aSettingsview = new SettingsView(r);
aSettingsview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(aSettingsview);
//aSettingsview->SetFont(be_bold_font);
//THIS should be changed later, I know no other way of setting this :PPP
ConnectSettings = new BStringView(BRect(13,5,250,25),"ConnectSettings","Connection settings for: ");
//aSettingsview->MovePenTo(30,40);
//aSettingsview->DrawString("Connection settings for: ");
ConnectSettings->SetFont(be_bold_font);
aSettingsview->AddChild(ConnectSettings);
aSettingsview->SetFont(be_plain_font);
//aSettingsview->DrawString("some_connection");
BRect ipbox_rect = aSettingsview->Bounds();
ipbox_rect.left = 13;
ipbox_rect.right -= 13;
ipbox_rect.top = 32;
ipbox_rect.bottom = 81;
//ipbox_rect.InsetBy(20,20);
IPBox = new BBox(ipbox_rect,"IPBox",B_FOLLOW_ALL | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
//IPBox->SetLabel("<BCheckBox>Use static IP address");
BView* iplabel = new BView(BRect(10,10,130,30),"iplabel",B_FOLLOW_ALL_SIDES,B_WILL_DRAW|B_NAVIGABLE);
//iplabel->SetViewColor(255,0,0);
iplabel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
//BRect stat_ip_rect = iplabel->Bounds();
//stat
UseStaticIP = new BCheckBox(iplabel->Bounds(),"UseStaticIP","Use static IP address", new BMessage(CHANGE_IP_BOX),B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
UseStaticIP->SetLabel("Use static IP address");
//UseStaticIP->SetEnabled(false);//by default it is off
iplabel->AddChild(UseStaticIP);
// IPBox->SetLabel("<BCheckBox>Use static IP address");
IPBox->SetLabel(iplabel);
// ipbox_rect.left = 23;
// ipbox_rect.bottom +=
BRect ipaddr_text = IPBox->Bounds();
ipaddr_text.right -= 10;
ipaddr_text.left += 50;
ipaddr_text.top += 20;
IPAddress = new BTextControl(ipaddr_text,"IPAddress","IP address:",NULL,
new BMessage(CHANGE_IP));
IPAddress->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
IPAddress->SetDivider(80);
IPAddress->SetEnabled(false); //by default it is off
IPBox->AddChild(IPAddress);
aSettingsview->AddChild(IPBox);
ipbox_rect.top += 60;
ipbox_rect.bottom += 75;
DNSBox = new BBox(ipbox_rect,"IPBox",B_FOLLOW_ALL | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
ipaddr_text.top -= 10;
PrimaryDNS = new BTextControl(ipaddr_text,"PrimaryDNS","Primary DNS:",NULL,
new BMessage(CHANGE_P_DNS));
PrimaryDNS->SetDivider(80);
PrimaryDNS->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
DNSBox->AddChild(PrimaryDNS);
ipaddr_text.top += 25;
SecondaryDNS = new BTextControl(ipaddr_text,"SecondaryDNS","Secondary DNS:",NULL,
new BMessage(CHANGE_S_DNS));
SecondaryDNS->SetDivider(80);
SecondaryDNS->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
DNSBox->AddChild(SecondaryDNS);
aSettingsview->AddChild(DNSBox);
BRect cute_buttons(205,200,280,220);
btnSettingsWindowDone = new BButton(cute_buttons,"btnSettingsWindowDone"," Done ", new BMessage(BTN_SETTINGS_WINDOW_DONE), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
cute_buttons.OffsetBy(-85,0);
btnSettingsWindowCancel = new BButton(cute_buttons,"btnSettingsWindowCancel"," Cancel ", new BMessage(BTN_SETTINGS_WINDOW_CANCEL), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
btnSettingsWindowDone->MakeDefault(true);
aSettingsview->AddChild(btnSettingsWindowDone);
aSettingsview->AddChild(btnSettingsWindowCancel);
YourServerTypeIsMenu = new BPopUpMenu("ServerType");
//These should be added after looking in /boot/beos/etc/servers.ppp
//parse that files contents, put the entries in a list, whatever
//loop through the list and add them
BMenuItem* item1 = new BMenuItem("Standard PPP",NULL); //n.b bmessage left out, add later
YourServerTypeIsMenu->AddItem(item1);
BMenuItem* item2 = new BMenuItem("etc,etc...",NULL);
YourServerTypeIsMenu->AddItem(item2);
YourServerTypeIsMenuField = new BMenuField(BRect(13,170,203,190),
"ServerType","Server Type:",YourServerTypeIsMenu);
item1->SetMarked(true);
YourServerTypeIsMenuField->SetDivider(70);
aSettingsview->AddChild(YourServerTypeIsMenuField);
}
// ------------------------------------------------------------------------------- //
// SettingsWindow::~aSettingsview -- destructor
SettingsWindow::~SettingsWindow()
{
exit(0);
}
// ------------------------------------------------------------------------------- //
// SettingsWindow::MessageReceived -- receives messages
void SettingsWindow::MessageReceived (BMessage *message)
{
switch(message->what)
{
case CHANGE_IP_BOX:
{
if(UseStaticIP->Value() == B_CONTROL_ON){
/*do something*/
//cout << "checkbox is on" << endl;
IPAddress->SetEnabled(true);
}else
{
/*do something else*/
//cout << "checkbox is off" << endl;
IPAddress->SetEnabled(false);
}
}break;
case CHANGE_IP:
{
//cout << IPAddress->Text() << endl;
printf("%s\n",IPAddress->Text());
}break;
case CHANGE_P_DNS:
{
//cout << PrimaryDNS->Text() << endl;
printf("%s\n",PrimaryDNS->Text());
}break;
case CHANGE_S_DNS:
{
//cout << SecondaryDNS->Text() << endl;
printf("%s\n",SecondaryDNS->Text());
}break;
case BTN_SETTINGS_WINDOW_CANCEL:
{
Hide(); // must find a better way to close this window and not the entire application
// any suggestions would be greatly appreciated ;)
}break;
case BTN_SETTINGS_WINDOW_DONE:
{
/*SAVE SETTINGS*/
Hide();
//Quit();
}break;
/*case BTN_MODEM_WINDOW_DONE:
Quit(); // debugging purposes
break;
case BTN_MODEM_WINDOW_CANCEL:
Hide(); // must find a better way to close this window and not the entire application
// any suggestions would be greatly appreciated ;)
break;*/
default:
BWindow::MessageReceived(message);
break;
}
}
// end
+52
View File
@@ -0,0 +1,52 @@
/*
SettingsWindow Header
Author: Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#ifndef __SETTINGSWINDOW_H__
#define __SETTINGSWINDOW_H__
//Constants
const uint32 CHANGE_IP_BOX = 'Cipb';
const uint32 CHANGE_IP = 'CIP';
const uint32 CHANGE_S_DNS = 'SDns';
const uint32 CHANGE_P_DNS = 'PDns';
const uint32 BTN_SETTINGS_WINDOW_CANCEL = 'BSWC';
const uint32 BTN_SETTINGS_WINDOW_DONE = 'BSWD';
class SettingsView;
class SettingsWindow : public BWindow
{
public:
SettingsWindow(BRect frame);
~SettingsWindow();
virtual void MessageReceived(BMessage *message);
private:
void InitWindow();
SettingsView* aSettingsview;
BButton *btnSettingsWindowCancel;
BButton *btnSettingsWindowDone;
BPopUpMenu *YourServerTypeIsMenu;
BMenuField *YourServerTypeIsMenuField;
BTextControl* IPAddress;
BTextControl* PrimaryDNS;
BTextControl* SecondaryDNS;
BStringView* ConnectSettings;
BCheckBox *UseStaticIP;
BBox* IPBox;
BBox* DNSBox;
};
#endif
+85
View File
@@ -0,0 +1,85 @@
/*
The Amazing TreeView !
Author: Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#include "TreeView.h"
#include "DUNWindow.h"
TreeView::TreeView(BRect r) : BView(r,"miszaView",B_FOLLOW_TOP,B_WILL_DRAW)
{
down = false;
status = false;
}
void TreeView::MouseUp(BPoint point)
{ //controls what get resized and how
BPoint where;
uint32 buttons;
GetMouse(&where, &buttons);
if(where != point)
{ Invalidate();
down = false;
}
if(!status)//if view is hidden
{
Invalidate();
status = true;
((DUNWindow*)Window())->DoResizeMagic();
}
else if(status)
{
Invalidate();
status = false;
((DUNWindow*)Window())->DoResizeMagic();
}
}
void TreeView::MouseDown(BPoint point)
{
SetMouseEventMask(B_POINTER_EVENTS,B_LOCK_WINDOW_FOCUS);
down = true;
Invalidate();
}
void TreeView::Draw(BRect updateRect)
{ //colours for drawing the triangle
SetHighColor(0,0,0);
SetLowColor(150,150,150);
if(status && !down)//if view is showing
{
//horiz triangle
FillTriangle(BPoint(0,2),BPoint(8,2),BPoint(4,6),B_SOLID_LOW);
StrokeTriangle(BPoint(0,2),BPoint(8,2),BPoint(4,6),B_SOLID_HIGH);
}
else if (!status && !down){
//vert triangle
FillTriangle(BPoint(2,0),BPoint(2,8),BPoint(6,4),B_SOLID_LOW);
StrokeTriangle(BPoint(2,0),BPoint(2,8),BPoint(6,4),B_SOLID_HIGH);
}
else
{//midway
SetHighColor(0,0,0);
SetLowColor(100,100,0);
FillTriangle(BPoint(0,6),BPoint(6,0),BPoint(6,6),B_SOLID_LOW);
StrokeTriangle(BPoint(0,6),BPoint(6,0),BPoint(6,6),B_SOLID_HIGH);
}
down = false;
SetHighColor(0,0,0);
SetLowColor(150,150,150);
}
void TreeView::SetTreeViewStatus(bool condition)
{
status = condition;
}
+32
View File
@@ -0,0 +1,32 @@
/*
The Amazing TreeView Header !
Author: Misza ([email protected])
(C) 2002 OpenBeOS under MIT license
*/
#ifndef __TREEVIEW_H__
#define __TREEVIEW_H__
#include <iostream>
#include <stdio.h>
#include <Application.h>
#include <InterfaceKit.h>
class TreeView : public BView
{
public:
TreeView(BRect r);
virtual void Draw(BRect updateRect);//Draws the little triangle depending on the state
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
bool TreeViewStatus() { return status;}
void SetTreeViewStatus(bool condition);
private:
bool status;//0 == off && 1 == on
bool down;
};
#endif
+166
View File
@@ -0,0 +1,166 @@
## BeOS Generic Makefile v2.3 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME := OBOSDialUpNetworking
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE := APP
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# 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
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS := DUN.rsrc
# Specify your RDEF files, if any.
RDEFS :=
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS := be tracker stdc++.r4 root
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS :=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS :=
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS :=
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE := FULL
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
DEFINES :=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS :=
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS :=
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
DEBUGGER := FALSE
# specify additional compiler flags for all files
COMPILER_FLAGS :=
# specify additional linker flags
LINKER_FLAGS :=
# specify the version of this particular item
# (for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL")
# This may also be specified in a resource.
APP_VERSION :=
# (for TYPE == DRIVER only) Specify desired location of driver in the /dev
# hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will
# instruct the driverinstall rule to place a symlink to your driver's binary in
# ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at
# /dev/video/usb when loaded. Default is "misc".
DRIVER_PATH :=
# Specify if you want the object files to be somewhere besides the default location.
OBJ_DIR :=
# Specify a non default placement for the target
TARGET_DIR :=
# Specify a directory for the 'install' target.
INSTALL_DIR :=
# Specify the name of this makefile.
# If you leave this blank, the makefile will not be considered as part of the
# dependenies for the project, and the project will not be rebuilt when the makefile
# is changed
MAKEFILE :=
# Custom overrides that can be set from the command line.
# This allows you to have the normal makefile be a release build and
# change it from the command line to be a debug build.
# Use like: $ CHECK_MEM=true make
# or : $ DEBUG_BUILD=true make
# For MALLOC_DEBUG=15 usage, will check every memory access for correctness.
# NOTE: This only works in Dano. (or if you happen to have the correct version
# of libroot.so with the extra debug stuff in it. This used to be available
# from the be.com ftp site, you might try asking on BeShare for that or a
# mirror of the ftp site.
ifeq ($(CHECK_MEM), true)
COMPILER_FLAGS += -fcheck-memory-usage -D_NO_INLINE_ASM=1 -D_KERNEL_MODE=1
DEBUG_BUILD=true
endif
ifeq ($(DEBUG_BUILD), true)
SYMBOLS := TRUE
DEBUGGER := TRUE
OPTIMIZE := NONE
COMPILER_FLAGS += -DDEBUG=1
ifeq ($(shell uname -r), 5.1)
COMPILER_FLAGS += -fno-debug-opt
endif
endif
## include the makefile-engine
include $(BUILDHOME)/etc/makefile-engine