Giter Site home page Giter Site logo

nana's People

Contributors

5cript avatar alexkaratarakis avatar beru avatar besh81 avatar call-me-void avatar cnjinhao avatar dankan1890 avatar dnso86 avatar dudztroyer avatar errorflynn avatar htzh avatar jamesbremner avatar jannlee avatar kmribti avatar leobackes avatar lilywangl avatar mihaizh avatar nabijaczleweli avatar peteraddy960 avatar pr0curo avatar qpcr4vir avatar qqiangwu avatar ramblingmadman avatar rbrugo avatar red-portal avatar refi64 avatar roberthauck avatar shamari91 avatar unitrunker avatar xeverous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nana's Issues

make more "std::"

container - like objects:
back() and front() for menu & item_proxy & menu_bar, tabbar, combox, listbox & cat_proxy,

refactor all API to use or mimic std , extensions or proposed libraries:
std::filesystem, chrono, 2D drawing, regex, codecvt_utf, atomic, thread, iterator, optional, any
see feature test macros

Cannot build RC v1.73 with clang-6.0 [Ubuntu 18.04]

rm -rf ReleaseClang && cmake -BReleaseClang -DCMAKE_BUILD_TYPE=Release -GNinja -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ && cmake --build ReleaseClang

-- The CXX compiler identification is Clang 6.0.0
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
You are using nana directly from original sources. (Recommended!) If this was not your intention, and what you want is to install precomplied nana first, then please tern ON option NANA_CMAKE_INSTALL 
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.8.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.12.6
-- Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so  
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Looking for C++ include filesystem
-- Looking for C++ include filesystem - found
-- Looking for C++ include experimental/filesystem
-- Looking for C++ include experimental/filesystem - found
-- C++ Filesystem header:      
-- Performing Test CXX17_BUILTIN
-- Performing Test CXX17_BUILTIN - Failed
-- Performing Test CXX17_FLAG
-- Performing Test CXX17_FLAG - Success
-- C++ Standard-17 support:    via -std=c++17
-- Performing Test C++17FS_FLAG
-- Performing Test C++17FS_FLAG - Success
-- C++ Filesystem library:     builtin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ppetraki/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3/ReleaseClang
[7/80] Building CXX object CMakeFiles/nana.dir/source/charset.cpp.o
../source/charset.cpp:1130:14: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
                                        data_ = std::move(str());
                                                ^
../source/charset.cpp:1130:14: note: remove std::move call here
                                        data_ = std::move(str());
                                                ^~~~~~~~~~     ~
../source/charset.cpp:1240:23: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
                                wdata_for_move_ = std::move(wstr());
                                                  ^
../source/charset.cpp:1240:23: note: remove std::move call here
                                wdata_for_move_ = std::move(wstr());
                                                  ^~~~~~~~~~      ~
../source/charset.cpp:1277:22: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
                                data_for_move_ = std::move(str());
                                                 ^
../source/charset.cpp:1277:22: note: remove std::move call here
                                data_for_move_ = std::move(str());
                                                 ^~~~~~~~~~     ~
3 warnings generated.
[23/80] Building CXX object CMakeFiles/nana.dir/source/gui/filebox.cpp.o
FAILED: CMakeFiles/nana.dir/source/gui/filebox.cpp.o 
/usr/bin/clang++  -DNANA_IGNORE_CONF -I../include -isystem /usr/include/freetype2 -O3 -march=native -mtune=native -DNDEBUG   -Wall -pthread -std=gnu++17 -MD -MT CMakeFiles/nana.dir/source/gui/filebox.cpp.o -MF CMakeFiles/nana.dir/source/gui/filebox.cpp.o.d -o CMakeFiles/nana.dir/source/gui/filebox.cpp.o -c ../source/gui/filebox.cpp
../source/gui/filebox.cpp:1604:37: error: no member named 'weakly_canonical' in namespace 'std::filesystem'
                : impl_(new implement{ owner, fs::weakly_canonical(init_path).make_preferred(), title, false})
                                              ~~~~^
1 error generated.
[32/80] Building CXX object CMakeFiles/nana.dir/source/gui/place.cpp.o
ninja: build stopped: subcommand failed.


Introduce command to share with menu, toolbar, button and checkbox

  • menu vs. toolbar:
    toolbar is a widget, menu - not.
    • menu: hold a plain ptr to an implement which use structures in a drawerbase::menu namespace.
      The later includes a menu_type, menu_item_type, and the enum checks,
			enum class checks
			{
				none,
				option,
				highlight
			};

menu_item_type hold a plain pointer to a menu_type and all the state-data of the item which can be acceded with an item_proxy which hold a pointer to the menu and the position order of the item.
A new item can be added with menu::append or menu::insert.

			enum class tools
			{
				separator,
				button,
				toggle,
				dropdown
			};
  • toolbar: the drawer hold a plain pointer to a drawer_impl_type that hold an item_container of toolbar_items. The later hold the state-data.
    A new item can be added with toolbar::append or with item_proxy::dropdown_append.

  • Implement/use checks/tools

  • create command: a no-widget class, wich state-data useful to set and to share menu, toolbar, button and checkbox

    • title/text, tooltip/status
    • event handler
    • image (a shared type),
    • set/get image
    • checks style
    • flags: enabled, checked
  • Make menu and toolbar API similar:

    • prefer item_proxy

