Advanced Strategic Command
Classes | Macros | Typedefs | Functions | Variables
dlg_box.cpp File Reference

Some basic classes from which all of ASC's dialogs are derived. More...

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <cstring>
#include <iostream>
#include "typen.h"
#include "basegfx.h"
#include "newfont.h"
#include "spfst.h"
#include "loaders.h"
#include "misc.h"
#include "events.h"
#include "stack.h"
#include "dlg_box.h"
#include "paradialog.h"
#include "widgets/textrenderer.h"
#include "spfst-legacy.h"
#include "dlgraph.cpp"
Include dependency graph for dlg_box.cpp:

Go to the source code of this file.

Classes

class  tdisplaymessage
 
struct  tpicture
 
class  thelpsystem
 
class  tviewtextquery
 
class  ViewTextQuery
 
class  tgetid
 
class  ChooseString
 
class  StringEdit
 

Macros

#define ppicture   tpicture*
 

Typedefs

typedef char * tstringa [30]
 
typedef tstringapstringa
 

Functions

void strrd8d (int l, char *s)
 
void strrd8u (int l, char *s)
 
void strrd8n (int l, char *s)
 
char * strrrd8d (int l)
 
char * strrrd8u (int l)
 
char * strrrd8n (int l)
 
char getletter (const char *s)
 
void repaintdisplay (void)
 
int getplayercolor (int i)
 
void displaymessage (const char *formatstring, int num,...)
 displays a dialog box with a message More...
 
void displaymessage (const ASCString &text, int num)
 displays a dialog box with a message More...
 
void removemessage (void)
 closes a message dialog box that has been opened by displaymessage() More...
 
ASCString readtextmessage (int id)
 returns the message with the given ID from the message system. More...
 
void help (int id)
 displays a dialogbog with the given help topic More...
 
void viewtext2 (int id)
 displays a dialogbog with the given message More...
 
int legacy_viewtextquery (int id, const char *title, const char *s1, const char *s2)
 
int viewtextquery (int id, const char *title, const char *s1, const char *s2)
 
int getid (const char *title, int lval, int min, int max)
 
int chooseString (const ASCString &title, const vector< ASCString > &entries, int defaultEntry)
 displays a dialogbox which lets you choose one of a number of strings. More...
 
pair< int, int > chooseString (const ASCString &title, const vector< ASCString > &entries, const vector< ASCString > &buttons, int defaultEntry)
 displays a dialogbox which lets you choose one of a number of strings. More...
 
ASCString editString (const ASCString &title, const ASCString &defaultValue)
 

Variables

char strrstring [200]
 
void * dialogtexture = NULL
 
int actdisplayedmessage = 0
 
long int lastdisplayedmessageticker = 0xffffff
 
tvirtualscreenbuf virtualscreenbuf
 
const char * emptystring = ""
 
tdisplaymessagemessagebox = NULL
 

Detailed Description

Some basic classes from which all of ASC's dialogs are derived.

Definition in file dlg_box.cpp.

Macro Definition Documentation

#define ppicture   tpicture*

Definition at line 3132 of file dlg_box.cpp.

Referenced by thelpsystem::done().

Typedef Documentation

typedef tstringa* pstringa

Definition at line 1748 of file dlg_box.cpp.

typedef char* tstringa[30]

Definition at line 1747 of file dlg_box.cpp.

Function Documentation

int chooseString ( const ASCString title,
const vector< ASCString > &  entries,
int  defaultEntry = -1 
)

displays a dialogbox which lets you choose one of a number of strings.

Parameters
titlethe title of the dialog box
entriesthe list of strings
defaultEntrythe entry that is selected by default (-1 if none)
Returns
the selected index or -1 if nothing was selected

Definition at line 3788 of file dlg_box.cpp.

References chooseString().

Referenced by chooseString(), chooseWeather(), editResearch(), editResearchPoints(), editTechAdapter(), CargoGuiFunctions::TransferUnitControl::execute(), generateTechTree(), selectPlayer(), FieldAddressing::setup(), EventTriggered::setup(), ChangeDiplomaticStatus::setup(), SetViewSharing::setup(), Reinforcements::setup(), and ChangePlayerState::setup().

pair<int,int> chooseString ( const ASCString title,
const vector< ASCString > &  entries,
const vector< ASCString > &  buttons,
int  defaultEntry = -1 
)

displays a dialogbox which lets you choose one of a number of strings.

Parameters
titlethe title of the dialog box
entriesthe list of strings
buttonsthe names of the buttons that are going to be displayed
defaultEntrythe entry that is selected by default (-1 if none)
Returns
button-number, selected index

Definition at line 3798 of file dlg_box.cpp.

References tstringselect::action, tstringselect::done(), tstringselect::init(), legacyEventSystemActive(), new_chooseString(), tstringselect::redline, and ChooseString::run().

void displaymessage ( const char *  formatstring,
int  num,
  ... 
)

displays a dialog box with a message

Parameters
formatstringthe text, which may contain the same format arguments as sprintf
num0 normal text, the dialog box will stay visible until removemessage() is called 1 red text for error message 2 fatal error, the program will be closed 3 normal text

Definition at line 1849 of file dlg_box.cpp.

References displaymessage().

