Added SimpleTable example, moved from C::B to Makefile based template.
authorDaniel G <giri@nwrk.biz>
Fri, 28 Dec 2018 00:44:20 +0000 (01:44 +0100)
committerDaniel G <giri@nwrk.biz>
Fri, 28 Dec 2018 00:44:20 +0000 (01:44 +0100)
21 files changed:
_template/Makefile [new file with mode: 0644]
_template/_template.workspace [deleted file]
_template/include/json.h [new file with mode: 0644]
_template/packages/fltk/fltk.cbp [deleted file]
_template/packages/tinyxml/.gitignore
_template/packages/tinyxml/Makefile [new file with mode: 0644]
_template/packages/tinyxml/tinyxml.cbp [deleted file]
_template/src/FSHelper.cxx
_template/src/FSHelper.h
_template/src/Icon.ico [new file with mode: 0644]
_template/src/Icon.png [new file with mode: 0644]
_template/src/Makefile [new file with mode: 0644]
_template/src/View.cxx
_template/src/View.h
_template/src/ViewFluid.cxx
_template/src/ViewFluid.fld
_template/src/ViewFluid.h
_template/src/_template.cbp [deleted file]
_template/src/main.rc [new file with mode: 0644]
_template/src/start__template [new file with mode: 0755]
_template/src/start__template.desktop [new file with mode: 0644]

