2007-03-08 04:03:40 +08:00
|
|
|
#ifndef PAGEBLK_C
|
|
|
|
#define PAGEBLK_C
|
|
|
|
|
|
|
|
#include "elst.h"
|
|
|
|
#include "txtregn.h"
|
|
|
|
#include "bits16.h"
|
|
|
|
|
|
|
|
#include "hpddef.h" //must be last (handpd.dll)
|
|
|
|
|
|
|
|
enum PB_TYPE
|
|
|
|
{
|
|
|
|
PB_TEXT,
|
|
|
|
PB_RULES,
|
|
|
|
PB_GRAPHICS,
|
|
|
|
PB_IMAGE,
|
|
|
|
PB_SCRIBBLE,
|
|
|
|
PB_WEIRD
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLLSYM PAGE_BLOCK; //forward decl
|
|
|
|
class DLLSYM TEXT_BLOCK; //forward decl
|
|
|
|
class DLLSYM GRAPHICS_BLOCK; //forward decl
|
|
|
|
class DLLSYM RULE_BLOCK; //forward decl
|
|
|
|
class DLLSYM IMAGE_BLOCK; //forward decl
|
|
|
|
class DLLSYM SCRIBBLE_BLOCK; //forward decl
|
|
|
|
class DLLSYM WEIRD_BLOCK; //forward decl
|
|
|
|
|
|
|
|
ELISTIZEH_S (PAGE_BLOCK)
|
|
|
|
class DLLSYM PAGE_BLOCK:public ELIST_LINK, public POLY_BLOCK
|
|
|
|
//page block
|
|
|
|
{
|
|
|
|
public:
|
2008-04-22 08:41:37 +08:00
|
|
|
PAGE_BLOCK() {
|
2007-03-08 04:03:40 +08:00
|
|
|
} //empty constructor
|
|
|
|
PAGE_BLOCK( //simple constructor
|
|
|
|
ICOORDELT_LIST *points,
|
|
|
|
PB_TYPE type,
|
|
|
|
PAGE_BLOCK_LIST *child);
|
|
|
|
|
|
|
|
PAGE_BLOCK( //simple constructor
|
|
|
|
ICOORDELT_LIST *points,
|
|
|
|
PB_TYPE type);
|
|
|
|
|
|
|
|
~PAGE_BLOCK () { //destructor
|
|
|
|
}
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void add_a_child(PAGE_BLOCK *newchild);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
PB_TYPE type() { //get type
|
|
|
|
return pb_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
PAGE_BLOCK_LIST *child() { //get children
|
|
|
|
return &children;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rotate( //rotate it
|
|
|
|
FCOORD rotation);
|
|
|
|
void move( //move it
|
|
|
|
ICOORD shift); //vector
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void basic_plot(ScrollView* window, ScrollView::Color colour);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void plot(ScrollView* window, ScrollView::Color colour);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void show_attrs(DEBUG_WIN *debug);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
NEWDELETE2 (PAGE_BLOCK) void pb_delete ();
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void serialise(FILE *f);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
static PAGE_BLOCK *de_serialise(FILE *f);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
void prep_serialise() { //set ptrs to counts
|
2008-04-22 08:41:37 +08:00
|
|
|
POLY_BLOCK::prep_serialise();
|
2007-03-08 04:03:40 +08:00
|
|
|
children.prep_serialise ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void dump( //write external bits
|
|
|
|
FILE *f) {
|
2008-04-22 08:41:37 +08:00
|
|
|
POLY_BLOCK::dump(f);
|
2007-03-08 04:03:40 +08:00
|
|
|
children.dump (f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void de_dump( //read external bits
|
|
|
|
FILE *f) {
|
2008-04-22 08:41:37 +08:00
|
|
|
POLY_BLOCK::de_dump(f);
|
2007-03-08 04:03:40 +08:00
|
|
|
children.de_dump (f);
|
|
|
|
}
|
|
|
|
|
|
|
|
//note that due to the awful switched nature of the PAGE_BLOCK class,
|
|
|
|
//a PAGE_BLOCK_LIST cannot be de-serialised by the normal mechanism, since
|
|
|
|
//each element cannot be de-serialised in place.
|
|
|
|
//To fix this it is important to use read_poly_blocks or the code therein.
|
|
|
|
void serialise_asc( //serialise to ascii
|
|
|
|
FILE *f);
|
|
|
|
void internal_serialise_asc( //serialise to ascii
|
|
|
|
FILE *f);
|
|
|
|
void de_serialise_asc( //serialise from ascii
|
|
|
|
FILE *f);
|
|
|
|
//make one from ascii
|
2008-04-22 08:41:37 +08:00
|
|
|
static PAGE_BLOCK *new_de_serialise_asc(FILE *f);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
PB_TYPE pb_type;
|
|
|
|
PAGE_BLOCK_LIST children;
|
|
|
|
};
|
|
|
|
|
|
|
|
DLLSYM void show_all_in(PAGE_BLOCK *pblock,
|
|
|
|
POLY_BLOCK *show_area,
|
|
|
|
DEBUG_WIN *f);
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
DLLSYM void delete_all_in(PAGE_BLOCK *pblock, POLY_BLOCK *delete_area);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
DLLSYM PAGE_BLOCK *smallest_containing(PAGE_BLOCK *pblock, POLY_BLOCK *other);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
class DLLSYM TEXT_BLOCK:public PAGE_BLOCK
|
|
|
|
//text block
|
|
|
|
{
|
|
|
|
public:
|
2008-04-22 08:41:37 +08:00
|
|
|
TEXT_BLOCK() {
|
2007-03-08 04:03:40 +08:00
|
|
|
} //empty constructor
|
2008-04-22 08:41:37 +08:00
|
|
|
TEXT_BLOCK(ICOORDELT_LIST *points);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
TEXT_BLOCK (ICOORDELT_LIST * points, BOOL8 backg[NUM_BACKGROUNDS]);
|
|
|
|
|
|
|
|
//get children
|
2008-04-22 08:41:37 +08:00
|
|
|
TEXT_REGION_LIST *regions() {
|
2007-03-08 04:03:40 +08:00
|
|
|
return &text_regions;
|
|
|
|
}
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
inT32 nregions() {
|
2007-03-08 04:03:40 +08:00
|
|
|
return text_regions.length ();
|
|
|
|
}
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void add_a_region(TEXT_REGION *newchild);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
void rotate( //rotate it
|
|
|
|
FCOORD rotation);
|
|
|
|
void move( //move it
|
|
|
|
ICOORD shift); //vector
|
|
|
|
|
2008-02-01 08:36:18 +08:00
|
|
|
void plot(ScrollView* window,
|
|
|
|
ScrollView::Color colour,
|
|
|
|
ScrollView::Color region_colour,
|
|
|
|
ScrollView::Color subregion_colour);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
void set_attrs (BOOL8 backg[NUM_BACKGROUNDS]);
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void show_attrs(DEBUG_WIN *debug);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
void prep_serialise() { //set ptrs to counts
|
2008-04-22 08:41:37 +08:00
|
|
|
PAGE_BLOCK::prep_serialise();
|
2007-03-08 04:03:40 +08:00
|
|
|
text_regions.prep_serialise ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void dump( //write external bits
|
|
|
|
FILE *f) {
|
2008-04-22 08:41:37 +08:00
|
|
|
PAGE_BLOCK::dump(f);
|
2007-03-08 04:03:40 +08:00
|
|
|
text_regions.dump (f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void de_dump( //read external bits
|
|
|
|
FILE *f) {
|
2008-04-22 08:41:37 +08:00
|
|
|
PAGE_BLOCK::de_dump(f);
|
2007-03-08 04:03:40 +08:00
|
|
|
text_regions.de_dump (f);
|
|
|
|
}
|
|
|
|
|
|
|
|
//serialise to ascii
|
|
|
|
make_serialise (TEXT_BLOCK) void serialise_asc (
|
|
|
|
FILE * f);
|
|
|
|
void de_serialise_asc( //serialise from ascii
|
|
|
|
FILE *f);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BITS16 background;
|
|
|
|
|
|
|
|
TEXT_REGION_LIST text_regions;
|
|
|
|
};
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
DLLSYM void delete_all_tr_in(TEXT_BLOCK *tblock, POLY_BLOCK *delete_area);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
DLLSYM void show_all_tr_in(TEXT_BLOCK *tblock,
|
|
|
|
POLY_BLOCK *show_area,
|
|
|
|
DEBUG_WIN *f);
|
|
|
|
|
|
|
|
class DLLSYM RULE_BLOCK:public PAGE_BLOCK
|
|
|
|
//rule block
|
|
|
|
{
|
|
|
|
public:
|
2008-04-22 08:41:37 +08:00
|
|
|
RULE_BLOCK() {
|
2007-03-08 04:03:40 +08:00
|
|
|
} //empty constructor
|
2008-04-22 08:41:37 +08:00
|
|
|
RULE_BLOCK(ICOORDELT_LIST *points, inT8 sing, inT8 colo);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void set_attrs(inT8 sing, inT8 colo);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void show_attrs(DEBUG_WIN *debug);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
//serialise to ascii
|
|
|
|
make_serialise (RULE_BLOCK) void serialise_asc (
|
|
|
|
FILE * f);
|
|
|
|
void de_serialise_asc( //serialise from ascii
|
|
|
|
FILE *f);
|
|
|
|
|
|
|
|
private:
|
2008-04-22 08:41:37 +08:00
|
|
|
inT8 multiplicity;
|
|
|
|
inT8 colour;
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLLSYM GRAPHICS_BLOCK:public PAGE_BLOCK
|
|
|
|
//graphics block
|
|
|
|
{
|
|
|
|
public:
|
2008-04-22 08:41:37 +08:00
|
|
|
GRAPHICS_BLOCK() {
|
2007-03-08 04:03:40 +08:00
|
|
|
} //empty constructor
|
|
|
|
GRAPHICS_BLOCK (ICOORDELT_LIST * points,
|
2008-04-22 08:41:37 +08:00
|
|
|
BOOL8 backg[NUM_BACKGROUNDS], inT8 foreg);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void set_attrs (BOOL8 backg[NUM_BACKGROUNDS], inT8 foreg);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void show_attrs(DEBUG_WIN *debug);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
//serialise to ascii
|
|
|
|
make_serialise (GRAPHICS_BLOCK) void serialise_asc (
|
|
|
|
FILE * f);
|
|
|
|
void de_serialise_asc( //serialise from ascii
|
|
|
|
FILE *f);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BITS16 background;
|
2008-04-22 08:41:37 +08:00
|
|
|
inT8 foreground;
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLLSYM IMAGE_BLOCK:public PAGE_BLOCK
|
|
|
|
//image block
|
|
|
|
{
|
|
|
|
public:
|
2008-04-22 08:41:37 +08:00
|
|
|
IMAGE_BLOCK() {
|
2007-03-08 04:03:40 +08:00
|
|
|
} //empty constructor
|
2008-04-22 08:41:37 +08:00
|
|
|
IMAGE_BLOCK(ICOORDELT_LIST *points, inT8 colo, inT8 qual);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void set_attrs(inT8 colo, inT8 qual);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void show_attrs(DEBUG_WIN *debug);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
//serialise to ascii
|
|
|
|
make_serialise (IMAGE_BLOCK) void serialise_asc (
|
|
|
|
FILE * f);
|
|
|
|
void de_serialise_asc( //serialise from ascii
|
|
|
|
FILE *f);
|
|
|
|
|
|
|
|
private:
|
2008-04-22 08:41:37 +08:00
|
|
|
inT8 colour;
|
|
|
|
inT8 quality;
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLLSYM SCRIBBLE_BLOCK:public PAGE_BLOCK
|
|
|
|
//scribble block
|
|
|
|
{
|
|
|
|
public:
|
2008-04-22 08:41:37 +08:00
|
|
|
SCRIBBLE_BLOCK() {
|
2007-03-08 04:03:40 +08:00
|
|
|
} //empty constructor
|
|
|
|
SCRIBBLE_BLOCK (ICOORDELT_LIST * points,
|
2008-04-22 08:41:37 +08:00
|
|
|
BOOL8 backg[NUM_BACKGROUNDS], inT8 foreg);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void set_attrs (BOOL8 backg[NUM_BACKGROUNDS], inT8 foreg);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void show_attrs(DEBUG_WIN *debug);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
//serialise to ascii
|
|
|
|
make_serialise (SCRIBBLE_BLOCK) void serialise_asc (
|
|
|
|
FILE * f);
|
|
|
|
void de_serialise_asc( //serialise from ascii
|
|
|
|
FILE *f);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BITS16 background;
|
2008-04-22 08:41:37 +08:00
|
|
|
inT8 foreground;
|
2007-03-08 04:03:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLLSYM WEIRD_BLOCK:public PAGE_BLOCK
|
|
|
|
//weird block
|
|
|
|
{
|
|
|
|
public:
|
2008-04-22 08:41:37 +08:00
|
|
|
WEIRD_BLOCK() {
|
2007-03-08 04:03:40 +08:00
|
|
|
} //empty constructor
|
2008-04-22 08:41:37 +08:00
|
|
|
WEIRD_BLOCK(ICOORDELT_LIST *points, inT32 id_no);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void set_id(inT32 id_no);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void show_attrs(DEBUG_WIN *debug);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void set_id_no(inT32 new_id) {
|
2007-03-08 04:03:40 +08:00
|
|
|
id_number = new_id;
|
|
|
|
}
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void plot(ScrollView* window, ScrollView::Color colour);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
inT32 id_no() {
|
2007-03-08 04:03:40 +08:00
|
|
|
return id_number;
|
|
|
|
}
|
|
|
|
|
|
|
|
//serialise to ascii
|
|
|
|
make_serialise (WEIRD_BLOCK) void serialise_asc (
|
|
|
|
FILE * f);
|
|
|
|
void de_serialise_asc( //serialise from ascii
|
|
|
|
FILE *f);
|
|
|
|
|
|
|
|
private:
|
2008-04-22 08:41:37 +08:00
|
|
|
inT32 id_number; //unique id
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2008-04-22 08:41:37 +08:00
|
|
|
void print_background(DEBUG_WIN *f, BITS16 background);
|
2007-03-08 04:03:40 +08:00
|
|
|
#endif
|