├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── ColorUtils.h ├── Command.cpp ├── Command.h ├── CommandDelegate.cpp ├── CommandDelegate.h ├── CommandImpl.cpp ├── CommandImpl.h ├── CommandWidget.cpp ├── CommandWidget.h ├── CommandsModel.cpp ├── CommandsModel.h ├── DebugWidget.cpp ├── DebugWidget.h ├── DebugWidget.ui ├── FlowCompass.cpp ├── FlowCompass.h ├── ImageModel.cpp ├── ImageModel.h ├── KColorCells.cpp ├── KColorCells.h ├── KColorMimeData.cpp ├── KColorMimeData.h ├── KColorPatch.cpp ├── KColorPatch.h ├── LICENSE ├── LICENSE.icon ├── MainWindow.cpp ├── MainWindow.h ├── MainWindow.ui ├── NPietObserver.cpp ├── NPietObserver.h ├── PixelDelegate.cpp ├── PixelDelegate.h ├── README.md ├── ResizeDialog.cpp ├── ResizeDialog.h ├── RunController.cpp ├── RunController.h ├── TODO ├── UndoCommands.cpp ├── UndoCommands.h ├── UndoHandler.cpp ├── UndoHandler.h ├── ViewMonitor.cpp ├── ViewMonitor.h ├── build.sh ├── fallback.qrc ├── icons ├── debug-step.svg ├── fallback │ ├── 16x16 │ │ ├── actions │ │ │ ├── application-exit.png │ │ │ ├── debug-step.png │ │ │ ├── document-new.png │ │ │ ├── document-open.png │ │ │ ├── document-save-as.png │ │ │ ├── document-save.png │ │ │ ├── edit-undo.png │ │ │ ├── insert-image.png │ │ │ ├── process-stop.png │ │ │ ├── run-build.png │ │ │ ├── system-run.png │ │ │ ├── transform-scale.png │ │ │ ├── view-form-table.png │ │ │ ├── zoom-in.png │ │ │ └── zoom-out.png │ │ └── apps │ │ │ └── utilities-terminal.png │ ├── 22x22 │ │ ├── actions │ │ │ ├── application-exit.png │ │ │ ├── document-new.png │ │ │ ├── document-open.png │ │ │ ├── document-save-as.png │ │ │ ├── document-save.png │ │ │ ├── edit-undo.png │ │ │ ├── insert-image.png │ │ │ ├── process-stop.png │ │ │ ├── run-build.png │ │ │ ├── system-run.png │ │ │ ├── transform-scale.png │ │ │ ├── view-form-table.png │ │ │ ├── zoom-in.png │ │ │ └── zoom-out.png │ │ └── apps │ │ │ └── utilities-terminal.png │ ├── 32x32 │ │ ├── actions │ │ │ ├── .directory │ │ │ ├── application-exit.png │ │ │ ├── debug-step.png │ │ │ ├── document-new.png │ │ │ ├── document-open.png │ │ │ ├── document-save-as.png │ │ │ ├── document-save.png │ │ │ ├── edit-undo.png │ │ │ ├── insert-image.png │ │ │ ├── process-stop.png │ │ │ ├── run-build.png │ │ │ ├── system-run.png │ │ │ ├── transform-scale.png │ │ │ ├── view-form-table.png │ │ │ ├── zoom-in.png │ │ │ └── zoom-out.png │ │ └── apps │ │ │ └── utilities-terminal.png │ ├── COPYING │ └── index.theme └── icons.sh ├── install_dependencies.sh ├── main.cpp ├── nhello.ppm ├── npiet ├── CMakeLists.txt ├── COPYING ├── README.npiet ├── cmake │ └── modules │ │ └── FindGD.cmake ├── config.h.in ├── npiet.c ├── npiet.h ├── npiet_utils.c ├── npiet_utils.h ├── test │ ├── NPietTest.cpp │ ├── NPietTest.h │ └── nhello.ppm └── win32 │ ├── LICENSE.gd │ ├── LICENSE.libpng │ ├── LICENSE.zlib │ ├── bin │ ├── bgd.dll │ ├── libpng12.dll │ ├── libpng3.dll │ └── zlib1.dll │ ├── include │ ├── entities.h │ ├── gd.h │ ├── gd_io.h │ ├── gdcache.h │ ├── gdfontg.h │ ├── gdfontl.h │ ├── gdfontmb.h │ ├── gdfonts.h │ ├── gdfontt.h │ ├── gdfx.h │ ├── gdhelpers.h │ ├── jisx0208.h │ ├── libpng12 │ │ ├── png.h │ │ └── pngconf.h │ ├── png.h │ ├── pngconf.h │ ├── wbmp.h │ ├── zconf.h │ └── zlib.h │ └── lib │ ├── bgd.dll │ ├── bgd.lib │ ├── bgd_a.lib │ ├── gdtest.lib │ ├── libpng-bcc.lib │ ├── libpng.dll.a │ ├── libpng.la │ ├── libpng.lib │ ├── libpng12.def │ ├── libpng12.dll.a │ ├── libpng12.la │ ├── libz.a │ ├── libz.dll.a │ ├── pkgconfig │ ├── libpng.pc │ └── libpng12.pc │ ├── webpng.lib │ ├── zlib-bcc.lib │ ├── zlib.def │ └── zlib.lib ├── piet-16x16.png ├── piet.ico ├── pietcreator.qrc ├── pietcreator.rc └── utils └── roll-vis.html /.gitignore: -------------------------------------------------------------------------------- 1 | *kdev4* 2 | *~ 3 | build 4 | CMakeLists.txt.user 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: true 2 | language: cpp 3 | compiler: gcc 4 | 5 | install: 6 | - sudo ./install_dependencies.sh 7 | 8 | script: 9 | - ./build.sh 10 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(pietcreator) 2 | cmake_minimum_required(VERSION 2.6) 3 | 4 | set( CMAKE_BUILD_TYPE Debug) 5 | set( DEBUG_BUILD_TYPE ON ) 6 | 7 | find_package(Qt4 REQUIRED) 8 | 9 | add_subdirectory( npiet ) 10 | 11 | include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ./npiet .) 12 | 13 | set( pietcreator_SRCS 14 | main.cpp 15 | MainWindow.cpp 16 | ImageModel.cpp 17 | PixelDelegate.cpp 18 | KColorCells.cpp 19 | KColorMimeData.cpp 20 | KColorPatch.cpp 21 | ViewMonitor.cpp 22 | Command.cpp 23 | CommandsModel.cpp 24 | CommandDelegate.cpp 25 | ResizeDialog.cpp 26 | RunController.cpp 27 | NPietObserver.cpp 28 | CommandWidget.cpp 29 | DebugWidget.cpp 30 | CommandImpl.cpp 31 | FlowCompass.cpp 32 | UndoCommands.cpp 33 | UndoHandler.cpp ) 34 | 35 | set( pietcreator_RCS 36 | fallback.qrc 37 | pietcreator.qrc ) 38 | 39 | QT4_ADD_RESOURCES( pietcreator_SRCS ${pietcreator_RCS} ) 40 | 41 | qt4_automoc(${pietcreator_SRCS}) 42 | 43 | qt4_wrap_ui( pietcreator_SRCS MainWindow.ui DebugWidget.ui ) 44 | 45 | IF(WIN32) 46 | add_executable(pietcreator ${pietcreator_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/pietcreator.rc) 47 | else() 48 | add_executable(pietcreator ${pietcreator_SRCS}) 49 | endif(WIN32) 50 | 51 | target_link_libraries( pietcreator 52 | ${QT_QTCORE_LIBRARY} 53 | ${QT_QTGUI_LIBRARY} 54 | npiet 55 | ) 56 | -------------------------------------------------------------------------------- /ColorUtils.h: -------------------------------------------------------------------------------- 1 | /* This class is an almagamation of several KDE color classes: 2 | * KColorSpaces, KColorHelpers, KColorUtils 3 | * Copyright (C) 2007 Matthew Woehlke 4 | * Copyright (C) 2007 Olaf Schmidt 5 | * Copyright (C) 2007 Thomas Zander 6 | * Copyright (C) 2007 Zack Rusin 7 | * Copyright (C) 2010 Casey Link 8 | * 9 | * This library is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Library General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2 of the License, or (at your option) any later version. 13 | * 14 | * This library is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Library General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Library General Public License 20 | * along with this library; see the file COPYING.LIB. If not, write to 21 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 | * Boston, MA 02110-1301, USA. 23 | */ 24 | 25 | 26 | #ifndef COLORUTILS_H 27 | #define COLORUTILS_H 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace ColorUtils { 34 | 35 | /////////////////////////////////////////////////////////////////////////////// 36 | // HCY color space 37 | // from kcolorspaces.cpp 38 | #define HCY_REC 709 // use 709 for now 39 | #if HCY_REC == 601 40 | static const qreal yc[3] = { 0.299, 0.587, 0.114 }; 41 | #elif HCY_REC == 709 42 | static const qreal yc[3] = {0.2126, 0.7152, 0.0722}; 43 | #else // use Qt values 44 | static const qreal yc[3] = { 0.34375, 0.5, 0.15625 }; 45 | #endif 46 | 47 | // from kcolorhelpers_p.h 48 | inline qreal normalize(qreal a) 49 | { 50 | return (a < 1.0 ? (a > 0.0 ? a : 0.0) : 1.0); 51 | } 52 | 53 | // from kcolorspaces.cpp 54 | inline qreal gamma(qreal n) 55 | { 56 | return pow(normalize(n), 2.2); 57 | } 58 | 59 | // from kcolorspaces.cpp 60 | inline qreal lumag(qreal r, qreal g, qreal b) 61 | { 62 | return r*yc[0] + g*yc[1] + b*yc[2]; 63 | } 64 | 65 | // from kcolorspaces.cpp 66 | inline qreal luma(const QColor& color) 67 | { 68 | return lumag(gamma(color.redF()), 69 | gamma(color.greenF()), 70 | gamma(color.blueF())); 71 | } 72 | 73 | // from kcolorutils.cpp 74 | inline qreal contrastRatio(const QColor &c1, const QColor &c2) 75 | { 76 | qreal y1 = luma(c1), y2 = luma(c2); 77 | if (y1 > y2) 78 | return (y1 + 0.05) / (y2 + 0.05); 79 | else 80 | return (y2 + 0.05) / (y1 + 0.05); 81 | } 82 | } 83 | 84 | #endif -------------------------------------------------------------------------------- /Command.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "Command.h" 21 | 22 | -------------------------------------------------------------------------------- /Command.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef COMMAND_H 21 | #define COMMAND_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | class QColor; 28 | 29 | struct Command 30 | { 31 | Command(){} 32 | Command( const QString &_name, const QString &_desc ) : name( _name ), desc( _desc ) {} 33 | Command( const QString &_name, const QString &_desc, const QColor &_color, int _index ) : name( _name ), desc( _desc ), color( _color ), index( _index ) {} 34 | 35 | Command( const Command &other ) { 36 | name = other.name; 37 | desc = other.desc; 38 | color = other.color; 39 | index = other.index; 40 | } 41 | 42 | Command &operator=( const Command &other ) { 43 | if( &other != this ) { 44 | name = other.name; 45 | desc = other.desc; 46 | color = other.color; 47 | index = other.index; 48 | } 49 | return *this; 50 | } 51 | 52 | QString name; 53 | QString desc; 54 | QColor color; 55 | int index; 56 | }; 57 | 58 | Q_DECLARE_METATYPE(Command) 59 | 60 | #endif // COMMAND_H 61 | -------------------------------------------------------------------------------- /CommandDelegate.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "CommandDelegate.h" 21 | 22 | #include "ViewMonitor.h" 23 | 24 | #include "ColorUtils.h" 25 | 26 | #include 27 | 28 | CommandDelegate::CommandDelegate( ViewMonitor* monitor, QObject* parent ): QStyledItemDelegate( parent ), mMonitor( monitor ) 29 | { 30 | 31 | } 32 | 33 | void CommandDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const 34 | { 35 | Q_ASSERT( index.isValid() ); 36 | QBrush backBrush = index.data( Qt::BackgroundRole ).value(); 37 | //QColor foreColor = option.palette.color( QPalette::Text ); 38 | painter->save(); 39 | QStyleOptionViewItemV4 opt( option ); 40 | opt.displayAlignment = Qt::AlignHCenter; 41 | opt.backgroundBrush = backBrush; 42 | const QStyle *style = opt.widget ? opt.widget->style() : QApplication::style(); 43 | style->drawPrimitive( QStyle::PE_PanelItemViewItem, &opt, painter, 0 ); 44 | 45 | QColor foreColor(0,0,0); 46 | if ( ColorUtils::contrastRatio( foreColor, backBrush.color() ) < 5 ) { 47 | foreColor.setRgb(255,255,255); 48 | } 49 | QString label = index.data().toString(); 50 | painter->setPen( foreColor ); 51 | painter->drawText( opt.rect, Qt::AlignCenter, label ); 52 | painter->restore(); 53 | } 54 | 55 | QSize CommandDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const 56 | { 57 | return QSize( QStyledItemDelegate::sizeHint( option, index ).width(), 25 ); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /CommandDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef COMMANDDELEGATE_H 21 | #define COMMANDDELEGATE_H 22 | 23 | #include 24 | 25 | class ViewMonitor; 26 | 27 | class CommandDelegate : public QStyledItemDelegate 28 | { 29 | 30 | public: 31 | CommandDelegate( ViewMonitor* monitor, QObject *parent ); 32 | void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; 33 | QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const; 34 | 35 | private: 36 | ViewMonitor* mMonitor; 37 | }; 38 | 39 | #endif // COMMANDDELEGATE_H 40 | -------------------------------------------------------------------------------- /CommandImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "CommandImpl.h" 21 | 22 | Command PietCommand::Noop() 23 | { 24 | return Command( "noop", "" ); 25 | } 26 | 27 | 28 | Command PietCommand::Push() 29 | { 30 | return Command( "push", "Pushes the value of the colour block just exited on to the stack. Note that values of colour blocks are not automatically pushed on to the stack - this push operation must be explicitly carried out." ); 31 | } 32 | 33 | Command PietCommand::Pop() 34 | { 35 | return Command( "pop", "Pops the top value off the stack and discards it." ); 36 | } 37 | 38 | 39 | Command PietCommand::Add() 40 | { 41 | return Command( "add", "Pops the top two values off the stack, adds them, and pushes the result back on the stack." ); 42 | } 43 | 44 | Command PietCommand::Subtract() 45 | { 46 | return Command( "subtract", "Pops the top two values off the stack, subtracts the top value from the second top value, and pushes the result back on the stack." ); 47 | } 48 | 49 | Command PietCommand::Multiply() 50 | { 51 | return Command( "multiply", "Pops the top two values off the stack, multiplies them, and pushes the result back on the stack." ); 52 | } 53 | 54 | Command PietCommand::Divide() 55 | { 56 | return Command( "divide", "Pops the top two values off the stack, calculates the integer division of the second top value by the top value, and pushes the result back on the stack." ); 57 | } 58 | 59 | Command PietCommand::Mod() 60 | { 61 | return Command( "mod", "Pops the top two values off the stack, calculates the second top value modulo the top value, and pushes the result back on the stack." ); 62 | } 63 | 64 | Command PietCommand::Not() 65 | { 66 | return Command( "not", "Replaces the top value of the stack with 0 if it is non-zero, and 1 if it is zero." ); 67 | } 68 | 69 | Command PietCommand::Greater() 70 | { 71 | return Command( "greater", "Pops the top two values off the stack, and pushes 1 on to the stack if the second top value is greater than the top value, and pushes 0 if it is not greater." ); 72 | } 73 | 74 | Command PietCommand::Pointer() 75 | { 76 | return Command( "pointer", "Pops the top value off the stack and rotates the DP clockwise that many steps (anticlockwise if negative)." ); 77 | } 78 | 79 | Command PietCommand::Switch() 80 | { 81 | return Command( "switch", "Pops the top value off the stack and toggles the CC that many times." ); 82 | } 83 | 84 | Command PietCommand::Duplicate() 85 | { 86 | return Command( "duplicate", "Pushes a copy of the top value on the stack on to the stack." ); 87 | } 88 | 89 | Command PietCommand::Roll() 90 | { 91 | return Command( "roll", "Pops the top two values off the stack and \"rolls\" the remaining stack entries to a depth equal to the second value popped, by a number of rolls equal to the first value popped. A single roll to depth n is defined as burying the top value on the stack n deep and bringing all values above it up by 1 place. A negative number of rolls rolls in the opposite direction. A negative depth is an error and the command is ignored." ); 92 | } 93 | 94 | Command PietCommand::In() 95 | { 96 | return Command( "in", "Reads a value from STDIN as either a number or character, depending on the particular incarnation of this command and pushes it on to the stack." ); 97 | } 98 | 99 | Command PietCommand::Out() 100 | { 101 | return Command( "out", "Pops the top value off the stack and prints it to STDOUT as either a number or character, depending on the particular incarnation of this command." ); 102 | } 103 | 104 | -------------------------------------------------------------------------------- /CommandImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef COMMANDIMPL_H 21 | #define COMMANDIMPL_H 22 | #include "Command.h" 23 | 24 | namespace PietCommand 25 | { 26 | Command Noop(); 27 | Command Push(); 28 | Command Pop(); 29 | Command Add(); 30 | Command Subtract(); 31 | Command Multiply(); 32 | Command Divide(); 33 | Command Mod(); 34 | Command Not(); 35 | Command Greater(); 36 | Command Pointer(); 37 | Command Switch(); 38 | Command Duplicate(); 39 | Command Roll(); 40 | Command In(); 41 | Command Out(); 42 | } 43 | #endif -------------------------------------------------------------------------------- /CommandWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "CommandWidget.h" 21 | 22 | #include "KColorCells.h" 23 | #include "KColorPatch.h" 24 | #include "ViewMonitor.h" 25 | #include "CommandsModel.h" 26 | #include "CommandDelegate.h" 27 | #include "Command.h" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | CommandWidget::CommandWidget( ViewMonitor* monitor, QWidget* parent ): QWidget( parent ), mMonitor( monitor ) 37 | { 38 | QBoxLayout *mainLayout = new QVBoxLayout( this ); 39 | setLayout( mainLayout ); 40 | 41 | setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); 42 | 43 | QWidget *colorsWidget = new QWidget( this ); 44 | QHBoxLayout *hlayout = new QHBoxLayout( colorsWidget ); 45 | mPalette = new KColorCells( colorsWidget, 6, 3 ); 46 | mPalette->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 47 | mPalette->setFixedSize( 25 * 3, 25 * 6 ); 48 | mMonitor->populateCells( mPalette ); 49 | 50 | KColorCells* mBWPalette = new KColorCells( colorsWidget, 2, 1 ); 51 | mBWPalette->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 52 | mBWPalette->setFixedSize( 25, 25 * 6 ); 53 | mBWPalette->setColor( 0, Qt::black ); 54 | mBWPalette->setColor( 1, Qt::white ); 55 | 56 | const int spacing = 15; 57 | QWidget *currentCommandWidget = new QWidget( colorsWidget ); 58 | QVBoxLayout *vlayout = new QVBoxLayout( currentCommandWidget ); 59 | QWidget *patchWidget = new QWidget( currentCommandWidget ); 60 | patchWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); 61 | patchWidget->setFixedWidth( 48 + spacing ); 62 | mSecondaryPatch = new KColorPatch( patchWidget ); 63 | mSecondaryPatch->setFixedSize( 48, 48 ); 64 | mSecondaryPatch->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 65 | mSecondaryPatch->installEventFilter( this ); 66 | 67 | mPrimaryPatch = new KColorPatch( patchWidget ); 68 | mPrimaryPatch->setFixedSize( 48, 48 ); 69 | mPrimaryPatch->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 70 | 71 | QRect secRect = mPrimaryPatch->geometry(); 72 | secRect.setTopLeft( QPoint( secRect.topLeft().x() + spacing, secRect.topLeft().y() + spacing ) ); 73 | mSecondaryPatch->setGeometry( secRect ); 74 | 75 | mPrimaryCommandLabel = new QLabel( currentCommandWidget ); 76 | mPrimaryCommandLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); 77 | 78 | mSecondaryCommandLabel = new QLabel( currentCommandWidget ); 79 | mSecondaryCommandLabel->setAlignment( Qt::AlignRight ); 80 | mSecondaryCommandLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); 81 | patchWidget->setFixedHeight( 48 + spacing ); 82 | vlayout->addWidget( mPrimaryCommandLabel ); 83 | vlayout->addWidget( patchWidget ); 84 | vlayout->addWidget( mSecondaryCommandLabel ); 85 | vlayout->addStretch(); 86 | currentCommandWidget->setLayout( vlayout ); 87 | 88 | hlayout->setSpacing( 0 ); 89 | hlayout->addStretch(); 90 | hlayout->addWidget( currentCommandWidget ); 91 | hlayout->addWidget( mPalette ); 92 | hlayout->addWidget( mBWPalette ); 93 | hlayout->addStretch(); 94 | colorsWidget->setLayout( hlayout ); 95 | 96 | mCommandsModel = new CommandsModel( mMonitor, this ); 97 | mCommandsView = new QTableView( this ); 98 | mCommandsView->horizontalHeader()->hide(); 99 | mCommandsView->verticalHeader()->hide(); 100 | mCommandsView->horizontalHeader()->setResizeMode( QHeaderView::ResizeToContents ); 101 | mCommandsView->setModel( mCommandsModel ); 102 | mCommandDelegate = new CommandDelegate( mMonitor, this ); 103 | mCommandsView->setItemDelegate( mCommandDelegate ); 104 | 105 | mainLayout->insertWidget( 0, colorsWidget ); 106 | mainLayout->insertWidget( 1, mCommandsView ); 107 | mainLayout->addStretch(); 108 | 109 | connect( mPalette, SIGNAL( colorSelected( int, QColor ) ), mMonitor, SLOT( setCurrentColor( int, QColor ) ) ); 110 | connect( mPalette, SIGNAL( colorSelected( int, QColor ) ), mBWPalette, SLOT( clearSelection( ) ) ); 111 | connect( mBWPalette, SIGNAL( colorSelected( int, QColor ) ), mMonitor, SLOT( setCurrentColor( int, QColor ) ) ); 112 | connect( mBWPalette, SIGNAL( colorSelected( int, QColor ) ), mPalette, SLOT( clearSelection( ) ) ); 113 | connect( mMonitor, SIGNAL( currentCommandChanged( Command, Command ) ), mCommandsView, SLOT( reset() ) ); 114 | connect( mMonitor, SIGNAL( currentColorChanged( QColor ) ), mCommandsView, SLOT( reset() ) ); 115 | connect( mMonitor, SIGNAL( currentColorChanged( QColor ) ), mPrimaryPatch, SLOT( setColor( QColor ) ) ); 116 | connect( mMonitor, SIGNAL( currentCommandChanged( Command, Command ) ), mPalette, SLOT( clearSelection( ) ) ); 117 | connect( mMonitor, SIGNAL( currentCommandChanged( Command, Command ) ), mBWPalette, SLOT( clearSelection( ) ) ); 118 | connect( mMonitor, SIGNAL( currentCommandChanged( Command, Command ) ), this, SLOT( slotCurrentCommandChanged( Command, Command ) ) ); 119 | connect( mCommandsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( slotCommandClicked( QModelIndex ) ) ); 120 | connect( mCommandsView->horizontalHeader(), SIGNAL( geometriesChanged() ), this, SLOT( slotSetViewWidth() ) ); 121 | 122 | Command firstcmd = mCommandsModel->data( mCommandsModel->index( 0, 0 ), CommandsModel::CommandRole ).value(); 123 | mMonitor->setCurrentCommand( firstcmd ); 124 | slotSetViewWidth(); 125 | } 126 | 127 | CommandWidget::~CommandWidget() 128 | { 129 | 130 | } 131 | 132 | void CommandWidget::slotCurrentCommandChanged( const Command& newCommand, const Command& oldCommand ) 133 | { 134 | mPrimaryPatch->setColor( newCommand.color ); 135 | mPrimaryCommandLabel->setText( newCommand.name ); 136 | mSecondaryPatch->setColor( oldCommand.color ); 137 | mSecondaryCommandLabel->setText( oldCommand.name ); 138 | } 139 | 140 | void CommandWidget::slotCommandClicked( const QModelIndex& index ) 141 | { 142 | Command command = index.data( CommandsModel::CommandRole ).value(); 143 | qDebug() << "command clicked:" << command.name << command.index; 144 | mMonitor->setCurrentCommand( command ); 145 | } 146 | 147 | bool CommandWidget::eventFilter( QObject* obj, QEvent* event ) 148 | { 149 | if ( obj == mSecondaryPatch && event->type() == QEvent::MouseButtonRelease ) { 150 | QMouseEvent * mevent = static_cast( event ); 151 | if ( mevent->button() == Qt::LeftButton ) { 152 | mMonitor->takeCommand(); 153 | return true; 154 | } 155 | } 156 | return QObject::eventFilter( obj, event ); 157 | } 158 | 159 | void CommandWidget::slotSetViewWidth() 160 | { 161 | // This table will always have 3 columns. 162 | // if this changes we have bigger worries 163 | mCommandsView->resizeColumnsToContents(); 164 | int width = 0; 165 | width += mCommandsView->columnWidth( 0 ); 166 | width += mCommandsView->columnWidth( 1 ); 167 | width += mCommandsView->columnWidth( 2 ); 168 | width += mCommandsView->frameWidth(); 169 | width += 3; 170 | 171 | mCommandsView->setMinimumWidth( width ); 172 | mCommandsView->adjustSize(); 173 | adjustSize(); 174 | } 175 | 176 | 177 | #include "CommandWidget.moc" 178 | -------------------------------------------------------------------------------- /CommandWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef COMMANDWIDGET_H 21 | #define COMMANDWIDGET_H 22 | 23 | #include 24 | #include 25 | 26 | class CommandDelegate; 27 | class CommandsModel; 28 | class KColorCells; 29 | class KColorPatch; 30 | class QLabel; 31 | class Command; 32 | class ViewMonitor; 33 | class QEvent; 34 | class QTableView; 35 | 36 | class CommandWidget : public QWidget 37 | { 38 | Q_OBJECT 39 | public: 40 | CommandWidget( ViewMonitor* monitor, QWidget* parent = 0 ); 41 | virtual ~CommandWidget(); 42 | 43 | virtual bool eventFilter( QObject* obj, QEvent* event ); 44 | 45 | public slots: 46 | void slotCurrentCommandChanged( const Command & newCommand, const Command & oldCommand ); 47 | 48 | private slots: 49 | void slotCommandClicked( const QModelIndex &index ); 50 | 51 | void slotSetViewWidth(); 52 | private: 53 | CommandsModel *mCommandsModel; 54 | CommandDelegate* mCommandDelegate; 55 | KColorCells* mPalette; 56 | KColorPatch* mPrimaryPatch; 57 | KColorPatch* mSecondaryPatch; 58 | QLabel *mPrimaryCommandLabel; 59 | QLabel *mSecondaryCommandLabel; 60 | ViewMonitor *mMonitor; 61 | QTableView *mCommandsView; 62 | 63 | }; 64 | 65 | #endif // COMMANDWIDGET_H 66 | -------------------------------------------------------------------------------- /CommandsModel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "CommandsModel.h" 21 | 22 | #include "ViewMonitor.h" 23 | 24 | #include 25 | 26 | /* 27 | the commands based on the color changes: 28 | 29 | Commands 30 | Lightness change 31 | Hue change None 1 Darker 2 Darker 32 | 33 | None push pop 34 | 1 Step add subtract multiply 35 | 2 Steps divide mod not 36 | 3 Steps greater pointer switch 37 | 4 Steps duplicate roll in(number) 38 | 5 Steps in(char) out(number) out(char) 39 | */ 40 | CommandsModel::CommandsModel( ViewMonitor* monitor, QObject* parent ): QAbstractTableModel( parent ), mMonitor( monitor ) 41 | { 42 | mCommands.insert( 0, Command( "nop", "Null" ) ); 43 | mCommands.insert( 1, Command( "add", "" ) ); 44 | mCommands.insert( 2, Command( "divide", "" ) ); 45 | mCommands.insert( 3, Command( "greater", "" ) ); 46 | mCommands.insert( 4, Command( "duplicate", "" ) ); 47 | mCommands.insert( 5, Command( "in(char)", "" ) ); 48 | 49 | mCommands.insert( 6, Command( "push", "" ) ); 50 | mCommands.insert( 7, Command( "subtract", "" ) ); 51 | mCommands.insert( 8, Command( "mod", "" ) ); 52 | mCommands.insert( 9, Command( "pointer", "" ) ); 53 | mCommands.insert( 10, Command( "roll", "" ) ); 54 | mCommands.insert( 11, Command( "out(number)", "" ) ); 55 | 56 | mCommands.insert( 12, Command( "pop", "" ) ); 57 | mCommands.insert( 13, Command( "multiply", "" ) ); 58 | mCommands.insert( 14, Command( "not", "" ) ); 59 | mCommands.insert( 15, Command( "switch", "" ) ); 60 | mCommands.insert( 16, Command( "in(number)", "" ) ); 61 | mCommands.insert( 17, Command( "out(char)", "" ) ); 62 | 63 | } 64 | 65 | QVariant CommandsModel::data( const QModelIndex& index, int role ) const 66 | { 67 | if ( !index.isValid() ) 68 | return QVariant(); 69 | 70 | Q_ASSERT( index.row() < 7 && index.column() < 4 ); 71 | 72 | switch ( role ) { 73 | case Qt::DisplayRole: 74 | return mCommands.at( index.row() + index.column() * 6 ).name; 75 | case Qt::BackgroundRole: 76 | return mMonitor->colorForIndex( colorIndex( index ) ); 77 | case CommandsModel::ColorIndexRole: 78 | return colorIndex( index ); 79 | case CommandsModel::CommandRole: { 80 | Command command = mCommands.at( index.row() + index.column() * 6 ); 81 | command.index = colorIndex( index ); 82 | command.color = mMonitor->colorForIndex( colorIndex( index ) ); 83 | return QVariant::fromValue( command ); 84 | } 85 | default: 86 | return QVariant(); 87 | } 88 | } 89 | 90 | int CommandsModel::colorIndex( const QModelIndex& index ) const 91 | { 92 | int cmdIdx = index.row() + index.column() * 6; 93 | int cmdHue = cmdIdx % 6; 94 | int cmdLight = ( ( cmdIdx / 6 ) + 3 ) % 3; 95 | 96 | int curColorIdx = mMonitor->currentColorIndex(); 97 | int newColorY = ( ( curColorIdx / 3 ) + cmdHue ) % 6; 98 | int newColorX = ( ( curColorIdx % 3 ) + cmdLight ) % 3; 99 | int newColorIdx = ( newColorX ) + ( newColorY * 3 ); 100 | // if( mCommands.at( index.row() + index.column() * 6 ).name == "add" ) { 101 | // qDebug() << curColorIdx<< "(" << newColorX << "," << newColorY << ")" << newColorIdx; 102 | // } 103 | return newColorIdx; 104 | } 105 | 106 | 107 | int CommandsModel::rowCount( const QModelIndex& parent ) const 108 | { 109 | return 6; 110 | } 111 | 112 | int CommandsModel::columnCount( const QModelIndex& parent ) const 113 | { 114 | return 3; 115 | } 116 | 117 | 118 | -------------------------------------------------------------------------------- /CommandsModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef COMMANDSMODEL_H 21 | #define COMMANDSMODEL_H 22 | 23 | #include "Command.h" 24 | 25 | #include 26 | #include 27 | 28 | class ViewMonitor; 29 | class CommandsModel : public QAbstractTableModel 30 | { 31 | Q_ENUMS( CommandRoles ) 32 | public: 33 | enum CommandRoles { 34 | ColorIndexRole = Qt::UserRole, 35 | CommandRole 36 | }; 37 | 38 | explicit CommandsModel( ViewMonitor* monitor, QObject* parent ); 39 | virtual ~CommandsModel() {} 40 | 41 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; 42 | int rowCount(const QModelIndex& parent = QModelIndex()) const; 43 | int columnCount( const QModelIndex& parent = QModelIndex() ) const; 44 | 45 | private: 46 | inline int colorIndex( const QModelIndex& index ) const; 47 | QVector mCommands; 48 | ViewMonitor *mMonitor; 49 | }; 50 | 51 | #endif // COMMANDSMODEL_H 52 | -------------------------------------------------------------------------------- /DebugWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef DEBUGWIDGET_H 21 | #define DEBUGWIDGET_H 22 | 23 | #include "ui_DebugWidget.h" 24 | #include "Command.h" 25 | #include "FlowCompass.h" 26 | 27 | #include 28 | 29 | struct trace_step; 30 | struct trace_action; 31 | class ImageModel; 32 | class DebugWidget : public QWidget, public Ui_DebugUi 33 | { 34 | Q_OBJECT 35 | public: 36 | DebugWidget( ImageModel* model, QWidget* parent = 0, Qt::WindowFlags f = 0 ); 37 | virtual ~DebugWidget(); 38 | 39 | public slots: 40 | void slotStepped( trace_step* ); 41 | void slotActionChanged( trace_action* ); 42 | void slotDebugStopped(); 43 | void slotDebugStarted(); 44 | 45 | private: 46 | void changeCurrent( int idx ); 47 | Command command( int light_change, int hue_change ); 48 | ImageModel* mImageModel; 49 | FlowCompass *mFlowCompass; 50 | }; 51 | 52 | #endif // DEBUGWIDGET_H 53 | -------------------------------------------------------------------------------- /DebugWidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DebugUi 4 | 5 | 6 | 7 | 0 8 | 0 9 | 239 10 | 539 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | Current Codel 27 | 28 | 29 | 30 | 31 | 32 | 33 | 0 34 | 0 35 | 36 | 37 | 38 | 0 39 | 40 | 41 | 42 | 43 | 0 44 | 0 45 | 46 | 47 | 48 | 49 | 16777215 50 | 16777215 51 | 52 | 53 | 54 | 55 | -1 56 | 57 | 58 | 0 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Value: 71 | 72 | 73 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 0,0 88 | 89 | 90 | Qt::AlignCenter 91 | 92 | 93 | 94 | 95 | 96 | 97 | Command: 98 | 99 | 100 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | Program not Running 112 | 113 | 114 | Qt::AlignCenter 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 0 130 | 0 131 | 132 | 133 | 134 | Flow Compass 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 0 144 | 0 145 | 146 | 147 | 148 | Stack 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | The state of the stack before the current codel was evaluated. 157 | 158 | 159 | Before: 160 | 161 | 162 | Qt::AlignCenter 163 | 164 | 165 | 166 | 167 | 168 | 169 | The state of the stack before the current codel was evaluated. 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | The state of the stack after the current codel was evaluated. 181 | 182 | 183 | After: 184 | 185 | 186 | Qt::AlignCenter 187 | 188 | 189 | 190 | 191 | 192 | 193 | The state of the stack after the current codel was evaluated. 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /FlowCompass.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Casey Link 3 | * 4 | * This library is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Library General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public License 15 | * along with this library; see the file COPYING.LIB. If not, write to the 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "FlowCompass.h" 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | const qreal Pi = 3.14; 29 | 30 | FlowCompass::FlowCompass( QWidget* parent ) : 31 | QWidget( parent ), 32 | mCCDirection( FlowCompass::Left ), 33 | mDPDirection( FlowCompass::Right ), 34 | mDPColor( 0xa4, 0x00, 0x00 ), 35 | mCCColor( 0x4e, 0x9a, 0x06 ), 36 | mArrowSize( 20 ), 37 | mPadding( 5 ) 38 | { 39 | setMinimumSize( 100, 100 ); 40 | } 41 | 42 | void FlowCompass::reset() 43 | { 44 | mCCDirection = FlowCompass::Left; 45 | mDPDirection = FlowCompass::Right; 46 | } 47 | 48 | FlowCompass::~FlowCompass() 49 | { 50 | 51 | } 52 | 53 | 54 | QSize FlowCompass::sizeHint() const 55 | { 56 | return QSize( 100, 100 ); 57 | } 58 | 59 | void FlowCompass::paintEvent( QPaintEvent* ) 60 | { 61 | QPainter painter( this ); 62 | paintDPArrow( painter ); 63 | paintCCArrow( painter ); 64 | 65 | QPen pen = QPen( Qt::black, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ); 66 | QFont font = painter.font(); 67 | font.setBold( true ); 68 | QFontMetrics fm( font ); 69 | painter.setFont( font ); 70 | 71 | pen.setColor( mDPColor ); 72 | painter.setPen( pen ); 73 | painter.drawText( mPadding, mPadding*2, "DP" ); 74 | pen.setColor( mCCColor ); 75 | painter.setPen( pen ); 76 | painter.drawText( mPadding, mPadding*2 + fm.height(), "CC" ); 77 | } 78 | 79 | void FlowCompass::paintCCArrow( QPainter &painter ) 80 | { 81 | // The CC arrow is relative to the DP. 82 | // So if the DP arrow is pointing right, and the CC is left, 83 | // then the absolute direction of the CC is up 84 | // This conversion is very ugly, 85 | // TODO find a more elegant solution 86 | Direction ccAbsoluteDirection; 87 | switch ( mDPDirection ) { 88 | case FlowCompass::Right: 89 | ccAbsoluteDirection = mCCDirection == FlowCompass::Right ? FlowCompass::Down : FlowCompass::Up; 90 | qDebug() << "DP Right" << "CC: " << ccAbsoluteDirection; 91 | break; 92 | case FlowCompass::Left: 93 | ccAbsoluteDirection = mCCDirection == FlowCompass::Right ? FlowCompass::Up : FlowCompass::Down; 94 | break; 95 | case FlowCompass::Up: 96 | ccAbsoluteDirection = mCCDirection == FlowCompass::Right ? FlowCompass::Right : FlowCompass::Left; 97 | break; 98 | case FlowCompass::Down: 99 | ccAbsoluteDirection = mCCDirection == FlowCompass::Right ? FlowCompass::Left : FlowCompass::Right; 100 | break; 101 | default: 102 | return; 103 | } 104 | QRect bounds( visibleRegion().boundingRect() ); 105 | QSize boundsSz = bounds.size(); 106 | int smallest_side = qMin( boundsSz.width(), boundsSz.height() ); 107 | boundsSz.scale( smallest_side - mArrowSize - mPadding, smallest_side - mArrowSize - mPadding, Qt::IgnoreAspectRatio); 108 | bounds.setSize( boundsSz ); 109 | bounds.moveCenter( visibleRegion().boundingRect().center() ); 110 | QPoint center( bounds.center() ); 111 | QPoint end; 112 | switch ( ccAbsoluteDirection ) { 113 | case FlowCompass::Right: 114 | end.setX( bounds.right() ); 115 | end.setY( center.y() ); 116 | break; 117 | case FlowCompass::Left: 118 | end.setX( bounds.left() ); 119 | end.setY( center.y() ); 120 | break; 121 | case FlowCompass::Up: 122 | end.setX( center.x() ); 123 | end.setY( bounds.top() ); 124 | break; 125 | case FlowCompass::Down: 126 | end.setX( center.x() ); 127 | end.setY( bounds.bottom() ); 128 | break; 129 | default: 130 | return; 131 | } 132 | 133 | QLine dpLine( center, end ); 134 | QVector arrowHead = calculateArrowHead( dpLine, bounds, mArrowSize, ccAbsoluteDirection ); 135 | 136 | painter.save(); 137 | QPen pen = QPen( Qt::black, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ); 138 | painter.setPen( pen ); 139 | painter.setRenderHint( QPainter::Antialiasing ); 140 | painter.setBrush( mCCColor ); 141 | painter.drawLine( dpLine ); 142 | painter.drawPolygon( arrowHead ); 143 | pen.setColor( Qt::black ); 144 | painter.restore(); 145 | } 146 | 147 | void FlowCompass::paintDPArrow( QPainter &painter ) 148 | { 149 | QRect bounds( visibleRegion().boundingRect() ); 150 | QSize boundsSz = bounds.size(); 151 | int smallest_side = qMin( boundsSz.width(), boundsSz.height() ); 152 | boundsSz.scale( smallest_side - mArrowSize - mPadding, smallest_side - mArrowSize - mPadding, Qt::IgnoreAspectRatio); 153 | bounds.setSize( boundsSz ); 154 | bounds.moveCenter( visibleRegion().boundingRect().center() ); 155 | QPoint center( bounds.center() ); 156 | QPoint end; 157 | switch ( mDPDirection ) { 158 | case FlowCompass::Right: 159 | end.setX( bounds.right() ); 160 | end.setY( center.y() ); 161 | break; 162 | case FlowCompass::Left: 163 | end.setX( bounds.left() ); 164 | end.setY( center.y() ); 165 | break; 166 | case FlowCompass::Up: 167 | end.setX( center.x() ); 168 | end.setY( bounds.top() ); 169 | break; 170 | case FlowCompass::Down: 171 | end.setX( center.x() ); 172 | end.setY( bounds.bottom() ); 173 | break; 174 | default: 175 | return; 176 | } 177 | 178 | QLine dpLine( center, end ); 179 | QVector arrowHead = calculateArrowHead( dpLine, bounds, mArrowSize, mDPDirection ); 180 | 181 | painter.save(); 182 | QPen pen = QPen( Qt::black, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ); 183 | painter.setPen( pen ); 184 | painter.setRenderHint( QPainter::Antialiasing ); 185 | painter.setBrush( mDPColor ); 186 | painter.drawLine( dpLine ); 187 | painter.drawPolygon( arrowHead ); 188 | painter.restore(); 189 | } 190 | 191 | QVector FlowCompass::calculateArrowHead( QLine line, QRect bounds, qreal arrowSize, Direction direction ) 192 | { 193 | double angle = ::acos( (double)( line.dx() / bounds.width() ) ); 194 | if ( line.p2().x() < line.p1().x() || line.p2().y() < line.p1().y() ) 195 | angle = ( Pi * 2 ) - angle; 196 | 197 | QPoint arrowP1, arrowP2; 198 | QVector arrowHead; 199 | 200 | if ( direction == FlowCompass::Right || direction == FlowCompass::Left ) { 201 | arrowP1 = line.p2() + QPoint( cos( angle + Pi / 3 ) * arrowSize, 202 | sin( angle + Pi / 3 ) * arrowSize ); 203 | arrowP2 = line.p2() + QPoint( cos( angle + Pi - Pi / 3 ) * arrowSize, 204 | sin( angle + Pi - Pi / 3 ) * arrowSize ); 205 | } else { 206 | arrowP1 = line.p2() + QPoint( sin( angle + Pi / 3 ) * arrowSize, 207 | cos( angle + Pi / 3 ) * arrowSize ); 208 | arrowP2 = line.p2() + QPoint( sin( angle + Pi - Pi / 3 ) * arrowSize, 209 | cos( angle + Pi - Pi / 3 ) * arrowSize ); 210 | } 211 | arrowHead << line.p2() << arrowP1 << arrowP2; 212 | return arrowHead; 213 | } 214 | 215 | 216 | void FlowCompass::setCCDirection( const FlowCompass::Direction& direction ) 217 | { 218 | mCCDirection = direction; 219 | update(); 220 | } 221 | 222 | void FlowCompass::setDPDirection( const FlowCompass::Direction& direction ) 223 | { 224 | mDPDirection = direction; 225 | update(); 226 | } 227 | 228 | 229 | #include "FlowCompass.moc" 230 | 231 | -------------------------------------------------------------------------------- /FlowCompass.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Casey Link 3 | * 4 | * This library is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Library General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public License 15 | * along with this library; see the file COPYING.LIB. If not, write to the 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef FLOWCOMPASS_H 21 | #define FLOWCOMPASS_H 22 | 23 | #include 24 | 25 | class QPainter; 26 | 27 | class FlowCompass : public QWidget 28 | { 29 | Q_OBJECT 30 | public: 31 | 32 | enum Direction { 33 | Left = 0, 34 | Right, 35 | Up, 36 | Down 37 | }; 38 | 39 | FlowCompass( QWidget * parent ); 40 | virtual ~FlowCompass(); 41 | 42 | virtual QSize sizeHint() const; 43 | 44 | void setCCDirection( const Direction &direction ); 45 | void setDPDirection( const Direction &direction ); 46 | 47 | void reset(); 48 | 49 | protected: 50 | virtual void paintEvent(QPaintEvent* ); 51 | 52 | private: 53 | void paintDPArrow( QPainter &p ); 54 | void paintCCArrow( QPainter &p ); 55 | 56 | QVector< QPoint > calculateArrowHead( QLine line, QRect bounds, qreal arrowSize, Direction direction ); 57 | 58 | Direction mCCDirection; 59 | Direction mDPDirection; 60 | 61 | QColor mCCColor; 62 | QColor mDPColor; 63 | 64 | int mPadding; 65 | int mArrowSize; 66 | }; 67 | 68 | #endif // FLOWCOMPASS_H 69 | -------------------------------------------------------------------------------- /ImageModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | #ifndef IMAGEMODEL_H 20 | #define IMAGEMODEL_H 21 | 22 | #include 23 | #include 24 | class QBitArray; 25 | class ImageModel : public QAbstractTableModel 26 | { 27 | Q_OBJECT 28 | public: 29 | 30 | enum ImageRoles { 31 | IsCurrentDebugRole = Qt::UserRole, 32 | ContiguousBlocksRole 33 | }; 34 | 35 | explicit ImageModel( QObject *parent = 0 ); 36 | virtual ~ImageModel(); 37 | 38 | /** 39 | * Sets the image to expose via the model 40 | * If codel size is not specified, then the model guesses. 41 | */ 42 | void setImage( const QImage &image, int codel_size = -1 ); 43 | 44 | /** 45 | * Sets the current image to a new image. 46 | * All pixels are filled white. 47 | * @param w width of the new image 48 | * @param h height of the new image 49 | */ 50 | void newImage( int w, int h ); 51 | QImage image() const; 52 | 53 | /** 54 | * Insert the image at the specified x,y coord 55 | */ 56 | void insertImage( const QImage &image, int x, int y); 57 | 58 | void scaleImage( const QSize & size ); 59 | QSize imageSize() const; 60 | 61 | void setDebuggedPixel( int x, int y ); 62 | void setBreakpoint( int x, int y ); 63 | 64 | int rowCount( const QModelIndex &parent = QModelIndex() ) const; 65 | int columnCount( const QModelIndex &parent = QModelIndex() ) const; 66 | 67 | QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; 68 | QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; 69 | 70 | bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ); 71 | static QImage autoScale(const QImage& _image, int codel_size); 72 | 73 | signals: 74 | void pixelChanged( int x, int y, QRgb color ); 75 | 76 | public slots: 77 | /*! This is a very bad hack. 78 | headerData() needs to know the current pixel size (IN THE VIEW!) in order 79 | to return a correct SizeHint, otherwise things get screwy. 80 | Note: this pixel information is only used by headerData to return a SizeHint 81 | It does not affect the backend image data at all 82 | */ 83 | void slotPixelSizeChange( int size ); 84 | private: 85 | void emitNeighborsChanged( int row, int col ); 86 | QString statusString( QModelIndex index ) const; 87 | quint64 contiguousBlocks( int x, int y ) const; 88 | QImage mImage; 89 | int mPixelSize; 90 | 91 | QPoint mDebugPixel; 92 | }; 93 | 94 | #endif // IMAGEMODEL_H 95 | -------------------------------------------------------------------------------- /KColorCells.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | This file was part of the KDE libraries 4 | Copyright (C) 1997 Martin Jones (mjones@kde.org) 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Library General Public 8 | License as published by the Free Software Foundation; either 9 | version 2 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Library General Public License for more details. 15 | 16 | You should have received a copy of the GNU Library General Public License 17 | along with this library; see the file COPYING.LIB. If not, write to 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 | Boston, MA 02110-1301, USA. 20 | */ 21 | #ifndef KCOLORCELLS_H 22 | #define KCOLORCELLS_H 23 | 24 | #include 25 | 26 | class QMouseEvent; 27 | class QDragEnterEvent; 28 | class QDropEvent; 29 | /** 30 | * A table of editable color cells. 31 | * 32 | * @author Martin Jones 33 | */ 34 | class KColorCells : public QTableWidget 35 | { 36 | Q_OBJECT 37 | public: 38 | /** 39 | * Constructs a new table of color cells, consisting of 40 | * @p rows * @p columns colors. 41 | * 42 | * @param parent The parent of the new widget 43 | * @param rows The number of rows in the table 44 | * @param columns The number of columns in the table 45 | */ 46 | KColorCells( QWidget *parent, int rows, int columns ); 47 | ~KColorCells(); 48 | 49 | /** Sets the color in the given index in the table */ 50 | void setColor( int index, const QColor &col ); 51 | /** Returns the color at a given index in the table */ 52 | QColor color( int index ) const; 53 | /** Returns the total number of color cells in the table */ 54 | int count() const; 55 | 56 | void setShading(bool shade); 57 | void setAcceptDrags(bool acceptDrags); 58 | 59 | /** Returns the index of the cell which is currently selected */ 60 | int selectedIndex() const; 61 | 62 | Q_SIGNALS: 63 | /** Emitted when a color is selected in the table */ 64 | void colorSelected( int index , const QColor& color ); 65 | /** Emitted when a color in the table is double-clicked */ 66 | void colorDoubleClicked( int index , const QColor& color ); 67 | 68 | public slots: 69 | /** Sets the currently selected cell to @p index */ 70 | void setSelected( int index ); 71 | 72 | protected: 73 | // the three methods below are used to ensure equal column widths and row heights 74 | // for all cells and to update the widths/heights when the widget is resized 75 | virtual int sizeHintForColumn(int column) const; 76 | virtual int sizeHintForRow(int column) const; 77 | virtual void resizeEvent( QResizeEvent* event ); 78 | 79 | virtual void mouseReleaseEvent( QMouseEvent * ); 80 | virtual void mousePressEvent( QMouseEvent * ); 81 | virtual void mouseMoveEvent( QMouseEvent * ); 82 | virtual void dragEnterEvent( QDragEnterEvent * ); 83 | virtual void dragMoveEvent( QDragMoveEvent * ); 84 | virtual void dropEvent( QDropEvent *); 85 | virtual void mouseDoubleClickEvent( QMouseEvent * ); 86 | virtual void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected); 87 | 88 | int positionToCell(const QPoint &pos, bool ignoreBorders=false) const; 89 | 90 | private: 91 | class KColorCellsPrivate; 92 | friend class KColorCellsPrivate; 93 | KColorCellsPrivate *const d; 94 | 95 | Q_DISABLE_COPY(KColorCells) 96 | }; 97 | #endif //KCOLORCELLS_H 98 | -------------------------------------------------------------------------------- /KColorMimeData.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 1999 Steffen Hansen (hansen@kde.org) 3 | Copyright (C) 2005 Joseph Wenninger (jowenn@kde.org) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public License 16 | along with this library; see the file COPYING.LIB. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #include "KColorMimeData.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | void 29 | KColorMimeData::populateMimeData( QMimeData *mimeData, const QColor &color ) 30 | { 31 | mimeData->setColorData( color ); 32 | mimeData->setText( color.name() ); 33 | } 34 | 35 | bool 36 | KColorMimeData::canDecode( const QMimeData *mimeData ) 37 | { 38 | if ( mimeData->hasColor() ) 39 | return true; 40 | if ( mimeData->hasText() ) { 41 | const QString colorName = mimeData->text(); 42 | if ( ( colorName.length() >= 4 ) && ( colorName[0] == '#' ) ) 43 | return true; 44 | } 45 | return false; 46 | } 47 | 48 | QColor 49 | KColorMimeData::fromMimeData( const QMimeData *mimeData ) 50 | { 51 | if ( mimeData->hasColor() ) 52 | return mimeData->colorData().value(); 53 | if ( canDecode( mimeData ) ) 54 | return QColor( mimeData->text() ); 55 | return QColor(); 56 | } 57 | 58 | 59 | QDrag* 60 | KColorMimeData::createDrag( const QColor &color, QWidget *dragsource ) 61 | { 62 | QDrag *drag = new QDrag( dragsource ); 63 | QMimeData *mime = new QMimeData; 64 | populateMimeData( mime, color ); 65 | drag->setMimeData( mime ); 66 | QPixmap colorpix( 25, 20 ); 67 | colorpix.fill( color ); 68 | QPainter p( &colorpix ); 69 | p.setPen( Qt::black ); 70 | p.drawRect( 0, 0, 24, 19 ); 71 | p.end(); 72 | drag->setPixmap( colorpix ); 73 | drag->setHotSpot( QPoint( -5, -7 ) ); 74 | return drag; 75 | } 76 | -------------------------------------------------------------------------------- /KColorMimeData.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 1999 Steffen Hansen (hansen@kde.org) 3 | Copyright (C) 2005 Joseph Wenninger (jowenn@kde.org) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public License 16 | along with this library; see the file COPYING.LIB. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef _KCOLORMIMEDATA_H 22 | #define _KCOLORMIMEDATA_H 23 | 24 | class QColor; 25 | class QDrag; 26 | class QMimeData; 27 | class QWidget; 28 | 29 | /** 30 | * Drag-and-drop and clipboard mimedata manipulation for QColor objects. The according MIME type 31 | * is set to application/x-color. 32 | * 33 | * See the Qt drag'n'drop documentation. 34 | */ 35 | namespace KColorMimeData 36 | { 37 | /** 38 | * Sets the color and text representation fields for the specified color in the mimedata object: 39 | * application/x-color and text/plain types are set 40 | */ 41 | void populateMimeData(QMimeData *mimeData, const QColor& color); 42 | 43 | /** 44 | * Returns true if the MIME data @p mimeData contains a color object. 45 | * First checks for application/x-color and if that fails, for a text/plain entry, which 46 | * represents a color in the format \#hexnumbers 47 | */ 48 | bool canDecode(const QMimeData *mimeData); 49 | 50 | /** 51 | * Decodes the MIME data @p mimeData and returns the resulting color. 52 | * First tries application/x-color and if that fails, a text/plain entry, which 53 | * represents a color in the format \#hexnumbers. If this fails too, 54 | * an invalid QColor object is returned, use QColor::isValid() to test it. 55 | */ 56 | QColor fromMimeData(const QMimeData *mimeData); 57 | 58 | /** 59 | * Creates a color drag object. Either you have to start this drag or delete it 60 | * The drag object's mime data has the application/x-color and text/plain type set and a pixmap 61 | * filled with the specified color, which is going to be displayed next to the mouse cursor 62 | */ 63 | QDrag* createDrag(const QColor& color, QWidget *dragsource); 64 | } 65 | 66 | 67 | #endif // _KCOLORMIMEDATA_H 68 | -------------------------------------------------------------------------------- /KColorPatch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | This file was part of the KDE libraries 4 | Copyright (C) 1997 Martin Jones (mjones@kde.org) 5 | Copyright (C) 2007 Roberto Raggi (roberto@kdevelop.org) 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Library General Public 9 | License as published by the Free Software Foundation; either 10 | version 2 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Library General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public License 18 | along with this library; see the file COPYING.LIB. If not, write to 19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 | Boston, MA 02110-1301, USA. 21 | */ 22 | #include "KColorPatch.h" 23 | 24 | #include "KColorMimeData.h" 25 | 26 | #include 27 | 28 | class KColorPatch::KColorPatchPrivate 29 | { 30 | public: 31 | KColorPatchPrivate( KColorPatch *q ): q( q ) {} 32 | 33 | KColorPatch *q; 34 | QColor color; 35 | }; 36 | 37 | KColorPatch::KColorPatch( QWidget *parent ) : QFrame( parent ), d( new KColorPatchPrivate( this ) ) 38 | { 39 | setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); 40 | setAcceptDrops( true ); 41 | setMinimumSize( 12, 12 ); 42 | } 43 | 44 | KColorPatch::~KColorPatch() 45 | { 46 | delete d; 47 | } 48 | 49 | QColor KColorPatch::color() const 50 | { 51 | return d->color; 52 | } 53 | 54 | void KColorPatch::setColor( const QColor &col ) 55 | { 56 | QColor old = d->color; 57 | d->color = col.toRgb(); 58 | 59 | update(); 60 | emit colorChanged( d->color, old ); 61 | } 62 | 63 | void KColorPatch::paintEvent( QPaintEvent* pe ) 64 | { 65 | QFrame::paintEvent( pe ); 66 | QPainter painter( this ); 67 | 68 | painter.fillRect( contentsRect(), d->color ); 69 | } 70 | 71 | void KColorPatch::mouseMoveEvent( QMouseEvent *e ) 72 | { 73 | // Drag color object 74 | if ( !( e->buttons() & Qt::LeftButton ) ) 75 | return; 76 | KColorMimeData::createDrag( d->color, this )->start(); 77 | } 78 | 79 | void KColorPatch::dragEnterEvent( QDragEnterEvent *event ) 80 | { 81 | event->setAccepted( KColorMimeData::canDecode( event->mimeData() ) ); 82 | } 83 | 84 | void KColorPatch::dropEvent( QDropEvent *event ) 85 | { 86 | QColor c = KColorMimeData::fromMimeData( event->mimeData() ); 87 | if ( c.isValid() ) { 88 | QColor old = d->color; 89 | setColor( c ); 90 | emit colorChanged( c, old ); 91 | } 92 | } 93 | 94 | #include "KColorPatch.moc" 95 | -------------------------------------------------------------------------------- /KColorPatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | This file was part of the KDE libraries 4 | Copyright (C) 1997 Martin Jones (mjones@kde.org) 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Library General Public 8 | License as published by the Free Software Foundation; either 9 | version 2 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Library General Public License for more details. 15 | 16 | You should have received a copy of the GNU Library General Public License 17 | along with this library; see the file COPYING.LIB. If not, write to 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 | Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef KCOLORPATCH_H 23 | #define KCOLORPATCH_H 24 | 25 | #include 26 | 27 | class QMouseEvent; 28 | class QDragEnterEvent; 29 | class QDropEvent; 30 | 31 | /** 32 | * @short A color displayer. 33 | * 34 | * The KColorPatch widget is a (usually small) widget showing 35 | * a selected color e.g. in the KColorDialog. It 36 | * automatically handles drag and drop from and on the widget. 37 | * 38 | * \image html kcolorpatch.png "KDE Color Patch" 39 | */ 40 | class KColorPatch : public QFrame 41 | { 42 | Q_OBJECT 43 | Q_PROPERTY(QColor color READ color WRITE setColor) 44 | 45 | public: 46 | KColorPatch( QWidget *parent ); 47 | virtual ~KColorPatch(); 48 | 49 | /** 50 | * Get the currently displayed color 51 | */ 52 | QColor color() const; 53 | 54 | public slots: 55 | /** 56 | * Set the color to display and update the display 57 | * 58 | * @param col color to display 59 | */ 60 | void setColor( const QColor &col ); 61 | 62 | Q_SIGNALS: 63 | /** 64 | * This signal is emitted whenever the current color 65 | * changes due to a drop event 66 | */ 67 | void colorChanged( const QColor& newColor, const QColor& oldColor ); 68 | 69 | protected: 70 | virtual void paintEvent ( QPaintEvent * pe ); 71 | virtual void mouseMoveEvent( QMouseEvent * ); 72 | virtual void dragEnterEvent( QDragEnterEvent *); 73 | virtual void dropEvent( QDropEvent *); 74 | 75 | private: 76 | class KColorPatchPrivate; 77 | KColorPatchPrivate *const d; 78 | 79 | Q_DISABLE_COPY(KColorPatch) 80 | }; 81 | 82 | #endif //KCOLORPATCH_H 83 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | All files in the Piet Creator project are licensed under the GPL v3, as defined below. 2 | Certain files are excepted due to previous existing licenses, these have been noted 3 | where applicable. 4 | 5 | GNU LESSER GENERAL PUBLIC LICENSE 6 | Version 3, 29 June 2007 7 | 8 | Copyright (C) 2007 Free Software Foundation, Inc. 9 | Everyone is permitted to copy and distribute verbatim copies 10 | of this license document, but changing it is not allowed. 11 | 12 | 13 | This version of the GNU Lesser General Public License incorporates 14 | the terms and conditions of version 3 of the GNU General Public 15 | License, supplemented by the additional permissions listed below. 16 | 17 | 0. Additional Definitions. 18 | 19 | As used herein, "this License" refers to version 3 of the GNU Lesser 20 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 21 | General Public License. 22 | 23 | "The Library" refers to a covered work governed by this License, 24 | other than an Application or a Combined Work as defined below. 25 | 26 | An "Application" is any work that makes use of an interface provided 27 | by the Library, but which is not otherwise based on the Library. 28 | Defining a subclass of a class defined by the Library is deemed a mode 29 | of using an interface provided by the Library. 30 | 31 | A "Combined Work" is a work produced by combining or linking an 32 | Application with the Library. The particular version of the Library 33 | with which the Combined Work was made is also called the "Linked 34 | Version". 35 | 36 | The "Minimal Corresponding Source" for a Combined Work means the 37 | Corresponding Source for the Combined Work, excluding any source code 38 | for portions of the Combined Work that, considered in isolation, are 39 | based on the Application, and not on the Linked Version. 40 | 41 | The "Corresponding Application Code" for a Combined Work means the 42 | object code and/or source code for the Application, including any data 43 | and utility programs needed for reproducing the Combined Work from the 44 | Application, but excluding the System Libraries of the Combined Work. 45 | 46 | 1. Exception to Section 3 of the GNU GPL. 47 | 48 | You may convey a covered work under sections 3 and 4 of this License 49 | without being bound by section 3 of the GNU GPL. 50 | 51 | 2. Conveying Modified Versions. 52 | 53 | If you modify a copy of the Library, and, in your modifications, a 54 | facility refers to a function or data to be supplied by an Application 55 | that uses the facility (other than as an argument passed when the 56 | facility is invoked), then you may convey a copy of the modified 57 | version: 58 | 59 | a) under this License, provided that you make a good faith effort to 60 | ensure that, in the event an Application does not supply the 61 | function or data, the facility still operates, and performs 62 | whatever part of its purpose remains meaningful, or 63 | 64 | b) under the GNU GPL, with none of the additional permissions of 65 | this License applicable to that copy. 66 | 67 | 3. Object Code Incorporating Material from Library Header Files. 68 | 69 | The object code form of an Application may incorporate material from 70 | a header file that is part of the Library. You may convey such object 71 | code under terms of your choice, provided that, if the incorporated 72 | material is not limited to numerical parameters, data structure 73 | layouts and accessors, or small macros, inline functions and templates 74 | (ten or fewer lines in length), you do both of the following: 75 | 76 | a) Give prominent notice with each copy of the object code that the 77 | Library is used in it and that the Library and its use are 78 | covered by this License. 79 | 80 | b) Accompany the object code with a copy of the GNU GPL and this license 81 | document. 82 | 83 | 4. Combined Works. 84 | 85 | You may convey a Combined Work under terms of your choice that, 86 | taken together, effectively do not restrict modification of the 87 | portions of the Library contained in the Combined Work and reverse 88 | engineering for debugging such modifications, if you also do each of 89 | the following: 90 | 91 | a) Give prominent notice with each copy of the Combined Work that 92 | the Library is used in it and that the Library and its use are 93 | covered by this License. 94 | 95 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 96 | document. 97 | 98 | c) For a Combined Work that displays copyright notices during 99 | execution, include the copyright notice for the Library among 100 | these notices, as well as a reference directing the user to the 101 | copies of the GNU GPL and this license document. 102 | 103 | d) Do one of the following: 104 | 105 | 0) Convey the Minimal Corresponding Source under the terms of this 106 | License, and the Corresponding Application Code in a form 107 | suitable for, and under terms that permit, the user to 108 | recombine or relink the Application with a modified version of 109 | the Linked Version to produce a modified Combined Work, in the 110 | manner specified by section 6 of the GNU GPL for conveying 111 | Corresponding Source. 112 | 113 | 1) Use a suitable shared library mechanism for linking with the 114 | Library. A suitable mechanism is one that (a) uses at run time 115 | a copy of the Library already present on the user's computer 116 | system, and (b) will operate properly with a modified version 117 | of the Library that is interface-compatible with the Linked 118 | Version. 119 | 120 | e) Provide Installation Information, but only if you would otherwise 121 | be required to provide such information under section 6 of the 122 | GNU GPL, and only to the extent that such information is 123 | necessary to install and execute a modified version of the 124 | Combined Work produced by recombining or relinking the 125 | Application with a modified version of the Linked Version. (If 126 | you use option 4d0, the Installation Information must accompany 127 | the Minimal Corresponding Source and Corresponding Application 128 | Code. If you use option 4d1, you must provide the Installation 129 | Information in the manner specified by section 6 of the GNU GPL 130 | for conveying Corresponding Source.) 131 | 132 | 5. Combined Libraries. 133 | 134 | You may place library facilities that are a work based on the 135 | Library side by side in a single library together with other library 136 | facilities that are not Applications and are not covered by this 137 | License, and convey such a combined library under terms of your 138 | choice, if you do both of the following: 139 | 140 | a) Accompany the combined library with a copy of the same work based 141 | on the Library, uncombined with any other library facilities, 142 | conveyed under the terms of this License. 143 | 144 | b) Give prominent notice with the combined library that part of it 145 | is a work based on the Library, and explaining where to find the 146 | accompanying uncombined form of the same work. 147 | 148 | 6. Revised Versions of the GNU Lesser General Public License. 149 | 150 | The Free Software Foundation may publish revised and/or new versions 151 | of the GNU Lesser General Public License from time to time. Such new 152 | versions will be similar in spirit to the present version, but may 153 | differ in detail to address new problems or concerns. 154 | 155 | Each version is given a distinguishing version number. If the 156 | Library as you received it specifies that a certain numbered version 157 | of the GNU Lesser General Public License "or any later version" 158 | applies to it, you have the option of following the terms and 159 | conditions either of that published version or of any later version 160 | published by the Free Software Foundation. If the Library as you 161 | received it does not specify a version number of the GNU Lesser 162 | General Public License, you may choose any version of the GNU Lesser 163 | General Public License ever published by the Free Software Foundation. 164 | 165 | If the Library as you received it specifies that a proxy can decide 166 | whether future versions of the GNU Lesser General Public License shall 167 | apply, that proxy's public statement of acceptance of any version is 168 | permanent authorization for you to choose that version for the 169 | Library. 170 | -------------------------------------------------------------------------------- /LICENSE.icon: -------------------------------------------------------------------------------- 1 | The application icon for this project (piet.ico, and piet-*.png) are based off the "Mondrian lookalike" image by "Husky" 2 | 3 | Source: http://commons.wikimedia.org/wiki/File:Mondrian_lookalike.svg 4 | License: Creative Commons Attribution ShareAlike 3.0 5 | URL: http://creativecommons.org/licenses/by-sa/3.0/ 6 | 7 | 8 | If an icon theme is not found on your system (windows and mac), then the fallback icon set is used, which comes from the Oxygen icon library. 9 | License: LGPL 3 10 | URL: http://www.oxygen-icons.org/ 11 | -------------------------------------------------------------------------------- /MainWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef MAINWINDOW_H 21 | #define MAINWINDOW_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace Ui 29 | { 30 | class MainWindow; 31 | } 32 | 33 | class PixelDelegate; 34 | class ImageModel; 35 | class ViewMonitor; 36 | class QTableView; 37 | class OutputModel; 38 | class RunController; 39 | class CommandWidget; 40 | class DebugWidget; 41 | class UndoHandler; 42 | class QUndoStack; 43 | class QLabel; 44 | 45 | class MainWindow : public QMainWindow 46 | { 47 | Q_OBJECT 48 | 49 | public: 50 | explicit MainWindow( QWidget *parent = 0 ); 51 | ~MainWindow(); 52 | 53 | virtual bool eventFilter( QObject* , QEvent* ); 54 | 55 | protected: 56 | void closeEvent(QCloseEvent *event); 57 | 58 | signals: 59 | void validImageDocument( bool ); 60 | void executeSource( const QImage & ); 61 | void debugSource( const QImage & ); 62 | void debugStep(); 63 | void debugStop(); 64 | void debugStarted( bool ); 65 | void setStopEnabled( bool ); 66 | 67 | private slots: 68 | void slotActionExit(); 69 | void slotActionSaveAs(); 70 | void slotActionSave(); 71 | void slotActionOpen(); 72 | void slotActionToggleGrid(); 73 | void slotActionToggleHeaders(); 74 | void slotActionNew(); 75 | void slotActionResize(); 76 | void slotActionInsert(); 77 | void slotActionZoom(); 78 | void slotActionDebug(); 79 | void slotActionRun(); 80 | 81 | void slotUpdateView( int pixelSize ); 82 | void slotImageEdited(); 83 | 84 | void slotToggleOutput(); 85 | void slotClearOutputView(); 86 | void slotStartDebug(); 87 | 88 | void slotControllerStopped(); 89 | void slotControllerStarted(); 90 | void slotGetChar(); 91 | void slotGetInt(); 92 | void slotReturnPressed(); 93 | 94 | void slotStopController(); 95 | 96 | void slotNewOutput( QString ); 97 | 98 | private: 99 | void setupToolbar(); 100 | void setModified( bool flag ); 101 | bool promptSave(bool close=false); 102 | 103 | Ui::MainWindow *ui; 104 | 105 | QString mSaveMessage; 106 | QHash mExtensions; 107 | 108 | QUndoStack* mUndoStack; 109 | UndoHandler* mUndoHandler; 110 | ImageModel* mModel; 111 | PixelDelegate* mDelegate; 112 | ViewMonitor* mMonitor; 113 | OutputModel* mOutputModel; 114 | RunController* mRunController; 115 | CommandWidget* mCommandWidget; 116 | DebugWidget* mDebugWidget; 117 | QLabel* mStatusLabel; 118 | 119 | QThread mRunThread; 120 | QUrl mCurrentFile; 121 | bool mModified; 122 | bool mWaitInt; 123 | bool mWaitChar; 124 | bool mWaitingForCoordSelection; 125 | QImage mInsertImage; 126 | }; 127 | 128 | #endif // MAINWINDOW_H 129 | -------------------------------------------------------------------------------- /MainWindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1024 10 | 768 11 | 12 | 13 | 14 | Piet Creator 15 | 16 | 17 | 18 | 19 | 20 | 21 | true 22 | 23 | 24 | true 25 | 26 | 27 | true 28 | 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Zoom: 40 | 41 | 42 | 43 | 44 | 45 | 46 | 4 47 | 48 | 49 | 32 50 | 51 | 52 | Qt::Horizontal 53 | 54 | 55 | 56 | 57 | 58 | 59 | Qt::Horizontal 60 | 61 | 62 | 63 | 40 64 | 20 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 0 77 | 0 78 | 1024 79 | 22 80 | 81 | 82 | 83 | 84 | 85 | 86 | toolBar 87 | 88 | 89 | TopToolBarArea 90 | 91 | 92 | false 93 | 94 | 95 | 96 | 97 | 98 | 0 99 | 0 100 | 101 | 102 | 103 | Development Bar 104 | 105 | 106 | 2 107 | 108 | 109 | 110 | 111 | 112 | 113 | 0 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | Program Output 129 | 130 | 131 | 8 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 0 140 | 0 141 | 142 | 143 | 144 | Clear Output 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | Monospace 153 | 154 | 155 | 156 | true 157 | 158 | 159 | Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse 160 | 161 | 162 | 163 | 164 | 165 | 166 | false 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | Toggle &Grid 176 | 177 | 178 | 179 | 180 | &New 181 | 182 | 183 | 184 | 185 | &Open… 186 | 187 | 188 | 189 | 190 | &Save… 191 | 192 | 193 | 194 | 195 | &Quit 196 | 197 | 198 | 199 | 200 | Toggle &Headers 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /NPietObserver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "NPietObserver.h" 21 | #include 22 | #include 23 | extern "C" 24 | { 25 | #include "npiet/npiet_utils.h" 26 | } 27 | 28 | NPietObserver::NPietObserver( RunController* controller ): QObject( controller ), mRunController( controller ) 29 | { 30 | register_step_callback( call_step, this ); 31 | register_action_callback( call_action, this ); 32 | register_readchar_callback( call_readchar, this ); 33 | register_readint_callback( call_readint, this ); 34 | } 35 | 36 | void NPietObserver::action( trace_action* act ) 37 | { 38 | emit actionChanged( act ); 39 | } 40 | 41 | void NPietObserver::step( trace_step* ste ) 42 | { 43 | emit stepped( ste ); 44 | } 45 | 46 | char NPietObserver::get_char() 47 | { 48 | return mRunController->getChar(); 49 | } 50 | 51 | int NPietObserver::get_int() 52 | { 53 | return mRunController->getInt(); 54 | } 55 | 56 | void NPietObserver::call_action( void* object, trace_action* act ) 57 | { 58 | NPietObserver* me = static_cast( object ); 59 | me->action( act ); 60 | } 61 | 62 | void NPietObserver::call_step( void* object, trace_step* ste ) 63 | { 64 | NPietObserver* me = static_cast( object ); 65 | me->step( ste ); 66 | } 67 | 68 | char NPietObserver::call_readchar( void* object ) 69 | { 70 | NPietObserver* me = static_cast( object ); 71 | return me->get_char(); 72 | } 73 | 74 | int NPietObserver::call_readint( void* object ) 75 | { 76 | NPietObserver* me = static_cast( object ); 77 | return me->get_int();; 78 | } 79 | 80 | 81 | #include "NPietObserver.moc" 82 | -------------------------------------------------------------------------------- /NPietObserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef NPIETOBSERVER_H 21 | #define NPIETOBSERVER_H 22 | 23 | #include "RunController.h" 24 | #include 25 | 26 | struct trace_step; 27 | struct trace_action; 28 | 29 | class NPietObserver : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | NPietObserver( RunController* controller = 0 ); 34 | 35 | void step( struct trace_step * ); 36 | void action( struct trace_action * ); 37 | 38 | int get_int(); 39 | char get_char(); 40 | 41 | static void call_step( void* object, struct trace_step * ); 42 | static void call_action( void* object, struct trace_action * ); 43 | 44 | static int call_readint( void* object ); 45 | static char call_readchar( void* object ); 46 | 47 | signals: 48 | void stepped( trace_step* ); 49 | void actionChanged( trace_action* ); 50 | 51 | private: 52 | RunController* mRunController; 53 | }; 54 | 55 | #endif // NPIETOBSERVER_H 56 | -------------------------------------------------------------------------------- /PixelDelegate.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "PixelDelegate.h" 21 | 22 | #include "ImageModel.h" 23 | #include "ViewMonitor.h" 24 | #include "UndoHandler.h" 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | PixelDelegate::PixelDelegate( ViewMonitor* monitor, UndoHandler* handler, QMenu* menu, QObject* parent ) : QStyledItemDelegate( parent ), mMonitor( monitor ), mUndoHandler(handler), mContextMenu( menu ) 34 | { 35 | } 36 | 37 | void PixelDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const 38 | { 39 | 40 | if ( option.state & QStyle::State_Selected ) 41 | painter->fillRect( option.rect, option.palette.highlight() ); 42 | 43 | QColor c = index.model()->data( index, Qt::DisplayRole ).value(); 44 | 45 | painter->save(); 46 | painter->setBrush( QBrush( c ) ); 47 | 48 | // shorten the rectangle a little to provide some spacing 49 | QRect shortRect = option.rect.adjusted( 1, 1, -1, -1 ); 50 | QPen pen = painter->pen(); 51 | if( index.data( ImageModel::IsCurrentDebugRole ).toBool() ) { 52 | pen.setColor( Qt::black ); 53 | pen.setWidth( 2 ); 54 | painter->setPen( pen ); 55 | } 56 | painter->drawRect( shortRect ); 57 | painter->restore(); 58 | 59 | // This seems to break using QT 4.8.7, it draws over everything this method has 60 | // just done 61 | /*QStyleOptionViewItemV4 opt = option; 62 | initStyleOption(&opt, index); 63 | opt.text = ""; 64 | QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &opt, painter);*/ 65 | } 66 | 67 | QSize PixelDelegate::sizeHint( const QStyleOptionViewItem & /* option */, 68 | const QModelIndex & /* index */ ) const 69 | { 70 | return QSize( mMonitor->pixelSize(), mMonitor->pixelSize() ); 71 | } 72 | 73 | bool PixelDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index ) 74 | { 75 | 76 | if ( !index.isValid() ) 77 | return false; 78 | switch ( event->type() ) { 79 | case QEvent::MouseButtonPress: 80 | case QEvent::MouseMove: { 81 | QMouseEvent *mev = static_cast( event ); 82 | if ( mev->buttons() & Qt::LeftButton ) { 83 | mUndoHandler->createEditPixel(index.column(), index.row(), mMonitor->currentColor(), mev->type() == QEvent::MouseMove ); 84 | emit imageEdited(); 85 | // return true; 86 | } else if ( (mev->modifiers() == Qt::NoModifier ) && (mev->button() == Qt::RightButton ) ) { 87 | mContextMenu->popup(mev->globalPos()); 88 | // return false; 89 | } else if ( (mev->modifiers() == Qt::ControlModifier ) && ( mev->button() == Qt::RightButton) ) { 90 | mMonitor->setCurrentColor( index.model()->data( index, Qt::DisplayRole ).value() ); 91 | // return false; 92 | } 93 | break; 94 | } 95 | default: 96 | break; 97 | // return false; 98 | } 99 | return QStyledItemDelegate::editorEvent(event, model, option, index); 100 | } 101 | 102 | #include "PixelDelegate.moc" 103 | -------------------------------------------------------------------------------- /PixelDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef PIXELDELEGATE_H 21 | #define PIXELDELEGATE_H 22 | 23 | #include 24 | 25 | class ViewMonitor; 26 | class UndoHandler; 27 | class QMenu; 28 | 29 | class PixelDelegate : public QStyledItemDelegate 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | PixelDelegate( ViewMonitor* monitor,UndoHandler* handler, QMenu* menu, QObject *parent = 0 ); 35 | virtual ~PixelDelegate() {} 36 | 37 | void paint( QPainter *painter, const QStyleOptionViewItem &option, 38 | const QModelIndex &index ) const; 39 | 40 | QSize sizeHint( const QStyleOptionViewItem &option, 41 | const QModelIndex &index ) const; 42 | 43 | bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index ); 44 | 45 | signals: 46 | void imageEdited(); 47 | 48 | private: 49 | ViewMonitor* mMonitor; 50 | UndoHandler* mUndoHandler; 51 | QMenu* mContextMenu; 52 | }; 53 | 54 | #endif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Piet Creator 2 | ------------------------------------------------------------------------------- 3 | 4 | [![Build Status](https://travis-ci.org/Ramblurr/PietCreator.svg?branch=master)](https://travis-ci.org/Ramblurr/PietCreator) 5 | 6 | Piet Creator is a cross platform GUI IDE for the Piet esoteric programming 7 | language. It includes a graphical editor, embedded interpreter, and integrated 8 | debugger. 9 | 10 | "Piet is a programming language in which programs look like abstract 11 | paintings. The language is named after Piet Mondrian, who pioneered the 12 | field of geometric abstract art. " - David Morgan-Mar. dmm@dangermouse.net (Piet Author) 13 | 14 | Piet Creator's primary author is Casey Link . 15 | 16 | The interpreter backend is provided by npiet, a piet interpreter written in C by 17 | Erik Schoenfelder. 18 | 19 | piet, the language: http://www.dangermouse.net/esoteric/piet.html 20 | npiet: http://www.bertnase.de/npiet/ 21 | 22 | Piet Creator is licensed under the GPL v3, and is written in C++ with Qt. 23 | 24 | Piet the esoteric programming language was created by David Morgan-Mar , 25 | and is copyright by him. 26 | 27 | Compiling / Running 28 | ---------------- 29 | Prerequisites for Linux/Mac OS X/Windows: 30 | 31 | * Qt >= 4.6 32 | * libPNG - http://www.libpng.org/pub/png/libpng.html 33 | * GIFLIB 34 | * GD Graphics Library - http://www.boutell.com/gd/ 35 | * CMake - http://www.cmake.org 36 | 37 | Piet Creator uses the cmake build system, which is supported on all major 38 | operating systems. 39 | 40 | On Linux/Mac OS X 41 | 42 | From the source directory: 43 | $ mkdir build 44 | $ cd build 45 | $ cmake ../ # This will attempt and find all the dependencies 46 | $ make 47 | $ ./pietcreator 48 | 49 | 50 | On Windows (With VS 2008) 51 | 52 | * Create the build directory as shown above 53 | * Run the same cmake command "cmake ../" or "cmake path_to_sources" 54 | * Open the resulting .sln in Visual Studio 55 | * Execute the pietcreator.exe binary in Debug/ 56 | 57 | On Windows (With mingw) 58 | 59 | * Unknown. Anyone care to contribute? 60 | * You will need the Qt SDK for windows that includes mingw from: 61 | http://qt.nokia.com/downloads/sdk-windows-cpp 62 | -------------------------------------------------------------------------------- /ResizeDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "ResizeDialog.h" 2 | 3 | #include 4 | 5 | ResizeDialog::ResizeDialog( const QSize &size, QWidget *parent ) : 6 | QDialog( parent ) 7 | { 8 | QVBoxLayout* mainLayout = new QVBoxLayout( this ); 9 | QWidget* formWidget = new QWidget( this ); 10 | QFormLayout* formLayout = new QFormLayout( formWidget ); 11 | QLabel* widthLabel = new QLabel( this ); 12 | widthLabel->setText( tr( "Width:" ) ); 13 | QLabel* heightLabel = new QLabel( this ); 14 | heightLabel->setText( tr( "Height:" ) ); 15 | 16 | mWidthSpin = new QSpinBox( this ); 17 | mWidthSpin->setMinimum( 1 ); 18 | mWidthSpin->setMaximum( 100 ); 19 | mWidthSpin->setSuffix( tr( " codels" ) ); 20 | mWidthSpin->setValue( size.width() ); 21 | mHeightSpin = new QSpinBox( this ); 22 | mHeightSpin->setMinimum( 1 ); 23 | mHeightSpin->setMaximum( 1000 ); 24 | mHeightSpin->setSuffix( tr( " codels" ) ); 25 | mHeightSpin->setValue( size.height() ); 26 | 27 | formLayout->addRow( widthLabel, mWidthSpin ); 28 | formLayout->addRow( heightLabel, mHeightSpin ); 29 | 30 | formWidget->setLayout( formLayout ); 31 | mainLayout->addWidget( formWidget ); 32 | 33 | QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); 34 | connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); 35 | connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); 36 | 37 | mainLayout->addWidget( buttonBox ); 38 | setLayout( mainLayout ); 39 | } 40 | 41 | ResizeDialog::~ResizeDialog() 42 | { 43 | } 44 | 45 | QSize ResizeDialog::newSize() const 46 | { 47 | return QSize( mWidthSpin->value(), mHeightSpin->value() ); 48 | } 49 | 50 | #include "ResizeDialog.moc" 51 | -------------------------------------------------------------------------------- /ResizeDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef RESIZEDIALOG_H 2 | #define RESIZEDIALOG_H 3 | 4 | #include 5 | 6 | class QSpinBox; 7 | 8 | class ResizeDialog : public QDialog 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit ResizeDialog( const QSize &size, QWidget *parent = 0); 14 | ~ResizeDialog(); 15 | 16 | QSize newSize() const; 17 | 18 | private: 19 | QSpinBox* mWidthSpin; 20 | QSpinBox* mHeightSpin; 21 | }; 22 | 23 | #endif // RESIZEDIALOG_H 24 | -------------------------------------------------------------------------------- /RunController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef RUNCONTROLLER_H 21 | #define RUNCONTROLLER_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #ifdef Q_WS_WIN 31 | #include 32 | #include 33 | #include 34 | #endif 35 | 36 | class QSocketNotifier; 37 | class NPietObserver; 38 | 39 | struct trace_step; 40 | struct trace_action; 41 | 42 | class RunController : public QObject 43 | { 44 | Q_OBJECT 45 | public: 46 | RunController(); 47 | ~RunController(); 48 | 49 | void putInt( int i ); 50 | void putChar( const QChar & c ); 51 | 52 | int getInt(); 53 | char getChar(); 54 | 55 | signals: 56 | void newOutput( const QString & ); 57 | void stepped( trace_step* ); 58 | void actionChanged( trace_action* ); 59 | void stopped(); 60 | void debugStarted(); 61 | void waitingForInt(); 62 | void waitingForChar(); 63 | 64 | public slots: 65 | void slotThreadStarted(); 66 | 67 | void debugSource( const QImage &source ); 68 | bool runSource( const QImage &source ); 69 | void pixelChanged( int x, int y, QRgb color ); 70 | 71 | void step(); 72 | void abort(); 73 | private slots: 74 | void stdoutReadyRead(); 75 | void win32OutputTimeout(); 76 | 77 | bool initialize( const QImage &source ); 78 | void execute(); 79 | 80 | void slotStepped( trace_step* ); 81 | void slotAction( trace_action* ); 82 | 83 | void tick(); 84 | 85 | private: 86 | void captureStdout(); 87 | bool prepare(); 88 | void finish(); 89 | 90 | /** Call with mutex locked */ 91 | void stop(); 92 | 93 | //Capturing program output 94 | QTextStream* mStdOut; 95 | #ifndef Q_WS_WIN 96 | QSocketNotifier* mNotifier; 97 | int mPipeFd[2]; /**< [0] is read end, [1] is write end */ 98 | int mOrigFd; 99 | int mOrigFdCopy; 100 | #else 101 | HANDLE mPipeRead; 102 | HANDLE mPipeWrite; 103 | HANDLE mOldStdoutHandle; 104 | #endif 105 | 106 | // Reacting to notifications from npiet 107 | NPietObserver* mObserver; 108 | 109 | 110 | bool mPrepared; 111 | QImage mSource; 112 | 113 | QMutex mMutex; 114 | QWaitCondition mWaitCond; 115 | bool mAbort; 116 | bool mExecuting; 117 | bool mDebugging; 118 | QTimer* mTimer; 119 | QTimer* mOutputTimer; 120 | 121 | char mChar; 122 | int mInt; 123 | }; 124 | 125 | #endif // RUNCONTROLLER_H 126 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ---- 3 | 4 | Oh so much... 5 | 6 | * Breakpoints 7 | * Selection and movement of blocks 8 | * Sub programs (like layers in a normal graphics editor) 9 | * Given a program refactor it to change its colors but not its functionality 10 | * Per-codel comments 11 | * Mouse over information (command, value, etc) 12 | * Given several subprograms automatically connect them 13 | 14 | TODOs related to Piet but not Piet Creator specifically: 15 | * Implement a "standard library" of programs 16 | * and, or, xor, complement, read string, out string, reverse string, etc. 17 | * Create roll visualizer -- DONE -- http://binaryelysium.com/code/roll-vis.html 18 | -------------------------------------------------------------------------------- /UndoCommands.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "UndoCommands.h" 21 | 22 | #include "ImageModel.h" 23 | 24 | #include 25 | 26 | EditPixelCommand::EditPixelCommand(int x, int y, QColor old_color, QColor new_color, ImageModel * model, QUndoCommand* parent) 27 | : QUndoCommand(parent) 28 | , mX(x) 29 | , mY(y) 30 | , mBefore(old_color) 31 | , mAfter(new_color) 32 | , mModel(model) 33 | { 34 | 35 | } 36 | 37 | void EditPixelCommand::redo() 38 | { 39 | mModel->setData( mModel->index(mY, mX), mAfter, Qt::DisplayRole ); 40 | } 41 | 42 | void EditPixelCommand::undo() 43 | { 44 | qDebug() << "me undo: " << mBefore << mAfter; 45 | mModel->setData( mModel->index(mY, mX), mBefore, Qt::DisplayRole ); 46 | } 47 | 48 | bool EditPixelCommand::mergeWith(const QUndoCommand* command) 49 | { 50 | const EditPixelCommand *editPixelCommand = static_cast(command); 51 | if( editPixelCommand->mX == mX && editPixelCommand->mY == mY ) 52 | return mAfter == editPixelCommand->mAfter; 53 | return false; 54 | } 55 | 56 | InsertImageCommand::InsertImageCommand(int x, int y, QImage before, QImage imageToInsert, QSize after, ImageModel* model, QUndoCommand* parent) 57 | : QUndoCommand(parent) 58 | , mX(x) 59 | , mY(y) 60 | , mBefore(before) 61 | , mAfter(after) 62 | , mImageToInsert(imageToInsert) 63 | , mModel(model) 64 | { 65 | } 66 | 67 | void InsertImageCommand::redo() 68 | { 69 | mModel->scaleImage(mAfter); 70 | mModel->insertImage(mImageToInsert, mX, mY); 71 | } 72 | 73 | void InsertImageCommand::undo() 74 | { 75 | mModel->setImage(mBefore, 1); 76 | } 77 | 78 | ScaleImageCommand::ScaleImageCommand(QImage before, QSize after, ImageModel* model, QUndoCommand* parent) 79 | : QUndoCommand(parent) 80 | , mBefore(before) 81 | , mAfter(after) 82 | , mModel(model) 83 | { 84 | 85 | } 86 | 87 | void ScaleImageCommand::redo() 88 | { 89 | mModel->scaleImage(mAfter); 90 | } 91 | 92 | void ScaleImageCommand::undo() 93 | { 94 | mModel->setImage(mBefore, 1); 95 | } 96 | 97 | 98 | -------------------------------------------------------------------------------- /UndoCommands.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | class ImageModel; 25 | 26 | class EditPixelCommand : public QUndoCommand 27 | { 28 | public: 29 | enum { Id = 1 }; 30 | EditPixelCommand(int x, int y, QColor old_color, QColor new_color, ImageModel* model, QUndoCommand* parent = 0 ); 31 | void undo(); 32 | void redo(); 33 | bool mergeWith(const QUndoCommand *command); 34 | int id() const { return Id; } 35 | private: 36 | int mX, mY; 37 | QColor mBefore,mAfter; 38 | ImageModel *mModel; 39 | 40 | }; 41 | 42 | class InsertImageCommand : public QUndoCommand 43 | { 44 | public: 45 | InsertImageCommand(int x, int y, QImage before, QImage imageToInsert, QSize after, ImageModel* model, QUndoCommand* parent = 0 ); 46 | void undo(); 47 | void redo(); 48 | private: 49 | int mX, mY; 50 | QImage mBefore,mImageToInsert; 51 | QSize mAfter; 52 | ImageModel *mModel; 53 | }; 54 | 55 | class ScaleImageCommand : public QUndoCommand 56 | { 57 | public: 58 | ScaleImageCommand(QImage before, QSize after, ImageModel* model, QUndoCommand* parent = 0); 59 | void undo(); 60 | void redo(); 61 | private: 62 | QImage mBefore; 63 | QSize mAfter; 64 | ImageModel *mModel; 65 | }; 66 | -------------------------------------------------------------------------------- /UndoHandler.cpp: -------------------------------------------------------------------------------- 1 | #include "UndoHandler.h" 2 | 3 | #include "ImageModel.h" 4 | 5 | #include "UndoCommands.h" 6 | 7 | #include 8 | #include 9 | 10 | UndoHandler::UndoHandler( QUndoStack* undostack, ImageModel* model ) : mUndoStack( undostack ), mModel( model ) 11 | { 12 | } 13 | 14 | void UndoHandler::createEditPixel(int x, int y, QColor new_color, bool dragging) 15 | { 16 | qDebug() << "createEditPixel" << dragging; 17 | EditPixelCommand* parent = 0; 18 | if (dragging) { 19 | const QUndoCommand* cmd = mUndoStack->command( mUndoStack->index() ); 20 | const EditPixelCommand* const_parent = dynamic_cast(cmd); 21 | qDebug() << const_parent; 22 | if( const_parent ) 23 | parent = const_cast(const_parent); 24 | } 25 | QColor old_color = mModel->data( mModel->index(y, x), Qt::DisplayRole ).value(); 26 | EditPixelCommand *cmd = new EditPixelCommand(x, y, old_color, new_color, mModel, parent ); 27 | mUndoStack->push(cmd); 28 | } 29 | 30 | void UndoHandler::insertImage(int x, int y, QImage imageToInsert, QSize scaleAfter) 31 | { 32 | QImage before = mModel->image(); 33 | InsertImageCommand *cmd = new InsertImageCommand(x,y,before, imageToInsert, scaleAfter, mModel); 34 | mUndoStack->push(cmd); 35 | } 36 | 37 | void UndoHandler::scaleImage(QSize newSize) 38 | { 39 | QImage before = mModel->image(); 40 | ScaleImageCommand *cmd = new ScaleImageCommand(before, newSize, mModel); 41 | mUndoStack->push(cmd); 42 | } 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /UndoHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef ACTIONHANDLER_H 2 | #define ACTIONHANDLER_H 3 | 4 | #include 5 | #include 6 | 7 | class ImageModel; 8 | class QUndoStack; 9 | 10 | class UndoHandler 11 | { 12 | 13 | public: 14 | UndoHandler(QUndoStack * undostack, ImageModel* model); 15 | 16 | void createEditPixel(int x, int y, QColor new_color, bool dragging = false); 17 | void insertImage(int x, int y, QImage imageToInsert, QSize scaleAfter); 18 | void scaleImage(QSize newSize); 19 | 20 | private: 21 | ImageModel* mModel; 22 | QUndoStack* mUndoStack; 23 | }; 24 | 25 | #endif // ACTIONHANDLER_H 26 | -------------------------------------------------------------------------------- /ViewMonitor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include "ViewMonitor.h" 21 | 22 | #include "KColorCells.h" 23 | 24 | #include 25 | 26 | ViewMonitor::ViewMonitor( QObject* parent ): QObject( parent ) 27 | { 28 | 29 | // 3 shades of red 30 | mColors.insert( 0, QColor( "#FFC0C0" ) ); 31 | mColors.insert( 1, QColor( "#FF0000" ) ); 32 | mColors.insert( 2, QColor( "#C00000" ) ); 33 | 34 | // 3 shades of yellow 35 | mColors.insert( 3, QColor( "#FFFFC0" ) ); 36 | mColors.insert( 4, QColor( "#FFFF00" ) ); 37 | mColors.insert( 5, QColor( "#C0C000" ) ); 38 | 39 | // 3 shades of green 40 | mColors.insert( 6, QColor( "#C0FFC0" ) ); 41 | mColors.insert( 7, QColor( "#00FF00" ) ); 42 | mColors.insert( 8, QColor( "#00C000" ) ); 43 | 44 | // 3 shades of cyan 45 | mColors.insert( 9, QColor( "#C0FFFF" ) ); 46 | mColors.insert( 10, QColor( "#00FFFF" ) ); 47 | mColors.insert( 11, QColor( "#00C0C0" ) ); 48 | 49 | // 3 shades of blue 50 | mColors.insert( 12, QColor( "#C0C0FF" ) ); 51 | mColors.insert( 13, QColor( "#0000FF" ) ); 52 | mColors.insert( 14, QColor( "#0000C0" ) ); 53 | 54 | // 3 shades of magenta 55 | mColors.insert( 15, QColor( "#FFC0FF" ) ); 56 | mColors.insert( 16, QColor( "#FF00FF" ) ); 57 | mColors.insert( 17, QColor( "#C000C0" ) ); 58 | 59 | mColors.insert( 18, QColor( "#FFFFFF" ) ); 60 | mColors.insert( 19, QColor( "#000000" ) ); 61 | 62 | Command first( "", "", mColors.at( 0 ), 0 ); 63 | setCurrentCommand( first ); 64 | } 65 | 66 | QColor ViewMonitor::currentColor() const 67 | { 68 | return mStack.top().color; 69 | } 70 | 71 | void ViewMonitor::setCurrentColor( int index, const QColor& color ) 72 | { 73 | if( mStack.top().index != index ) { 74 | mStack.top().color = color; 75 | mStack.top().index = index; 76 | emit currentColorChanged( color ); 77 | } 78 | } 79 | 80 | void ViewMonitor::setCurrentColor( const QColor& color ) 81 | { 82 | int index = mColors.indexOf( color ); 83 | if( index > 0 && mStack.top().index != index ) { 84 | mStack.top().color = color; 85 | mStack.top().index = index; 86 | emit currentColorChanged( color ); 87 | } 88 | } 89 | 90 | void ViewMonitor::setCurrentColor( int index ) 91 | { 92 | if( mStack.top().index != index ) { 93 | Q_ASSERT( index < mColors.size() ); 94 | mStack.top().color = mColors.at( index ); 95 | mStack.top().index = index; 96 | emit currentColorChanged( mStack.top().color ); 97 | } 98 | } 99 | 100 | int ViewMonitor::pixelSize() const 101 | { 102 | return mPixelSize; 103 | } 104 | 105 | void ViewMonitor::setPixelSize( int size ) 106 | { 107 | mPixelSize = size; 108 | emit pixelSizeChanged( size ); 109 | } 110 | 111 | int ViewMonitor::currentColorIndex() const 112 | { 113 | return mStack.top().index; 114 | } 115 | 116 | QColor ViewMonitor::colorForIndex( int index ) const 117 | { 118 | if( index < mColors.size() ) 119 | return mColors.at( index ); 120 | return Qt::black; 121 | } 122 | 123 | QString ViewMonitor::currentCommandLabel() const 124 | { 125 | return mStack.top().name; 126 | } 127 | 128 | Command ViewMonitor::currentCommand() const 129 | { 130 | return mStack.top(); 131 | } 132 | 133 | 134 | static inline int secondToLastIndex( int size ) 135 | { 136 | return ( size > 1 ) ? size - 2 : size - 1; 137 | } 138 | 139 | 140 | void ViewMonitor::takeCommand() 141 | { 142 | if (mStack.size()<2) 143 | return; 144 | Command c = mStack.pop(); 145 | emit currentCommandChanged( mStack.top(), mStack.at( secondToLastIndex( mStack.size() ) ) ); 146 | if( mStack.last().color != c.color ) 147 | emit currentColorChanged( mStack.last().color ); 148 | return; 149 | } 150 | 151 | void ViewMonitor::setCurrentCommand( const Command& command ) 152 | { 153 | mStack.push( command ); 154 | emit currentCommandChanged( mStack.top(), mStack.at( secondToLastIndex( mStack.size() ) ) ); 155 | if( mStack.last().color != command.color ) 156 | emit currentColorChanged( command.color ); 157 | } 158 | 159 | 160 | void ViewMonitor::populateCells( KColorCells* cells ) 161 | { 162 | for( int i = 0; i < cells->count(); ++i ) 163 | cells->setColor( i, mColors.at( i ) ); 164 | 165 | cells->setSelected( 0 ); 166 | } 167 | 168 | 169 | 170 | #include "ViewMonitor.moc" 171 | 172 | 173 | -------------------------------------------------------------------------------- /ViewMonitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #ifndef VIEWMONITOR_H 21 | #define VIEWMONITOR_H 22 | 23 | #include "Command.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | class KColorCells; 31 | 32 | class ViewMonitor : public QObject 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit ViewMonitor( QObject * parent ); 37 | 38 | QColor currentColor() const; 39 | int currentColorIndex() const; 40 | QString currentCommandLabel() const; 41 | Command currentCommand() const; 42 | void takeCommand(); 43 | 44 | int pixelSize() const; 45 | QColor colorForIndex( int index ) const; 46 | void populateCells( KColorCells * cells ); 47 | 48 | signals: 49 | void currentCommandChanged( const Command & newCommand, const Command & oldCommand ); 50 | void pixelSizeChanged( int ); 51 | void currentColorChanged( const QColor & ); 52 | 53 | public slots: 54 | void setCurrentCommand( const Command & command ); 55 | void setCurrentColor( int index ); 56 | void setCurrentColor( int index, const QColor& color ); 57 | void setCurrentColor( const QColor& color ); 58 | 59 | void setPixelSize( int ); 60 | 61 | private: 62 | QStack mStack; 63 | 64 | int mPixelSize; 65 | QVector mColors; 66 | }; 67 | 68 | #endif // VIEWMONITOR_H 69 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | mkdir build 2 | cd build 3 | cmake ../ 4 | make 5 | 6 | if [ ! -e pietcreator ] 7 | then 8 | echo "pietcreater not found" 9 | exit 1 10 | fi -------------------------------------------------------------------------------- /fallback.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/fallback/index.theme 4 | icons/fallback/16x16/actions/application-exit.png 5 | icons/fallback/16x16/actions/debug-step.png 6 | icons/fallback/16x16/actions/document-new.png 7 | icons/fallback/16x16/actions/document-open.png 8 | icons/fallback/16x16/actions/document-save-as.png 9 | icons/fallback/16x16/actions/document-save.png 10 | icons/fallback/16x16/actions/process-stop.png 11 | icons/fallback/16x16/actions/run-build.png 12 | icons/fallback/16x16/actions/system-run.png 13 | icons/fallback/16x16/actions/transform-scale.png 14 | icons/fallback/16x16/actions/view-form-table.png 15 | icons/fallback/16x16/actions/zoom-in.png 16 | icons/fallback/16x16/actions/zoom-out.png 17 | icons/fallback/16x16/actions/edit-undo.png 18 | icons/fallback/16x16/actions/insert-image.png 19 | icons/fallback/16x16/apps/utilities-terminal.png 20 | icons/fallback/22x22/actions/application-exit.png 21 | icons/fallback/22x22/actions/document-new.png 22 | icons/fallback/22x22/actions/document-open.png 23 | icons/fallback/22x22/actions/document-save-as.png 24 | icons/fallback/22x22/actions/document-save.png 25 | icons/fallback/22x22/actions/process-stop.png 26 | icons/fallback/22x22/actions/run-build.png 27 | icons/fallback/22x22/actions/system-run.png 28 | icons/fallback/22x22/actions/transform-scale.png 29 | icons/fallback/22x22/actions/view-form-table.png 30 | icons/fallback/22x22/actions/zoom-in.png 31 | icons/fallback/22x22/actions/zoom-out.png 32 | icons/fallback/22x22/apps/utilities-terminal.png 33 | icons/fallback/22x22/actions/edit-undo.png 34 | icons/fallback/22x22/actions/insert-image.png 35 | icons/fallback/32x32/actions/application-exit.png 36 | icons/fallback/32x32/actions/debug-step.png 37 | icons/fallback/32x32/actions/document-new.png 38 | icons/fallback/32x32/actions/document-open.png 39 | icons/fallback/32x32/actions/document-save-as.png 40 | icons/fallback/32x32/actions/document-save.png 41 | icons/fallback/32x32/actions/process-stop.png 42 | icons/fallback/32x32/actions/run-build.png 43 | icons/fallback/32x32/actions/system-run.png 44 | icons/fallback/32x32/actions/transform-scale.png 45 | icons/fallback/32x32/actions/view-form-table.png 46 | icons/fallback/32x32/actions/zoom-in.png 47 | icons/fallback/32x32/actions/zoom-out.png 48 | icons/fallback/32x32/apps/utilities-terminal.png 49 | icons/fallback/32x32/actions/edit-undo.png 50 | icons/fallback/32x32/actions/insert-image.png 51 | 52 | 53 | -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/application-exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/application-exit.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/debug-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/debug-step.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/document-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/document-new.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/document-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/document-open.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/document-save-as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/document-save-as.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/document-save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/document-save.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/edit-undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/edit-undo.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/insert-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/insert-image.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/process-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/process-stop.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/run-build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/run-build.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/system-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/system-run.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/transform-scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/transform-scale.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/view-form-table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/view-form-table.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/zoom-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/zoom-in.png -------------------------------------------------------------------------------- /icons/fallback/16x16/actions/zoom-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/actions/zoom-out.png -------------------------------------------------------------------------------- /icons/fallback/16x16/apps/utilities-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/16x16/apps/utilities-terminal.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/application-exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/application-exit.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/document-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/document-new.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/document-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/document-open.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/document-save-as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/document-save-as.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/document-save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/document-save.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/edit-undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/edit-undo.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/insert-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/insert-image.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/process-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/process-stop.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/run-build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/run-build.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/system-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/system-run.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/transform-scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/transform-scale.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/view-form-table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/view-form-table.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/zoom-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/zoom-in.png -------------------------------------------------------------------------------- /icons/fallback/22x22/actions/zoom-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/actions/zoom-out.png -------------------------------------------------------------------------------- /icons/fallback/22x22/apps/utilities-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/22x22/apps/utilities-terminal.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | AdditionalInfoV2=Details_Size,Details_Date,CustomizedDetails 3 | Timestamp=2011,4,15,12,30,54 4 | Version=2 5 | ViewMode=1 6 | -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/application-exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/application-exit.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/debug-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/debug-step.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/document-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/document-new.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/document-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/document-open.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/document-save-as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/document-save-as.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/document-save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/document-save.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/edit-undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/edit-undo.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/insert-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/insert-image.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/process-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/process-stop.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/run-build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/run-build.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/system-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/system-run.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/transform-scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/transform-scale.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/view-form-table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/view-form-table.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/zoom-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/zoom-in.png -------------------------------------------------------------------------------- /icons/fallback/32x32/actions/zoom-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/actions/zoom-out.png -------------------------------------------------------------------------------- /icons/fallback/32x32/apps/utilities-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/icons/fallback/32x32/apps/utilities-terminal.png -------------------------------------------------------------------------------- /icons/fallback/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Oxygen Small 3 | Comment=Subset of Oxygen 4 | Inherits=default 5 | Directories=16x16 32x32 22x22 6 | 7 | [16x16] 8 | Size=16 9 | 10 | [22x22] 11 | Size=22 12 | 13 | [32x32] 14 | Size=32 -------------------------------------------------------------------------------- /icons/icons.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | actions=( document-new document-new document-save document-save-as application-exit view-form-table zoom-in zoom-out transform-scale system-run run-build process-stop edit-undo insert-image) 3 | sizes=( 32 22 16 ) 4 | source_path=/usr/share/icons/oxygen 5 | 6 | for size in ${sizes[@]} 7 | do 8 | for icon in ${actions[@]} 9 | do 10 | icon_path=$source_path/$size"x"$size/actions/$icon.png 11 | cp $icon_path ./fallback/$size"x"$size/actions/ 12 | done 13 | done 14 | 15 | 16 | apps=( utilities-terminal ) 17 | 18 | for size in ${sizes[@]} 19 | do 20 | for icon in ${apps[@]} 21 | do 22 | icon_path=$source_path/$size"x"$size/apps/$icon.png 23 | cp $icon_path ./fallback/$size"x"$size/apps/ 24 | done 25 | done 26 | -------------------------------------------------------------------------------- /install_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | apt-get install cmake 3 | apt-get install libqt4-dev 4 | apt-get install libgif-dev 5 | #apt-get install libgd-dev # Travis wants me to be explicit 6 | apt-get install libgd2-xpm-dev 7 | apt-get install libpng12-dev -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | #include 21 | #include "MainWindow.h" 22 | 23 | #include "Command.h" 24 | 25 | 26 | int main( int argc, char** argv ) 27 | { 28 | qRegisterMetaType( "Command" ); 29 | qRegisterMetaType("QRgb"); 30 | QIcon::setThemeName( "fallback" ); 31 | QApplication app( argc, argv ); 32 | MainWindow foo; 33 | foo.show(); 34 | return app.exec(); 35 | } 36 | -------------------------------------------------------------------------------- /npiet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE (CheckIncludeFiles) 2 | 3 | set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ) 4 | 5 | if (WIN32) 6 | message(STATUS "Using in source libraries") 7 | find_library(GD_LIBRARIES NAMES bgd PATHS ${CMAKE_CURRENT_SOURCE_DIR}/win32/lib) 8 | SET (LOCAL_GD 1) 9 | find_library(PNG_LIBRARIES NAMES libpng PATHS ${CMAKE_CURRENT_SOURCE_DIR}/win32/lib) 10 | set( CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/win32/include ${CMAKE_REQUIRED_INCLUDES}) 11 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/win32/include ) 12 | else() 13 | find_package(GD REQUIRED) 14 | find_package(PNG REQUIRED) 15 | find_package(GIF REQUIRED) 16 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES}) 17 | endif() 18 | 19 | ### 20 | # to minimize the amount of edits we have to make to the npiet 21 | # source, we create a config.h file that plays nice with the 22 | # autotools-isms in npiet.c 23 | ### 24 | CHECK_INCLUDE_FILES (gd.h HAVE_GD_H) 25 | CHECK_INCLUDE_FILES (png.h HAVE_PNG_H) 26 | CHECK_INCLUDE_FILES (gif_lib.h HAVE_GIF_LIB_H) 27 | 28 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) 29 | 30 | 31 | 32 | set( CMAKE_BUILD_TYPE Debug) 33 | set( DEBUG_BUILD_TYPE ON ) 34 | 35 | ENABLE_TESTING() 36 | 37 | ADD_TEST(npiettest ${EXECUTABLE_OUTPUT_PATH}/npiettest Hello) 38 | 39 | set(npiet_SRCS npiet.c npiet_utils.c) 40 | 41 | # add_executable(npiet ${npiet_SRCS} ) 42 | # target_link_libraries( npiet ${GD_LIBRARIES} ${GIF_LIBRARIES} ${PNG_LIBRARIES}) 43 | add_library( npiet ${npiet_SRCS} ) 44 | 45 | target_link_libraries( npiet 46 | ${GD_LIBRARIES} 47 | ${GIF_LIBRARIES} 48 | ${PNG_LIBRARIES} ) 49 | 50 | # Tests 51 | 52 | set( npiettest_SRCS test/NPietTest.cpp ) 53 | qt4_automoc(${npiettest_SRCS}) 54 | ADD_EXECUTABLE(npiettest ${npiettest_SRCS} ) 55 | TARGET_LINK_LIBRARIES(npiettest 56 | ${QT_LIBRARIES} 57 | ${QT_QTTEST_LIBRARIES} 58 | ${QT_QTCORE_LIBRARY} 59 | ${QT_QTGUI_LIBRARY} 60 | npiet ) 61 | 62 | # copy libs to the output dirs 63 | # not sure how msvc could be true and win32 not, but just in case.. 64 | if (MSVC AND WIN32) 65 | message(STATUS "Copying dlls to the Debug and Release directories") 66 | file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Debug) 67 | file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Release) 68 | file(COPY win32/bin/ DESTINATION ${PROJECT_BINARY_DIR}/Debug FILES_MATCHING PATTERN "*.dll") 69 | file(COPY win32/bin/ DESTINATION ${PROJECT_BINARY_DIR}/Release FILES_MATCHING PATTERN "*.dll") 70 | endif() -------------------------------------------------------------------------------- /npiet/README.npiet: -------------------------------------------------------------------------------- 1 | 2 | 3 | README.npiet: Jun 2004 4 | (schoenfr@web.de) Nov 2009 5 | 6 | 7 | 8 | npiet is an interperter for the piet programming language and 9 | 10 | npietedit is a very simple editor for small piet programs. 11 | 12 | npietedit-foogol is a ``foogol to piet'' compiler. 13 | 14 | 15 | about the piet programming language please look at: 16 | 17 | http://www.dangermouse.net/esoteric/piet.html 18 | 19 | 20 | and you find more about npiet at: 21 | 22 | http://bertnase.de/npiet 23 | 24 | 25 | and a copy of the foogol (and cfoogol) postings, about a ``ALGOL-like 26 | language'' definition is avail here: 27 | 28 | http://bertnase.de/html/foogol.html 29 | 30 | 31 | to compile and install npiet and the additional programs and files run 32 | 33 | ./configure 34 | make 35 | make install 36 | 37 | this installes the binaries npiet, npietedit and npiet-foogol, 38 | together with the manpages npiet.1, npietedit.1 and npiet-foogol.1 . 39 | 40 | 41 | if compiled with gd-lib and png-lib support (if avail), graphical 42 | trace output can be created by npiet - great fun ;-) 43 | 44 | 45 | npietedit is a Tk/Tcl program, so you need Tk/Tcl installed to run it. 46 | 47 | npiet-foogil needs libgd to compile and run. 48 | 49 | 50 | a quick npiet-foogol and npiet test would be: 51 | 52 | echo 'begin prints ("Yo\n") end' | ./npiet-foogol - 53 | ./npiet npiet-foogol.png 54 | 55 | or additionally to create a trace picture named npiet-trace.png: 56 | 57 | ./npiet -tpic npiet-foogol.png 58 | 59 | 60 | Have fun! 61 | 62 | 63 | -- 64 | Sun Nov 15 21:54:08 CET 2009 65 | 66 | 67 | -------------------------------------------------------------------------------- /npiet/cmake/modules/FindGD.cmake: -------------------------------------------------------------------------------- 1 | # - Find GD 2 | # Find the native GD includes and library 3 | # This module defines 4 | # GD_INCLUDE_DIR, where to find gd.h, etc. 5 | # GD_LIBRARIES, the libraries needed to use GD. 6 | # GD_FOUND, If false, do not try to use GD. 7 | # also defined, but not for general use are 8 | # GD_LIBRARY, where to find the GD library. 9 | # GD_SUPPORTS_PNG, GD_SUPPORTS_JPEG, GD_SUPPORTS_GIF, test 10 | # support for image formats in GD. 11 | 12 | FIND_PATH(GD_INCLUDE_DIR gd.h 13 | /usr/local/include 14 | /usr/include 15 | ) 16 | 17 | if(WIN32 AND NOT CYGWIN) 18 | SET(GD_NAMES ${GD_NAMES} bgd) 19 | else(WIN32) 20 | SET(GD_NAMES ${GD_NAMES} gd) 21 | endif(WIN32 AND NOT CYGWIN) 22 | 23 | FIND_LIBRARY(GD_LIBRARY 24 | NAMES ${GD_NAMES} 25 | PATHS /usr/lib64 /usr/lib /usr/local/lib 26 | ) 27 | 28 | IF (GD_LIBRARY AND GD_INCLUDE_DIR) 29 | SET(GD_LIBRARIES ${GD_LIBRARY}) 30 | SET(GD_FOUND "YES") 31 | ELSE (GD_LIBRARY AND GD_INCLUDE_DIR) 32 | SET(GD_FOUND "NO") 33 | ENDIF (GD_LIBRARY AND GD_INCLUDE_DIR) 34 | 35 | IF (GD_FOUND) 36 | IF (WIN32 AND NOT CYGWIN) 37 | SET(GD_SUPPORTS_PNG ON) 38 | SET(GD_SUPPORTS_JPEG ON) 39 | SET(GD_SUPPORTS_GIF ON) 40 | get_filename_component(GD_LIBRARY_DIR ${GD_LIBRARY} PATH) 41 | ELSE (WIN32 AND NOT CYGWIN) 42 | INCLUDE(CheckLibraryExists) 43 | GET_FILENAME_COMPONENT(GD_LIB_PATH ${GD_LIBRARY} PATH) 44 | GET_FILENAME_COMPONENT(GD_LIB ${GD_LIBRARY} NAME) 45 | 46 | CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImagePng" "${GD_LIB_PATH}" GD_SUPPORTS_PNG) 47 | IF (GD_SUPPORTS_PNG) 48 | find_package(PNG) 49 | IF (PNG_FOUND) 50 | SET(GD_LIBRARIES ${GD_LIBRARIES} ${PNG_LIBRARIES}) 51 | SET(GD_INCLUDE_DIR ${GD_INCLUDE_DIR} ${PNG_INCLUDE_DIR}) 52 | ELSE (PNG_FOUND) 53 | SET(GD_SUPPORTS_PNG "NO") 54 | ENDIF (PNG_FOUND) 55 | ENDIF (GD_SUPPORTS_PNG) 56 | 57 | CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImageJpeg" "${GD_LIB_PATH}" GD_SUPPORTS_JPEG) 58 | IF (GD_SUPPORTS_JPEG) 59 | find_package(JPEG) 60 | IF (JPEG_FOUND) 61 | SET(GD_LIBRARIES ${GD_LIBRARIES} ${JPEG_LIBRARIES}) 62 | SET(GD_INCLUDE_DIR ${GD_INCLUDE_DIR} ${JPEG_INCLUDE_DIR}) 63 | ELSE (JPEG_FOUND) 64 | SET(GD_SUPPORTS_JPEG "NO") 65 | ENDIF (JPEG_FOUND) 66 | ENDIF (GD_SUPPORTS_JPEG) 67 | 68 | CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImageGif" "${GD_LIB_PATH}" GD_SUPPORTS_GIF) 69 | 70 | # Trim the list of include directories 71 | SET(GDINCTRIM) 72 | FOREACH(GD_DIR ${GD_INCLUDE_DIR}) 73 | SET(GD_TMP_FOUND OFF) 74 | FOREACH(GD_TRIMMED ${GDINCTRIM}) 75 | IF ("${GD_DIR}" STREQUAL "${GD_TRIMMED}") 76 | SET(GD_TMP_FOUND ON) 77 | ENDIF ("${GD_DIR}" STREQUAL "${GD_TRIMMED}") 78 | ENDFOREACH(GD_TRIMMED ${GDINCTRIM}) 79 | IF (NOT GD_TMP_FOUND) 80 | SET(GDINCTRIM "${GDINCTRIM}" "${GD_DIR}") 81 | ENDIF (NOT GD_TMP_FOUND) 82 | ENDFOREACH(GD_DIR ${GD_INCLUDE_DIR}) 83 | SET(GD_INCLUDE_DIR ${GDINCTRIM}) 84 | 85 | SET(GD_LIBRARY_DIR) 86 | 87 | # Generate trimmed list of library directories and list of libraries 88 | FOREACH(GD_LIB ${GD_LIBRARIES}) 89 | GET_FILENAME_COMPONENT(GD_NEXTLIBDIR ${GD_LIB} PATH) 90 | SET(GD_TMP_FOUND OFF) 91 | FOREACH(GD_LIBDIR ${GD_LIBRARY_DIR}) 92 | IF ("${GD_NEXTLIBDIR}" STREQUAL "${GD_LIBDIR}") 93 | SET(GD_TMP_FOUND ON) 94 | ENDIF ("${GD_NEXTLIBDIR}" STREQUAL "${GD_LIBDIR}") 95 | ENDFOREACH(GD_LIBDIR ${GD_LIBRARIES}) 96 | IF (NOT GD_TMP_FOUND) 97 | SET(GD_LIBRARY_DIR "${GD_LIBRARY_DIR}" "${GD_NEXTLIBDIR}") 98 | ENDIF (NOT GD_TMP_FOUND) 99 | ENDFOREACH(GD_LIB ${GD_LIBRARIES}) 100 | ENDIF (WIN32 AND NOT CYGWIN) 101 | ENDIF (GD_FOUND) 102 | 103 | IF (GD_FOUND) 104 | IF (NOT GD_FIND_QUIETLY) 105 | MESSAGE(STATUS "Found GD: ${GD_LIBRARY}") 106 | ENDIF (NOT GD_FIND_QUIETLY) 107 | ELSE (GD_FOUND) 108 | IF (GD_FIND_REQUIRED) 109 | MESSAGE(FATAL_ERROR "Could not find GD library") 110 | ENDIF (GD_FIND_REQUIRED) 111 | ENDIF (GD_FOUND) 112 | 113 | MARK_AS_ADVANCED( 114 | GD_LIBRARY 115 | GD_LIBRARIES 116 | GD_INCLUDE_DIR 117 | GD_LIBRARY_DIR 118 | GD_SUPPORTS_PNG 119 | GD_SUPPORTS_JPEG 120 | GD_SUPPORTS_GIF 121 | ) 122 | -------------------------------------------------------------------------------- /npiet/config.h.in: -------------------------------------------------------------------------------- 1 | #cmakedefine HAVE_GD_H 2 | #cmakedefine HAVE_PNG_H 3 | #cmakedefine HAVE_GIF_LIB_H -------------------------------------------------------------------------------- /npiet/npiet.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | Copyright (C) 2004 Erik Schoenfelder (schoenfr@web.de) 4 | 5 | This library is free software; you can redistribute it and/or modify it 6 | under the terms of the GNU Library General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or (at your 8 | option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, but WITHOUT 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 | License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public License 16 | along with this library; see the file COPYING.LIB. If not, write to the 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | 02110-1301, USA. 19 | */ 20 | #ifndef NPIET_H 21 | #define NPIET_H 22 | 23 | #define BUF_LEN 300 24 | 25 | /* 26 | * color and hue values: 27 | * 28 | * we order the colors linear: 29 | * 30 | * idx 0: light red 31 | * [...] 32 | * idx 15: dark margenta 33 | * idx 16: white 34 | * idx 17: black 35 | 36 | */ 37 | #define n_hue 6 /* 4 colors */ 38 | #define n_light 3 /* 4 shades */ 39 | #define c_white (n_hue * n_light) 40 | #define c_black (c_white + 1) 41 | #define n_colors (c_black + 1) 42 | /* internal used index for filling areas: */ 43 | #define c_mark_index 9999 44 | 45 | int set_image( int w, int h ); 46 | int read_ppm (char *fname); 47 | int read_png (char *fname); 48 | int get_color_idx (int col); 49 | void set_cell (int x, int y, int val); 50 | void cleanup_input (); 51 | 52 | int piet_run(); 53 | void piet_init(); 54 | int piet_step(); 55 | 56 | /* 57 | * walk along the border of a given colorblock looking about the 58 | * next codel described by dir dp and the cc. 59 | * 60 | * return the coordinates of the new codel and the new directions. 61 | */ 62 | int piet_walk_border (int *n_x, int *n_y, int *num_cells); 63 | /* 64 | * Commands 65 | * Lightness change 66 | * Hue change None 1 Darker 2 Darker 67 | * 68 | * None push pop 69 | * 1 Step add subtract multiply 70 | * 2 Steps divide mod not 71 | * 3 Steps greater pointer switch 72 | * 4 Steps duplicate roll in(number) 73 | * 5 Steps in(char) out(number) out(char) 74 | * 75 | * fill msg with a string describing the action (limited space). 76 | * 77 | * return -1 on error condition (actually there is none) 78 | */ 79 | 80 | int piet_action (int c_col, int a_col, int num_cells, char *msg); 81 | 82 | #endif /*NPIET_H*/ -------------------------------------------------------------------------------- /npiet/npiet_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | #include "npiet_utils.h" 20 | 21 | #include 22 | #include 23 | 24 | void* step_object = 0; 25 | step_callback_t step_callback = 0; 26 | 27 | void* action_object = 0; 28 | action_callback_t action_callback = 0; 29 | 30 | void* readint_object = 0; 31 | readint_callback_t readint_callback = 0; 32 | 33 | void* readchar_object = 0; 34 | readchar_callback_t readchar_callback = 0; 35 | 36 | long *before_stack = 0; 37 | long *after_stack = 0; 38 | int before_num = 0; 39 | int after_num = 0; 40 | 41 | 42 | void notify_step( int step, int px, int py, int pdp, int pcc, int pcol, 43 | int nx, int ny, int ndp, int ncc, int ncol ) 44 | { 45 | if( step_callback ) { 46 | struct trace_step *s; 47 | s = malloc( sizeof( struct trace_step ) ); 48 | 49 | s->execution_step = step; 50 | 51 | s->p_xpos = px; 52 | s->p_ypos = py; 53 | s->p_dp = pdp; 54 | s->p_cc = pcc; 55 | s->p_color = pcol; 56 | 57 | s->n_xpos = nx; 58 | s->n_ypos = ny; 59 | s->n_dp = ndp; 60 | s->n_cc = ncc; 61 | s->n_color = ncol; 62 | 63 | step_callback(step_object, s ); 64 | } 65 | } 66 | 67 | void notify_action( int hue_change, int light_change, int value, char* msg ) 68 | { 69 | if( step_callback ) { 70 | struct trace_action *a; 71 | a = malloc( sizeof( struct trace_action ) ); 72 | 73 | a->hue_change = hue_change; 74 | a->light_change = light_change; 75 | a->value = value; 76 | a->msg = strdup( msg ); 77 | 78 | a->after_stack = after_stack; 79 | a->after_num = after_num; 80 | 81 | a->before_stack = before_stack; 82 | a->before_num = before_num; 83 | 84 | action_callback(action_object, a ); 85 | } 86 | } 87 | 88 | void notify_stack_before(long int* stack, int num_stack) 89 | { 90 | int i; 91 | before_stack = malloc( sizeof( long ) * num_stack ); 92 | before_num = num_stack; 93 | for ( i = 0; i < num_stack; i++ ) { 94 | before_stack[i] = stack[i]; 95 | } 96 | } 97 | 98 | void notify_stack_after(long int* stack, int num_stack) 99 | { 100 | int i; 101 | after_stack = malloc( sizeof( long ) * num_stack ); 102 | after_num = num_stack; 103 | for ( i = 0; i < num_stack; i++ ) { 104 | after_stack[i] = stack[i]; 105 | } 106 | } 107 | 108 | void register_step_callback( step_callback_t callable, void* obj ) 109 | { 110 | step_object = obj; 111 | step_callback = callable; 112 | } 113 | 114 | void register_action_callback( action_callback_t callable, void* obj ) 115 | { 116 | action_object = obj; 117 | action_callback = callable; 118 | } 119 | 120 | int read_int() 121 | { 122 | return readint_callback( readint_object ); 123 | } 124 | 125 | char read_char() 126 | { 127 | return readchar_callback( readchar_object ); 128 | } 129 | 130 | void register_readchar_callback( readchar_callback_t callable, void* obj ) 131 | { 132 | readchar_object = obj; 133 | readchar_callback = callable; 134 | } 135 | 136 | void register_readint_callback( readint_callback_t callable, void* obj ) 137 | { 138 | readint_object = obj; 139 | readint_callback = callable; 140 | } 141 | 142 | -------------------------------------------------------------------------------- /npiet/npiet_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Casey Link 3 | 4 | This library is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or (at your 7 | option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 | License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to the 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. 18 | */ 19 | 20 | 21 | struct trace_step { 22 | int execution_step; /**< step number */ 23 | 24 | int p_xpos, p_ypos; /**< */ 25 | int p_dp, p_cc; /**< previous values of dp and cc */ 26 | int p_color; /**< color of cell at p_xpos, p_ypos */ 27 | 28 | int n_xpos, n_ypos; /**< next x and y positions */ 29 | int n_dp, n_cc; /**< next values of dp and cc */ 30 | int n_color; /**< color of cell at n_xpos, n_ypos */ 31 | }; 32 | 33 | struct trace_action { 34 | int hue_change; 35 | int light_change; 36 | int value; 37 | 38 | int before_num; 39 | long *before_stack; 40 | 41 | int after_num; 42 | long* after_stack; 43 | 44 | char* msg; 45 | }; 46 | 47 | /** 48 | * step - step number 49 | * px/py - prev x,y coord 50 | * pdp/pcc - prev dp/cc 51 | * pcol - prev color 52 | * 53 | * nx/ny - next x,y coord 54 | * ndp/ncc - next dp/cc 55 | * ncol - next color 56 | */ 57 | void notify_step( int step, int px, int py, int pdp, int pcc, int pcol, 58 | int nx, int ny, int ndp, int ncc, int ncol ); 59 | 60 | void notify_action( int hue_change, int light_change, int value, char* msg ); 61 | 62 | void notify_stack_before( long* stack, int num_stack ); 63 | void notify_stack_after( long* stack, int num_stack ); 64 | 65 | typedef void (*step_callback_t)( void* object, struct trace_step* ); 66 | typedef void (*action_callback_t)( void* object, struct trace_action* ); 67 | 68 | void register_step_callback( step_callback_t callable, void* obj ); 69 | void register_action_callback( action_callback_t callable, void* obj ); 70 | 71 | 72 | int read_int(); 73 | char read_char(); 74 | 75 | typedef int (*readint_callback_t)( void* object ); 76 | typedef char (*readchar_callback_t)( void* object ); 77 | 78 | void register_readint_callback( readint_callback_t callable, void* obj ); 79 | void register_readchar_callback( readchar_callback_t callable, void* obj ); 80 | -------------------------------------------------------------------------------- /npiet/test/NPietTest.cpp: -------------------------------------------------------------------------------- 1 | #include "NPietTest.h" 2 | 3 | extern "C" 4 | { 5 | #include "../npiet.h" 6 | } 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | void NPietTest::initTestCase() 13 | { 14 | } 15 | 16 | void NPietTest::simpleTest() 17 | { 18 | QImage image( "nhello.png" ); 19 | image = image.convertToFormat( QImage::Format_RGB32 ); 20 | qDebug() << image.bits() << image.width() << image.height(); 21 | QRgb* cells = (QRgb*) image.bits(); 22 | set_image( image.width(), image.height()); 23 | for( int i = 0; i < image.height(); ++i ) { 24 | QRgb* lineptr = (QRgb*) image.scanLine( i ); 25 | for( int j = 0; j < image.width(); ++j ) { 26 | int r = qRed( lineptr[j] ); 27 | int g = qGreen( lineptr[j] ); 28 | int b = qBlue( lineptr[j] ); 29 | int col = ((r * 256 + g) * 256) + b; 30 | int col_idx = get_color_idx (col); 31 | if (col_idx < 0) { 32 | /* set to black or white: */ 33 | col_idx = (/*unknown_color*/1 == 0 ? c_black : c_white); 34 | } 35 | set_cell (j, i, col_idx); 36 | } 37 | } 38 | qDebug() << "result:" << piet_run(); 39 | } 40 | 41 | QTEST_MAIN( NPietTest ) 42 | 43 | #include "NPietTest.moc" -------------------------------------------------------------------------------- /npiet/test/NPietTest.h: -------------------------------------------------------------------------------- 1 | #ifndef NPIETTEST_H 2 | #define NPIETTEST_H 3 | 4 | #include 5 | class NPietTest : public QObject 6 | { 7 | Q_OBJECT 8 | private slots: 9 | void initTestCase(); 10 | void simpleTest(); 11 | }; 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /npiet/win32/LICENSE.gd: -------------------------------------------------------------------------------- 1 | 2 | Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 3 | 2002 by Cold Spring Harbor Laboratory. Funded under Grant 4 | P41-RR02188 by the National Institutes of Health. 5 | 6 | Portions copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 by 7 | Boutell.Com, Inc. 8 | 9 | Portions relating to GD2 format copyright 1999, 2000, 2001, 2002 10 | Philip Warner. 11 | 12 | Portions relating to PNG copyright 1999, 2000, 2001, 2002 Greg 13 | Roelofs. 14 | 15 | Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002 John 16 | Ellson (ellson@lucent.com). 17 | 18 | Portions relating to gdft.c copyright 2001, 2002 John Ellson 19 | (ellson@lucent.com). 20 | 21 | Portions copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 22 | Pierre-Alain Joye (pierre@libgd.org). 23 | 24 | Portions relating to JPEG and to color quantization copyright 2000, 25 | 2001, 2002, Doug Becker and copyright (C) 1994, 1995, 1996, 1997, 26 | 1998, 1999, 2000, 2001, 2002, Thomas G. Lane. This software is 27 | based in part on the work of the Independent JPEG Group. See the 28 | file README-JPEG.TXT for more information. 29 | 30 | Portions relating to WBMP copyright 2000, 2001, 2002 Maurice 31 | Szmurlo and Johan Van den Brande. 32 | 33 | Permission has been granted to copy, distribute and modify gd in 34 | any context without fee, including a commercial application, 35 | provided that this notice is present in user-accessible supporting 36 | documentation. 37 | 38 | This does not affect your ownership of the derived work itself, and 39 | the intent is to assure proper credit for the authors of gd, not to 40 | interfere with your productive use of gd. If you have questions, 41 | ask. "Derived works" includes all programs that utilize the 42 | library. Credit must be given in user-accessible documentation. 43 | 44 | This software is provided "AS IS." The copyright holders disclaim 45 | all warranties, either express or implied, including but not 46 | limited to implied warranties of merchantability and fitness for a 47 | particular purpose, with respect to this code and accompanying 48 | documentation. 49 | 50 | Although their code does not appear in gd, the authors wish to thank 51 | David Koblas, David Rowley, and Hutchison Avenue Software Corporation 52 | for their prior contributions. 53 | 54 | -------------------------------------------------------------------------------- /npiet/win32/LICENSE.libpng: -------------------------------------------------------------------------------- 1 | 2 | This copy of the libpng notices is provided for your convenience. In case of 3 | any discrepancy between this copy and the notices in the file png.h that is 4 | included in the libpng distribution, the latter shall prevail. 5 | 6 | COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: 7 | 8 | If you modify libpng you may insert additional notices immediately following 9 | this sentence. 10 | 11 | libpng versions 1.2.6, August 15, 2004, through 1.2.37, June 4, 2009, are 12 | Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are 13 | distributed according to the same disclaimer and license as libpng-1.2.5 14 | with the following individual added to the list of Contributing Authors 15 | 16 | Cosmin Truta 17 | 18 | libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are 19 | Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are 20 | distributed according to the same disclaimer and license as libpng-1.0.6 21 | with the following individuals added to the list of Contributing Authors 22 | 23 | Simon-Pierre Cadieux 24 | Eric S. Raymond 25 | Gilles Vollant 26 | 27 | and with the following additions to the disclaimer: 28 | 29 | There is no warranty against interference with your enjoyment of the 30 | library or against infringement. There is no warranty that our 31 | efforts or the library will fulfill any of your particular purposes 32 | or needs. This library is provided with all faults, and the entire 33 | risk of satisfactory quality, performance, accuracy, and effort is with 34 | the user. 35 | 36 | libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are 37 | Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are 38 | distributed according to the same disclaimer and license as libpng-0.96, 39 | with the following individuals added to the list of Contributing Authors: 40 | 41 | Tom Lane 42 | Glenn Randers-Pehrson 43 | Willem van Schaik 44 | 45 | libpng versions 0.89, June 1996, through 0.96, May 1997, are 46 | Copyright (c) 1996, 1997 Andreas Dilger 47 | Distributed according to the same disclaimer and license as libpng-0.88, 48 | with the following individuals added to the list of Contributing Authors: 49 | 50 | John Bowler 51 | Kevin Bracey 52 | Sam Bushell 53 | Magnus Holmgren 54 | Greg Roelofs 55 | Tom Tanner 56 | 57 | libpng versions 0.5, May 1995, through 0.88, January 1996, are 58 | Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. 59 | 60 | For the purposes of this copyright and license, "Contributing Authors" 61 | is defined as the following set of individuals: 62 | 63 | Andreas Dilger 64 | Dave Martindale 65 | Guy Eric Schalnat 66 | Paul Schmidt 67 | Tim Wegner 68 | 69 | The PNG Reference Library is supplied "AS IS". The Contributing Authors 70 | and Group 42, Inc. disclaim all warranties, expressed or implied, 71 | including, without limitation, the warranties of merchantability and of 72 | fitness for any purpose. The Contributing Authors and Group 42, Inc. 73 | assume no liability for direct, indirect, incidental, special, exemplary, 74 | or consequential damages, which may result from the use of the PNG 75 | Reference Library, even if advised of the possibility of such damage. 76 | 77 | Permission is hereby granted to use, copy, modify, and distribute this 78 | source code, or portions hereof, for any purpose, without fee, subject 79 | to the following restrictions: 80 | 81 | 1. The origin of this source code must not be misrepresented. 82 | 83 | 2. Altered versions must be plainly marked as such and must not 84 | be misrepresented as being the original source. 85 | 86 | 3. This Copyright notice may not be removed or altered from any 87 | source or altered source distribution. 88 | 89 | The Contributing Authors and Group 42, Inc. specifically permit, without 90 | fee, and encourage the use of this source code as a component to 91 | supporting the PNG file format in commercial products. If you use this 92 | source code in a product, acknowledgment is not required but would be 93 | appreciated. 94 | 95 | 96 | A "png_get_copyright" function is available, for convenient use in "about" 97 | boxes and the like: 98 | 99 | printf("%s",png_get_copyright(NULL)); 100 | 101 | Also, the PNG logo (in PNG format, of course) is supplied in the 102 | files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). 103 | 104 | Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a 105 | certification mark of the Open Source Initiative. 106 | 107 | Glenn Randers-Pehrson 108 | glennrp at users.sourceforge.net 109 | June 4, 2009 110 | -------------------------------------------------------------------------------- /npiet/win32/LICENSE.zlib: -------------------------------------------------------------------------------- 1 | ZLIB DATA COMPRESSION LIBRARY 2 | 3 | zlib 1.2.3 is a general purpose data compression library. All the code is 4 | thread safe. The data format used by the zlib library is described by RFCs 5 | (Request for Comments) 1950 to 1952 in the files 6 | http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) 7 | and rfc1952.txt (gzip format). These documents are also available in other 8 | formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html 9 | 10 | All functions of the compression library are documented in the file zlib.h 11 | (volunteer to write man pages welcome, contact zlib@gzip.org). A usage example 12 | of the library is given in the file example.c which also tests that the library 13 | is working correctly. Another example is given in the file minigzip.c. The 14 | compression library itself is composed of all source files except example.c and 15 | minigzip.c. 16 | 17 | To compile all files and run the test program, follow the instructions given at 18 | the top of Makefile. In short "make test; make install" should work for most 19 | machines. For Unix: "./configure; make test; make install". For MSDOS, use one 20 | of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. 21 | 22 | Questions about zlib should be sent to , or to Gilles Vollant 23 | for the Windows DLL version. The zlib home page is 24 | http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, 25 | please check this site to verify that you have the latest version of zlib; 26 | otherwise get the latest version and check whether the problem still exists or 27 | not. 28 | 29 | PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking 30 | for help. 31 | 32 | Mark Nelson wrote an article about zlib for the Jan. 1997 33 | issue of Dr. Dobb's Journal; a copy of the article is available in 34 | http://dogma.net/markn/articles/zlibtool/zlibtool.htm 35 | 36 | The changes made in version 1.2.3 are documented in the file ChangeLog. 37 | 38 | Unsupported third party contributions are provided in directory "contrib". 39 | 40 | A Java implementation of zlib is available in the Java Development Kit 41 | http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html 42 | See the zlib home page http://www.zlib.org for details. 43 | 44 | A Perl interface to zlib written by Paul Marquess is in the 45 | CPAN (Comprehensive Perl Archive Network) sites 46 | http://www.cpan.org/modules/by-module/Compress/ 47 | 48 | A Python interface to zlib written by A.M. Kuchling is 49 | available in Python 1.5 and later versions, see 50 | http://www.python.org/doc/lib/module-zlib.html 51 | 52 | A zlib binding for TCL written by Andreas Kupries is 53 | availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html 54 | 55 | An experimental package to read and write files in .zip format, written on top 56 | of zlib by Gilles Vollant , is available in the 57 | contrib/minizip directory of zlib. 58 | 59 | 60 | Notes for some targets: 61 | 62 | - For Windows DLL versions, please see win32/DLL_FAQ.txt 63 | 64 | - For 64-bit Irix, deflate.c must be compiled without any optimization. With 65 | -O, one libpng test fails. The test works in 32 bit mode (with the -n32 66 | compiler flag). The compiler bug has been reported to SGI. 67 | 68 | - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works 69 | when compiled with cc. 70 | 71 | - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is 72 | necessary to get gzprintf working correctly. This is done by configure. 73 | 74 | - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with 75 | other compilers. Use "make test" to check your compiler. 76 | 77 | - gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. 78 | 79 | - For PalmOs, see http://palmzlib.sourceforge.net/ 80 | 81 | - When building a shared, i.e. dynamic library on Mac OS X, the library must be 82 | installed before testing (do "make install" before "make test"), since the 83 | library location is specified in the library. 84 | 85 | 86 | Acknowledgments: 87 | 88 | The deflate format used by zlib was defined by Phil Katz. The deflate 89 | and zlib specifications were written by L. Peter Deutsch. Thanks to all the 90 | people who reported problems and suggested various improvements in zlib; 91 | they are too numerous to cite here. 92 | 93 | Copyright notice: 94 | 95 | (C) 1995-2004 Jean-loup Gailly and Mark Adler 96 | 97 | This software is provided 'as-is', without any express or implied 98 | warranty. In no event will the authors be held liable for any damages 99 | arising from the use of this software. 100 | 101 | Permission is granted to anyone to use this software for any purpose, 102 | including commercial applications, and to alter it and redistribute it 103 | freely, subject to the following restrictions: 104 | 105 | 1. The origin of this software must not be misrepresented; you must not 106 | claim that you wrote the original software. If you use this software 107 | in a product, an acknowledgment in the product documentation would be 108 | appreciated but is not required. 109 | 2. Altered source versions must be plainly marked as such, and must not be 110 | misrepresented as being the original software. 111 | 3. This notice may not be removed or altered from any source distribution. 112 | 113 | Jean-loup Gailly Mark Adler 114 | jloup@gzip.org madler@alumni.caltech.edu 115 | 116 | If you use the zlib library in a product, we would appreciate *not* 117 | receiving lengthy legal documents to sign. The sources are provided 118 | for free but without warranty of any kind. The library has been 119 | entirely written by Jean-loup Gailly and Mark Adler; it does not 120 | include third-party code. 121 | 122 | If you redistribute modified sources, we would appreciate that you include 123 | in the file ChangeLog history information documenting your changes. Please 124 | read the FAQ for more information on the distribution of modified source 125 | versions. 126 | -------------------------------------------------------------------------------- /npiet/win32/bin/bgd.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/bin/bgd.dll -------------------------------------------------------------------------------- /npiet/win32/bin/libpng12.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/bin/libpng12.dll -------------------------------------------------------------------------------- /npiet/win32/bin/libpng3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/bin/libpng3.dll -------------------------------------------------------------------------------- /npiet/win32/bin/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/bin/zlib1.dll -------------------------------------------------------------------------------- /npiet/win32/include/entities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated file - do not edit directly. 3 | * 4 | * This file was generated from: 5 | * http://www.w3.org/TR/REC-html40/sgml/entities.html 6 | * by means of the script: 7 | * entities.tcl 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct entities_s { 15 | char *name; 16 | int value; 17 | } entities[] = { 18 | {"AElig", 198}, 19 | {"Aacute", 193}, 20 | {"Acirc", 194}, 21 | {"Agrave", 192}, 22 | {"Alpha", 913}, 23 | {"Aring", 197}, 24 | {"Atilde", 195}, 25 | {"Auml", 196}, 26 | {"Beta", 914}, 27 | {"Ccedil", 199}, 28 | {"Chi", 935}, 29 | {"Dagger", 8225}, 30 | {"Delta", 916}, 31 | {"ETH", 208}, 32 | {"Eacute", 201}, 33 | {"Ecirc", 202}, 34 | {"Egrave", 200}, 35 | {"Epsilon", 917}, 36 | {"Eta", 919}, 37 | {"Euml", 203}, 38 | {"Gamma", 915}, 39 | {"Iacute", 205}, 40 | {"Icirc", 206}, 41 | {"Igrave", 204}, 42 | {"Iota", 921}, 43 | {"Iuml", 207}, 44 | {"Kappa", 922}, 45 | {"Lambda", 923}, 46 | {"Mu", 924}, 47 | {"Ntilde", 209}, 48 | {"Nu", 925}, 49 | {"OElig", 338}, 50 | {"Oacute", 211}, 51 | {"Ocirc", 212}, 52 | {"Ograve", 210}, 53 | {"Omega", 937}, 54 | {"Omicron", 927}, 55 | {"Oslash", 216}, 56 | {"Otilde", 213}, 57 | {"Ouml", 214}, 58 | {"Phi", 934}, 59 | {"Pi", 928}, 60 | {"Prime", 8243}, 61 | {"Psi", 936}, 62 | {"Rho", 929}, 63 | {"Scaron", 352}, 64 | {"Sigma", 931}, 65 | {"THORN", 222}, 66 | {"Tau", 932}, 67 | {"Theta", 920}, 68 | {"Uacute", 218}, 69 | {"Ucirc", 219}, 70 | {"Ugrave", 217}, 71 | {"Upsilon", 933}, 72 | {"Uuml", 220}, 73 | {"Xi", 926}, 74 | {"Yacute", 221}, 75 | {"Yuml", 376}, 76 | {"Zeta", 918}, 77 | {"aacute", 225}, 78 | {"acirc", 226}, 79 | {"acute", 180}, 80 | {"aelig", 230}, 81 | {"agrave", 224}, 82 | {"alefsym", 8501}, 83 | {"alpha", 945}, 84 | {"amp", 38}, 85 | {"and", 8743}, 86 | {"ang", 8736}, 87 | {"aring", 229}, 88 | {"asymp", 8776}, 89 | {"atilde", 227}, 90 | {"auml", 228}, 91 | {"bdquo", 8222}, 92 | {"beta", 946}, 93 | {"brvbar", 166}, 94 | {"bull", 8226}, 95 | {"cap", 8745}, 96 | {"ccedil", 231}, 97 | {"cedil", 184}, 98 | {"cent", 162}, 99 | {"chi", 967}, 100 | {"circ", 710}, 101 | {"clubs", 9827}, 102 | {"cong", 8773}, 103 | {"copy", 169}, 104 | {"crarr", 8629}, 105 | {"cup", 8746}, 106 | {"curren", 164}, 107 | {"dArr", 8659}, 108 | {"dagger", 8224}, 109 | {"darr", 8595}, 110 | {"deg", 176}, 111 | {"delta", 948}, 112 | {"diams", 9830}, 113 | {"divide", 247}, 114 | {"eacute", 233}, 115 | {"ecirc", 234}, 116 | {"egrave", 232}, 117 | {"empty", 8709}, 118 | {"emsp", 8195}, 119 | {"ensp", 8194}, 120 | {"epsilon", 949}, 121 | {"equiv", 8801}, 122 | {"eta", 951}, 123 | {"eth", 240}, 124 | {"euml", 235}, 125 | {"euro", 8364}, 126 | {"exist", 8707}, 127 | {"fnof", 402}, 128 | {"forall", 8704}, 129 | {"frac12", 189}, 130 | {"frac14", 188}, 131 | {"frac34", 190}, 132 | {"frasl", 8260}, 133 | {"gamma", 947}, 134 | {"ge", 8805}, 135 | {"gt", 62}, 136 | {"hArr", 8660}, 137 | {"harr", 8596}, 138 | {"hearts", 9829}, 139 | {"hellip", 8230}, 140 | {"iacute", 237}, 141 | {"icirc", 238}, 142 | {"iexcl", 161}, 143 | {"igrave", 236}, 144 | {"image", 8465}, 145 | {"infin", 8734}, 146 | {"int", 8747}, 147 | {"iota", 953}, 148 | {"iquest", 191}, 149 | {"isin", 8712}, 150 | {"iuml", 239}, 151 | {"kappa", 954}, 152 | {"lArr", 8656}, 153 | {"lambda", 955}, 154 | {"lang", 9001}, 155 | {"laquo", 171}, 156 | {"larr", 8592}, 157 | {"lceil", 8968}, 158 | {"ldquo", 8220}, 159 | {"le", 8804}, 160 | {"lfloor", 8970}, 161 | {"lowast", 8727}, 162 | {"loz", 9674}, 163 | {"lrm", 8206}, 164 | {"lsaquo", 8249}, 165 | {"lsquo", 8216}, 166 | {"lt", 60}, 167 | {"macr", 175}, 168 | {"mdash", 8212}, 169 | {"micro", 181}, 170 | {"middot", 183}, 171 | {"minus", 8722}, 172 | {"mu", 956}, 173 | {"nabla", 8711}, 174 | {"nbsp", 160}, 175 | {"ndash", 8211}, 176 | {"ne", 8800}, 177 | {"ni", 8715}, 178 | {"not", 172}, 179 | {"notin", 8713}, 180 | {"nsub", 8836}, 181 | {"ntilde", 241}, 182 | {"nu", 957}, 183 | {"oacute", 243}, 184 | {"ocirc", 244}, 185 | {"oelig", 339}, 186 | {"ograve", 242}, 187 | {"oline", 8254}, 188 | {"omega", 969}, 189 | {"omicron", 959}, 190 | {"oplus", 8853}, 191 | {"or", 8744}, 192 | {"ordf", 170}, 193 | {"ordm", 186}, 194 | {"oslash", 248}, 195 | {"otilde", 245}, 196 | {"otimes", 8855}, 197 | {"ouml", 246}, 198 | {"para", 182}, 199 | {"part", 8706}, 200 | {"permil", 8240}, 201 | {"perp", 8869}, 202 | {"phi", 966}, 203 | {"pi", 960}, 204 | {"piv", 982}, 205 | {"plusmn", 177}, 206 | {"pound", 163}, 207 | {"prime", 8242}, 208 | {"prod", 8719}, 209 | {"prop", 8733}, 210 | {"psi", 968}, 211 | {"quot", 34}, 212 | {"rArr", 8658}, 213 | {"radic", 8730}, 214 | {"rang", 9002}, 215 | {"raquo", 187}, 216 | {"rarr", 8594}, 217 | {"rceil", 8969}, 218 | {"rdquo", 8221}, 219 | {"real", 8476}, 220 | {"reg", 174}, 221 | {"rfloor", 8971}, 222 | {"rho", 961}, 223 | {"rlm", 8207}, 224 | {"rsaquo", 8250}, 225 | {"rsquo", 8217}, 226 | {"sbquo", 8218}, 227 | {"scaron", 353}, 228 | {"sdot", 8901}, 229 | {"sect", 167}, 230 | {"shy", 173}, 231 | {"sigma", 963}, 232 | {"sigmaf", 962}, 233 | {"sim", 8764}, 234 | {"spades", 9824}, 235 | {"sub", 8834}, 236 | {"sube", 8838}, 237 | {"sum", 8721}, 238 | {"sup", 8835}, 239 | {"sup1", 185}, 240 | {"sup2", 178}, 241 | {"sup3", 179}, 242 | {"supe", 8839}, 243 | {"szlig", 223}, 244 | {"tau", 964}, 245 | {"there4", 8756}, 246 | {"theta", 952}, 247 | {"thetasym", 977}, 248 | {"thinsp", 8201}, 249 | {"thorn", 254}, 250 | {"tilde", 732}, 251 | {"times", 215}, 252 | {"trade", 8482}, 253 | {"uArr", 8657}, 254 | {"uacute", 250}, 255 | {"uarr", 8593}, 256 | {"ucirc", 251}, 257 | {"ugrave", 249}, 258 | {"uml", 168}, 259 | {"upsih", 978}, 260 | {"upsilon", 965}, 261 | {"uuml", 252}, 262 | {"weierp", 8472}, 263 | {"xi", 958}, 264 | {"yacute", 253}, 265 | {"yen", 165}, 266 | {"yuml", 255}, 267 | {"zeta", 950}, 268 | {"zwj", 8205}, 269 | {"zwnj", 8204}, 270 | }; 271 | 272 | #define ENTITY_NAME_LENGTH_MAX 8 273 | #define NR_OF_ENTITIES 252 274 | 275 | #ifdef __cplusplus 276 | } 277 | #endif 278 | -------------------------------------------------------------------------------- /npiet/win32/include/gd_io.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | #ifndef GD_IO_H 6 | #define GD_IO_H 1 7 | 8 | #include 9 | 10 | #ifdef VMS 11 | #define Putchar gdPutchar 12 | #endif 13 | 14 | typedef struct gdIOCtx 15 | { 16 | int (*getC) (struct gdIOCtx *); 17 | int (*getBuf) (struct gdIOCtx *, void *, int); 18 | 19 | void (*putC) (struct gdIOCtx *, int); 20 | int (*putBuf) (struct gdIOCtx *, const void *, int); 21 | 22 | /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */ 23 | int (*seek) (struct gdIOCtx *, const int); 24 | 25 | long (*tell) (struct gdIOCtx *); 26 | 27 | void (*gd_free) (struct gdIOCtx *); 28 | 29 | } 30 | gdIOCtx; 31 | 32 | typedef struct gdIOCtx *gdIOCtxPtr; 33 | 34 | void Putword (int w, gdIOCtx * ctx); 35 | void Putchar (int c, gdIOCtx * ctx); 36 | 37 | void gdPutC (const unsigned char c, gdIOCtx * ctx); 38 | int gdPutBuf (const void *, int, gdIOCtx *); 39 | void gdPutWord (int w, gdIOCtx * ctx); 40 | void gdPutInt (int w, gdIOCtx * ctx); 41 | 42 | int gdGetC (gdIOCtx * ctx); 43 | int gdGetBuf (void *, int, gdIOCtx *); 44 | int gdGetByte (int *result, gdIOCtx * ctx); 45 | int gdGetWord (int *result, gdIOCtx * ctx); 46 | int gdGetInt (int *result, gdIOCtx * ctx); 47 | 48 | int gdSeek (gdIOCtx * ctx, const int offset); 49 | long gdTell (gdIOCtx * ctx); 50 | 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | -------------------------------------------------------------------------------- /npiet/win32/include/gdcache.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | /* 6 | * gdcache.h 7 | * 8 | * Caches of pointers to user structs in which the least-recently-used 9 | * element is replaced in the event of a cache miss after the cache has 10 | * reached a given size. 11 | * 12 | * John Ellson (ellson@graphviz.org) Oct 31, 1997 13 | * 14 | * Test this with: 15 | * gcc -o gdcache -g -Wall -DTEST gdcache.c 16 | * 17 | * The cache is implemented by a singly-linked list of elements 18 | * each containing a pointer to a user struct that is being managed by 19 | * the cache. 20 | * 21 | * The head structure has a pointer to the most-recently-used 22 | * element, and elements are moved to this position in the list each 23 | * time they are used. The head also contains pointers to three 24 | * user defined functions: 25 | * - a function to test if a cached userdata matches some keydata 26 | * - a function to provide a new userdata struct to the cache 27 | * if there has been a cache miss. 28 | * - a function to release a userdata struct when it is 29 | * no longer being managed by the cache 30 | * 31 | * In the event of a cache miss the cache is allowed to grow up to 32 | * a specified maximum size. After the maximum size is reached then 33 | * the least-recently-used element is discarded to make room for the 34 | * new. The most-recently-returned value is always left at the 35 | * beginning of the list after retrieval. 36 | * 37 | * In the current implementation the cache is traversed by a linear 38 | * search from most-recent to least-recent. This linear search 39 | * probably limits the usefulness of this implementation to cache 40 | * sizes of a few tens of elements. 41 | */ 42 | 43 | /*********************************************************/ 44 | /* header */ 45 | /*********************************************************/ 46 | 47 | #ifdef HAVE_CONFIG_H 48 | #include "config.h" 49 | #endif 50 | 51 | #include 52 | #ifndef NULL 53 | #define NULL (void *)0 54 | #endif 55 | 56 | /* user defined function templates */ 57 | typedef int (*gdCacheTestFn_t) (void *userdata, void *keydata); 58 | typedef void *(*gdCacheFetchFn_t) (char **error, void *keydata); 59 | typedef void (*gdCacheReleaseFn_t) (void *userdata); 60 | 61 | /* element structure */ 62 | typedef struct gdCache_element_s gdCache_element_t; 63 | struct gdCache_element_s 64 | { 65 | gdCache_element_t *next; 66 | void *userdata; 67 | }; 68 | 69 | /* head structure */ 70 | typedef struct gdCache_head_s gdCache_head_t; 71 | struct gdCache_head_s 72 | { 73 | gdCache_element_t *mru; 74 | int size; 75 | char *error; 76 | gdCacheTestFn_t gdCacheTest; 77 | gdCacheFetchFn_t gdCacheFetch; 78 | gdCacheReleaseFn_t gdCacheRelease; 79 | }; 80 | 81 | /* function templates */ 82 | gdCache_head_t *gdCacheCreate (int size, 83 | gdCacheTestFn_t gdCacheTest, 84 | gdCacheFetchFn_t gdCacheFetch, 85 | gdCacheReleaseFn_t gdCacheRelease); 86 | 87 | void gdCacheDelete (gdCache_head_t * head); 88 | 89 | void *gdCacheGet (gdCache_head_t * head, void *keydata); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | -------------------------------------------------------------------------------- /npiet/win32/include/gdfontg.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | 6 | #ifndef _GDFONTG_H_ 7 | #define _GDFONTG_H_ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | /* 15 | This is a header file for gd font, generated using 16 | bdftogd version 0.51 by Jan Pazdziora, adelton@fi.muni.cz 17 | from bdf font 18 | -Misc-Fixed-Bold-R-Normal-Sans-15-140-75-75-C-90-ISO8859-2 19 | at Mon Jan 26 14:45:58 1998. 20 | The original bdf was holding following copyright: 21 | "Libor Skarvada, libor@informatics.muni.cz" 22 | */ 23 | 24 | 25 | #include "gd.h" 26 | 27 | BGD_EXPORT_DATA_PROT gdFontPtr gdFontGiant; 28 | BGD_DECLARE(gdFontPtr) gdFontGetGiant(void); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /npiet/win32/include/gdfontl.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | 6 | #ifndef _GDFONTL_H_ 7 | #define _GDFONTL_H_ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | /* 15 | This is a header file for gd font, generated using 16 | bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz 17 | from bdf font 18 | -misc-fixed-medium-r-normal--16-140-75-75-c-80-iso8859-2 19 | at Tue Jan 6 19:39:27 1998. 20 | 21 | The original bdf was holding following copyright: 22 | "Libor Skarvada, libor@informatics.muni.cz" 23 | */ 24 | 25 | 26 | #include "gd.h" 27 | 28 | BGD_EXPORT_DATA_PROT gdFontPtr gdFontLarge; 29 | BGD_DECLARE(gdFontPtr) gdFontGetLarge(void); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /npiet/win32/include/gdfontmb.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | 6 | #ifndef _GDFONTMB_H_ 7 | #define _GDFONTMB_H_ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | /* 15 | This is a header file for gd font, generated using 16 | bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz 17 | from bdf font 18 | -misc-fixed-bold-r-normal-sans-13-94-100-100-c-70-iso8859-2 19 | at Thu Jan 8 13:54:57 1998. 20 | No copyright info was found in the original bdf. 21 | */ 22 | 23 | 24 | #include "gd.h" 25 | 26 | BGD_EXPORT_DATA_PROT gdFontPtr gdFontMediumBold; 27 | BGD_DECLARE(gdFontPtr) gdFontGetMediumBold(void); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /npiet/win32/include/gdfonts.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | 6 | #ifndef _GDFONTS_H_ 7 | #define _GDFONTS_H_ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | /* 15 | This is a header file for gd font, generated using 16 | bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz 17 | from bdf font 18 | -misc-fixed-medium-r-semicondensed-sans-12-116-75-75-c-60-iso8859-2 19 | at Thu Jan 8 14:13:20 1998. 20 | No copyright info was found in the original bdf. 21 | */ 22 | 23 | 24 | #include "gd.h" 25 | 26 | BGD_EXPORT_DATA_PROT gdFontPtr gdFontSmall; 27 | BGD_DECLARE(gdFontPtr) gdFontGetSmall(void); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /npiet/win32/include/gdfontt.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | 6 | #ifndef _GDFONTT_H_ 7 | #define _GDFONTT_H_ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | /* 15 | This is a header file for gd font, generated using 16 | bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz 17 | from bdf font 18 | -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO8859-2 19 | at Thu Jan 8 13:49:54 1998. 20 | The original bdf was holding following copyright: 21 | "Libor Skarvada, libor@informatics.muni.cz" 22 | */ 23 | 24 | 25 | #include "gd.h" 26 | 27 | BGD_EXPORT_DATA_PROT gdFontPtr gdFontTiny; 28 | BGD_DECLARE(gdFontPtr) gdFontGetTiny(void); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /npiet/win32/include/gdfx.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | #ifndef GDFX_H 6 | #define GDFX_H 1 7 | 8 | #include "gd.h" 9 | 10 | /* im MUST be square, but can have any size. Returns a new image 11 | of width and height radius * 2, in which the X axis of 12 | the original has been remapped to theta (angle) and the Y axis 13 | of the original has been remapped to rho (distance from center). 14 | This is known as a "polar coordinate transform." */ 15 | 16 | BGD_DECLARE(gdImagePtr) gdImageSquareToCircle(gdImagePtr im, int radius); 17 | 18 | /* Draws the text 'top' and 'bottom' on 'im', curved along the 19 | edge of a circle of radius 'radius', with its 20 | center at 'cx' and 'cy'. 'top' is written clockwise 21 | along the top; 'bottom' is written counterclockwise 22 | along the bottom. 'textRadius' determines the 'height' 23 | of each character; if 'textRadius' is 1/2 of 'radius', 24 | characters extend halfway from the edge to the center. 25 | 'fillPortion' varies from 0 to 1.0, with useful values 26 | from about 0.4 to 0.9, and determines how much of the 27 | 180 degrees of arc assigned to each section of text 28 | is actually occupied by text; 0.9 looks better than 29 | 1.0 which is rather crowded. 'font' is a freetype 30 | font; see gdImageStringFT. 'points' is passed to the 31 | freetype engine and has an effect on hinting; although 32 | the size of the text is determined by radius, textRadius, 33 | and fillPortion, you should pass a point size that 34 | 'hints' appropriately -- if you know the text will be 35 | large, pass a large point size such as 24.0 to get the 36 | best results. 'fgcolor' can be any color, and may have 37 | an alpha component, do blending, etc. 38 | 39 | Returns 0 on success, or an error string. */ 40 | 41 | BGD_DECLARE(char *) gdImageStringFTCircle( 42 | gdImagePtr im, 43 | int cx, 44 | int cy, 45 | double radius, 46 | double textRadius, 47 | double fillPortion, 48 | char *font, 49 | double points, 50 | char *top, 51 | char *bottom, 52 | int fgcolor); 53 | 54 | /* 2.0.16: 55 | * Sharpen function added on 2003-11-19 56 | * by Paul Troughton (paultroughtonieeeorg) 57 | * Simple 3x3 convolution kernel 58 | * Makes use of seperability 59 | * Faster, but less flexible, than full-blown unsharp masking 60 | * pct is sharpening percentage, and can be greater than 100 61 | * Silently does nothing to non-truecolor images 62 | * Silently does nothing for pct<0, as not a useful blurring function 63 | * Leaves transparency/alpha-channel untouched 64 | */ 65 | 66 | BGD_DECLARE(void) gdImageSharpen (gdImagePtr im, int pct); 67 | 68 | #endif /* GDFX_H */ 69 | 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /npiet/win32/include/gdhelpers.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | #ifndef GDHELPERS_H 6 | #define GDHELPERS_H 1 7 | 8 | /* sys/types.h is needed for size_t on Sparc-SunOS-4.1 */ 9 | #include 10 | 11 | /* TBB: strtok_r is not universal; provide an implementation of it. */ 12 | 13 | char * gd_strtok_r (char *s, char *sep, char **state); 14 | 15 | /* These functions wrap memory management. gdFree is 16 | in gd.h, where callers can utilize it to correctly 17 | free memory allocated by these functions with the 18 | right version of free(). */ 19 | void *gdCalloc (size_t nmemb, size_t size); 20 | void *gdMalloc (size_t size); 21 | void *gdRealloc (void *ptr, size_t size); 22 | 23 | /* Returns nonzero if multiplying the two quantities will 24 | result in integer overflow. Also returns nonzero if 25 | either quantity is negative. By Phil Knirsch based on 26 | netpbm fixes by Alan Cox. */ 27 | 28 | int overflow2(int a, int b); 29 | 30 | /* 2.0.16: portable mutex support for thread safety. */ 31 | 32 | #ifdef WIN32 33 | /* 2.0.18: must include windows.h to get CRITICAL_SECTION. */ 34 | #include 35 | #define gdMutexDeclare(x) CRITICAL_SECTION x 36 | #define gdMutexSetup(x) InitializeCriticalSection(&x) 37 | #define gdMutexShutdown(x) DeleteCriticalSection(&x) 38 | #define gdMutexLock(x) EnterCriticalSection(&x) 39 | #define gdMutexUnlock(x) LeaveCriticalSection(&x) 40 | #else 41 | #ifdef HAVE_PTHREAD 42 | #include 43 | #define gdMutexDeclare(x) pthread_mutex_t x 44 | #define gdMutexSetup(x) pthread_mutex_init(&x, 0) 45 | #define gdMutexShutdown(x) pthread_mutex_destroy(&x) 46 | #define gdMutexLock(x) pthread_mutex_lock(&x) 47 | #define gdMutexUnlock(x) pthread_mutex_unlock(&x) 48 | #else 49 | #define gdMutexDeclare(x) 50 | #define gdMutexSetup(x) 51 | #define gdMutexShutdown(x) 52 | #define gdMutexLock(x) 53 | #define gdMutexUnlock(x) 54 | #endif /* HAVE_PTHREAD */ 55 | #endif /* WIN32 */ 56 | 57 | #endif /* GDHELPERS_H */ 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /npiet/win32/include/wbmp.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | /* WBMP 6 | ** ---- 7 | ** WBMP Level 0: B/W, Uncompressed 8 | ** This implements the WBMP format as specified in WAPSpec 1.1 and 1.2. 9 | ** It does not support ExtHeaders as defined in the spec. The spec states 10 | ** that a WAP client does not need to implement ExtHeaders. 11 | ** 12 | ** (c) 2000 Johan Van den Brande 13 | ** 14 | ** Header file 15 | */ 16 | #ifndef __WBMP_H 17 | #define __WBMP_H 1 18 | 19 | 20 | /* WBMP struct 21 | ** ----------- 22 | ** A Wireless bitmap structure 23 | ** 24 | */ 25 | 26 | typedef struct Wbmp_ 27 | { 28 | int type; /* type of the wbmp */ 29 | int width; /* width of the image */ 30 | int height; /* height of the image */ 31 | int *bitmap; /* pointer to data: 0 = WHITE , 1 = BLACK */ 32 | } 33 | Wbmp; 34 | 35 | #define WBMP_WHITE 1 36 | #define WBMP_BLACK 0 37 | 38 | 39 | /* Proto's 40 | ** ------- 41 | ** 42 | */ 43 | void putmbi (int i, void (*putout) (int c, void *out), void *out); 44 | int getmbi (int (*getin) (void *in), void *in); 45 | int skipheader (int (*getin) (void *in), void *in); 46 | Wbmp *createwbmp (int width, int height, int color); 47 | int readwbmp (int (*getin) (void *in), void *in, Wbmp ** wbmp); 48 | int writewbmp (Wbmp * wbmp, void (*putout) (int c, void *out), void *out); 49 | void freewbmp (Wbmp * wbmp); 50 | void printwbmp (Wbmp * wbmp); 51 | 52 | #endif 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /npiet/win32/lib/bgd.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/bgd.dll -------------------------------------------------------------------------------- /npiet/win32/lib/bgd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/bgd.lib -------------------------------------------------------------------------------- /npiet/win32/lib/bgd_a.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/bgd_a.lib -------------------------------------------------------------------------------- /npiet/win32/lib/gdtest.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/gdtest.lib -------------------------------------------------------------------------------- /npiet/win32/lib/libpng-bcc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/libpng-bcc.lib -------------------------------------------------------------------------------- /npiet/win32/lib/libpng.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/libpng.dll.a -------------------------------------------------------------------------------- /npiet/win32/lib/libpng.la: -------------------------------------------------------------------------------- 1 | # libpng12.la - a libtool library file 2 | # Generated by ltmain.sh (GNU libtool 1.2971 2008-04-29) 2.2.3a 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/libpng12.dll' 9 | 10 | # Names of this library. 11 | library_names='libpng12.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -LD:/Progra~1/GnuWin32/lib -lz -lintl -lwsock32 -lole32 -luuid -lmsvcp60' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libpng12. 26 | current=37 27 | age=37 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='c:/progra~1/libpng/lib' 42 | -------------------------------------------------------------------------------- /npiet/win32/lib/libpng.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/libpng.lib -------------------------------------------------------------------------------- /npiet/win32/lib/libpng12.def: -------------------------------------------------------------------------------- 1 | LIBRARY libpng12.dll 2 | EXPORTS 3 | DllGetVersion 4 | png_IDAT DATA 5 | png_IEND DATA 6 | png_IHDR DATA 7 | png_PLTE DATA 8 | png_access_version_number 9 | png_bKGD DATA 10 | png_build_grayscale_palette 11 | png_cHRM DATA 12 | png_check_sig 13 | png_chunk_error 14 | png_chunk_warning 15 | png_convert_from_struct_tm 16 | png_convert_from_time_t 17 | png_convert_to_rfc1123 18 | png_create_info_struct 19 | png_create_read_struct 20 | png_create_read_struct_2 21 | png_create_write_struct 22 | png_create_write_struct_2 23 | png_data_freer 24 | png_destroy_info_struct 25 | png_destroy_read_struct 26 | png_destroy_write_struct 27 | png_error 28 | png_free 29 | png_free_data 30 | png_free_default 31 | png_gAMA DATA 32 | png_get_IHDR 33 | png_get_PLTE 34 | png_get_asm_flagmask 35 | png_get_asm_flags 36 | png_get_bKGD 37 | png_get_bit_depth 38 | png_get_cHRM 39 | png_get_cHRM_fixed 40 | png_get_channels 41 | png_get_color_type 42 | png_get_compression_buffer_size 43 | png_get_compression_type 44 | png_get_copyright 45 | png_get_error_ptr 46 | png_get_filter_type 47 | png_get_gAMA 48 | png_get_gAMA_fixed 49 | png_get_hIST 50 | png_get_header_ver 51 | png_get_header_version 52 | png_get_iCCP 53 | png_get_image_height 54 | png_get_image_width 55 | png_get_int_32 56 | png_get_interlace_type 57 | png_get_io_ptr 58 | png_get_libpng_ver 59 | png_get_mem_ptr 60 | png_get_mmx_bitdepth_threshold 61 | png_get_mmx_flagmask 62 | png_get_mmx_rowbytes_threshold 63 | png_get_oFFs 64 | png_get_pCAL 65 | png_get_pHYs 66 | png_get_pixel_aspect_ratio 67 | png_get_pixels_per_meter 68 | png_get_progressive_ptr 69 | png_get_rgb_to_gray_status 70 | png_get_rowbytes 71 | png_get_rows 72 | png_get_sBIT 73 | png_get_sCAL 74 | png_get_sPLT 75 | png_get_sRGB 76 | png_get_signature 77 | png_get_tIME 78 | png_get_tRNS 79 | png_get_text 80 | png_get_uint_16 81 | png_get_uint_31 82 | png_get_uint_32 83 | png_get_unknown_chunks 84 | png_get_user_chunk_ptr 85 | png_get_user_height_max 86 | png_get_user_transform_ptr 87 | png_get_user_width_max 88 | png_get_valid 89 | png_get_x_offset_microns 90 | png_get_x_offset_pixels 91 | png_get_x_pixels_per_meter 92 | png_get_y_offset_microns 93 | png_get_y_offset_pixels 94 | png_get_y_pixels_per_meter 95 | png_hIST DATA 96 | png_handle_as_unknown 97 | png_iCCP DATA 98 | png_iTXt DATA 99 | png_info_init 100 | png_info_init_3 101 | png_init_io 102 | png_libpng_ver DATA 103 | png_malloc 104 | png_malloc_default 105 | png_malloc_warn 106 | png_memcpy_check 107 | png_memset_check 108 | png_mmx_support 109 | png_oFFs DATA 110 | png_pCAL DATA 111 | png_pHYs DATA 112 | png_pass_dsp_mask DATA 113 | png_pass_inc DATA 114 | png_pass_mask DATA 115 | png_pass_start DATA 116 | png_pass_yinc DATA 117 | png_pass_ystart DATA 118 | png_permit_empty_plte 119 | png_permit_mng_features 120 | png_process_data 121 | png_progressive_combine_row 122 | png_read_destroy 123 | png_read_end 124 | png_read_image 125 | png_read_info 126 | png_read_init 127 | png_read_init_2 128 | png_read_init_3 129 | png_read_png 130 | png_read_row 131 | png_read_rows 132 | png_read_update_info 133 | png_reset_zstream 134 | png_sBIT DATA 135 | png_sCAL DATA 136 | png_sPLT DATA 137 | png_sRGB DATA 138 | png_save_int_32 139 | png_save_uint_16 140 | png_save_uint_32 141 | png_set_IHDR 142 | png_set_PLTE 143 | png_set_add_alpha 144 | png_set_asm_flags 145 | png_set_bKGD 146 | png_set_background 147 | png_set_bgr 148 | png_set_cHRM 149 | png_set_cHRM_fixed 150 | png_set_compression_buffer_size 151 | png_set_compression_level 152 | png_set_compression_mem_level 153 | png_set_compression_method 154 | png_set_compression_strategy 155 | png_set_compression_window_bits 156 | png_set_crc_action 157 | png_set_dither 158 | png_set_error_fn 159 | png_set_expand 160 | png_set_expand_gray_1_2_4_to_8 161 | png_set_filler 162 | png_set_filter 163 | png_set_filter_heuristics 164 | png_set_flush 165 | png_set_gAMA 166 | png_set_gAMA_fixed 167 | png_set_gamma 168 | png_set_gray_1_2_4_to_8 169 | png_set_gray_to_rgb 170 | png_set_hIST 171 | png_set_iCCP 172 | png_set_interlace_handling 173 | png_set_invalid 174 | png_set_invert_alpha 175 | png_set_invert_mono 176 | png_set_keep_unknown_chunks 177 | png_set_mem_fn 178 | png_set_mmx_thresholds 179 | png_set_oFFs 180 | png_set_pCAL 181 | png_set_pHYs 182 | png_set_packing 183 | png_set_packswap 184 | png_set_palette_to_rgb 185 | png_set_progressive_read_fn 186 | png_set_read_fn 187 | png_set_read_status_fn 188 | png_set_read_user_chunk_fn 189 | png_set_read_user_transform_fn 190 | png_set_rgb_to_gray 191 | png_set_rgb_to_gray_fixed 192 | png_set_rows 193 | png_set_sBIT 194 | png_set_sCAL 195 | png_set_sPLT 196 | png_set_sRGB 197 | png_set_sRGB_gAMA_and_cHRM 198 | png_set_shift 199 | png_set_sig_bytes 200 | png_set_strip_16 201 | png_set_strip_alpha 202 | png_set_strip_error_numbers 203 | png_set_swap 204 | png_set_swap_alpha 205 | png_set_tIME 206 | png_set_tRNS 207 | png_set_tRNS_to_alpha 208 | png_set_text 209 | png_set_unknown_chunk_location 210 | png_set_unknown_chunks 211 | png_set_user_limits 212 | png_set_user_transform_info 213 | png_set_write_fn 214 | png_set_write_status_fn 215 | png_set_write_user_transform_fn 216 | png_sig DATA 217 | png_sig_cmp 218 | png_start_read_image 219 | png_tEXt DATA 220 | png_tIME DATA 221 | png_tRNS DATA 222 | png_warning 223 | png_write_chunk 224 | png_write_chunk_data 225 | png_write_chunk_end 226 | png_write_chunk_start 227 | png_write_destroy 228 | png_write_end 229 | png_write_flush 230 | png_write_image 231 | png_write_info 232 | png_write_info_before_PLTE 233 | png_write_init 234 | png_write_init_2 235 | png_write_init_3 236 | png_write_png 237 | png_write_row 238 | png_write_rows 239 | png_zTXt DATA 240 | -------------------------------------------------------------------------------- /npiet/win32/lib/libpng12.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/libpng12.dll.a -------------------------------------------------------------------------------- /npiet/win32/lib/libpng12.la: -------------------------------------------------------------------------------- 1 | # libpng12.la - a libtool library file 2 | # Generated by ltmain.sh (GNU libtool 1.2971 2008-04-29) 2.2.3a 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/libpng12.dll' 9 | 10 | # Names of this library. 11 | library_names='libpng12.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -LD:/Progra~1/GnuWin32/lib -lz -lintl -lwsock32 -lole32 -luuid -lmsvcp60' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libpng12. 26 | current=37 27 | age=37 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='c:/progra~1/libpng/lib' 42 | -------------------------------------------------------------------------------- /npiet/win32/lib/libz.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/libz.a -------------------------------------------------------------------------------- /npiet/win32/lib/libz.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/libz.dll.a -------------------------------------------------------------------------------- /npiet/win32/lib/pkgconfig/libpng.pc: -------------------------------------------------------------------------------- 1 | prefix=c:/progra~1/libpng 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include/libpng12 5 | 6 | Name: libpng 7 | Description: Loads and saves PNG files 8 | Version: 1.2.37 9 | Libs: -L${libdir} -lpng12 10 | Libs.private: -lz -Wl,-s -lz -LD:/Progra~1/GnuWin32/lib -lintl -lwsock32 -lole32 -luuid -lmsvcp60 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /npiet/win32/lib/pkgconfig/libpng12.pc: -------------------------------------------------------------------------------- 1 | prefix=c:/progra~1/libpng 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include/libpng12 5 | 6 | Name: libpng 7 | Description: Loads and saves PNG files 8 | Version: 1.2.37 9 | Libs: -L${libdir} -lpng12 10 | Libs.private: -lz -Wl,-s -lz -LD:/Progra~1/GnuWin32/lib -lintl -lwsock32 -lole32 -luuid -lmsvcp60 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /npiet/win32/lib/webpng.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/webpng.lib -------------------------------------------------------------------------------- /npiet/win32/lib/zlib-bcc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/zlib-bcc.lib -------------------------------------------------------------------------------- /npiet/win32/lib/zlib.def: -------------------------------------------------------------------------------- 1 | ; h:\mingw\3.3.1\bin\dlltool.exe --export-all-symbols --output-def=zlib.def adler32.pic.o compress.pic.o crc32.pic.o gzio.pic.o uncompr.pic.o deflate.pic.o trees.pic.o zutil.pic.o inflate.pic.o infback.pic.o inftrees.pic.o inffast.pic.o zlib-dllversion.o zlib-dll-res.o 2 | EXPORTS 3 | DllGetVersion @ 1 ; 4 | _dist_code @ 2 DATA ; 5 | _length_code @ 3 DATA ; 6 | _tr_align @ 4 ; 7 | _tr_flush_block @ 5 ; 8 | _tr_init @ 6 ; 9 | _tr_stored_block @ 7 ; 10 | _tr_tally @ 8 ; 11 | adler32 @ 9 ; 12 | adler32_combine @ 10 ; 13 | compress @ 11 ; 14 | compress2 @ 12 ; 15 | compressBound @ 13 ; 16 | crc32 @ 14 ; 17 | crc32_combine @ 15 ; 18 | deflate @ 16 ; 19 | deflateBound @ 17 ; 20 | deflateCopy @ 18 ; 21 | deflateEnd @ 19 ; 22 | deflateInit2_ @ 20 ; 23 | deflateInit_ @ 21 ; 24 | deflateParams @ 22 ; 25 | deflatePrime @ 23 ; 26 | deflateReset @ 24 ; 27 | deflateSetDictionary @ 25 ; 28 | deflateSetHeader @ 26 ; 29 | deflateTune @ 27 ; 30 | deflate_copyright @ 28 DATA ; 31 | get_crc_table @ 29 ; 32 | gzclearerr @ 30 ; 33 | gzclose @ 31 ; 34 | gzdirect @ 32 ; 35 | gzdopen @ 33 ; 36 | gzeof @ 34 ; 37 | gzerror @ 35 ; 38 | gzflush @ 36 ; 39 | gzgetc @ 37 ; 40 | gzgets @ 38 ; 41 | gzopen @ 39 ; 42 | gzprintf @ 40 ; 43 | gzputc @ 41 ; 44 | gzputs @ 42 ; 45 | gzread @ 43 ; 46 | gzrewind @ 44 ; 47 | gzseek @ 45 ; 48 | gzsetparams @ 46 ; 49 | gztell @ 47 ; 50 | gzungetc @ 48 ; 51 | gzwrite @ 49 ; 52 | inflate @ 50 ; 53 | inflateBack @ 51 ; 54 | inflateBackEnd @ 52 ; 55 | inflateBackInit_ @ 53 ; 56 | inflateCopy @ 54 ; 57 | inflateEnd @ 55 ; 58 | inflateGetHeader @ 56 ; 59 | inflateInit2_ @ 57 ; 60 | inflateInit_ @ 58 ; 61 | inflatePrime @ 59 ; 62 | inflateReset @ 60 ; 63 | inflateSetDictionary @ 61 ; 64 | inflateSync @ 62 ; 65 | inflateSyncPoint @ 63 ; 66 | inflate_copyright @ 64 DATA ; 67 | inflate_fast @ 65 ; 68 | inflate_table @ 66 ; 69 | uncompress @ 67 ; 70 | zError @ 68 ; 71 | z_errmsg @ 69 DATA ; 72 | zcalloc @ 70 ; 73 | zcfree @ 71 ; 74 | zlibCompileFlags @ 72 ; 75 | zlibVersion @ 73 ; 76 | -------------------------------------------------------------------------------- /npiet/win32/lib/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/npiet/win32/lib/zlib.lib -------------------------------------------------------------------------------- /piet-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/piet-16x16.png -------------------------------------------------------------------------------- /piet.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ramblurr/PietCreator/1645efe343a6672d30543d7ecd46fdb5f049d040/piet.ico -------------------------------------------------------------------------------- /pietcreator.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | piet.ico 4 | piet-16x16.png 5 | 6 | 7 | icons/debug-step.svg 8 | icons/fallback/32x32/actions/debug-step.png 9 | 10 | 11 | -------------------------------------------------------------------------------- /pietcreator.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "piet.ico" 2 | --------------------------------------------------------------------------------