Changes

Jump to: navigation, search

OOP344 20102 TextEdit

1,705 bytes added, 14:24, 11 August 2010
PLATFORM KEY DEFINITIONS
<big><big><big>TextEdit , OOP344 Open Source Project 20102</big></big></big>(under construction)
<big><big><big>Release 0.1</big></big></big>
Include your already existing C code into your C++ code as follows:
<big><syntaxhighlight lang="cpp">
extern "C"{
#include "iof.h"
};
</syntaxhighlight></big>
This tells to C++ compiler, the included header file contains C functions and should be complied and called as such. Remember, you do not need and should not rename your iof.c to iof.cpp, since the compiler is already aware of the C functions in iof.c.
<pre>
#ifndef __BIO_BTEXT_H____IO_TEXT_H__ #define __BIO_BTEXT_H____IO_TEXT_H__
extern "C"{
#include "biofiof.h"
};
Also as mentioned above, A Form object is responsible to hold the input/output objects and display and edit them in an orderly fashion. A Form, so to speak, could be an array or list of input/output objects.
These objects by design, could be framed, which means they can have a border drawn around them. Because of this, a class needs to be designed to represent a Frame (we call it '''IOFrame''') to represent a Frame and this class should be inherited by all Framed objects.
Also, the input/output objects all have the same purpose (that is displaying or editing something). This "same purpose" will be encapsulated in a class called '''IOField''' that presents the idea of an input/output object in a form.
Also, the input/output objects all have the same purpose (that is displaying or editing something). This "same purpose" will be encapsulated in an abstract class called '''[[#IOField | IOField]]''' that presents the idea of an input/output object in a form.
== IOFrame ==
<br />
[[OOP344 20102 IOFrame test main|A main() function to test IOFrame::draw Offsets]]<br />
 
 
 
== IOField ==
To accommodate the above we create the following class:
<big><presyntaxhighlight lang=cpp>
# include "ioframe.h"
};
</presyntaxhighlight></big>
* '''_owner''' Holds the address of the Form the IOField Belongs to. If null, it means the IOField does not belong to any Form and it is stand alone
class IOForm: public IOFrame{
private: int _fnum; int _curidx; IOField* _fld[MAX_NO_FIELDS]; bool _dyn[MAX_NO_FIELDS]; bool _editable; IOForm* _owner; public: IOForm(int row = -1, int col = -1, int width = -1, int height = -1, bool framed = false); virtual ~IOForm(); void display(int fn = OT_CLR_AND_DSPLY_ALL_CLR_AND_DSPLY_ALL)const; int edit(int fn = 0, IOForm* owner = (IOForm*)0); IOForm& add(IOField* field, bool dynamic = true); IOForm& add(IOField& field, bool dynamic = false); bool editable(); int fieldNum()const; int curField()const; IOForm& set(IOForm* owner);
IOField& operator[](unsigned int index);
};
* '''void display(int fn = 0)const;'''<br />
If '''fn''' is OT_CLR_AND_DSPLY_ALL_CLR_AND_DSPLY_ALL, then it will check to see if _owner is not null. If _owner is not null, it will call the _owner's display() with OT_CLR_AND_DSPLY_ALL_CLR_AND_DSPLY_ALL, otherwise it will just clear the screen.<br />
Then it first call IOFrame::draw() and then it will display all the _fld elements, one by one.
If '''fn''' is OT_DSPLY_ALL _DSPLY_ALL then it will just call IOFrame::draw() and then it will display all the _fld elements, one by one.<br />
If '''fn''' is greater than 0 then it will only display '''_fld''' number '''fn''' (_fld[fn-1])
* '''IOField& operator[](unsigned int index);''' returns the reference of the _fld[index], if index is larger than _fnum, then circle back from the beginning.<br />
Executable sample for optext Release 0.3: ~fardad.soleimanloo/optext0.3
 
 
= IOVEdit =
= Executable Samples on Matrix=
* Bframe test: ~fardad.soleimanloo/bframetest
* optext Release 0.3: ~fardad.soleimanloo/optext0.3
== compiling under Linux ==
To compile in matrix, use:
g++ yada.cpp yadoo.cpp -x c biofiof.c -lncurses
If you have many cpp's, you may also do
g++ *.cpp -x c biofiof.c -lncurses
== Sample makefile for optext release 0.3 TextEdit ==
<big><pre>
optexttextedit: biofiof.o ioframe.o IOFieldiofield.o blabeliolabel.o beditioedit.o bformioform.o optexttextedit.o c++ biofiof.o ioframe.o IOFieldiofield.o blabeliolabel.o beditioedit.o bformioform.o optexttextedit.o \ -lncurses -ooptextotextedit
biofiof.o: biofiof.c biofiof.h cc -c biofiof.c
ioframe.o: ioframe.cpp ioframe.h iotext.h
c++ -c ioframe.cpp
IOFieldiofield.o: IOFieldiofield.cpp IOFieldiofield.h ioframe.h bform.h c++ -c IOFieldiofield.cpp
blabeliolabel.o: blabeliolabel.cpp blabeliolabel.h IOField.h iotext.h c++ -c blabeliolabel.cpp
beditioedit.o: beditioedit.cpp beditioedit.h IOField.h iotext.h c++ -c beditioedit.cpp
bformioform.o: bformioform.cpp bformioform.h iotext.h IOFieldiofield.h c++ -c bformioform.cpp
optexttextedit.o: optexttextedit.cpp iotext.h blabeliolabel.h beditioedit.h bformioform.h IOFieldiofield.h
c++ -c optext.cpp
</pre></big>
 
