Gtk3: Difference between revisions

From Pfsc-wiki
Jump to navigation Jump to search
Line 161: Line 161:
[[File:calc.png|200px|thumb|Calc]]
[[File:calc.png|200px|thumb|Calc]]


A calculator that allows you to write your calculation 3 + 4 * 5 and press [Cntl] [Enter] to see the result. Also supports variables e.g. a = 3 + 4 * 5, and cares about your locale settings.  
A calculator that allows you to write your calculation 3 + 4 * 5 and press [Cntl] [Enter] to see the result. Also supports variables e.g. a = 3 + 4 * 5.  


[[Media:CalcSrc.zip]] (vala source, automake project, shoud work with  
[[Media:CalcSrc.zip]] (vala source, automake project, shoud work with  
Line 169: Line 169:


[[Media:Calcpp.zip]] (c++ 11 source, automake project, dependency: Gtkmm, Glibmm, libunistring ) if you want to compare vala <-> c++, vala offers the best support for gtk and glib, where c++ allows easy integration for c/c++ libs. By the way this also gives a example of some gtkmm programming (but still a bit more advanced as the documentation examples) e.g. custom components, setting binding, signal lambda funtions...  
[[Media:Calcpp.zip]] (c++ 11 source, automake project, dependency: Gtkmm, Glibmm, libunistring ) if you want to compare vala <-> c++, vala offers the best support for gtk and glib, where c++ allows easy integration for c/c++ libs. By the way this also gives a example of some gtkmm programming (but still a bit more advanced as the documentation examples) e.g. custom components, setting binding, signal lambda funtions...  
It cares about your locale settings, so with a e.g. german locale you write 3,14 * r ^ 2 (sorry separators are not supported).


&copy; The parsing part was inspired by the shunting yard algorithm by E.W.Dijkstra
&copy; The parsing part was inspired by the shunting yard algorithm by E.W.Dijkstra


== Local docs ==
== Local docs ==

Revision as of 13:25, 10 September 2022

Java projects

Some project are build with java:

Java

Gtk3

fractale generator

Julia fractale

Example of a mandelbrot and julia generator:

Media:Fract.zip (C++ source, automake project, shoud work on any linux system dependencies: gtkmm3, glibmm2, gthreads )

build & run for Debian/Ubuntu

apt-get install build-essential libgtkmm-3.0-dev
cd fract-program-0.1
((do "autoreconf -i" if needed))
./configure
make
./fract

if you like to keep it

# make install

build for windows

Install msys2 for gtkmm,...

Also useful infos: Msys2.

In netbeans change build host to localhost (Win), Tools Mingw

GenericGlm

Basic OpenGL function lib, using Gtk::GlArea including antialiased display, text display...

Media:Genericglm.zip (C++ source, autotools, shoud work on any linux system dependencies: gtkmm3, glibmm2, fontconfig, freetype, epoxy, glu, glm )

build & run for Debian/Ubuntu

Additional to the above:

# apt-get install libglm-dev libglu1-mesa-dev

The glm includes may require tweaking depending on version:

 glm/ext/matrix_transform.hpp ->  glm/gtc/matrix_transform.hpp

build for windows

Additional to the above:

Add glm : pacman -S mingw-w64-x86_64-glm

./configure --disable-shared

The file will be linked statically

GLglobe

Glglobe

Example of a fancy desktop clock with world time (depending on linux zoneinfo)

Media:Glglobe.zip (C++ source, autotools project, shoud work on any linux system dependencies: gtkmm3, glibmm2, GenericGlm)

© Textures Solarsystemscope.com

build & run for Debian/Ubuntu

As above.

build for windows

As above

Change in res/Makefile.am pkgconf to pkg-config

Add to glglobe_LDFLAGS -lglu32

Not working: Linking not working with Msys2, correct timzone time display

build for MacOS

Use Macports or alike...

Or this port with limited functions File:OSXglobe.zip as XCode-project.

Monglmm

Monglmm

Some kind of different system monitor (load, memory, network, disk, clock) for linux, delegates most display work to graphis-card.

Media:Monglmm.zip (C++ source, autotools project, shoud work on any linux system (with user accessible /proc) dependencies : gtkmm3, glibmm2, GenericGlm )(for g15 functions use ./configure --with-libg15 requires libusb, usb-compat)(for hardware sensors use --with-lmsensors requires lmsensors, use --with-raspi for additional Raspberry sensors)

© g15-function Sourceforge g15tools

build & run for Debian/Ubuntu

Additional to the above (if the #include "filesystem" causes trouble remove it):

apt-get install libusb-dev


Granting g15 usb permission

Add rules to /etc/udev/rules.d (needs activating, by rule reload or restart):

SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c626",
    ACTION=="add", GROUP="usbdev", MODE="0664"
SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c227",
    ACTION=="add", GROUP="usbdev", MODE="0664"

Add user to usbdev group:

usermod your_users -a -G usbdev

Logic

If you own a Raspi4 and intrested in Hardware development you sometimes need some insight what is happening in electrical terms with some speed. So here comes a tool that helps you discover these mysteries:

Logic

Example connect a switch to Gpio 4 (Raspi 40 pin header pin 7 Gpio pinout) and Ground (pin 9). With the program you now choose the Trigger 4 and "Single" (capture) and activate the switch. In a moment you see that a switch is not just on or off but usually bounces back and forth some times.

Logic 2

"Logic 2" is a example of a Spi communication.

Media:LogicSrc.zip (C++ source, netbeans project, shoud work on any raspi dependencies: gtkmm3, glibmm2)

© bcm2835-lib mikem/bcm2835

build & run for Raspian

sudo apt-get install libgtkmm-3.0
cd Logic
make

Preperation:

The preparation steps that are presented when you first start the program are required! You shoud add

dtoverlay=gpio-no-irq

to /boot/config.txt and reboot (without this setup the program will not use triggers or without reboot your pi will hang!). The next udev setup is included in Raspian buster by default. If you run this program as root the setup-assistant might help.

To run use:

dist/Debug/GNU-Linux/logic

If you want to keep it:

sudo make install

Calculator

Calc

A calculator that allows you to write your calculation 3 + 4 * 5 and press [Cntl] [Enter] to see the result. Also supports variables e.g. a = 3 + 4 * 5.

Media:CalcSrc.zip (vala source, automake project, shoud work with

./configure --prefix=/usr 
make

on any *ix, dependencies: gtk+3, libgee)

Media:Calcpp.zip (c++ 11 source, automake project, dependency: Gtkmm, Glibmm, libunistring ) if you want to compare vala <-> c++, vala offers the best support for gtk and glib, where c++ allows easy integration for c/c++ libs. By the way this also gives a example of some gtkmm programming (but still a bit more advanced as the documentation examples) e.g. custom components, setting binding, signal lambda funtions... It cares about your locale settings, so with a e.g. german locale you write 3,14 * r ^ 2 (sorry separators are not supported).

© The parsing part was inspired by the shunting yard algorithm by E.W.Dijkstra

Local docs

[file:///usr/share/gtk-doc/html/gtk3/gtk.html]

Gtk glibmm codegen

glibmm codegen

pacman -S python-pip
pip install Jinja2