Source: /app/hbasic/hbasic/src/basic_document.h


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
 File: basic_document.h
 Desc: Base file to manage data of one source document (including GUI).
 ----------------------------------------------------------------------------
	copyright            : (C) 2001 HBasic project (Marcus Engels)
 ***************************************************************************/

/* **************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

/**
  The class CBasicDocument holds the data used for the sourcecode and gui
  structures for one module of your HBasic project. This may be a form or
  class definition.
*/

/* ----------------------------------------------------------------------- */
/* Classlist: List of classes that will be defined in this source file.    */
/* ----------------------------------------------------------------------- */

/* ----------------------------------------------------------------------- */
/* Changelog: Description of important changes within this file.           */
/*            Please report with date, maintainer and change description.  */
/* ----------------------------------------------------------------------- */

#ifndef SOURCEFILE_H
#define SOURCEFILE_H

class CBasicDocument;
class CWindowListChild;
class CProject;
class CSourceEditWidget;
class CSourceEditData;
class CFormDescData;
class FormDesigner;

#include 
#include 
#include 
#include 
#include 

#include "defines.h"
#include "structs.h"
#include "../hbdata/hbobject.h"
#include "../source_editor/source_edit_widget.h"

class CBasicDocument : public QObject, public HBObject
{
	Q_OBJECT

public:
	/* type of this source entry see STYPE_* in defines.h */
	short form_number;          /* unique form id. */
	short form_type;
	long sz_local_var;          // size of memory for local variables
	CSourceEditData *source_block;  // pointer to source file data
	CFormDescData *form_desc;     /* Form description */

	/* Parser results for this form */
	long localvar_offset;    /* current offset for local variables */
	VAR_DESC *first_formlocal_var;   /* local variable list */
	SUB_DESC *first_formlocal_sub;   /* function list */
	SUB_DESC *first_sub_parse_order;   /* function list in parsing order */
	SUB_DESC *last_sub_parse_order;   /* function list in parsing order */
					/* Used for appending to currrent list. */
	MACRO_DESC *first_macro_desc;   /* Strart of list of defined macros */

	QString src_path;         /* save path to store the file */
	CSourceEditWidget *src_editor_window;
	FormDesigner *gui_editor_window;  /* NULL if no gui exists. */
	CProject *doc_project;   /* matching project for this document. */

	char *runtime_code_start;  /* Start of runtime code (DEBUG) */
	long runtime_code_length;  /* Length of generated code (DEBUG) */
	char *event_start;	/* Start of event description for this form. DEBUG */
	long event_length;	/* Length of event description for this form. DEBUG */
	short init_label;       /* Label number for init_code */
	short exit_label;       /* label number for exit code */
	short parser_state;     /* 1= module preread / 2 = module parsed  */

	/* If this module inherits another module */
	/* this is the pointer to the inherited module. */
	/* This pointer is only valid at parsetime. */
	CBasicDocument *inh_module;

private:
	long selected_gui_offset;  // offset for current selected gui
	short comp_number;         // number for component name

	/* Variables for edit operations. */
	QRegExp find_expr;

private:
	CLASS_DESC *findClassName( CLASS_DESC *class_desc_ptr );
	void loadPropertyValues( QFile *f, GUI_HEADER *comp_ptr );
	
public:
	CBasicDocument( CProject *my_project, short source_type, short range_type,
		short source_number, short create_with_form );
	~CBasicDocument( void );

	void initSourceEditor( void );
	GUI_HEADER *createNewComp( QWidget *parent, short pckg_number,
	short comp_pos );
	void dropFormGui( void );
	void saveSourceToFile( QFile *f );
	void create_sub_address_ptr( void );
	unsigned char *findRtErrorLine( void );
	void saveCurrentEditLine( void );
	unsigned char *insertSourceLine( unsigned char *new_line );
	int createModuleGuiDesc( int form_number );
	int createGuiEventDesc(void);

	/**
	 * Create a new form GUI as a component.
	 */
	 
	void createFormComponent( void );
	void create_sub_description( void );
	short compileModule( void );
	void appendSourceLine( QFile *f, FILE_TAG_HEADER *file_info );
	void loadActionMenuToolbar( QFile *f, MENUTOOLBAR_DESC *mtbar_desc );
	long getFormRTSize( GUI_HEADER *comp_ptr );
	void loadSourceLines( QDomElement *docElem );
	void loadGuiDesc( QDomElement *docElem, GUI_HEADER *parent_gui_ptr );
	void loadSourceCode( QDomElement *docElem );
	void loadGuiComponent( QFile *f, FILE_TAG_HEADER *start_block );
	void loadFormComponent( QFile *f );
	short createFormInitcode( void );
	void createGeometryProperty( GUI_HEADER *gui_desc_ptr, QWidget *wgt );
	void redrawGuiStructure( void );
	void assignEventAddress( void );
	void storeCurrentLine( bool with_preparse );
	void printDocument( void );
	void assignClassEvent( void );
	short find_user_sub( void );
	void setGuiDesignerProperty( QString *prop_name, QVariant *new_value );
	short findNext( void );
	GUI_HEADER *skipGuiChildren( GUI_HEADER *parent );
	GUI_HEADER *findParentComp( GUI_HEADER *parent_guiptr, QWidget *par_wgt );
	CSourceEditWidget *sourceEditWidget( void );
	int findString( void );
	short replaceString( void );
	void closeGuiWindow( void );
	void closeSourceWindow( void );
	void openSourceWindow( void );
	void openGuiWindow( void );
	short isFormWidget( QWidget *widget );
	long insertPropValue( char *desc_ptr, QWidget *wgt, 
	short prop_type, char *name_ptr);
	void setWindowProperties( QDomElement *docElem, 
	CWindowListChild *win_ptr );
	void saveGuiStructure( QFile *f, GUI_HEADER *parent_comp_ptr );
	void saveCompProperties( QFile *f, GUI_HEADER *comp_ptr );
	void load( QFile *f );
	void saveGeneratedCode( QFile *code_file );
	QVariant *loadPropertyValue( QFile *f );

	short findCompName( FACT_DESC *expr_desc_ptr, GUI_HEADER *start_comp );
	short getPropertyType( QMetaObject *qm, char *prop_name);
	void removeComp( GUI_HEADER *start_comp );
	void setWidgetGeometry( QWidget *widget );

	short replace_string( QRegExp *find_expr, char *replace_str, 
		char *line_str, int replace_all );
	void join_two_lines( int direction );
	void editCursorLeft( void );
	void editLineUp( void );
	void editKeyReturn( void );
	int iskeyword( char *start);
	void freeFormDesc( void );
	short findActionEventName( char *nameptr );

	/* Find or create event handler for event description in sourcecode. */
	void findEventSource( char *widget_name, SOCOMP_HEADER *pckg_ptr );
	int prepareCompile( void );
	void resetComponentSignals( void );
	short isModuleSub( QWidget *parent, int text_line_height, CSourceEditWidget *manager );
	void listMacros( QListView *lv_parent );
};

#endif


Generated by: root on linux on Sun Jul 13 18:06:35 2003, using kdoc 2.0a54.