In menu:

  • no struct arg_menu ?
  • menu::append(shared_command)
  • menu::insert(shared_command) .
  • in menu_type
  • in menu_item_type <---- real data here (generalize?)
    • hold a shared_command
    • add constructor that take a shared_command
    • set/get shared_command (to be used by other constructors)
    • really need 'linked'?
  • add to item_proxy
    • set/get shared_command (to be used by other constructors)
    • set/get image
    • answerer()
  • reuse renderer_interface?
    In toolbar:
  • dropdown_item construct take a menu?

posible optimization in very big listbox

I may have listbox with more than 100 000 items, and I need to sort.
The sort function come in two versions: for text only and for the atached any.objects only. If the second exist for the given header (column) to sort it have preference to be used.
Also, it could be a ref to an array or vector with the actual data, and indexed by the any object or better simple by the index of the item. The real items or item proxys are created only on demand, on the fly, need to be draw, but not when only need to be ordered. To draw we need maximal 20 to 100 items, not more: it is not to much and is not going to be very slow. Drawed items could be conserverd until it go out of the screen.

RC v1.73 fails to build on Ubuntu 18.04 in Debug and Release mode

ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake --version | head -n1
cmake version 3.16.0

ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ c++ --version
c++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Debug mode

ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake -BDebug -DCMAKE_BUILD_TYPE=Debug -GNinja
-- The CXX compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
You are using nana directly from original sources. (Recommended!) If this was not your intention, and what you want is to install precomplied nana first, then please tern ON option NANA_CMAKE_INSTALL 
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.8.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.12.6
-- Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so  
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Looking for C++ include filesystem
-- Looking for C++ include filesystem - not found
-- Looking for C++ include experimental/filesystem
-- Looking for C++ include experimental/filesystem - found
-- C++ Filesystem header:      
-- Performing Test CXX17_BUILTIN
-- Performing Test CXX17_BUILTIN - Failed
-- Performing Test CXX17_FLAG
-- Performing Test CXX17_FLAG - Success
-- C++ Standard-17 support:    via -std=c++17
-- Performing Test C++17FS_FLAG
-- Performing Test C++17FS_FLAG - Success
-- C++ Filesystem library:     builtin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ppetraki/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3/Debug
ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake --build Debug
[7/80] Building CXX object CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o
FAILED: CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o 
/usr/bin/c++  -DNANA_IGNORE_CONF -I../include -isystem /usr/include/freetype2 -g   -Wall -fmax-errors=3 -pthread -std=gnu++1z -MD -MT CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -MF CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o.d -o CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -c ../source/filesystem/filesystem.cpp
../source/filesystem/filesystem.cpp:1600:39: error: ‘path’ does not name a type; did you mean ‘putw’?
     bool try_throw(int err_val, const path& p, std::error_code* ec, const char* message)
                                       ^~~~
                                       putw
../source/filesystem/filesystem.cpp: In function ‘bool detail::try_throw(int, const int&, std::error_code*, const char*)’:
../source/filesystem/filesystem.cpp:1611:29: error: ‘generic_category’ was not declared in this scope
         error_code(err_val, generic_category())));
                             ^~~~~~~~~~~~~~~~
../source/filesystem/filesystem.cpp:1611:29: note: suggested alternatives:
In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0,
                 from /usr/include/c++/7/experimental/filesystem:36,
                 from ../include/nana/filesystem/filesystem.hpp:112,
                 from ../include/nana/filesystem/filesystem_ext.hpp:18,
                 from ../source/filesystem/filesystem.cpp:14:
/usr/include/c++/7/system_error:135:40: note:   ‘std::_V2::generic_category’
   _GLIBCXX_CONST const error_category& generic_category() noexcept;
                                        ^~~~~~~~~~~~~~~~
/usr/include/c++/7/system_error:135:40: note:   ‘std::_V2::generic_category’
../source/filesystem/filesystem.cpp:1611:9: error: ‘error_code’ was not declared in this scope
         error_code(err_val, generic_category())));
         ^~~~~~~~~~
../source/filesystem/filesystem.cpp:1611:9: note: suggested alternative:
In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0,
                 from /usr/include/c++/7/experimental/filesystem:36,
                 from ../include/nana/filesystem/filesystem.hpp:112,
                 from ../include/nana/filesystem/filesystem_ext.hpp:18,
                 from ../source/filesystem/filesystem.cpp:14:
/usr/include/c++/7/system_error:146:10: note:   ‘std::error_code’
   struct error_code
          ^~~~~~~~~~
compilation terminated due to -fmax-errors=3.
[16/80] Building CXX object CMakeFiles/nana.dir/source/gui/dragdrop.cpp.o
ninja: build stopped: subcommand failed.