diff --git a/_template/Makefile b/_template/Makefile
new file mode 100644 (file)
index 0000000..6a52f6c
--- /dev/null
@@ -0,0 +1,61 @@
+############################################################################
+# Workfile: Makefile
+# Author: Daniel Giritzer, S1810567004 (daniel@giritzer.eu)
+# Date: 03.12.2018
+# Description: Universal Makefile for Unix based Operating Systems
+############################################################################
+WORKDIR = $(shell pwd)
+
+all: fltk tinyxml _template linux_package windows_package
+
+fltk:
+       cd $(WORKDIR)/packages/fltk; \
+       make
+
+tinyxml:
+       cd $(WORKDIR)/packages/tinyxml; \
+       make
+
+_template:
+       cd $(WORKDIR)/src; \
+       make
+
+clean_fltk:
+       cd $(WORKDIR)/packages/fltk; \
+       make clean
+
+clean_tinyxml:
+       cd $(WORKDIR)/packages/tinyxml; \
+       make clean
+
+clean__template:
+       cd $(WORKDIR)/src; \
+       make clean
+
+clean_lib:
+       rm -rf $(WORKDIR)/lib/
+       rm -rf $(WORKDIR)/include/tinyxml2.h
+       rm -rf $(WORKDIR)/include/FL
+       rm -rf $(WORKDIR)/install_package/
+
+linux_package:
+       mkdir -p $(WORKDIR)/install_package/linux/lib
+       mkdir -p $(WORKDIR)/install_package/linux/bin
+       $(WORKDIR)/scripts/copydeps.sh $(WORKDIR)/src/bin/Release_Linux/_template $(WORKDIR)/install_package/linux/lib
+       cp $(WORKDIR)/src/bin/Release_Linux/_template $(WORKDIR)/install_package/linux/bin
+       cp $(WORKDIR)/src/start__template $(WORKDIR)/install_package/linux/
+       cp $(WORKDIR)/src/start__template.desktop $(WORKDIR)/install_package/linux/
+       cp $(WORKDIR)/src/Icon.png $(WORKDIR)/install_package/linux/
+       tar -zcvf $(WORKDIR)/install_package/install_linux -C $(WORKDIR)/install_package/linux/ .
+       $(WORKDIR)/scripts/gen_package_linux.sh $(WORKDIR)/install_package/install_linux
+       rm $(WORKDIR)/install_package/install_linux 
+
+windows_package:
+       mkdir -p $(WORKDIR)/install_package/windows/
+       cp $(WORKDIR)/src/bin/Release_Windows/_template.exe $(WORKDIR)/install_package/windows/
+       cd $(WORKDIR)/scripts/; \
+       ./gen_package_windows.sh $(WORKDIR)/install_package/windows/*; \
+       mv ./*.exe $(WORKDIR)/install_package/install_windows.exe
+
+
+clean: clean_lib clean__template clean_fltk clean_tinyxml
diff --git a/_template/_template.workspace b/_template/_template.workspace
deleted file mode 100644 (file)
index 3d573fb..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_workspace_file>
-       <Workspace title="Workspace">
-               <Project filename="src/_template.cbp" />
-               <Project filename="packages/fltk/fltk.cbp" />
-               <Project filename="packages/tinyxml/tinyxml.cbp" />
-       </Workspace>
-</CodeBlocks_workspace_file>
diff --git a/_template/include/json.h b/_template/include/json.h
new file mode 100644 (file)
index 0000000..8325db4
--- /dev/null
@@ -0,0 +1,667 @@
+#ifndef JSON_H
+#define JSON_H
+
+#include <cstdint>
+#include <cmath>
+#include <cctype>
+#include <string>
+#include <deque>
+#include <map>
+#include <type_traits>
+#include <initializer_list>
+#include <ostream>
+#include <iostream>
+
+namespace json {
+
+using std::map;
+using std::deque;
+using std::string;
+using std::enable_if;
+using std::initializer_list;
+using std::is_same;
+using std::is_convertible;
+using std::is_integral;
+using std::is_floating_point;
+
+namespace {
+    string json_escape( const string &str ) {
+        string output;
+        for( unsigned i = 0; i < str.length(); ++i )
+            switch( str[i] ) {
+                case '\"': output += "\\\""; break;
+                case '\\': output += "\\\\"; break;
+                case '\b': output += "\\b";  break;
+                case '\f': output += "\\f";  break;
+                case '\n': output += "\\n";  break;
+                case '\r': output += "\\r";  break;
+                case '\t': output += "\\t";  break;
+                default  : output += str[i]; break;
+            }
+        return std::move( output );
+    }
+}
+
+class JSON
+{
+    union BackingData {
+        BackingData( double d ) : Float( d ){}
+        BackingData( long   l ) : Int( l ){}
+        BackingData( bool   b ) : m_Bool( b ){}
+        BackingData( string s ) : String( new string( s ) ){}
+        BackingData()           : Int( 0 ){}
+
+        deque<JSON>        *List;
+        map<string,JSON>   *Map;
+        string             *String;
+        double              Float;
+        long                Int;
+        bool                m_Bool;
+    } Internal;
+
+    public:
+        enum class Class {
+            Null,
+            Object,
+            Array,
+            String,
+            Floating,
+            Integral,
+            Boolean
+        };
+
+        template <typename Container>
+        class JSONWrapper {
+            Container *object;
+
+            public:
+                JSONWrapper( Container *val ) : object( val ) {}
+                JSONWrapper( std::nullptr_t )  : object( nullptr ) {}
+
+                typename Container::iterator begin() { return object ? object->begin() : typename Container::iterator(); }
+                typename Container::iterator end() { return object ? object->end() : typename Container::iterator(); }
+                typename Container::const_iterator begin() const { return object ? object->begin() : typename Container::iterator(); }
+                typename Container::const_iterator end() const { return object ? object->end() : typename Container::iterator(); }
+        };
+
+        template <typename Container>
+        class JSONConstWrapper {
+            const Container *object;
+
+            public:
+                JSONConstWrapper( const Container *val ) : object( val ) {}
+                JSONConstWrapper( std::nullptr_t )  : object( nullptr ) {}
+
+                typename Container::const_iterator begin() const { return object ? object->begin() : typename Container::const_iterator(); }
+                typename Container::const_iterator end() const { return object ? object->end() : typename Container::const_iterator(); }
+        };
+
+        JSON() : Internal(), Type( Class::Null ){}
+
+        JSON( initializer_list<JSON> list ) 
+            : JSON() 
+        {
+            SetType( Class::Object );
+            for( auto i = list.begin(), e = list.end(); i != e; ++i, ++i )
+                operator[]( i->ToString() ) = *std::next( i );
+        }
+
+        JSON( JSON&& other )
+            : Internal( other.Internal )
+            , Type( other.Type )
+        { other.Type = Class::Null; other.Internal.Map = nullptr; }
+
+        JSON& operator=( JSON&& other ) {
+            ClearInternal();
+            Internal = other.Internal;
+            Type = other.Type;
+            other.Internal.Map = nullptr;
+            other.Type = Class::Null;
+            return *this;
+        }
+
+        JSON( const JSON &other ) {
+            switch( other.Type ) {
+            case Class::Object:
+                Internal.Map = 
+                    new map<string,JSON>( other.Internal.Map->begin(),
+                                          other.Internal.Map->end() );
+                break;
+            case Class::Array:
+                Internal.List = 
+                    new deque<JSON>( other.Internal.List->begin(),
+                                      other.Internal.List->end() );
+                break;
+            case Class::String:
+                Internal.String = 
+                    new string( *other.Internal.String );
+                break;
+            default:
+                Internal = other.Internal;
+            }
+            Type = other.Type;
+        }
+
+        JSON& operator=( const JSON &other ) {
+            ClearInternal();
+            switch( other.Type ) {
+            case Class::Object:
+                Internal.Map = 
+                    new map<string,JSON>( other.Internal.Map->begin(),
+                                          other.Internal.Map->end() );
+                break;
+            case Class::Array:
+                Internal.List = 
+                    new deque<JSON>( other.Internal.List->begin(),
+                                      other.Internal.List->end() );
+                break;
+            case Class::String:
+                Internal.String = 
+                    new string( *other.Internal.String );
+                break;
+            default:
+                Internal = other.Internal;
+            }
+            Type = other.Type;
+            return *this;
+        }
+
+        ~JSON() {
+            switch( Type ) {
+            case Class::Array:
+                delete Internal.List;
+                break;
+            case Class::Object:
+                delete Internal.Map;
+                break;
+            case Class::String:
+                delete Internal.String;
+                break;
+            default:;
+            }
+        }
+
+        template <typename T>
+        JSON( T b, typename enable_if<is_same<T,bool>::value>::type* = 0 ) : Internal( b ), Type( Class::Boolean ){}
+
+        template <typename T>
+        JSON( T i, typename enable_if<is_integral<T>::value && !is_same<T,bool>::value>::type* = 0 ) : Internal( (long)i ), Type( Class::Integral ){}
+
+        template <typename T>
+        JSON( T f, typename enable_if<is_floating_point<T>::value>::type* = 0 ) : Internal( (double)f ), Type( Class::Floating ){}
+
+        template <typename T>
+        JSON( T s, typename enable_if<is_convertible<T,string>::value>::type* = 0 ) : Internal( string( s ) ), Type( Class::String ){}
+
+        JSON( std::nullptr_t ) : Internal(), Type( Class::Null ){}
+
+        static JSON Make( Class type ) {
+            JSON ret; ret.SetType( type );
+            return ret;
+        }
+
+        static JSON Load( const string & );
+        static JSON Load( const string &, bool & );
+
+        template <typename T>
+        void append( T arg ) {
+            SetType( Class::Array ); Internal.List->emplace_back( arg );
+        }
+
+        template <typename T, typename... U>
+        void append( T arg, U... args ) {
+            append( arg ); append( args... );
+        }
+
+        template <typename T>
+            typename enable_if<is_same<T,bool>::value, JSON&>::type operator=( T b ) {
+                SetType( Class::Boolean ); Internal.m_Bool = b; return *this;
+            }
+
+        template <typename T>
+            typename enable_if<is_integral<T>::value && !is_same<T,bool>::value, JSON&>::type operator=( T i ) {
+                SetType( Class::Integral ); Internal.Int = i; return *this;
+            }
+
+        template <typename T>
+            typename enable_if<is_floating_point<T>::value, JSON&>::type operator=( T f ) {
+                SetType( Class::Floating ); Internal.Float = f; return *this;
+            }
+
+        template <typename T>
+            typename enable_if<is_convertible<T,string>::value, JSON&>::type operator=( T s ) {
+                SetType( Class::String ); *Internal.String = string( s ); return *this;
+            }
+
+        JSON& operator[]( const string &key ) {
+            SetType( Class::Object ); return Internal.Map->operator[]( key );
+        }
+
+        JSON& operator[]( unsigned index ) {
+            SetType( Class::Array );
+            if( index >= Internal.List->size() ) Internal.List->resize( index + 1 );
+            return Internal.List->operator[]( index );
+        }
+
+        JSON &at( const string &key ) {
+            return operator[]( key );
+        }
+
+        const JSON &at( const string &key ) const {
+            return Internal.Map->at( key );
+        }
+
+        JSON &at( unsigned index ) {
+            return operator[]( index );
+        }
+
+        const JSON &at( unsigned index ) const {
+            return Internal.List->at( index );
+        }
+
+        int length() const {
+            if( Type == Class::Array )
+                return Internal.List->size();
+            else
+                return -1;
+        }
+
+        bool hasKey( const string &key ) const {
+            if( Type == Class::Object )
+                return Internal.Map->find( key ) != Internal.Map->end();
+            return false;
+        }
+
+        int size() const {
+            if( Type == Class::Object )
+                return Internal.Map->size();
+            else if( Type == Class::Array )
+                return Internal.List->size();
+            else
+                return -1;
+        }
+
+        Class JSONType() const { return Type; }
+
+        /// Functions for getting primitives from the JSON object.
+        bool IsNull() const { return Type == Class::Null; }
+
+        string ToString() const { bool b; return std::move( ToString( b ) ); }
+        string ToString( bool &ok ) const {
+            ok = (Type == Class::String);
+            return ok ? std::move( json_escape( *Internal.String ) ): string("");
+        }
+
+        double ToFloat() const { bool b; return ToFloat( b ); }
+        double ToFloat( bool &ok ) const {
+            ok = (Type == Class::Floating);
+            return ok ? Internal.Float : 0.0;
+        }
+
+        long ToInt() const { bool b; return ToInt( b ); }
+        long ToInt( bool &ok ) const {
+            ok = (Type == Class::Integral);
+            return ok ? Internal.Int : 0;
+        }
+
+        bool ToBool() const { bool b; return ToBool( b ); }
+        bool ToBool( bool &ok ) const {
+            ok = (Type == Class::Boolean);
+            return ok ? Internal.m_Bool : false;
+        }
+
+        JSONWrapper<map<string,JSON>> ObjectRange() {
+            if( Type == Class::Object )
+                return JSONWrapper<map<string,JSON>>( Internal.Map );
+            return JSONWrapper<map<string,JSON>>( nullptr );
+        }
+
+        JSONWrapper<deque<JSON>> ArrayRange() {
+            if( Type == Class::Array )
+                return JSONWrapper<deque<JSON>>( Internal.List );
+            return JSONWrapper<deque<JSON>>( nullptr );
+        }
+
+        JSONConstWrapper<map<string,JSON>> ObjectRange() const {
+            if( Type == Class::Object )
+                return JSONConstWrapper<map<string,JSON>>( Internal.Map );
+            return JSONConstWrapper<map<string,JSON>>( nullptr );
+        }
+
+
+        JSONConstWrapper<deque<JSON>> ArrayRange() const { 
+            if( Type == Class::Array )
+                return JSONConstWrapper<deque<JSON>>( Internal.List );
+            return JSONConstWrapper<deque<JSON>>( nullptr );
+        }
+
+        string dump( int depth = 1, string tab = "  ") const {
+            string pad = "";
+            for( int i = 0; i < depth; ++i, pad += tab );
+
+            switch( Type ) {
+                case Class::Null:
+                    return "null";
+                case Class::Object: {
+                    string s = "{\n";
+                    bool skip = true;
+                    for( auto &p : *Internal.Map ) {
+                        if( !skip ) s += ",\n";
+                        s += ( pad + "\"" + p.first + "\" : " + p.second.dump( depth + 1, tab ) );
+                        skip = false;
+                    }
+                    s += ( "\n" + pad.erase( 0, 2 ) + "}" ) ;
+                    return s;
+                }
+                case Class::Array: {
+                    string s = "[";
+                    bool skip = true;
+                    for( auto &p : *Internal.List ) {
+                        if( !skip ) s += ", ";
+                        s += p.dump( depth + 1, tab );
+                        skip = false;
+                    }
+                    s += "]";
+                    return s;
+                }
+                case Class::String:
+                    return "\"" + json_escape( *Internal.String ) + "\"";
+                case Class::Floating:
+                    return std::to_string( Internal.Float );
+                case Class::Integral:
+                    return std::to_string( Internal.Int );
+                case Class::Boolean:
+                    return Internal.m_Bool ? "true" : "false";
+                default:
+                    return "";
+            }
+            return "";
+        }
+
+        friend std::ostream& operator<<( std::ostream&, const JSON & );
+
+    private:
+        void SetType( Class type ) {
+            if( type == Type )
+                return;
+
+            ClearInternal();
+          
+            switch( type ) {
+            case Class::Null:      Internal.Map    = nullptr;                break;
+            case Class::Object:    Internal.Map    = new map<string,JSON>(); break;
+            case Class::Array:     Internal.List   = new deque<JSON>();     break;
+            case Class::String:    Internal.String = new string();           break;
+            case Class::Floating:  Internal.Float  = 0.0;                    break;
+            case Class::Integral:  Internal.Int    = 0;                      break;
+            case Class::Boolean:   Internal.m_Bool   = false;                  break;
+            }
+
+            Type = type;
+        }
+
+    private:
+      /* beware: only call if YOU know that Internal is allocated. No checks performed here. 
+         This function should be called in a constructed JSON just before you are going to 
+        overwrite Internal... 
+      */
+      void ClearInternal() {
+        switch( Type ) {
+          case Class::Object: delete Internal.Map;    break;
+          case Class::Array:  delete Internal.List;   break;
+          case Class::String: delete Internal.String; break;
+          default:;
+        }
+      }
+
+    private:
+
+        Class Type = Class::Null;
+};
+
+inline JSON Array() {
+    return std::move( JSON::Make( JSON::Class::Array ) );
+}
+
+template <typename... T>
+JSON Array( T... args ) {
+    JSON arr = JSON::Make( JSON::Class::Array );
+    arr.append( args... );
+    return std::move( arr );
+}
+
+inline JSON Object() {
+    return std::move( JSON::Make( JSON::Class::Object ) );
+}
+
+inline std::ostream& operator<<( std::ostream &os, const JSON &json ) {
+    os << json.dump();
+    return os;
+}
+
+namespace {
+    JSON parse_next( const string &, size_t &, bool & );
+
+    void consume_ws( const string &str, size_t &offset ) {
+        while( isspace( str[offset] ) ) ++offset;
+    }
+
+    JSON parse_object( const string &str, size_t &offset, bool& rc ) {
+        JSON Object = JSON::Make( JSON::Class::Object );
+
+        ++offset;
+        consume_ws( str, offset );
+        if( str[offset] == '}' ) {
+            ++offset; return std::move( Object );
+        }
+
+        while( true ) {
+            JSON Key = parse_next( str, offset, rc );
+            consume_ws( str, offset );
+            if( str[offset] != ':' ) {
+                //std::cerr << "Error: Object: Expected colon, found '" << str[offset] << "'\n";
+                rc = false;
+                break;
+            }
+            consume_ws( str, ++offset );
+            JSON Value = parse_next( str, offset, rc );
+            Object[Key.ToString()] = Value;
+            
+            consume_ws( str, offset );
+            if( str[offset] == ',' ) {
+                ++offset; continue;
+            }
+            else if( str[offset] == '}' ) {
+                ++offset; break;
+            }
+            else {
+                //std::cerr << "ERROR: Object: Expected comma, found '" << str[offset] << "'\n";
+                rc = false;
+                break;
+            }
+        }
+
+        return std::move( Object );
+    }
+
+    JSON parse_array( const string &str, size_t &offset, bool& rc ) {
+        JSON Array = JSON::Make( JSON::Class::Array );
+        unsigned index = 0;
+        
+        ++offset;
+        consume_ws( str, offset );
+        if( str[offset] == ']' ) {
+            ++offset; return std::move( Array );
+        }
+
+        while( true ) {
+            Array[index++] = parse_next( str, offset, rc );
+            consume_ws( str, offset );
+
+            if( str[offset] == ',' ) {
+                ++offset; continue;
+            }
+            else if( str[offset] == ']' ) {
+                ++offset; break;
+            }
+            else {
+                //std::cerr << "ERROR: Array: Expected ',' or ']', found '" << str[offset] << "'\n";
+                rc = false;
+                return std::move( JSON::Make( JSON::Class::Array ) );
+            }
+        }
+
+        return std::move( Array );
+    }
+
+    JSON parse_string( const string &str, size_t &offset, bool& rc ) {
+        JSON String;
+        string val;
+        for( char c = str[++offset]; c != '\"' ; c = str[++offset] ) {
+            if( c == '\\' ) {
+                switch( str[ ++offset ] ) {
+                case '\"': val += '\"'; break;
+                case '\\': val += '\\'; break;
+                case '/' : val += '/' ; break;
+                case 'b' : val += '\b'; break;
+                case 'f' : val += '\f'; break;
+                case 'n' : val += '\n'; break;
+                case 'r' : val += '\r'; break;
+                case 't' : val += '\t'; break;
+                case 'u' : {
+                    val += "\\u" ;
+                    for( unsigned i = 1; i <= 4; ++i ) {
+                        c = str[offset+i];
+                        if( (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') )
+                            val += c;
+                        else {
+                            //std::cerr << "ERROR: String: Expected hex character in unicode escape, found '" << c << "'\n";
+                            rc = false;
+                            return std::move( JSON::Make( JSON::Class::String ) );
+                        }
+                    }
+                    offset += 4;
+                } break;
+                default  : val += '\\'; break;
+                }
+            }
+            else
+                val += c;
+        }
+        ++offset;
+        String = val;
+        return std::move( String );
+    }
+
+    JSON parse_number( const string &str, size_t &offset, bool& rc ) {
+        JSON Number;
+        string val, exp_str;
+        char c;
+        bool isDouble = false;
+        long exp = 0;
+        while( true ) {
+            c = str[offset++];
+            if( (c == '-') || (c >= '0' && c <= '9') )
+                val += c;
+            else if( c == '.' ) {
+                val += c; 
+                isDouble = true;
+            }
+            else
+                break;
+        }
+        if( c == 'E' || c == 'e' ) {
+            c = str[ offset++ ];
+            if( c == '-' ){ ++offset; exp_str += '-';}
+            while( true ) {
+                c = str[ offset++ ];
+                if( c >= '0' && c <= '9' )
+                    exp_str += c;
+                else if( !isspace( c ) && c != ',' && c != ']' && c != '}' ) {
+                    //std::cerr << "ERROR: Number: Expected a number for exponent, found '" << c << "'\n";
+                    rc = false;
+                    return std::move( JSON::Make( JSON::Class::Null ) );
+                }
+                else
+                    break;
+            }
+            exp = std::stol( exp_str );
+        }
+        else if( !isspace( c ) && c != ',' && c != ']' && c != '}' ) {
+            //std::cerr << "ERROR: Number: unexpected character '" << c << "'\n";
+            rc = false;
+            return std::move( JSON::Make( JSON::Class::Null ) );
+        }
+        --offset;
+        
+        if( isDouble )
+            Number = std::stod( val ) * std::pow( 10, exp );
+        else {
+            if( !exp_str.empty() )
+                Number = std::stol( val ) * std::pow( 10, exp );
+            else
+                Number = std::stol( val );
+        }
+        return std::move( Number );
+    }
+
+    JSON parse_bool( const string &str, size_t &offset, bool& rc ) {
+        JSON m_Bool;
+        if( str.substr( offset, 4 ) == "true" )
+            m_Bool = true;
+        else if( str.substr( offset, 5 ) == "false" )
+            m_Bool = false;
+        else {
+            //std::cerr << "ERROR: Bool: Expected 'true' or 'false', found '" << str.substr( offset, 5 ) << "'\n";
+            rc = false;
+            return std::move( JSON::Make( JSON::Class::Null ) );
+        }
+        offset += (m_Bool.ToBool() ? 4 : 5);
+        return std::move( m_Bool );
+    }
+
+    JSON parse_null( const string &str, size_t &offset, bool& rc ) {
+        JSON Null;
+        if( str.substr( offset, 4 ) != "null" ) {
+            //std::cerr << "ERROR: Null: Expected 'null', found '" << str.substr( offset, 4 ) << "'\n";
+            rc = false;
+            return std::move( JSON::Make( JSON::Class::Null ) );
+        }
+        offset += 4;
+        return std::move( Null );
+    }
+
+    JSON parse_next( const string &str, size_t &offset, bool& rc ) {
+        char value;
+        consume_ws( str, offset );
+        value = str[offset];
+        switch( value ) {
+            case '[' : return std::move( parse_array( str, offset, rc ) );
+            case '{' : return std::move( parse_object( str, offset, rc ) );
+            case '\"': return std::move( parse_string( str, offset, rc ) );
+            case 't' :
+            case 'f' : return std::move( parse_bool( str, offset, rc ) );
+            case 'n' : return std::move( parse_null( str, offset, rc ) );
+            default  : if( ( value <= '9' && value >= '0' ) || value == '-' )
+                           return std::move( parse_number( str, offset, rc ) );
+        }
+        //std::cerr << "ERROR: Parse: Unknown starting character '" << value << "'\n";
+        rc = false;
+        return JSON();
+    }
+}
+
+inline JSON JSON::Load( const string &str, bool& rc ) {
+    size_t offset = 0;
+    rc = true;
+    return std::move( parse_next( str, offset, rc ) );
+}
+
+inline JSON JSON::Load( const string &str ) {
+    size_t offset = 0;
+    bool rc = true;
+    return std::move( parse_next( str, offset, rc ) );
+}
+
+} // End Namespace json
+#endif // JSON_H
\ No newline at end of file
diff --git a/_template/packages/fltk/fltk.cbp b/_template/packages/fltk/fltk.cbp
deleted file mode 100644 (file)
index 80b021b..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
-       <FileVersion major="1" minor="6" />
-       <Project>
-               <Option title="fltk" />
-               <Option pch_mode="2" />
-               <Option compiler="gcc" />
-               <Build>
-                       <Target title="fltk_linux64">
-                               <Option output="bin/Debug/fltk" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Debug/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-g" />
-                               </Compiler>
-                               <ExtraCommands>
-                                       <Add before="mkdir -p ../../include" />
-                                       <Add before="mkdir -p ../../lib/linux64" />
-                                       <Add before="cp -rf ./FL ../../include" />
-                                       <Add before='./configure LDFLAGS=&quot;&quot; --enable-localjpeg --enable-localzlib --enable-localpng --enable-x11=no --disable-xcursor --disable-xinerama --disable-xft --disable-xdbe --disable-xrender --disable-xfixes --disable-threads' />
-                                       <Add before="make clean" />
-                                       <Add before="make -j5" />
-                                       <Add before="cp -rf ./lib/* ../../lib/linux64/" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="fltk_linux32">
-                               <Option output="bin/Debug/fltk" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Debug/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-g" />
-                               </Compiler>
-                               <ExtraCommands>
-                                       <Add before="mkdir -p ../../include" />
-                                       <Add before="mkdir -p ../../lib/linux32" />
-                                       <Add before="cp -rf ./FL ../../include" />
-                                       <Add before='./configure &quot;CFLAGS=-m32&quot; &quot;CXXFLAGS=-m32&quot; &quot;LDFLAGS=-m32&quot; --enable-localjpeg --enable-localzlib --enable-localpng --enable-x11=no --disable-xcursor --disable-xinerama --disable-xft --disable-xdbe --disable-xrender --disable-xfixes --disable-threads' />
-                                       <Add before="make clean" />
-                                       <Add before="make -j5" />
-                                       <Add before="cp -rf ./lib/* ../../lib/linux32/" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="fltk_windows">
-                               <Option output="bin/Debug/fltk" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Debug/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-g" />
-                               </Compiler>
-                               <ExtraCommands>
-                                       <Add before="mkdir -p ../../include" />
-                                       <Add before="mkdir -p ../../lib/mingw32" />
-                                       <Add before="cp -rf ./FL ../../include" />
-                                       <Add before='./configure LDFLAGS=&quot;-static-libgcc -static-libstdc++&quot; --enable-cygwin --enable-threads --enable-localjpeg --enable-localzlib --enable-localpng --enable-x11 --disable-xcursor --disable-xinerama --disable-xft --disable-xdbe --disable-xrender --disable-xfixes --disable-threads --host=i686-w64-mingw32' />
-                                       <Add before="make clean" />
-                                       <Add before="make -j5" />
-                                       <Add before="cp -rf ./lib/* ../../lib/mingw32/" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="fltk_unpack">
-                               <Option output="bin/Debug/fltk" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Debug/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-g" />
-                               </Compiler>
-                               <ExtraCommands>
-                                       <Add before="tar xvzf fltk-1.3.4-1-source.tar.gz" />
-                                       <Add before="cp -rf ./fltk-1.3.4-1/* ./" />
-                                       <Add before="rm -rf ./fltk-1.3.4-1/" />
-                               </ExtraCommands>
-                       </Target>
-               </Build>
-               <Compiler>
-                       <Add option="-Wall" />
-               </Compiler>
-               <Extensions>
-                       <envvars />
-                       <code_completion />
-                       <debugger />
-                       <lib_finder disable_auto="1" />
-               </Extensions>
-       </Project>
-</CodeBlocks_project_file>
index 3466ad1..3747c55 100644 (file)
@@ -4,4 +4,4 @@
 # But not these files...
 !.gitignore
 !tinyxml-2.src.zip
-!tinyxml.cbp
\ No newline at end of file
+!Makefile
diff --git a/_template/packages/tinyxml/Makefile b/_template/packages/tinyxml/Makefile
new file mode 100644 (file)
index 0000000..d63cbc6
--- /dev/null
@@ -0,0 +1,37 @@
+############################################################################
+# Workfile: Makefile
+# Author: Daniel Giritzer, S1810567004 (daniel@giritzer.eu)
+# Date: 03.12.2018
+# Description: Universal Makefile for Unix based Operating Systems
+############################################################################
+WORKDIR = $(shell pwd)
+
+all: unpack windows linux
+
+.PHONY: unpack
+unpack:
+       unzip -o  tinyxml-2.src.zip
+
+.PHONY: windows
+windows:
+       cd $(WORKDIR)/tinyxml2-master; \
+       i686-w64-mingw32-g++ -c -o tinyxml2.o tinyxml2.cpp; \
+       i686-w64-mingw32-ar rvs libtinyxml2.a tinyxml2.o
+       mkdir -p $(WORKDIR)/../../include
+       mkdir -p $(WORKDIR)/../../lib/mingw32
+       cp -rf $(WORKDIR)/tinyxml2-master/libtinyxml2.a $(WORKDIR)/../../lib/mingw32
+       cp -rf $(WORKDIR)/tinyxml2-master/tinyxml2.h $(WORKDIR)/../../include
+
+.PHONY: linux
+linux:
+       cd $(WORKDIR)/tinyxml2-master; \
+       g++ -m32 -c -o tinyxml2.o tinyxml2.cpp; \
+       ar rvs libtinyxml2.a tinyxml2.o
+       mkdir -p $(WORKDIR)/../../include
+       mkdir -p $(WORKDIR)/../../lib/linux32
+       cp -rf $(WORKDIR)/tinyxml2-master/libtinyxml2.a $(WORKDIR)/../../lib/linux32
+       cp -rf $(WORKDIR)/tinyxml2-master/tinyxml2.h $(WORKDIR)/../../include
+
+.PHONY: clean
+clean:
+       rm -rf $(WORKDIR)/tinyxml2-master
diff --git a/_template/packages/tinyxml/tinyxml.cbp b/_template/packages/tinyxml/tinyxml.cbp
deleted file mode 100644 (file)
index c3e555b..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
-       <FileVersion major="1" minor="6" />
-       <Project>
-               <Option title="tinyxml" />
-               <Option pch_mode="2" />
-               <Option compiler="gcc" />
-               <Build>
-                       <Target title="tinyxml_linux64">
-                               <Option output="bin/Release/tinyxml" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Release/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-O2" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-s" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="mkdir -p ../../include" />
-                                       <Add before="mkdir -p ../../lib/linux64" />
-                                       <Add before="cp ./tinyxml2.h ../../include" />
-                                       <Add before="g++ -c -o tinyxml2.o tinyxml2.cpp" />
-                                       <Add before="ar rvs libtinyxml2.a tinyxml2.o" />
-                                       <Add before="cp ./libtinyxml2.a ../../lib/linux64" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="tinyxml_linux32">
-                               <Option output="bin/Release/tinyxml" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Release/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-O2" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-s" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="mkdir -p ../../include" />
-                                       <Add before="mkdir -p ../../lib/linux32" />
-                                       <Add before="cp ./tinyxml2.h ../../include" />
-                                       <Add before="g++ -m32 -c -o tinyxml2.o tinyxml2.cpp" />
-                                       <Add before="ar rvs libtinyxml2.a tinyxml2.o" />
-                                       <Add before="cp ./libtinyxml2.a ../../lib/linux32" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="tinyxml_windows">
-                               <Option output="bin/Release/tinyxml" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Release/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-O2" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-s" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="mkdir -p ../../include" />
-                                       <Add before="mkdir -p ../../lib/mingw32" />
-                                       <Add before="cp ./tinyxml2.h ../../include" />
-                                       <Add before="i686-w64-mingw32-g++    -c -o tinyxml2.o tinyxml2.cpp" />
-                                       <Add before="i686-w64-mingw32-ar rvs libtinyxml2.a tinyxml2.o" />
-                                       <Add before="cp ./libtinyxml2.a ../../lib/mingw32" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="tinyxml_unpack">
-                               <Option output="bin/Release/tinyxml" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Release/" />
-                               <Option type="1" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-O2" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-s" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="rm -rf ./tinyxml2-master/" />
-                                       <Add before="unzip tinyxml-2.src.zip" />
-                                       <Add before="cp -rf ./tinyxml2-master/* ./" />
-                                       <Add before="rm -rf ./tinyxml2-master/" />
-                               </ExtraCommands>
-                       </Target>
-               </Build>
-               <Compiler>
-                       <Add option="-Wall" />
-               </Compiler>
-               <Extensions>
-                       <envvars />
-                       <code_completion />
-                       <debugger />
-                       <lib_finder disable_auto="1" />
-               </Extensions>
-       </Project>
-</CodeBlocks_project_file>
index b727d35..b58a288 100644 (file)
@@ -11,6 +11,7 @@
 #include <fstream>
 #include <dirent.h>
 #include <sys/types.h>
+#include <FL/fl_utf8.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <cstring>
@@ -66,11 +67,7 @@ void FSHelper::copyFile(const std::string &src, const std::string &dest)
 void FSHelper::makeDir(const std::string &dir)
 {
     if(!dirExists(dir))
-#if defined(_WIN32)
-        if(mkdir(dir.c_str()) < 0)
-#else
-        if(mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0)
-#endif
+        if(fl_mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0)
             throw std::string("Failed to create directory: " + dir);
 
 }
@@ -137,8 +134,6 @@ void FSHelper::copyDir(const std::string &src, const std::string &dest)
     for(auto inFile : files)
     {
         File outFile = inFile;
-        unsigned int idx = 0;
-
         // ersetze Qellordner mit zielordner
         outFile.first.replace(outFile.first.find(from), from.length(), to);
         try
@@ -169,7 +164,7 @@ bool FSHelper::validFileName(const std::string &fName)
                             ';', ':', '+', '=', '*', '/', '<', '>', '?', ',', '[', ']', '{', '}'
                           };
 
-    int pos = fName.find_first_of(invalidChars, 0, sizeof(invalidChars));
+    unsigned int pos = fName.find_first_of(invalidChars, 0, sizeof(invalidChars));
     if (pos != std::string::npos)
         return false;
 
@@ -182,7 +177,7 @@ bool FSHelper::dirExists(const std::string &directory)
 
     // Ã¼berprüfe existenz
     struct stat info;
-    if( stat( dir.c_str(), &info ) != 0 )
+    if( fl_stat( dir.c_str(), &info ) != 0 )
         return false;
     if( info.st_mode & S_IFDIR )
         return true;
@@ -282,11 +277,37 @@ bool FSHelper::listDirsRecursive(const std::string &path, std::vector<std::strin
     return true;
 }
 
+std::vector<std::string> FSHelper::listDirsNonRecursive(const std::string &path,const bool showHiddenDirs)
+{
+    std::vector<std::string> folders;
+    std::string dir = addDirLastSlash(path);
+    DIR *dpdf;
+    struct dirent *epdf;
+    dpdf = opendir(dir.c_str());
+    if(dpdf != nullptr)
+    {
+        while((epdf = readdir(dpdf)) != nullptr)
+        {
+            struct stat s;
+
+            stat((dir + std::string(epdf->d_name)).c_str(), &s);
+            if(showHiddenDirs ? (S_ISDIR(s.st_mode) && std::string(epdf->d_name) != ".." && std::string(epdf->d_name) != "." ) :
+                    (S_ISDIR(s.st_mode) && strstr(epdf->d_name,"..") == NULL && strstr(epdf->d_name,".") == NULL ))
+            {
+                if(!(std::find(folders.begin(), folders.end(), dir+epdf->d_name) != folders.end()))
+                    folders.push_back(addDirLastSlash(dir+epdf->d_name));
+            }
+        }
+    }
+    closedir(dpdf);
+    return folders;
+}
+
 std::string FSHelper::getCurrentWorkingDir()
 {
     char temp[PATH_MAX];
 
-    if(getcwd(temp, PATH_MAX))
+    if(fl_getcwd(temp, PATH_MAX))
 #if defined(_WIN32)
         return convertPathToWindows(temp);
 #else
@@ -401,11 +422,6 @@ void FSHelper::executeCommand(const std::string &path, const std::string &comman
     // String vector zu char array
     std::vector<char*> charParams;
 
-
-
-    if(!log.empty())
-        FILE* logFile = freopen(log.c_str(),"a",stdout);
-
     // Param Array muss wie folgt aufgebaut sein:
     // 0 -> command
     // 1 -> param 1
@@ -441,10 +457,7 @@ void FSHelper::executeCommand(const std::string &path, const std::string &comman
     charParams.emplace_back(nullptr); //Letztes element muss ein nullpointer sein
 
     int status;
-    pid_t parent_pid;
     pid_t child_pid;
-    parent_pid = getpid();
-
     child_pid = fork();
     switch(child_pid)
     {
index 45d93fd..d0f1a7b 100644 (file)
@@ -85,14 +85,14 @@ public:
     bool validFileName(const std::string &fName);
 
 /////////////////////////////////////////////////
-/// \brief Ersetzt alle / mit \\
+/// \brief Ersetzt alle / mit doppel backslash
 /// \param dir Zu verarbeitender pfad
 /// \return pfad mit ersetzten Zeichen
 /////////////////////////////////////////////////
     std::string convertPathToWindows(const std::string &dir);
 
 /////////////////////////////////////////////////
-/// \brief Ersetzt alle \\ mit /
+/// \brief Ersetzt alle doppel backslash mit /
 /// \param dir Zu verarbeitender pfad
 /// \return pfad mit ersetzten Zeichen
 /////////////////////////////////////////////////
@@ -144,12 +144,12 @@ public:
 ///        false nein)
 /// \return true bei erfolg, false bei fehler
 /////////////////////////////////////////////////
-    bool listFilesRecursive(const std::string &path, std::vector<FSHelper::File> &files,const bool showHiddenDirs);
+    bool listFilesRecursive(const std::string &path, std::vector<FSHelper::File> &files,const bool showHiddenDirs = false);
 
 /////////////////////////////////////////////////
 /// \brief Diese funktion gibt rekursiv alle Unterordner eines
 ///        Ordners zurück.
-/// \param [IN] src Ordner dessen Dateien zurückgegeben
+/// \param [IN] src Ordner dessen Unterordner zurückgegeben
 ///        werden sollen.
 /// \param [OUT] string Vektor mit allen gefundenen Ordnern
 /// \param [IN] Optional, Gibt an ob auch versteckte Unterordner
@@ -157,7 +157,19 @@ public:
 ///        false nein)
 /// \return true bei erfolg, false bei fehler
 /////////////////////////////////////////////////
-    bool listDirsRecursive(const std::string &path, std::vector<std::string>& dirs,const bool showHiddenDirs);
+    bool listDirsRecursive(const std::string &path, std::vector<std::string>& dirs,const bool showHiddenDirs = false);
+
+/////////////////////////////////////////////////
+/// \brief Diese funktion gibt alle Unterordner eines
+///        Ordners zurück (nicht rekursiv).
+/// \param src Ordner dessen Unterordner zurückgegeben
+///        werden sollen.
+/// \param Optional, Gibt an ob auch versteckte Unterordner
+///        durchsucht werden sollen. (true ja,
+///        false nein)
+/// \return string Vektor mit allen gefundenen Ordnern
+/////////////////////////////////////////////////
+    std::vector<std::string> listDirsNonRecursive(const std::string &path,const bool showHiddenDirs = false);
 
 /////////////////////////////////////////////////
 /// \brief Diese funktion führt einen Befehl/ein Programm
diff --git a/_template/src/Icon.ico b/_template/src/Icon.ico
new file mode 100644 (file)
index 0000000..2cb803d
Binary files /dev/null and b/_template/src/Icon.ico differ
diff --git a/_template/src/Icon.png b/_template/src/Icon.png
new file mode 100644 (file)
index 0000000..7912f4e
Binary files /dev/null and b/_template/src/Icon.png differ
diff --git a/_template/src/Makefile b/_template/src/Makefile
new file mode 100644 (file)
index 0000000..e51c0f6
--- /dev/null
@@ -0,0 +1,213 @@
+############################################################################
+# Workfile: Makefile
+# Author: Daniel Giritzer, S1810567004 (daniel@giritzer.eu)
+# Date: 03.12.2018
+# Description: Universal Makefile for Unix based Operating Systems
+############################################################################
+
+###################################
+#GENERAL | EDIT 1/7
+###################################
+WORKDIR = $(shell pwd)
+SOURCES := $(shell ls *.cxx)
+PROJNAME = _template
+LIBDIR =
+INC = -I$(WORKDIR)/../include -I$(WORKDIR)/../../include
+LDFLAGS = -m32 -std=c++11 -static-libstdc++ -static-libgcc
+CFLAGS = -m32 -Wall -fexceptions -std=c++11 -static-libstdc++ -static-libgcc
+LIB = -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg -lfltk
+
+###################################
+#GCC | EDIT 2/7
+###################################
+CC_GCC = gcc
+CXX_GCC = g++
+AR_GCC = ar
+LD_GCC = g++
+WINDRES_GCC =
+
+INC_GCC = $(INC)
+LIBDIR_GCC = -L$(WORKDIR)/../lib/linux32 -L$(WORKDIR)/../../lib/linux32
+CFLAGS_GCC = $(CFLAGS)
+RESINC_GCC =
+LDFLAGS_GCC = $(LDFLAGS)
+LIB_GCC = $(LIB) -lm -lpthread -lX11 -lxcb -lXau -lXdmcp -lbsd -lrt -ldl
+
+###################################
+#MinGW | EDIT 3/7
+###################################
+CC_WIN = i686-w64-mingw32-gcc
+CXX_WIN = i686-w64-mingw32-g++
+AR_WIN = i686-w64-mingw32-ar
+LD_WIN = i686-w64-mingw32-g++
+WINDRES_WIN = i686-w64-mingw32-windres
+
+INC_WIN = $(INC)
+LIBDIR_WIN = -L$(WORKDIR)/../lib/mingw32 -L$(WORKDIR)/../../lib/mingw32
+CFLAGS_WIN = $(CFLAGS) -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+RESINC_WIN =
+LDFLAGS_WIN =  $(LDFLAGS) -static
+LIB_WIN = $(LIB) -mwindows -lole32 -luuid -lcomctl32 -lpthread
+
+###################################
+#RELEASE GCC SETTINGS | EDIT: 4/7
+###################################
+INC_RELEASE_GCC = $(INC_GCC)
+CFLAGS_RELEASE_GCC = $(CFLAGS_GCC) -O2
+RESINC_RELEASE_GCC = $(RESINC_GCC)
+RCFLAGS_RELEASE_GCC = $(RCFLAGS_GCC)
+LIBDIR_RELEASE_GCC = $(LIBDIR_GCC)
+LIB_RELEASE_GCC = $(LIB_GCC)
+LDFLAGS_RELEASE_GCC = $(LDFLAGS_GCC) -s
+OBJDIR_RELEASE_GCC = obj/Release_Linux
+DEP_RELEASE_GCC =
+OUT_RELEASE_GCC = bin/Release_Linux
+
+###################################
+#DEBUG GCC SETTINGS | EDIT: 5/7
+###################################
+INC_DEBUG_GCC = $(INC_GCC)
+CFLAGS_DEBUG_GCC = $(CFLAGS_GCC) -g
+RESINC_DEBUG_GCC = $(RESINC_GCC)
+RCFLAGS_DEBUG_GCC = $(RCFLAGS_GCC)
+LIBDIR_DEBUG_GCC = $(LIBDIR_GCC)
+LIB_DEBUG_GCC = $(LIB_GCC)
+LDFLAGS_DEBUG_GCC = $(LDFLAGS_GCC)
+OBJDIR_DEBUG_GCC = obj/Debug_Linux
+DEP_DEBUG_GCC =
+OUT_DEBUG_GCC = bin/Debug_Linux
+
+###################################
+#RELEASE MinGW SETTINGS | EDIT: 6/7
+###################################
+INC_RELEASE_WIN = $(INC_WIN)
+CFLAGS_RELEASE_WIN = $(CFLAGS_WIN) -O2
+RESINC_RELEASE_WIN = $(RESINC_WIN)
+RCFLAGS_RELEASE_WIN = $(RCFLAGS_WIN)
+LIBDIR_RELEASE_WIN = $(LIBDIR_WIN)
+LIB_RELEASE_WIN = $(LIB_WIN)
+LDFLAGS_RELEASE_WIN = $(LDFLAGS_WIN) -s
+OBJDIR_RELEASE_WIN = obj/Release_Windows
+DEP_RELEASE_WIN =
+OUT_RELEASE_WIN = bin/Release_Windows
+
+###################################
+#DEBUG MinGW SETTINGS | EDIT: 7/7
+###################################
+INC_DEBUG_WIN = $(INC_WIN)
+CFLAGS_DEBUG_WIN = $(CFLAGS_WIN) -g
+RESINC_DEBUG_WIN = $(RESINC_WIN)
+RCFLAGS_DEBUG_WIN = $(RCFLAGS_WIN)
+LIBDIR_DEBUG_WIN = $(LIBDIR_WIN)
+LIB_DEBUG_WIN = $(LIB_WIN)
+LDFLAGS_DEBUG_WIN = $(LDFLAGS_WIN)
+OBJDIR_DEBUG_WIN = obj/Debug_Windows
+DEP_DEBUG_WIN =
+OUT_DEBUG_WIN = bin/Debug_Windows
+
+############################
+#OBJECT LISTS | DO NOT EDIT!
+############################
+OBJ_DEBUG_GCC = $(addprefix $(OBJDIR_DEBUG_GCC)/,$(SOURCES:%.cxx=%.o))
+OBJ_RELEASE_GCC = $(addprefix $(OBJDIR_RELEASE_GCC)/,$(SOURCES:%.cxx=%.o))
+OBJ_DEBUG_WIN = $(addprefix $(OBJDIR_DEBUG_WIN)/,$(SOURCES:%.cxx=%.o))
+OBJ_RELEASE_WIN = $(addprefix $(OBJDIR_RELEASE_WIN)/,$(SOURCES:%.cxx=%.o))
+
+##########################
+#FUNCTIONS | DO NOT EDIT!
+##########################
+
+######## General
+all: make_fluid debug release
+clean: clean_debug_linux clean_release_linux clean_debug_windows clean_release_windows
+rebuild: clean debug release
+
+debug Debug: debug_linux debug_windows
+release Release:  release_linux release_windows
+
+make_fluid:
+       $(WORKDIR)/../packages/fltk/fltk-1.3.4-1/fluid/fluid -c $(WORKDIR)/ViewFluid.fld
+
+######## DEBUG GCC
+before_debug_linux:
+       test -d $(OUT_DEBUG_GCC) || mkdir -p $(OUT_DEBUG_GCC)
+       test -d $(OBJDIR_DEBUG_GCC) || mkdir -p $(OBJDIR_DEBUG_GCC)
+
+after_debug_linux:
+
+debug_linux: before_debug_linux out_debug_linux after_debug_linux
+
+out_debug_linux: before_debug_linux $(OBJ_DEBUG_GCC) $(DEP_DEBUG_GCC)
+       $(LD_GCC) $(LDFLAGS_DEBUG_GCC) $(LIBDIR_GCC) $(LIBDIR_DEBUG_GCC) $(OBJ_DEBUG_GCC) $(LIB_DEBUG_GCC)  -o $(OUT_DEBUG_GCC)/$(PROJNAME)
+
+$(OBJDIR_DEBUG_GCC)/%.o: %.cxx
+       $(CXX_GCC) $(CFLAGS_DEBUG_GCC) $(INC_DEBUG_GCC) -c $< -D_DEBUG -o $@
+
+clean_debug_linux:
+       rm -f $(OBJ_DEBUG_GCC) $(OUT_DEBUG_GCC)/$(PROJNAME)
+       rm -rf $(OUT_DEBUG_GCC)
+       rm -rf $(OBJDIR_DEBUG_GCC)
+
+######## RELEASE GCC
+before_release_linux:
+       test -d $(OUT_RELEASE_GCC) || mkdir -p $(OUT_RELEASE_GCC)
+       test -d $(OBJDIR_RELEASE_GCC) || mkdir -p $(OBJDIR_RELEASE_GCC)
+
+after_release_linux:
+
+release_linux: before_release_linux out_release_linux after_release_linux
+
+out_release_linux: before_release_linux $(OBJ_RELEASE_GCC) $(DEP_RELEASE_GCC)
+       $(LD_GCC) $(LDFLAGS_RELEASE_GCC) $(LIBDIR_GCC) $(LIBDIR_RELEASE_GCC) $(OBJ_RELEASE_GCC) $(LIB_RELEASE_GCC)  -o $(OUT_RELEASE_GCC)/$(PROJNAME)
+
+$(OBJDIR_RELEASE_GCC)/%.o: %.cxx
+       $(CXX_GCC) $(CFLAGS_RELEASE_GCC) $(INC_RELEASE_GCC) -c $< -D_RELEASE -o $@
+
+clean_release_linux:
+       rm -f $(OBJ_RELEASE_GCC) $(OUT_RELEASE_GCC)/$(PROJNAME)
+       rm -rf $(OUT_RELEASE_GCC)
+       rm -rf $(OBJDIR_RELEASE_GCC)
+
+######## DEBUG WIN
+before_debug_windows:
+       test -d $(OUT_DEBUG_WIN) || mkdir -p $(OUT_DEBUG_WIN)
+       test -d $(OBJDIR_DEBUG_WIN) || mkdir -p $(OBJDIR_DEBUG_WIN)
+       $(WINDRES_WIN) main.rc $(OBJDIR_DEBUG_WIN)/mainres.o
+
+after_debug_windows:
+
+debug_windows: before_debug_windows out_debug_windows after_debug_windows
+
+out_debug_windows: before_debug_windows $(OBJ_DEBUG_WIN) $(DEP_DEBUG_WIN)
+       $(LD_WIN) $(LDFLAGS_DEBUG_WIN) $(LIBDIR_WIN) $(LIBDIR_DEBUG_WIN) $(OBJ_DEBUG_WIN) $(OBJDIR_DEBUG_WIN)/mainres.o $(LIB_DEBUG_WIN)  -o $(OUT_DEBUG_WIN)/$(PROJNAME).exe
+
+$(OBJDIR_DEBUG_WIN)/%.o: %.cxx
+       $(CXX_WIN) $(CFLAGS_DEBUG_WIN) $(INC_DEBUG_WIN) -c $< -D_DEBUG -o $@
+
+clean_debug_windows:
+       rm -f $(OBJ_DEBUG_WIN) $(OUT_DEBUG_WIN)/$(PROJNAME).exe
+       rm -rf $(OUT_DEBUG_WIN)
+       rm -rf $(OBJDIR_DEBUG_WIN)
+
+######## RELEASE WIN
+before_release_windows:
+       test -d $(OUT_RELEASE_WIN) || mkdir -p $(OUT_RELEASE_WIN)
+       test -d $(OBJDIR_RELEASE_WIN) || mkdir -p $(OBJDIR_RELEASE_WIN)
+       $(WINDRES_WIN) main.rc $(OBJDIR_RELEASE_WIN)/mainres.o
+
+after_release_windows:
+
+release_windows: before_release_windows out_release_windows after_release_windows
+
+out_release_windows: before_release_windows $(OBJ_RELEASE_WIN) $(DEP_RELEASE_WIN)
+       $(LD_WIN) $(LDFLAGS_RELEASE_WIN) $(LIBDIR_WIN) $(LIBDIR_RELEASE_WIN) $(OBJ_RELEASE_WIN) $(OBJDIR_RELEASE_WIN)/mainres.o $(LIB_RELEASE_WIN)  -o $(OUT_RELEASE_WIN)/$(PROJNAME).exe
+
+$(OBJDIR_RELEASE_WIN)/%.o: %.cxx
+       $(CXX_WIN) $(CFLAGS_RELEASE_WIN) $(INC_RELEASE_WIN) -c $< -D_RELEASE -o $@
+
+clean_release_windows:
+       rm -f $(OBJ_RELEASE_WIN) $(OUT_RELEASE_WIN)/$(PROJNAME).exe
+       rm -rf $(OUT_RELEASE_WIN)
+       rm -rf $(OBJDIR_RELEASE_WIN)
+
+.PHONY: before_debug_linux out_debug_linux after_debug_linux before_release_linux out_release_linux after_release_linux before_debug_windows out_debug_windows after_debug_windows before_release_windows out_release_windows after_release_windows
index 96371e6..77968d7 100644 (file)
@@ -9,6 +9,12 @@
 #include "View.h"
 #include <iostream>
 #include <FL/fl_ask.H>
+#include <FL/Fl_PNG_Image.H>
+
+#ifdef _WIN32
+#include <FL/x.H>
+#include <windows.h>
+#endif /*_WIN32*/
 
 View::View(ControllerIF::SPtr contr, ModelIF::SPtr model)
 {
@@ -17,6 +23,17 @@ View::View(ControllerIF::SPtr contr, ModelIF::SPtr model)
     subscribeSubject(mModel.get());
 }
 
+void View::showErrorMsg(const std::string& message)
+{
+    std::cerr << message << std::endl;
+    std::string printMsg = message;
+    fl_message_title("Error!");
+    printMsg.append("\n\nExit application?");
+    switch ( fl_choice(printMsg.c_str(), "Yes", "No", 0) ) {
+      case 0: exit(EXIT_FAILURE); break;
+    }
+}
+
 View::~View()
 {
     win_exmpl->hide();
@@ -28,8 +45,9 @@ View::~View()
 
 void View::updatedBySubject(Subject* s)
 {
-    if(s == nullptr)
+    if(s == nullptr) {
         throw std::string("Nullpointer given as Subject!");
+    }
 
         try
         {
@@ -39,18 +57,36 @@ void View::updatedBySubject(Subject* s)
             win_exmpl->redraw();
         }
         // ----------- Exception Handling ------------
-        catch(std::string& e)
+        catch(const std::string &e)
         {
-            std::cerr << e << std::endl;
-            fl_alert(e.c_str()); //Textbox mit fehlermeldung
+            showErrorMsg(e);
         }
-}
+        catch(...)
+        {
+            showErrorMsg("Unknown error occured!");
+        }
+} 
 
 void View::show()
 {
     // Setze fenster style global
     Fl::scheme("gtk+");
 
+    //Setze Fenster Icon
+#ifdef _WIN32
+    win_exmpl->icon((char*)LoadIcon(fl_display, MAKEINTRESOURCE(101)));
+#else
+    Fl_PNG_Image win_icon("Icon.png");
+    win_exmpl->icon(&win_icon);
+#endif /*_WIN32*/
+
+    //Tabelle mit Beispieldaten füllen
+    tbl_example->row_header(true);
+    tbl_example->col_header(true);
+    for(int i = 0; i <= 10; i++)
+           for(int ii = 0; ii <= 10; ii++)
+               tbl_example->SetTableData(std::to_string(i) + " " + std::to_string(ii), i, ii, i + ii);
+
     // definiere callback funktionen
     btn_exception->callback((Fl_Callback*)btn_exception_cb, (void*)(this) );
 
@@ -68,12 +104,10 @@ void View::btn_exception_cb(Fl_Button* btn, void* view)
     // ----------- Exception Handling ------------
     catch(const std::string &e)
     {
-        std::cerr << e << std::endl;
-        fl_alert(e.c_str()); //Textbox mit fehlermeldung
+       showErrorMsg(e);
     }
     catch(...)
     {
-        fl_alert("Unknown error occured!");
-        std::cerr << "Unknown error occured!" << std::endl;
+       showErrorMsg("Unknown error occured!");
     }
 }
index 1614128..6c4e249 100644 (file)
@@ -50,6 +50,13 @@ public:
     /////////////////////////////////////////////////
     void updatedBySubject(Subject* s);
 
+    /////////////////////////////////////////////////
+    /// \brief Funktion zum darstellen von
+    /// Fehlermeldungen.
+    /// \param message anzuzeigende Fehlermeldung
+    /////////////////////////////////////////////////
+    static void showErrorMsg(const std::string& message);
+
 private:
     ControllerIF::SPtr mController;
     ModelIF::SPtr mModel;
index 8d76f38..8d18686 100644 (file)
 // generated by Fast Light User Interface Designer (fluid) version 1.0304
 
 #include "ViewFluid.h"
+#include <FL/fl_draw.H>
+#include <FL/Fl_Table_Row.H>
+#include <string>
+#include <vector>
+
+void SimpleTable::draw_cell(TableContext context, int R, int C, int X, int Y, int W, int H) {
+  static char s[40];
+      switch ( context ) {
+        case CONTEXT_STARTPAGE:                   // before page is drawn..
+          fl_font(FL_HELVETICA, 16);              // set the font for our drawing operations
+          return; 
+        case CONTEXT_COL_HEADER:                  // Draw column headers
+          sprintf(s,"%c",'A'+C);                // "A", "B", "C", etc.
+          DrawHeader(s,X,Y,W,H);
+          return; 
+        case CONTEXT_ROW_HEADER:                  // Draw row headers
+          sprintf(s,"%02d:",R+1);                 // "001:", "002:", etc
+          DrawHeader(s,X,Y,W,H);
+          return; 
+        case CONTEXT_CELL:                        // Draw data in cells
+               if((int)m_TableData.size()-1 < R)
+                       SetTableData("", 0, R);
+               
+               if((int)m_TableData.at(R).size()-1 < C)
+                       SetTableData("", C, 0);
+                                       
+          DrawData(m_TableData.at(R).at(C).c_str(),
+                   m_CellColors.at(R).at(C),X,Y,W,H);
+          return;
+        default:
+          return;
+   }
+}
+
+SimpleTable::SimpleTable(int x, int y, int w, int h, const char *l ) : Fl_Table_Row(x,y,w,h,l) {
+}
+
+void SimpleTable::SetTableData(std::string data, unsigned int x , unsigned int y , Fl_Color color ) {
+  if(m_TableData.empty() || (m_TableData.size() < y+1))
+  {
+      m_TableData.resize(y+1);
+      rows(y+1);
+  }
+  
+  for (unsigned int i = 0; i < m_TableData.size(); ++i)
+      if(m_TableData.at(i).empty() || 
+        (m_TableData.at(i).size() < x+1))
+      {
+          m_TableData.at(i).resize(x+1, "");   
+          cols(x+1);
+      }   
+  
+  m_TableData.at(y).at(x) = data;
+  SetCellColor(color,x,y);
+}
+
+void SimpleTable::SetCellColor(Fl_Color color, unsigned int x , unsigned int y ) {
+  if(m_CellColors.empty() || (m_CellColors.size() < y+1))
+  {
+      m_CellColors.resize(y+1);
+      rows(y+1);
+  }
+  
+  for (unsigned int i = 0; i < m_CellColors.size(); ++i)
+      if(m_CellColors.at(i).empty() || 
+        (m_CellColors.at(i).size() < x+1))
+      {
+          m_CellColors.at(i).resize(x+1, FL_WHITE);   
+          cols(x+1);
+      }   
+  
+  m_CellColors.at(y).at(x) = color;
+}
+
+std::vector<std::vector<std::string>> SimpleTable::GetTableData() {
+  return m_TableData;
+}
+
+void SimpleTable::Resize(unsigned int x , unsigned int y ) {
+  m_TableData.resize(y+1);
+  m_CellColors.resize(y+1);
+  rows(y+1);
+  for (unsigned int i = 0; i < m_TableData.size(); ++i)
+  {
+      m_CellColors.at(i).resize(x+1, FL_WHITE);
+      m_TableData.at(i).resize(x+1, "");   
+  }       
+  cols(x+1);
+}
+
+void SimpleTable::DrawData(const char *s, Fl_Color cell_color, int X, int Y, int W, int H) {
+  fl_push_clip(X,Y,W,H);
+        // Draw cell bg
+        fl_color(cell_color); fl_rectf(X,Y,W,H);
+        // Draw cell data
+        fl_color(FL_GRAY0); fl_draw(s, X,Y,W,H, FL_ALIGN_CENTER);
+        // Draw box border
+        fl_color(color()); fl_rect(X,Y,W,H);
+  fl_pop_clip();
+}
+
+void SimpleTable::DrawHeader(const char *s, int X, int Y, int W, int H) {
+  fl_push_clip(X,Y,W,H);
+        fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, row_header_color());
+        fl_color(FL_BLACK);
+        fl_draw(s, X,Y,W,H, FL_ALIGN_CENTER);
+  fl_pop_clip();
+}
 
 ViewFluid::ViewFluid() {
-  { win_exmpl = new Fl_Double_Window(340, 150, "Example");
+  { win_exmpl = new Fl_Double_Window(500, 300, "Example");
     win_exmpl->box(FL_GTK_DOWN_BOX);
     win_exmpl->user_data((void*)(this));
     win_exmpl->hotspot(win_exmpl);
-    { btn_exception = new Fl_Button(100, 45, 135, 45, "Throw Exception");
+    { btn_exception = new Fl_Button(20, 120, 135, 45, "Throw Exception");
     } // Fl_Button* btn_exception
+    { tbl_example = new SimpleTable(170, 0, 330, 300);
+      tbl_example->tooltip("Simple Table Implementation Example");
+      tbl_example->box(FL_THIN_DOWN_FRAME);
+      tbl_example->color(FL_BACKGROUND_COLOR);
+      tbl_example->selection_color(FL_BACKGROUND_COLOR);
+      tbl_example->labeltype(FL_NORMAL_LABEL);
+      tbl_example->labelfont(0);
+      tbl_example->labelsize(14);
+      tbl_example->labelcolor(FL_FOREGROUND_COLOR);
+      tbl_example->align(Fl_Align(FL_ALIGN_TOP));
+      tbl_example->when(FL_WHEN_RELEASE);
+      tbl_example->end();
+    } // SimpleTable* tbl_example
     win_exmpl->size_range(585, 555);
     win_exmpl->end();
-    win_exmpl->resizable(win_exmpl);
   } // Fl_Double_Window* win_exmpl
 }
index 4cefb23..f42b4fb 100644 (file)
 version 1.0304
 header_name {.h}
 code_name {.cxx}
+declblock {\#include <FL/fl_draw.H>} {open public after {\#include <FL/Fl_Table_Row.H>}
+} {}
+
+declblock {\#include <string>} {open public after {\#include <vector>}
+} {}
+
+class SimpleTable {: {public Fl_Table_Row}
+} {
+  Function {draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0)} {return_type void
+  } {
+    code {static char s[40];
+    switch ( context ) {
+      case CONTEXT_STARTPAGE:                   // before page is drawn..
+        fl_font(FL_HELVETICA, 16);              // set the font for our drawing operations
+        return; 
+      case CONTEXT_COL_HEADER:                  // Draw column headers
+        sprintf(s,"%c",'A'+C);                // "A", "B", "C", etc.
+        DrawHeader(s,X,Y,W,H);
+        return; 
+      case CONTEXT_ROW_HEADER:                  // Draw row headers
+        sprintf(s,"%02d:",R+1);                 // "001:", "002:", etc
+        DrawHeader(s,X,Y,W,H);
+        return; 
+      case CONTEXT_CELL:                        // Draw data in cells
+       if((int)m_TableData.size()-1 < R)
+               SetTableData("", 0, R);
+       
+       if((int)m_TableData.at(R).size()-1 < C)
+               SetTableData("", C, 0);
+                               
+        DrawData(m_TableData.at(R).at(C).c_str(),
+                 m_CellColors.at(R).at(C),X,Y,W,H);
+        return;
+      default:
+        return;
+ }} {}
+  }
+  Function {SimpleTable(int x, int y, int w, int h, const char *l = 0) : Fl_Table_Row(x,y,w,h,l)} {} {
+    code {} {}
+  }
+  Function {SetTableData(std::string data, unsigned int x = 0, unsigned int y = 0, Fl_Color color = FL_WHITE)} {return_type void
+  } {
+    code {if(m_TableData.empty() || (m_TableData.size() < y+1))
+{
+    m_TableData.resize(y+1);
+    rows(y+1);
+}
+
+for (unsigned int i = 0; i < m_TableData.size(); ++i)
+    if(m_TableData.at(i).empty() || 
+      (m_TableData.at(i).size() < x+1))
+    {
+        m_TableData.at(i).resize(x+1, "");   
+        cols(x+1);
+    }   
+
+m_TableData.at(y).at(x) = data;
+SetCellColor(color,x,y);} {}
+  }
+  Function {SetCellColor(Fl_Color color, unsigned int x = 0, unsigned int y = 0)} {return_type void
+  } {
+    code {if(m_CellColors.empty() || (m_CellColors.size() < y+1))
+{
+    m_CellColors.resize(y+1);
+    rows(y+1);
+}
+
+for (unsigned int i = 0; i < m_CellColors.size(); ++i)
+    if(m_CellColors.at(i).empty() || 
+      (m_CellColors.at(i).size() < x+1))
+    {
+        m_CellColors.at(i).resize(x+1, FL_WHITE);   
+        cols(x+1);
+    }   
+
+m_CellColors.at(y).at(x) = color;} {}
+  }
+  Function {GetTableData()} {return_type {std::vector<std::vector<std::string>>}
+  } {
+    code {return m_TableData;} {}
+  }
+  Function {Resize(unsigned int x = 0, unsigned int y = 0)} {} {
+    code {m_TableData.resize(y+1);
+m_CellColors.resize(y+1);
+rows(y+1);
+for (unsigned int i = 0; i < m_TableData.size(); ++i)
+{
+    m_CellColors.at(i).resize(x+1, FL_WHITE);
+    m_TableData.at(i).resize(x+1, "");   
+}       
+cols(x+1);} {}
+  }
+  decl {using TableData = std::vector<std::vector<std::string>>;} {public local
+  }
+  decl {using TableCellColors = std::vector<std::vector<Fl_Color>>;} {public local
+  }
+  Function {DrawData(const char *s, Fl_Color cell_color, int X, int Y, int W, int H)} {private return_type void
+  } {
+    code {fl_push_clip(X,Y,W,H);
+      // Draw cell bg
+      fl_color(cell_color); fl_rectf(X,Y,W,H);
+      // Draw cell data
+      fl_color(FL_GRAY0); fl_draw(s, X,Y,W,H, FL_ALIGN_CENTER);
+      // Draw box border
+      fl_color(color()); fl_rect(X,Y,W,H);
+fl_pop_clip();} {}
+  }
+  Function {DrawHeader(const char *s, int X, int Y, int W, int H)} {private return_type void
+  } {
+    code {fl_push_clip(X,Y,W,H);
+      fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, row_header_color());
+      fl_color(FL_BLACK);
+      fl_draw(s, X,Y,W,H, FL_ALIGN_CENTER);
+fl_pop_clip();} {}
+  }
+  decl {TableData m_TableData;} {private local
+  }
+  decl {TableCellColors m_CellColors;} {private local
+  }
+}
+
 class ViewFluid {open
 } {
   Function {ViewFluid()} {open protected
   } {
     Fl_Window win_exmpl {
       label Example open selected
-      protected xywh {634 239 340 150} type Double box GTK_DOWN_BOX resizable hotspot size_range {585 555 0 0} visible
+      protected xywh {729 313 500 300} type Double box GTK_DOWN_BOX hotspot size_range {585 555 0 0} visible
     } {
       Fl_Button btn_exception {
         label {Throw Exception}
-        xywh {100 45 135 45}
+        protected xywh {20 120 135 45}
       }
+      Fl_Table tbl_example {open
+        protected tooltip {Simple Table Implementation Example} xywh {170 0 330 300}
+        class SimpleTable
+      } {}
     }
   }
 }
index ae437a5..ad9ba6c 100644 (file)
@@ -3,6 +3,27 @@
 #ifndef ViewFluid_h
 #define ViewFluid_h
 #include <FL/Fl.H>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Table_Row.H>
+#include <string>
+#include <vector>
+
+class SimpleTable : public Fl_Table_Row {
+public:
+  void draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0);
+  SimpleTable(int x, int y, int w, int h, const char *l = 0) ;
+  void SetTableData(std::string data, unsigned int x = 0, unsigned int y = 0, Fl_Color color = FL_WHITE);
+  void SetCellColor(Fl_Color color, unsigned int x = 0, unsigned int y = 0);
+  std::vector<std::vector<std::string>> GetTableData();
+  void Resize(unsigned int x = 0, unsigned int y = 0);
+using TableData = std::vector<std::vector<std::string>>;
+using TableCellColors = std::vector<std::vector<Fl_Color>>;
+private:
+  void DrawData(const char *s, Fl_Color cell_color, int X, int Y, int W, int H);
+  void DrawHeader(const char *s, int X, int Y, int W, int H);
+  TableData m_TableData; 
+  TableCellColors m_CellColors; 
+};
 #include <FL/Fl_Double_Window.H>
 #include <FL/Fl_Button.H>
 
@@ -10,7 +31,7 @@ class ViewFluid {
 protected:
   ViewFluid();
   Fl_Double_Window *win_exmpl;
-public:
   Fl_Button *btn_exception;
+  SimpleTable *tbl_example;
 };
 #endif
diff --git a/_template/src/_template.cbp b/_template/src/_template.cbp
deleted file mode 100644 (file)
index e4f6d6a..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
-       <FileVersion major="1" minor="6" />
-       <Project>
-               <Option title="_template" />
-               <Option pch_mode="2" />
-               <Option compiler="gcc" />
-               <Build>
-                       <Target title="Release_Linux64">
-                               <Option output="bin/Release_Linux64/_template" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Release_Linux64/" />
-                               <Option type="0" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-O2" />
-                                       <Add option="-s" />
-                                       <Add directory="../src" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-static-libstdc++" />
-                                       <Add option="-static-libgcc" />
-                                       <Add option="../lib/linux64/libfltk.a" />
-                                       <Add option="../lib/linux64/libtinyxml2.a" />
-                                       <Add option="-ldl" />
-                                       <Add option="-lm" />
-                                       <Add option="-lX11" />
-                                       <Add directory="../lib/linux64" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="fluid -c ./ViewFluid.fld" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="Release_Linux32">
-                               <Option output="bin/Release_Linux32/_template" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Release_Linux32/" />
-                               <Option type="0" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-O2" />
-                                       <Add option="-m32" />
-                                       <Add directory="../src" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-m32" />
-                                       <Add option="-static-libstdc++" />
-                                       <Add option="-static-libgcc" />
-                                       <Add option="../lib/linux32/libfltk.a" />
-                                       <Add option="../lib/linux32/libtinyxml2.a" />
-                                       <Add option="-ldl" />
-                                       <Add option="-lm" />
-                                       <Add option="-lX11" />
-                                       <Add directory="../lib/linux32" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="fluid -c ./ViewFluid.fld" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="Release_Windows">
-                               <Option output="bin/Release_Windows/_template" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Release_Windows/" />
-                               <Option type="0" />
-                               <Option compiler="mingw32_compiler" />
-                               <Compiler>
-                                       <Add option="-O2" />
-                                       <Add option="-m32" />
-                                       <Add option="-mwindows" />
-                                       <Add option="-DWIN32" />
-                                       <Add option="-DUSE_OPENGL32" />
-                                       <Add option="-D_LARGEFILE_SOURCE" />
-                                       <Add option="-D_LARGEFILE64_SOURCE" />
-                                       <Add option="-D_FILE_OFFSET_BITS=64" />
-                                       <Add directory="../src" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-m32" />
-                                       <Add option="-mwindows" />
-                                       <Add option="-static-libgcc" />
-                                       <Add option="-static-libstdc++" />
-                                       <Add option="../lib/mingw32/libfltk.a" />
-                                       <Add option="../lib/mingw32/libtinyxml2.a" />
-                                       <Add option="-lole32" />
-                                       <Add option="-luuid" />
-                                       <Add option="-lcomctl32" />
-                                       <Add directory="../lib/mingw32" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="fluid -c ./ViewFluid.fld" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="Debug_Linux64">
-                               <Option output="bin/Debug_Linux64/_template" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Debug_Linux64/" />
-                               <Option type="0" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-g" />
-                                       <Add directory="../src" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-static-libstdc++" />
-                                       <Add option="-static-libgcc" />
-                                       <Add option="../lib/linux64/libfltk.a" />
-                                       <Add option="../lib/linux64/libtinyxml2.a" />
-                                       <Add option="-ldl" />
-                                       <Add option="-lm" />
-                                       <Add option="-lX11" />
-                                       <Add directory="../lib/linux64" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="fluid -c ./ViewFluid.fld" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="Debug_Linux32">
-                               <Option output="bin/Debug_Linux32/_template" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Debug_Linux32/" />
-                               <Option type="0" />
-                               <Option compiler="gcc" />
-                               <Compiler>
-                                       <Add option="-m32" />
-                                       <Add option="-g" />
-                                       <Add directory="../src" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-m32" />
-                                       <Add option="-static-libstdc++" />
-                                       <Add option="-static-libgcc" />
-                                       <Add option="../lib/linux32/libfltk.a" />
-                                       <Add option="../lib/linux32/libtinyxml2.a" />
-                                       <Add option="-ldl" />
-                                       <Add option="-lm" />
-                                       <Add option="-lX11" />
-                                       <Add directory="../lib/linux32" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="fluid -c ./ViewFluid.fld" />
-                               </ExtraCommands>
-                       </Target>
-                       <Target title="Debug_Windows">
-                               <Option output="bin/Debug_Windows/_template" prefix_auto="1" extension_auto="1" />
-                               <Option object_output="obj/Debug_Windows/" />
-                               <Option type="0" />
-                               <Option compiler="mingw32_compiler" />
-                               <Compiler>
-                                       <Add option="-m32" />
-                                       <Add option="-g" />
-                                       <Add option="-mwindows" />
-                                       <Add option="-DWIN32" />
-                                       <Add option="-DUSE_OPENGL32" />
-                                       <Add option="-D_LARGEFILE_SOURCE" />
-                                       <Add option="-D_LARGEFILE64_SOURCE" />
-                                       <Add option="-D_FILE_OFFSET_BITS=64" />
-                                       <Add directory="../src" />
-                               </Compiler>
-                               <Linker>
-                                       <Add option="-m32" />
-                                       <Add option="-mwindows" />
-                                       <Add option="-static-libgcc" />
-                                       <Add option="-static-libstdc++" />
-                                       <Add option="../lib/mingw32/libfltk.a" />
-                                       <Add option="../lib/mingw32/libtinyxml2.a" />
-                                       <Add option="-lole32" />
-                                       <Add option="-luuid" />
-                                       <Add option="-lcomctl32" />
-                                       <Add directory="../lib/mingw32" />
-                               </Linker>
-                               <ExtraCommands>
-                                       <Add before="fluid -c ./ViewFluid.fld" />
-                               </ExtraCommands>
-                       </Target>
-               </Build>
-               <Compiler>
-                       <Add option="-std=c++11" />
-                       <Add directory="../include" />
-               </Compiler>
-               <Unit filename="Controller.cxx" />
-               <Unit filename="Controller.h" />
-               <Unit filename="ControllerIF.h" />
-               <Unit filename="FSHelper.cxx" />
-               <Unit filename="FSHelper.h" />
-               <Unit filename="Model.cxx" />
-               <Unit filename="Model.h" />
-               <Unit filename="ModelIF.h" />
-               <Unit filename="Object.h" />
-               <Unit filename="Observer.cxx" />
-               <Unit filename="Observer.h" />
-               <Unit filename="Subject.cxx" />
-               <Unit filename="Subject.h" />
-               <Unit filename="View.cxx" />
-               <Unit filename="View.h" />
-               <Unit filename="ViewFluid.cxx" />
-               <Unit filename="ViewFluid.fld" />
-               <Unit filename="ViewFluid.h" />
-               <Unit filename="main.cxx" />
-               <Extensions>
-                       <envvars />
-                       <code_completion />
-                       <debugger />
-                       <lib_finder disable_auto="1" />
-                       <DoxyBlocks>
-                               <comment_style block="5" line="0" />
-                               <doxyfile_project />
-                               <doxyfile_build />
-                               <doxyfile_warnings />
-                               <doxyfile_output />
-                               <doxyfile_dot />
-                               <general />
-                       </DoxyBlocks>
-               </Extensions>
-       </Project>
-</CodeBlocks_project_file>
diff --git a/_template/src/main.rc b/_template/src/main.rc
new file mode 100644 (file)
index 0000000..805562e
--- /dev/null
@@ -0,0 +1,29 @@
+101 ICON DISCARDABLE "./Icon.ico"
+1 VERSIONINFO
+FILEVERSION     1,0,0,0
+PRODUCTVERSION  1,0,0,0
+FILEFLAGSMASK   0X3FL
+FILEFLAGS       0L
+FILEOS          0X40004L
+FILETYPE        0X1
+FILESUBTYPE     0
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904B0"
+        BEGIN
+           VALUE "CompanyName", "Daniel Giritzer"
+            VALUE "FileDescription", "_template"
+            VALUE "FileVersion", "1.0.0.0"
+            VALUE "InternalName", "_template"
+            VALUE "LegalCopyright", "(c) Daniel Giritzer"
+            VALUE "OriginalFilename", "_template.exe"
+            VALUE "ProductName", "_template"
+           VALUE "ProductVersion", "1.0.0.0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+            VALUE "Translation", 0x0409, 0x04B0
+    END
+END
\ No newline at end of file
diff --git a/_template/src/start__template b/_template/src/start__template
new file mode 100755 (executable)
index 0000000..ebe62d6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+DIR=$(pwd)
+export PATH=$DIR/bin:$PATH
+#export LD_LIBRARY_PATH=$DIR/lib
+_template
+# comment line above, LD_LIBRARY_PATH and uncomment next line to use libs shipped with this package
+#$LD_LIBRARY_PATH/ld-linux.so.2 --library-path $LD_LIBRARY_PATH $DIR/bin/_template
\ No newline at end of file
diff --git a/_template/src/start__template.desktop b/_template/src/start__template.desktop
new file mode 100644 (file)
index 0000000..5058d39
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=_template
+Comment=_template Application
+TryExec=start__template
+Exec=start__template %F
+Icon=Icon
+MimeType=image/x-foo;
\ No newline at end of file