Skip to content

Commit

Permalink
New headerbar (#108)
Browse files Browse the repository at this point in the history
* Updated License to GPLv3. Fixes #65

* Simplify headerbar complexity, allow users to switch between regular and symbolic icons

* Margin and valignment fixes

* Remove unused settings schema

* Add Zoom widget to headerbar

* Add headerbar css and zoom button padding

* Style and label for zoom grid

* Remove extra margins for headerbar buttons. Add zoom actions and accelerators

* Add all remaining buttons

* Heeaderbar button style completed

* Fix stylesheet.css location after rebase from master

* Remove Pages file because it is useless and we should not have empty files as placeholders

* Fixed indentation

* Fixed indentation

* Fix "labelled" typo becuase English is hard

* Revert canvas to previous commit to avoid UI breaking
  • Loading branch information
Alecaddd committed Mar 5, 2019
1 parent 4c5d6f1 commit 9ba0116
Show file tree
Hide file tree
Showing 33 changed files with 1,409 additions and 975 deletions.
1 change: 1 addition & 0 deletions data/assets.gresource.xml
Expand Up @@ -5,6 +5,7 @@
<file alias="layout.css" compressed="true">css/layout.css</file>
<file alias="artboard.css" compressed="true">css/artboard.css</file>
<file alias="layer.css" compressed="true">css/layer.css</file>
<file alias="headerbar.css" compressed="true">css/headerbar.css</file>
</gresource>
<gresource prefix="/com/github/akiraux/akira">
<file alias="stylesheet.css" compressed="true">stylesheet.css</file>
Expand Down
15 changes: 15 additions & 0 deletions data/css/headerbar.css
@@ -0,0 +1,15 @@
.headerbar-label {
font-size: 8pt;
}

/* headerbar separator {
margin-left: 0px;
} */

.button-zoom {
padding: 0 6px;
}

.linked-flat button {
background-color: shade (@bg_color, 1);
}
10 changes: 0 additions & 10 deletions data/css/layout.css
Expand Up @@ -14,16 +14,6 @@
border-left: 1px solid shade (@bg_color, 0.9);
}

/* .headerbar-button {
padding-left: 12px;
padding-right: 12px;
background-image: linear-gradient(to top, alpha (@bg_color, 0.3), alpha (@bg_color, 0.9));
} */

.headerbar-label {
font-size: 8pt;
}

.border-bottom {
border-bottom: 1px solid shade (@bg_color, 0.8);
}
8 changes: 1 addition & 7 deletions data/schemas/com.github.akiraux.akira.gschema.xml
Expand Up @@ -49,17 +49,11 @@
</key>

<key name="use-symbolic" type="b">
<default>true</default>
<default>false</default>
<summary>Use Symbolic Icons</summary>
<description>Allow user to choose between normal and symbolic icons in HeaderBar.</description>
</key>

<key name="icon-style" type="s">
<default>"filled"</default>
<summary>HeaderBar Icon Style</summary>
<description>Allow user to change the style/theme of icons in HeaderBar.</description>
</key>

<key name="open-quick" type="b">
<default>false</default>
<summary>Auto Reopen latest file</summary>
Expand Down
1 change: 1 addition & 0 deletions data/stylesheet.css
Expand Up @@ -2,4 +2,5 @@
@import url("css/variables.css");
@import url("css/layout.css");
@import url("css/artboard.css");
@import url("css/headerbar.css");
@import url("css/layer.css");
3 changes: 3 additions & 0 deletions meson.build
Expand Up @@ -25,6 +25,9 @@ asresources = gnome.compile_resources(
c_name: 'as'
)

cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required: true)

# Set our translation domain
add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language:'c')

