Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Functions | Variables
textedit.hpp File Reference
#include "inexor/ui/legacy/3dgui.hpp"
#include "inexor/engine/rendertext.hpp"
#include "inexor/engine/glexts.hpp"
#include "inexor/engine/glemu.hpp"

Go to the source code of this file.

Classes

struct  editline
 
struct  editor
 

Macros

#define TEXTCOMMAND(f, s, d, body)
 
#define PASTEBUFFER   "#pastebuffer"
 

Functions

static editorcurrentfocus ()
 
static void readyeditors ()
 
static void flusheditors ()
 
static editoruseeditor (const char *name, int mode, bool focus, const char *initval=nullptr)
 
 ICOMMAND (textlist,"",(), vector< char > s;loopv(editors){if(i > 0) s.put(", ", 2);s.put(editors[i]->name, strlen(editors[i]->name));}s.add('\0');result(s.getbuf());)
 
 TEXTCOMMAND (textshow,"",(), editline line;line.combinelines(top->lines);result(line.text);line.clear();)
 
 ICOMMAND (textfocus,"si",(char *name, int *mode), if(*name) useeditor(name,*mode<=0?EDITORFOREVER:*mode, true);else if(editors.length() > 0) result(editors.last() ->name);)
 
 TEXTCOMMAND (textprev,"",(), editors.insert(0, top);editors.pop();)
 
 TEXTCOMMAND (textmode,"i",(int *m), if(*m) top->mode=*m;else intret(top->mode);)
 
if file top setfile (path(file, true))
 
top save ()
 
 TEXTCOMMAND (textload,"s",(char *file), if(*file){top->setfile(path(file, true));top->load();}else if(top->filename) result(top->filename);)
 
 TEXTCOMMAND (textinit,"sss",(char *name, char *file, char *initval),{editor *e=NULL;loopv(editors) if(!strcmp(editors[i]->name, name)){e=editors[i];break;}if(e &&e->rendered &&!e->filename &&*file &&(e->lines.empty()||(e->lines.length()==1 &&!strcmp(e->lines[0].text, initval)))){e->setfile(path(file, true));e->load();}})
 
 TEXTCOMMAND (textcopy,"",(), editor *b=useeditor(PASTEBUFFER, EDITORFOREVER, false);top->copyselectionto(b);)
 
 TEXTCOMMAND (textpaste,"",(), editor *b=useeditor(PASTEBUFFER, EDITORFOREVER, false);top->insertallfrom(b);)
 
 TEXTCOMMAND (textmark,"i",(int *m), if(*m) top->mark(*m==1);else intret(top->region()?1:2);)
 
 TEXTCOMMAND (textselectall,"",(), top->selectall();)
 
 TEXTCOMMAND (textclear,"",(), top->clear();)
 
 TEXTCOMMAND (textcurrentline,"",(), result(top->currentline().text);)
 
 execute (script)
 

Variables

static vector< editor * > editors
 
char * script = *selected ? top->selectiontostring() : top->tostring()
 

Macro Definition Documentation

#define PASTEBUFFER   "#pastebuffer"
#define TEXTCOMMAND (   f,
  s,
  d,
  body 
)
Value:
ICOMMAND(f, s, d,\
if(!top || identflags&IDF_OVERRIDDEN) return;\
body\
)
Definition: command.hpp:76
int identflags
Definition: command.cpp:41
ICOMMAND * f(float *a, float *b), floatret(*a **b)
static editor * currentfocus()
Definition: textedit.hpp:673
if(NOT DEFINED PROJECT_ARCH) message(FATAL_ERROR"You are generating from the wrong folder! \"Where is the Source
Definition: CMakeLists.txt:2
int d
Definition: octaedit.cpp:1749
Definition: textedit.hpp:148
ICOMMAND(textlist,"",(), vector< char > s;loopv(editors){if(i > 0) s.put(", ", 2);s.put(editors[i]->name, strlen(editors[i]->name));}s.add('\0');result(s.getbuf());)

Function Documentation

static editor* currentfocus ( )
static
execute ( script  )
static void flusheditors ( )
static

References DELETEP, loopvrev, and vector< T, MINSIZE >::remove().

Referenced by g3d_render().

ICOMMAND ( textlist  ,
""  ,
()  ,
vector< char > s;loopv(editors){if(i > 0) s.put(", ", 2);s.put(editors[i]->name, strlen(editors[i]->name));}s.add('\0');result(s.getbuf());   
)
ICOMMAND ( textfocus  ,
"si"  ,
(char *name, int *mode)  ,
if *name useeditor(name,*mode<=0?EDITORFOREVER:*mode, true);else if(editors.length() > 0) result(editors.last() ->name);   
)
static void readyeditors ( )
static

References EDITORFOREVER, and loopv.

Referenced by g3d_render().

top save ( )

Referenced by edittex(), and BIH::traverse().

if file top setfile ( path(file, true)  )
TEXTCOMMAND ( textshow  ,
""  ,
()  ,
editline line;line.combinelines(top->lines);result(line.text);line.clear();   
)
TEXTCOMMAND ( textprev  ,
""  ,
()  ,
editors.insert(0, top);editors.pop();   
)
TEXTCOMMAND ( textmode  ,
"i"  ,
(int *m)  ,
if *m top->  mode = *m;else intret(top->mode); 
)
TEXTCOMMAND ( textload  ,
"s"  ,
(char *file)  ,
if *file{top->setfile(path(file, true));top->load();}else if(top->filename) result(top->filename);   
)
TEXTCOMMAND ( textinit  ,
"sss"  ,
(char *name, char *file, char *initval)  ,
{editor *e=NULL;loopv(editors) if(!strcmp(editors[i]->name, name)){e=editors[i];break;}if(e &&e->rendered &&!e->filename &&*file &&(e->lines.empty()||(e->lines.length()==1 &&!strcmp(e->lines[0].text, initval)))){e->setfile(path(file, true));e->load();}}   
)
TEXTCOMMAND ( textcopy  ,
""  ,
()  ,
editor b = useeditor(PASTEBUFFEREDITORFOREVER, false);top->copyselectionto(b); 
)
TEXTCOMMAND ( textpaste  ,
""  ,
()  ,
editor b = useeditor(PASTEBUFFEREDITORFOREVER, false);top->insertallfrom(b); 
)
TEXTCOMMAND ( textmark  ,
"i"  ,
(int *m)  ,
if *m top->mark *==1m;else intret(top->region()?1:2);   
)
TEXTCOMMAND ( textselectall  ,
""  ,
()  ,
top->selectall();   
)
TEXTCOMMAND ( textclear  ,
""  ,
()  ,
top->clear();   
)
TEXTCOMMAND ( textcurrentline  ,
""  ,
()  ,
result(top->currentline().text);   
)
static editor* useeditor ( const char *  name,
int  mode,
bool  focus,
const char *  initval = nullptr 
)
static

Variable Documentation

vector<editor*> editors
static
delete [] script = *selected ? top->selectiontostring() : top->tostring()