From: Andy D. <kha...@us...> - 2003-07-30 17:14:29
|
Update of /cvsroot/planeshift/planeshift/src/client/paws In directory sc8-pr-cvs1:/tmp/cvs-serv19522/src/client/paws Modified Files: shortcutwindow.cpp Log Message: Improved the shortcut edit window so it is read from a XML file and no longer has to be modal Added a cancel button Index: shortcutwindow.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/paws/shortcutwindow.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shortcutwindow.cpp 30 Jul 2003 07:47:20 -0000 1.3 --- shortcutwindow.cpp 30 Jul 2003 17:14:26 -0000 1.4 *************** *** 50,53 **** --- 50,55 ---- systemText = (pawsMessageTextBox*)windowManager->FindWidget("SystemText"); subWidget = NULL; + textBox = NULL; + labelBox = NULL; } *************** *** 84,88 **** { // Finished Configuring command button ! if (widget->GetID() == 1010) { if (textBox->GetText() && *(textBox->GetText()) != '\0') --- 86,90 ---- { // Finished Configuring command button ! if (widget->GetID() == 1100) { if (textBox->GetText() && *(textBox->GetText()) != '\0') *************** *** 97,104 **** windowManager->SetModalWidget(NULL); windowManager->SetCurrentFocusedWidget(this); ! DeleteChild(subWidget); ! subWidget = NULL; ! } // Execute clicked on button else if (mouseButton == 1) --- 99,111 ---- windowManager->SetModalWidget(NULL); windowManager->SetCurrentFocusedWidget(this); ! subWidget->Hide(); } + else if (widget->GetID() == 1101) + { + windowManager->SetModalWidget(NULL); + windowManager->SetCurrentFocusedWidget(this); + subWidget->Hide(); + } + // Execute clicked on button else if (mouseButton == 1) *************** *** 136,188 **** else { - if (subWidget) - return false; edit = widget->GetID() - 1000; ! subWidget = (pawsWidget*)windowManager->CreateWidget("pawsWidget"); ! AddChild(subWidget); ! subWidget->MoveTo(80, 80); ! subWidget->SetSize(330, 320); ! subWidget->UseBorder(); ! subWidget->SetBackground("Standard Background"); ! subWidget->SetBackgroundAlpha(0); ! subWidget->SetName("Set Command"); ! windowManager->SetModalWidget(subWidget); ! ! pawsTextBox* infoBox = (pawsTextBox*)windowManager->CreateWidget("pawsTextBox"); ! subWidget->AddChild(infoBox); ! infoBox->SetText("Name:"); ! infoBox->SetRelativeFrame(20, 5, 0, 0); ! infoBox->SetSizeByText(); ! infoBox->Show(); ! labelBox = (pawsEditTextBox*)windowManager->CreateWidget("pawsEditTextBox"); ! subWidget->AddChild(labelBox); ! labelBox->SetRelativeFrame(20, 25, 80, 25); ! labelBox->UseBorder(); if (!name[edit].IsEmpty()) labelBox->SetText(name[edit].GetData()); ! infoBox = (pawsTextBox*)windowManager->CreateWidget("pawsTextBox"); ! subWidget->AddChild(infoBox); ! infoBox->SetText("Enter the command(s):"); ! infoBox->SetRelativeFrame(20, 52, 0, 0); ! infoBox->SetSizeByText(); ! infoBox->Show(); ! ! textBox = (pawsEditTextBox*)windowManager->CreateWidget("pawsEditTextBox"); ! subWidget->AddChild(textBox); ! textBox->SetRelativeFrame(20, 73, 300, 203); ! textBox->UseBorder(); ! textBox->SetMultiline(true); if (!cmd[edit].IsEmpty()) textBox->SetText(cmd[edit].GetData()); ! pawsButton* buttonWidget = (pawsButton*)windowManager->CreateWidget("pawsButton"); ! subWidget->AddChild(buttonWidget); ! buttonWidget->SetRelativeFrame(20, 280, 50, 25); ! buttonWidget->SetText("Done"); ! buttonWidget->UseBorder(); ! buttonWidget->SetToggle(false); ! buttonWidget->SetID(1010); windowManager->SetCurrentFocusedWidget(textBox); } --- 143,165 ---- else { edit = widget->GetID() - 1000; ! if (!subWidget) ! subWidget = (pawsWidget*)windowManager->FindWidget("ShortcutEdit"); ! if (!subWidget) ! return false; ! if (!labelBox) ! labelBox = (pawsEditTextBox*)subWidget->FindWidget("LabelBox"); if (!name[edit].IsEmpty()) labelBox->SetText(name[edit].GetData()); + else labelBox->Clear(); ! if (!textBox) ! textBox = (pawsEditTextBox*)subWidget->FindWidget("CommandBox"); if (!cmd[edit].IsEmpty()) textBox->SetText(cmd[edit].GetData()); + else textBox->Clear(); ! subWidget->Show(); windowManager->SetCurrentFocusedWidget(textBox); } |