tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / preferences / dun / DUNWindow.cpp
blobf04c533b529db5c7a09bf24968ccdc3e76ebe291
1 /*
3 DUNWindow - DialUp Networking BWindow
5 Authors: Sikosis (phil@sikosis.com)
6 Misza (misza@ihug.com.au)
8 (C) 2002-2004 OpenBeOS under MIT license
11 /*-----WARNING MESSY CODE AHEAD :-)------*/
13 #include <String.h>
14 #include "DUNWindow.h"
15 #include "NewConnectionWindow.h"
18 // Add these to Constants file
19 const int DUN_WINDOW_STATE_DEFAULT = 0; // default - closed
20 const int DUN_WINDOW_STATE_ONE = 1; // 1st only
21 const int DUN_WINDOW_STATE_TWO = 2; // 2nd only
22 const int DUN_WINDOW_STATE_THREE = 3; // both
24 int DUNWindowState;
25 int DUNLastWindowState;
27 float ModemFormTopDefault = 150;
28 float ModemFormLeftDefault = 150;
29 float ModemFormWidthDefault = 281;
30 float ModemFormHeightDefault = 324;
31 BRect windowRectModem(ModemFormTopDefault,ModemFormLeftDefault,ModemFormLeftDefault+ModemFormWidthDefault,ModemFormTopDefault+ModemFormHeightDefault);
33 // DUNWindow -- constructor for DUNWindow Class
34 DUNWindow::DUNWindow(BRect frame) : BWindow (frame, "OBOS Dial-up Networking", B_TITLED_WINDOW,
35 B_NOT_RESIZABLE |B_NOT_ZOOMABLE, 0)
37 InitWindow();
38 Show();
40 // ------------------------------------------------------------------------------- //
43 // DUNWindow::InitWindow -- Initialization Commands here
44 void DUNWindow::InitWindow() {
46 //SetStatus(0,0);//none active at beginning
47 BRect r;
48 r = Bounds();
50 // Add the Drawing View
51 aDUNview = new DUNView(r);
52 aDUNview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
53 AddChild(aDUNview);
56 // Buttons
57 float ButtonTop = 217;
58 float ButtonWidth = 24;
60 BRect btn1(10,ButtonTop,83,ButtonTop+ButtonWidth);
61 modembutton = new BButton(btn1,"Modem","Modem" B_UTF8_ELLIPSIS, new BMessage(BTN_MODEM), B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
62 BRect btn2(143,ButtonTop,218,ButtonTop+ButtonWidth);
63 disconnectbutton = new BButton(btn2,"Disconnect","Disconnect", new BMessage(BTN_DISCONNECT), B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
64 BRect btn3(230,ButtonTop,302,ButtonTop+ButtonWidth);
65 connectbutton = new BButton(btn3,"Connect","Connect", new BMessage(BTN_CONNECT), B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
67 connectbutton->MakeDefault(true);
68 disconnectbutton->SetEnabled(false);
70 aDUNview->AddChild(modembutton);
71 aDUNview->AddChild(disconnectbutton);
72 aDUNview->AddChild(connectbutton);
74 // Connection MenuField
75 BRect mfld1(17,8,175,31);
76 BMenuItem *menuconnew;
77 BMenuItem *menucondelete;
79 top_frame_label = new BView(mfld1,"top_frame_label",B_FOLLOW_NONE,B_WILL_DRAW|B_NAVIGABLE);
80 top_frame_label->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
82 conmenufield = new BMenu("Click to add");
83 //conmenufield = new BPopUpMenu("Click to add");
84 conmenufield->AddSeparatorItem();
85 conmenufield->AddItem(menuconnew = new BMenuItem("New" B_UTF8_ELLIPSIS, new BMessage(MENU_CON_NEW)));
86 //menuconnew->SetTarget(be_app);
87 conmenufield->AddItem(menucondelete = new BMenuItem("Delete Current", new BMessage(MENU_CON_DELETE_CURRENT)));
88 menucondelete->SetEnabled(false);
89 //menucondelete->SetTarget(be_app);
91 connectionmenufield = new BMenuField(top_frame_label->Bounds(),"connection_menu","Connect to:",conmenufield,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
92 connectionmenufield->SetDivider(77);
93 connectionmenufield->SetFont(be_bold_font);
94 connectionmenufield->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
96 // Location MenuField
97 BRect mfld2(17,75,205,99);//60 for small
98 BRect middle_rect_drp = mfld2;
100 BMenuItem *menulochome;
101 BMenuItem *menulocwork;
102 BMenuItem *menulocnew;
103 BMenuItem *menulocdelete;
105 middle_frame_label = new BView(middle_rect_drp,"middle_frame_label",B_FOLLOW_NONE,B_WILL_DRAW|B_NAVIGABLE);
106 middle_frame_label->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
108 locmenufield = new BPopUpMenu("Home ");
109 locmenufield->AddItem(menulochome = new BMenuItem("Home", new BMessage(MENU_LOC_HOME)));
110 //menulochome->SetTarget(be_app);
111 menulochome->SetMarked(true);
113 locmenufield->AddItem(menulocwork = new BMenuItem("Work", new BMessage(MENU_LOC_WORK)));
114 //menulocwork->SetTarget(be_app);
115 locmenufield->AddSeparatorItem();
117 locmenufield->AddItem(menulocnew = new BMenuItem("New" B_UTF8_ELLIPSIS, new BMessage(MENU_LOC_NEW)));
118 //menulocnew->SetTarget(be_app);
120 locmenufield->AddItem(menulocdelete = new BMenuItem("Delete Current", new BMessage(MENU_LOC_DELETE_CURRENT)));
121 //menulocdelete->SetTarget(be_app);
123 locationmenufield = new BMenuField(middle_frame_label->Bounds(),"location_menu","From location:",locmenufield,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
124 locationmenufield->SetDivider(92);
125 locationmenufield->SetFont(be_bold_font);
126 locationmenufield->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
128 // Frames
129 BRect tf(10,8,302,67);
130 topframe = new BBox(tf,"Connect to:",B_FOLLOW_NONE | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
131 topframe->SetLabel(top_frame_label);
132 top_frame_label->AddChild(connectionmenufield);
134 passmeon = new BStringView(BRect(24,31,284,49),"tvConnectionProfile", "<Create a connection profile to continue.>");
135 passmeon->SetViewColor(255,0,0);
138 passmeon2 = new DetailsView();
140 //***********INTEGRAL TO GETTING SET STATE READY
141 //passmeon2->Hide();
142 topframe->AddChild(passmeon2);
143 topframe->AddChild(passmeon);
146 BRect THESPOT = BRect(10,37,19,45);
148 trvconnect = new TreeView(THESPOT);
149 trvconnect->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
150 topframe->AddChild(trvconnect);
152 aDUNview->AddChild(topframe);
155 BRect mf(10,76,302,139);
156 middleframe = new BBox(mf,"From Location:",B_FOLLOW_NONE | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
158 middleframe->SetLabel(middle_frame_label);
159 middle_frame_label->AddChild(locationmenufield);
161 passmeon4 = new BStringView(BRect(25,31+4,284,49+4),"tvCallWaiting","Call waiting may be enabled.");
162 passmeon3 = new LocationView();
163 //***********INTEGRAL TO GETTING SET STATE READY
164 //passmeon3->Hide();
166 middleframe->AddChild(passmeon3);
167 middleframe->AddChild(passmeon4);
169 BRect THESPOT2 = BRect(10,37+4,19,45+4);
170 trvlocation = new TreeView(THESPOT2);
171 trvlocation->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
173 middleframe->AddChild(trvlocation);
174 aDUNview->AddChild(middleframe);
177 BRect bf(10,149,302,208);
178 bottomframe = new BBox(bf,"Connection",B_FOLLOW_BOTTOM | B_WILL_DRAW | B_NAVIGABLE_JUMP, B_FANCY_BORDER);
179 bottomframe->SetLabel("Connection");
181 // Displays - No Connection
182 BRect NCLocation(10,18,80,30);
183 svNoConnect = new BStringView(NCLocation,"svNoConnect","No Connection");
185 // Displays - Text Label of Local IP address
186 BRect LocalIPAddressLocation(NCLocation.left,35,100,47);
187 svLocalIPAddress = new BStringView(LocalIPAddressLocation,"svLocalIPAddress","Local IP address:");
189 // Display - Time Online ie. 00:00:00
190 BRect TOLocation(238,NCLocation.top,288,NCLocation.bottom);
191 svTimeOnline = new BStringView(TOLocation,"svTimeOnline","00:00:00");
193 // Display - Local IP address ie. None -- might find some code to get the current ip address and
194 // put that in here instead ... hrmmm ;)
195 BRect LIPLocation (253,LocalIPAddressLocation.top,283,LocalIPAddressLocation.bottom);
196 svLIP = new BStringView(LIPLocation,"svLIP","None");
198 // Add to Bottom Frame
199 bottomframe->AddChild(svNoConnect);
200 bottomframe->AddChild(svLocalIPAddress);
201 bottomframe->AddChild(svTimeOnline);
202 bottomframe->AddChild(svLIP);
204 aDUNview->AddChild(bottomframe);
206 // Load User Settings
207 BPath path;
208 find_directory(B_USER_SETTINGS_DIRECTORY,&path);
209 path.Append("DUN/OBOS_DUN_settings",true);
210 BFile file(path.Path(),B_READ_ONLY);
211 BMessage msg;
212 msg.Unflatten(&file);
213 LoadSettings (&msg);
215 // ------------------------------------------------------------------------------- //
218 // DUNWindow::~DUNWindow -- destructor
219 DUNWindow::~DUNWindow()
221 exit(0);
223 // ------------------------------------------------------------------------------- //
226 void DUNWindow::DUNResizeHandler()
227 { //post: window has been set to last state :-)
228 switch (DUNWindowState)
230 case DUN_WINDOW_STATE_DEFAULT:
232 SetStatus(0,0);
233 trvconnect->SetTreeViewStatus(false);
234 trvlocation->SetTreeViewStatus(false);
235 ResizeTo(312,250);
236 passmeon2->Hide();
237 passmeon3->Hide();
239 } break;
241 case DUN_WINDOW_STATE_ONE:
243 ResizeTo(312,250);
244 SetStatus(0,0);
245 trvconnect->SetTreeViewStatus(true);
246 trvlocation->SetTreeViewStatus(false);
247 DoResizeMagic();
249 } break;
250 case DUN_WINDOW_STATE_TWO:
252 ResizeTo(312,250);
253 SetStatus(0,0);
254 trvconnect->SetTreeViewStatus(false);
255 trvlocation->SetTreeViewStatus(true);
256 DoResizeMagic();
257 } break;
258 case DUN_WINDOW_STATE_THREE:
260 ResizeTo(312,250);
261 SetStatus(0,0);
262 trvconnect->SetTreeViewStatus(true);
263 trvlocation->SetTreeViewStatus(true);
264 DoResizeMagic();
265 } break;
268 //------------------------------------------------------//
271 // DUNWindow::LoadSettings -- Loads your current DUN settings
272 void DUNWindow::LoadSettings(BMessage *msg)
274 BRect frame;
275 int16 LoadedWindowState;
276 int16 LoadedLastWindowState;
278 // Load and Set Window Position and Size
279 if (B_OK == msg->FindRect("windowframe",&frame))
281 MoveTo(frame.left,frame.top);
282 ResizeTo(frame.right-frame.left,frame.bottom-frame.top);
285 // Load LastWindowState (to prevent cumulative resizing)
286 if (B_OK == msg->FindInt16("lastwindowstate",&LoadedLastWindowState))
288 DUNLastWindowState = LoadedLastWindowState;
289 //cout << "From Settings: " << DUNLastWindowState << endl;
290 } else {
291 DUNLastWindowState = DUN_WINDOW_STATE_DEFAULT;
294 // Load and Set WindowState
295 if (B_OK == msg->FindInt16("windowstate",&LoadedWindowState)) {
296 DUNWindowState = LoadedWindowState;
297 //cout << "From Settings: " << DUNWindowState << endl;
298 DUNResizeHandler();
299 } else {
300 DUNWindowState = DUN_WINDOW_STATE_DEFAULT;//setup window state as def
301 DUNResizeHandler();
304 // ------------------------------------------------------------------------------- //
306 // DUNWindow::SaveSettings -- Saves the Users DUN settings
307 void DUNWindow::SaveSettings()
309 BMessage msg;
311 // Current Window Position
312 msg.AddRect("windowframe",Frame());
314 // Current WindowState
315 msg.AddInt16("windowstate",DUNWindowState);
316 DUNLastWindowState = DUNWindowState;
317 // Last WindowState
318 msg.AddInt16("lastwindowstate",DUNLastWindowState);
320 // Current Connection - doesnt work :(
321 msg.AddString("currentconnection","");
323 // Current Location - doesnt work :(
324 msg.AddString("currentlocation","");
328 BPath path;
329 status_t result = find_directory(B_USER_SETTINGS_DIRECTORY,&path);
330 if (result == B_OK)
332 path.Append("DUN/OBOS_DUN_settings",true);
333 BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
334 msg.Flatten(&file);
337 // ------------------------------------------------------------------------------- //
340 // DUNWindow::QuitRequested -- Post a message to the app to quit
341 bool DUNWindow::QuitRequested() {
342 SaveSettings();
343 be_app->PostMessage(B_QUIT_REQUESTED);
344 return true;
346 // ------------------------------------------------------------------------------- //
349 // DUNWindow::MessageReceived -- receives messages
350 void DUNWindow::MessageReceived (BMessage *message)
352 switch(message->what)
354 case BTN_CONNECT:
356 disconnectbutton->SetEnabled(true);
357 connectbutton->SetEnabled(false);
358 //debug
359 BAlert *errormsg = new BAlert("errormsg", "The hidden wispy bush\nOver the green flower\nThe sea and connection have stopped.", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT);
360 errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE);
361 errormsg->Go();
363 break;
365 case BTN_DISCONNECT:
367 disconnectbutton->SetEnabled(false);
368 connectbutton->SetEnabled(true);
369 BAlert *errormsg = new BAlert("errormsg", "A late long rain\nOver an icy meadow\nBroken connection and dreams.", " Haiku Error ;) ", NULL , NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT);
370 errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE);
371 errormsg->Go();
373 break;
375 case MENU_LOC_DELETE_CURRENT:
377 // debug
378 BAlert *errormsg = new BAlert("errormsg", "Hark! Something is wrong.\nFor this is not what I asked.\n\nMy life is somewhat ... Incomplete.\n", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT);
379 errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE);
380 errormsg->Go();
382 break;
384 case MENU_LOC_NEW:
386 // debug
387 BAlert *errormsg = new BAlert("errormsg", "Lost Clouds.\nDisappear behind the mountains.\n\nFor an eternity must I wait ?\n", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT);
388 errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE);
389 errormsg->Go();
391 break;
393 case MENU_LOC_HOME:
395 // Set the Text for the Work Profile
396 passmeon4->SetText("Call waiting maybe enabled.");
398 break;
400 case MENU_LOC_WORK:
402 // Set the Text for the Work Profile
403 passmeon4->SetText("Using dial out prefix of '9,'.");
405 break;
407 case MENU_CON_NEW:
409 // open new connection window
410 ptrNewConnectionWindow = new NewConnectionWindow(BRect(0,0,260,73));
412 break;
414 case BTN_MODEM:
416 // open modem window
417 modemWindow = new ModemWindow(windowRectModem);
419 break;
421 case BTN_SETTINGS:
423 // open settings window
424 settingsWindow = new SettingsWindow(BRect(367.0, 268.0, 657.0, 500.0));
426 break;
428 case ADD_NEW_CONNECTION:
430 // add and set our new connection
431 BString fConnectionName;
432 message->FindString("ConnectionName", &fConnectionName);
433 printf("ConnectionName = %s\n",fConnectionName.String());
434 // add to dropdown
435 // set as current item with tick
437 break;
438 default:
440 BWindow::MessageReceived(message);
442 break;
445 // ------------------------------------------------------------------------------- //
448 // DUNWindow::InvalidateAll
449 void DUNWindow::InvalidateAll()
450 { //redraws the top and middle BBoxen, so that DoResizeMagic()
451 //(InvalidateAll() is called by DoResizeMagic()) works smoothly :D
452 topframe->Invalidate();
453 middleframe->Invalidate();
455 // ------------------------------------------------------------------------------- //
458 // DUNWindow::DoResizeMagic -- this magical function handles the resizing of the main window,
459 // NOTE: it is quite messy & confusing only the brave may try to understand this code
460 void DUNWindow::DoResizeMagic()
462 if(trvconnect->TreeViewStatus() == 1 && trvlocation->TreeViewStatus() == 1)
463 { //BOTH ON
464 if(last.x == 1 && last.y == 0)
465 { //pre: 1,0
466 //post: 1,1
467 topframe->SetResizingMode(B_FOLLOW_TOP);
468 middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
469 middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
471 if(!(passmeon->IsHidden())) passmeon->Hide();
472 if(!(passmeon4->IsHidden()))passmeon4->Hide();
473 if((passmeon2->IsHidden()))passmeon2->Show();
474 if((passmeon3->IsHidden()))passmeon3->Show();
476 passmeon->SetResizingMode(B_FOLLOW_TOP);
477 passmeon4->SetResizingMode(B_FOLLOW_TOP);
478 passmeon2->SetResizingMode(B_FOLLOW_TOP);
479 passmeon3->SetResizingMode(B_FOLLOW_TOP);
481 ResizeBy(0,31);
484 if(last.x == 0 && last.y == 1)
485 { //pre: 0,1
486 //post: 1,1
487 topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
488 middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
489 middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
491 if(!(passmeon->IsHidden())) passmeon->Hide();
492 if(!(passmeon4->IsHidden()))passmeon4->Hide();
493 if((passmeon2->IsHidden()))passmeon2->Show();
494 if((passmeon3->IsHidden()))passmeon3->Show();
496 passmeon->SetResizingMode(B_FOLLOW_TOP);
497 passmeon4->SetResizingMode(B_FOLLOW_TOP);
498 passmeon2->SetResizingMode(B_FOLLOW_TOP);
499 passmeon3->SetResizingMode(B_FOLLOW_TOP);
500 ResizeBy(0,100);
503 if(last.x == 0 && last.y == 0)
504 { //if loading from settings 3
505 //pre: 0,0
506 //post: 1,1
507 topframe->SetResizingMode(B_FOLLOW_TOP);
508 middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
509 middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
512 passmeon->SetResizingMode(B_FOLLOW_TOP);
513 passmeon4->SetResizingMode(B_FOLLOW_TOP);
514 passmeon2->SetResizingMode(B_FOLLOW_TOP);
515 passmeon3->SetResizingMode(B_FOLLOW_TOP);
517 ResizeBy(0,31);
519 topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
520 middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
521 middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
523 passmeon->SetResizingMode(B_FOLLOW_TOP);
524 passmeon4->SetResizingMode(B_FOLLOW_TOP);
525 passmeon2->SetResizingMode(B_FOLLOW_TOP);
526 passmeon3->SetResizingMode(B_FOLLOW_TOP);
528 ResizeBy(0,100);
529 passmeon->Hide();
530 passmeon4->Hide();
531 DUNLastWindowState = 4;//so we don't keep doing this :P
533 DUNWindowState = DUN_WINDOW_STATE_THREE;
534 InvalidateAll();
535 SetStatus(1,1);
538 else if(trvconnect->TreeViewStatus() == 0 && trvlocation->TreeViewStatus() == 0)
539 { //both off
541 if(last.x == 1 && last.y == 0)
542 { //pre: 1,0
543 //post: 0,0
545 topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
546 middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
547 middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
549 if(!(passmeon3->IsHidden())) passmeon3->Hide();
550 if(!(passmeon2->IsHidden())) passmeon2->Hide();
551 if((passmeon->IsHidden()))passmeon->Show();
552 if((passmeon4->IsHidden()))passmeon4->Show();
554 passmeon->SetResizingMode(B_FOLLOW_TOP);
555 passmeon4->SetResizingMode(B_FOLLOW_TOP);
556 passmeon2->SetResizingMode(B_FOLLOW_TOP);
557 passmeon3->SetResizingMode(B_FOLLOW_TOP);
559 ResizeBy(0,-100);
562 if(last.x == 0 && last.y == 1)
563 { //pre: 0,1
564 //post:0,0
565 topframe->SetResizingMode(B_FOLLOW_TOP);
566 middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
567 middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
569 if(!(passmeon3->IsHidden()))passmeon3->Hide();
570 if(!(passmeon2->IsHidden()))passmeon2->Hide();
571 if((passmeon->IsHidden()))passmeon->Show();
572 if((passmeon4->IsHidden()))passmeon4->Show();
574 passmeon->SetResizingMode(B_FOLLOW_TOP);
575 passmeon4->SetResizingMode(B_FOLLOW_TOP);
576 passmeon2->SetResizingMode(B_FOLLOW_TOP);
577 passmeon3->SetResizingMode(B_FOLLOW_TOP);
579 ResizeBy(0,-31);
582 DUNWindowState = DUN_WINDOW_STATE_DEFAULT;
583 InvalidateAll();
584 SetStatus(0,0);
587 else if(trvconnect->TreeViewStatus() == 1 && trvlocation->TreeViewStatus() == 0)
588 { //1,0
589 if(last.x == 0 && last.y == 0)
590 { //pre: 0,0
591 //post: 1,0
592 topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
593 middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
594 middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
596 if(DUNLastWindowState == DUN_WINDOW_STATE_ONE)
598 passmeon->Hide();
599 passmeon3->Hide();
600 DUNLastWindowState = 4;//so we don't keep doing this :P
602 else
604 if(!(passmeon->IsHidden())) passmeon->Hide();
605 if(!(passmeon3->IsHidden()))passmeon3->Hide();
606 if((passmeon2->IsHidden()))passmeon2->Show();
607 if((passmeon4->IsHidden()))passmeon4->Show();
609 passmeon->SetResizingMode(B_FOLLOW_TOP);
610 passmeon4->SetResizingMode(B_FOLLOW_TOP);
611 passmeon2->SetResizingMode(B_FOLLOW_TOP);
612 passmeon3->SetResizingMode(B_FOLLOW_TOP);
614 ResizeBy(0,100);
617 if(last.x == 1 && last.y == 1)
618 { //pre: 1,1
619 //post: 1,0
620 topframe->SetResizingMode(B_FOLLOW_TOP);
621 middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
622 middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
624 if(!(passmeon->IsHidden())) passmeon->Hide();
625 if(!(passmeon3->IsHidden()))passmeon3->Hide();
626 if((passmeon2->IsHidden()))passmeon2->Show();
627 if((passmeon4->IsHidden()))passmeon4->Show();
629 passmeon->SetResizingMode(B_FOLLOW_TOP);
630 passmeon4->SetResizingMode(B_FOLLOW_TOP);
631 passmeon2->SetResizingMode(B_FOLLOW_TOP);
632 passmeon3->SetResizingMode(B_FOLLOW_TOP);
634 ResizeBy(0,-31);
638 DUNWindowState = DUN_WINDOW_STATE_ONE;
639 InvalidateAll();
640 SetStatus(1,0);
642 else if(trvconnect->TreeViewStatus() == 0 && trvlocation->TreeViewStatus() == 1)
643 { //0,1
645 if(last.x == 0 && last.y == 0)
646 { //pre:0,0
647 //post: 0,1
648 topframe->SetResizingMode(B_FOLLOW_TOP);
649 middleframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
650 middle_frame_label->SetResizingMode(B_FOLLOW_TOP);
652 if(DUNLastWindowState == DUN_WINDOW_STATE_TWO)
654 passmeon4->Hide();
655 passmeon2->Hide();
656 DUNLastWindowState = 4;//so we don't keep doing this :P
658 else
660 if(!(passmeon4->IsHidden())) passmeon4->Hide();
661 if(!(passmeon2->IsHidden()))passmeon2->Hide();
662 if((passmeon3->IsHidden()))passmeon3->Show();
663 if((passmeon->IsHidden()))passmeon->Show();
666 passmeon->SetResizingMode(B_FOLLOW_TOP);
667 passmeon4->SetResizingMode(B_FOLLOW_TOP);
668 passmeon2->SetResizingMode(B_FOLLOW_TOP);
669 passmeon3->SetResizingMode(B_FOLLOW_TOP);
671 ResizeBy(0,31);
674 if(last.x == 1 && last.y == 1)
675 { //pre: 1,1
676 //post: 0,1
677 topframe->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
678 middleframe->SetResizingMode(B_FOLLOW_BOTTOM);
679 middle_frame_label->SetResizingMode(B_FOLLOW_BOTTOM);
681 if(!(passmeon4->IsHidden()))passmeon4->Hide();
682 if(!(passmeon2->IsHidden()))passmeon2->Hide();
683 if((passmeon3->IsHidden()))passmeon3->Show();
684 if((passmeon->IsHidden()))passmeon->Show();
685 passmeon->SetResizingMode(B_FOLLOW_TOP);
686 passmeon4->SetResizingMode(B_FOLLOW_TOP);
687 passmeon2->SetResizingMode(B_FOLLOW_TOP);
688 passmeon3->SetResizingMode(B_FOLLOW_TOP);
690 ResizeBy(0,-100);
694 DUNWindowState = DUN_WINDOW_STATE_TWO;
695 InvalidateAll();
696 SetStatus(0,1);
699 // ------------------------------------------------------------------------------- //
700 // DUNWindow::SetStatus -- Integral to how DoResizeMagic Works! :-)
701 void DUNWindow::SetStatus(int m,int n)
703 last.x = m;
704 last.y = n;
706 // ------------------------------------------------------------------------------- //
709 // end