summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-04-18 15:42:59 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-04-18 15:42:59 +0200
commit84a27086bbd9f493128b354300f9c77ccb32a56b (patch)
tree977cb323f0ac6953f10bc20d84f45ebd5a6d4535 /src/gui
parentb683ce2789d95b2e9f221e75adc30efd91cfb901 (diff)
Imported Upstream version 0.6.0upstream/0.6.0
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/aboutWindow.vala72
-rw-r--r--src/gui/iconSelectWindow.vala32
-rw-r--r--src/gui/indicator.vala32
-rw-r--r--src/gui/newSliceWindow.vala32
-rw-r--r--src/gui/newsWindow.vala32
-rw-r--r--src/gui/pieComboList.vala92
-rw-r--r--src/gui/pieList.vala144
-rw-r--r--src/gui/piePreview.vala32
-rw-r--r--src/gui/piePreviewAddSign.vala140
-rw-r--r--src/gui/piePreviewCenter.vala32
-rw-r--r--src/gui/piePreviewDeleteSign.vala110
-rw-r--r--src/gui/piePreviewRenderer.vala32
-rw-r--r--src/gui/piePreviewSliceRenderer.vala158
-rw-r--r--src/gui/preferencesWindow.vala32
-rw-r--r--src/gui/renameWindow.vala78
-rw-r--r--src/gui/settingsWindow.vala42
-rw-r--r--src/gui/sliceTypeList.vala106
-rw-r--r--src/gui/themeList.vala68
-rw-r--r--src/gui/triggerSelectButton.vala97
-rw-r--r--src/gui/triggerSelectWindow.vala98
20 files changed, 766 insertions, 695 deletions
diff --git a/src/gui/aboutWindow.vala b/src/gui/aboutWindow.vala
index 39258cb..cf1ce8a 100644
--- a/src/gui/aboutWindow.vala
+++ b/src/gui/aboutWindow.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
@@ -29,38 +29,40 @@ public class AboutWindow: Gtk.AboutDialog {
/////////////////////////////////////////////////////////////////////
public AboutWindow () {
- string[] devs = {
- "Simon Schneegans <code@simonschneegans.de>",
+ string[] devs = {
+ "Simon Schneegans <code@simonschneegans.de>",
+ "Gabriel Dubatti <gdubatti@gmail.com>",
"Francesco Piccinno <stack.box@gmail.com>"
};
string[] artists = {
- "Simon Schneegans <code@simonschneegans.de>"
+ "Simon Schneegans <code@simonschneegans.de>"
};
- string[] translators = {
- "Simon Schneegans <code@simonschneegans.de> (DE, EN)",
- "Riccardo Traverso <gr3yfox.fw@gmail.com> (IT)",
- "Magnun Leno <magnun@codecommunity.org> (PT-BR)",
- "Kim Boram <Boramism@gmail.com> (KO)",
+ string[] translators = {
+ "Simon Schneegans <code@simonschneegans.de> (DE, EN)",
+ "Riccardo Traverso <gr3yfox.fw@gmail.com> (IT)",
+ "Magnun Leno <magnun@codecommunity.org> (PT-BR)",
+ "Kim Boram <Boramism@gmail.com> (KO)",
"Eduardo Anabalon <lalo1412@gmail.com> (ES)",
+ "Gabriel Dubatti <gdubatti@gmail.com> (ES)",
"Grégoire Bellon-Gervais <greggbg@gmail.com> (FR)",
"Alex Maxime <cad.maxime@gmail.com> (FR)",
"Eugene Roskin <pams@imail.ru> (RU)",
"Ting Zhou <tzhou@haverford.edu> (ZH-CN)",
"Martin Dinov <martindinov@yahoo.com> (BG)"
- };
+ };
- // sort translators
- GLib.List<string> translator_list = new GLib.List<string>();
- foreach (var translator in translators)
- translator_list.append(translator);
+ // sort translators
+ GLib.List<string> translator_list = new GLib.List<string>();
+ foreach (var translator in translators)
+ translator_list.append(translator);
- translator_list.sort((a, b) => {
- return a.ascii_casecmp(b);
- });
+ translator_list.sort((a, b) => {
+ return a.ascii_casecmp(b);
+ });
- string translator_string = "";
- foreach (var translator in translator_list)
- translator_string += translator + "\n";
+ string translator_string = "";
+ foreach (var translator in translator_list)
+ translator_string += translator + "\n";
GLib.Object (
artists : artists,
diff --git a/src/gui/iconSelectWindow.vala b/src/gui/iconSelectWindow.vala
index 2560811..ce610ea 100644
--- a/src/gui/iconSelectWindow.vala
+++ b/src/gui/iconSelectWindow.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
diff --git a/src/gui/indicator.vala b/src/gui/indicator.vala
index 1277fb8..b46ee59 100644
--- a/src/gui/indicator.vala
+++ b/src/gui/indicator.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
diff --git a/src/gui/newSliceWindow.vala b/src/gui/newSliceWindow.vala
index 92c7701..a17c819 100644
--- a/src/gui/newSliceWindow.vala
+++ b/src/gui/newSliceWindow.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
diff --git a/src/gui/newsWindow.vala b/src/gui/newsWindow.vala
index 373135f..cc1a77d 100644
--- a/src/gui/newsWindow.vala
+++ b/src/gui/newsWindow.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
diff --git a/src/gui/pieComboList.vala b/src/gui/pieComboList.vala
index 3be3bff..f0fd22f 100644
--- a/src/gui/pieComboList.vala
+++ b/src/gui/pieComboList.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A drop-down list, containing one entry for each existing Pie.
/////////////////////////////////////////////////////////////////////////
@@ -26,19 +26,19 @@ class PieComboList : Gtk.ComboBox {
/////////////////////////////////////////////////////////////////////
/// This signal gets emitted when the user selects a new Pie.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_select(string id);
-
+
/////////////////////////////////////////////////////////////////////
/// The currently selected row.
/////////////////////////////////////////////////////////////////////
-
+
public string current_id { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// Stores the data internally.
/////////////////////////////////////////////////////////////////////
-
+
private Gtk.ListStore data;
private enum DataPos {ICON, NAME, ID}
@@ -48,25 +48,25 @@ class PieComboList : Gtk.ComboBox {
public PieComboList() {
GLib.Object();
-
- this.data = new Gtk.ListStore(3, typeof(Gdk.Pixbuf),
+
+ this.data = new Gtk.ListStore(3, typeof(Gdk.Pixbuf),
typeof(string),
typeof(string));
-
+
this.data.set_sort_column_id(1, Gtk.SortType.ASCENDING);
-
+
base.set_model(this.data);
-
+
var icon_render = new Gtk.CellRendererPixbuf();
icon_render.xpad = 4;
this.pack_start(icon_render, false);
-
+
var name_render = new Gtk.CellRendererText();
this.pack_start(name_render, true);
-
+
this.add_attribute(icon_render, "pixbuf", DataPos.ICON);
this.add_attribute(name_render, "text", DataPos.NAME);
-
+
this.changed.connect(() => {
Gtk.TreeIter active;
if (this.get_active_iter(out active)) {
@@ -76,36 +76,36 @@ class PieComboList : Gtk.ComboBox {
this.current_id = id;
}
});
-
+
reload();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads all existing Pies to the list.
/////////////////////////////////////////////////////////////////////
-
+
public void reload() {
Gtk.TreeIter active;
string id = "";
if (this.get_active_iter(out active))
this.data.get(active, DataPos.ID, out id);
-
+
data.clear();
foreach (var pie in PieManager.all_pies.entries) {
this.load_pie(pie.value);
}
-
+
select_first();
select(id);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Selects the first Pie.
/////////////////////////////////////////////////////////////////////
-
+
public void select_first() {
Gtk.TreeIter active;
-
+
if(this.data.get_iter_first(out active) ) {
this.set_active_iter(active);
string id = "";
@@ -117,37 +117,37 @@ class PieComboList : Gtk.ComboBox {
this.current_id = "";
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Selects the Pie with the given ID.
/////////////////////////////////////////////////////////////////////
-
+
public void select(string id) {
this.data.foreach((model, path, iter) => {
string pie_id;
this.data.get(iter, DataPos.ID, out pie_id);
-
+
if (id == pie_id) {
this.set_active_iter(iter);
return true;
}
-
+
return false;
});
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads one given pie to the list.
/////////////////////////////////////////////////////////////////////
-
+
private void load_pie(Pie pie) {
if (pie.id.length == 3) {
Gtk.TreeIter last;
this.data.append(out last);
var icon = new Icon(pie.icon, 24);
- this.data.set(last, DataPos.ICON, icon.to_pixbuf(),
+ this.data.set(last, DataPos.ICON, icon.to_pixbuf(),
DataPos.NAME, pie.name,
- DataPos.ID, pie.id);
+ DataPos.ID, pie.id);
}
}
}
diff --git a/src/gui/pieList.vala b/src/gui/pieList.vala
index f9fb54b..29c0a1e 100644
--- a/src/gui/pieList.vala
+++ b/src/gui/pieList.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A list, containing one entry for each existing Pie.
/////////////////////////////////////////////////////////////////////////
@@ -26,22 +26,22 @@ class PieList : Gtk.TreeView {
/////////////////////////////////////////////////////////////////////
/// This signal gets emitted when the user selects a new Pie.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_select(string id);
-
+
/////////////////////////////////////////////////////////////////////
/// Stores the data internally.
/////////////////////////////////////////////////////////////////////
-
+
private Gtk.ListStore data;
private enum DataPos {ICON, ICON_NAME, NAME, ID}
-
+
/////////////////////////////////////////////////////////////////////
/// Stores where a drag startet.
/////////////////////////////////////////////////////////////////////
-
+
private Gtk.TreeIter? drag_start = null;
-
+
/////////////////////////////////////////////////////////////////////
/// Rembers the time when a last drag move event was reported. Used
/// to avoid frequent changes of selected Pie when a Pie is dragged
@@ -49,45 +49,45 @@ class PieList : Gtk.TreeView {
/////////////////////////////////////////////////////////////////////
private uint last_hover = 0;
-
+
/////////////////////////////////////////////////////////////////////
/// C'tor, constructs the Widget.
/////////////////////////////////////////////////////////////////////
public PieList() {
GLib.Object();
-
- this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf),
+
+ this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf),
typeof(string),
typeof(string),
typeof(string));
-
+
this.data.set_sort_column_id(DataPos.NAME, Gtk.SortType.ASCENDING);
-
+
this.set_model(this.data);
this.set_headers_visible(false);
this.set_grid_lines(Gtk.TreeViewGridLines.NONE);
this.width_request = 170;
this.set_enable_search(false);
-
+
this.set_events(Gdk.EventMask.POINTER_MOTION_MASK);
-
+
var main_column = new Gtk.TreeViewColumn();
var icon_render = new Gtk.CellRendererPixbuf();
icon_render.xpad = 4;
icon_render.ypad = 4;
main_column.pack_start(icon_render, false);
-
+
var name_render = new Gtk.CellRendererText();
name_render.ellipsize = Pango.EllipsizeMode.END;
name_render.ellipsize_set = true;
main_column.pack_start(name_render, true);
-
+
base.append_column(main_column);
-
+
main_column.add_attribute(icon_render, "pixbuf", DataPos.ICON);
main_column.add_attribute(name_render, "text", DataPos.NAME);
-
+
// setup drag'n'drop
Gtk.TargetEntry uri_source = {"text/uri-list", 0, 0};
Gtk.TargetEntry[] entries = { uri_source };
@@ -100,7 +100,7 @@ class PieList : Gtk.TreeView {
this.drag_leave.connect(() => {
this.last_hover = 0;
});
-
+
this.get_selection().changed.connect(() => {
Gtk.TreeIter active;
if (this.get_selection().get_selected(null, out active)) {
@@ -109,35 +109,35 @@ class PieList : Gtk.TreeView {
this.on_select(id);
}
});
-
+
reload_all();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads all existing Pies to the list.
/////////////////////////////////////////////////////////////////////
-
+
public void reload_all() {
Gtk.TreeIter active;
string id = "";
if (this.get_selection().get_selected(null, out active))
this.data.get(active, DataPos.ID, out id);
-
+
data.clear();
foreach (var pie in PieManager.all_pies.entries) {
this.load_pie(pie.value);
}
-
+
select(id);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Selects the first Pie.
/////////////////////////////////////////////////////////////////////
-
+
public void select_first() {
Gtk.TreeIter active;
-
+
if(this.data.get_iter_first(out active) ) {
this.get_selection().select_iter(active);
string id = "";
@@ -147,45 +147,45 @@ class PieList : Gtk.TreeView {
this.on_select("");
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Selects the Pie with the given ID.
/////////////////////////////////////////////////////////////////////
-
+
public void select(string id) {
this.data.foreach((model, path, iter) => {
string pie_id;
this.data.get(iter, DataPos.ID, out pie_id);
-
+
if (id == pie_id) {
this.get_selection().select_iter(iter);
return true;
}
-
+
return false;
});
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads one given pie to the list.
/////////////////////////////////////////////////////////////////////
-
+
private void load_pie(Pie pie) {
if (pie.id.length == 3) {
Gtk.TreeIter last;
this.data.append(out last);
var icon = new Icon(pie.icon, 24);
- this.data.set(last, DataPos.ICON, icon.to_pixbuf(),
+ this.data.set(last, DataPos.ICON, icon.to_pixbuf(),
DataPos.ICON_NAME, pie.icon,
DataPos.NAME, pie.name,
- DataPos.ID, pie.id);
+ DataPos.ID, pie.id);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a drag which started on this Widget was successfull.
/////////////////////////////////////////////////////////////////////
-
+
private void on_dnd_source(Gdk.DragContext context, Gtk.SelectionData selection_data, uint info, uint time_) {
if (this.drag_start != null) {
string id = "";
@@ -193,72 +193,72 @@ class PieList : Gtk.TreeView {
selection_data.set_uris({"file://" + Paths.launchers + "/" + id + ".desktop"});
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a drag operation is started on this Widget.
/////////////////////////////////////////////////////////////////////
-
+
private void on_start_drag(Gdk.DragContext ctx) {
if (this.get_selection().get_selected(null, out this.drag_start)) {
string icon_name = "";
this.data.get(this.drag_start, DataPos.ICON_NAME, out icon_name);
-
+
var icon = new Icon(icon_name, 48);
var pixbuf = icon.to_pixbuf();
Gtk.drag_set_icon_pixbuf(ctx, pixbuf, icon.size()/2, icon.size()/2);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when something is dragged over this Widget.
/////////////////////////////////////////////////////////////////////
-
+
private bool on_drag_move(Gdk.DragContext context, int x, int y, uint time) {
-
+
Gtk.TreeViewDropPosition position;
Gtk.TreePath path;
-
+
if (!this.get_dest_row_at_pos(x, y, out path, out position))
return false;
-
+
if (position == Gtk.TreeViewDropPosition.BEFORE)
this.set_drag_dest_row(path, Gtk.TreeViewDropPosition.INTO_OR_BEFORE);
else if (position == Gtk.TreeViewDropPosition.AFTER)
this.set_drag_dest_row(path, Gtk.TreeViewDropPosition.INTO_OR_AFTER);
Gdk.drag_status(context, context.get_suggested_action(), time);
-
+
// avoid too frequent selection...
this.last_hover = time;
-
+
GLib.Timeout.add(150, () => {
if (this.last_hover == time)
- this.get_selection().select_path(path);
+ this.get_selection().select_path(path);
return false;
});
-
+
return true;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the user finishes a drag operation on this widget.
/// Only used for external drags.
/////////////////////////////////////////////////////////////////////
-
- private void on_dnd_received(Gdk.DragContext context, int x, int y,
+
+ private void on_dnd_received(Gdk.DragContext context, int x, int y,
Gtk.SelectionData selection_data, uint info, uint time_) {
-
+
Gtk.TreeIter active;
if (this.get_selection().get_selected(null, out active)) {
string id = "";
this.data.get(active, DataPos.ID, out id);
-
+
var pie = PieManager.all_pies[id];
-
+
foreach (var uri in selection_data.get_uris()) {
pie.add_action(ActionRegistry.new_for_uri(uri), 0);
}
-
+
this.on_select(id);
}
}
diff --git a/src/gui/piePreview.vala b/src/gui/piePreview.vala
index 0420d5e..ce1ba96 100644
--- a/src/gui/piePreview.vala
+++ b/src/gui/piePreview.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
diff --git a/src/gui/piePreviewAddSign.vala b/src/gui/piePreviewAddSign.vala
index ee8c14b..fb5e9fa 100644
--- a/src/gui/piePreviewAddSign.vala
+++ b/src/gui/piePreviewAddSign.vala
@@ -1,25 +1,25 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
using GLib.Math;
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A liitle plus-sign displayed on the preview widget to indicate where
/// the user may add a new Slice.
/////////////////////////////////////////////////////////////////////////
@@ -31,57 +31,57 @@ public class PiePreviewAddSign : GLib.Object {
/////////////////////////////////////////////////////////////////////
public signal void on_clicked(int position);
-
+
/////////////////////////////////////////////////////////////////////
/// The image used to display this oject.
/////////////////////////////////////////////////////////////////////
-
+
public Image icon { get; private set; }
-
+
/////////////////////////////////////////////////////////////////////
/// True, when the add sign is currently visible.
/////////////////////////////////////////////////////////////////////
-
+
public bool visible { get; private set; default=false; }
-
+
/////////////////////////////////////////////////////////////////////
/// The position of the sign in its parent Pie. May be 2.5 for
/// example.
/////////////////////////////////////////////////////////////////////
-
+
private double position = 0;
-
+
/////////////////////////////////////////////////////////////////////
/// The parent renderer.
/////////////////////////////////////////////////////////////////////
- private unowned PiePreviewRenderer parent;
-
+ private unowned PiePreviewRenderer parent;
+
/////////////////////////////////////////////////////////////////////
/// Some values used for displaying this sign.
/////////////////////////////////////////////////////////////////////
-
+
private double time = 0;
- private double max_size = 0;
- private double angle = 0;
- private AnimatedValue size;
- private AnimatedValue alpha;
- private AnimatedValue activity;
- private AnimatedValue clicked;
-
+ private double max_size = 0;
+ private double angle = 0;
+ private AnimatedValue size;
+ private AnimatedValue alpha;
+ private AnimatedValue activity;
+ private AnimatedValue clicked;
+
/////////////////////////////////////////////////////////////////////
/// C'tor, sets everything up.
/////////////////////////////////////////////////////////////////////
public PiePreviewAddSign(PiePreviewRenderer parent) {
this.parent = parent;
-
+
this.size = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 2.0);
this.alpha = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 0.0);
this.activity = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, -3, -3, 0, 0.0);
this.clicked = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 1, 1, 0, 0.0);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads the desired icon for this sign.
/////////////////////////////////////////////////////////////////////
@@ -89,41 +89,41 @@ public class PiePreviewAddSign : GLib.Object {
public void load() {
this.icon = new Icon("add", 36);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Updates the position where this object should be displayed.
/////////////////////////////////////////////////////////////////////
public void set_position(int position) {
double new_position = position;
-
+
if (!this.parent.drag_n_drop_mode)
new_position += 0.5;
this.position = new_position;
this.angle = 2.0 * PI * new_position/parent.slice_count();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Makes this object visible.
/////////////////////////////////////////////////////////////////////
-
+
public void show() {
this.visible = true;
- this.size.reset_target(this.max_size, 0.3);
- this.alpha.reset_target(1.0, 0.3);
+ this.size.reset_target(this.max_size, 0.3);
+ this.alpha.reset_target(1.0, 0.3);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Makes this object invisible.
/////////////////////////////////////////////////////////////////////
-
+
public void hide() {
this.visible = false;
- this.size.reset_target(0.0, 0.3);
- this.alpha.reset_target(0.0, 0.3);
+ this.size.reset_target(0.0, 0.3);
+ this.alpha.reset_target(0.0, 0.3);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Updates the size of this object. All transitions will be smooth.
/////////////////////////////////////////////////////////////////////
@@ -132,7 +132,7 @@ public class PiePreviewAddSign : GLib.Object {
this.max_size = size;
this.size.reset_target(size, 0.5);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Draws the sign to the given context.
/////////////////////////////////////////////////////////////////////
@@ -140,75 +140,75 @@ public class PiePreviewAddSign : GLib.Object {
public void draw(double frame_time, Cairo.Context ctx) {
this.time += frame_time;
-
+
this.size.update(frame_time);
this.alpha.update(frame_time);
this.activity.update(frame_time);
this.clicked.update(frame_time);
-
+
if (this.parent.slice_count() == 0) {
ctx.save();
-
- double scale = this.clicked.val
+
+ double scale = this.clicked.val
+ GLib.Math.sin(this.time*10)*0.02*this.alpha.val
+ this.alpha.val*0.08 - 0.1;
ctx.scale(scale, scale);
-
+
// paint the image
icon.paint_on(ctx);
-
+
ctx.restore();
-
+
} else if (this.alpha.val*this.activity.val > 0) {
ctx.save();
-
+
// distance from the center
double radius = 120;
-
+
// transform the context
ctx.translate(cos(this.angle)*radius, sin(this.angle)*radius);
- double scale = this.size.val*this.clicked.val
+ double scale = this.size.val*this.clicked.val
+ this.activity.val*0.07
+ GLib.Math.sin(this.time*10)*0.03*this.activity.val
- 0.1;
ctx.scale(scale, scale);
-
+
// paint the image
icon.paint_on(ctx, this.alpha.val*this.activity.val);
-
+
ctx.restore();
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the mouse moves to another position.
/////////////////////////////////////////////////////////////////////
-
+
public void on_mouse_move(double angle) {
double direction = 2.0 * PI * position/parent.slice_count();
double diff = fabs(angle-direction);
-
+
if (diff > PI)
- diff = 2 * PI - diff;
-
- if (diff < 0.5*PI/parent.slice_count()) this.activity.reset_target(1.0, 1.0);
+ diff = 2 * PI - diff;
+
+ if (diff < 0.5*PI/parent.slice_count()) this.activity.reset_target(1.0, 1.0);
else this.activity.reset_target(-3.0, 1.5);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a button of the mouse is pressed.
/////////////////////////////////////////////////////////////////////
-
+
public void on_button_press(double x, double y) {
if (this.activity.end == 1.0) {
this.clicked.reset_target(0.9, 0.1);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a button of the mouse is released.
/////////////////////////////////////////////////////////////////////
-
+
public void on_button_release(double x, double y) {
if (this.clicked.end == 0.9) {
this.clicked.reset_target(1.0, 0.1);
diff --git a/src/gui/piePreviewCenter.vala b/src/gui/piePreviewCenter.vala
index 20527bc..2a163b6 100644
--- a/src/gui/piePreviewCenter.vala
+++ b/src/gui/piePreviewCenter.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
using GLib.Math;
diff --git a/src/gui/piePreviewDeleteSign.vala b/src/gui/piePreviewDeleteSign.vala
index 500d876..6ba4dcb 100644
--- a/src/gui/piePreviewDeleteSign.vala
+++ b/src/gui/piePreviewDeleteSign.vala
@@ -1,25 +1,25 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
using GLib.Math;
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// The delete sign, displayed in the upper right corner of each
/// Slice.
/////////////////////////////////////////////////////////////////////////
@@ -31,17 +31,17 @@ public class PiePreviewDeleteSign : GLib.Object {
/////////////////////////////////////////////////////////////////////
public signal void on_clicked();
-
+
/////////////////////////////////////////////////////////////////////
/// The image used to display this oject.
/////////////////////////////////////////////////////////////////////
-
+
public Image icon { get; private set; }
-
+
/////////////////////////////////////////////////////////////////////
/// Some constants determining the look and behaviour of this Slice.
/////////////////////////////////////////////////////////////////////
-
+
private static const int radius = 18;
private static const double globale_scale = 0.8;
private static const double click_cancel_treshold = 5;
@@ -51,24 +51,24 @@ public class PiePreviewDeleteSign : GLib.Object {
/////////////////////////////////////////////////////////////////////
private bool visible = false;
-
+
/////////////////////////////////////////////////////////////////////
/// Some AnimatedValues for smooth transitions.
/////////////////////////////////////////////////////////////////////
-
+
private AnimatedValue size;
- private AnimatedValue alpha;
- private AnimatedValue activity;
- private AnimatedValue clicked;
-
+ private AnimatedValue alpha;
+ private AnimatedValue activity;
+ private AnimatedValue clicked;
+
/////////////////////////////////////////////////////////////////////
/// Storing the position where a mouse click was executed. Useful for
/// canceling the click when the mouse moves some pixels.
/////////////////////////////////////////////////////////////////////
-
+
private double clicked_x = 0.0;
private double clicked_y = 0.0;
-
+
/////////////////////////////////////////////////////////////////////
/// C'tor, sets everything up.
/////////////////////////////////////////////////////////////////////
@@ -79,7 +79,7 @@ public class PiePreviewDeleteSign : GLib.Object {
this.activity = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, -3, -3, 0, 0.0);
this.clicked = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 1, 1, 0, 0.0);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads an Action. All members are initialized accordingly.
/////////////////////////////////////////////////////////////////////
@@ -87,26 +87,26 @@ public class PiePreviewDeleteSign : GLib.Object {
public void load() {
this.icon = new Icon("stock_delete", PiePreviewDeleteSign.radius*2);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Makes this object visible.
/////////////////////////////////////////////////////////////////////
-
+
public void show() {
if (!this.visible) {
this.visible = true;
- this.alpha.reset_target(1.0, 0.3);
+ this.alpha.reset_target(1.0, 0.3);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Makes this object invisible.
/////////////////////////////////////////////////////////////////////
-
+
public void hide() {
if (this.visible) {
this.visible = false;
- this.alpha.reset_target(0.0, 0.3);
+ this.alpha.reset_target(0.0, 0.3);
}
}
@@ -117,7 +117,7 @@ public class PiePreviewDeleteSign : GLib.Object {
public void set_size(double size) {
this.size.reset_target(size, 0.2);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Draws the sign to the given context.
/////////////////////////////////////////////////////////////////////
@@ -127,46 +127,46 @@ public class PiePreviewDeleteSign : GLib.Object {
this.alpha.update(frame_time);
this.activity.update(frame_time);
this.clicked.update(frame_time);
-
+
if (this.alpha.val > 0) {
ctx.save();
-
+
// transform the context
- double scale = (this.size.val*this.clicked.val
+ double scale = (this.size.val*this.clicked.val
+ this.activity.val*0.2 - 0.2)*PiePreviewDeleteSign.globale_scale;
ctx.scale(scale, scale);
-
+
// paint the image
icon.paint_on(ctx, this.alpha.val);
-
+
ctx.restore();
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the mouse moves to another position.
/////////////////////////////////////////////////////////////////////
-
+
public bool on_mouse_move(double x, double y) {
if (this.clicked.end == 0.9) {
double dist = GLib.Math.pow(x-this.clicked_x, 2) + GLib.Math.pow(y-this.clicked_y, 2);
if (dist > PiePreviewDeleteSign.click_cancel_treshold*PiePreviewDeleteSign.click_cancel_treshold)
this.clicked.reset_target(1.0, 0.1);
}
-
- if (GLib.Math.fabs(x) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale && GLib.Math.fabs(y) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale) {
- this.activity.reset_target(1.0, 0.2);
- return true;
- }
-
+
+ if (GLib.Math.fabs(x) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale && GLib.Math.fabs(y) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale) {
+ this.activity.reset_target(1.0, 0.2);
+ return true;
+ }
+
this.activity.reset_target(0.0, 0.2);
return false;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a button of the mouse is pressed.
/////////////////////////////////////////////////////////////////////
-
+
public bool on_button_press(double x, double y) {
if (this.activity.end == 1.0) {
this.clicked.reset_target(0.9, 0.1);
@@ -176,16 +176,16 @@ public class PiePreviewDeleteSign : GLib.Object {
}
return false;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a button of the mouse is released.
/////////////////////////////////////////////////////////////////////
-
+
public bool on_button_release(double x, double y) {
if (this.clicked.end == 0.9) {
this.clicked.reset_target(1.0, 0.1);
this.on_clicked();
-
+
return true;
}
return false;
diff --git a/src/gui/piePreviewRenderer.vala b/src/gui/piePreviewRenderer.vala
index 626ab73..53dd2fb 100644
--- a/src/gui/piePreviewRenderer.vala
+++ b/src/gui/piePreviewRenderer.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
using GLib.Math;
diff --git a/src/gui/piePreviewSliceRenderer.vala b/src/gui/piePreviewSliceRenderer.vala
index 6a12a47..5b4d939 100644
--- a/src/gui/piePreviewSliceRenderer.vala
+++ b/src/gui/piePreviewSliceRenderer.vala
@@ -1,25 +1,25 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
using GLib.Math;
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// Displays the preview of a Slice.
/////////////////////////////////////////////////////////////////////////
@@ -30,17 +30,17 @@ public class PiePreviewSliceRenderer : GLib.Object {
/////////////////////////////////////////////////////////////////////
public signal void on_clicked(int position);
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the user clicked on the delete sign.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_remove(int position);
-
+
/////////////////////////////////////////////////////////////////////
/// The image used to display this oject.
/////////////////////////////////////////////////////////////////////
-
+
public Icon icon { get; private set; }
public ActionGroup action_group { get; private set; }
public string name { get; private set; default=""; }
@@ -50,47 +50,47 @@ public class PiePreviewSliceRenderer : GLib.Object {
/// The parent renderer.
/////////////////////////////////////////////////////////////////////
- private unowned PiePreviewRenderer parent;
-
+ private unowned PiePreviewRenderer parent;
+
/////////////////////////////////////////////////////////////////////
/// The delete sign, displayed in the upper right corner of each
/// Slice.
/////////////////////////////////////////////////////////////////////
-
+
private PiePreviewDeleteSign delete_sign = null;
-
+
/////////////////////////////////////////////////////////////////////
/// Some AnimatedValues for smooth transitions.
/////////////////////////////////////////////////////////////////////
-
- private AnimatedValue angle;
- private AnimatedValue size;
- private AnimatedValue activity;
- private AnimatedValue clicked;
-
+
+ private AnimatedValue angle;
+ private AnimatedValue size;
+ private AnimatedValue activity;
+ private AnimatedValue clicked;
+
/////////////////////////////////////////////////////////////////////
/// Some constants determining the look and behaviour of this Slice.
/////////////////////////////////////////////////////////////////////
-
+
private static const double pie_radius = 126;
private static const double radius = 24;
private static const double delete_x = 13;
private static const double delete_y = -13;
private static const double click_cancel_treshold = 5;
-
+
/////////////////////////////////////////////////////////////////////
/// Storing the position where a mouse click was executed. Useful for
/// canceling the click when the mouse moves some pixels.
/////////////////////////////////////////////////////////////////////
-
+
private double clicked_x = 0.0;
private double clicked_y = 0.0;
-
+
/////////////////////////////////////////////////////////////////////
/// The index of this slice in a pie. Clockwise assigned, starting
/// from the right-most slice.
/////////////////////////////////////////////////////////////////////
-
+
private int position;
/////////////////////////////////////////////////////////////////////
@@ -103,21 +103,21 @@ public class PiePreviewSliceRenderer : GLib.Object {
this.delete_sign.on_clicked.connect(() => {
this.on_remove(this.position);
});
-
+
this.parent = parent;
this.angle = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 0.5);
this.size = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 1.0);
this.activity = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 0.0);
this.clicked = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 1, 1, 0, 1.0);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads an Action. All members are initialized accordingly.
/////////////////////////////////////////////////////////////////////
public void load(ActionGroup group) {
this.action_group = group;
-
+
// if it's a custom ActionGroup
if (group.get_type().depth() == 2 && group.actions.size > 0) {
this.icon = new Icon(group.actions[0].icon, (int)(PiePreviewSliceRenderer.radius*2));
@@ -127,23 +127,23 @@ public class PiePreviewSliceRenderer : GLib.Object {
this.name = GroupRegistry.descriptions[group.get_type().name()].name;
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Updates the position where this object should be displayed.
/////////////////////////////////////////////////////////////////////
public void set_position(int position, bool smoothly = true) {
double direction = 2.0 * PI * position/parent.slice_count();
-
+
if (direction != this.angle.end) {
this.position = position;
this.angle.reset_target(direction, smoothly ? 0.5 : 0.0);
-
+
if (!smoothly)
this.angle.update(1.0);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Updates the size of this object. All transitions will be smooth.
/////////////////////////////////////////////////////////////////////
@@ -152,15 +152,15 @@ public class PiePreviewSliceRenderer : GLib.Object {
this.size.reset_target(size, 0.5);
this.delete_sign.set_size(size);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Notifies that all quick actions should be disabled.
/////////////////////////////////////////////////////////////////////
-
+
public void disable_quickactions() {
this.action_group.disable_quickactions();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Draws the slice to the given context.
/////////////////////////////////////////////////////////////////////
@@ -172,100 +172,100 @@ public class PiePreviewSliceRenderer : GLib.Object {
this.clicked.update(frame_time);
ctx.save();
-
+
// transform the context
ctx.translate(cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius, sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius);
-
- double scale = this.size.val*this.clicked.val
+
+ double scale = this.size.val*this.clicked.val
+ this.activity.val*0.1 - 0.1;
- ctx.save();
-
+ ctx.save();
+
ctx.scale(scale, scale);
-
+
// paint the image
icon.paint_on(ctx);
-
+
ctx.restore();
-
+
ctx.translate(PiePreviewSliceRenderer.delete_x*this.size.val, PiePreviewSliceRenderer.delete_y*this.size.val);
this.delete_sign.draw(frame_time, ctx);
-
+
ctx.restore();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the mouse moves to another position.
/////////////////////////////////////////////////////////////////////
-
+
public bool on_mouse_move(double angle, double x, double y) {
double direction = 2.0 * PI * position/parent.slice_count();
double diff = fabs(angle-direction);
-
+
if (diff > PI)
- diff = 2 * PI - diff;
-
- bool active = diff < 0.5*PI/parent.slice_count();
-
- if (active) {
- this.activity.reset_target(1.0, 0.3);
- this.delete_sign.show();
+ diff = 2 * PI - diff;
+
+ bool active = diff < 0.5*PI/parent.slice_count();
+
+ if (active) {
+ this.activity.reset_target(1.0, 0.3);
+ this.delete_sign.show();
} else {
this.activity.reset_target(0.0, 0.3);
this.delete_sign.hide();
- }
-
+ }
+
if (this.clicked.end == 0.9) {
double dist = GLib.Math.pow(x-this.clicked_x, 2) + GLib.Math.pow(y-this.clicked_y, 2);
if (dist > PiePreviewSliceRenderer.click_cancel_treshold*PiePreviewSliceRenderer.click_cancel_treshold)
this.clicked.reset_target(1.0, 0.1);
}
-
+
double own_x = cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
double own_y = sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
- this.delete_hovered = this.delete_sign.on_mouse_move(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val,
+ this.delete_hovered = this.delete_sign.on_mouse_move(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val,
y - own_y - PiePreviewSliceRenderer.delete_y*this.size.val);
-
+
return active;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the mouse leaves the area of this widget.
/////////////////////////////////////////////////////////////////////
-
+
public void on_mouse_leave() {
this.activity.reset_target(0.0, 0.3);
this.delete_sign.hide();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a button of the mouse is pressed.
/////////////////////////////////////////////////////////////////////
-
+
public void on_button_press(double x, double y) {
bool delete_pressed = false;
if (this.activity.end == 1.0) {
double own_x = cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
double own_y = sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
- delete_pressed = this.delete_sign.on_button_press(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val,
+ delete_pressed = this.delete_sign.on_button_press(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val,
y - own_y - PiePreviewSliceRenderer.delete_y*this.size.val);
}
-
+
if (!delete_pressed && this.activity.end == 1.0) {
this.clicked.reset_target(0.9, 0.1);
this.clicked_x = x;
this.clicked_y = y;
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when a button of the mouse is released.
/////////////////////////////////////////////////////////////////////
-
+
public void on_button_release(double x, double y) {
bool deleted = false;
if (this.activity.end == 1.0)
deleted = this.delete_sign.on_button_release(x, y);
-
+
if (!deleted && this.clicked.end == 0.9) {
this.clicked.reset_target(1.0, 0.1);
this.on_clicked(this.position);
diff --git a/src/gui/preferencesWindow.vala b/src/gui/preferencesWindow.vala
index 8cdc853..29b5250 100644
--- a/src/gui/preferencesWindow.vala
+++ b/src/gui/preferencesWindow.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
diff --git a/src/gui/renameWindow.vala b/src/gui/renameWindow.vala
index 389b460..de65069 100644
--- a/src/gui/renameWindow.vala
+++ b/src/gui/renameWindow.vala
@@ -1,106 +1,106 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A window which allows selection of a new name for a Pie.
/////////////////////////////////////////////////////////////////////////
public class RenameWindow : GLib.Object {
-
+
/////////////////////////////////////////////////////////////////////
/// Gets emitted when the user selects a new name.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_ok(string new_name);
-
+
/////////////////////////////////////////////////////////////////////
/// Some Widgets used by this dialog.
/////////////////////////////////////////////////////////////////////
-
+
private Gtk.Dialog window = null;
private Gtk.Entry entry = null;
-
+
/////////////////////////////////////////////////////////////////////
/// C'tor, constructs the Widget.
/////////////////////////////////////////////////////////////////////
-
+
public RenameWindow() {
try {
-
+
Gtk.Builder builder = new Gtk.Builder();
builder.add_from_file (Paths.ui_files + "/rename_pie.ui");
window = builder.get_object("window") as Gtk.Dialog;
entry = builder.get_object("name-entry") as Gtk.Entry;
-
+
entry.activate.connect(this.on_ok_button_clicked);
-
+
(builder.get_object("ok-button") as Gtk.Button).clicked.connect(on_ok_button_clicked);
(builder.get_object("cancel-button") as Gtk.Button).clicked.connect(on_cancel_button_clicked);
-
+
this.window.delete_event.connect(this.window.hide_on_delete);
-
+
} catch (GLib.Error e) {
error("Could not load UI: %s\n", e.message);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Sets the parent window, in order to make this window stay in
/// front.
/////////////////////////////////////////////////////////////////////
-
+
public void set_parent(Gtk.Window parent) {
this.window.set_transient_for(parent);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Displays the window on the screen.
/////////////////////////////////////////////////////////////////////
-
+
public void show() {
this.window.show_all();
this.entry.is_focus = true;
- }
-
+ }
+
/////////////////////////////////////////////////////////////////////
/// Make the text entry display the name of the Pie with given ID.
/////////////////////////////////////////////////////////////////////
-
+
public void set_pie(string id) {
entry.text = PieManager.get_name_of(id);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the ok button is pressed.
/////////////////////////////////////////////////////////////////////
-
+
private void on_ok_button_clicked() {
this.on_ok(entry.text);
this.window.hide();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the cancel button is pressed.
/////////////////////////////////////////////////////////////////////
-
+
private void on_cancel_button_clicked() {
this.window.hide();
}
diff --git a/src/gui/settingsWindow.vala b/src/gui/settingsWindow.vala
index b03ae2f..6bb10c1 100644
--- a/src/gui/settingsWindow.vala
+++ b/src/gui/settingsWindow.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
@@ -99,13 +99,21 @@ public class SettingsWindow : GLib.Object {
});
var range_slider = (builder.get_object("range-hscale") as Gtk.Scale);
- range_slider.set_range(100, 2000);
+ range_slider.set_range(0, 2000);
range_slider.set_increments(10, 100);
range_slider.set_value(Config.global.activation_range);
range_slider.value_changed.connect(() => {
Config.global.activation_range = (int)range_slider.get_value();
});
+ var range_slices = (builder.get_object("range-slices") as Gtk.Scale);
+ range_slices.set_range(12, 96);
+ range_slices.set_increments(4, 12);
+ range_slices.set_value(Config.global.max_visible_slices);
+ range_slices.value_changed.connect(() => {
+ Config.global.max_visible_slices = (int)range_slices.get_value();
+ });
+
this.window.delete_event.connect(this.window.hide_on_delete);
} catch (GLib.Error e) {
diff --git a/src/gui/sliceTypeList.vala b/src/gui/sliceTypeList.vala
index a339e5e..e164dea 100644
--- a/src/gui/sliceTypeList.vala
+++ b/src/gui/sliceTypeList.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A list displaying all available Action types and ActionGroup types.
/////////////////////////////////////////////////////////////////////////
@@ -26,13 +26,13 @@ class SliceTypeList : Gtk.TreeView {
/////////////////////////////////////////////////////////////////////
/// This signal gets emitted when the user selects a new Type.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_select(string id, string icon_name);
-
+
/////////////////////////////////////////////////////////////////////
/// The listore which staroes all types internally.
/////////////////////////////////////////////////////////////////////
-
+
private Gtk.ListStore data;
private enum DataPos {ICON, ICON_NAME, NAME, ID}
@@ -42,33 +42,33 @@ class SliceTypeList : Gtk.TreeView {
public SliceTypeList() {
GLib.Object();
-
- this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf),
+
+ this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf),
typeof(string),
typeof(string),
typeof(string));
-
+
this.data.set_sort_column_id(2, Gtk.SortType.ASCENDING);
-
+
base.set_model(this.data);
base.set_headers_visible(true);
base.set_grid_lines(Gtk.TreeViewGridLines.NONE);
this.set_fixed_height_mode(true);
-
+
var main_column = new Gtk.TreeViewColumn();
main_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED);
main_column.title = _("Slice types");
var icon_render = new Gtk.CellRendererPixbuf();
main_column.pack_start(icon_render, false);
-
+
var name_render = new Gtk.CellRendererText();
main_column.pack_start(name_render, true);
-
+
base.append_column(main_column);
-
+
main_column.add_attribute(icon_render, "pixbuf", DataPos.ICON);
main_column.add_attribute(name_render, "markup", DataPos.NAME);
-
+
this.get_selection().changed.connect(() => {
Gtk.TreeIter active;
if (this.get_selection().get_selected(null, out active)) {
@@ -79,59 +79,59 @@ class SliceTypeList : Gtk.TreeView {
this.on_select(id, icon);
}
});
-
+
reload_all();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads a registered actions and action groups.
/////////////////////////////////////////////////////////////////////
-
+
public void reload_all() {
Gtk.TreeIter active;
string current_id = "";
if (this.get_selection().get_selected(null, out active))
this.data.get(active, DataPos.ID, out current_id);
-
+
data.clear();
-
+
foreach (var action_type in ActionRegistry.types) {
var description = ActionRegistry.descriptions[action_type];
-
+
Gtk.TreeIter current;
data.append(out current);
var icon = new Icon(description.icon, 36);
- data.set(current, DataPos.ICON, icon.to_pixbuf());
- data.set(current, DataPos.ICON_NAME, description.icon);
+ data.set(current, DataPos.ICON, icon.to_pixbuf());
+ data.set(current, DataPos.ICON_NAME, description.icon);
data.set(current, DataPos.NAME, "<b>" + GLib.Markup.escape_text(description.name) + "</b>\n"
- + "<small>" + GLib.Markup.escape_text(description.description) + "</small>");
- data.set(current, DataPos.ID, description.id);
+ + "<small>" + GLib.Markup.escape_text(description.description) + "</small>");
+ data.set(current, DataPos.ID, description.id);
}
-
+
foreach (var group_type in GroupRegistry.types) {
var description = GroupRegistry.descriptions[group_type];
-
+
Gtk.TreeIter current;
data.append(out current);
var icon = new Icon(description.icon, 36);
- data.set(current, DataPos.ICON, icon.to_pixbuf());
+ data.set(current, DataPos.ICON, icon.to_pixbuf());
data.set(current, DataPos.ICON_NAME, description.icon);
data.set(current, DataPos.NAME, "<b>" + GLib.Markup.escape_text(description.name) + "</b>\n"
- + "<small>" + GLib.Markup.escape_text(description.description) + "</small>");
- data.set(current, DataPos.ID, description.id);
+ + "<small>" + GLib.Markup.escape_text(description.description) + "</small>");
+ data.set(current, DataPos.ID, description.id);
}
-
+
select_first();
select(current_id);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Selects the first type in the list.
/////////////////////////////////////////////////////////////////////
-
+
public void select_first() {
Gtk.TreeIter active;
-
+
if(this.data.get_iter_first(out active) ) {
this.get_selection().select_iter(active);
string id = "";
@@ -143,16 +143,16 @@ class SliceTypeList : Gtk.TreeView {
this.on_select("", "stock_unknown");
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Select the given slice type.
/////////////////////////////////////////////////////////////////////
-
+
public void select(string id) {
this.data.foreach((model, path, iter) => {
string pie_id;
this.data.get(iter, DataPos.ID, out pie_id);
-
+
if (id == pie_id) {
this.get_selection().select_iter(iter);
string icon = "";
@@ -160,10 +160,10 @@ class SliceTypeList : Gtk.TreeView {
this.on_select(pie_id, icon);
this.scroll_to_cell(path, null, true, 0.5f, 0.5f);
this.has_focus = true;
-
+
return true;
}
-
+
return false;
});
}
diff --git a/src/gui/themeList.vala b/src/gui/themeList.vala
index 1c038a9..4173819 100644
--- a/src/gui/themeList.vala
+++ b/src/gui/themeList.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A widget displaying all available themes of Gnome-Pie.
/////////////////////////////////////////////////////////////////////////
@@ -26,7 +26,7 @@ class ThemeList : Gtk.TreeView {
/////////////////////////////////////////////////////////////////////
/// This signal gets emitted, when a new theme is selected by the
/// user. This new theme is applied automatically, with this signal
- /// actions may be triggered which should be executed AFTER the
+ /// actions may be triggered which should be executed AFTER the
/// change to a new theme.
/////////////////////////////////////////////////////////////////////
@@ -37,11 +37,11 @@ class ThemeList : Gtk.TreeView {
/////////////////////////////////////////////////////////////////////
private Gtk.TreeIter active { private get; private set; }
-
+
/////////////////////////////////////////////////////////////////////
/// The positions in the data list store.
/////////////////////////////////////////////////////////////////////
-
+
private enum DataPos {ICON, NAME}
/////////////////////////////////////////////////////////////////////
@@ -50,57 +50,57 @@ class ThemeList : Gtk.TreeView {
public ThemeList() {
GLib.Object();
-
- var data = new Gtk.ListStore(2, typeof(Gdk.Pixbuf),
+
+ var data = new Gtk.ListStore(2, typeof(Gdk.Pixbuf),
typeof(string));
this.set_model(data);
this.set_headers_visible(true);
this.set_grid_lines(Gtk.TreeViewGridLines.NONE);
this.set_fixed_height_mode(true);
-
+
var main_column = new Gtk.TreeViewColumn();
main_column.title = _("Themes");
main_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED);
var icon_render = new Gtk.CellRendererPixbuf();
main_column.pack_start(icon_render, false);
-
+
var theme_render = new Gtk.CellRendererText();
main_column.pack_start(theme_render, true);
-
+
this.append_column(main_column);
-
+
main_column.add_attribute(icon_render, "pixbuf", DataPos.ICON);
main_column.add_attribute(theme_render, "markup", DataPos.NAME);
-
+
this.get_selection().changed.connect(() => {
Gtk.TreeIter active;
if (this.get_selection().get_selected(null, out active)) {
Timeout.add(10, () => {
int index = int.parse(data.get_path(active).to_string());
Config.global.theme = Config.global.themes[index];
-
+
this.on_select_new();
-
+
Config.global.theme.load();
Config.global.theme.load_images();
return false;
- });
+ });
}
});
-
+
// load all themes into the list
var themes = Config.global.themes;
foreach(var theme in themes) {
Gtk.TreeIter current;
data.append(out current);
- data.set(current, DataPos.ICON, theme.preview_icon.to_pixbuf());
+ data.set(current, DataPos.ICON, theme.preview_icon.to_pixbuf());
data.set(current, DataPos.NAME, "<b>"+GLib.Markup.escape_text(theme.name)+"</b><small> - "
+GLib.Markup.escape_text(theme.description)+"\n"
+"<i>"+GLib.Markup.escape_text(_("By")+" "+theme.author)
- +"</i></small>");
+ +"</i></small>");
if(theme == Config.global.theme)
get_selection().select_iter(current);
- }
+ }
}
}
diff --git a/src/gui/triggerSelectButton.vala b/src/gui/triggerSelectButton.vala
index 7132220..92cd8a3 100644
--- a/src/gui/triggerSelectButton.vala
+++ b/src/gui/triggerSelectButton.vala
@@ -1,64 +1,64 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This window allows the selection of a hotkey. It is returned in form
/// of a Trigger. Therefore it can be either a keyboard driven hotkey or
/// a mouse based hotkey.
/////////////////////////////////////////////////////////////////////////
public class TriggerSelectButton : Gtk.ToggleButton {
-
+
/////////////////////////////////////////////////////////////////////
/// This signal is emitted when the user selects a new hot key.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_select(Trigger trigger);
-
+
/////////////////////////////////////////////////////////////////////
/// The currently contained Trigger.
/////////////////////////////////////////////////////////////////////
-
+
private Trigger trigger = null;
-
+
/////////////////////////////////////////////////////////////////////
/// True, if mouse buttons can be bound as well.
/////////////////////////////////////////////////////////////////////
-
+
private bool enable_mouse = false;
-
+
/////////////////////////////////////////////////////////////////////
/// These modifiers are ignored.
/////////////////////////////////////////////////////////////////////
-
+
private Gdk.ModifierType lock_modifiers = Gdk.ModifierType.MOD2_MASK
|Gdk.ModifierType.SUPER_MASK
|Gdk.ModifierType.LOCK_MASK
|Gdk.ModifierType.MOD5_MASK;
-
+
/////////////////////////////////////////////////////////////////////
/// C'tor, constructs a new TriggerSelectWindow.
/////////////////////////////////////////////////////////////////////
-
+
public TriggerSelectButton(bool enable_mouse) {
this.enable_mouse = enable_mouse;
-
+
this.toggled.connect(() => {
if (this.active) {
this.set_label(_("Press a hotkey ..."));
@@ -66,49 +66,49 @@ public class TriggerSelectButton : Gtk.ToggleButton {
FocusGrabber.grab(this.get_window(), true, true, true);
}
});
-
+
this.button_press_event.connect(this.on_button_press);
this.key_press_event.connect(this.on_key_press);
this.set_trigger(new Trigger());
}
-
+
/////////////////////////////////////////////////////////////////////
/// Makes the button display the given Trigger.
/////////////////////////////////////////////////////////////////////
-
+
public void set_trigger(Trigger trigger) {
this.trigger = trigger;
this.set_label(trigger.label);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Can be called to cancel the selection process.
/////////////////////////////////////////////////////////////////////
-
+
private void cancel() {
this.set_label(trigger.label);
this.set_active(false);
Gtk.grab_remove(this);
FocusGrabber.ungrab(true, true);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Makes the button display the given Trigger.
/////////////////////////////////////////////////////////////////////
-
+
private void update_trigger(Trigger trigger) {
if (this.trigger.name != trigger.name) {
this.set_trigger(trigger);
this.on_select(this.trigger);
}
-
+
this.cancel();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the user presses a keyboard key.
/////////////////////////////////////////////////////////////////////
-
+
private bool on_key_press(Gdk.EventKey event) {
if (this.active) {
if (Gdk.keyval_name(event.keyval) == "Escape") {
@@ -117,44 +117,45 @@ public class TriggerSelectButton : Gtk.ToggleButton {
this.update_trigger(new Trigger());
} else if (event.is_modifier == 0) {
Gdk.ModifierType state = event.state & ~ this.lock_modifiers;
- this.update_trigger(new Trigger.from_values(event.keyval, state, false, false, false, false));
+ this.update_trigger(new Trigger.from_values(event.keyval, state, false, false, false,
+ false, false, 5));
}
-
+
return true;
}
return false;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Called when the user presses a button of the mouse.
/////////////////////////////////////////////////////////////////////
-
+
private bool on_button_press(Gdk.EventButton event) {
if (this.active) {
Gtk.Allocation rect;
this.get_allocation(out rect);
if (event.x < 0 || event.x > rect.width
|| event.y < 0 || event.y > rect.height) {
-
+
this.cancel();
return true;
}
}
-
+
if (this.active && this.enable_mouse) {
Gdk.ModifierType state = event.state & ~ this.lock_modifiers;
var new_trigger = new Trigger.from_values((int)event.button, state, true,
- false, false, false);
-
+ false, false, false, false, 5);
+
if (new_trigger.key_code != 1) this.update_trigger(new_trigger);
else this.cancel();
-
+
return true;
} else if (this.active) {
this.cancel();
return true;
}
-
+
return false;
}
}
diff --git a/src/gui/triggerSelectWindow.vala b/src/gui/triggerSelectWindow.vala
index 611c179..56781b4 100644
--- a/src/gui/triggerSelectWindow.vala
+++ b/src/gui/triggerSelectWindow.vala
@@ -1,19 +1,19 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-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 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, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// 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 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, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
@@ -39,6 +39,8 @@ public class TriggerSelectWindow : GLib.Object {
private Gtk.CheckButton turbo;
private Gtk.CheckButton delayed;
private Gtk.CheckButton centered;
+ private Gtk.CheckButton warp;
+ private Gtk.RadioButton rshape[10];
private TriggerSelectButton button;
/////////////////////////////////////////////////////////////////////
@@ -56,6 +58,13 @@ public class TriggerSelectWindow : GLib.Object {
private Trigger original_trigger = null;
/////////////////////////////////////////////////////////////////////
+ /// Radioboxes call toggled() twice per selection change.
+ /// This flag is used to discard one of the two notifications.
+ /////////////////////////////////////////////////////////////////////
+
+ private static int notify_toggle= 0;
+
+ /////////////////////////////////////////////////////////////////////
/// C'tor, constructs a new TriggerSelectWindow.
/////////////////////////////////////////////////////////////////////
@@ -76,7 +85,9 @@ public class TriggerSelectWindow : GLib.Object {
trigger.with_mouse,
this.turbo.active,
this.delayed.active,
- this.centered.active);
+ this.centered.active,
+ this.warp.active,
+ this.get_radio_shape());
});
(builder.get_object("trigger-box") as Gtk.Box).pack_start(this.button, true, true);
@@ -93,6 +104,14 @@ public class TriggerSelectWindow : GLib.Object {
this.centered = builder.get_object("center-check") as Gtk.CheckButton;
this.centered.toggled.connect(this.on_check_toggled);
+ this.warp = builder.get_object("warp-check") as Gtk.CheckButton;
+ this.warp.toggled.connect(this.on_check_toggled);
+
+ for (int i= 0; i < 10; i++) {
+ this.rshape[i] = builder.get_object("rshape%d".printf(i)) as Gtk.RadioButton;
+ this.rshape[i].toggled.connect(this.on_radio_toggled);
+ }
+
this.window.delete_event.connect(this.window.hide_on_delete);
} catch (GLib.Error e) {
@@ -128,6 +147,8 @@ public class TriggerSelectWindow : GLib.Object {
this.turbo.active = trigger.turbo;
this.delayed.active = trigger.delayed;
this.centered.active = trigger.centered;
+ this.warp.active = trigger.warp;
+ this.set_radio_shape( trigger.shape );
this.original_trigger = trigger;
this.trigger = trigger;
@@ -135,14 +156,53 @@ public class TriggerSelectWindow : GLib.Object {
}
/////////////////////////////////////////////////////////////////////
- /// Called when one of the three checkoxes is toggled.
+ /// Called when one of the checkboxes is toggled.
/////////////////////////////////////////////////////////////////////
private void on_check_toggled() {
if (this.trigger != null)
this.trigger = new Trigger.from_values(this.trigger.key_sym, this.trigger.modifiers,
this.trigger.with_mouse, this.turbo.active,
- this.delayed.active, this.centered.active);
+ this.delayed.active, this.centered.active,
+ this.warp.active,
+ this.get_radio_shape());
+ }
+
+ /////////////////////////////////////////////////////////////////////
+ /// Returns the current selected radio-button shape: 0= automatic
+ /// 5= full pie; 1,3,7,8= quarters; 2,4,6,8=halves
+ /// 1 | 4 | 7
+ /// 2 | 5 | 8
+ /// 3 | 6 | 9
+ /////////////////////////////////////////////////////////////////////
+
+ private int get_radio_shape() {
+ int rs;
+ for (rs= 0; rs < 10; rs++)
+ if (this.rshape[rs].active)
+ break;
+ return rs;
+ }
+
+ /////////////////////////////////////////////////////////////////////
+ /// Sets the current selected radio-button shape: 0= automatic
+ /// 5= full pie; 1,3,7,8= quarters; 2,4,6,8=halves
+ /////////////////////////////////////////////////////////////////////
+
+ private void set_radio_shape(int rs) {
+ if (rs < 0 || rs > 9)
+ rs= 5; //replace invalid value with default= full pie
+ this.rshape[rs].active= true;
+ }
+
+ /////////////////////////////////////////////////////////////////////
+ /// Called twice when one of the radioboxes is toggled.
+ /////////////////////////////////////////////////////////////////////
+
+ private void on_radio_toggled() {
+ notify_toggle= 1 - notify_toggle;
+ if (notify_toggle == 1)
+ on_check_toggled(); //just call once
}
/////////////////////////////////////////////////////////////////////