= PLATFORM KEY DEFINITIONS =
 
<u>'''VCC and PLT_BCC'''</u>
* UP_KEY 1072
* DOWN_KEY 1080
* LEFT_KEY 1075
* RIGHT_KEY 1077
* PGUP_KEY 1073
* PGDN_KEY 1081
* ENTER_KEY 13
* TAB_KEY 9
* BACSPACE_KEY 8
* DEL_KEY 1083
* HOME_KEY 1071
* END_KEY 1079
* ESCAPE_KEY 27
* INSERT_KEY 1082
* F1_KEY 1059
* F2_KEY 1060
* F3_KEY 1061
* F4_KEY 1062
* F5_KEY 1063
* F6_KEY 1064
* F7_KEY 1065
* F8_KEY 1066
* F9_KEY 1067
* F10_KEY 1068
* F11_KEY 1133
* F12_KEY 1134
 
<u>'''LNX'''</u> /* use PUTTY terminal only and set the keyboard to Xtrem R6 */
 
* UP_KEY 259
* DOWN_KEY 258
* LEFT_KEY 260
* RIGHT_KEY 261
* PGUP_KEY 339
* PGDN_KEY 338
* ENTER_KEY 10
* TAB_KEY 9
* BACKSPACE_KEY 263
* DEL_KEY 330
* HOME_KEY 262
* END_KEY 360
* ESCAPE_KEY 27
* INSRT_KEY 331
* F1_KEY 265
* F2_KEY 266
* F3_KEY 267
* F4_KEY 268
* F5_KEY 269
* F6_KEY 270
* F7_KEY 271
* F8_KEY 272
* F9_KEY 273
* F10_KEY 274
* F11_KEY 275
* F12_KEY 276
 
<u>'''MAC'''</u>
 
* UP_KEY 259
* DOWN_KEY 258
* LEFT_KEY 260
* RIGHT_KEY 261
* PGUP_KEY 339
* PGDN_KEY 338
* ENTER_KEY 10
* TAB_KEY 9
* BACKSPACE_KEY 263
* DEL_KEY 127
* HOME_KEY 262
* END_KEY 360
* ESCAPE_KEY 27
* INSERT_KEY 331
* F1_KEY 995
* F2_KEY 996
* F3_KEY 997
* F4_KEY 998
* F5_KEY 269
* F6_KEY 270
* F7_KEY 111
* F8_KEY 272
* F9_KEY 273
* F10_KEY 274
* F11_KEY 275
* F12_KEY 126
1
edit

Navigation menu