From: Shamus Hammons Date: Mon, 2 Aug 2010 00:48:56 +0000 (+0000) Subject: Added missing readme and GPL license file. X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5374cdbb127a1bced9a65abeb30b1ef4eb5e35a7;p=architektonas Added missing readme and GPL license file. --- diff --git a/GPLv2 b/GPLv2 new file mode 100644 index 0000000..960fe74 --- /dev/null +++ b/GPLv2 @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/Makefile b/Makefile index 60003db..ce3a75b 100644 --- a/Makefile +++ b/Makefile @@ -51,8 +51,8 @@ clean: statistics: @echo -n "Lines in source files: " - @-$(FIND) -name *.cpp | xargs cat | wc -l + @-$(FIND) ./src -name "*.cpp" | xargs cat | wc -l @echo -n "Lines in header files: " - @-$(FIND) -name *.h | xargs cat | wc -l + @-$(FIND) ./src -name "*.h" | xargs cat | wc -l dist: clean diff --git a/README b/README new file mode 100644 index 0000000..144c76d --- /dev/null +++ b/README @@ -0,0 +1,64 @@ +@-~ Copyright and Licensing ~-@ + +Architektonas: Free Cross Platform CAD software +Copyright (C) 2010 Underground Software. +Portions copyright (C) 2001-2003 RibbonSoft. +Trademarks used are the property of their respective owners. + +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. + +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 General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 51 Franklin +Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +@-~ History ~-@ + +Architektonas was started by James Hammons as a fork of QCad Community Edition +2.0.5.0 which was released under the GPLv2 by Andrew Mustun of RibbonSoft. The +author started working on a porting effort of the CE codebase from Qt 3 to Qt 4 +for a couple of reasons: First, QCad CE had been stagnant for quite a long time +(not surprising, as it is likely that Mr. Mustun was holding off on releasing +QCad 3 because of the enormous difficulties involving in making QCad a pure Qt +4 application) and second, Gentoo (the author's Linux distribution of choice) +removed both Qt 3 and QCad CE from the Portage tree. + +And so porting to Qt 4 using the Qt3Support module was done initially to see if +it would work, and if it was worth doing. Positive results were obtained in +both respects, so work started in earnest in doing a complete port to Qt 4 +without any reliance whatsoever on the Qt3Support module. + +Eventually, after much hard work and cursing, success was won and the author +ended up with a codebase that was quite a bit different from that which he +started with. And since the end goal was not just feature parity with QCad CE +but to surpass it, a new name was needed to prevent confusion with RibbonSoft's +product. + +Initial thoughts on naming centered around FooCAD or CADFoo (with Foo being +whatever), but a long search on the internet brought forth the conclusion that +such paths have been well trodden by just about anyone who has even given a +thought towards creating computer aided design software. And so it was +manifestly clear that a different naming scheme would be required. After +several false starts, the name Architektonas was chosen as a rough English +transliteration of the Greek word for architect. We like it; we hope you do +too! + + +@-~ Installation ~-@ + +Architektonas is built on the Qt 4 framework; it requires version 4.6.3 or +later. We build it using gcc v4.4.3; we can't guarantee that it will compile on +lesser versions but you never know. Building Architektonas should be as easy as +typing: + +make && make install + +[*NOTE: make install doesn't do anything ATM] + diff --git a/src/base/rs_fileio.cpp b/src/base/rs_fileio.cpp index 8d1e9ef..7703fd7 100644 --- a/src/base/rs_fileio.cpp +++ b/src/base/rs_fileio.cpp @@ -17,6 +17,7 @@ #include "rs_filtercxf.h" #include "rs_filterdxf.h" #include "rs_filterdxf1.h" +#include "rs_filterinterface.h" RS_FileIO * RS_FileIO::uniqueInstance = NULL; diff --git a/src/base/rs_fileio.h b/src/base/rs_fileio.h index 320463a..6ad6324 100644 --- a/src/base/rs_fileio.h +++ b/src/base/rs_fileio.h @@ -2,11 +2,12 @@ #define RS_FILEIO_H #include -#include "rs_filterinterface.h" +//#include "rs_filterinterface.h" #define RS_FILEIO RS_FileIO::instance() class Drawing; +class RS_FilterInterface; /** * API Class for importing files. @@ -21,7 +22,6 @@ class RS_FileIO public: static RS_FileIO * instance(); void registerFilter(RS_FilterInterface * f); -// Q3PtrList getFilterList(); QList getFilterList(); RS_FilterInterface * getImportFilter(RS2::FormatType t); RS_FilterInterface * getExportFilter(RS2::FormatType t); @@ -36,7 +36,6 @@ class RS_FileIO protected: static RS_FileIO * uniqueInstance; -// Q3PtrList filterList; QList filterList; }; diff --git a/src/base/rs_filtercxf.cpp b/src/base/rs_filtercxf.cpp index b3bbfe4..1040b03 100644 --- a/src/base/rs_filtercxf.cpp +++ b/src/base/rs_filtercxf.cpp @@ -18,7 +18,6 @@ #include #include -//#include "rs_regexp.h" #include "rs_font.h" #include "rs_utility.h" #include "rs_system.h" @@ -54,11 +53,11 @@ bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType bool success = false; // Load font file as we normally do, but the font doesn't own the - // letters (we'll add them to the graphic instead. Hence 'false'). + // letters (we'll add them to the graphic instead. Hence 'false'). RS_Font font(file, false); success = font.loadFont(); - if (success == false) + if (!success) { RS_DEBUG->print(RS_Debug::D_WARNING, "Cannot open CXF file '%s'.", file.toLatin1().data()); return false; @@ -75,15 +74,15 @@ bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType RS_BlockList * letterList = font.getLetterList(); - for(uint i=0; igetName().at(0).unicode(), 16); while (uCode.length() < 4) - uCode="0"+uCode; + uCode = "0" + uCode; //ch->setName("[" + uCode + "] " + ch->getName()); //letterList->rename(ch, QString("[%1]").arg(ch->getName())); @@ -106,7 +105,7 @@ bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType */ bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/) { - RS_DEBUG->print("CXF Filter: exporting file '%s'...", file.toLatin1().data()); + RS_DEBUG->print("CXF Filter: exporting file '%s'...", file.toAscii().data()); // crashes under windoze xp: //std::ofstream fout; diff --git a/src/base/rs_font.cpp b/src/base/rs_font.cpp index b8a3e6c..b982669 100644 --- a/src/base/rs_font.cpp +++ b/src/base/rs_font.cpp @@ -25,14 +25,10 @@ * @param owner true if the font owns the letters (blocks). Otherwise * the letters will be deleted when the font is deleted. */ -RS_Font::RS_Font(const QString & fileName, bool owner): letterList(owner) +RS_Font::RS_Font(const QString & fn, bool owner): letterList(owner), fileName(fn), + encoding(""), loaded(false), letterSpacing(3.0), wordSpacing(6.75), + lineSpacingFactor(1.0) { - this->fileName = fileName; - encoding = ""; - loaded = false; - letterSpacing = 3.0; - wordSpacing = 6.75; - lineSpacingFactor = 1.0; } /** @return the fileName of this font. */ @@ -124,16 +120,13 @@ bool RS_Font::loadFont() if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Font::loadFont: Cannot open font file: %s", - path.toLatin1().data()); + path.toAscii().data()); return false; } - else - { - RS_DEBUG->print("RS_Font::loadFont: Successfully opened font file: %s", path.toLatin1().data()); - } + + RS_DEBUG->print("RS_Font::loadFont: Successfully opened font file: %s", path.toAscii().data()); QTextStream ts(&file); - QString line; // Read line by line until we find a new letter: //I think this is wrong... We're mixing classes here... @@ -141,143 +134,126 @@ bool RS_Font::loadFont() // while (!file.atEnd()) while (!ts.atEnd()) { - line = ts.readLine(); -//printf("\"%s\"\n", line.toAscii().data()); + QString line = ts.readLine(); + if (line.isEmpty()) continue; // Read font settings: if (line.at(0) == '#') - { -#if 0 -// QStringList lst = QStringList::split(':', line.right(line.length() - 1)); - QStringList lst = line.right(line.length() - 1).split(":"); - QStringList::Iterator it3 = lst.begin(); - -// QString identifier = (*it3).stripWhiteSpace(); - QString identifier = (*it3); - identifier = identifier.simplified().toLower(); - it3++; -// QString value = (*it3).stripWhiteSpace(); - QString value = (*it3); - value = value.simplified().toLower(); -#else - QStringList list = line.right(line.length() - 1).split(":"); - QString identifier = "", value = ""; - - if (list.size() >= 1) - identifier = list[0].simplified().toLower(); - - if (list.size() >= 2) - value = list[1].simplified();//.toLower(); -#endif -//printf("--> identifier=\"%s\", value=\"%s\"\n", identifier.toAscii().data(), value.toAscii().data()); - - if (identifier == "letterspacing") - letterSpacing = value.toDouble(); - else if (identifier == "wordspacing") - wordSpacing = value.toDouble(); - else if (identifier == "linespacingfactor") - lineSpacingFactor = value.toDouble(); - else if (identifier == "author") - authors.append(value); - else if (identifier == "name") - names.append(value); - else if (identifier == "encoding") - { - ts.setCodec(QTextCodec::codecForName(value.toAscii())); - encoding = value; - } - } + ParseIdentifier(ts, line); // Add another letter to this font: else if (line.at(0) == '[') - { - // uniode character: - QChar ch; + ParseCharacter(ts, line); + } - // read unicode: - QRegExp regexp("[0-9A-Fa-f]{4,4}"); -// regexp.search(line); - regexp.indexIn(line); - QString cap = regexp.cap(); + file.close(); + loaded = true; + RS_DEBUG->print("RS_Font::loadFont OK"); - if (!cap.isNull()) - { - int uCode = cap.toInt(NULL, 16); - ch = QChar(uCode); - } - // read UTF8 (qcad 1 compatibility) -// else if (line.find(']') >= 3) - else if (line.indexOf(']') >= 3) - { -// int i = line.find(']'); - int i = line.indexOf(']'); - QString mid = line.mid(1, i - 1); - ch = QString::fromUtf8(mid.toLatin1()).at(0); - } - // read normal ascii character: - else - { - ch = line.at(1); - } + return true; +} - // create new letter: - RS_FontChar * letter = new RS_FontChar(NULL, ch, Vector(0.0, 0.0)); +void RS_Font::ParseIdentifier(QTextStream & ts, QString line) +{ + QStringList list = line.mid(1).split(":"); + QString identifier = "", value = ""; + + if (list.size() >= 1) + identifier = list[0].simplified().toLower(); + + if (list.size() >= 2) + value = list[1].simplified(); + + if (identifier == "letterspacing") + letterSpacing = value.toDouble(); + else if (identifier == "wordspacing") + wordSpacing = value.toDouble(); + else if (identifier == "linespacingfactor") + lineSpacingFactor = value.toDouble(); + else if (identifier == "author") + authors.append(value); + else if (identifier == "name") + names.append(value); + else if (identifier == "encoding") + { + ts.setCodec(QTextCodec::codecForName(value.toAscii())); + encoding = value; + } +} - // Read entities of this letter: - line = ts.readLine(); +void RS_Font::ParseCharacter(QTextStream & ts, QString line) +{ + // Unicode character: + QChar ch; - while (!line.isEmpty()) - { - QString coordsStr = line.right(line.length() - 2); - QStringList coords = coordsStr.split(","); - QStringList::Iterator it2 = coords.begin(); - - // Line: - if (line.at(0) == 'L') - { - double x1 = (*it2++).toDouble(); - double y1 = (*it2++).toDouble(); - double x2 = (*it2++).toDouble(); - double y2 = (*it2).toDouble(); - - RS_LineData ld(Vector(x1, y1), Vector(x2, y2)); - RS_Line * line = new RS_Line(letter, ld); - line->setPen(RS_Pen(RS2::FlagInvalid)); - line->setLayer(NULL); - letter->addEntity(line); - } - // Arc: - else if (line.at(0) == 'A') - { - double cx = (*it2++).toDouble(); - double cy = (*it2++).toDouble(); - double r = (*it2++).toDouble(); - double a1 = (*it2++).toDouble() / ARAD; - double a2 = (*it2).toDouble() / ARAD; - bool reversed = (line.at(1) == 'R'); - - RS_ArcData ad(Vector(cx, cy), r, a1, a2, reversed); - RS_Arc * arc = new RS_Arc(letter, ad); - arc->setPen(RS_Pen(RS2::FlagInvalid)); - arc->setLayer(NULL); - letter->addEntity(arc); - } - - line = ts.readLine(); - } + // Read unicode: + QRegExp regexp("[0-9A-Fa-f]{4,4}"); + regexp.indexIn(line); + QString cap = regexp.cap(); - letter->calculateBorders(); - letterList.add(letter); - } + if (!cap.isNull()) + { + int uCode = cap.toInt(NULL, 16); + ch = QChar(uCode); + } + // Read UTF8 (QCad 1 compatibility) + else if (line.indexOf(']') >= 3) + { + int i = line.indexOf(']'); + QString mid = line.mid(1, i - 1); + ch = QString::fromUtf8(mid.toAscii()).at(0); + } + // Read normal ascii character: + else + { + ch = line.at(1); } - file.close(); - loaded = true; + // Create new letter: + RS_FontChar * letter = new RS_FontChar(NULL, ch, Vector(0.0, 0.0)); + // Read entities of this letter: + line = ts.readLine(); - RS_DEBUG->print("RS_Font::loadFont OK"); + while (!line.isEmpty()) + { + QStringList coords = line.mid(2).split(","); + QStringList::Iterator it2 = coords.begin(); - return true; + if (line.at(0) == 'L') // Line + { + double x1 = (*it2++).toDouble(); + double y1 = (*it2++).toDouble(); + double x2 = (*it2++).toDouble(); + double y2 = (*it2).toDouble(); + + RS_LineData ld(Vector(x1, y1), Vector(x2, y2)); + RS_Line * line = new RS_Line(letter, ld); + line->setPen(RS_Pen(RS2::FlagInvalid)); + line->setLayer(NULL); + letter->addEntity(line); + } + else if (line.at(0) == 'A') // Arc + { + double cx = (*it2++).toDouble(); + double cy = (*it2++).toDouble(); + double r = (*it2++).toDouble(); + double a1 = (*it2++).toDouble() / ARAD; + double a2 = (*it2).toDouble() / ARAD; + bool reversed = (line.at(1) == 'R'); + + RS_ArcData ad(Vector(cx, cy), r, a1, a2, reversed); + RS_Arc * arc = new RS_Arc(letter, ad); + arc->setPen(RS_Pen(RS2::FlagInvalid)); + arc->setLayer(NULL); + letter->addEntity(arc); + } + + line = ts.readLine(); + } + + letter->calculateBorders(); + letterList.add(letter); } // Wrappers for block list (letters) functions diff --git a/src/base/rs_font.h b/src/base/rs_font.h index 3b6d21c..61eee22 100644 --- a/src/base/rs_font.h +++ b/src/base/rs_font.h @@ -18,7 +18,6 @@ class RS_Font public: RS_Font(const QString & name, bool owner = true); - //RS_Font(const char* name); QString getFileName() const; QString getEncoding() const; @@ -37,6 +36,12 @@ class RS_Font friend std::ostream & operator<<(std::ostream & os, const RS_Font & l); +#if 1 + private: + void ParseIdentifier(QTextStream &, QString); + void ParseCharacter(QTextStream &, QString); +#endif + private: //! block list (letters) RS_BlockList letterList; diff --git a/src/mainapp/commands.h b/src/mainapp/commands.h index ea709d8..12c713c 100644 --- a/src/mainapp/commands.h +++ b/src/mainapp/commands.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_commands.h 1307 2004-04-04 22:48:13Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_COMMANDS_H #define RS_COMMANDS_H diff --git a/src/widgets/qg_blockwidget.h b/src/widgets/qg_blockwidget.h index 8df63a1..efb8e04 100644 --- a/src/widgets/qg_blockwidget.h +++ b/src/widgets/qg_blockwidget.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: qg_blockwidget.h 1563 2004-04-04 22:51:54Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef QG_BLOCKWIDGET_H #define QG_BLOCKWIDGET_H diff --git a/src/widgets/qg_commandedit.cpp b/src/widgets/qg_commandedit.cpp index b345967..f345f0f 100644 --- a/src/widgets/qg_commandedit.cpp +++ b/src/widgets/qg_commandedit.cpp @@ -1,28 +1,3 @@ -/**************************************************************************** -** $Id: qg_commandedit.cpp 1614 2004-12-09 23:10:15Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ #include "qg_commandedit.h" diff --git a/src/widgets/qg_commandedit.h b/src/widgets/qg_commandedit.h index ed6fd22..5cc6287 100644 --- a/src/widgets/qg_commandedit.h +++ b/src/widgets/qg_commandedit.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: qg_commandedit.h 1370 2003-08-02 00:02:00Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef QG_COMMANDEDIT_H #define QG_COMMANDEDIT_H diff --git a/src/widgets/qg_fontbox.h b/src/widgets/qg_fontbox.h index 721b90b..6841f79 100644 --- a/src/widgets/qg_fontbox.h +++ b/src/widgets/qg_fontbox.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: qg_fontbox.h 1346 2003-06-11 06:58:22Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef QG_FONTBOX_H #define QG_FONTBOX_H diff --git a/src/widgets/qg_layerbox.h b/src/widgets/qg_layerbox.h index b0bba6e..f266288 100644 --- a/src/widgets/qg_layerbox.h +++ b/src/widgets/qg_layerbox.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: qg_layerbox.h 1383 2003-08-22 23:23:38Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef QG_LAYERBOX_H #define QG_LAYERBOX_H diff --git a/src/widgets/qg_layerwidget.h b/src/widgets/qg_layerwidget.h index 62c478b..3f4a5af 100644 --- a/src/widgets/qg_layerwidget.h +++ b/src/widgets/qg_layerwidget.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: qg_layerwidget.h 1589 2004-07-14 21:28:54Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef QG_LAYERWIDGET_H #define QG_LAYERWIDGET_H diff --git a/src/widgets/qg_listviewitem.cpp b/src/widgets/qg_listviewitem.cpp index dcf14bc..4d01feb 100644 --- a/src/widgets/qg_listviewitem.cpp +++ b/src/widgets/qg_listviewitem.cpp @@ -1,39 +1,11 @@ -/**************************************************************************** -** $Id: qg_listviewitem.cpp 1385 2003-08-27 23:19:42Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ #include "qg_listviewitem.h" #include -/*#include "xpm/folderclosed.xpm" -#include "xpm/folderopen.xpm"*/ /** * Constructor for root items. */ -//QG_ListViewItem::QG_ListViewItem(Q3ListView * par, const QString & label, QG_ListViewItem::QG_ListViewItem(QListWidget * par, const QString & label, bool open, int id): QListWidgetItem(par) { @@ -41,8 +13,6 @@ QG_ListViewItem::QG_ListViewItem(QListWidget * par, const QString & label, this->label = label; this->id = id; -// setPixmap(0, QPixmap((open ? folderopen_xpm : folderclosed_xpm))); -// setIcon(QIcon((open ? folderopen_xpm : folderclosed_xpm))); setIcon(QIcon((open ? ":/res/folderopen.xpm" : ":/res/folderclosed.xpm"))); setOpen(open); diff --git a/src/widgets/qg_listviewitem.h b/src/widgets/qg_listviewitem.h index 653bb18..334390d 100644 --- a/src/widgets/qg_listviewitem.h +++ b/src/widgets/qg_listviewitem.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: qg_listviewitem.h 1385 2003-08-27 23:19:42Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef QG_LISTVIEWITEM_H #define QG_LISTVIEWITEM_H