1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842
|
/*
* This file is part of XForms.
*
* XForms is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1, or
* (at your option) any later version.
*
* XForms is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with XForms. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file fd_main.h
*
* This file is the header file used in the Form Designer
*/
#ifndef FD_MAIN_H_
#define FD_MAIN_H_
#include <stdio.h>
#include "include/forms.h"
#include "flinternal.h"
#ifndef FALSE
#define FALSE 0
#define TRUE ( ! FALSE )
#endif
/* since MAGIC4 all coordinates are relative to the top-left */
#define MAGIC2 12321
#define MAGIC3 12322
#define MAGIC4 13000
#define MAGIC5 14000 /* since XForms 1.0.92 */
#define MAGIC6 15000 /* since XForms 1.0.94pre4 */
/* general limits */
#define MAX_CLASS_NAME_LEN 64 /* FL_BUTTON etc. */
#define MAX_TYPE_NAME_LEN 64 /* FL_RADIO_BUTTON etc */
#define MAX_VAR_LEN 128 /* max. length of a variable/function */
/* various options of the program */
typedef struct {
int language;
int emit_code; /* if emit UI code */
int emit_main;
int emit_cb;
int lax;
int altformat;
int conv_only;
int show_pallete;
int compensate; /* if emit font size compensation code */
int unit;
char * output_dir;
} FD_Opt;
enum {
FD_C = 1,
FD_ADA95,
FD_PERL,
FD_PASCAL,
FD_PYTHON,
FD_FORTRAN,
FD_PS,
FD_SCM,
FD_EXP
};
/* We use different file selector for different tasks */
enum {
SAVE_FSELECTOR,
LOAD_FSELECTOR,
XPM_FSELECTOR
};
#define MAX_CONVERTOR ( FD_EXP + 1 )
/* Structure that will hole all forms created */
typedef struct {
FL_FORM * form; /* The form */
char fname[ MAX_VAR_LEN ]; /* Its name */
} FRM;
typedef struct {
const char * lang_name;
int ( * convert )( const char *,
FRM *,
int ); /* built-in convertor */
const char * extern_convertor; /* the converter itself */
const char * contact_info; /* who to contact in case of error */
int need_c_code; /* if translator works on C or .fd file */
void ( * init )( void ); /* additional initialization */
} Conv;
extern Conv convertor[ ];
extern FD_Opt fdopt;
#define ShiftIsDown( mask ) ( mask & ShiftMask )
/******** in fd_main.c *********/
extern long main_window; /* The identifier of the main window */
extern FL_Coord winw,
winh;
extern int changed; /* Whether the file has changed. */
extern char main_name[ ]; /* Main creation routine name */
/******** in fd_rubber.c *********/
/* Contains routines for drawing rubberband boxes. */
void set_step_size( double ); /* sets the stepsize */
double get_step_size( void ); /* returns the stepsize */
/* Sets the bounding box in which the drawing occurs */
void set_bounding_box( double,
double,
double,
double );
/* returns the position of the mouse in world coordinates */
void get_mouse_pos( double *,
double * );
/* drag a box around until the user releases a mouse button */
void move_box( double *,
double *,
double *,
double *,
int );
/* scales a box until the user releases a left mouse button */
void scale_box( double *,
double *,
double *,
double * );
/******** in fd_select.c *********/
/* Contains the routines that deal with the maintenance of the
current selection of objects */
int is_selected( FL_OBJECT * ); /* Returns whether the object is
selected. */
void addto_selection( FL_OBJECT * ); /* Adds an object to a
selection */
void addgroupto_selection( FL_OBJECT * ); /* Adds a group of objects
to a selection */
void deletefrom_selection( FL_OBJECT * ); /* Deletes an object from a
selection */
void clear_selection( void ); /* Clears the current selection */
void resize_selection( FL_Coord,
FL_Coord );
void move_selection( FL_Coord,
FL_Coord );
void deletegroupfrom_selection( FL_OBJECT * ); /* Deletes a group of objects
from a selection */
void draw_selbox( void ); /* Draws the box around the selected objects */
void handle_select( const XEvent * ); /* Change the selection when
user puhed mouse. */
void handle_move( const XEvent * ); /* Moves or scales the
selection. */
void select_all( void ); /* Selects all objectsin the form */
void change_selection( void ); /* Changes the atributes of the
selection */
void align_selection( int ); /* Aligns the objects in the
selection */
void show_selection( void ); /* Makes the selection visible. */
void hide_selection( void ); /* Makes the selection invisible. */
void raise_selection( void ); /* Raises the selection */
void lower_selection( void ); /* Lower the selection */
void cut_selection( void ); /* Deletes all objects in the
selection */
void paste_selection( void ); /* Puts elements from buffer into
form */
void copy_selection( void ); /* Copies objects in selection to
buffer */
FL_OBJECT **dup_selection( void );
void set_selection( FL_OBJECT ** );
void free_dupped_selection( FL_OBJECT ** );
void next_selection( void );
void prev_selection( void );
void group_selection( void ); /* Turns objects in the selection
into a group. */
void flatten_selection( void ); /* Removes begin and end groups from
the selection. */
/******** in fd_attribs.c **********/
/* Contains routines to set and change attributes of objects. */
int change_object( FL_OBJECT *, /* changes the settings for object */
int );
void change_type( FL_OBJECT *, /* Changes the type of a particular object. */
int);
void set_label( FL_OBJECT *, /* Sets the object label (interpreting \n's). */
const char * );
void set_shortcut( FL_OBJECT *,
const char * );
char *get_label( const FL_OBJECT *, /* Returns object label */
int); /* (turning NL's into \n's). */
char *get_shortcut_string( const FL_OBJECT * );
/******** in fl_file_fun.c ********/
#define FF_READ_FAILURE -1
#define FF_AT_END_OF_FILE 0
#define FF_AT_START_OF_FORM 1
#define FF_AT_START_OF_OBJECT 2
int ff_get_fd_file( const char *,
int );
char *ff_get_filename_copy( void );
int ff_read( const char *,
... );
void ff_close( void );
int ff_err( const char * );
/******** in fl_file.c ********/
/* Contains all routines that deal with saving and loading forms. */
int read_form( void );
void write_form( FILE *,
FL_FORM *,
char[ ] );
/******** in fl_print.c ********/
/* Contains all routines that deal with printing forms in C format. */
void print_form( FILE *,
FL_FORM *,
const char * );
void print_callbacks_and_globals( FILE *,
FL_FORM *,
int );
/* For making the header file */
void print_header( FILE *,
FL_FORM *,
const char * );
void output_main( FILE *,
FRM *,
int );
void output_callbacks( FILE *,
FRM *,
int );
/******** in fd_forms.c *********/
/* Contains the routines that maintain the collection of forms. */
extern FL_FORM *cur_form;
const char * get_form_name( FL_FORM * form );
/* The current form under construction */
void redraw_the_form( int );
/* Redraws the current form. The argument indicates whether the background
should be redrawn. */
void reshape_form_background( FL_Coord,
FL_Coord );
/* loads the forms from a file */
int load_forms( int,
const char * );
int save_forms( const char * );
/* saves the forms to a file, returns whether actually saved */
/******** fd_groups.c *********/
/* Contains the routines that deal with groups. */
/* Fills in the groups in the current form. */
void fillin_groups( void );
/******** fd_names.c **********/
/* Routines that keep track of the object names */
void get_object_name( const FL_OBJECT *,
char *,
char *,
char * );
void set_object_name( FL_OBJECT *,
const char *,
const char *,
const char * );
const char * get_object_c_name( FL_OBJECT * obj );
/******** fd_objects.c *********/
/* Contains the different object classes and types. */
#define MAXCLASSES 60 /* Max. number of object classes handled */
#define MAXTYPES 24 /* Max. number of types per class. */
/* Maximal number of object classes. */
/* The current class of object to be added */
extern int cur_class;
/* Initializes all the classes and types. */
void init_classes( void );
/* adds an object to the current form */
FL_OBJECT * add_an_object( int,
int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord );
/* Returns a pointer to the name of the class */
char *find_class_name( int );
char * find_class_name( int );
/* Returns the number of types in the class */
int find_class_maxtype( int );
/* Returns the default object in the class */
FL_OBJECT * find_class_default( int,
int );
/* Returns a pointer to the name of the type in the class */
const char *find_type_name( int,
int );
int find_type_value( int,
const char * );
extern unsigned long fd_red,
fd_black,
fd_white,
fd_col;
extern int fd_magic;
extern int fd_border;
extern int fd_trackgeometry,
fd_buttonLabelSize,
fd_testborder;
void color( unsigned long );
int getbutton( int );
void fd_clear( int,
int,
int,
int );
void rect( FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord );
void rectf( FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord );
int fl_qtest( void );
/* attribute query routines */
char * class_name( int );
int class_val( const char * );
char * gravity_name( int );
int gravity_val( const char * );
char * resize_name( int );
int resize_val( const char * );
char * style_name( int );
int style_val( const char * );
const char * align_name( int,
int );
int align_val( const char * );
char * lsize_name( int );
int lsize_val( const char * );
char * boxtype_name( int );
int boxtype_val( const char * );
extern char * loadedfile;
extern char *loadedfile_fullpath;
typedef struct {
int val; /* value */
char * name; /* formal name */
char * shown; /* name shown */
char * hotkey; /* hotkeys */
} VN_pair;
char * get_vn_name( VN_pair *,
int );
int get_vn_val( VN_pair *,
const char * );
extern VN_pair vn_btype[ ];
extern VN_pair vn_gravity[ ];
extern VN_pair vn_align[ ];
extern VN_pair vn_resize[ ];
extern int fd_align_fontsize,
fd_type_fontsize;
extern int fd_convert,
fd_show_palette;
const char * get_fd_name( const char * );
extern int fd_bwidth;
char * unit_name( int );
int unit_val( const char * );
int convert_u( int );
double get_conversion_factor( void );
extern char xform_header[ ];
extern char glcanvas_header[ ];
void show_geometry( int,
int,
int,
int );
void show_selmessage( FL_OBJECT *[ ],
int );
enum {
FD_LEFT = 1,
FD_HCENTER = 2,
FD_RIGHT = 3,
FD_HEQUAL = 4,
FD_BOTTOM = 5,
FD_VCENTER = 6,
FD_TOP = 7,
FD_VEQUAL = 8
};
enum {
HELP_VERSION,
HELP_GENERAL,
HELP_MOUSE,
HELP_KEYBOARD,
HELP_GROUP,
HELP_TEST,
HELP_SAVE
};
extern FL_FORM * thetestform;
FL_OBJECT * fl_create_simu_canvas( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char * );
FL_OBJECT * fl_add_simu_canvas( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char * );
FL_OBJECT * fl_create_simu_glcanvas( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char * );
FL_OBJECT * fl_add_simu_glcanvas( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char * );
/* Object class specific info handler */
void save_objclass_spec_info( FILE *,
FL_OBJECT * );
int load_objclass_spec_info( FL_OBJECT *,
char *);
void emit_objclass_spec_info( FILE *,
FL_OBJECT * );
void emit_objclass_spec_header( FILE *,
FL_OBJECT * );
void emit_objclass_spec_global( FILE *,
FL_OBJECT * );
void set_objclass_spec_attributes( FL_OBJECT *,
long );
void obj_spec_reread( FL_OBJECT * obj );
void obj_spec_apply( FL_OBJECT * obj );
void obj_spec_restore( FL_OBJECT * obj );
int has_class_spec_info( FL_OBJECT * );
void modify_attrib_basic_color( FL_COLOR,
FL_COLOR );
/* Control panel etc */
#include "fd/ui_theforms.h"
#include "fd/ui_attrib.h"
extern FD_control *fd_control;
extern FD_attrib *fd_attrib;
extern FD_generic_attrib *fd_generic_attrib;
extern FD_test * fd_test;
extern FD_align * fd_align;
extern FD_resize * fd_resize;
extern FD_helpform * fd_help;
void loadforms_cb( FL_OBJECT *,
long );
void saveforms_cb( FL_OBJECT *,
long );
void saveforms_as_cb( FL_OBJECT *,
long );
void mergeforms_cb( FL_OBJECT *,
long );
void exit_cb( FL_OBJECT *,
long );
void changegroupname_cb( FL_OBJECT *,
long );
void mainname_cb( FL_OBJECT *,
long );
void create_the_forms( void );
void control_init( FD_control * );
extern FL_FORM *thetestform;
int within_selection( double,
double );
extern int no_selection;
int C_output( const char *,
FRM *,
int );
extern int is_pasting;
void init_align( void );
void cleanup_spec( FL_OBJECT * );
/* fake stuff */
#define FL_NTABFOLDER 50
FL_OBJECT *fl_add_ntabfolder( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char *);
FL_OBJECT *fl_create_ntabfolder( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char * );
FL_OBJECT *fl_add_nformbrowser( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char * );
FL_OBJECT *fl_create_nformbrowser( int,
FL_Coord,
FL_Coord,
FL_Coord,
FL_Coord,
const char * );
void make_backup( const char * );
int is_var_boxtype( int cn );
void set_testing_pixmap( FL_OBJECT * );
void set_testing_bitmap( FL_OBJECT * ob );
void set_snap_size( int,
int );
int get_snap_size( void );
void show_pallette( void );
void hide_pallette( void );
void reset_pallette_menu_status( void );
void select_pallette_entry( int );
void reset_pallette( void );
typedef struct {
double min,
max,
xmin,
xmax,
ymin,
ymax;
double val,
xval,
yval;
double step,
sstep,
lstep,
xstep,
ystep;
double slsize;
double thetai,
thetaf;
double ldelta,
rdelta;
double dval,
dmin,
dmax,
dstep;
int prec;
int direction;
int mbuttons;
int int_val;
int align;
int dx,
dy;
int show_focus;
int h_pref,
v_pref;
int nlines;
int xmajor,
xminor;
int ymajor,
yminor;
int xscale,
yscale;
float xbase,
ybase;
int xgrid,
ygrid;
char ** content;
char ** shortcut;
char ** callback;
unsigned char * mode;
int new_menuapi;
int global_scope;
int showsymbol;
char * misc_char;
int grid_linestyle;
int no_title;
int mark_active;
int * mval;
int orient;
} SuperSPEC;
SuperSPEC * get_superspec( FL_OBJECT * );
SuperSPEC * spec_to_superspec( FL_OBJECT * );
void * superspec_to_spec( FL_OBJECT * );
void copy_superspec( FL_OBJECT * dest,
FL_OBJECT * src );
void free_superspec( FL_OBJECT * obj );
#define ISBUTTON( cls ) ( ( cls ) == FL_BUTTON \
|| ( cls ) == FL_LIGHTBUTTON \
|| ( cls ) == FL_CHECKBUTTON \
|| ( cls ) == FL_ROUNDBUTTON \
|| ( cls ) == FL_ROUND3DBUTTON \
|| ( cls ) == FL_PIXMAPBUTTON \
|| ( cls ) == FL_BITMAPBUTTON \
|| ( cls ) == FL_SCROLLBUTTON \
|| ( cls ) == FL_LABELBUTTON )
#define ISCHOICE( cls ) ( ( cls ) == FL_CHOICE \
|| ( cls ) == FL_MENU \
|| ( cls ) == FL_BROWSER )
void select_object_by_class( int );
char * append_fd_suffix( const char * );
const char * get_placement( FL_FORM * );
unsigned int
check_resize( unsigned int what,
int nw,
int se );
void reset_dupinfo_cache( void );
int is_duplicate_info( const char * );
char * rel2abs( const char * rel_path );
int is_valid_c_name( const char * str );
void setup_how_return_menu( FL_OBJECT * );
void reset_how_return_menu( FL_OBJECT *,
unsigned int );
void handle_how_return_changes( FL_OBJECT *,
FL_OBJECT * );
int get_how_return_val( const char * );
const char * get_how_return_name( unsigned int,
int );
const char * file_tail( const char * );
void reset_object_list( void );
void addform_cb( FL_OBJECT *,
long );
void deleteform_cb( FL_OBJECT *,
long );
void changename_cb( FL_OBJECT *,
long );
void changesize_cb( FL_OBJECT *,
long );
#endif /* FD_MAIN_H */
/*
* Local variables:
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
|