The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

New icon for glyph version menu

These changes was commited to the Birdfont repository Fri, 13 Mar 2015 20:46:31 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 13 Mar 2015 20:46:31 +0000 (21:46 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 13 Mar 2015 20:46:31 +0000 (21:46 +0100)
commit b3f25e26ef43469f2d2e15753b7bb82eb9698779
tree dc4cbf257c4232381e255534e4dda20f6a714701
parent ee20d8a969d33d58bc08b26f5116197e36e6063b
New icon for glyph version menu

libbirdfont/DropMenu.vala
libbirdfont/OverViewItem.vala
libbirdfont/VersionList.vala
resources/icons.bf
--- a/libbirdfont/DropMenu.vala +++ b/libbirdfont/DropMenu.vala @@ -31,22 +31,17 @@ double menu_x = -1; - bool menu_visible = false; + public bool menu_visible = false; Gee.ArrayList <MenuAction> actions = new Gee.ArrayList <MenuAction> (); const int item_height = 25; MenuDirection direction = MenuDirection.DROP_DOWN; - - ImageSurface? icon = null; public signal void signal_delete_item (int item_index); - public DropMenu (string icon_file = "") { - if (icon_file != "") { - icon = Icons.get_icon (@"$icon_file.png"); - } + public DropMenu () { } public MenuAction get_action_index (int index) { @@ -223,32 +218,6 @@ item.draw (ix, iy, cr); n++; - } - - cr.restore (); - } - - public void draw_icon (Context cr) { - double alpha = 1; - ImageSurface i = (!) icon; - - if (!menu_visible) { - alpha = 0; - } - - cr.save (); - - cr.set_source_rgba (234/255.0, 234/255.0, 234/255.0, alpha); - - cr.rectangle (x, y, 12, 12); - cr.fill_preserve (); - cr.stroke (); - - if (likely (icon != null && i.status () == Cairo.Status.SUCCESS)) { - cr.set_source_surface (i, x, y + (12 - i.get_height ()) / 2.0); - cr.paint (); - } else { - warning ("Failed to load icon."); } cr.restore ();
--- a/libbirdfont/OverViewItem.vala +++ b/libbirdfont/OverViewItem.vala @@ -278,19 +278,24 @@ private void draw_menu (Context cr) { GlyphCollection g; DropMenu menu; - + Text icon; + if (glyphs == null) { return; } + + icon = new Text ("dropdown_menu", 17); + icon.load_font ("icons.bf"); + icon.use_cache (false); + Theme.text_color (icon, "Foreground 1"); + icon.draw_at_top (cr, x + width - 32, y + height - 19); g = (!) glyphs; - - menu = g.get_version_list (); + menu = g.get_version_list (); + menu.draw_menu (cr); menu.set_position (x + width - 32, y + height - 16); - menu.draw_icon (cr); - menu.draw_menu (cr); } } }
--- a/libbirdfont/VersionList.vala +++ b/libbirdfont/VersionList.vala @@ -24,7 +24,7 @@ public Gee.ArrayList<Glyph> glyphs; public VersionList (Glyph? g = null, GlyphCollection glyph_collection) { - base ("version"); + base (); this.glyph_collection = glyph_collection; glyphs = new Gee.ArrayList<Glyph> (); @@ -47,6 +47,8 @@ int current_version; Font font = BirdFont.get_current_font (); OverView over_view = MainWindow.get_overview (); + + font.touch (); index--; // first item is the add new action @@ -60,7 +62,6 @@ return_if_fail (0 <= index < glyphs.size); font.deleted_glyphs.add (glyph_collection.get_current ()); - font.touch (); over_view.store_undo_state (glyph_collection.copy ()); glyphs.remove_at (index);
--- a/resources/icons.bf +++ b/resources/icons.bf @@ -124,6 +124,7 @@ <glyph id="1" left="-28" right="28.419182948490214"> <path stroke="0" skew="0" data="B 28.3602245702,27.4852661412 C 28.3602245702,11.9897661412 15.7036045702,-0.6668338588 0.2081145702,-0.6668338588 C -15.2873664298,-0.6668338588 -27.8309294298,11.9897661412 -27.8309294298,27.4852661412 C -27.8309294298,42.9807661412 -15.2873664298,55.5242661412 0.2081145702,55.5242661412 C 15.7036045702,55.5242661412 28.3602245702,42.9807661412 28.3602245702,27.4852661412" /> <path stroke="0" skew="0" data="B -24.2129884298,27.4852661412 C -24.2129884298,13.9450661412 -13.3320824298,2.9510661412 0.2081145702,2.9510661412 C 13.7483145702,2.9510661412 24.7422845702,13.9450661412 24.7422845702,27.4852661412 C 24.7422845702,41.0254661412 13.7483145702,51.9063661412 0.2081145702,51.9063661412 C -13.3320824298,51.9063661412 -24.2129884298,41.0254661412 -24.2129884298,27.4852661412" /> + <path stroke="0" skew="0" data="S -1.5502645503,33.9444444444 L -1.5502645503,33.9444444444" /> </glyph> </collection> <collection name="contrast_threshold"> @@ -203,6 +204,14 @@ <path stroke="0" skew="0" data="B -13.9189206409,29.7820448026 C -12.8182052940,30.9238346416 -12.1651451095,31.6138629544 -11.9597907386,31.8520682359 C -11.2122914219,32.7720710129 -10.6988982588,33.5688684032 -10.4195931595,34.2424567889 C -10.1321115120,34.9242398125 -9.9883489807,35.6429982004 -9.9883345089,36.3987355703 C -9.9883489807,37.9923122612 -10.5551429633,39.2655419222 -11.6887164567,40.2184281713 C -12.8223116578,41.1712782409 -14.3419737998,41.6477141311 -16.2477028826,41.6477322193 C -16.9705748701,41.6477322193 -17.7673686425,41.5450550338 -18.6380914355,41.3397006629 C -19.5088178465,41.1343245844 -20.4452605506,40.8303921560 -21.4474123118,40.4279033778 M -21.4474123118,37.9143022023 C -20.4616896238,38.4646490219 -19.5375696292,38.8753686175 -18.6750559459,39.1464609891 C -17.8043367708,39.4175063274 -16.9787912157,39.5530561293 -16.1984156628,39.5530706029 C -15.0976966979,39.5530561286 -14.2064348499,39.2450173390 -13.5246301185,38.6289542263 C -12.8346235134,38.0128585521 -12.4896310647,37.2160647798 -12.4896165929,36.2385656733 C -12.4896310647,35.6389026904 -12.6498262873,35.0269314698 -12.9701588454,34.4026483935 C -13.2823184732,33.7865599553 -13.8367897464,33.0308370571 -14.6335726649,32.1354760811 C -15.0525158420,31.6590329565 -16.0793130220,30.5952712661 -17.7139714409,28.9441873919 C -19.3404243681,27.3013017736 -20.6259767385,25.9911076022 -21.5706285522,25.0136012599 M -21.5706285522,22.9189287897 M -9.8897636873,22.9189287897 M -9.8897636873,25.0136012599 M -18.5764815063,25.0136012599 C -16.5721779839,27.0589684206 -15.0196576955,28.6484496015 -13.9189206409,29.7820448026" /> <path stroke="0" skew="0" data="B 3.8241637187,36.7191079258 M 0.1646518685,31.8027954879 M -3.4948599816,36.7191079258 M -6.1686455259,36.7191079258 M -1.2646521795,30.1393816684 M -6.6245423595,22.9189287897 M -3.9507568152,22.9189287897 M 0.0660774290,28.3404288990 M 4.0829152911,22.9189287897 M 6.7567008354,22.9189287897 M 1.5077041864,30.0038427185 M 6.4979492629,36.7191079258 M 3.8241637187,36.7191079258" /> <path stroke="0" skew="0" data="B 17.0821942910,29.7820448026 C 18.1829096379,30.9238346416 18.8359698224,31.6138629544 19.0413241933,31.8520682359 C 19.7888235100,32.7720710129 20.3022166731,33.5688684032 20.5815217723,34.2424567889 C 20.8691372837,34.9242398125 21.0127695691,35.6429982004 21.0127695691,36.3987355703 C 21.0127695691,37.9923122612 20.4459719686,39.2655419222 19.3123984752,40.2184281713 C 18.1788032741,41.1712782409 16.6591411321,41.6477141311 14.7534120493,41.6477322193 C 14.0305400617,41.6477322193 13.2337462894,41.5450550338 12.3630234963,41.3397006629 C 11.4922970853,41.1343245844 10.5558543813,40.8303921560 9.5537026201,40.4279033778 M 9.5537026201,37.9143022023 C 10.5394253080,38.4646490219 11.4635453026,38.8753686175 12.3260589860,39.1464609891 C 13.1967817790,39.4175063274 14.0223237161,39.5530561293 14.8026992691,39.5530706029 C 15.9034182339,39.5530561286 16.7946800820,39.2450173390 17.4764848133,38.6289542263 C 18.1664914185,38.0128585521 18.5114874851,37.2160647798 18.5114983390,36.2385656733 C 18.5114874851,35.6389026904 18.3512886446,35.0269314698 18.0309560865,34.4026483935 C 17.7187964587,33.7865599553 17.1643288034,33.0308370571 16.3675422670,32.1354760811 C 15.9485990899,31.6590329565 14.9218019098,30.5952712661 13.2871434909,28.9441873919 C 11.6606905638,27.3013017736 10.3751381934,25.9911076022 9.4304863796,25.0136012599 M 9.4304863796,22.9189287897 M 21.1113584805,22.9189287897 M 21.1113584805,25.0136012599 M 12.4246334255,25.0136012599 C 14.4289369479,27.0589684206 15.9814572364,28.6484496015 17.0821942910,29.7820448026" /> + </glyph> + </collection> + <collection name="dropdown_menu"> + <selected id="1"/> + <glyph id="1" left="-4" right="43.08994708994711"> + <path stroke="0" skew="0" data="S -4.0000000000,12.2098765432 L 69.2592592593,12.2098765432 L 69.2592592593,0.0000000000 L -4.0000000000,0.0000000000 L -4.0000000000,12.2098765432" /> + <path stroke="0" skew="0" data="S -4.0000000000,24.4197530865 L -4.0000000000,36.6296296296 L 69.2592592593,36.6296296296 L 69.2592592593,24.4197530865 L -4.0000000000,24.4197530865" /> + <path stroke="0" skew="0" data="S -4.0000000000,61.0493827161 L 69.2592592593,61.0493827161 L 69.2592592593,48.8395061728 L -4.0000000000,48.8395061728 L -4.0000000000,61.0493827161" /> </glyph> </collection> <collection unicode="U+65"> @@ -772,6 +781,7 @@ <ligature sequence="i n s e r t _ u n i c h a r" replacement="insert_unichar"/> <ligature sequence="c u t _ b a c k g r o u n d" replacement="cut_background"/> <ligature sequence="u p d a t e _ w e b v i e w" replacement="update_webview"/> + <ligature sequence="d r o p d o w n _ m e n u" replacement="dropdown_menu"/> <ligature sequence="f l i p _ v e r t i c a l" replacement="flip_vertical"/> <ligature sequence="d e l e t e _ b u t t o n" replacement="delete_button"/> <ligature sequence="c o n v e r t _ p o i n t" replacement="convert_point"/>