My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qucsdoc.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qucsdoc.cpp
3  -------------
4  begin : Wed Sep 3 2003
5  copyright : (C) 2003, 2004 by Michael Margraf
6  email : michael.margraf@alumni.tu-berlin.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 
22 #include <qfileinfo.h>
23 
24 #include "qucsdoc.h"
25 #include "qucs.h"
26 
27 // icon for unsaved files (diskette)
28 const char *smallsave_xpm[] = {
29 "16 17 66 1", " c None",
30 ". c #595963","+ c #E6E6F1","@ c #465460","# c #FEFEFF",
31 "$ c #DEDEEE","% c #43535F","& c #D1D1E6","* c #5E5E66",
32 "= c #FFFFFF","- c #C5C5DF","; c #FCF8F9","> c #BDBDDA",
33 ", c #BFBFDC","' c #C4C4DF",") c #FBF7F7","! c #D6D6E9",
34 "~ c #CBCBE3","{ c #B5B5D6","] c #BCBCDA","^ c #C6C6E0",
35 "/ c #CFCFE5","( c #CEC9DC","_ c #D8D8EA",": c #DADAEB",
36 "< c #313134","[ c #807FB3","} c #AEAED1","| c #B7B7D7",
37 "1 c #E2E2EF","2 c #9393C0","3 c #E3E3F0","4 c #DDD5E1",
38 "5 c #E8E8F3","6 c #2F2F31","7 c #7B7BAF","8 c #8383B5",
39 "9 c #151518","0 c #000000","a c #C0C0DC","b c #8E8FBD",
40 "c c #8989BA","d c #E7EEF6","e c #282829","f c #6867A1",
41 "g c #7373A9","h c #A7A7CD","i c #8080B3","j c #7B7CB0",
42 "k c #7070A8","l c #6D6DA5","m c #6E6EA6","n c #6969A2",
43 "o c #7A79AF","p c #DCDCEC","q c #60609A","r c #7777AC",
44 "s c #5D5D98","t c #7676AB","u c #484785","v c #575793",
45 "w c #50506A","x c #8787B8","y c #53536E","z c #07070E",
46 "A c #666688",
47 " . ",
48 " .+. ",
49 " .+@#. ",
50 " .$%###. ",
51 " .&*####=. ",
52 " .-.#;#####. ",
53 " .>,'.#)!!!!~. ",
54 " .{].'^./(!_:<[.",
55 ".}|.1./2.3456789",
56 "0a.$11.bc.defg9 ",
57 " 011h11.ij9kl9 ",
58 " 0_1h1h.mno9 ",
59 " 0p12h9qr9 ",
60 " 0hh9st9 ",
61 " 09uv9w ",
62 " 0x9y ",
63 " zA "};
64 
65 const char *empty_xpm[] = { // provides same height than "smallsave_xpm"
66 "1 17 1 1", " c None", " ", " ", " ", " ", " ",
67 " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "};
68 
69 
70 QucsDoc::QucsDoc(QucsApp *App_, const QString& Name_)
71 {
72  App = App_;
73 
74  GridOn = true;
75  DocName = Name_;
76  QFileInfo Info(DocName);
77  if(!DocName.isEmpty()) {
78  DocName = Info.absFilePath();
79  QString base = Info.baseName(true);
80  QString ext = Info.extension(false);
81 
82  if(ext == "m" || ext == "oct")
83  SimTime = "1";
84 
85  DataSet = base + ".dat"; // name of the default dataset
86  Script = base + ".m"; // name of the default script
87  if(ext != "dpl")
88  DataDisplay = base + ".dpl"; // name of default data display
89  else {
90  DataDisplay = base + ".sch"; // name of default schematic
91  GridOn = false; // data display without grid (per default)
92  }
93  }
94  SimOpenDpl = true;
95  SimRunScript = false;
96 
97  DocChanged = false;
98  showBias = -1; // don't show DC bias (currently for "Schematic" only)
99  Scale = 1.0;
100 }
101 
102 QString QucsDoc::fileSuffix (const QString& Name) {
103  QFileInfo Info (Name);
104  return Info.extension (false);
105 }
106 
107 QString QucsDoc::fileSuffix (void) {
108  return fileSuffix (DocName);
109 }
110 
111 QString QucsDoc::fileBase (const QString& Name) {
112  QFileInfo Info (Name);
113  return Info.baseName (true);
114 }
115 
116 QString QucsDoc::fileBase (void) {
117  return fileBase (DocName);
118 }
119