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


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
 File: project.cpp
 Desc: Main data structure for HBasic project.
 ----------------------------------------------------------------------------
	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.                                   *
 *                                                                         *
 ***************************************************************************/

/* ----------------------------------------------------------------------- */
/* Classlist: List of classes that will be defined in this source file.    */
/* ----------------------------------------------------------------------- */
/**
 * class CProject : Main data structure for HBasic projects.
 */

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

#ifndef PROJECT_H
#define PROJECT_H

#include 
#include 

#include "defines.h"
#include "structs.h"
#include "../source_editor/source_edit_data.h"
#include "../hbdata/hbobject.h"
#include "window_list.h"
#include "report_document.h"

/* Indentation modes for source files in project. */
#define PRJ_INDENT_NONE 0
#define PRJ_INDENT_SAME 1
#define PRJ_INDENT_CHECK 2

class CSheetEditor;
class HBQueryTable;
class HBSheet;
class HBSubList;
class CBasicDocument;
class HBDatabase;
class HBIcon;
class HBSqlStatement;
class HBQueryDesc;
class HBDesignConnect;
class HBDesignTable;

/** 
   The class CProject represents the data structures for one
   project in HBasic. 

   It holds all parts of the project like source files in substructures 
   and exports some common functions like saving and loding the project.
*/

class CProject : public QObject, public HBObject
{
	Q_OBJECT

public:
	/** 
            Create a new project with the number that should be 
            inserted into the name of the project. 
	*/

	CProject ( short project_number, char *name );
	~CProject( void );

	/** 
	   Create a new source code document for this project.  
	*/

	CBasicDocument *createNewSource( short new_source_type, short create_with_form, short range_type );

	/** 
	   Create a calculation sheet editor for this project.  
	*/

	void createNewCalcSheet( void );
	void editSheet( HBSheet *sheet_ptr );
	void createGlobalSource( void );
	int compileGlobalSource( void );

	/* ------------------------------------------------------ */
	/* Information about created initcode for DEBUG purposes. */

	char *code_start_forminit;
	long code_init_length;
	/* Type of indentation for sourcef code in project. */
	short indent_mode;
	/* number of blanks for each indent level. */
	short indent_blank;
	/* TRUE if MDI window should be used at runtime */
	short use_mdi_window;

	MENUTOOLBAR_DESC mtbar_desc;

	HBDatabase *getHBDatabase( void );

	void saveProject( QFile *f );
	void saveProjectAscii( QFile *f );
	void saveProjectForCompiler( QFile *f );

	void preparse_compute_classoffset( void );
	short preparse_create_formhead( void );

	short preparseAllModules( void );
	void createFormTypeDesc( void );
	void setEditFont( void );
	int get_number_of_forms( void );
	int compileAllModules( void );
	void comp_create_sub_description( void );
	void comp_create_class_description( void );
	void create_class_sub_info( CLASS_DESC *class_desc_ptr );
	void create_class_property_info( CLASS_DESC *class_desc_ptr );
	void create_class_localvar_info( CLASS_DESC *class_desc_ptr );
	void comp_create_class_desc2( CLASS_DESC *class_desc_ptr );
	void listMacros( QListView *lv_parent );
	CBasicDocument *findTopLevelWindow( short * );
	void saveCurrentLine( void );
	void redrawSourceWindows( void );

