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
|
/* -*- C++ -*-
This file is part of ViPEC
Copyright (C) 1991-2001 Johan Rossouw (jrossouw@alcatel.altech.co.za)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as
published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <Types.h>
#include <FileBlock.h>
#include <Schematic.h>
#include <NewGraphWindow.h>
#include <GraphDefinition.h>
#include <SubstrateDefinition.h>
#include <SchematicSizeWindow.h>
#include <qmainwindow.h>
#include <qlist.h>
#include <qmap.h>
#include <qguardedptr.h>
class QDomElement;
class GridDefinition;
class SmithDefinition;
class TableDefinition;
class HelpWindow;
class QTranslator;
class TunerWindow;
class NewGraphWindow;
class ResultDefinition;
class MicroStripCalcWindow;
class SubstrateWindow;
class MainWindow: public QMainWindow
{
Q_OBJECT
public:
static MainWindow* instance();
virtual ~MainWindow();
void setTranslator( QTranslator* );
QTranslator* getTranslator();
const QString& getFilename() const;
void setActiveSchematic( const QString& name );
void getSchematicNames( QStringList& );
void changeSchematicSize( const QString& name );
void setSchematicSize( const QString& name, Schematic::SchematicSize newSize );
void setFileChanged();
void changeVariable( const QString& name );
void renameVariable( const QString& name );
void deleteVariable( const QString& name );
void updateVariable( const QString& name,
const QString& value );
TReal getVariableValue( const QString& name );
void renameSchematic( const QString& name );
void deleteSchematic( const QString& name );
Schematic* getSchematic( const QString& name );
void changeSubstrate( const QString& name );
void updateSubstrate( const QString& name,
const SubstrateDefinition& definition );
void renameSubstrate( const QString& name );
void deleteSubstrate( const QString& name );
SubstrateDefinition* getSubstrate( const QString& name );
void deleteDataFile( const QString& name );
QList<DataPoint>* getFileData( const QString& name );
bool confirm( const QString& message );
static long int getUniqueID();
void resetCircuits();
void calculateResponse();
//Interface to graphical output
GraphDefinition* findGraph( const QString& name );
void addGraph( const QString& name, NewGraphWindow::GraphType );
void renameGraph( const QString& name );
void deleteGraph( const QString& name );
GridDefinition* addGrid( const QString& name, const QString& title );
GridDefinition* findGrid( const QString& name );
SmithDefinition* addSmith( const QString& name, const QString& title );
SmithDefinition* findSmith( const QString& name );
TableDefinition* addTable( const QString& name, const QString& title );
TableDefinition* findTable( const QString& name );
public slots:
void quit();
void loadSlot();
void saveSlot();
void saveAsSlot();
void closeSlot();
void printSlot();
void helpSlot();
void aboutSlot();
void aboutQtSlot();
void newSchematicSlot();
void newVariableSlot();
void newGraphSlot();
void newSubstrateSlot();
void newDataFileSlot();
void graphFontChanged();
void microStripCalculator();
void tuner();
protected:
void closeEvent( QCloseEvent* e );
private:
MainWindow();
void createApplicationMenus();
void createMainToolbar();
void createSymbolToolbar();
void writeFile();
bool readFile();
bool closeFile();
bool readVariablesFromDOM( QDomElement& element );
bool readDimensionsFromDOM( QDomElement& element );
bool readSweepSettingsFromDOM( QDomElement& element );
bool readGraphDefinitionsFromDOM( QDomElement& element );
bool readSubstrateDefinitionsFromDOM( QDomElement& element );
bool readFileBlocksFromDOM( QDomElement& element );
bool checkSchematics();
void removeAllGraphs();
void showAllGraphs();
void computeAllGraphOutputs();
void renameGraph( const QString& oldName, const QString& newName );
void readFileBlock( const QString& name );
private:
static MainWindow* instance_;
static long int uniqueID_;
//Circuit file name
QString filename_;
bool fileChanged_;
//Sub circuit map
typedef QMap<QString, Schematic> SchematicMap;
SchematicMap schematicMap_;
//Variables map
typedef QMap<QString, QString> VariableMap;
VariableMap variableMap_;
//Substrate map
typedef QMap<QString, SubstrateDefinition> SubstrateMap;
SubstrateMap substrateMap_;
//File block map
typedef QMap<QString, FileBlock> FileBlockMap;
FileBlockMap fileBlockMap_;
//Help browser
QGuardedPtr<HelpWindow> helpWindow_;
//windows
QList<GraphDefinition> graphs_;
QGuardedPtr<TunerWindow> tunerWindow_;
QGuardedPtr<NewGraphWindow> newGraphWindow_;
QGuardedPtr<MicroStripCalcWindow> microStripCalculator_;
QGuardedPtr<SubstrateWindow> substrateWindow_;
QGuardedPtr<SchematicSizeWindow> schematicSizeWindow_;
//Translator object
QTranslator* translator_;
};
#endif
|