From bce3a7b0f38a83682ad2793d70cb8941de07c87a Mon Sep 17 00:00:00 2001 From: Evan Battaglia Date: Sun, 7 Oct 2007 21:01:58 +0000 Subject: [PATCH] Cursors! --- ChangeLog | 1 + src/icons/Makefile.am | 15 +++++++++- src/icons/cursor_addtr.png | Bin 0 -> 762 bytes src/icons/cursor_addwp.png | Bin 0 -> 791 bytes src/icons/cursor_demdl.png | Bin 0 -> 958 bytes src/icons/cursor_edtr.png | Bin 0 -> 706 bytes src/icons/cursor_edwp.png | Bin 0 -> 822 bytes src/icons/cursor_geomove.png | Bin 0 -> 783 bytes src/icons/cursor_geozoom.png | Bin 0 -> 860 bytes src/icons/cursor_iscissors.png | Bin 0 -> 1003 bytes src/icons/cursor_mapdl.png | Bin 0 -> 780 bytes src/icons/cursor_ruler.png | Bin 0 -> 713 bytes src/icons/cursor_showpic.png | Bin 0 -> 803 bytes src/icons/cursor_zoom.png | Bin 0 -> 941 bytes src/main.c | 4 +++ src/vikdemlayer.c | 5 +++- src/vikgeoreflayer.c | 8 +++-- src/viklayer.c | 52 +++++++++++++++++++++++++++++++++ src/viklayer.h | 8 +++++ src/vikmapslayer.c | 5 +++- src/viktrwlayer.c | 14 +++++---- src/vikwindow.c | 39 ++++++++++++++++++++++++- src/vikwindow.h | 4 +++ 23 files changed, 143 insertions(+), 12 deletions(-) create mode 100644 src/icons/cursor_addtr.png create mode 100644 src/icons/cursor_addwp.png create mode 100644 src/icons/cursor_demdl.png create mode 100644 src/icons/cursor_edtr.png create mode 100644 src/icons/cursor_edwp.png create mode 100644 src/icons/cursor_geomove.png create mode 100644 src/icons/cursor_geozoom.png create mode 100644 src/icons/cursor_iscissors.png create mode 100644 src/icons/cursor_mapdl.png create mode 100644 src/icons/cursor_ruler.png create mode 100644 src/icons/cursor_showpic.png create mode 100644 src/icons/cursor_zoom.png diff --git a/ChangeLog b/ChangeLog index e1aa0183..b2a87905 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2007-10-07 Evan Battaglia : * Scroll zoom keeps cursor over same spot on map (like Google, QLandKarte) + * Cursors for tools. Quy Tonthat : * Correctly calculate position (based on time instead of distance) diff --git a/src/icons/Makefile.am b/src/icons/Makefile.am index ff2f1aa0..d93f409f 100644 --- a/src/icons/Makefile.am +++ b/src/icons/Makefile.am @@ -95,7 +95,20 @@ ICONS = \ zoom_18.png \ iscissors_18.png -ALL_ICONS = $(ICONS) $(WAYPOINT_ICONS) +CURSORS = \ + cursor_addtr.png \ + cursor_edtr.png \ + cursor_geozoom.png \ + cursor_ruler.png \ + cursor_addwp.png \ + cursor_edwp.png \ + cursor_iscissors.png \ + cursor_showpic.png \ + cursor_demdl.png \ + cursor_geomove.png \ + cursor_mapdl.png + +ALL_ICONS = $(ICONS) $(WAYPOINT_ICONS) $(CURSORS) EXTRA_DIST = $(ALL_ICONS) BUILT_SOURCES = $(EXTRA_DIST:%.png=%.png_h) icons.h diff --git a/src/icons/cursor_addtr.png b/src/icons/cursor_addtr.png new file mode 100644 index 0000000000000000000000000000000000000000..5bd4d5948807379764af492dac80cce25b6e212b GIT binary patch literal 762 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwei(SOR(%p7u0Z`~riEBiObAE1aYF-J0MzW@Yk%57M zf>&a8X_A7vS7vT*VzRnIa7k)rUTP5+S4c)?u|j5UVtT4Vd1A3ba#3nxNotBhX>n#= zx`KOVZh;<{Q~;_68D<}H5IO#T`Q6$23$APomfa=#JwdUKL;d!;zS4q1 zkKp53;`=c0`#UYUb9#tqcCCn?arv{S*8!2_Qt6* zthcPo*C;IB8FOm3{o;!rdWWaKT3g=Bc9N0dY~&_42Njb(FM;e0_iF6e8E$OjW#G?T zDQYb(Vm*7Z*d2pqZyKLRl-Ga%U8^I;&Em+waJ|xJ-qRgQCyU))&TVFN;6BivQ+mdvoz!`&yAVO_~DRqX7#PTwcATBa68X#v}RyPXH1E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J$YldV^lhGJ>y0a))*WYHT4B!bueEb?K%1ihr^EuU{wpsz z7YMWnvNLU4EU~|;edlq1D=o)2J971GnHBoo=UMG!V5>R7I$^cbeY+=jZFc@iWov7* zW(v?1X<(9L*w&K8u!^lBV9t*A#Hb&2dlw6xh%{fbw)$RpBD2)4zf&2Tm4z8<{{7Iq z$iuKAFVdQ&MBb@06aB~jQ{`u literal 0 HcmV?d00001 diff --git a/src/icons/cursor_edtr.png b/src/icons/cursor_edtr.png new file mode 100644 index 0000000000000000000000000000000000000000..4b28d30e6b2a4eae628a153c918f7f9c53fc479c GIT binary patch literal 706 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwei(SN6<6LEeCs626iEBiObAE1aYF-J0MzW@Yk%57M zf>&a8X_A7vS7vT*VzRnIa7k)rUTP5+S4c)?u|j5UVtT4Vd1A3ba#3nxNotBhX>n#= zx`KOVZh;<{Q~;_r-V~n-ahl<;pyR#o&0jsl`yBbe?rQ7mhL`Mc&_~Y#`Vm94i_c` z&)HU(%A2q?DzbHf&H1%X0rQ@RDY7)^c5pTDcE~pDQ(VGO>!iWx<7gq&aErCauwtHi zboM$X&q)C*y+6%(Eg-W(?b>V8M;2@hJJxky%s8_7*~gqEOs;_(>uc|ehjKJEFxb4Q z+#c|n_4LzCdmdD8jF^&J@m|T!*Hd*J%kSR?Jck297!SCK9}qwJ{Mn>>=2M$`B$DTP zMKU|YuC3JCTXQ?C#-_WYBg3X!t4SuyqVq(Av39qA@G6$`QRWRN0@U=hE!izDDBAgQ z+RvA_u(3OQnzf+rbI0Y^)(i(;FHK&P?PWeyrC9gxLe2$mKi;-%V`dhQdi&s>yydf) zz_0^PE(UjUum3GD{Viwe>AR=*ud~a)_fC4N%v?!+b-`_i_^M=jQ?He^L{;4TS-pSX Xovm{kW(foUlNN)gtDnm{r-UW|NBI$z literal 0 HcmV?d00001 diff --git a/src/icons/cursor_edwp.png b/src/icons/cursor_edwp.png new file mode 100644 index 0000000000000000000000000000000000000000..d8f1f8ff7cf1a985941d4931d0ed354adfaec745 GIT binary patch literal 822 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwei(SNA@$yO8mq4LIC9V-A&iT2ysd*&~8p)apMg|53 z3SNoXrAZ3vUYWVMiOK2;!6m7gd8tKQTp<~m#R{3ZiRq~d<%z`#$wjG&C8;S2rNx~3=E84JzX3_A`YLOw$V%5QKap^V6@{m#%W8sTPJ8aDg0G!+WtXMO>CB$ zt4?iGL_|gIp6y=Kwa&IyHZ?R&Fqu`N7_mNS>%+J|xkiWI?2_J;X8!s>qrund2vZ8H zq7uV2K8gP08q-e)CU5@iu>bz@Qm-s)@8pAPcl4c1X^LCV&Y&UIT@V}oKI*own%s=@ z&)r@}txek#u>Lyd1Eq&^4;^7R{P2R@k2`P6awY$%%{;v~DQUuo^JmjGXYOHmV5-@$ z?Zcg5BO~r}PPg7MR><(M709qJ4bt@da(VBsJs%^zS)OsQCt7Tn$M9!W*y^f}mrG6K z9SXm%m|Vx;ebk&`jfoYbMs(K%m5-S}j&5RRDBqsT&=4XL6nG}eX?NY%;)J6OSGifO z`26&I|DNYxT*=_#z42V$ea1iRADAA*FTJSf874LNyXd2XCpPRoXR9R2nQ;By&%3$N zG7LNZ*X}EMvqp7>*MrQ-UBxRs-gf?dY_@olvdCW_YwiqZ57&Qt>K265^m^K+P3)S| zr6W7f?e2ovmEn3x&EFg(9C<2XMgboFyt=akR{065lGA^-pY literal 0 HcmV?d00001 diff --git a/src/icons/cursor_geomove.png b/src/icons/cursor_geomove.png new file mode 100644 index 0000000000000000000000000000000000000000..09a8a73c938851ac411bea3a6e4056b32f38ff28 GIT binary patch literal 783 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_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^KiB|9pT1VyqFwW4 z)1&n)+Ya|$dH!s{)%y)qsejt~VhZgUW~`2%b>l)&-RZ#Z^S3OV{z&J}o9UO%ufNCt z_U$!Z{%_fy55xbyU$FOXnXLIK5$%6p*JjOn`zzOF%?D$}8KNv{yXU=-p6ArDmc3~G f?{lgSKNyyKFZQ3pE4&k!=ovg+{an^LB{Ts59hzFT literal 0 HcmV?d00001 diff --git a/src/icons/cursor_iscissors.png b/src/icons/cursor_iscissors.png new file mode 100644 index 0000000000000000000000000000000000000000..2f5b072a4727ff7433ac600848024c2f8a8c39db GIT binary patch literal 1003 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwei(SNw_1nc0l|Z3GC9V-A&iT2ysd*&~8p)apMg|53 z3SNoXrAZ3vUYWVMiOK2;!6m7gd8tKQTp<~m#R{3ZiRq~d<%z`#$wjG&C8;S2rNx~3=B-GJY5_^A`YLOcF5OM?>A(%2f_z02FR zYuBIH-;XQ3WeQ@qhrQmnZ{IBLzkmNS$^BRT$7m35o|MiM5gGYWm+i;2^Us@8D~i3| zc;DU@s{ddmqxI$M7s8b$dR&QN*f(F`yU(PY+xKLoq;9czrG58g{iGMiwRQl(orER`_V0n(&ZrM5KQ;e(+EKXxS;}w*yVkFAf-aSdA|9E)g(F&V=TAmLJ zcHEHc^pSK=b6&eavBdBTcL}G${PXLX&CiHlSh~1$R+WJ4<$wPiLlzyrBgeL0NcQ({ z_KVBZc(z<>&kwei(SN2XTBfvHK5R;64!_l=ltB<)VvY~jbu#)BLf2i z1+T>H(j*0Sugu)s#AJ1a;F8qLywoBtu8@q(Vuj4y#Pn2!^2B0=9W=>*KPAXSgevv{-etBL_eqxG3Vu?aVNlAf~zJ7Umxn4TR z&itZuwBVao z1o)D89}3;PHYo%cjAFhQuPoCL)I4(W!i`I1e(M$ATdcSKf3NiK1M@q!_kP#j`~Lm; zLHjM0`pw;a>nqqUWSH2r3anaH#ibY$`c=e<{R7t`?gQK%@eK96iJTv%3v6S^bMz2n zur)WC?R)6qhO2SkMKq?LK4hS3dcRERLCamI)mIlq=r9RzwQ{gE-&$*GU+mggwtMY! zE2-XBT1OriGRo|@$NIG@cCy5S#Q_=;mkX>PB%5_ai!Xe+U+46vOugyM2i||LXACYo z*c$XI{_E!K*!gyscjcUV>ufh)eX5rr2MdE*wQO8jm7}nf7 zd!hWW#VH9@v#3pzE;iqPqZ7I9;f|wfnT=W3)pvby`}uq8!xQUYD14G$TCUCNynW&M zlMj@8lIE}!q=@vVF78Qke-qm=aengox6+4aq~6k5;j$5!NEtj`{an^LB{Ts5lHE8P literal 0 HcmV?d00001 diff --git a/src/icons/cursor_ruler.png b/src/icons/cursor_ruler.png new file mode 100644 index 0000000000000000000000000000000000000000..1c34ad86ce95f633f3915ae832e44f15c8e455d7 GIT binary patch literal 713 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwei(SN&W3lgZcA(Iq64!_l=ltB<)VvY~jbu#)BLf2i z1+T>H(j*0Sugu)s#AJ1a;F8qLywoBtu8@q(Vuj4y#Pn2!^2B0=9W=>*KPAXSgevv{-etBL_eqxG3Vu?aVNlAf~zJ7Umxn4TR z&itZuw8G0Xf5IO$;x_^MRWoz0*F20*ft2-B5SbxE_YxUyI z&DnzA^CVR`oa`N6Dydv}xT&;YTF=QZF?*_fi!vuYtEwtsndJR%|M!3IMZHhMnZ95im%zMtrkaN2&HBu?daK7}mU!PbrXXWjc<7>aIvtyk% zgB;(?wwr(2Y|r(;IXW5cF+P$?>5j_|$c3*KWk@iQVmy#~_{2r& zp8EVF*-K?FH*IFro$mc;POvC{_a!}dzmL1Vm8S(gy>Iq0hT+7cyRVmjidE>fUim5h z)e>2TBVV6<;aO8X@wL3H>|T}EJH7UpHk@oKF#dhQ^`3N(_t8?9bzkb>!`xLd2=6)WZ)DV}O^`R&dRQSO41R-Np~c)Y#(Z~Kj$>fGDU hy#%C{{@nh^tGsW$;ktgi24D(f@O1TaS?83{1OPK+AUyy8 literal 0 HcmV?d00001 diff --git a/src/icons/cursor_showpic.png b/src/icons/cursor_showpic.png new file mode 100644 index 0000000000000000000000000000000000000000..c97f41aa731cee9eb2391997665cc2e5b891b283 GIT binary patch literal 803 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwei(SOTm^;=!2`F@^#5JPCIX^cyHLrw0BUw|y$iTor z!7DMlG)Y0-D>FAYF`zGSY2sWf zB6cewDRC*QC};1&B<|a*&m47o+7X!1+u7RNdopk>>zij0-|Qw>pYvRHqyOgjvS)8) z82(@2@@(3?^Szqefo*SHJPnQ)3aK8HIqo^7MPY(SCo7ZZgb1Y#nL=JnvsE5?D(DGm zvNGOp_*l^sv~o#TuRe40!G@i?RK8b%tChI7M)fjUl;&UKOuX}S=YoyZd5s4OES_kxHT1`=f3A0U?r(+5CNnc<@ibVN zyt(o8)OyA3Zi_DpL^6EP6%NQqR-HaIW_ngM!-uR$F{7D0pMLHM*zd=&S(BAv%lv%> zoBnPtxN!9IwDh_8=f53HP8B?LsEWBDc4dgg55f2in!YbvG#LLLcxtww^+t)!cZX<3 ziyx9~GyOPrXPMQ0w~2V4QMzm2dcWxBXQkRUvUtS%7^)q;S+)AI>+b~p5bZciZnLEa z9;$j=3~1W@+~v-5Tk%9KS=aB65>{>8qc(fnIyN4!spj8z)vl2e$kcy-M(vbb<8zfH zUK_R?8P7syC6fh;e$uK}+1(x_GVxF8o+Eu&mx77bM)}DXVsgF_ND|h|n WRZZU&&UgaTE`z75pUXO@geCw5heRL% literal 0 HcmV?d00001 diff --git a/src/icons/cursor_zoom.png b/src/icons/cursor_zoom.png new file mode 100644 index 0000000000000000000000000000000000000000..243849db081fc402e9b6bd27d01ba25b8e0126d5 GIT binary patch literal 941 zcmV;e15*5nP)UFWod3@ataDmXlZjGX>DO= zWgvH9b0A}KWnpw>WFU2OX>MmAM`>+vE+9u~ZEzrIb0B7NWo009Z)S9NVRB_43Sn~~ zWMyV)Ze?U3VtF8RXk{Qqa%E*8Q*UN;cVTj6AVzO>Ze(F}X>V>IVQyp~X>%Z9c4293 zVPb4$3TAI|AY^ZMZftL1WFTR5AZT=Sa5^t9cXxL#XK8J4E^l&YMp_mN0007PNkl~WaKA&%8czAdmhy&{fi5h?#{r&x42L}g}-QC@%HBHkM zMNusli?rMA#}q}`ky5T}nzoZjB-(-4K_UgX)YH>5*V);5#%8lMnWkAPm&--NFn;H9 zx%ArFTE^*g+5&;V9N<4}GzGXWgxJ);c&a%Cxj3-RaF~Osno~W*;)6*#KZ&OGH?X= zbX4aW23ZMt+M*=p-yhOTrN2}Ix1&oW~9&OlfbEZWfG7>LqjqejY@~ZA%V7f zL>KqVrl+U(#ynn+?Ao3z7!1mAIJ_sTi}QeVyWLU #include +#include "icons/icons.h" + VikLayerParam georef_layer_params[] = { { "image", VIK_LAYER_PARAM_STRING, VIK_LAYER_NOT_IN_PROPERTIES }, { "corner_easting", VIK_LAYER_PARAM_DOUBLE, VIK_LAYER_NOT_IN_PROPERTIES }, @@ -57,10 +59,12 @@ static gboolean georef_layer_zoom_press ( VikGeorefLayer *vgl, GdkEventButton *e static VikToolInterface georef_tools[] = { { "Georef Move Map", (VikToolConstructorFunc) georef_layer_move_create, NULL, NULL, NULL, - (VikToolMouseFunc) georef_layer_move_press, NULL, (VikToolMouseFunc) georef_layer_move_release }, + (VikToolMouseFunc) georef_layer_move_press, NULL, (VikToolMouseFunc) georef_layer_move_release, + &cursor_geomove }, { "Georef Zoom Tool", (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL, - (VikToolMouseFunc) georef_layer_zoom_press, NULL, NULL }, + (VikToolMouseFunc) georef_layer_zoom_press, NULL, NULL, + &cursor_geozoom }, }; VikLayerInterface vik_georef_layer_interface = { diff --git a/src/viklayer.c b/src/viklayer.c index 83547187..d7a6c047 100644 --- a/src/viklayer.c +++ b/src/viklayer.c @@ -743,3 +743,55 @@ static gboolean layer_properties_factory ( VikLayer *vl, VikViewport *vp ) return FALSE; } } + +static GdkCursor ***layers_cursors; + +GdkCursor *vik_layer_get_tool_cursor ( gint layer_id, gint tool_id ) +{ + if ( layer_id >= VIK_LAYER_NUM_TYPES ) + return NULL; + if ( tool_id >= vik_layer_interfaces[layer_id]->tools_count ) + return NULL; + return layers_cursors[layer_id][tool_id]; +} + +void vik_layer_cursors_init() +{ + gint i, j; + layers_cursors = g_malloc ( sizeof(GdkCursor **) * VIK_LAYER_NUM_TYPES ); + for ( i = 0 ; i < VIK_LAYER_NUM_TYPES; i++ ) { + if ( vik_layer_interfaces[i]->tools_count ) { + layers_cursors[i] = g_malloc ( sizeof(GdkCursor *) * vik_layer_interfaces[i]->tools_count ); + for ( j = 0; j < vik_layer_interfaces[i]->tools_count; j++ ) { + if ( vik_layer_interfaces[i]->tools[j].cursor ) { + const GdkPixdata *cursor_pixdata = vik_layer_interfaces[i]->tools[j].cursor; + GError *cursor_load_err = NULL; + GdkPixbuf *cursor_pixbuf = gdk_pixbuf_from_pixdata (cursor_pixdata, FALSE, &cursor_load_err); + /* TODO: settable offeset */ + GdkCursor *cursor = gdk_cursor_new_from_pixbuf ( gdk_display_get_default(), cursor_pixbuf, 3, 3 ); + layers_cursors[i][j] = cursor; + + g_object_unref ( G_OBJECT(cursor_pixbuf) ); + } + else + layers_cursors[i][j] = NULL; + } + } else + layers_cursors[i] = NULL; + } +} + +void vik_layer_cursors_uninit() +{ + gint i, j; + for ( i = 0 ; i < VIK_LAYER_NUM_TYPES; i++ ) { + if ( vik_layer_interfaces[i]->tools_count ) { + for ( j = 0; j < vik_layer_interfaces[i]->tools_count; j++ ) { + if ( layers_cursors[i][j] ) + gdk_cursor_unref ( layers_cursors[i][j] ); + } + g_free ( layers_cursors[i] ); + } + } + g_free ( layers_cursors ); +} diff --git a/src/viklayer.h b/src/viklayer.h index cfb5a5ee..26ce4464 100644 --- a/src/viklayer.h +++ b/src/viklayer.h @@ -97,6 +97,7 @@ struct _VikToolInterface { VikToolMouseFunc click; VikToolMouseFunc move; VikToolMouseFunc release; + const GdkPixdata *cursor; }; /* Parameters (for I/O and Properties) */ @@ -328,4 +329,11 @@ VikLayer *vik_layer_get_and_reset_trigger(); void vik_layer_emit_update_secondary ( VikLayer *vl ); /* to be called by aggregate layer only. doesn't set the trigger */ void vik_layer_emit_update_although_invisible ( VikLayer *vl ); +GdkCursor *vik_layer_get_tool_cursor ( gint layer_id, gint tool_id ); +void vik_layer_cursors_init(); +void vik_layer_cursors_uninit(); + + + + #endif diff --git a/src/vikmapslayer.c b/src/vikmapslayer.c index a1ee1a5b..51944153 100644 --- a/src/vikmapslayer.c +++ b/src/vikmapslayer.c @@ -58,6 +58,8 @@ #include "mapcoord.h" #include "terraserver.h" +#include "icons/icons.h" + /****** MAP TYPES ******/ static GList *__map_types = NULL; @@ -114,7 +116,8 @@ enum { PARAM_MAPTYPE=0, PARAM_CACHE_DIR, PARAM_ALPHA, PARAM_AUTODOWNLOAD, PARAM_ static VikToolInterface maps_tools[] = { { "Maps Download", (VikToolConstructorFunc) maps_layer_download_create, NULL, NULL, NULL, - (VikToolMouseFunc) maps_layer_download_click, NULL, (VikToolMouseFunc) maps_layer_download_release }, + (VikToolMouseFunc) maps_layer_download_click, NULL, (VikToolMouseFunc) maps_layer_download_release, + &cursor_mapdl }, }; VikLayerInterface vik_maps_layer_interface = { diff --git a/src/viktrwlayer.c b/src/viktrwlayer.c index 3f665b8a..b6c815f5 100644 --- a/src/viktrwlayer.c +++ b/src/viktrwlayer.c @@ -44,6 +44,8 @@ #include "osm-traces.h" #endif +#include "icons/icons.h" + #include #include #include @@ -268,26 +270,26 @@ static void track_convert ( const gchar *name, VikTrack *tr, VikCoordMode *dest_ static VikToolInterface trw_layer_tools[] = { { "Create Waypoint", (VikToolConstructorFunc) tool_new_waypoint_create, NULL, NULL, NULL, - (VikToolMouseFunc) tool_new_waypoint_click, NULL, NULL }, + (VikToolMouseFunc) tool_new_waypoint_click, NULL, NULL, &cursor_addwp }, { "Create Track", (VikToolConstructorFunc) tool_new_track_create, NULL, NULL, NULL, - (VikToolMouseFunc) tool_new_track_click, NULL, NULL }, + (VikToolMouseFunc) tool_new_track_click, NULL, NULL, &cursor_addtr }, { "Edit Waypoint", (VikToolConstructorFunc) tool_edit_waypoint_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_edit_waypoint_click, (VikToolMouseFunc) tool_edit_waypoint_move, - (VikToolMouseFunc) tool_edit_waypoint_release }, + (VikToolMouseFunc) tool_edit_waypoint_release, &cursor_edwp }, { "Edit Trackpoint", (VikToolConstructorFunc) tool_edit_trackpoint_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_edit_trackpoint_click, (VikToolMouseFunc) tool_edit_trackpoint_move, - (VikToolMouseFunc) tool_edit_trackpoint_release }, + (VikToolMouseFunc) tool_edit_trackpoint_release, &cursor_edtr }, { "Show Picture", (VikToolConstructorFunc) tool_show_picture_create, NULL, NULL, NULL, - (VikToolMouseFunc) tool_show_picture_click, NULL, NULL }, + (VikToolMouseFunc) tool_show_picture_click, NULL, NULL, &cursor_showpic }, { "Magic Scissors", (VikToolConstructorFunc) tool_magic_scissors_create, NULL, NULL, NULL, - (VikToolMouseFunc) tool_magic_scissors_click, NULL, NULL }, + (VikToolMouseFunc) tool_magic_scissors_click, NULL, NULL, &cursor_iscissors }, }; /****** PARAMETERS ******/ diff --git a/src/vikwindow.c b/src/vikwindow.c index eae61d96..1b098ab1 100644 --- a/src/vikwindow.c +++ b/src/vikwindow.c @@ -62,6 +62,7 @@ static void newwindow_cb ( GtkAction *a, VikWindow *vw ); static gboolean delete_event( VikWindow *vw ); +static void window_configure_event ( VikWindow *vw ); static void draw_sync ( VikWindow *vw ); static void draw_redraw ( VikWindow *vw ); static void draw_scroll ( VikWindow *vw, GdkEventScroll *event ); @@ -169,6 +170,9 @@ static guint window_signals[VW_LAST_SIGNAL] = { 0 }; static gchar *tool_names[NUMBER_OF_TOOLS] = { "Zoom", "Ruler", "Pan" }; +GdkCursor *vw_cursor_zoom = NULL; +GdkCursor *vw_cursor_ruler = NULL; + GType vik_window_get_type (void) { static GType vw_type = 0; @@ -228,6 +232,7 @@ static void window_finalize ( GObject *gob ) G_OBJECT_CLASS(parent_class)->finalize(gob); } + static void window_class_init ( VikWindowClass *klass ) { /* destructor */ @@ -285,7 +290,7 @@ static void window_init ( VikWindow *vw ) g_signal_connect (G_OBJECT (vw), "delete_event", G_CALLBACK (delete_event), NULL); g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "expose_event", G_CALLBACK(draw_sync), vw); - g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "configure_event", G_CALLBACK(draw_redraw), vw); + g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "configure_event", G_CALLBACK(window_configure_event), vw); gtk_widget_add_events ( GTK_WIDGET(vw->viking_vvp), GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK ); g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "scroll_event", G_CALLBACK(draw_scroll), vw); g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "button_press_event", G_CALLBACK(draw_click), vw); @@ -377,6 +382,13 @@ void vik_window_set_redraw_trigger(VikLayer *vl) vw->trigger = vl; } +static void window_configure_event ( VikWindow *vw ) +{ + g_print ("debug\n"); + draw_redraw ( vw ); + gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw_cursor_zoom ); +} + static void draw_redraw ( VikWindow *vw ) { VikCoord old_center = vw->trigger_center; @@ -1089,9 +1101,11 @@ static void menu_tool_cb ( GtkAction *old, GtkAction *a, VikWindow *vw ) if (!strcmp(gtk_action_get_name(a), "Zoom")) { vw->current_tool = TOOL_ZOOM; + gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw_cursor_zoom ); } else if (!strcmp(gtk_action_get_name(a), "Ruler")) { vw->current_tool = TOOL_RULER; + gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw_cursor_ruler ); } else { /* TODO: only enable tools from active layer */ @@ -1101,6 +1115,7 @@ static void menu_tool_cb ( GtkAction *old, GtkAction *a, VikWindow *vw ) vw->current_tool = TOOL_LAYER; vw->tool_layer_id = i; vw->tool_tool_id = j; + gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vik_layer_get_tool_cursor ( i, j ) ); } } } @@ -1928,3 +1943,25 @@ register_vik_icons (GtkIconFactory *icon_factory) gtk_icon_set_unref (icon_set); } } + +void vik_window_cursors_init() +{ + GdkPixbuf *cursor_pixbuf; + GError *cursor_load_err; + + cursor_pixbuf = gdk_pixbuf_from_pixdata (&cursor_zoom, FALSE, &cursor_load_err); + vw_cursor_zoom = gdk_cursor_new_from_pixbuf ( gdk_display_get_default(), cursor_pixbuf, 6, 6 ); + + g_object_unref ( G_OBJECT(cursor_pixbuf) ); + + cursor_pixbuf = gdk_pixbuf_from_pixdata (&cursor_ruler, FALSE, &cursor_load_err); + vw_cursor_ruler = gdk_cursor_new_from_pixbuf ( gdk_display_get_default(), cursor_pixbuf, 6, 6 ); + + g_object_unref ( G_OBJECT(cursor_pixbuf) ); +} + +void vik_window_cursors_uninit() +{ + gdk_cursor_unref ( vw_cursor_zoom ); + gdk_cursor_unref ( vw_cursor_ruler ); +} diff --git a/src/vikwindow.h b/src/vikwindow.h index 24d20f57..d7b32d56 100644 --- a/src/vikwindow.h +++ b/src/vikwindow.h @@ -57,6 +57,10 @@ void vik_window_selected_layer(VikWindow *vw, struct _VikLayer *vl); struct _VikViewport * vik_window_viewport(VikWindow *vw); void vik_window_set_redraw_trigger(struct _VikLayer *vl); +void vik_window_cursors_init(); +void vik_window_cursors_uninit(); + + G_END_DECLS #define VIK_WINDOW_FROM_WIDGET(x) VIK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(x))) -- 2.39.5