]> Shamusworld >> Repos - architektonas/commitdiff
Added missing readme and GPL license file.
authorShamus Hammons <jlhamm@acm.org>
Mon, 2 Aug 2010 00:48:56 +0000 (00:48 +0000)
committerShamus Hammons <jlhamm@acm.org>
Mon, 2 Aug 2010 00:48:56 +0000 (00:48 +0000)
17 files changed:
GPLv2 [new file with mode: 0644]
Makefile
README [new file with mode: 0644]
src/base/rs_fileio.cpp
src/base/rs_fileio.h
src/base/rs_filtercxf.cpp
src/base/rs_font.cpp
src/base/rs_font.h
src/mainapp/commands.h
src/widgets/qg_blockwidget.h
src/widgets/qg_commandedit.cpp
src/widgets/qg_commandedit.h
src/widgets/qg_fontbox.h
src/widgets/qg_layerbox.h
src/widgets/qg_layerwidget.h
src/widgets/qg_listviewitem.cpp
src/widgets/qg_listviewitem.h

diff --git a/GPLv2 b/GPLv2
new file mode 100644 (file)
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.
+\f
+                   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.)
+\f
+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.
+\f
+  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.
+\f
+  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
index 60003dba35079b6ea508cdbcea1bab8e83eff6d2..ce3a75b6cc79ad271720cd842993958759c704bd 100644 (file)
--- 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 (file)
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]
+
index 8d1e9efa87dd94ac32e96713a94e2048c6b233dc..7703fd7b482b5c0ae31e545e11312cc7a34462e9 100644 (file)
@@ -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;
 
index 320463ad04ee29294d3f10caa233f7cf24da070d..6ad632493156d67b9f20a8326b04eb05ac7060d7 100644 (file)
@@ -2,11 +2,12 @@
 #define RS_FILEIO_H
 
 #include <QtCore>
-#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<RS_FilterInterface> getFilterList();
                QList<RS_FilterInterface *> 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<RS_FilterInterface> filterList;
                QList<RS_FilterInterface *> filterList;
 };
 
index b3bbfe46bcd900963f6ef208cf8d07bfa0f540b6..1040b03f1a47b109fcdbaa3c0c397cb4a71e52db 100644 (file)
@@ -18,7 +18,6 @@
 #include <fstream>
 #include <QtCore>
 
-//#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; i<font.countLetters(); ++i)
+       for(uint i=0; i<font.countLetters(); i++)
        {
-               RS_Block* ch = font.letterAt(i);
+               RS_Block * ch = font.letterAt(i);
 
                QString uCode;
                uCode.setNum(ch->getName().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;
index b8a3e6cc1c19b8b7621db9bdbc6061016b39139f..b982669729c0cd3861466bda6e089b42fe49ea60 100644 (file)
  * @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
index 3b6d21cac927ffd0f5afef0274d523179207da66..61eee2299b0a580c2a543654a9a9a17f6ae642fb 100644 (file)
@@ -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;
index ea709d89af8e0f16c6752601d33519a11500c346..12c713cbcc0347aaed4fb59b0251e47a547a697e 100644 (file)
@@ -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
 
index 8df63a1f46bda6ac212f48b9522512570c939294..efb8e0471fc59ab65ebd8acea4e07884d6779306 100644 (file)
@@ -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
 
index b3459678b6a25580f03ccaecc8b9b7d8932de4ec..f345f0f6da24ebd951c2f992fb574dc2b80381a8 100644 (file)
@@ -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"
 
index ed6fd22cb3c1372f4132ceed0ee6dcd77c9241d3..5cc6287e3b19ef920024fdb54dc40d56eb5bb774 100644 (file)
@@ -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
 
index 721b90bed6ca0329247709772796c23fb9f2e69a..6841f798c0c238e9505c04260689fad93a940494 100644 (file)
@@ -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
 
index b0bba6e7cd7e9833194b1e7f7be359299b4c860b..f2662888811a503905c8afaf87c7e870b8c1e576 100644 (file)
@@ -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
 
index 62c478b505d49c4a7c8668dddd7c4fb830b5f96a..3f4a5af165ffb0365fb60690aafc69dab07a26fa 100644 (file)
@@ -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
 
index dcf14bcbb24960c5043506bcd97ac81f9a6b052d..4d01feb1c01518525972608311c0c248ad93f9c3 100644 (file)
@@ -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 <qpixmap.h>
-/*#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);
index 653bb1871ed84c99f78b9b483facd8cdd63fa4a7..334390dd4eb2d4cbec29dde4ca4fe8a3a84d6a42 100644 (file)
@@ -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