Referenced by tdlgengine::addbutton(), tdlgengine::addDropDown(), tdlgengine::addscrollbar(), BuildingConquered::arm(), BuildingLost::arm(), BuildingSeen::arm(), PlayListSelector::buttonpressed(), tgiveunitawaydlg::buttonpressed(), GetResource::checkbuilding(), PutResource::checkbuilding(), tparagraph::checkcursor(), checkforvictory(), ResizeMap::checkvalue(), displaymessage(), trunreplay::error(), execaction(), trunreplay::execnextreplaymove(), LoseMap::execute(), Reinforcements::execute(), executeUserAction(), generatemap(), getbipath(), BuildingConquered::getState(), BuildingDestroyed::getState(), BuildingSeen::getState(), GameMap::getUnit(), tdialogbox::intedit(), CargoItemFactory::itemSelected(), iterateToNextPlayer(), k_loadmap(), legacy_choice_dlg(), loadreplay(), loadStartupMap(), main(), mapeditorMainThread(), mapLoadingExceptionChecker(), MapNetwork::MapNetwork(), movebuilding(), ClipBoardBase::place(), tspfldloaders::readfields(), readOldEvent(), readOldEventLists(), resourceComparison(), trunreplay::run(), AI::run(), ResizeMap::run(), UnitTypeTransformation::run(), savegame(), savemap(), savereplay(), selectunitsetfilter(), ChangeGameParameter::setup(), showbdtbits(), PolygonEditor::showFieldMarking(), statisticDialog(), transformMap(), UnitInfoDialog::UnitInfoDialog(), tspfldloaders::writefields(), and tspfldloaders::writemap().

void displaymessage ( const ASCString text,
int  num 
)

displays a dialog box with a message

Parameters
textthe text
num0 normal text, the dialog box will stay visible until removemessage() is called 1 red text for error message 2 fatal error, the program will be closed 3 normal text

Definition at line 1866 of file dlg_box.cpp.

References tdialogbox::boxstatus, displayLogMessage(), tdialogbox::done(), tdisplaymessage::init(), legacyEventSystemActive(), messagebox, and tdisplaymessage::run().

ASCString editString ( const ASCString title,
const ASCString defaultValue 
)
int getid ( const char *  title,
int  lval,
int  min,
int  max 
)
char getletter ( const char *  s)

Definition at line 123 of file dlg_box.cpp.

Referenced by tdlgengine::addbutton().

int getplayercolor ( int  i)

Definition at line 303 of file dlg_box.cpp.

References actmap.

Referenced by tdialogbox::init().

void help ( int  id)

displays a dialogbog with the given help topic

See Also
viewtext2(int)

Definition at line 3286 of file dlg_box.cpp.

References readtextmessage(), and ASC_PG_Dialog::RunModal().

Referenced by execaction_pg(), executeUserAction(), MailOptionsDialog::MailOptionsDialog(), tmapgenerator::run(), and tplayerchange::run().

int legacy_viewtextquery ( int  id,
const char *  title,
const char *  s1,
const char *  s2 
)
ASCString readtextmessage ( int  id)

returns the message with the given ID from the message system.

This system spans the helpfiles and the message files associated with the maps

Definition at line 3048 of file dlg_box.cpp.

References actmap, displayLogMessage(), tfindfile::getnextname(), GameMap::PreferredFilenames::mapname, GameMap::preferredFileNames, tnstream::reading, and strrr().

Referenced by execaction(), help(), helpAbout(), thelpsystem::init(), MailOptionsDialog::MailOptionsDialog(), viewtext2(), and ViewTextQuery::ViewTextQuery().

void removemessage ( void  )

closes a message dialog box that has been opened by displaymessage()

Definition at line 1976 of file dlg_box.cpp.

References tdialogbox::boxstatus, tdialogbox::done(), and messagebox.

void repaintdisplay ( void  )
void strrd8d ( int  l,
char *  s 
)

Definition at line 57 of file dlg_box.cpp.

References itoa(), and minmalq.

void strrd8n ( int  l,
char *  s 
)

Definition at line 67 of file dlg_box.cpp.

References itoa(), and minmalq.

void strrd8u ( int  l,
char *  s 
)

Definition at line 62 of file dlg_box.cpp.

References itoa(), and minmalq.

char* strrrd8d ( int  l)

Definition at line 73 of file dlg_box.cpp.

References itoa(), minmalq, and strrstring.

Referenced by displaywindspeed().

char* strrrd8n ( int  l)

Definition at line 87 of file dlg_box.cpp.

References itoa(), minmalq, and strrstring.

char* strrrd8u ( int  l)

Definition at line 80 of file dlg_box.cpp.

References itoa(), minmalq, and strrstring.

void viewtext2 ( int  id)

displays a dialogbog with the given message

See Also
help(int)

Definition at line 3296 of file dlg_box.cpp.

References readtextmessage(), and ASC_PG_Dialog::RunModal().

Referenced by NextTurnStrategy_AskUser::continueWhenLastPlayer(), and gamethread().

int viewtextquery ( int  id,
const char *  title,
const char *  s1,
const char *  s2 
)

Variable Documentation

int actdisplayedmessage = 0

Definition at line 97 of file dlg_box.cpp.

Referenced by infomessage().

void* dialogtexture = NULL

Definition at line 95 of file dlg_box.cpp.

Referenced by tdialogbox::paintsurface2().

const char* emptystring = ""

Definition at line 469 of file dlg_box.cpp.

Referenced by tdlgengine::addbutton().

long int lastdisplayedmessageticker = 0xffffff

Definition at line 98 of file dlg_box.cpp.

Referenced by infomessage().

tdisplaymessage * messagebox = NULL

Definition at line 3409 of file dlg_box.cpp.

Referenced by displaymessage(), and removemessage().

char strrstring[200]

Definition at line 55 of file dlg_box.cpp.

Referenced by strrrd8d(), strrrd8n(), and strrrd8u().

tvirtualscreenbuf virtualscreenbuf

Definition at line 101 of file dlg_box.cpp.

Referenced by gamethread(), main(), and runTester().