g3data-1.5.3/0000755000076400007640000000000011121140706012602 5ustar jfrantzjfrantzg3data-1.5.3/test2.png0000664000076400007640000002645111120723752014372 0ustar jfrantzjfrantzPNG  IHDRX\ٿgAMA aPLTE  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~]}8tEXtSoftwareXV Version 3.10a Rev: 12/29/94 (PNG patch 1.2).I IDATx|ڇ@hPRAP(Q*x k(*"4D $:;S6lsf>;aO<=;;; I_%,P$x@B %)Q5\.2bIR(Xbш%Xs,K"4H,l74-P{Cs,l7#U5!C#6hc!A `E(] dh Zca!A ސXؠjoP"$K]!%Xt@ ͱA ސXؠjoh Z&ؠjoh ZBc?k0B&ؠjoh ZXؠjoz,l74ba96h6h6hca96hԗBK"4l7Y!6h: Z-P{Cs,l74ba!A Йwl7$6h: Z-P{Cwl74bafA лBl7$6h @ MޱA зtA Ј ZN7` A G:ؠjot6h @ }@ ͱA ޠn $Kμc @ +-P{CbwؠjoH,l74-P{Cs,l7t@ b;6hH@ ] Z^ A NEbyIh#, ਢ4h!rؒŤU1?3ojc6ޱO^ [똩%ڗJh<ئ, e?NsldGZVKa0M^A)Cb9[o+0<K,X٠u|<ĪJM ]a-4Lk[uBUnM>n<_LvU8b}=b"3w+XIZ#Xj2}H,4~5D/SXH=|9=MhvAxoV>lDKܪ}GE,ӿCbPxa'#J6kvU1 (X4yW :EM,c)]X}?QPP=ϨlVܨpˆ%XbrzTcW^x^0bшtA4*Ăzpٗ[kY@%K '^*: X=>Lfq+N2f$$$Wuqk8<#ا0vyZVƶ}G<ˆlI2ibh{eG2TB9˭(b1z)Ti&)b}wfI1pjy߷D:2>UNr+(XtT &TǷOXfrz+=n*fgzȣ: wKMPƾYk/R=~iٕwQϓٱ`Qbݱ# +XjXKC[X`l,;| ؾ=[DN7]@`wS? 5 &+g\vDX_XGab$ Crm!hx-W+(1(Xj2}jX\PW9V}slܸk<Ɩ4F36b1.Ph.hނ [Ļ}R k,V홇ߍvwkqaœڹSYYV2αaC7V|VXrO.z3W+'HϕtaJ_9`I2Gm+ҬD;*3SW/X#:uze<֩SZ VV!XXm 4ֱjĪ6e{|4JDKMPZ,hUӡOv𘺙Ī.^/n| /^ _ I߀x"&hДћH,#? x =-S㨚dK,GjfCu9'Xj2A:"׻&ioo|UL @NgEmVE#څ13zQ*4CFb E,.POA dX.5wF,.oKע1)0@  XIZ~"6qĢXRWkјeH,}Ƥ-P$/zAh%J%!X4bI\cjՀҵhL :X$EcR`/zB!t-@}o% ڽNT:4sONi[I,'?oET^ "4B3` #Rj9?z% [I, fD o:6F]/x7x͕cQ!XYP;حݎ{:hrV oRXpރnc>IZȭnc傈FZw=FH,&{`4Ľk2gt+M&Q%P0b[D,B#k %yGih4 o倛KX#pb!TDKPZ9rFLb)D7bX9($~*S$c9\b-sz|+n KtҥX\>ֶ8uF"V\=QxEgt 4ڤnab/CdbU\]Q 0Jk$wkX=}{wР1X@U4$j,rGa5~=|@q* qB;|EX\A^欏j,·Zp^8QWPs~FڈuMwI+59X/rwM~m *VwlG$[h?z s b1ˡ Mc95ihݵ7מ_ Rϫa/!G,z]cA_Wꦰ+G,ܫv*h&Ua.ч4tytDKHƺe^&IodڦpK:_ ?QĢ.C\S@E,^[ZDQ3E,.D>\ \xA!t-@yAAߗXIA`{^U t-;둖MG,:A*1-RM`"K;qM17&]_ QĢK++ xl ' XF, .}(k '!X4b]p%[i%XZ^3No|bGVe Y(bшv$QhҺ*(4bi]p!B7r$EcR`C}^u=t t-̏Po{yҵhL t36pG;∅vߺLiI~>_%Z':\~A)H[h_rⵀ!h}"H.NVKf[v Ϡk∅5rՒ4 mo6>44Z XX#ߙ'eUnG$[@ޏl%Zg#a'bb';59R;%k5Qxe8& bj3_ι{8%iߣHP5~3šp2e<ɾjTDڈ^˧rݏ4mp2T Xx#֚JFUr3" &-SkE,7|퐤8s‹uuQhߔ{/-PE,VS2@-Gje3/4!u;nAE,B'"u{g a(bkyg a(b;مAj5 ffEKbn`o 9;*6X{nu!lGx#. $Š0?إ ak19'v[qĪissyEbЈpb]DKHƾbm{wQĪ#O- rl. Uh$ʢʲ$?̹jJ^/B X#։G">D b2E&HvڤZ6ȧWZ~b} ~,h Ϩ-kcC>%Xم!r@$r/sު3q:A:wӒ~fď<\ aC%S  m.sQ Ԙj6Gd@%9F(ֺVpI]-nǍv`V4\+qƸ_T b ]j%r3 k:};D/Oc t=Z~spJ+ukyR-P ?d*oE=b;#X VzS7v aC@n6\ܻAw,# W7Y.߹jro1RhZ(b0tqO+\ -PE0kqh8#pH,#}!jPNpeQ F rDKHƾY*laQ +/@ˣj9Uh$c߇,$b-}e Q {_-P!t-rBʿ{:Kb6|`:#3s\S#mc=]KJ^uF"TH,Τ`QUKKbP.tּ{*օAl:Z+.]˖#֞ck10 v-~kk#$ -[6ޅҵXW)Mj6wTqt!l t-?[:45rwm[G4薆Rnq5ʽܢ^z_^R}t!lE,&UuבjWӒ @ rDKxƛoRfQ.sXhZ(b1!GݠHmВ @ rD w:%?/u8~p~~Xgr\H_ S]Qb#DY3V=k1-P c<,|[s*W\gQ5_j9a)ֱ?yyByywwÉ* ˝ƕR%߶fX2+Q#x!VarXپ*@ r+H';ǀEba"Xf^AZ󨢸a@-GL}Cp}(b1yJP Q[:!-PE,&tBZ#X4b]DKHƾZDF, a(bi!#B(bшv!l t-@-ҵhL Kע1)0@ rH,]Ƥ-PG,:.X$6hZkјj9$EcR`XIZCbZ4&hZkјj9eyW|Lro {"z`fF,fˆ~"e_i)lQ.T% L3ja2aZY:'@v/*5A,?bMwԿ|u*/Ŋ 3JʉCLF,33J:wQƞ?27;C5|?30v6xYb\-f XQr3ղRReYFcpq(b0b)w:wM!]Ua0[])B(c]Qk,%ІSɋi02Hbl;$0`@]m3(0?N ͆ajY_b}DF?X,yʒ  ԲGx1u8WKʳ0\^| hv3)0вb=VWni?⵲ޮn?Cm,܏`/ qIDAT`/}ceeǕ0{iLA2epd"T!V!X:u}s/bUPZPPTEϛPq{WVPp@>))((6nƊ J-:bɕU/coqo8x9P(2Py;@mA@ͩaFe 1'3&n5!'8EZ#HIIaN{pkc#nM*0MIk bXN**omX/nbIopqZeX*+,;$:,IU5ϰK*ͭ86/|Y{UOͩ-fY~k X;fWfuVqaKǻjFoXbj.гRBSʼQx=wyX|$/Bmݶi|6@;}]fS4~j3?~a$ͼ;ҕaVλDc>LnSwT˧4Mބ$y54}a*\6y(#΃lI10y7|nK7Zuro~"-W:>~|[+qݲGX6r:% 亹X'z#il3qΐ>) ~`CV#X U u%iq8pEb"ɏX$r\6}:dH]Y,>:WB JOer*Xƒ=^bb!$wSk3\AwՂ=SI9W]6>E4Lss*_,N&JQޭ{6Gi풓oQjW ck 랜|Ng:zEs$&K%a@rDms5qFG\䮱~0̩#1OkVbM琖z?bGKȣX|~!M_?9}ŻVMXy}fwsKy &p9G~}2ݷṮ =α)0WŒi ωVV+&S7z˵MyK0m9VpbuR | _ڧ9Vnwb&XbM_i3\߻^ZŒEPfwr'T0ڋXdpۨKcx @ ZXؠjoh-P{cXmoꚥ%҃Ҷt)ci@*!A@TȋIameV*gxD)df<׾EULE-P{cX_4Ny]~f ; #include #include "main.h" /****************************************************************/ /* This function draws the X-axis, Y-axis or point marker on */ /* the drawing_area depending on the value of the type */ /* parameter. */ /****************************************************************/ void DrawMarker(GtkWidget *da, gint x, gint y, gint type, GdkColor *color) { GdkGC *bpegc; bpegc = gdk_gc_new (da->window); if (type==0) { gdk_gc_set_foreground (bpegc, &color[0]); gdk_draw_rectangle(da->window,bpegc,TRUE, x-MARKERLENGTH,y-MARKERTHICKNESS/2,MARKERLENGTH*2+1,MARKERTHICKNESS+1); gdk_draw_rectangle(da->window,bpegc,TRUE, x-MARKERTHICKNESS/2,y-MARKERLENGTH,MARKERTHICKNESS+1,MARKERLENGTH+1); } else if (type==1) { gdk_gc_set_foreground (bpegc, &color[1]); gdk_draw_rectangle(da->window,bpegc,TRUE, x-MARKERTHICKNESS/2,y-MARKERLENGTH,MARKERTHICKNESS+1,MARKERLENGTH*2+1); gdk_draw_rectangle(da->window,bpegc,TRUE, x,y-MARKERTHICKNESS/2,MARKERLENGTH+1,MARKERTHICKNESS+1); } else { gdk_gc_set_foreground (bpegc, &color[2]); gdk_draw_rectangle(da->window,bpegc,TRUE, x-OUTERSIZE,y-OUTERSIZE,OUTERSIZE*2+1,OUTERSIZE*2+1); gdk_gc_set_foreground (bpegc, &color[3]); gdk_draw_rectangle(da->window,bpegc,TRUE, x-INNERSIZE,y-INNERSIZE,INNERSIZE*2+1,INNERSIZE*2+1); } g_object_unref(bpegc); } /****************************************************************/ /* This function initializes the colors which are used when */ /* drawing the axispoints and the graph points */ /****************************************************************/ gboolean setcolors(GdkColor **color) { gboolean *success; gint i, ncolors; gushort xcolor[19][4] = {{40000,20000,48000}, /* x axis marker color */ {40000,48000,20000}, /* y axis marker color */ {65535,00000,00000}, /* outer square color */ {65535,65535,65535}}; /* inner square color */ ncolors=4; /* Number of colors to be initialized */ *color = (GdkColor *) calloc (ncolors, sizeof(GdkColor)); /* Allocate memory for the colors */ success = (gboolean *) calloc (ncolors, sizeof(gboolean)); for(i=0;i 2007-03-16 g3data 1 g3data 1.5.1 g3data A tool for extracting data from graphs. g3data 2001-01-01 DESCRIPTION g3data is a tool for extracting data from scanned graphs. For graphs published in scientific articles the actual data is usually not explicitly given ; g3data makes the process of extracting this data easy. OPTIONS If picture is larger x-wise than x or y-wise than y, the picture is scaled down accordingly otherwise this parameter has no effect. Scales the picture size by factor. This parameter nullifies effect of the -max parameter. Preset the coordinates of the left lower (ll) corner and the right upper (ru) corner. Print out the error of the x value in column 3 and the error of y value in column 4 of the output. Use logarithmic scale for x coordinates. Use logarithmic scale for y coordinates. The filename(s) of the image(s) to open. Supported image formats: PNG, XPM, JPEG, TIFF, PNM, RAS, BMP and GIF. USAGE g3data -scale 2 -errors test1.png g3data -scale 2 -lny -errors test2.png BUGS None known. AUTHOR Jonas Frantz jonas.frantz@welho.com g3data-1.5.3/sort.c0000644000076400007640000000710711120723752013751 0ustar jfrantzjfrantz/* g3data : A program for grabbing data from scanned graphs Copyright (C) 2000 Jonas Frantz This file is part of g3data. g3data 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 2 of the License, or (at your option) any later version. g3data 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Authors email : jonas.frantz@welho.com */ #include #include "main.h" /****************************************************************/ /* The following sorting functions is a copy of the example in */ /* K & R C programming 2nd ed. page 120. Some sort of quicksort.*/ /****************************************************************/ void swap3(struct PointValue *RealPos, gint i, gint j) { struct PointValue tmp; tmp.Xv = RealPos[i].Xv; tmp.Yv = RealPos[i].Yv; tmp.Xerr = RealPos[i].Xerr; tmp.Yerr = RealPos[i].Yerr; RealPos[i].Xv = RealPos[j].Xv; RealPos[i].Yv = RealPos[j].Yv; RealPos[i].Xerr = RealPos[j].Xerr; RealPos[i].Yerr = RealPos[j].Yerr; RealPos[j].Xv = tmp.Xv; RealPos[j].Yv = tmp.Yv; RealPos[j].Xerr = tmp.Xerr; RealPos[j].Yerr = tmp.Yerr; } gint compare3(struct PointValue *RealPos, gint i, gint j, gint orderv) { if (orderv == 1) { if (RealPos[i].Xv < RealPos[j].Xv) return (-1); else return (1); } else { if (RealPos[i].Yv < RealPos[j].Yv) return (-1); else return (1); } } void Order(struct PointValue *RealPos, gint left, gint right, gint ordering) { gint i,last; if (left>=right) return; swap3(RealPos, left, (left+right)/2); last = left; for (i=left+1;i<=right;i++) if (compare3(RealPos,i,left,ordering)<0) swap3(RealPos, ++last, i); swap3(RealPos, left, last); Order(RealPos, left, last-1, ordering); Order(RealPos, last+1, right, ordering); } g3data-1.5.3/points.c0000644000076400007640000002055511120723752014300 0ustar jfrantzjfrantz/* g3data : A program for grabbing data from scanned graphs Copyright (C) 2000 Jonas Frantz This file is part of g3data. g3data 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 2 of the License, or (at your option) any later version. g3data 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Authors email : jonas.frantz@welho.com */ #include #include #include #include #include "main.h" /* Extern functions */ extern void Order(struct PointValue *RealPos, gint left, gint right, gint ordering); /* Extern variables */ extern gint axiscoords[MAXNUMTABS][4][2]; extern gint **points[MAXNUMTABS]; extern gint numpoints[MAXNUMTABS]; extern gint ordering[MAXNUMTABS]; extern gdouble realcoords[MAXNUMTABS][4]; extern gboolean UseErrors[MAXNUMTABS]; extern gboolean logxy[MAXNUMTABS][2]; extern gint Action[MAXNUMTABS]; extern gchar *file_name[MAXNUMTABS]; extern gint ViewedTabNum; /****************************************************************/ /* This function sets the numpoints entry to numpoints variable */ /* value. */ /****************************************************************/ void SetNumPointsEntry(GtkWidget *np_entry, gint np) { char buf[128]; sprintf(buf,"%d",np); gtk_entry_set_text(GTK_ENTRY(np_entry),buf); } /****************************************************************/ /* This function returns the integer with the lesser value. */ /****************************************************************/ gint min(gint x, gint y) { if (x < y) return x; else return y; } /****************************************************************/ /* This function calculates the true value of the point based */ /* on the coordinates of the point on the bitmap. */ /****************************************************************/ struct PointValue CalcPointValue(gint Xpos, gint Ypos, gint TabNum) { double alpha,beta,x21,x43,y21,y43,rlc[4]; /* Declare help variables */ struct PointValue PV; x21=(double) axiscoords[TabNum][1][0]-axiscoords[TabNum][0][0]; /* Calculate deltax of x axis points */ y21=(double) axiscoords[TabNum][1][1]-axiscoords[TabNum][0][1]; /* Calculate deltay of x axis points */ x43=(double) axiscoords[TabNum][3][0]-axiscoords[TabNum][2][0]; /* Calculate deltax of y axis points */ y43=(double) axiscoords[TabNum][3][1]-axiscoords[TabNum][2][1]; /* Calculate deltay of y axis points */ if (logxy[TabNum][0]) { /* If x axis is logarithmic, store */ rlc[0]=log(realcoords[TabNum][0]); /* recalculated values in rlc. */ rlc[1]=log(realcoords[TabNum][1]); } else { rlc[0]=realcoords[TabNum][0]; /* Else store old values in rlc. */ rlc[1]=realcoords[TabNum][1]; } if (logxy[TabNum][1]) { rlc[2]=log(realcoords[TabNum][2]); /* If y axis is logarithmic, store */ rlc[3]=log(realcoords[TabNum][3]); /* recalculated values in rlc. */ } else { rlc[2]=realcoords[TabNum][2]; /* Else store old values in rlc. */ rlc[3]=realcoords[TabNum][3]; } alpha=((axiscoords[TabNum][0][0]-(double) Xpos) -(axiscoords[TabNum][0][1]-(double) Ypos)*(x43/y43))/(x21-((y21*x43)/y43)); beta=((axiscoords[TabNum][2][1]-(double) Ypos) -(axiscoords[TabNum][2][0]-(double) Xpos)*(y21/x21))/(y43-((x43*y21)/x21)); if (logxy[TabNum][0]) PV.Xv = exp(-alpha*(rlc[1]-rlc[0])+rlc[0]); else PV.Xv = -alpha*(rlc[1]-rlc[0])+rlc[0]; if (logxy[TabNum][1]) PV.Yv = exp(-beta*(rlc[3]-rlc[2])+rlc[2]); else PV.Yv = -beta*(rlc[3]-rlc[2])+rlc[2]; alpha=((axiscoords[TabNum][0][0]-(double) (Xpos+1)) -(axiscoords[TabNum][0][1]-(double) (Ypos+1))*(x43/y43))/(x21-((y21*x43)/y43)); beta=((axiscoords[TabNum][2][1]-(double) (Ypos+1)) -(axiscoords[TabNum][2][0]-(double) (Xpos+1))*(y21/x21))/(y43-((x43*y21)/x21)); if (logxy[TabNum][0]) PV.Xerr = exp(-alpha*(rlc[1]-rlc[0])+rlc[0]); else PV.Xerr = -alpha*(rlc[1]-rlc[0])+rlc[0]; if (logxy[TabNum][1]) PV.Yerr = exp(-beta*(rlc[3]-rlc[2])+rlc[2]); else PV.Yerr = -beta*(rlc[3]-rlc[2])+rlc[2]; alpha=((axiscoords[TabNum][0][0]-(double) (Xpos-1)) -(axiscoords[TabNum][0][1]-(double) (Ypos-1))*(x43/y43))/(x21-((y21*x43)/y43)); beta=((axiscoords[TabNum][2][1]-(double) (Ypos-1)) -(axiscoords[TabNum][2][0]-(double) (Xpos-1))*(y21/x21))/(y43-((x43*y21)/x21)); if (logxy[TabNum][0]) PV.Xerr -= exp(-alpha*(rlc[1]-rlc[0])+rlc[0]); else PV.Xerr -= -alpha*(rlc[1]-rlc[0])+rlc[0]; if (logxy[TabNum][1]) PV.Yerr -= exp(-beta*(rlc[3]-rlc[2])+rlc[2]); else PV.Yerr -= -beta*(rlc[3]-rlc[2])+rlc[2]; PV.Xerr = fabs(PV.Xerr/4.0); PV.Yerr = fabs(PV.Yerr/4.0); return PV; } /****************************************************************/ /* This function is called when the "Print results" button is */ /* pressed, it calculate the values of the datapoints and */ /* prints them through stdout. */ /****************************************************************/ void print_results(GtkWidget *widget, gpointer func_data) { gint i; /* Declare index variable */ gboolean print2file; FILE *FP; struct PointValue *RealPos, CalcVal; print2file = Action[ViewedTabNum]; if (print2file == PRINT2FILE) { FP = fopen(file_name[ViewedTabNum],"w"); /* Open file for writing */ if (FP==NULL) { printf("Could not open %s for writing\n",file_name[ViewedTabNum]); /* If unable to open print error */ return; } } RealPos = (struct PointValue *) malloc(sizeof(struct PointValue) * numpoints[ViewedTabNum]); /* Next up is recalculating the positions of the points by solving a 2*2 matrix */ for (i=0;iu~}NuU<Q!d+Co$6FPI\HLS6.))i!d>cݮ}x T"]{T!DVf߮Ҡ"- `WRoٿildR+viXzNܕ @ zŋwt!<^ku?bIwN 6QYRիIe00/w(2bz蔠|1|ӆvdC3vdA`zKBO<w:R+*Xq< X]M#=}0cJm4mץ< @ 9D D:~U`2C 'duޘ[;3[ }. 0:nnqj`ˮ@̞Z =[v9vS٦sW` 97yt E ݿ  c@W+)w40(}Lhqhr3i0|0,Nrr@'2<WT1=xzJC^r\-2di[_,co &jiU]9 hDp} 7>0t!Vo: 1eS;} Z hqqsݏ<荸P鍨:,Yۃa2Q$Gza`j9H݂ҒzK(*Ż%" rDA*?OT`͏!xmNtoO w/nGiRxoj)0#Z-ոD!4s[&vkׁ`yaR0il=v(ƍ +Pިi;oDF39z{{#1G2;&I\hђK1}m⧄rAk^kTX M_.gk Dq߈F;oMv6PXhM1_Z6X1`@B"fUh42>@NGc AT@@,<bAchZ@_#~8~Bk[0`DMDcVHP 8aA]#}&̣t?~b_m HO\Hk#8ؚ 6Q1kN \c@m| h^2 s!o')|obcρG?h*qKW_["XX"c; nzh$N4q9mwho`bk#1њGxuצ;lPt&(i56 @R'Z;Ba u׵8A]UQQ@]PS*EvFc-A!pgw\0pajQmGJ5*V| صPZ {͜m=xH\aKk1gmѝNlOۢO:`Cq(|Ջo{b 躞Mq#oҸ8`BpA@ |ƌg ! ;Ej*׽歡%0ƴ 0;7,;{zí*1FYu[-!z0nnf{tБÀZ*G=A77{ŮDZ11s޷r{.ͭr{(tA!0ج3EGE=f=ě&Wsbc ,yR{O/N1t D6Iӹ_eddoS-=7b1x2/^<8gK !_1.ʻ3 U f:HKK"_-c9>gse=hs`ϸ_8G)=&2TiNHjv_Ya&P XO~  4V!@ IurE<>ŬI~M4BfnE \Ş{wጱWOcSI*w+I`8Dу bQe)W3Ƙ"_-.x}50weŇ^T䫃4#ĞsEv| dTUjy)'J˨bPmmm!9{0PQҚ"=!MR.mTrCPKRUucuN{DS!R1` %s+?}^~]aq󦼮a~[ J9c RcPm·$''wFFc7%c6$FĦ4T (:`1'!%ƵBGoQz$<.j}i2ykуAO t}Ǖ|fkc\pokINݑlzH-/9e(GA`FD0ꗄ~49. 4GɩT?1!0wUߩԅ4^`4bԤStO'c&EzvC E2|j1/J\G,W?f3rf@&6W*JdM3jcjyF83EJiQff-k R oy_-9@]$Gee˪.S7g/4)vk8Pn[1.1k /EɋMy 䈼du[vY]?j?(gQݛ3LZJ7~ƾj _9Iyeר(dw84 ]6ﭿmr%>Ĩ=WiMq8z܏62|pjhj*i_#+>ۙ5aQK Zohzb;}W~$}|A͆g\+\ue3yQAY+>;-帗HDs#LoWgͪ̆. ^s7aFcP /|N[VzfYZZgT*6-_7(!N>@ffh6>!L>m)JHo[Bmj[^Jk5ZFˢDxHת+hf 69#g\&Avsf^Som޼OKI06=pIENDB`g3data-1.5.3/g3data.spec0000644000076400007640000000347011121140607014625 0ustar jfrantzjfrantz%define base_version 1.5.3 %define rel 1 Summary: Program for extracting the data from scanned graphs Name: g3data Version: %{base_version} Release: %{rel} License: GPL Group: Applications/Engineering URL: http://www.frantz.fi/software/g3data.php Source0: http://www.frantz.fi/software/g3data-%{version}.tar.gz BuildRoot: %{_tmppath}/g3data-%{version}-root Requires: gtk2 BuildRequires: gtk2-devel BuildRequires: pkgconfig %description g3data is used for extracting data from graphs. In publications graphs often are included, but the actual data is missing, g3data makes this extracting process much easier. %prep %setup -q -n g3data-%{version} %build make %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/usr/bin mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1 %makeinstall %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) /usr/bin/g3data /usr/share/man/man1/g3data.1.gz %doc README.TEST README.SOURCE README.INSTALL test1.png test1.values test2.png test2.values gpl.txt %changelog * Sun Dec 14 2008 Jonas Frantz - 1.5.3 released: * Updated deprecated symbols * Sun Nov 30 2008 Jonas Frantz - 1.5.2 released: * Fixed the "beeping" bug * Fri Mar 16 2007 Jonas Frantz - 1.5.1 released: * Added basic drag-n-drop support, current version only supports uri drops * Added preliminary basis for datapoint movement * Minor GUI changes * Some of the graph properties are now hideable, to resolv issues on lower resolution screens * Sat Oct 8 2005 Jonas Frantz - 1.5.0 released * Sun Sep 11 2005 Jonas Frantz - 1.5.0rc2 released * Sun Apr 24 2005 Jonas Frantz - 1.4.0.99 released * Sat Aug 10 2003 Jonas Frantz - Initial build g3data-1.5.3/vardefs.h0000664000076400007640000000601111120723752014414 0ustar jfrantzjfrantz/* g3data : A program for grabbing data from scanned graphs Copyright (C) 2000 Jonas Frantz This file is part of g3data. g3data 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 2 of the License, or (at your option) any later version. g3data 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Authors email : jonas.frantz@welho.com */ /* Actions definitions */ GtkActionEntry entries[] = { { "FileMenu", NULL, "_File" }, { "ViewMenu", NULL, "_View" }, { "HelpMenu", NULL, "_Help" }, { "Open", GTK_STOCK_OPEN, "_Open", "O", "Open an image in a new tab", (GCallback) menu_file_open }, { "Quit", GTK_STOCK_QUIT, "_Quit", "Q", "Quit program", (GCallback) menu_file_exit }, { "About", GTK_STOCK_HELP, "_About", "H", "About g3data", (GCallback) menu_help_about } }; GtkActionEntry closeaction[] = { { "Close", GTK_STOCK_CLOSE, "_Close", "C", "Close current tab", (GCallback) menu_tab_close } }; GtkToggleActionEntry toggle_entries[] = { { "Zoom area", NULL, "Zoom area", "F5", "Hide zoom area", (GCallback) hide_zoom_area_callback, FALSE }, { "Axis settings", NULL, "Axis settings", "F6", "Hide axis settings", (GCallback) hide_axis_settings_callback, FALSE }, { "Output properties", NULL, "Output properties", "F7", "Hide output properties", (GCallback) hide_output_prop_callback, FALSE }, { "FullScreen", NULL, "_Full Screen", "F11", "Switch between full screen and windowed mode", (GCallback) full_screen_action_callback, FALSE } }; /* Menu definitions */ char *ui_description = "" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ""; /* Drag and drop definitions */ static GtkTargetEntry ui_drop_target_entries [NUM_IMAGE_DATA] = { {"text/uri-list", 0, URI_LIST}, {"image/png", 0, PNG_DATA}, {"image/jpeg", 0, JPEG_DATA}, {"application/x-color", 0, APP_X_COLOR} }; g3data-1.5.3/strings.h0000644000076400007640000002403211120723752014454 0ustar jfrantzjfrantz/* g3data : A program for grabbing data from scanned graphs Copyright (C) 2000 Jonas Frantz This file is part of g3data. g3data 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 2 of the License, or (at your option) any later version. g3data 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Authors email : jonas.frantz@welho.com */ /************************************************************************************************/ /* ABOUT INFO */ /************************************************************************************************/ #define PROGNAME "g3data" #define COPYRIGHT "Copyright (C) 2000 Jonas Frantz" #define COMMENTS "Grab graph data, a program for extracting data from graphs" #define LICENSE "g3data is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\ng3data is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" #define HOMEPAGEURL "http://www.frantz.fi/software/g3data.php" #define HOMEPAGELABEL "g3data homepage" #define AUTHORS {"Jonas Frantz", NULL} /************************************************************************************************/ /* COMMANDLINE HELP */ /************************************************************************************************/ gchar HelpText[] = "\n" "g3data version "VERSION", Copyright (C) 2000 Jonas Frantz\n" " g3data comes with ABSOLUTELY NO WARRANTY; for details\n" " check out the documentation. This is free software, and\n" " you are welcome to redistribute it under all conditions.\n" "\n" " Usage : g3data [options] [file1.ext [file2.ext [...]]]\n" "\n" " Options :\n" " -max : If picture is larger x-wise than x or y-wise than y,\n" " the picture is scaled down accordingly otherwise this\n" " parameter has no effect.\n" " -scale : Scales the picture size according to the factor. This\n" " parameter nullifies effect of the -max parameter.\n" " -coords : Preset the coordinates of the left lower (ll) corner\n" " and the right upper (ru) corner.\n" " -errors : Print out the error of the x value in column 3 and the\n" " error of y value in column 4 of the output.\n" " -lnx : Use logarithmic scale for x coordinates.\n" " -lny : Use logarithmic scale for y coordinates.\n" " -h or --help : Print this help.\n" "\n" " Supported image formats : PNG, XPM, JPEG, TIFF, PNM, RAS, BMP and GIF\n" "\n" " Hints and remarks for usage :\n" " - The options given on the commandline only is applied to the images\n" " opened from the commandline.\n" " - To access fullscreen mode use the F11 key.\n" " - For increased data accuracy use the -scale option with a large parameter\n" " to achieve finer granularity and thus smaller errors.\n" "\n" " Report bugs to jonas.frantz@welho.com\n" "\n"; /************************************************************************************************/ /* BUTTON/CHECKBUTTON/LABELS */ /************************************************************************************************/ gchar Dialog_Title[] = "g3data Export data"; gchar Window_Title_NoneOpen[] = "g3data - No open files"; gchar Window_Title[] = "%s - g3data"; gchar setxylabel[4][40] = {"Set point X1 on X axis (_1)", "Set point X2 on X axis (_2)", "Set point Y1 on Y axis (_3)", "Set point Y2 on Y axis (_4)"}; gchar orderlabel[ORDERBNUM][40] = {"No ordering", "Based on X value", "Based on Y value"}; gchar actionlabel[ACTIONBNUM][32] = {"Export data to stdout", "Export data to file"}; gchar loglabel[LOGBNUM][32] = {"_X axis is logarithmic", "_Y axis is logarithmic"}; gchar xy_label_text[4][32] = {"X1 value : ", "X2 value : ", "Y1 value : ", "Y2 value : "}; gchar PrintBLabel[] = "Export point _data"; gchar RemLastBLabel[] = "_Remove last point"; gchar RemAllBLabel[] = "Remove _all points"; gchar PrintErrCBLabel[] = "Include _errors"; gchar pm_string[] = " ± "; gchar x_string[] = " X : "; gchar y_string[] = " Y : "; gchar filen_string[] = "Filename : "; gchar nump_string[] = "Number of points : "; gchar scale_string[] = "Scale image : "; gchar APheader[] = "Axis points"; gchar PIheader[] = "Processing information"; gchar ZAheader[] = "Zoom area"; gchar Oheader[] = "Point ordering"; gchar Eheader[] = "Value errors"; gchar Lheader[] = "Logarithmic scales"; gchar Aheader[] = "Action"; /************************************************************************************************/ /* TOOLTIPS */ /************************************************************************************************/ gchar setx1tts[] = "Put out first point on x axis"; gchar setx1tt[] = "To set out first point on x axis press this button and then press on the " "image x-axis (with left mousebutton). This procedure can be replaced by " "pressing the middle button on the image."; gchar setx2tts[] = "Put out second point on x axis"; gchar setx2tt[] = "To set out second point on x axis press this button and then press on the " "image x-axis (with left mousebutton). This procedure can be replaced by " "pressing the middle button on the image."; gchar sety1tts[] = "Put out first point on y axis"; gchar sety1tt[] = "To set out first point on y axis press this button and then press on the " "image y-axis (with left mousebutton). This procedure can be replaced by " "pressing the right button on the image."; gchar sety2tts[] = "Put out second point on y axis"; gchar sety2tt[] = "To set out second point on y axis press this button and then press on the " "image y-axis (with left mousebutton). This procedure can be replaced by " "pressing the right button on the image."; gchar *setxytts[] = {&setx1tts[0], &setx2tts[0], &sety1tts[0], &sety2tts[0]}; gchar *setxytt[] = {&setx1tt[0], &setx2tt[0], &sety1tt[0], &sety2tt[0]}; gchar entryx1tt[] = "This entry should contain the value of the first x-axis point"; gchar entryx2tt[] = "This entry should contain the value of the second x-axis point"; gchar entryy1tt[] = "This entry should contain the value of the first y-axis point"; gchar entryy2tt[] = "This entry should contain the value of the second y-axis point"; gchar *entryxytt[] = {&entryx1tt[0], &entryx2tt[0], &entryy1tt[0], &entryy2tt[0]}; gchar removeltt[] = "This button removes the last put out point"; gchar removeatts[] = "Remove all points"; gchar removeatt[] = "This button removes all put out points except the axispoints. If all " "points are already removed a second click will also remove the axispoints."; gchar printrestt[] = "Print data to stdout"; gchar printfilett[] = "Print data to file %s"; gchar filenamett[] = "This entry should contain the name of the file to print data to"; gchar logxtt[] = "If x-axis is logarithmic check this button"; gchar logytt[] = "If y-axis is logarithmic check this button"; gchar *logxytt[] = {&logxtt[0], &logytt[0]}; gchar uetts[] = "Show the errors of the x and y values at printout"; gchar uett[] = "If you want the errors of the x value to be printed in column 3 and the error " "of the y value to be printed in column 4 check this button."; g3data-1.5.3/main.h0000644000076400007640000000336311121137367013715 0ustar jfrantzjfrantz/* g3data : A program for grabbing data from scanned graphs Copyright (C) 2000 Jonas Frantz This file is part of g3data. g3data 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 2 of the License, or (at your option) any later version. g3data 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Authors email : jonas.frantz@welho.com */ #define ZOOMPIXSIZE 200 /* Size of zoom in window */ #define ZOOMFACTOR 4 /* Zoom factor of zoom window */ #define INNERSIZE 1 /* Size of point marker white inner square */ #define OUTERSIZE 3 /* Size of point marker red outer square */ #define MARKERLENGTH 6 /* Axis marker length */ #define MARKERTHICKNESS 2 /* Axis marker thickness */ #define MAXPOINTS 256 /* Maximum number of points per memory allocation */ #define MAXNUMTABS 128 /* Maximum number of open tabs */ #define VERSION "1.5.2" /* Version number */ #define MOVETRESHOLD 3 #define ACTIONBNUM 2 #define ORDERBNUM 3 #define LOGBNUM 2 #define URI_IDENTIFIER "file://" struct PointValue { double Xv,Yv,Xerr,Yerr; }; typedef enum { PRINT2STDOUT = 0, PRINT2FILE } ACTION; typedef enum { URI_LIST, PNG_DATA, JPEG_DATA, APP_X_COLOR, NUM_IMAGE_DATA, } UI_DROP_TARGET_INFO; g3data-1.5.3/gpl.txt0000644000076400007640000004313111120723752014136 0ustar jfrantzjfrantz GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. g3data-1.5.3/Makefile0000644000076400007640000000133511121140701014237 0ustar jfrantzjfrantzCC=gcc CFLAGS=-Wall `pkg-config --cflags gtk+-2.0` LIBS=`pkg-config --libs gtk+-2.0` bindir ?= /usr/bin mandir ?= /usr/share/man .c.o: $(CC) -c $(CFLAGS) $(CPPFLAGS) $< g3data: main.o sort.o points.o drawing.o g3data.1.gz $(CC) $(CFLAGS) -o g3data main.o sort.o points.o drawing.o $(LIBS) strip g3data main.o: main.c main.h strings.h vardefs.h sort.o: sort.c main.h points.o: points.c main.h drawing.o: drawing.c main.h g3data.1.gz: g3data.sgml rm -f *.1 onsgmls g3data.sgml | sgmlspl /usr/share/sgml/docbook/utils-0.6.14/helpers/docbook2man-spec.pl gzip g3data.1 clean: rm -f *.o g3data g3data.1.gz *~ manpage.* install: install g3data $(bindir) install g3data.1.gz $(mandir)/man1 uninstall: rm $(bindir)/g3data g3data-1.5.3/test1.values0000644000076400007640000000004711120723752015073 0ustar jfrantzjfrantz10 20 23 55 33 12 57 60 99 107 123 120 g3data-1.5.3/test1.png0000664000076400007640000001225711120723752014370 0ustar jfrantzjfrantzPNG  IHDR?cMgAMA a3PLTEwwwUUU333fffDDD"""=/8tEXtSoftwareXV Version 3.10a Rev: 12/29/94 (PNG patch 1.2).IIDATx흇@5JP睷m;% Og@O_gyV%1ϚQ̙󬱅b\jsQ̥F1FF}O4'iq}+h83G0_L z ǜCF$ ;?`Әln0;?`ވ0>Vx92c.Q + ZTqŜT5IwY1At@1z!sc!vußIpJBb[ZXctbtzbײ{6yƨ駊ӳJ?P4h6)3}ɑPoQdXMF RslF1w̾WX\zә .>bѓOvCB8r(`S̑ׯ;3`|KCg+ߩ?8 m_*l\=Ϯu̝qB7TqRۏ Ny%@3ycnVTr00m3PPcsB(&)zKz5?j 9|/#5'Uؙ!g0`CI Jr93C1gw;RoBsR0k^_l44HsRSoa7J+RT\@\ܨ 1:[as .a'[9\ Tsؚ2b>F,ppl>E+枆cF7)ک9OR0y>gYp1cJs",MP=B i&(T<ߏIsI+FhyJ1w+ps9MP݄hsCڞz}9kWyv, iuMP] T%57S9nHؚR*/z%ܮRKyduxU#4V*lUYc.bBp\ϱK=VX\/̕G\a/涏ϣxui7c.m0醓v$jBx{:csKY^ E5Gs/dRσsј;Ov(:<Ks I >d]?4TeN!;s5>}S9S~wS̹vs s.US[EŜFe}bΞշ鳐3qZb~2恵/xf-(N`鱹, ~hP̙SO~(挡K1g _čŜ!lz')xp3/➿I9EB139("NAc=4ӻB .08ѐbC]g#Hq'h.巂jy}ݤܙ!巂9 \  I3 jn"q1'戨kP=u?X)vf UshN3[\pU+U@Ṉ#T< | [Ka &'s"Fj+܃5:0QO)'Xg'kt`8Pjՙnzfkpq_}I5s5:&x39D s-OPmxFH1& Ŝ _~SCK:[Ac=#5' ev"[o͐:P1W5UW>9>ıV(dN$w8ES\x%:P27WE!os!9p[r6h[#_s1w:dGWsŐW/nsEm>;dfCCdr?4d srڔNW.4r;\5`1qANC~?8-[D* j[RK\zk=,io,c9zP}ml]\=Gn(=5ZdаA'!׌ N料4󣡍7Rrb=M-S=`f mq1?ذ #sd-2VqnjSʙ |[erFn95! uŠ(}3_XOS2V~ܜ@X%ssJC+0'S_X9>\Xqs072Vzja;K8sDX*an>N/B-+'s}g62@U*+(bb.VX)bb.R@[<`'s3ۊ;dwfh  cNtfxC:3PE!~aYjxZLhy$ssjEj0{5'߫ژ;By cnݚa i5z9{ǀҚbZkgb.0SZ38Uŧ1~=CQ[3\Ɯ6Lw⧺Kof`=}wt\x썰haz9 D/ws 2}oazF?[%ĩ{=P58ͧzTj("`ՑOdjAFC1/ֽס+{T`uֽס/fE=$0jJLG݇cN|{R jO2 y#s/QCbu0 I& iܒl:ix[LL^2Eجf$S*~#l ls| 2zCso3(%I&?#.27caN7״EmٰJ,FS>c28#P'DKO.;0|fsHs0`+&09P] 僜jn캰dXp 0U-av0tsPd"8Ķ\M}s*_iLŜl1xkcnEAw1`J y蓁Z|;4S`怐9L D,%;&a /* Include gtk library */ #include /* Include stdio library */ #include #include #include /* Include stdlib library */ #include /* Include string library */ #include /* Include math library */ #include #include #include "main.h" /* Include predined variables */ #include "strings.h" /* Include strings */ #ifdef NOSPACING #define SECT_SEP 0 #define GROUP_SEP 0 #define ELEM_SEP 0 #define FRAME_INDENT 0 #define WINDOW_BORDER 0 #else #define SECT_SEP 12 #define GROUP_SEP 12 #define ELEM_SEP 6 #define FRAME_INDENT 18 #define WINDOW_BORDER 12 #endif /* Declaration of gtk variables */ GtkWidget *window; /* Window */ GtkWidget *drawing_area[MAXNUMTABS], *zoom_area[MAXNUMTABS]; /* Drawing areas */ GtkWidget *xyentry[MAXNUMTABS][4]; GtkWidget *exportbutton[MAXNUMTABS], *remlastbutton[MAXNUMTABS]; /* Various buttons */ GtkWidget *setxybutton[MAXNUMTABS][4]; GtkWidget *remallbutton[MAXNUMTABS]; /* Even more various buttons */ GtkWidget *xc_entry[MAXNUMTABS],*yc_entry[MAXNUMTABS]; GtkWidget *file_entry[MAXNUMTABS], *nump_entry[MAXNUMTABS]; GtkWidget *xerr_entry[MAXNUMTABS],*yerr_entry[MAXNUMTABS]; /* Coordinate and filename entries */ GtkWidget *logbox[MAXNUMTABS] = {NULL}, *zoomareabox[MAXNUMTABS] = {NULL}, *oppropbox[MAXNUMTABS] = {NULL}; GtkWidget *pm_label, *pm_label2, *file_label; GtkWidget *ViewPort; GdkColor *colors; /* Pointer to colors */ GdkPixbuf *gpbimage[MAXNUMTABS]; GtkWidget *mainnotebook; GtkActionGroup *tab_action_group; /* Declaration of global variables */ gint axiscoords[MAXNUMTABS][4][2]; /* X,Y coordinates of axispoints */ gint **points[MAXNUMTABS]; /* Indexes of graphpoints and their coordinates */ gint *lastpoints[MAXNUMTABS]; /* Indexes of last points put out */ gint numpoints[MAXNUMTABS]; gint numlastpoints[MAXNUMTABS]; /* Number of points on graph and last put out */ gint remthis = 0, ordering[MAXNUMTABS]; /* Various control variables */ gint XSize[MAXNUMTABS], YSize[MAXNUMTABS]; gint file_name_length[MAXNUMTABS]; gint MaxPoints[MAXNUMTABS] = {MAXPOINTS}; gint Action[MAXNUMTABS]; gint ViewedTabNum = -1; /* The currently viewed tab */ gint NoteBookNumPages = 0; gdouble realcoords[MAXNUMTABS][4]; /* X,Y coords on graph */ gboolean UseErrors[MAXNUMTABS], WinFullScreen; gboolean setxypressed[MAXNUMTABS][4]; gboolean bpressed[MAXNUMTABS][4]; /* What axispoints have been set out ? */ gboolean valueset[MAXNUMTABS][4]; gboolean logxy[MAXNUMTABS][2] = {{FALSE,FALSE}}; gboolean MovePointMode = FALSE; gboolean HideLog = FALSE, HideZoomArea = FALSE, HideOpProp = FALSE; gchar *file_name[MAXNUMTABS]; /* Pointer to filename */ gchar FileNames[MAXNUMTABS][256]; FILE *FP; /* File pointer */ GtkWidget *drawing_area_alignment; /* Declaration of extern functions */ extern void SetNumPointsEntry(GtkWidget *np_entry, gint np); extern gint min(gint x, gint y); extern void DrawMarker(GtkWidget *da, gint x, gint y, gint type, GdkColor *color); extern struct PointValue CalcPointValue(gint Xpos, gint Ypos, gint TabNum); extern void print_results(GtkWidget *widget, gpointer func_data); extern gboolean setcolors(GdkColor **color); /* Explicit declaration of functions */ void remove_last(GtkWidget *widget, gpointer data); void SetOrdering(GtkWidget *widget, gpointer func_data); void SetAction(GtkWidget *widget, gpointer func_data); void UseErrCB(GtkWidget *widget, gpointer func_data); void read_file_entry(GtkWidget *entry, gpointer func_data); // GCallback full_screen_action_callback(GtkWidget *widget, gpointer func_dat); /****************************************************************/ /* This function closes the window when the application is */ /* killed. */ /****************************************************************/ gint close_application(GtkWidget *widget, GdkEvent *event, gpointer data) { gtk_main_quit(); /* Quit gtk */ return FALSE; } /****************************************************************/ /* This function sets the sensitivity of the buttons depending */ /* the control variables. */ /****************************************************************/ void SetButtonSensitivity(int TabNum) { char ttbuf[256]; if (Action[TabNum] == PRINT2FILE) { snprintf(ttbuf, sizeof(ttbuf), printfilett, gtk_entry_get_text(GTK_ENTRY (file_entry[TabNum]))); gtk_widget_set_tooltip_text(exportbutton[TabNum],ttbuf); gtk_widget_set_sensitive(file_entry[TabNum], TRUE); if (valueset[TabNum][0] && valueset[TabNum][1] && valueset[TabNum][2] && valueset[TabNum][3] && bpressed[TabNum][0] && bpressed[TabNum][1] && bpressed[TabNum][2] && bpressed[TabNum][3] && numpoints[TabNum] > 0 && file_name_length[TabNum] > 0) gtk_widget_set_sensitive(exportbutton[TabNum], TRUE); else gtk_widget_set_sensitive(exportbutton[TabNum], FALSE); } else { gtk_widget_set_tooltip_text(exportbutton[TabNum],printrestt); gtk_widget_set_sensitive(file_entry[TabNum], FALSE); if (valueset[TabNum][0] && valueset[TabNum][1] && valueset[TabNum][2] && valueset[TabNum][3] && bpressed[TabNum][0] && bpressed[TabNum][1] && bpressed[TabNum][2] && bpressed[TabNum][3] && numpoints[TabNum] > 0) gtk_widget_set_sensitive(exportbutton[TabNum], TRUE); else gtk_widget_set_sensitive(exportbutton[TabNum], FALSE); } if (numlastpoints[TabNum]==0) { gtk_widget_set_sensitive(remlastbutton[TabNum],FALSE); gtk_widget_set_sensitive(remallbutton[TabNum],FALSE); } else { gtk_widget_set_sensitive(remlastbutton[TabNum],TRUE); gtk_widget_set_sensitive(remallbutton[TabNum],TRUE); } } /****************************************************************/ /* When a button is pressed inside the drawing area this */ /* function is called, it handles axispoints and graphpoints */ /* and paints a square in that position. */ /****************************************************************/ gint button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) { GdkModifierType state; gint x, y, i, j, TabNum; TabNum = GPOINTER_TO_INT(data); gdk_window_get_pointer (event->window, &x, &y, &state); /* Get pointer state */ if (event->button == 1) { /* If button 1 (leftmost) is pressed */ if (MovePointMode) { for (i=0;i MaxPoints[TabNum]-1) { i = MaxPoints[TabNum]; MaxPoints[TabNum] += MAXPOINTS; lastpoints[TabNum] = realloc(lastpoints[TabNum],sizeof(gint) * (MaxPoints[TabNum]+4)); if (lastpoints[TabNum]==NULL) { printf("Error reallocating memory for lastpoints. Exiting.\n"); exit(-1); } points[TabNum] = realloc(points[TabNum],sizeof(gint *) * MaxPoints[TabNum]); if (points[TabNum]==NULL) { printf("Error reallocating memory for points. Exiting.\n"); exit(-1); } for (;ibutton == 2) { /* Is the middle button pressed ? */ for (i=0;i<2;i++) if (!bpressed[TabNum][i]) { axiscoords[TabNum][i][0]=x; axiscoords[TabNum][i][1]=y; for (j=0;j<4;j++) if (i!=j) gtk_widget_set_sensitive(setxybutton[TabNum][j],TRUE); gtk_widget_set_sensitive(xyentry[TabNum][i],TRUE); gtk_editable_set_editable((GtkEditable *) xyentry[TabNum][i],TRUE); gtk_widget_grab_focus(xyentry[TabNum][i]); setxypressed[TabNum][i]=FALSE; bpressed[TabNum][i]=TRUE; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(setxybutton[TabNum][i]),FALSE); lastpoints[TabNum][numlastpoints[TabNum]]=-(i+1); numlastpoints[TabNum]++; DrawMarker(drawing_area[TabNum], x, y, 0, colors); break; } } else if (event->button == 3) { /* Is the right button pressed ? */ for (i=2;i<4;i++) if (!bpressed[TabNum][i]) { axiscoords[TabNum][i][0]=x; axiscoords[TabNum][i][1]=y; for (j=0;j<4;j++) if (i!=j) gtk_widget_set_sensitive(setxybutton[TabNum][j],TRUE); gtk_widget_set_sensitive(xyentry[TabNum][i],TRUE); gtk_editable_set_editable((GtkEditable *) xyentry[TabNum][i],TRUE); gtk_widget_grab_focus(xyentry[TabNum][i]); setxypressed[TabNum][i]=FALSE; bpressed[TabNum][i]=TRUE; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(setxybutton[TabNum][i]),FALSE); lastpoints[TabNum][numlastpoints[TabNum]]=-(i+1); numlastpoints[TabNum]++; DrawMarker(drawing_area[TabNum], x, y, 1, colors); break; } } SetButtonSensitivity(TabNum); return TRUE; } /****************************************************************/ /* This function is called when a button is released on the */ /* drawing area, currently this function does not perform any */ /* task. */ /****************************************************************/ gint button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) { if (event->button == 1) { } else if (event->button == 2) { } else if (event->button == 3) { } return TRUE; } /****************************************************************/ /* This function is called when movement is detected in the */ /* drawing area, it captures the coordinates and zoom in om the */ /* position and plots it on the zoom area. */ /****************************************************************/ gint motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) { gint x, y, TabNum; gchar buf[32]; GdkModifierType state; static gboolean FirstTime = TRUE; static GdkGC *mngc; /* Graphic context */ static GdkPixbuf *gpbzoomimage; struct PointValue CalcVal; TabNum = GPOINTER_TO_INT(data); gdk_window_get_pointer (event->window, &x, &y, &state); /* Grab mousepointers coordinates */ /* on drawing area. */ mngc = gdk_gc_new (zoom_area[TabNum]->window); /* Create graphics context */ if (FirstTime) { gpbzoomimage = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, ZOOMPIXSIZE, ZOOMPIXSIZE); FirstTime = FALSE; } if (x>=0 && y>=0 && xwindow,zoom_area[TabNum]->style->white_gc,gpbzoomimage, 0,0,0,0,ZOOMPIXSIZE,ZOOMPIXSIZE,GDK_RGB_DITHER_NONE,0,0); DrawMarker(zoom_area[TabNum], ZOOMPIXSIZE/2, ZOOMPIXSIZE/2, 2, colors); /* Then draw the square in the middle of the zoom area */ if (valueset[TabNum][0] && valueset[TabNum][1] && valueset[TabNum][2] && valueset[TabNum][3]) { CalcVal = CalcPointValue(x,y,TabNum); sprintf(buf,"%16.10g",CalcVal.Xv); gtk_entry_set_text(GTK_ENTRY(xc_entry[TabNum]),buf); /* Put out coordinates in entries */ sprintf(buf,"%16.10g",CalcVal.Yv); gtk_entry_set_text(GTK_ENTRY(yc_entry[TabNum]),buf); sprintf(buf,"%16.10g",CalcVal.Xerr); gtk_entry_set_text(GTK_ENTRY(xerr_entry[TabNum]),buf); /* Put out coordinates in entries */ sprintf(buf,"%16.10g",CalcVal.Yerr); gtk_entry_set_text(GTK_ENTRY(yerr_entry[TabNum]),buf); } else { gtk_entry_set_text(GTK_ENTRY(xc_entry[TabNum]),""); /* Else clear entries */ gtk_entry_set_text(GTK_ENTRY(yc_entry[TabNum]),""); gtk_entry_set_text(GTK_ENTRY(xerr_entry[TabNum]),""); gtk_entry_set_text(GTK_ENTRY(yerr_entry[TabNum]),""); } } else { gtk_entry_set_text(GTK_ENTRY(xc_entry[TabNum]),""); /* Else clear entries */ gtk_entry_set_text(GTK_ENTRY(yc_entry[TabNum]),""); gtk_entry_set_text(GTK_ENTRY(xerr_entry[TabNum]),""); gtk_entry_set_text(GTK_ENTRY(yerr_entry[TabNum]),""); } g_object_unref(mngc); /* Kill graphics context */ return TRUE; } /****************************************************************/ /* This function is called when the drawing area is exposed, it */ /* simply redraws the pixmap on it. */ /****************************************************************/ static gint expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) { gint i, TabNum; TabNum = GPOINTER_TO_INT(data); gdk_draw_pixbuf(widget->window,widget->style->white_gc,gpbimage[TabNum], event->area.x, event->area.y, event->area.x, event->area.y, min(event->area.width,XSize[TabNum]), min(event->area.height,YSize[TabNum]), GDK_RGB_DITHER_NONE,0,0); for (i=0;i<4;i++) if (bpressed[TabNum][i]) DrawMarker(drawing_area[TabNum], axiscoords[TabNum][i][0], axiscoords[TabNum][i][1], i/2, colors); for (i=0;iactive) { /* Is the button pressed on ? */ setxypressed[ViewedTabNum][index]=TRUE; /* The button is pressed down */ for (i=0;i<4;i++) { if (index != i) gtk_widget_set_sensitive(setxybutton[ViewedTabNum][i],FALSE); } if (bpressed[index]) { /* If the x axis point is already set */ remthis=-(index+1); /* remove the square */ remove_last(widget,NULL); } bpressed[ViewedTabNum][index]=FALSE; /* Set x axis point 1 to unset */ } else { /* If button is trying to get unpressed */ if (setxypressed[ViewedTabNum][index]) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),TRUE); /* Set button down */ } } /****************************************************************/ /* Set type of ordering at output of data. */ /****************************************************************/ void SetOrdering(GtkWidget *widget, gpointer func_data) { ordering[ViewedTabNum] = GPOINTER_TO_INT (func_data); /* Set ordering control variable */ } /****************************************************************/ /****************************************************************/ void SetAction(GtkWidget *widget, gpointer func_data) { Action[ViewedTabNum] = GPOINTER_TO_INT (func_data); SetButtonSensitivity(ViewedTabNum); } /****************************************************************/ /* Set whether to use error evaluation and printing or not. */ /****************************************************************/ void UseErrCB(GtkWidget *widget, gpointer func_data) { UseErrors[ViewedTabNum] = (GTK_TOGGLE_BUTTON (widget)->active); } /****************************************************************/ /* When the value of the entry of any axis point is changed, */ /* this function gets called. */ /****************************************************************/ void read_xy_entry(GtkWidget *entry, gpointer func_data) { gchar *xy_text; gint index; index = GPOINTER_TO_INT (func_data); xy_text = (gchar *) gtk_entry_get_text(GTK_ENTRY (entry)); sscanf(xy_text,"%lf",&realcoords[ViewedTabNum][index]); /* Convert string to double value and */ /* store in realcoords[0]. */ if (logxy[ViewedTabNum][index/2] && realcoords[ViewedTabNum][index] > 0) valueset[ViewedTabNum][index]=TRUE; else if (logxy[ViewedTabNum][index/2]) valueset[ViewedTabNum][index]=FALSE; else valueset[ViewedTabNum][index]= TRUE; SetButtonSensitivity(ViewedTabNum); } /****************************************************************/ /* If all the axispoints has been put out, values for these */ /* have been assigned and at least one point has been set on */ /* the graph activate the write to file button. */ /****************************************************************/ void read_file_entry(GtkWidget *entry, gpointer func_data) { gint TabNum; TabNum = GPOINTER_TO_INT (func_data); file_name[TabNum] = (gchar *) gtk_entry_get_text (GTK_ENTRY (entry)); file_name_length[TabNum] = strlen(file_name[TabNum]); /* Get length of string */ if (bpressed[TabNum][0] && bpressed[TabNum][1] && bpressed[TabNum][2] && bpressed[TabNum][3] && valueset[TabNum][0] && valueset[TabNum][1] && valueset[TabNum][2] && valueset[TabNum][3] && numpoints[TabNum] > 0 && file_name_length[TabNum] > 0) { gtk_widget_set_sensitive(exportbutton[TabNum],TRUE); } else gtk_widget_set_sensitive(exportbutton[TabNum],FALSE); } /****************************************************************/ /* If the "X/Y axis is logarithmic" check button is toggled */ /* this function gets called. It sets the logx variable to its */ /* correct value corresponding to the buttons state. */ /****************************************************************/ void islogxy(GtkWidget *widget, gpointer func_data) { gint index; index = GPOINTER_TO_INT (func_data); logxy[ViewedTabNum][index] = (GTK_TOGGLE_BUTTON (widget)->active); /* If checkbutton is pressed down */ /* logxy = TRUE else FALSE. */ if (logxy[ViewedTabNum][index]) { if (realcoords[ViewedTabNum][index*2] <= 0) { /* If a negative value has been insert */ valueset[ViewedTabNum][index*2]=FALSE; gtk_entry_set_text(GTK_ENTRY(xyentry[ViewedTabNum][index*2]),""); /* Zero it */ } if (realcoords[ViewedTabNum][index*2+1] <= 0) { /* If a negative value has been insert */ valueset[ViewedTabNum][index*2+1]=FALSE; gtk_entry_set_text(GTK_ENTRY(xyentry[ViewedTabNum][index*2+1]),""); /* Zero it */ } } } /****************************************************************/ /* This function removes the last inserted point or the point */ /* indexed by remthis (<0). */ /****************************************************************/ void remove_last(GtkWidget *widget, gpointer data) { gint i, j, TabNum; TabNum = GPOINTER_TO_INT(data); /* First redraw the drawing_area with the original image, to clean it. */ gdk_draw_pixbuf(drawing_area[TabNum]->window,widget->style->white_gc,gpbimage[TabNum], 0, 0, 0, 0, XSize[TabNum], YSize[TabNum],GDK_RGB_DITHER_NONE,0,0); if (numlastpoints[TabNum]>0) { /* If points been put out, remove last one */ if (remthis==0) { /* If remthis is 0, ignore it. */ numlastpoints[TabNum]--; for (i=0;i<4;i++) if (lastpoints[TabNum][numlastpoints[TabNum]]==-(i+1)) { /* If point to be removed is axispoint 1-4 */ bpressed[TabNum][i]=FALSE; /* Mark it unpressed. */ gtk_widget_set_sensitive(xyentry[TabNum][i],FALSE); /* Inactivate entry for point. */ break; } if (i==4) numpoints[TabNum]--; /* If its none of the X/Y markers then */ SetNumPointsEntry(nump_entry[TabNum], numpoints[TabNum]); /* its an ordinary marker, remove it. */ } if (numlastpoints[TabNum]>0) { /* If more than 0 points left, start to redraw */ for (i=0;i=0) DrawMarker(drawing_area[TabNum], points[TabNum][lastpoints[TabNum][i]][0], points[TabNum][lastpoints[TabNum][i]][1], 2, colors); } } } SetButtonSensitivity(TabNum); remthis = 0; /* Reset remthis variable */ } /****************************************************************/ /* This function sets the proper variables and then calls */ /* remove_last, to remove all points except the axis points. */ /****************************************************************/ void remove_all(GtkWidget *widget, gpointer data) { gint i, j, index, TabNum; TabNum = GPOINTER_TO_INT(data); if (numlastpoints[TabNum]>0 && numpoints[TabNum]>0) { index = 0; for (i=0;i0 && numpoints[TabNum]==0) { numlastpoints[TabNum] = 0; /* Nullify amount of points */ for (i=0;i<4;i++) { valueset[TabNum][i] = FALSE; bpressed[TabNum][i] = FALSE; gtk_entry_set_text((GtkEntry *) xyentry[TabNum][i], ""); } remove_last(widget,data); /* Call remove_last() */ } SetButtonSensitivity(TabNum); } /****************************************************************/ /* This function handles all of the keypresses done within the */ /* main window and handles the appropriate measures. */ /****************************************************************/ gint key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer pointer) { GtkAdjustment *adjustment; gdouble adj_val; GdkCursor *cursor; if (event->keyval==GDK_Left) { adjustment = gtk_viewport_get_hadjustment((GtkViewport *) ViewPort); adj_val = gtk_adjustment_get_value(adjustment); adj_val -= adjustment->page_size/10.0; if (adj_val < adjustment->lower) adj_val = adjustment->lower; gtk_adjustment_set_value(adjustment, adj_val); gtk_viewport_set_hadjustment((GtkViewport *) ViewPort, adjustment); } else if (event->keyval==GDK_Right) { adjustment = gtk_viewport_get_hadjustment((GtkViewport *) ViewPort); adj_val = gtk_adjustment_get_value(adjustment); adj_val += adjustment->page_size/10.0; if (adj_val > (adjustment->upper-adjustment->page_size)) adj_val = (adjustment->upper-adjustment->page_size); gtk_adjustment_set_value(adjustment, adj_val); gtk_viewport_set_hadjustment((GtkViewport *) ViewPort, adjustment); } else if (event->keyval==GDK_Up) { adjustment = gtk_viewport_get_vadjustment((GtkViewport *) ViewPort); adj_val = gtk_adjustment_get_value(adjustment); adj_val -= adjustment->page_size/10.0; if (adj_val < adjustment->lower) adj_val = adjustment->lower; gtk_adjustment_set_value(adjustment, adj_val); gtk_viewport_set_vadjustment((GtkViewport *) ViewPort, adjustment); } else if (event->keyval==GDK_Down) { adjustment = gtk_viewport_get_vadjustment((GtkViewport *) ViewPort); adj_val = gtk_adjustment_get_value(adjustment); adj_val += adjustment->page_size/10.0; if (adj_val > (adjustment->upper-adjustment->page_size)) adj_val = (adjustment->upper-adjustment->page_size); gtk_adjustment_set_value(adjustment, adj_val); gtk_viewport_set_vadjustment((GtkViewport *) ViewPort, adjustment); } else if (event->keyval==GDK_Control_L) { if (ViewedTabNum != -1) { cursor = gdk_cursor_new (GDK_CIRCLE); gdk_window_set_cursor (drawing_area[ViewedTabNum]->window, cursor); MovePointMode = TRUE; } } return 0; } /****************************************************************/ /****************************************************************/ gint key_release_event(GtkWidget *widget, GdkEventKey *event, gpointer pointer) { GdkCursor *cursor; if (event->keyval==GDK_Control_L) { if (ViewedTabNum != -1) { cursor = gdk_cursor_new (GDK_CROSSHAIR); gdk_window_set_cursor (drawing_area[ViewedTabNum]->window, cursor); MovePointMode = FALSE; } } return 0; } /****************************************************************/ /* This function loads the image, and inserts it into the tab */ /* and sets up all of the different signals associated with it. */ /****************************************************************/ gint InsertImage(char *filename, gdouble Scale, gdouble maxX, gdouble maxY, gint TabNum) { gint newX, newY; gdouble mScale; GdkPixbuf *loadgpbimage; GdkCursor *cursor; GtkWidget *dialog; gchar buf[256]; /* Text buffer for window title */ loadgpbimage = gdk_pixbuf_new_from_file(filename,NULL); /* Load image */ if (loadgpbimage==NULL) { /* If unable to load image */ dialog = gtk_message_dialog_new (GTK_WINDOW(window), /* Notify user of the error */ GTK_DIALOG_DESTROY_WITH_PARENT, /* with a dialog */ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error loading file '%s'", filename); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return -1; /* exit */ } XSize[TabNum] = gdk_pixbuf_get_width(loadgpbimage); /* Get image width */ YSize[TabNum] = gdk_pixbuf_get_height(loadgpbimage); /* Get image height */ sprintf(buf, Window_Title, filename); /* Print window title in buffer */ gtk_window_set_title (GTK_WINDOW (window), buf); /* Set window title */ mScale = -1; if (maxX != -1 && maxY != -1) { if (XSize[TabNum] > maxX) { mScale = (double) maxX/XSize[TabNum]; } if (YSize[TabNum] > maxY && (double) maxY/YSize[TabNum] < mScale) mScale = (double) maxY/YSize[TabNum]; } if (Scale == -1 && mScale != -1) Scale = mScale; if (Scale != -1) { newX = XSize[TabNum]*Scale; newY = YSize[TabNum]*Scale; gpbimage[TabNum] = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, newX, newY); gdk_pixbuf_composite(loadgpbimage, gpbimage[TabNum], 0, 0, newX, newY, 0, 0, Scale, Scale, GDK_INTERP_BILINEAR, 255); g_object_unref(loadgpbimage); } else gpbimage[TabNum] = loadgpbimage; XSize[TabNum] = gdk_pixbuf_get_width(gpbimage[TabNum]); /* Get image width */ YSize[TabNum] = gdk_pixbuf_get_height(gpbimage[TabNum]); /* Get image height */ drawing_area[TabNum] = gtk_drawing_area_new (); /* Create new drawing area */ gtk_widget_set_size_request (drawing_area[TabNum], XSize[TabNum], YSize[TabNum]); g_signal_connect (G_OBJECT (drawing_area[TabNum]), "expose_event", /* Connect drawing area to */ G_CALLBACK (expose_event), GINT_TO_POINTER (TabNum)); /* expose_event. */ g_signal_connect (G_OBJECT (drawing_area[TabNum]), "configure_event", /* Connect drawing area to */ G_CALLBACK (configure_event), GINT_TO_POINTER (TabNum)); /* configure_event. */ g_signal_connect (G_OBJECT (drawing_area[TabNum]), "button_press_event", /* Connect drawing area to */ G_CALLBACK (button_press_event), GINT_TO_POINTER (TabNum)); /* button_press_event. */ g_signal_connect (G_OBJECT (drawing_area[TabNum]), "button_release_event", /* Connect drawing area to */ G_CALLBACK (button_release_event), GINT_TO_POINTER (TabNum)); /* button_release_event */ g_signal_connect (G_OBJECT (drawing_area[TabNum]), "motion_notify_event", /* Connect drawing area to */ G_CALLBACK (motion_notify_event), GINT_TO_POINTER (TabNum)); /* motion_notify_event. */ gtk_widget_set_events (drawing_area[TabNum], GDK_EXPOSURE_MASK | /* Set the events active */ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); gtk_container_add((GtkContainer *) drawing_area_alignment, drawing_area[TabNum]); gtk_widget_show(drawing_area[TabNum]); cursor = gdk_cursor_new (GDK_CROSSHAIR); gdk_window_set_cursor (drawing_area[TabNum]->window, cursor); return 0; } /****************************************************************/ /* This callback is called when the file - exit menuoptioned is */ /* selected. */ /****************************************************************/ GCallback menu_file_exit(void) { close_application(NULL,NULL,NULL); return NULL; } /****************************************************************/ /* This callback sets up the thumbnail in the Fileopen dialog. */ /****************************************************************/ static void update_preview_cb (GtkFileChooser *file_chooser, gpointer data) { GtkWidget *preview; char *filename; GdkPixbuf *pixbuf; gboolean have_preview; preview = GTK_WIDGET (data); filename = gtk_file_chooser_get_preview_filename (file_chooser); pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL); have_preview = (pixbuf != NULL); g_free (filename); gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf); if (pixbuf) g_object_unref (pixbuf); gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview); } /****************************************************************/ /* This function sets up a new tab, sets up all of the widgets */ /* needed. */ /****************************************************************/ gint SetupNewTab(char *filename, gdouble Scale, gdouble maxX, gdouble maxY, gboolean UsePreSetCoords) { GtkWidget *table; /* GTK table/box variables for packing */ GtkWidget *tophbox, *bottomhbox; GtkWidget *trvbox, *tlvbox, *brvbox, *blvbox, *subvbox; GtkWidget *xy_label[4]; /* Labels for texts in window */ GtkWidget *logcheckb[2]; /* Logarithmic checkbuttons */ GtkWidget *nump_label, *ScrollWindow; /* Various widgets */ GtkWidget *APlabel, *PIlabel, *ZAlabel, *Llabel, *tab_label; GtkWidget *alignment, *fixed; GtkWidget *x_label, *y_label, *tmplabel; GtkWidget *ordercheckb[3], *UseErrCheckB, *actioncheckb[2]; GtkWidget *Olabel, *Elabel, *Alabel; GSList *group; GtkWidget *dialog; gchar buf[256], buf2[256]; gint i, TabNum; gboolean FileInCwd; static gint NumberOfTabs=0; if (NumberOfTabs == MAXNUMTABS-1) { dialog = gtk_message_dialog_new (GTK_WINDOW(window), /* Notify user of the error */ GTK_DIALOG_DESTROY_WITH_PARENT, /* with a dialog */ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Cannot open more tabs, maximum number reached (%d)", MAXNUMTABS); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return -1; } NumberOfTabs++; strncpy(buf2,filename,256); if (strcmp(dirname(buf2),getcwd(buf,256)) == 0) { tab_label = gtk_label_new(basename(filename)); FileInCwd = TRUE; } else { tab_label = gtk_label_new(filename); FileInCwd = FALSE; } table = gtk_table_new(1, 2 ,FALSE); /* Create table */ gtk_container_set_border_width (GTK_CONTAINER (table), WINDOW_BORDER); gtk_table_set_row_spacings(GTK_TABLE(table), SECT_SEP); /* Set spacings */ gtk_table_set_col_spacings(GTK_TABLE(table), 0); TabNum = gtk_notebook_append_page((GtkNotebook *) mainnotebook, table, tab_label); if (TabNum == -1) { return -1; } /* Init datastructures */ bpressed[TabNum][0] = FALSE; bpressed[TabNum][1] = FALSE; bpressed[TabNum][2] = FALSE; bpressed[TabNum][3] = FALSE; valueset[TabNum][0] = FALSE; valueset[TabNum][1] = FALSE; valueset[TabNum][2] = FALSE; valueset[TabNum][3] = FALSE; numpoints[TabNum] = 0; numlastpoints[TabNum] = 0; ordering[TabNum] = 0; lastpoints[TabNum] = (gint *) malloc(sizeof(gint) * (MaxPoints[TabNum]+4)); if (lastpoints[TabNum]==NULL) { printf("Error allocating memory for lastpoints. Exiting.\n"); return -1; } points[TabNum] = (void *) malloc(sizeof(gint *) * MaxPoints[TabNum]); if (points[TabNum]==NULL) { printf("Error allocating memory for points. Exiting.\n"); return -1; } for (i=0;idata); if ((c = strstr((gchar *) data->data, URI_IDENTIFIER)) == NULL) { dialog = gtk_message_dialog_new (GTK_WINDOW(window), /* Notify user of the error */ GTK_DIALOG_DESTROY_WITH_PARENT, /* with a dialog */ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Cannot extract filename from uri '%s'", filename); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; } strncpy(filename,&(c[strlen(URI_IDENTIFIER)]),256); for (i=0;itype), &error); if (loader) { error = NULL; if (gdk_pixbuf_loader_write( loader, data->data, data->length, &error)) { GdkPixbuf *pbuf = gdk_pixbuf_loader_get_pixbuf(loader); if ( pbuf ) { int width = gdk_pixbuf_get_width(pbuf); int height = gdk_pixbuf_get_height(pbuf); printf("Received image of size %d x %d\n", width, height); // Print debugging information } } } break; } case APP_X_COLOR: { printf("Received drag-and-drop app-x-color\n"); break; } } gtk_drag_finish (drag_context, TRUE, FALSE, event_time); } /****************************************************************/ /* This callback handles the file - open dialog. */ /****************************************************************/ GCallback menu_file_open(void) { GtkWidget *dialog, *scalespinbutton, *hboxextra, *scalelabel; GtkImage *preview; GtkAdjustment *scaleadj; GtkFileFilter *filefilter; dialog = gtk_file_chooser_dialog_new ("Open File", GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); // Set filtering of files to open to filetypes gdk_pixbuf can handle filefilter = gtk_file_filter_new(); gtk_file_filter_add_pixbuf_formats(filefilter); gtk_file_chooser_set_filter((GtkFileChooser *) dialog, (GtkFileFilter *) filefilter); hboxextra = gtk_hbox_new(FALSE, ELEM_SEP); scalelabel = gtk_label_new(scale_string); scaleadj = (GtkAdjustment *) gtk_adjustment_new(1, 0.1, 100, 0.1, 0.1, 1); scalespinbutton = gtk_spin_button_new(scaleadj, 0.1, 1); gtk_box_pack_start (GTK_BOX (hboxextra), scalelabel, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hboxextra), scalespinbutton, FALSE, FALSE, 0); gtk_file_chooser_set_extra_widget((GtkFileChooser *) dialog, hboxextra); gtk_widget_show(hboxextra); gtk_widget_show(scalelabel); gtk_widget_show(scalespinbutton); preview = (GtkImage *) gtk_image_new (); gtk_file_chooser_set_preview_widget ((GtkFileChooser *) dialog, (GtkWidget *) preview); g_signal_connect (dialog, "update-preview", G_CALLBACK (update_preview_cb), preview); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); SetupNewTab(filename, gtk_spin_button_get_value((GtkSpinButton *) scalespinbutton), -1, -1, FALSE); g_free (filename); } gtk_widget_destroy (dialog); return NULL; } /****************************************************************/ /* This function destroys a dialog. */ /****************************************************************/ void dialog_destroy( GtkWidget *widget, gpointer data) { gtk_grab_remove(GTK_WIDGET(widget)); } /****************************************************************/ /* This function closes a dialog. */ /****************************************************************/ void dialog_close( GtkWidget *widget, gpointer data) { gtk_widget_destroy(GTK_WIDGET(data)); } /****************************************************************/ /* This Callback generates the help - about dialog. */ /****************************************************************/ GCallback menu_help_about(void) { gchar *authors[] = AUTHORS; gtk_show_about_dialog((GtkWindow *) window, "authors", authors, "comments", COMMENTS, "copyright", COPYRIGHT, "license", LICENSE, "name", PROGNAME, "version", VERSION, "website", HOMEPAGEURL, "website-label", HOMEPAGELABEL, NULL); return NULL; } /****************************************************************/ /* This function is called when a tab is closed. It removes the */ /* page from the notebook, all widgets within the page are */ /* destroyed. */ /****************************************************************/ GCallback menu_tab_close(void) { gtk_notebook_remove_page((GtkNotebook *) mainnotebook, ViewedTabNum); /* This appearently takes care of everything */ logxy[ViewedTabNum][0] = FALSE; logxy[ViewedTabNum][1] = FALSE; zoomareabox[ViewedTabNum] = NULL; logbox[ViewedTabNum] = NULL; oppropbox[ViewedTabNum] = NULL; NoteBookNumPages--; if (NoteBookNumPages == 0) gtk_action_group_set_sensitive(tab_action_group, FALSE); return NULL; } /****************************************************************/ /* This callback handles the fullscreen toggling. */ /****************************************************************/ GCallback full_screen_action_callback(GtkWidget *widget, gpointer func_data) { if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(widget))) { gtk_window_fullscreen(GTK_WINDOW (window)); WinFullScreen = TRUE; } else { gtk_window_unfullscreen(GTK_WINDOW (window)); WinFullScreen = FALSE; } return NULL; } /****************************************************************/ /* This callback handles the hide zoom area toggling. */ /****************************************************************/ GCallback hide_zoom_area_callback(GtkWidget *widget, gpointer func_data) { int i; if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(widget))) { for (i=0;i 1) if (strcmp(argv[1],"-h")==0 || /* If no parameters given, -h or --help */ strcmp(argv[1],"--help")==0) { printf("%s",HelpText); /* Print help */ exit(0); /* and exit */ } maxX = -1; maxY = -1; Scale = -1; UseError = FALSE; UsePreSetCoords = FALSE; Uselogxy[0] = FALSE; Uselogxy[1] = FALSE; for (i=1;i= argc) break; } else if (strcmp(argv[i],"-errors")==0) { UseError = TRUE; } else if (strcmp(argv[i],"-lnx")==0) { Uselogxy[0] = TRUE; } else if (strcmp(argv[i],"-lny")==0) { Uselogxy[1] = TRUE; } else if (strcmp(argv[i],"-max")==0) { if (argc-i < 3) { printf("Too few parameters for -max\n"); exit(0); } if (sscanf(argv[i+1],"%d", &maxX)!=1) { printf("-max first parameter in invalid form !\n"); exit(0); } if (sscanf(argv[i+2],"%d", &maxY)!=1) { printf("-max second parameter in invalid form !\n"); exit(0); } i+=2; if (i >= argc) break; } else if (strcmp(argv[i],"-coords")==0) { UsePreSetCoords = TRUE; if (argc-i < 5) { printf("Too few parameters for -coords\n"); exit(0); } if (sscanf(argv[i+1],"%lf", &TempCoords[0])!=1) { printf("-max first parameter in invalid form !\n"); exit(0); } if (sscanf(argv[i+2],"%lf", &TempCoords[1])!=1) { printf("-max second parameter in invalid form !\n"); exit(0); } if (sscanf(argv[i+3],"%lf", &TempCoords[2])!=1) { printf("-max third parameter in invalid form !\n"); exit(0); } if (sscanf(argv[i+4],"%lf", &TempCoords[3])!=1) { printf("-max fourth parameter in invalid form !\n"); exit(0); } i+=4; if (i >= argc) break; /* } else if (strcmp(argv[i],"-hidelog")==0) { HideLog = TRUE; } else if (strcmp(argv[i],"-hideza")==0) { HideZoomArea = TRUE; } else if (strcmp(argv[i],"-hideop")==0) { HideOpProp = TRUE; */ } else { printf("Unknown parameter : %s\n", argv[i]); exit(0); } continue; } else { FileIndex[NumFiles] = i; NumFiles++; } } window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* Create window */ gtk_window_set_default_size((GtkWindow *) window, 640, 480); gtk_window_set_title(GTK_WINDOW (window), Window_Title_NoneOpen); /* Set window title */ gtk_window_set_resizable(GTK_WINDOW (window), TRUE); gtk_container_set_border_width(GTK_CONTAINER (window), 0); /* Set borders in window */ mainvbox = gtk_vbox_new(FALSE, 0); gtk_container_add( GTK_CONTAINER(window), mainvbox); g_signal_connect(G_OBJECT (window), "delete_event", /* Init delete event of window */ G_CALLBACK (close_application), NULL); gtk_drag_dest_set(window, GTK_DEST_DEFAULT_ALL, ui_drop_target_entries, NUM_IMAGE_DATA, (GDK_ACTION_COPY | GDK_ACTION_MOVE)); g_signal_connect(G_OBJECT (window), "drag-data-received", /* Drag and drop catch */ G_CALLBACK (drag_data_received), NULL); /* Create menues */ action_group = gtk_action_group_new("MenuActions"); gtk_action_group_add_actions(action_group, entries, G_N_ELEMENTS (entries), window); gtk_action_group_add_toggle_actions(action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), window); tab_action_group = gtk_action_group_new("TabActions"); gtk_action_group_add_actions(tab_action_group, closeaction, G_N_ELEMENTS (closeaction), window); gtk_action_group_set_sensitive(tab_action_group, FALSE); ui_manager = gtk_ui_manager_new(); gtk_ui_manager_insert_action_group(ui_manager, action_group, 0); gtk_ui_manager_insert_action_group(ui_manager, tab_action_group, 0); accel_group = gtk_ui_manager_get_accel_group(ui_manager); gtk_window_add_accel_group(GTK_WINDOW (window), accel_group); error = NULL; if (!gtk_ui_manager_add_ui_from_string(ui_manager, ui_description, -1, &error)) { g_message("building menus failed: %s", error->message); g_error_free(error); exit(EXIT_FAILURE); } menubar = gtk_ui_manager_get_widget(ui_manager, "/MainMenu"); gtk_box_pack_start(GTK_BOX (mainvbox), menubar, FALSE, FALSE, 0); mainnotebook = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX (mainvbox), mainnotebook, TRUE, TRUE, 0); g_signal_connect(G_OBJECT (mainnotebook), "switch-page", /* Init switch-page event of notebook */ G_CALLBACK (NoteBookTabChange), NULL); if (NumFiles > 0) { for (i=0;i