Release mode

ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake -BRelease -DCMAKE_BUILD_TYPE=Release -GNinja && cmake --build Release
-- The CXX compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
You are using nana directly from original sources. (Recommended!) If this was not your intention, and what you want is to install precomplied nana first, then please tern ON option NANA_CMAKE_INSTALL 
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.8.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.12.6
-- Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so  
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Looking for C++ include filesystem
-- Looking for C++ include filesystem - not found
-- Looking for C++ include experimental/filesystem
-- Looking for C++ include experimental/filesystem - found
-- C++ Filesystem header:      
-- Performing Test CXX17_BUILTIN
-- Performing Test CXX17_BUILTIN - Failed
-- Performing Test CXX17_FLAG
-- Performing Test CXX17_FLAG - Success
-- C++ Standard-17 support:    via -std=c++17
-- Performing Test C++17FS_FLAG
-- Performing Test C++17FS_FLAG - Success
-- C++ Filesystem library:     builtin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ppetraki/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3/Release
[4/80] Building CXX object CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o
FAILED: CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o 
/usr/bin/c++  -DNANA_IGNORE_CONF -I../include -isystem /usr/include/freetype2 -O3 -march=native -mtune=native -DNDEBUG   -Wall -fmax-errors=3 -pthread -std=gnu++1z -MD -MT CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -MF CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o.d -o CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -c ../source/filesystem/filesystem.cpp
../source/filesystem/filesystem.cpp:1600:39: error: ‘path’ does not name a type; did you mean ‘putw’?
     bool try_throw(int err_val, const path& p, std::error_code* ec, const char* message)
                                       ^~~~
                                       putw
../source/filesystem/filesystem.cpp: In function ‘bool detail::try_throw(int, const int&, std::error_code*, const char*)’:
../source/filesystem/filesystem.cpp:1611:29: error: ‘generic_category’ was not declared in this scope
         error_code(err_val, generic_category())));
                             ^~~~~~~~~~~~~~~~
../source/filesystem/filesystem.cpp:1611:29: note: suggested alternatives:
In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0,
                 from /usr/include/c++/7/experimental/filesystem:36,
                 from ../include/nana/filesystem/filesystem.hpp:112,
                 from ../include/nana/filesystem/filesystem_ext.hpp:18,
                 from ../source/filesystem/filesystem.cpp:14:
/usr/include/c++/7/system_error:135:40: note:   ‘std::_V2::generic_category’
   _GLIBCXX_CONST const error_category& generic_category() noexcept;
                                        ^~~~~~~~~~~~~~~~
/usr/include/c++/7/system_error:135:40: note:   ‘std::_V2::generic_category’
../source/filesystem/filesystem.cpp:1611:9: error: ‘error_code’ was not declared in this scope
         error_code(err_val, generic_category())));
         ^~~~~~~~~~
../source/filesystem/filesystem.cpp:1611:9: note: suggested alternative:
In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0,
                 from /usr/include/c++/7/experimental/filesystem:36,
                 from ../include/nana/filesystem/filesystem.hpp:112,
                 from ../include/nana/filesystem/filesystem_ext.hpp:18,
                 from ../source/filesystem/filesystem.cpp:14:
/usr/include/c++/7/system_error:146:10: note:   ‘std::error_code’
   struct error_code
          ^~~~~~~~~~
compilation terminated due to -fmax-errors=3.
[13/80] Building CXX object CMakeFiles/nana.dir/source/detail/platform_spec_posix.cpp.o
ninja: build stopped: subcommand failed.

a set of static color scheme to initialize and actualize all scheme

the idea is like this: (need more work! ... I´m not sure how...)

// in namespace nana
    struct widget_colors
    {
        virtual ~widget_colors() = default;
        widget_colors(){}
        widget_colors(color_proxy ac,  color_proxy bg , color_proxy fg):
                      activated(ac), background(bg), foreground(fg){}

        color_proxy activated   {def.activated };
        color_proxy background  {def.background};
        color_proxy foreground  {def.background};

        static widget_colors def; 
    };
// in cpp
    widget_colors widget_colors::def  {color_proxy(static_cast<color_rgb>(0x60C8FD)), 
                                       color_proxy(colors::button_face), 
                                       color_proxy(colors::black)}; 

template<typename Category, typename DrawerTrigger, typename Events = general_events, typename Scheme = widget_colors>
 class nana::widget_object< Category, DrawerTrigger, Events, Scheme >
{
     //...
    using  scheme_type = Scheme ;
    static  scheme_type  def_scheme{};
    scheme_type &  scheme () const  ;  // const ?
    widget_object()  : events_{ std::make_shared<Events>() } {  }
private:
    std::unique_ptr<Scheme> scheme_{ API::dev::make_scheme<Scheme>(def_scheme) }

 //...
};
//...
listbox::scheme_type scheme_type():widget_colors(widget::def_widget_colors){/* ... */}}
//...
widget_colors::def.background=colors::aqua;
form::def_scheme.activate=colors::red; // for all class and object derived from form
form myForm1, myForm2;  // bg will aqua, activate red

And then to have a way of switch the entery application from one "style" to other

string place::div() to retrive last div string

Related to that:
conserve beging and end for each field (in the div string), and have a function that return it and another that return the rectangle of a field based on the position in the string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.