Expand Down
26 changes: 13 additions & 13 deletions src/Application.vala
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2018 Alecaddd (http://alecaddd.com)
* Copyright (c) 2019 Alecaddd (http://alecaddd.com)
*
* 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 file is part of Akira.
*
* This program is distributed in the hope that it will be useful,
* Akira 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.
* Akira 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* 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 Akira. If not, see <https://www.gnu.org/licenses/>.
*
* Authored by: Alessandro "Alecaddd" Castellani <castellani.ale@gmail.com>
*/
Expand Down
137 changes: 80 additions & 57 deletions src/Layouts/HeaderBar.vala
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2018 Alecaddd (http://alecaddd.com)
* Copyright (c) 2019 Alecaddd (http://alecaddd.com)
*
* 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 file is part of Akira.
*
* This program is distributed in the hope that it will be useful,
* Akira 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.
* Akira 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* 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 Akira. If not, see <https://www.gnu.org/licenses/>.
*
* Authored by: Alessandro "Alecaddd" Castellani <castellani.ale@gmail.com>
*/
Expand All @@ -28,10 +28,20 @@ public class Akira.Layouts.HeaderBar : Gtk.HeaderBar {

public Akira.Partials.MenuButton menu;
public Akira.Partials.MenuButton toolset;
public Akira.Partials.ZoomButton zoom;
public Akira.Partials.HeaderBarButton group;
public Akira.Partials.HeaderBarButton ungroup;
public Akira.Partials.HeaderBarButton move_up;
public Akira.Partials.HeaderBarButton move_down;
public Akira.Partials.HeaderBarButton move_top;
public Akira.Partials.HeaderBarButton move_bottom;
public Akira.Partials.HeaderBarButton preferences;
public Akira.Partials.HeaderBarButton export;
public Akira.Partials.HeaderBarButton layout;
public Akira.Partials.HeaderBarButton grid;
public Akira.Partials.HeaderBarButton pixel_grid;
public Akira.Partials.HeaderBarButton path_difference;
public Akira.Partials.HeaderBarButton path_exclusion;
public Akira.Partials.HeaderBarButton path_intersect;
public Akira.Partials.HeaderBarButton path_union;

public bool toggled {
get {
Expand All @@ -50,9 +60,8 @@ public class Akira.Layouts.HeaderBar : Gtk.HeaderBar {
}

construct {
set_title (APP_NAME);
// set_title (APP_NAME);
set_show_close_button (true);
get_style_context ().add_class ("default-decoration");

var menu_items = new Gtk.Menu ();

Expand Down Expand Up @@ -81,8 +90,8 @@ public class Akira.Layouts.HeaderBar : Gtk.HeaderBar {

menu_items.show_all ();

menu = new Akira.Partials.MenuButton ("document-open", _("Menu"), _("Open Menu"));
menu.popup = menu_items;
menu = new Akira.Partials.MenuButton ("document-open", _("Menu"), null);
menu.button.popup = menu_items;

var tools = new Gtk.Menu ();
tools.add (new Gtk.MenuItem.with_label(_("Artboard")));
Expand All @@ -95,48 +104,52 @@ public class Akira.Layouts.HeaderBar : Gtk.HeaderBar {
tools.add (new Gtk.MenuItem.with_label(_("Image")));
tools.show_all ();

toolset = new Akira.Partials.MenuButton ("insert-object", _("Insert"), _("Insert a New Object"));
toolset.popup = tools;
toolset = new Akira.Partials.MenuButton ("insert-object", _("Insert"), null);
toolset.button.popup = tools;

var application_instance = (Gtk.Application) GLib.Application.get_default ();
zoom = new Akira.Partials.ZoomButton (window);

preferences = new Akira.Partials.HeaderBarButton ("system-settings-%s".printf (settings.icon_style), _("Settings"));
preferences.button.action_name = Akira.Services.ActionManager.ACTION_PREFIX + Akira.Services.ActionManager.ACTION_PREFERENCES;
preferences.tooltip_markup = Granite.markup_accel_tooltip (
application_instance.get_accels_for_action (preferences.button.action_name),
_("Open Settings")
);
group = new Akira.Partials.HeaderBarButton ("object-group", _("Group"), {"<Ctrl>g"});
ungroup = new Akira.Partials.HeaderBarButton ("object-ungroup", _("Ungroup"), {"<Ctrl><Shift>g"});

layout = new Akira.Partials.HeaderBarButton ("layout-panels-%s".printf (settings.icon_style), _("Layout"));
layout.button.action_name = Akira.Services.ActionManager.ACTION_PREFIX + Akira.Services.ActionManager.ACTION_PRESENTATION;
layout.tooltip_markup = Granite.markup_accel_tooltip (
application_instance.get_accels_for_action (layout.button.action_name),
_("Toggle Layout")
);
move_up = new Akira.Partials.HeaderBarButton ("selection-raise", _("Up"), {"<Ctrl>Up"});
move_down = new Akira.Partials.HeaderBarButton ("selection-lower", _("Down"), {"<Ctrl>Down"});
move_top = new Akira.Partials.HeaderBarButton ("selection-top", _("Top"), {"<Ctrl><Shift>Up"});
move_bottom = new Akira.Partials.HeaderBarButton ("selection-bottom", _("Bottom"), {"<Ctrl><Shift>Down"});

grid = new Akira.Partials.HeaderBarButton ("layout-grid-%s".printf (settings.icon_style), _("UI Grid"));
grid.button.action_name = Akira.Services.ActionManager.ACTION_PREFIX + Akira.Services.ActionManager.ACTION_SHOW_UI_GRID;
grid.tooltip_markup = Granite.markup_accel_tooltip (
application_instance.get_accels_for_action (grid.button.action_name),
_("UI Grid")
);
preferences = new Akira.Partials.HeaderBarButton ("open-menu", _("Settings"), {"<Ctrl>comma"});
preferences.button.action_name = Akira.Services.ActionManager.ACTION_PREFIX + Akira.Services.ActionManager.ACTION_PREFERENCES;

pixel_grid = new Akira.Partials.HeaderBarButton ("layout-pixels-%s".printf (settings.icon_style), _("Pixel Grid"));
pixel_grid.button.action_name = Akira.Services.ActionManager.ACTION_PREFIX + Akira.Services.ActionManager.ACTION_SHOW_PIXEL_GRID;
pixel_grid.tooltip_markup = Granite.markup_accel_tooltip (
application_instance.get_accels_for_action (pixel_grid.button.action_name),
_("Pixel Grid")
);
export = new Akira.Partials.HeaderBarButton ("document-export", _("Export"), {"<Ctrl><Shift>E"});
export.button.action_name = Akira.Services.ActionManager.ACTION_PREFIX + Akira.Services.ActionManager.ACTION_EXPORT;

path_difference = new Akira.Partials.HeaderBarButton ("path-difference", _("Difference"), null);
path_exclusion = new Akira.Partials.HeaderBarButton ("path-exclusion", _("Exclusion"), null);
path_intersect = new Akira.Partials.HeaderBarButton ("path-intersection", _("Intersect"), null);
path_union = new Akira.Partials.HeaderBarButton ("path-union", _("Union"), null);

pack_start (menu);
pack_start (toolset);
pack_start (new Gtk.Separator (Gtk.Orientation.VERTICAL));
pack_start (zoom);
pack_start (new Gtk.Separator (Gtk.Orientation.VERTICAL));
pack_start (group);
pack_start (ungroup);
pack_start (new Gtk.Separator (Gtk.Orientation.VERTICAL));
pack_start (move_up);
pack_start (move_down);
pack_start (move_top);
pack_start (move_bottom);
pack_start (new Gtk.Separator (Gtk.Orientation.VERTICAL));

add (menu);
add (new Gtk.Separator (Gtk.Orientation.VERTICAL));
add (toolset);
add (new Gtk.Separator (Gtk.Orientation.VERTICAL));
pack_end (preferences);
pack_end (export);
pack_end (new Gtk.Separator (Gtk.Orientation.VERTICAL));
pack_end (path_difference);
pack_end (path_exclusion);
pack_end (path_intersect);
pack_end (path_union);
pack_end (new Gtk.Separator (Gtk.Orientation.VERTICAL));
pack_end (layout);
pack_end (grid);
pack_end (pixel_grid);

build_signals ();
}
Expand All @@ -150,10 +163,20 @@ public class Akira.Layouts.HeaderBar : Gtk.HeaderBar {
}

public void update_icons_style () {
layout.update_image ("layout-panels-%s".printf (settings.icon_style));
grid.update_image ("layout-grid-%s".printf (settings.icon_style));
pixel_grid.update_image ("layout-pixels-%s".printf (settings.icon_style));
preferences.update_image ("system-settings-%s".printf (settings.icon_style));
menu.update_image ();
toolset.update_image ();
export.update_image ();
preferences.update_image ();
group.update_image ();
ungroup.update_image ();
move_up.update_image ();
move_down.update_image ();
move_top.update_image ();
move_bottom.update_image ();
path_difference.update_image ();
path_exclusion.update_image ();
path_intersect.update_image ();
path_union.update_image ();
}

public void toggle () {
Expand Down
27 changes: 14 additions & 13 deletions src/Layouts/LeftSideBar.vala
@@ -1,23 +1,24 @@
/*
* Copyright (c) 2018 Alecaddd (http://alecaddd.com)
* Copyright (c) 2019 Alecaddd (http://alecaddd.com)
*
* 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 file is part of Akira.
*
* This program is distributed in the hope that it will be useful,
* Akira 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.
* Akira 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* 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 Akira. If not, see <https://www.gnu.org/licenses/>.
*
* Authored by: Alessandro "Alecaddd" Castellani <castellani.ale@gmail.com>
*/

public class Akira.Layouts.LeftSideBar : Gtk.Grid {
public bool toggled {
get {
Expand Down

0 comments on commit 9ba0116

Please sign in to comment.