/* * MathPlanner 3.2.0 - Mathematical design tool. * Copyright(C) 2003 Jarmo Nikkanen * * 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. * * You should have received a copy of the GNU General Public License with this program. * */ #ifndef _MATHPLANNER_OBJECT_STRING_H #define _MATHPLANNER_OBJECT_STRING_H #include "BaseStructures.h" #include "MathHeaders.h" #include "Extern.h" class m_base_object; class ApplicationControl; class m_function_object; class DataStorage; #define RANGE_LIST_SIZE 50 class string_object { private: int string_size; int list_size; bool overlimits; str_range selection; bool multible; bool required; math_node value; int fontsize; int margin,spacing; class m_base_object *Focused_object; struct index_obj *sub,*mid; struct index_obj *pre; struct list_entry *list; class m_base_object *assign_list[10]; layout_rect bounds; layout_rect old_bounds; int InsertMode; public: bool build_flag; bool Error_flag; int index; // index is read only class ApplicationControl *AppControl; class m_function_object *function; class m_base_object *parent; string_object(int no,class ApplicationControl *,class m_function_object *); string_object(class DataStorage *,class ApplicationControl *,class m_function_object *); ~string_object(); DataStorage *BuildStorage(); // Font setup int GetFontSize(int type=-1); void SetFontSize(int); QFont GetFont(int type); // Layout & calculate layout_rect Bounds(); // Update by calling CalculateBounds() void Draw(QPainter *); void CalculateBounds(); void MoveTo(QPoint); math_node Calculate(); void Build(); void ResetErrorFlags(); bool HasErrors(); void SetRequired(bool); // Focus control void UnFocusAll(); m_base_object *GetFocus(); void SetFocus(); bool HasFocus(); void FocusObject(m_base_object *); // Setup void SetFunctionObject(class m_function_object *); void SetBaseObject(class m_base_object *,int); void SetParent(class m_base_object *); class m_base_object *GetParent(); void KeyReceived(struct key_code); void MessageReceived(DataStorage *msg,int rec); void PostMessage(DataStorage *msg,int dest=TO_FRAME); m_base_object *GetLeftSideObject(m_base_object *); m_base_object *GetRightSideObject(m_base_object *); void AutoOperations(); void SendCall(int); void SetParenthesis(str_range ran); bool RequiresParenthesis(str_range ran); void RemoveFromString(int); void Cut(str_range,bool del=false); void GlobalCopy(); void GlobalPaste(); void CopySelection(DataStorage *); void CopyRange(str_range,DataStorage *); void PasteSelection(DataStorage *); void CopyAll(DataStorage *); bool IsEmpty(); bool IsLastObject(class m_base_object *); bool SelectObject(class m_base_object *); void SeekObject(QPoint p); void SetInsertMode(int); void DeleteMarked(); void MarkForDeletion(int index); void ChangeIndex(int); int ObjectTypeAt(int index); m_base_object *ObjectAt(int index); private: //QString ObjectName(int); //void StatusReport(); //void BugRange(str_range r,index_obj *s); void IndexChk(); void SyntaxChk(); void FocusObject(); void AllocateListSpace(int); void AllocateStringSpace(int); m_base_object *ConstructNewObject(DataStorage *msg); void DrawRQ(); void Reset(); void ResetTables(); void ResetSelection(); // Calculation int FindLast(index_obj *); int FindIndex(class m_base_object *); void PreProcess(str_range); math_node CalculateRange(str_range); void FindRanges(int ot,str_range r,str_range *rl,int *no); void CheckErrors(str_range); // List & string commands index_obj CreateObjectEntry(m_base_object *); void ObjectInput(m_base_object *,int side=1); void SetStringOperator(int,int); void MoveCursor(struct key_code); void RemoveFromList(class m_base_object *); int AddObject(class m_base_object *); // String void AddToSub(index_obj,int pos); void AddToPre(index_obj,int pos); void Clear(index_obj *,int); void ClearListIndex(int); void WriteToString(index_obj,int side=1); }; #endif