diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/gv-savepos |
Initial commit
Diffstat (limited to 'support/gv-savepos')
-rw-r--r-- | support/gv-savepos/README | 15 | ||||
-rw-r--r-- | support/gv-savepos/gv-3.6.2-savepos.patch | 180 |
2 files changed, 195 insertions, 0 deletions
diff --git a/support/gv-savepos/README b/support/gv-savepos/README new file mode 100644 index 0000000000..76ec9edd31 --- /dev/null +++ b/support/gv-savepos/README @@ -0,0 +1,15 @@ +- this patch was made against gv-3.6.2 sources coming with debian. + Not tested with other versions. + +- how to apply: + - cd /path/to/gv-source + - patch -p1 </path/to/the/patch + - build gv; with the version coming with debian, it's as simple + as: + ./configure; make + +- how to use: + - press z to append the current coordinate to a file named + "gv.savepos" in the current directory + +- feedbacks: please send them to <hanthethanh gmail com> diff --git a/support/gv-savepos/gv-3.6.2-savepos.patch b/support/gv-savepos/gv-3.6.2-savepos.patch new file mode 100644 index 0000000000..9bc3ccda6a --- /dev/null +++ b/support/gv-savepos/gv-3.6.2-savepos.patch @@ -0,0 +1,180 @@ +Binary files gv-3.6.2/doc/gv.info and gv-3.6.2-savepos/doc/gv.info differ +diff -u -r gv-3.6.2/src/actions.c gv-3.6.2-savepos/src/actions.c +--- gv-3.6.2/src/actions.c 2005-08-10 20:46:20.000000000 +0530 ++++ gv-3.6.2-savepos/src/actions.c 2008-01-09 09:14:43.000000000 +0530 +@@ -793,6 +793,23 @@ + } + + /*##################################################################*/ ++/* action_savepos */ ++/*##################################################################*/ ++ ++void ++action_savepos(w, event, params, num_params) ++ Widget w; ++ XEvent *event; ++ String *params; ++ Cardinal *num_params; ++{ ++ BEGINMESSAGE(action_savepos) ++ if (!XtIsSensitive(saveposEntry)) {INFMESSAGE(insensitive) ENDMESSAGE(action_savepos) return; } ++ cb_savepos((Widget)NULL,(XtPointer)NULL,(XtPointer)NULL); ++ ENDMESSAGE(action_savepos) ++} ++ ++/*##################################################################*/ + /* action_save */ + /* Popup the save file dialog box. */ + /*##################################################################*/ +diff -u -r gv-3.6.2/src/actions.h gv-3.6.2-savepos/src/actions.h +--- gv-3.6.2/src/actions.h 2004-11-11 17:51:04.000000000 +0530 ++++ gv-3.6.2-savepos/src/actions.h 2008-01-08 22:57:35.000000000 +0530 +@@ -150,6 +150,15 @@ + #endif + ); + ++extern void action_savepos ( ++#if NeedFunctionPrototypes ++ Widget, ++ XEvent *, ++ String *, ++ Cardinal * ++#endif ++); ++ + extern void action_save ( + #if NeedFunctionPrototypes + Widget, +diff -u -r gv-3.6.2/src/callbacks.c gv-3.6.2-savepos/src/callbacks.c +--- gv-3.6.2/src/callbacks.c 2005-08-10 17:03:21.000000000 +0530 ++++ gv-3.6.2-savepos/src/callbacks.c 2008-01-13 22:46:05.000000000 +0530 +@@ -90,6 +90,9 @@ + static char* save_directory = NULL; + static char* open_directory = NULL; + ++static int last_psx; ++static int last_psy; ++ + /*############################################################*/ + /* cb_showTitle */ + /*############################################################*/ +@@ -826,6 +829,28 @@ + } + + /*##################################################################*/ ++/* cb_savepos */ ++/*##################################################################*/ ++ ++void ++cb_savepos(w, client_data, call_data) ++ Widget w; ++ XtPointer client_data, call_data; ++{ ++ FILE* posfile = fopen("gv.savepos", "a"); ++ ++ BEGINMESSAGE(cb_savepos) ++ if (posfile == NULL) { ++ INFMESSAGE(cannot open file for writting) ++ ENDMESSAGE(cb_savepos) ++ return; ++ } ++ fprintf(posfile, "%i %i\n", last_psx, last_psy); ++ fclose(posfile); ++ ENDMESSAGE(cb_savepos) ++} ++ ++/*##################################################################*/ + /* cb_redisplay */ + /*##################################################################*/ + +@@ -1134,6 +1159,8 @@ + } + x=p->psx; y=p->psy; + } ++ last_psx = p->psx; ++ last_psy = p->psy; + ENDMESSAGE1(cb_track) + return; + } +@@ -1374,5 +1401,3 @@ + XtDestroyWidget(toplevel); + ENDMESSAGE(cb_doQuit) + } +- +- +diff -u -r gv-3.6.2/src/callbacks.h gv-3.6.2-savepos/src/callbacks.h +--- gv-3.6.2/src/callbacks.h 2004-11-11 17:51:04.000000000 +0530 ++++ gv-3.6.2-savepos/src/callbacks.h 2008-01-09 09:15:12.000000000 +0530 +@@ -193,6 +193,14 @@ + #endif + ); + ++extern void cb_savepos ( ++#if NeedFunctionPrototypes ++ Widget, ++ XtPointer, ++ XtPointer ++#endif ++); ++ + extern void cb_redisplay ( + #if NeedFunctionPrototypes + Widget, +@@ -313,4 +321,5 @@ + #endif + ); + ++ + #endif /* _GV_CALLBACKS_H_ */ +diff -u -r gv-3.6.2/src/gv_misc_res.dat gv-3.6.2-savepos/src/gv_misc_res.dat +--- gv-3.6.2/src/gv_misc_res.dat 2005-04-01 02:44:27.000000000 +0530 ++++ gv-3.6.2-savepos/src/gv_misc_res.dat 2008-01-09 09:25:28.000000000 +0530 +@@ -401,6 +401,7 @@ + <Key>p: GV_Print(all) \n\ + ~c ~s <Key>period: GV_Page(redisplay) \n\ + <Key>period: GV_Reopen() \n\ ++ <Key>Z: GV_SavePos() \n\ + c <Key>L: GV_Page(redisplay) \n\ + <Key>M: GV_SetPageMark(current,mark)\n\ + <Key>N: GV_SetPageMark(current,unmark)\n\ +diff -u -r gv-3.6.2/src/main.c gv-3.6.2-savepos/src/main.c +--- gv-3.6.2/src/main.c 2006-09-15 00:26:08.000000000 +0530 ++++ gv-3.6.2-savepos/src/main.c 2008-01-09 09:14:43.000000000 +0530 +@@ -236,6 +236,7 @@ + { "GV_Print" , action_print }, + { "GV_Quit" , action_quit }, + { "GV_Reopen" , action_reopen }, ++ { "GV_SavePos" , action_savepos }, + { "GV_Resizing" , action_autoResize }, + { "GV_Save" , action_save }, + { "GV_SetScale" , action_setScale }, +@@ -780,6 +781,7 @@ + { &fileMenu, "menu", NULL ,NULL}, + { &openEntry, "open", cb_openFile, NULL}, + { &reopenEntry, "reopen", cb_reopen, NULL}, ++ { &saveposEntry, "savepos", cb_savepos, NULL}, + { &updateEntry, "update", cb_checkFile, (XtPointer)CHECK_FILE_VERSION }, + { NULL, "line", NULL, NULL }, + { &printAllEntry, "printAllPages", cb_print, (XtPointer)PAGE_MODE_ALL}, +diff -u -r gv-3.6.2/src/main_globals.h gv-3.6.2-savepos/src/main_globals.h +--- gv-3.6.2/src/main_globals.h 2005-03-31 17:44:09.000000000 +0530 ++++ gv-3.6.2-savepos/src/main_globals.h 2008-01-09 09:18:00.000000000 +0530 +@@ -171,6 +171,7 @@ + EXTERN Widget fileMenu; + EXTERN Widget openEntry; + EXTERN Widget reopenEntry; ++EXTERN Widget saveposEntry; + EXTERN Widget updateEntry; + EXTERN Widget printAllEntry; + EXTERN Widget printMarkedEntry; +diff -u -r gv-3.6.2/src/misc.c gv-3.6.2-savepos/src/misc.c +--- gv-3.6.2/src/misc.c 2005-08-10 17:03:21.000000000 +0530 ++++ gv-3.6.2-savepos/src/misc.c 2008-01-09 09:18:00.000000000 +0530 +@@ -1084,6 +1084,7 @@ + misc_setSensitive(w_unmarkAllPages , show_unmarkAllPages , (toc_text != NULL)); + + XtSetSensitive(reopenEntry, (gv_psfile != NULL)); ++ XtSetSensitive(saveposEntry, (gv_psfile != NULL)); + XtSetSensitive(printAllEntry, (gv_psfile != NULL)); + XtSetSensitive(printMarkedEntry, (toc_text != NULL)); + XtSetSensitive(saveAllEntry, (gv_psfile != NULL)); |