	void createSourceFromFile( QFile *save_file );
	short createModuleInit( void );
	void createGuiForFile( QFile *save_file );
	CBasicDocument *createNewClass( void );
	void adjustEventOffset( void );
	short findFormIdentifier( CBasicDocument *source_ptr, 
		FACT_DESC *expr_desc_ptr );
	short findVarnameInModule( CBasicDocument *form_desc_ptr, 
		FACT_DESC *expr_desc_ptr );
	short getPropertyParlist( SUB_DESC *first_parlist, FACT_DESC *fact_desc_ptr );
	short findClassProperty( CBasicDocument *source_desc_ptr, FACT_DESC *expr_desc_ptr);
	void closeAllFiles( void );
	/* Add database description to project. */
	void addDatabase( HBDatabase *new_db_desc );
	CBasicDocument *findErrorLine( unsigned char **error_line_ptr );
//	void assignEventAddress( void );
	void assignClassEventAddress( void );
	void co_create_rt_header( void );
	void saveProjectCode( QFile *code_file );
	void saveDatabaseDesign( QFile *f );
	void saveDatabaseQueries( QFile *f );
	void saveDbSqlStatements( QFile *f );
	CBasicDocument *findModuleName( void );
	void findSourcePosition( short show_source );
	void deleteQuery( QString *query_name );
	void deleteReport( QString *report_name );
	HBSheet *createNewSheet( void );
	void deleteSheet( HBSheet *sheet_ptr );
	void deleteIcon( HBIcon *icon_ptr );
	void deleteStmt( HBSqlStatement *stmt_ptr );
	void addSqlStatement( HBSqlStatement *stmt_ptr );
	void loadModule( QFile *f );
	void loadPictureEntry( QFile *f, FILE_TAG_HEADER *ptr );
	void loadSheetDescription( QFile *f, FILE_TAG_HEADER *start_block );
	void saveSheetDescription( QFile *f );
	void loadConnectList( QFile *f, FILE_TAG_HEADER *start_block, HBQueryDesc *query_desc_ptr );
	void freeParserStructures( void );
	void saveDatabaseDescription( QFile *f );
	void saveReportDescription( QFile *f );
	void loadReportDescription( QFile *f, FILE_TAG_HEADER *start_block );
	void loadDatabaseDescription( QFile *f, FILE_TAG_HEADER *ftag );
	void loadDatabaseDesign( QFile *f, FILE_TAG_HEADER *start_block );
	void loadDbStmtDescription( QFile *f, FILE_TAG_HEADER *start_block );
	void createDbTableForm( QString *table_name );
	void setChangedState( void );

private:
	void saveIconDescription( QFile *f );
	void createPictureDesc( void );
	void createDatabaseDesc( void );

	HBDatabase *findDbName( QString name );
	HBDbColumn *findDbTableColumn( HBQueryTable *table_desc, QString column_name );
	HBDbTable *findDbTable( QString table_name );
	HBDbColumn *getTableColumn( HBDbTable *table_ptr, QString *column_name );
	HBDbTable *getTableDesc( QString *table_name );
	void changeInheritedOffset( CLASS_DESC *class_desc_ptr, long offset );
	short getInheritedOffset( CLASS_DESC *class_desc_ptr );
	void clearSqlStatements( void );
	void clearIconList( void );
	void clearQueryList( void );
	void clearReportList( void );
	void clearSheetList( void );

	short next_source_number;    /* Next number for new source name */
	short next_class_number;    /* Next number for new class name */

public:
	QString prj_path;       /* File path for project file. */

	QString comp_path;	/* Path for compiler executable. */
	QString comp_name;	/* File name for compiler executable. */
	QString comp_options;   /* Compiler options. */

	short qtc_include;      /* Include support for qtc library? */
	short net_include;      /* Include support for dot.net programs? */

	int project_state_saved;  /* False if unsaved changes to projectdata. */

	CBasicDocument *current_source;
	QListViewItem *ptree_entry;    /* depending entry in project tree */
	QListViewItem *ptree_prj_forms;  /* folder for form entries in project tree */
	QListViewItem *ptree_prj_class;  /* folder for class entries in project tree */
	QListViewItem *ptree_prj_tables;  /* folder for table entries in project tree */
	QListViewItem *ptree_prj_queries;  /* folder for query entries in project tree */
	void setWidgetGeometry( QWidget *widget );

	/* Search for main function and create call if found */
	short initMainFunctionCall( void );

	/* ----------------------------------------- */
	/* Database that may be used in the project. */

	HBDatabase *project_db;
};

#endif


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