MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DoEditDialog

Function DoEditDialog

Descent3/newui.cpp:726–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726bool DoEditDialog(const char *title, char *buffer, int buflen, bool showcancel) {
727 newuiMessageBox mbox;
728 newuiSheet *sheet;
729
730 int old_screen_mode, res;
731 char msgbuf[256];
732 char *edit;
733
734 // force menu mode
735 old_screen_mode = GetScreenMode();
736
737 textaux_WordWrap(title, msgbuf, NEWUI_MSGBOX_SHEET_W, MONITOR9_NEWUI_FONT);
738
739 // make message box
740 mbox.Create("", showcancel ? MSGBOX_OKCANCEL : MSGBOX_OK);
741
742 sheet = mbox.GetSheet();
743 sheet->NewGroup(NULL, 0, 25);
744 edit = sheet->AddEditBox("", buflen, 0, DEFAULT_NEWUID, 0, true);
745 strcpy(edit, buffer);
746
747 sheet->NewGroup(NULL, 0, 0);
748 sheet->AddText(msgbuf);
749
750 mbox.Open();
751 res = mbox.DoUI();
752 mbox.Close();
753
754 if (res != UID_CANCEL && res != NEWUIRES_FORCEQUIT) {
755 if (strcmp(edit, NEWUI_EDIT_CANCELED_STR) != 0) {
756 strcpy(buffer, edit);
757 mprintf(0, "editdialog=%s\n", buffer);
758 } else {
759 res = UID_CANCEL;
760 }
761 }
762
763 mbox.Destroy();
764
765 // restore screen
766 SetScreenMode(old_screen_mode);
767
768 // return correct value.
769 return ((res != UID_CANCEL && res != NEWUIRES_FORCEQUIT) ? true : false);
770}
771
772// puts up a file selector box
773// Parameters: max_filename_len - the max length for the filename. filebuf have a length of at least max_filename_len+1

Callers 5

PilotCreateFunction · 0.85
SaveGameDialogFunction · 0.85
CheckMissionForScriptFunction · 0.85
BuddyProcessCommandFunction · 0.85
DemoToggleRecordingFunction · 0.85

Calls 12

GetScreenModeFunction · 0.85
textaux_WordWrapFunction · 0.85
SetScreenModeFunction · 0.85
GetSheetMethod · 0.80
NewGroupMethod · 0.80
AddEditBoxMethod · 0.80
AddTextMethod · 0.80
CreateMethod · 0.45
OpenMethod · 0.45
DoUIMethod · 0.45
CloseMethod · 0.45
DestroyMethod · 0.45

Tested by

no test coverage detected