00001 /*************************************************************************** 00002 * Copyright (C) 2005 by David Saxton * 00003 * david@bluehaze.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #ifndef DOCUMENTIFACE_H 00012 #define DOCUMENTIFACE_H 00013 00014 #include "config.h" 00015 00016 #include <dcopobject.h> 00017 #include <dcopref.h> 00018 00019 class CircuitDocument; 00020 class Document; 00021 class FlowCodeDocument; 00022 class ICNDocument; 00023 class ItemDocument; 00024 class MechanicsDocument; 00025 class TextDocument; 00026 class View; 00027 00028 // TODO: should probably be split up and placed in proper subdirectories. 00029 00033 class DocumentIface : public DCOPObject 00034 { 00035 K_DCOP 00036 00037 public: 00038 DocumentIface( Document * document ); 00039 virtual ~DocumentIface(); 00040 00041 k_dcop: 00042 QString caption() const; 00043 DCOPRef activeView(); 00044 uint numberOfViews(); 00045 // View *createView( ViewContainer *viewContainer, uint viewAreaId, const char *name = 0 ); 00046 QString url(); 00047 bool openURL( const QString & url ); 00048 bool isModified(); 00049 bool isUndoAvailable(); 00050 bool isRedoAvailable(); 00051 void save(); 00052 void saveAs(); 00053 bool close(); 00054 void print(); 00055 void cut(); 00056 void copy(); 00057 void paste(); 00058 void undo(); 00059 void redo(); 00060 void selectAll(); 00061 00062 protected: 00063 DCOPRef viewToRef( View * view ); 00064 00065 Document * m_pDocument; 00066 }; 00067 00068 class TextDocumentIface : public DocumentIface 00069 { 00070 K_DCOP 00071 00072 public: 00073 TextDocumentIface( TextDocument * document ); 00074 00075 k_dcop: 00076 void formatAssembly(); 00077 void convertToMicrobe(); 00078 void convertToHex(); 00079 void convertToPIC(); 00080 void convertToAssembly(); 00081 void clearBookmarks(); 00082 bool isDebugging(); 00083 void debugRun(); 00084 void debugInterrupt(); 00085 void debugStop(); 00086 void debugStep(); 00087 void debugStepOver(); 00088 void debugStepOut(); 00089 00090 protected: 00091 TextDocument * m_pTextDocument; 00092 }; 00093 00094 class ItemDocumentIface : public DocumentIface 00095 { 00096 K_DCOP 00097 00098 public: 00099 ItemDocumentIface( ItemDocument * document ); 00100 00101 k_dcop: 00102 QCStringList validItemIDs(); 00108 QString addItem( const QString & id, int x, int y ); 00109 void selectItem( const QString & id ); 00110 void unselectItem( const QString & id ); 00111 void clearHistory(); 00112 void unselectAll(); 00113 void alignHorizontally(); 00114 void alignVertically(); 00115 void distributeHorizontally(); 00116 void distributeVertically(); 00117 void deleteSelection(); 00118 00119 protected: 00120 ItemDocument * m_pItemDocument; 00121 }; 00122 00123 class MechanicsDocumentIface : public ItemDocumentIface 00124 { 00125 K_DCOP 00126 00127 public: 00128 MechanicsDocumentIface( MechanicsDocument * document ); 00129 00130 protected: 00131 MechanicsDocument * m_pMechanicsDocument; 00132 }; 00133 00134 class ICNDocumentIface : public ItemDocumentIface 00135 { 00136 K_DCOP 00137 00138 public: 00139 ICNDocumentIface( ICNDocument * document ); 00140 00141 k_dcop: 00142 void exportToImage(); 00143 QCStringList nodeIDs( const QString & id ); 00147 QString makeConnection( const QString & item1, const QString & node1, const QString & item2, const QString & node2 ); 00148 void selectConnector( const QString & id ); 00149 void unselectConnector( const QString & id ); 00150 00151 protected: 00152 ICNDocument * m_pICNDocument; 00153 }; 00154 00155 class CircuitDocumentIface : public ICNDocumentIface 00156 { 00157 K_DCOP 00158 00159 public: 00160 CircuitDocumentIface( CircuitDocument * document ); 00161 00162 k_dcop: 00163 void setOrientation0(); 00164 void setOrientation90(); 00165 void setOrientation180(); 00166 void setOrientation270(); 00167 void rotateCounterClockwise(); 00168 void rotateClockwise(); 00169 void flip(); 00170 void displayEquations(); 00171 void createSubcircuit(); 00172 00173 protected: 00174 CircuitDocument * m_pCircuitDocument; 00175 }; 00176 00177 class FlowCodeDocumentIface : public ICNDocumentIface 00178 { 00179 K_DCOP 00180 00181 public: 00182 FlowCodeDocumentIface( FlowCodeDocument * document ); 00183 void convertToMicrobe(); 00184 void convertToHex(); 00185 void convertToPIC(); 00186 void convertToAssembly(); 00187 00188 k_dcop: 00189 void setPicType( const QString & id ); 00190 00191 protected: 00192 FlowCodeDocument * m_pFlowCodeDocument; 00193 }; 00194 00195 #endif
1.5.1