The Birdfont Source Code
More colors in theme settings
These changes was commited to the Birdfont repository Mon, 16 Mar 2015 16:11:52 +0000.
Contributing
Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
More colors in theme settings
--- a/libbirdfont/Button.vala
+++ b/libbirdfont/Button.vala
@@ -27,19 +27,19 @@
public Button (string label) {
font_size = 17 * MainWindow.units;
this.label = new Text (label, font_size);
- Theme.text_color (this.label, "Background 1");
+ Theme.text_color (this.label, "Button Foreground");
padding = 15 * MainWindow.units;
}
public override void draw (Context cr) {
cr.save ();
- Theme.color (cr, "Background 4");
+ Theme.color (cr, "Button Background 3");
draw_rounded_rectangle (cr, widget_x, widget_y, get_width (), padding, padding);
cr.fill ();
cr.restore ();
cr.save ();
- Theme.color (cr, "Foreground 1");
+ Theme.color (cr, "Button Border 3");
cr.set_line_width (1);
draw_rounded_rectangle (cr, widget_x, widget_y, get_width (), padding, padding);
cr.stroke ();
--- a/libbirdfont/FileTab.vala
+++ b/libbirdfont/FileTab.vala
@@ -245,7 +245,7 @@
if (recent_fonts.size == 0 && !has_backup ()) {
cr.save ();
- Theme.color (cr, "Background 5");
+ Theme.color (cr, "Foreground 2");
cr.set_font_size (18 * MainWindow.units);
cr.move_to (50 * MainWindow.units, top - 9 * MainWindow.units);
cr.show_text (t_("No fonts created yet."));
@@ -256,7 +256,7 @@
if (scroll == 0 && recent_fonts.size > 0) {
cr.save ();
- Theme.color (cr, "Background 5");
+ Theme.color (cr, "Foreground 2");
cr.set_font_size (18 * MainWindow.units);
cr.move_to (50 * MainWindow.units, top - 9 * MainWindow.units);
cr.show_text (t_("Recent files"));
@@ -303,12 +303,16 @@
private void draw_file_row (WidgetAllocation allocation, Context cr, Font font, bool color, double y) {
string fn = (!) font.font_file;
+ Text file;
fn = fn.substring (fn.replace ("\\", "/").last_index_of ("/") + 1);
draw_background (cr, allocation, y, color);
- cr.move_to (50 * MainWindow.units, y + row_height / 2 + 5 * MainWindow.units);
- cr.show_text (fn);
+ file = new Text (fn);
+ Theme.text_color (file, "Foreground 6");
+ file.widget_x = 50 * MainWindow.units;
+ file.widget_y = y + 5 * MainWindow.units;
+ file.draw (cr);
}
private void draw_backup_row (WidgetAllocation allocation, Context cr, string backup, bool color, double y) {
@@ -334,15 +338,15 @@
void draw_background (Context cr, WidgetAllocation allocation, double y, bool color) {
if (color) {
- draw_background_color (cr, allocation, y, 224);
+ draw_background_color (cr, allocation, y, 1);
} else {
- draw_background_color (cr, allocation, y, 239);
+ draw_background_color (cr, allocation, y, 0.5);
}
}
- void draw_background_color (Context cr, WidgetAllocation allocation, double y, int color) {
+ void draw_background_color (Context cr, WidgetAllocation allocation, double y, double opacity) {
cr.save ();
- cr.set_source_rgba (color/255.0, color/255.0, color/255.0, 1);
+ Theme.color_opacity (cr, "Background 10", opacity);
cr.rectangle (0, y, allocation.width, row_height);
cr.fill ();
cr.restore ();
--- a/libbirdfont/Menu.vala
+++ b/libbirdfont/Menu.vala
@@ -668,7 +668,7 @@
cr.save ();
label_x = allocation.width - width + 0.7 * height * MainWindow.units;
label_y = y + font_size - 1 * MainWindow.units;
- Theme.text_color (item.label, "Foreground 2");
+ Theme.text_color (item.label, "Menu Foreground");
item.label.draw_at_baseline (cr, label_x, label_y);
key_binding.set_text (item.get_key_bindings ());
@@ -676,7 +676,7 @@
binding_extent = key_binding.get_extent ();
label_x = x + width - binding_extent - 0.6 * height * MainWindow.units;
key_binding.set_font_size (font_size);
- Theme.text_color (key_binding, "Foreground 2");
+ Theme.text_color (key_binding, "Menu Foreground");
key_binding.draw_at_baseline (cr, label_x, label_y);
y += height;
--- a/libbirdfont/PenTool.vala
+++ b/libbirdfont/PenTool.vala
@@ -740,6 +740,10 @@
last_point_x = Glyph.path_coordinate_x (x);
last_point_y = Glyph.path_coordinate_y (y);
}
+ }
+
+ if (show_selection_box) {
+ GlyphCanvas.redraw ();
}
}
--- a/libbirdfont/Renderer/TextArea.vala
+++ b/libbirdfont/Renderer/TextArea.vala
@@ -990,7 +990,7 @@
// background
cr.save ();
cr.set_line_width (1);
- Theme.color (cr, "Foreground 2");
+ Theme.color (cr, "Background 2");
draw_rounded_rectangle (cr, x, y, this.width, this.height, padding);
cr.fill ();
cr.restore ();
--- a/libbirdfont/Theme.vala
+++ b/libbirdfont/Theme.vala
@@ -84,15 +84,15 @@
}
public static void set_default_colors () {
- add_theme_files ();
current_theme = "default.theme";
+ color_list = new Gee.ArrayList<string> ();
+ colors = new Gee.HashMap<string, Color> ();
+ themes = new Gee.ArrayList<string> ();
+
+ add_theme_files ();
- if (Argument.has_argument ("--test") {
+ if (BirdFont.has_argument ("--test")) {
current_theme = "generated_theme.theme";
-
- color_list = new Gee.ArrayList<string> ();
- colors = new Gee.HashMap<string, Color> ();
- themes = new Gee.ArrayList<string> ();
Theme.set_default_color ("Stroke Color", 0, 0, 0, 1);
Theme.set_default_color ("Handle Color", 0, 0, 0, 1);
@@ -107,13 +107,16 @@
Theme.set_default_color ("Background 7", 56 / 255.0, 59 / 255.0, 65 / 255.0, 1);
Theme.set_default_color ("Background 8", 55/255.0, 55/255.0, 55/255.0, 1);
Theme.set_default_color ("Background 9", 72/255.0, 72/255.0, 72/255.0, 1);
+ Theme.set_default_color ("Background 10", 223/255.0, 223/255.0, 223/255.0, 1);
Theme.set_default_color ("Foreground 1", 0, 0, 0, 1);
Theme.set_default_color ("Foreground 2", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1);
Theme.set_default_color ("Foreground 3", 26 / 255.0, 30 / 255.0, 32 / 255.0, 1);
Theme.set_default_color ("Foreground 4", 40 / 255.0, 57 / 255.0, 65 / 255.0, 1);
Theme.set_default_color ("Foreground 5", 70 / 255.0, 77 / 255.0, 83 / 255.0, 1);
+ Theme.set_default_color ("Foreground 6", 45 / 255.0, 45 / 255.0, 45 / 255.0, 1);
Theme.set_default_color ("Foreground Inverted", 1, 1, 1, 1);
+ Theme.set_default_color ("Menu Foreground", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1);
Theme.set_default_color ("Highlighted 1", 234 / 255.0, 77 / 255.0, 26 / 255.0, 1);
@@ -138,8 +141,11 @@
Theme.set_default_color ("Button Border 4", 38 / 255.0, 39 / 255.0, 43 / 255.0, 1);
Theme.set_default_color ("Button Background 4", 33 / 255.0, 36 / 255.0, 39 / 255.0, 1);
- Theme.set_default_color ("Button Foreground", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1);
- Theme.set_default_color ("Selected Button Foreground", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1);
+ Theme.set_default_color ("Button Foreground", 1, 1, 1, 1);
+ Theme.set_default_color ("Selected Button Foreground", 1, 1, 1, 1);
+
+ Theme.set_default_color ("Tool Foreground", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1);
+ Theme.set_default_color ("Selected Tool Foreground", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1);
t_("Stroke Color");
t_("Handle Color");
@@ -161,6 +167,7 @@
t_("Foreground 4");
t_("Foreground 5");
t_("Foreground Inverted");
+ t_("Menu Foreground");
t_("Highlighted 1");
t_("Highlighted Guide");
--- a/libbirdfont/Tool.vala
+++ b/libbirdfont/Tool.vala
@@ -292,10 +292,10 @@
iconx = bgx + w / 2 - icon_font.get_sidebearing_extent () / 2;
icony = bgy + h / 2 - icon_font.get_height () / 2;
- if (!selected || active) {
- Theme.text_color (icon_font, "Button Foreground");
+ if (!selected) {
+ Theme.text_color (icon_font, "Tool Foreground");
} else {
- Theme.text_color (icon_font, "Selected Button Foreground");
+ Theme.text_color (icon_font, "Selected Tool Foreground");
}
icon_font.widget_x = iconx;
--- a/libbirdfont/Toolbox.vala
+++ b/libbirdfont/Toolbox.vala
@@ -482,7 +482,7 @@
TextArea t;
if (tool_tip != null && tool_tip != "") {
- t = new TextArea (15 * get_scale ());
+ t = new TextArea (17 * get_scale ());
t.allocation = new WidgetAllocation.for_area (0, 0, allocation_width, allocation_height);
t.set_editable (false);
t.set_text ((!) tool_tip);
--- a/resources/win32/icon.rc
+++ /dev/null
@@ -1,2 +1,1 @@
- id ICON "../win32/birdfont.ico"