Commit 0210c3f
remove native gtk window from libbirdfont
Changed files (35)
modifiedsrc/Birdfont.valamodifiedsrc/DropMenu.valamodifiedsrc/EditPoint.valamodifiedsrc/EditPointHandle.valaaddedsrc/Expander.valamodifiedsrc/ExportTool.valamodifiedsrc/Font.valamodifiedsrc/FontDisplay.valamodifiedsrc/Glyph.valamodifiedsrc/GlyphBackgroundImage.valamodifiedsrc/GlyphCanvas.valamodifiedsrc/GlyphCollection.valamodifiedsrc/GlyphRange.valamodifiedsrc/GtkInterface.valamodifiedsrc/Icons.valamodifiedsrc/Kerning.valamodifiedsrc/KeyBindings.valamodifiedsrc/Line.valamodifiedsrc/Main.valamodifiedsrc/MainWindow.valamodifiedsrc/MenuTab.valamodifiedsrc/NativeWindow.valamodifiedsrc/OverView.valamodifiedsrc/Path.valamodifiedsrc/Preferences.valamodifiedsrc/SaveDialog.valamodifiedsrc/SpinButton.valamodifiedsrc/Supplement.valamodifiedsrc/TabBar.valamodifiedsrc/Tool.valamodifiedsrc/Toolbox.valamodifiedsrc/TooltipArea.valamodifiedsrc/UniRange.valamodifiedsrc/VersionList.valamodifiedsrc/wscript
Diff
@@ -18,107 +18,6 @@ using Supplement; namespace Birdfont { -public static int run_gui (string[] arg) {- int err_arg;- File font_file;- Argument args;- IdleSource idle;- int i;- string exec_path;-- Supplement.Supplement supplement = new Supplement.Supplement ();-- supplement.args = new Argument.command_line (arg);- args = supplement.args;- - if (supplement.args.has_argument ("--help")) {- args.print_help ();- Process.exit (0);- }-- err_arg = args.validate ();- if (err_arg != 0) {- stdout.printf (@"Unknown parameter $(arg [err_arg])\n\n");- args.print_help ();- Process.exit (0);- }-- stdout.printf ("birdfont version %s\n", VERSION);- stdout.printf ("built on %s\n", BUILD_TIMESTAMP);-- supplement.current_font = new Font ();- supplement.current_glyph = new Glyph ("");-- supplement.experimental = args.has_argument ("--test");- supplement.show_coordinates = args.has_argument ("--show-coordinates");- supplement.fatal_wanings = args.has_argument ("--fatal-warning");- supplement.win32 = (arg[0].index_of (".exe") > -1) || arg[0] == "wine";- supplement.exec_path = "";- - print (@"$(arg[0]) \n");-- if (supplement.win32) {- // wine hack to get "." folder in win32 environment- i = arg[0].last_index_of ("\\");- - if (i != -1) { - exec_path = arg[0];- exec_path = exec_path.substring (0, i);- supplement.exec_path = wine_to_unix_path (exec_path); - }- } else {- supplement.exec_path = "./";- }- - print (@"arg[0]: $(arg[0])\n");- print (@"supplement.win32: $(supplement.win32)\n");- print (@"supplement.exec_path: $(supplement.exec_path)\n");- - Preferences preferences = new Preferences ();- preferences.load ();- - if (args.get_file () != "") {- font_file = File.new_for_path (args.get_file ());- - if (!font_file.query_exists ()) {- stderr.printf (@"File $(args.get_file ()) not found.");- return -1;- }- }- - Gtk.init (ref arg);- MainWindow window = new MainWindow ();- GtkWindow native_window = new GtkWindow ("birdfont");- window.set_native (native_window);-- if (supplement.fatal_wanings) {- LogLevelFlags levels = LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL | LogLevelFlags.LEVEL_WARNING;- Log.set_handler (null, levels, supplement.fatal_warning);- }- - idle = new IdleSource ();- idle.set_callback(() => {- preferences.load ();- - if (args.get_file () != "") {- supplement.get_current_font ().load (args.get_file ());- MainWindow.get_toolbox ().select_tool_by_name ("available_characters");- } else {- MainWindow.get_tab_bar ().select_tab_name ("Menu");- }- - return false;- });- - idle.attach (null);- - Gtk.main ();- - preferences.set_last_file (supplement.get_current_font ().get_path ());- - return 0;-}- static void print_export_help (string[] arg) { stdout.printf ("Usage: "); stdout.printf (arg[0]);@@ -19,12 +19,12 @@ using Cairo; namespace Supplement { -enum MenuDirection {+public enum MenuDirection { DROP_DOWN, POP_UP; } -class DropMenu : GLib.Object {+public class DropMenu : GLib.Object { public delegate void Selected (MenuAction self); public signal void selected (DropMenu self);@@ -198,7 +198,7 @@ class DropMenu : GLib.Object { } } -class MenuAction : GLib.Object {+public class MenuAction : GLib.Object { public string label; public DropMenu.Selected action; public DropMenu? parent = null;@@ -19,7 +19,7 @@ using Math; namespace Supplement { -enum PointType {+public enum PointType { NONE, NORMAL, LINE,@@ -29,7 +29,7 @@ enum PointType { FLOATING } -class EditPoint {+public class EditPoint { public double x; public double y;@@ -19,7 +19,7 @@ using Math; namespace Supplement { -class EditPointHandle {+public class EditPointHandle { public double angle; public double length;new file mode 100644@@ -0,0 +1,225 @@+/*+ Copyright (C) 2012 Johan Mattsson++ 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 Cairo;+using Math;++namespace Supplement {++public class Expander : GLib.Object {+ + public double x = 7;+ public double y = 5;++ public double w = 6;+ public double h = 5;+ + public double margin = 0;+ + protected double rotation = 0;+ protected double opacity = 0.5;+ + protected bool active = false;+ protected bool open = false;++ public List<Tool> tool;++ bool persist = false;+ bool unique = false;+ + public Expander () {+ }++ /** Returns true if tools can be used with the current canvas after+ * they have been selectes and false if they are a commands to be executed.+ */+ public bool is_persistent () {+ return persist;+ }++ /** Returns true if all other tools in thid expander should be deselected + * when a tool is selected.+ */+ public bool is_unique () {+ return unique;+ }++ public void set_persistent (bool p) {+ persist = p;+ }++ public void set_unique (bool u) {+ unique = u;+ }+ + private void update_tool_position () {+ int i = 0;+ double xt = x + 10;+ double yt = y - 4;+ foreach (var t in tool) {+ t.set_properties (xt, yt, w, h);+ + if (i == 3) {+ yt += 31;+ i = 0;+ xt = x + 10;+ } else {+ i++;+ xt += w + 3 + 25;+ }+ }+ }+ + public void set_offset (double ty) {+ y = ty;+ + if (open) {+ update_tool_position ();+ }+ }+ + public void add_tool (Tool t) {+ tool.append (t);+ update_tool_position ();+ + t.select_action.connect ((selected) => {+ if (!selected.new_selection) {+ if (is_persistent ()) {+ selected.set_selected (true);+ } else {+ selected.set_selected (false);+ }+ }+ + MainWindow.get_toolbox ().redraw ((int) x, (int) y, (int) w + 300, (int) (h + margin));+ + if (is_unique ()) {+ foreach (var deselected in tool) {+ if (selected.get_id () != deselected.get_id ()) {+ deselected.set_selected (false);+ }+ }+ }++ if (!is_persistent ()) {+ var time = new TimeoutSource(200);+ time.set_callback(() => {+ selected.set_selected (false);+ MainWindow.get_toolbox ().redraw ((int) x, (int) y, (int) w + 300, (int) (h + margin));+ return false;+ });+ time.attach(null);+ }++ selected.new_selection = false;+ });+ }+ + public bool is_over (double xp, double yp) { + return (x - 7/2.0 <= xp <= x + w + 7/2.0 && y - 7/2.0<= yp <= y + w + 7/2.0); + }+ + public bool set_active (bool a) {+ bool r = (active != a);+ opacity = (a) ? 1 : 0;+ active = a;+ return r;+ }+ + public bool is_open () {+ return open;+ }+ + public virtual bool set_open (bool o) {+ bool r = (open != o);+ rotation = (o) ? Math.PI_2 : 0;+ + if (o) {+ margin = 35 * (int)((tool.length () / 4.0) + 1) ;+ rotation = Math.PI_2; + if (tool.length () % 4 == 0) {+ margin -= 35;+ }+ } else {+ margin = 0;+ rotation = 0; + }+ + open = o;+ return r;+ }+ + public void draw (int wd, int hd, Context cr) {+ double lx, ly;+ double ih2 = 5.4 / 2;+ double iw2 = 5.4 / 2;+ + // box+ cr.save ();+ cr.set_line_join (LineJoin.ROUND);+ cr.set_line_width(7);+ cr.set_source_rgba (176/255.0, 211/255.0, 230/255.0, opacity);+ cr.rectangle (x, y, w, h);+ cr.stroke ();+ cr.restore ();+ + // arrow+ cr.save ();+ + cr.translate (x + w/2, y + h/2);+ cr.rotate (rotation);++ cr.set_line_width (1);+ cr.set_source_rgba (0, 0, 0, opacity);++ cr.new_path ();+ cr.move_to (-iw2, -ih2);+ cr.line_to (iw2, 0); + cr.line_to (-iw2, +ih2);++ cr.close_path();+ cr.stroke ();+ cr.restore ();+ + // separator+ cr.save ();+ lx = x + w + 7;+ ly = y + ih2;+ if (lx < wd) {+ cr.set_line_width(1);+ cr.set_source_rgba (0, 0, 0, 0.2);+ cr.move_to (lx, ly);+ cr.line_to (wd - w - x + 4, ly); + cr.stroke ();+ }+ cr.restore ();++ }+ + public void draw_content (int w, int h, Context cr) {+ if (open) {+ cr.save ();+ foreach (var t in tool) {+ t.draw (cr);+ }+ cr.restore ();+ }+ }+ +}++}@@ -17,7 +17,7 @@ namespace Supplement { -class ExportTool : Tool {+public class ExportTool : Tool { private static string? prefered_browser = null; private static ExportThread export_thread;@@ -496,7 +496,7 @@ os.put_string ( } - class ExportThread : GLib.Object {+ public class ExportThread : GLib.Object { private string ffi; private string ttf;@@ -20,7 +20,7 @@ using Xml; namespace Supplement { -class Font : GLib.Object {+public class Font : GLib.Object { GlyphTable glyph_cache = new GlyphTable (); @@ -23,12 +23,12 @@ using Birdfont; namespace Supplement { /** Javascripts in webkit do use this callback. */-internal class PropertyFunction {+public class PropertyFunction { public delegate void PropertyCallback (string val); public PropertyCallback call; } -internal abstract class FontDisplay : GLib.Object {+public abstract class FontDisplay : GLib.Object { List<string> property = new List<string> (); List<PropertyFunction> call = new List<PropertyFunction> ();@@ -22,7 +22,7 @@ using Math; namespace Supplement { -class Glyph : FontDisplay {+public class Glyph : FontDisplay { public const double SCALE = 1.0; @@ -22,7 +22,7 @@ using Math; namespace Supplement { -class GlyphBackgroundImage {+public class GlyphBackgroundImage { public double img_x = 0; public double img_y = 0;@@ -22,7 +22,7 @@ using Math; namespace Supplement { -class GlyphCanvas : DrawingArea { +public class GlyphCanvas : DrawingArea { FontDisplay current_display; @@ -22,7 +22,7 @@ using Math; namespace Supplement { -class GlyphCollection : GLib.Object {+public class GlyphCollection : GLib.Object { VersionList versions; public GlyphCollection (Glyph? current = null) {@@ -17,7 +17,7 @@ namespace Supplement { -class GlyphRange {+public class GlyphRange { List<UniRange> ranges; @@ -54,8 +54,7 @@ public class GtkWindow : Gtk.Window, NativeWindow { html_canvas.get_settings ().enable_default_context_menu = false; html_canvas.title_changed.connect ((p, s) => {- FontDisplay fd = MainWindow.get_current_display ();- fd.process_property (s);+ webkit_callback (s); }); html_box = new ScrolledWindow (null, null);@@ -153,6 +152,23 @@ public class GtkWindow : Gtk.Window, NativeWindow { } + void set_first_view () {+/*//FIXA IdleSource idle = new IdleSource ();+ idle.set_callback(() => {+ if (args.get_file () != "") {+ Supplement.get_current_font ().load (args.get_file ());+ MainWindow.get_toolbox ().select_tool_by_name ("available_characters");+ } else {+ MainWindow.get_tab_bar ().select_tab_name ("Menu");+ }+ + return false;+ });+ + idle.attach (null); +*/+ }+ internal void toggle_expanded_margin_bottom () { int w, h; margin_bottom.get_size_request (out w, out h);@@ -19,7 +19,7 @@ namespace Supplement { using Cairo; -class Icons {+public class Icons { public static ImageSurface? get_icon (string? name) { ImageSurface? img = null;@@ -20,7 +20,7 @@ using Xml; namespace Supplement { -class Kerning : GLib.Object {+public class Kerning : GLib.Object { public string glyph_right; public double val; @@ -19,7 +19,7 @@ using Gdk; namespace Supplement { -enum Key {+public enum Key { NONE = 0, UP = 65362, RIGHT = 65363,@@ -68,17 +68,17 @@ bool is_modifier_key (uint i) { } /** Modifier flags */-internal static const uint NONE = 0;-internal static const uint CTRL = 1 << 0;-internal static const uint ALT = 1 << 2;-internal static const uint SHIFT = 1 << 3;+public static const uint NONE = 0;+public static const uint CTRL = 1 << 0;+public static const uint ALT = 1 << 2;+public static const uint SHIFT = 1 << 3; -internal bool is_mod (EventKey e) {+public bool is_mod (EventKey e) { return (e.keyval == Key.CTRL_RIGHT || e.keyval == Key.CTRL_LEFT || e.keyval == Key.ALT_RIGHT || e.keyval == Key.ALT_LEFT); } /** A list of all valid key bindings. */-class BindingList {+public class BindingList { static ShortCut[]? nc = null; public static ShortCut[] get_default_bindings () { @@ -274,7 +274,7 @@ class CloseTab : ShortCut { } /** Function to be executed for each global key binding. */-abstract class ShortCut : GLib.Object {+public abstract class ShortCut : GLib.Object { uint modifier = 0; uint key = 0; @@ -310,7 +310,7 @@ abstract class ShortCut : GLib.Object { } -class KeyBindings {+public class KeyBindings { bool modifier_ctrl = false; bool modifier_alt = false;@@ -22,7 +22,7 @@ using Gdk; namespace Supplement { /** Help line */-class Line : GLib.Object {+public class Line : GLib.Object { public static const bool VERTICAL = true; public static const bool HOROIZONTAL = false; @@ -16,7 +16,19 @@ */ using Birdfont;+using Supplement; public static int main (string[] arg) {- return run_gui (arg);+ Supplement.Supplement supplement = new Supplement.Supplement ();+ + supplement.init (arg);+ + Gtk.init (ref arg);+ MainWindow window = new MainWindow ();+ GtkWindow native_window = new GtkWindow ("birdfont"); + window.set_native (native_window);+ Gtk.main ();++ return 0; }+@@ -17,11 +17,10 @@ using Gdk; using Gtk; -using WebKit; namespace Supplement { -internal class MainWindow { +public class MainWindow { public static Toolbox tools; public static GlyphCanvas glyph_canvas; @@ -69,7 +68,7 @@ internal class MainWindow { return get_glyph_canvas ().get_current_display (); } - internal static GlyphCanvas get_glyph_canvas () { + public static GlyphCanvas get_glyph_canvas () { return glyph_canvas; } @@ -90,7 +89,7 @@ internal class MainWindow { return get_singleton ().tools.get_tool (n); } - internal static TabBar get_tab_bar () { + public static TabBar get_tab_bar () { return get_singleton ().tabs; } @@ -19,7 +19,7 @@ using WebKit; namespace Supplement { -class MenuTab : FontDisplay { +public class MenuTab : FontDisplay { List<Font> recent_fonts = new List<Font> (); @@ -15,6 +15,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ +namespace Supplement {+ public interface NativeWindow : GLib.Object { public abstract string? file_chooser (string title); public abstract string? set_title (string title);@@ -23,4 +25,11 @@ public interface NativeWindow : GLib.Object { public abstract void toggle_expanded_margin_right (); public abstract void update_window_size ();++ protected void webkit_callback (string s) {+ FontDisplay fd = MainWindow.get_current_display ();+ fd.process_property (s);+ }+}+ }@@ -22,7 +22,7 @@ using Gdk; namespace Supplement { /** A display with all glyphs present in this font. */-class OverView : FontDisplay {+public class OverView : FontDisplay { Allocation allocation; int rows = 0;@@ -22,12 +22,12 @@ using Math; namespace Supplement { -enum Direction {+public enum Direction { CLOCKWISE, COUNTER_CLOCKWISE } -class Path {+public class Path { public List<EditPoint> points = new List<EditPoint> (); @@ -76,14 +76,6 @@ class Path { return points.length () == 0; } - public void set_selected (bool s) {- selected = s;- }-- public bool is_selected () {- return selected;- }- public void draw_outline (Context cr, Allocation allocation, double view_zoom) { unowned List<EditPoint> ep = points; @@ -96,7 +88,7 @@ class Path { } cr.new_path ();- + // draw lines foreach (EditPoint e in ep) { if (n != null) {@@ -1883,7 +1875,7 @@ class Path { } -class PathList : GLib.Object {+public class PathList : GLib.Object { public List<Path> paths = new List<Path> (); public PathList () {@@ -16,7 +16,7 @@ */ namespace Supplement { -internal class Preferences {+public class Preferences { static HashTable<string, string> data; @@ -21,7 +21,7 @@ using Cairo; namespace Supplement { -class SaveDialog : FontDisplay {+public class SaveDialog : FontDisplay { public signal void finished (); @@ -21,7 +21,7 @@ using Gdk; namespace Supplement { -class SpinButton : Tool {+public class SpinButton : Tool { public signal void new_value_action (SpinButton selected); @@ -17,10 +17,11 @@ using Gtk; using Supplement; +using Birdfont; namespace Supplement { -internal class Supplement { +public class Supplement { internal static Argument args; internal static bool experimental = false; internal static bool show_coordinates = false; @@ -31,7 +32,74 @@ internal class Supplement { internal static Font current_font; internal static Glyph current_glyph; - internal static Font get_current_font () { + public void init (string[] arg) { + int err_arg; + int i; + File font_file; + Argument args; + IdleSource idle; + string exec_path; + + stdout.printf ("birdfont version %s\n", VERSION); + stdout.printf ("built on %s\n", BUILD_TIMESTAMP); + + args = new Argument.command_line (arg); + + if (args.has_argument ("--help")) { + args.print_help (); + Process.exit (0); + } + + err_arg = args.validate (); + if (err_arg != 0) { + stdout.printf (@"Unknown parameter $(arg [err_arg])\n\n"); + args.print_help (); + Process.exit (0); + } + + current_font = new Font (); + current_glyph = new Glyph (""); + + experimental = args.has_argument ("--test"); + show_coordinates = args.has_argument ("--show-coordinates"); + fatal_wanings = args.has_argument ("--fatal-warning"); + win32 = (arg[0].index_of (".exe") > -1) || arg[0] == "wine"; + exec_path = ""; + + if (win32) { + // wine hack to get "." folder in win32 environment + i = arg[0].last_index_of ("\\"); + + if (i != -1) { + exec_path = arg[0]; + exec_path = exec_path.substring (0, i); + exec_path = wine_to_unix_path (exec_path); + } + } else { + exec_path = "./"; + } + + Preferences preferences = new Preferences (); + preferences.load (); + + if (args.get_file () != "") { + font_file = File.new_for_path (args.get_file ()); + + if (!font_file.query_exists ()) { + stderr.printf (@"File $(args.get_file ()) not found."); + Process.exit (-1); + } + } + + if (fatal_wanings) { + LogLevelFlags levels = LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL | LogLevelFlags.LEVEL_WARNING; + Log.set_handler (null, levels, fatal_warning); + } + + preferences.set_last_file (get_current_font ().get_path ()); + } + + public static Font get_current_font () { return current_font; } @@ -19,7 +19,7 @@ using Cairo; namespace Supplement { -class TabBar : GLib.Object {+public class TabBar : GLib.Object { int width = 0; int height = 0;@@ -565,7 +565,7 @@ class TabBar : GLib.Object { } } -class Tab : GLib.Object {+public class Tab : GLib.Object { bool always_open; double width; @@ -19,7 +19,7 @@ using Cairo; namespace Supplement { -class Tool : GLib.Object {+public class Tool : GLib.Object { public double x = 0; public double y = 0;@@ -20,7 +20,7 @@ using Math; namespace Supplement { -class Toolbox : GLib.Object {+public class Toolbox : GLib.Object { GlyphCanvas glyph_canvas; bool expanded = true;@@ -845,206 +845,4 @@ class ToolboxExpander : Expander { } } -class Expander : GLib.Object {- - public double x = 7;- public double y = 5;-- public double w = 6;- public double h = 5;- - public double margin = 0;- - protected double rotation = 0;- protected double opacity = 0.5;- - protected bool active = false;- protected bool open = false;-- public List<Tool> tool;-- bool persist = false;- bool unique = false;- - public Expander () {- }-- /** Returns true if tools can be used with the current canvas after- * they have been selectes and false if they are a commands to be executed.- */- public bool is_persistent () {- return persist;- }-- /** Returns true if all other tools in thid expander should be deselected - * when a tool is selected.- */- public bool is_unique () {- return unique;- }-- public void set_persistent (bool p) {- persist = p;- }-- public void set_unique (bool u) {- unique = u;- }- - private void update_tool_position () {- int i = 0;- double xt = x + 10;- double yt = y - 4;- foreach (var t in tool) {- t.set_properties (xt, yt, w, h);- - if (i == 3) {- yt += 31;- i = 0;- xt = x + 10;- } else {- i++;- xt += w + 3 + 25;- }- }- }- - public void set_offset (double ty) {- y = ty;- - if (open) {- update_tool_position ();- }- }- - public void add_tool (Tool t) {- tool.append (t);- update_tool_position ();- - t.select_action.connect ((selected) => {- if (!selected.new_selection) {- if (is_persistent ()) {- selected.set_selected (true);- } else {- selected.set_selected (false);- }- }- - MainWindow.get_toolbox ().redraw ((int) x, (int) y, (int) w + 300, (int) (h + margin));- - if (is_unique ()) {- foreach (var deselected in tool) {- if (selected.get_id () != deselected.get_id ()) {- deselected.set_selected (false);- }- }- }-- if (!is_persistent ()) {- var time = new TimeoutSource(200);- time.set_callback(() => {- selected.set_selected (false);- MainWindow.get_toolbox ().redraw ((int) x, (int) y, (int) w + 300, (int) (h + margin));- return false;- });- time.attach(null);- }-- selected.new_selection = false;- });- }- - public bool is_over (double xp, double yp) { - return (x - 7/2.0 <= xp <= x + w + 7/2.0 && y - 7/2.0<= yp <= y + w + 7/2.0); - }- - public bool set_active (bool a) {- bool r = (active != a);- opacity = (a) ? 1 : 0;- active = a;- return r;- }- - public bool is_open () {- return open;- }- - public virtual bool set_open (bool o) {- bool r = (open != o);- rotation = (o) ? Math.PI_2 : 0;- - if (o) {- margin = 35 * (int)((tool.length () / 4.0) + 1) ;- rotation = Math.PI_2; - if (tool.length () % 4 == 0) {- margin -= 35;- }- } else {- margin = 0;- rotation = 0; - }- - open = o;- return r;- }- - public void draw (int wd, int hd, Context cr) {- double lx, ly;- double ih2 = 5.4 / 2;- double iw2 = 5.4 / 2;- - // box- cr.save ();- cr.set_line_join (LineJoin.ROUND);- cr.set_line_width(7);- cr.set_source_rgba (176/255.0, 211/255.0, 230/255.0, opacity);- cr.rectangle (x, y, w, h);- cr.stroke ();- cr.restore ();- - // arrow- cr.save ();- - cr.translate (x + w/2, y + h/2);- cr.rotate (rotation);-- cr.set_line_width (1);- cr.set_source_rgba (0, 0, 0, opacity);-- cr.new_path ();- cr.move_to (-iw2, -ih2);- cr.line_to (iw2, 0); - cr.line_to (-iw2, +ih2);-- cr.close_path();- cr.stroke ();- cr.restore ();- - // separator- cr.save ();- lx = x + w + 7;- ly = y + ih2;- if (lx < wd) {- cr.set_line_width(1);- cr.set_source_rgba (0, 0, 0, 0.2);- cr.move_to (lx, ly);- cr.line_to (wd - w - x + 4, ly); - cr.stroke ();- }- cr.restore ();-- }- - public void draw_content (int w, int h, Context cr) {- if (open) {- cr.save ();- foreach (var t in tool) {- t.draw (cr);- }- cr.restore ();- }- }- -}- }@@ -21,7 +21,7 @@ using Gtk; namespace Supplement { -class TooltipArea : DrawingArea {+public class TooltipArea : DrawingArea { string tool_tip; @@ -15,33 +15,35 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -namespace Supplement { - class UniRange : GLib.Object {- - public unichar start;- public unichar stop;+namespace Supplement {+ +public class UniRange : GLib.Object {+ + public unichar start;+ public unichar stop;+ + public UniRange (unichar start, unichar stop) {+ this.start = start;+ this.stop = stop;+ }+ + public unichar length () {+ return stop - start + 1;+ }++ public unichar get_char (unichar index) {+ unichar result = start + index; - public UniRange (unichar start, unichar stop) {- this.start = start;- this.stop = stop;+ if (unlikely (index < 0)) {+ warning ("Index is negative in UniRange."); } - public unichar length () {- return stop - start + 1;- }-- public unichar get_char (unichar index) {- unichar result = start + index;- - if (unlikely (index < 0)) {- warning ("Index is negative in UniRange.");- }- - if (unlikely (!(start <= result <= stop))) {- warning ("Index out of range in UniRange (%u <= %u <= %u) (index: %u)\n", start, result, stop, index);- }- - return result;+ if (unlikely (!(start <= result <= stop))) {+ warning ("Index out of range in UniRange (%u <= %u <= %u) (index: %u)\n", start, result, stop, index); }+ + return result; } }++}@@ -22,7 +22,7 @@ using Math; namespace Supplement { -class VersionList : DropMenu {+public class VersionList : DropMenu { int versions = 1; int current_version = 0; public List<Glyph> glyphs = new List<Glyph> ();@@ -5,6 +5,7 @@ BIRDFONT = [ 'BackgroundSelection.vala', 'Birdfont.vala', 'EotWriter.vala',+ 'Expander.vala', 'ExportTool.vala', 'FontDisplay.vala', 'CharDatabase.vala',@@ -23,7 +24,6 @@ BIRDFONT = [ 'GlyphRange.vala', 'GlyphTable.vala', 'GridTool.vala',- 'GtkInterface.vala', 'Icons.vala', 'Kerning.vala', 'KeyBindings.vala', @@ -62,14 +62,6 @@ BIRDFONT = [ 'ZoomTool.vala', ] -BIRDFONT_MAIN = [- 'Main.vala'-]--BIRDFONT_EXPORT = [- 'BirdfontExport.vala'-]- PARAM = [ '--thread', '--disable-warnings',@@ -96,7 +88,7 @@ def build (bld): ) bld (- rule = 'valac -C ./src/birdfont.vapi ../src/Main.vala -X ../build/src/libbirdfont.so -X ./birdfont.h --pkg gtk+-2.0 --pkg libxml-2.0 --pkg gdk-2.0 --pkg webkit-1.0',+ rule = 'valac -C ./src/birdfont.vapi ../src/Main.vala ../src/GtkInterface.vala -X ../build/src/libbirdfont.so -X ./birdfont.h --pkg gtk+-2.0 --pkg libxml-2.0 --pkg gdk-2.0 --pkg webkit-1.0', name = 'main_c', target = '../Main.c', depends = 'libbirdfont'@@ -110,7 +102,7 @@ def build (bld): ) bld (- rule = 'gcc ../build/Main.c -I../build/ -L ../build/src -l birdfont -o ${TGT} \+ rule = 'gcc ../build/Main.c ../build/GtkInterface.c -I ../build/ -I ../build/src -L ../build/src -l birdfont -o ${TGT} \ $(pkg-config --cflags --libs glib-2.0) \ $(pkg-config --cflags --libs libxml-2.0) \ $(pkg-config --cflags --libs gio-2.0) \