Skip to content

Commit

Permalink
Drag CanvasItems working
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip-Scott committed Oct 21, 2018
0 parents commit cd742bf
Show file tree
Hide file tree
Showing 14 changed files with 1,515 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
*~
docs
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div>
<h1 align="center">Canvas Demo</h1>
<h3 align="center">Testing and Developing the new Canvas Tech for Akira and Spice-Up</h3>
</div>

<br/>

## Generate Docs

```
valadoc -o docs goocanvas-2.0.vapi --pkg gio-2.0 --pkg gtk+-3.0 --pkg goocanvas-2.0 --force
```

## Build the App

Run `meson build` to configure the build environment and then change to the build directory and run `ninja` to build

meson build --prefix=/usr
cd build
ninja

To install, use `ninja install`, then execute with `com.github.philip-scott.canvas-demo`

sudo ninja install
com.github.philip-scott.canvas-demo
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
com.github.philip-scott.wallpaperize (0.1) UNSTABLE; urgency=low

* Initial release

-- Felipe Escoto <felescoto95@hotmail.com> Wed, 7 Jun 2017 04:52:12 -0600
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
16 changes: 16 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Source: com.github.philip-scott.wallpaperize
Section: x11
Priority: extra
Maintainer: Felipe Escoto <felescoto95@hotmail.com>
Build-Depends: debhelper (>= 9),
libgtk-3-dev,
valac (>= 0.26),
libgranite-dev,
meson

Standards-Version: 3.9.3
Package: com.github.philip-scott.wallpaperize
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Beautify your oddly-sized wallpapers
Turn your oddly sized wallpapers into a piece of beauty
25 changes: 25 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: cmake-hello-world
Source: https://github.com/Philip-Scott/wallpaperize

Files: *
Copyright: 2017 Felipe Escoto <felescoto95@hotmail.com>
License: GPL-3.0+

License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

29 changes: 29 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
dh $@

override_dh_auto_clean:
rm -rf debian/build

override_dh_auto_configure:
mkdir -p debian/build
cd debian/build && meson --prefix=/usr ../..

override_dh_auto_build:
cd debian/build && ninja -v

override_dh_auto_test:
cd debian/build && ninja test

override_dh_auto_install:
cd debian/build && DESTDIR=${CURDIR}/debian/com.github.philip-scott.wallpaperize ninja install
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
39 changes: 39 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
project('com.github.philip-scott.canvas-demo', ['vala', 'c'],
version: '0.2.0'
)

gnome = import('gnome')
i18n = import('i18n')

conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')

add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')],
language: 'vala')


c_args = [
'-include', 'config.h',
]

executable(
'com.github.philip-scott.canvas-demo',
'src/Application.vala',
'src/Window.vala',
'src/ResponsiveCanvas.vala',
c_args: c_args,
dependencies: [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('gtk+-3.0'),
dependency('granite'),
dependency('libsoup-2.4'),
dependency('libsecret-1'),
dependency('goocanvas-2.0'),
],
install : true
)

meson.add_install_script('meson/post_install.py')
10 changes: 10 additions & 0 deletions meson/post_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

import os
import subprocess

schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')

if not os.environ.get('DESTDIR'):
print('Compiling gsettings schemas...')
subprocess.call(['glib-compile-schemas', schemadir])
92 changes: 92 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright (c) 2018 Felipe Escoto (https://github.com/Philip-Scott)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authored by: Felipe Escoto <felescoto95@hotmail.com>
*/

public class Phi.Application : Granite.Application {
public const string PROGRAM_ID = "com.github.philip-scott.canvas-demo";
public const string PROGRAM_NAME = "CanvasDemo";

construct {
flags |= ApplicationFlags.HANDLES_OPEN;

application_id = PROGRAM_ID;
program_name = PROGRAM_NAME;
exec_name = PROGRAM_ID;
app_launcher = PROGRAM_ID;

build_version = "1.0.0";
}

public static Gtk.Window? window = null;
public static Gtk.Grid grid;

Goo.Canvas canvas;
bool set_color = false;

public override void activate () {
var window = new Gtk.Window ();
this.add_window (window);

canvas = new Phi.ResponsiveCanvas ();
canvas.set_size_request (600, 600);
canvas.set_scale (2.0);
canvas.set_bounds (0, 0, 10000, 10000);

var root = canvas.get_root_item ();

var rect_item = Goo.CanvasRect.create (root, 100, 100, 400, 400,
"line-width", 5.0,
"radius-x", 100.0,
"radius-y", 100.0,
"stroke-color", "#f37329",
"fill-color", "#ffa154");

rect_item = Goo.CanvasRect.create (root, 50, 100, 200, 100,
"line-width", 5.0,
"stroke-color", "#64baff",
"fill-color", "#3689e6");

rect_item = Goo.CanvasRect.create (root, 0, 0, 64, 64,
"radius-x", 32.0,
"radius-y", 32.0,
"line-width", 5.0,
"stroke-color", "#9bdb4d",
"fill-color", "#68b723");

window.add (canvas);
window.show_all ();

window.show ();
}

public static int main (string[] args) {
/* Initiliaze gettext support */
Intl.setlocale (LocaleCategory.MESSAGES, Intl.get_language_names ()[0]);
Intl.setlocale (LocaleCategory.NUMERIC, "en_US");
//Intl.textdomain (Config.GETTEXT_PACKAGE);

Environment.set_application_name (PROGRAM_NAME);
Environment.set_prgname (PROGRAM_NAME);

var application = new Phi.Application ();

return application.run (args);
}
}
Loading

0 comments on commit cd742bf

Please sign in to comment.