home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume21 / pan / part02 < prev    next >
Encoding:
Text File  |  1993-11-08  |  44.7 KB  |  1,506 lines

  1. Newsgroups: comp.sources.x
  2. From: jeff@tasslehoff.interlan.com (Jeff Bailey)
  3. Subject: v21i038:  pan - A post a note program, Part02/06
  4. Message-ID: <1993Nov9.000702.10767@sparky.sterling.com>
  5. X-Md4-Signature: cac7eab6c89f045fdcaba0ddd0a850b4
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Tue, 9 Nov 1993 00:07:02 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: jeff@tasslehoff.interlan.com (Jeff Bailey)
  12. Posting-number: Volume 21, Issue 38
  13. Archive-name: pan/part02
  14. Environment: X11, OpenLook, XView
  15. Supersedes: pan: Volume 16, Issue 137-142
  16.  
  17. ---- Cut Here and feed the following to sh ----
  18. #!/bin/sh
  19. # This is part 02 of a multipart archive
  20. # ============= pan3.0/README ==============
  21. if test ! -d 'pan3.0'; then
  22.     echo 'x - creating directory pan3.0'
  23.     mkdir 'pan3.0'
  24. fi
  25. if test -f 'pan3.0/README' -a X"$1" != X"-c"; then
  26.     echo 'x - skipping pan3.0/README (File already exists)'
  27. else
  28. echo 'x - extracting pan3.0/README (Text)'
  29. sed 's/^X//' << 'SHAR_EOF' > 'pan3.0/README' &&
  30. XAbout Pan:
  31. X
  32. XPan is an Open Look X Windows Post A Note program.  It is basically a note
  33. Xmanager program.  It organizes notes into folders.  Each note may be hidden or
  34. Xvisible.  If it is visible, it is mapped to a window on the display.  The
  35. Xnote's state, position, and size are "remembered" across invocations of Pan.
  36. X
  37. XSome of Pan's features are:
  38. X
  39. X    o  Multiple folders
  40. X    o  Number of notes limited only by memory (swap space).
  41. X    o  Re-sizable notes with full text editing capabilities.
  42. X    o  Note text size limited only by machine resources.
  43. X    o  Command line control language.
  44. X    o  Flexible note searching features.
  45. X    o  Flexible note printing features.
  46. X
  47. XNew Features in Version 3.0 (in no particular order):
  48. X
  49. X    o  Abbreviated button with user configurable menu for quick searching
  50. X       for notes by title.
  51. X    o  Notes now have an Action menu button with Print, Width, and Destroy
  52. X       menu items.  (It is now harder to accidentally destroy a note.)
  53. X    o  Width option from note's Action menu will automatically expand
  54. X       a note to a specified character width.
  55. X    o  Windows and the widgets within them are now created and positioned
  56. X       better.  Pan now handles the -scale option and different fonts
  57. X       better.
  58. X    o  Command line control interface for Pan
  59. X        o  X resource to control processing interval.
  60. X        o  X resource to enable/disable logging
  61. X    o  X resources for top, bottom, left, and right window border margins.
  62. X       Allows for better interaction with window managers other than olwm.
  63. X    o  X resource for title length limit in menus.  Also, better "fitting"
  64. X       of titles in menus with proportional fonts.
  65. X    o  Quit menu item now at bottom of Action menu.  (Fewer accidental quits).
  66. X        o  X resource to specify default action of Action menu
  67. X    o  X resource to limit the number of notes exposed by a single action.
  68. X       Prevents accidental "over exposures" leading to over usage of swap
  69. X       resources.
  70. X    o  X resource to independently set the text subwindow font.
  71. X    o  X resource to allow display of folder name in note's title bar.
  72. X    o  Handles iconified notes better.
  73. X    o  Matching notes window now re-sizable
  74. X    o  Move notes window now re-sizable
  75. X    o  New (different) icon for the main Pan window
  76. X    o  Visual feedback on folder creation
  77. X    o  All pop ups now have a class of "Pan"
  78. X    o  X Resources to specify initial size of new notes.
  79. X    o  Support for drag and drop of a note to another application
  80. X
  81. XHistory:
  82. X
  83. XI wrote this program after seeing a couple of X based post-it style programs
  84. Xand deciding that none of them did exactly what I wanted.  Note that I intend
  85. Xno insult by this statement - I simply wanted different functionality.  Pan has
  86. Xgone through several in-house revisions.  Some of the available options
  87. Xwere requested by individual users of the program.  Because of this, they
  88. Xmay not seem generally useful.
  89. X
  90. XVersion 3.0 is the second public release of Pan.  It is greatly enhanced
  91. Xand incorporates many user requested features.
  92. X
  93. XVersion 2.4 is the first version that I publicly distributed.
  94. X
  95. XIf you find bugs, or mis-features, or want enhancements, feel free to send
  96. Xme e-mail.  Note, however, that I can promise nothing.  I may or may not do
  97. Xwhat you request.  It depends upon my available free time, current work
  98. Xload, and whether I feel it is generally desirable or feasible.
  99. X
  100. XCaveats:
  101. X
  102. XA lot of people have been using this program for quite a while, and I haven't
  103. Xgotten a single complaint about a lost note due to program error.  However,
  104. Xas we all know, there is always a first.  In other words, I think pan is
  105. Xpretty trustworthy, but I wouldn't bet my life on it!
  106. X
  107. XVersion 3.0:
  108. X
  109. XI have only built and tested Pan 3.0 under Open Windows V3 on a sun4 platform.
  110. XI have tried to remain compatible with OW2.0, but I may have accidentally
  111. Xused a new feature, or attribute.  If Pan 3.0 won't compile or work correctly
  112. Xunder OW2.0, get Pan 2.4 and use it.
  113. X
  114. X****
  115. XSpecial thanks to the following people who helped me by Beta testing pan 3.0:
  116. X****
  117. X
  118. XCharles.Ditzel@west.sun.com
  119. Xwollborn@helios.tnt.uni-hannover.de
  120. Xjay@vnet.ibm.com
  121. Xbk@kullmar.kullmar.se        (Thanks for help with the compiler warnings)
  122. Xgsipe@pyratl.ga.pyramid.com    (Thanks for the BSD support)
  123. Xrwm26@cas.org
  124. XMats.Larsson@eua.ericsson.se
  125. Xamir@matis.ingr.com        (Thanks for the Imakefile)
  126. Xian@sq.com
  127. Xlee@sq.com
  128. XJoe.Backo@east.sun.com
  129. Xam@comdyn.cdsyd.oz.au        (Thanks for finding the destroy folder bug)
  130. Xyu@math.duke.edu        (Thanks for finding the edited list bug)
  131. Xneilb@borris.eece.unm.edu
  132. Xdj@micromuse.co.uk
  133. X
  134. XIf I forgot anybody, or left something off of the list, my apologies.
  135. X
  136. XVersion 2.4:
  137. X
  138. XI've only ever built this under Open Windows (v2 & v3) on a sun4 platform.
  139. XI don't know whether it will build and run under any other configuration.
  140. X
  141. XBuilding pan:
  142. X
  143. XBasically, pan needs the xview library, the olgx library, and the X11 library.
  144. XIt also needs the X and xview include files.
  145. X
  146. XTo build pan, make sure OPENWINHOME is set in the environment and
  147. Xthen run make.  If this doesn't work, take a look at the Makefile and
  148. Xsee if you can modify it for your configuration.  The included Makefile
  149. Xis pathetically simple.
  150. X
  151. XNote that to include drag and drop of notes to other applications, PAN_DND
  152. Xmust be defined during the compile.  This feature is available *only* under
  153. XOW/Xview V3.x.
  154. X
  155. XIf you are compiling under BSD, make sure that you (or your compiler) defines
  156. XBSD.  This is necessary because of some header file differences.
  157. X
  158. XNote that if you use a more strict (or ANSI) compiler, you might get lots
  159. Xof warnings.  I haven't gone through and made sure that I always cast the
  160. Xreturn value from xv_get() everywhere and I might have been sloppy elsewhere
  161. Xtoo.  I apologize if this causes any grief.
  162. X
  163. XSCRIPTS FOR CONTROL LANGUAGE EXECUTION
  164. X
  165. XTwo scripts are included for support of control language execution.  The
  166. Xcontrol language is documented in the manual entry for pan.  However, I did
  167. Xnot get the chance to write manual entries for the scripts.  They are 
  168. Xvery simplistic, so using them shouldn't be a problem.  Briefly:
  169. X
  170. Xpancmd - Allows the queuing of control language statements to be executed
  171. X         by pan.  Usage is:
  172. X
  173. Xpancmd [-user <username>] [-dir <pan directory>] [-now] <pan command> <arguments> ...
  174. X
  175. X    -user - specify another user name to use to locate the pan directory.
  176. X            Uses $HOME/.pan as the default.
  177. X
  178. X    -dir  - specify the full pan directory path name.
  179. X
  180. X    -now  - attempt to signal the running pan to execute the command
  181. X            immediately.
  182. X
  183. X    Command Language Syntax:
  184. X
  185. X    expose    title <title RE> [windowmax <max # to expose>]
  186. X    hide      title <title RE>
  187. X    move      source <folder> title <title RE> destination <folder>
  188. X    newfolder folder <name>
  189. X    newnote   [folder <folder>] [title <title>] [size <width> <height>]
  190. X          [location <x> <y>] [hidden|visible|veiled] [file <name>]
  191. X    print     folder <folder> title <title RE>
  192. X    quit
  193. X    veil      title <title RE>
  194. X
  195. Xpanlog - Allows viewing and removal of the pan log file.   This file contains
  196. X         the results of execution of control language statements.  Usage:
  197. X
  198. Xpanlog [-user <username>] [-dir <pan directory>] [-remove] [-quiet]
  199. X
  200. X    -user   - specify another user name to use to locate the pan directory.
  201. X              Uses $HOME/.pan as the default.
  202. X
  203. X    -dir    - specify the full pan directory path name.
  204. X
  205. X    -remove - remove the log after displaying it.
  206. X
  207. X    -quiet  - do not display the log.
  208. SHAR_EOF
  209. chmod 0644 pan3.0/README ||
  210. echo 'restore of pan3.0/README failed'
  211. Wc_c="`wc -c < 'pan3.0/README'`"
  212. test 7450 -eq "$Wc_c" ||
  213.     echo 'pan3.0/README: original size 7450, current size' "$Wc_c"
  214. fi
  215. # ============= pan3.0/pan.h ==============
  216. if test -f 'pan3.0/pan.h' -a X"$1" != X"-c"; then
  217.     echo 'x - skipping pan3.0/pan.h (File already exists)'
  218. else
  219. echo 'x - extracting pan3.0/pan.h (Text)'
  220. sed 's/^X//' << 'SHAR_EOF' > 'pan3.0/pan.h' &&
  221. X/*
  222. XPost A Note V3.0
  223. XCopyright (c) 1993, Jeffrey W. Bailey
  224. XAll rights reserved.
  225. X
  226. XPermission is granted to distribute this program in exact, complete
  227. Xsource form, which includes this copyright notice, as long as no fee
  228. Xother than media and distribution cost is charged.
  229. X
  230. XThis program may not be used in whole, or in part, in any other manner
  231. Xwithout prior written permission from the author.
  232. X
  233. XThis program may not be distributed in modified form without prior
  234. Xwritten permission from the author.  In other words, patches may be
  235. Xdistributed, but modified source may not be distributed.
  236. X
  237. XIf there are any questions, comments or suggestions, the author may be
  238. Xcontacted at:
  239. X
  240. X    jeff@rd1.interlan.com
  241. X
  242. X    or
  243. X
  244. X    Jeffrey Bailey
  245. X    Racal-Datacom, Inc.
  246. X    Mail Stop E-110
  247. X    1601 N. Harrison Parkway
  248. X    Sunrise, FL  33323-2899
  249. X*/
  250. X
  251. X#ifndef  PAN
  252. X
  253. X#include <stdio.h>
  254. X
  255. X#ifdef HAS_STDLIB
  256. X#include <stdlib.h>
  257. X#else
  258. Xextern char *malloc();
  259. Xextern char *getenv();
  260. X#endif /* HAS_STDLIB */
  261. X
  262. X#include <sys/types.h>
  263. X
  264. X#ifndef BSD
  265. X#include <time.h>
  266. X#include <dirent.h>
  267. X#else
  268. X#include <sys/dir.h>
  269. X#define dirent direct
  270. X#endif /* BSD */
  271. X
  272. X#include <sys/file.h>
  273. X#include <sys/wait.h>
  274. X#include <sys/time.h>
  275. X#include <sys/resource.h>
  276. X#include <sys/stat.h>
  277. X#include <xview/xview.h>
  278. X#include <xview/panel.h>
  279. X#include <xview/openmenu.h>
  280. X#include <xview/textsw.h>
  281. X#include <xview/svrimage.h>
  282. X#include <xview/icon.h>
  283. X#include <xview/notice.h>
  284. X#include <xview/defaults.h>
  285. X#include <xview/seln.h>
  286. X
  287. X#define  PAN
  288. X
  289. X/* parser stuff */
  290. Xstruct ps_component
  291. X    {
  292. X    struct ps_component *ps_prev; /* Pointer to previous node */
  293. X    struct ps_component *ps_next; /* Pointer to next node */
  294. X    char *ps_text;                /* Pointer to token text */
  295. X    char ps_start_delim;          /* Character delimiter for start of token */
  296. X    char ps_end_delim;            /* Character delimiter for end of token */
  297. X    };
  298. Xextern struct ps_component *parse_string();
  299. X
  300. X
  301. X/* Linked List stuff */
  302. X
  303. Xstruct LLM_node   {
  304. X                  struct LLM_node *Next;
  305. X                  struct LLM_node *Prev;
  306. X                  };
  307. X
  308. Xstruct LLM_root   {
  309. X                  int              Init;
  310. X                  struct LLM_node *First;
  311. X                  struct LLM_node *Last;
  312. X                  struct LLM_node *Current;
  313. X                  unsigned int     Size;
  314. X                  };
  315. X
  316. Xtypedef struct LLM_root LLM_root;
  317. X
  318. Xextern char *LLM_add();
  319. Xextern char *LLM_first();
  320. Xextern char *LLM_insert();
  321. Xextern char *LLM_last();
  322. Xextern char *LLM_next();
  323. Xextern char *LLM_previous();
  324. Xextern char *LLM_current();
  325. X
  326. X/* Pan stuff */
  327. Xstruct resource {
  328. X    char *a;
  329. X    char *b;
  330. X};
  331. X
  332. X#ifdef public
  333. Xstruct resource resources [] = {
  334. X    {"pan.initialDirectory",    "pan.initialdirectory"},
  335. X    {"pan.noticeBeep",        "pan.noticebeep"},
  336. X    {"pan.confirmDestroy",    "pan.confirmdestroy"},
  337. X    {"pan.printCommand",    "pan.printcommand"},
  338. X    {"pan.iconTransparent",    "pan.icontransparent"},
  339. X    {"pan.folderOrder",            "pan.folderorder"},
  340. X    {"pan.defaultSearch",    "pan.defaultsearch"},
  341. X    {"pan.folderInTitle",    "pan.folderintitle"},
  342. X    {"pan.textFont",        "pan.textfont"},
  343. X    {"pan.windowMax",        "pan.windowmax"},
  344. X    {"pan.actionDefault",    "pan.actiondefault"},
  345. X    {"pan.menuTextLength",    "pan.menutextlength"},
  346. X    {"pan.setWidth",        "pan.setwidth"},
  347. X    {"pan.logging",        "pan.logging"},
  348. X    {"pan.topMargin",        "pan.topmargin"},
  349. X    {"pan.bottomMargin",    "pan.bottommargin"},
  350. X    {"pan.leftMargin",        "pan.leftmargin"},
  351. X    {"pan.rightMargin",        "pan.rightmargin"},
  352. X    {"pan.checkInterval",    "pan.checkinterval"},
  353. X    {"pan.searchMenu",        "pan.searchmenu"},
  354. X    {"pan.noteWidth",        "pan.notewidth"},
  355. X    {"pan.noteHeight",        "pan.noteheight"}
  356. X};
  357. X
  358. Xunsigned short mainicon [] = {
  359. X#include "panmain.icon"
  360. X};
  361. X
  362. Xunsigned short mainiconmask [] = {
  363. X#include "panmain.mask.icon"
  364. X};
  365. X
  366. Xunsigned short myicon [] = {
  367. X#include "pan.icon"
  368. X};
  369. X
  370. Xunsigned short myiconmask [] = {
  371. X#include "pan.mask.icon"
  372. X};
  373. X
  374. X#else /* ifdef public */
  375. X
  376. Xextern struct resource resources [];
  377. Xextern unsigned short mainicon [];
  378. Xextern unsigned short mainiconmask [];
  379. Xextern unsigned short myicon [];
  380. Xextern unsigned short myiconmask [];
  381. X
  382. X#endif /* ifdef public */
  383. X
  384. X/* Index number into resources array */
  385. X#define RES_IDIR          0
  386. X#define RES_NBEEP         1
  387. X#define RES_CDESTROY      2
  388. X#define RES_PCOMMAND      3
  389. X#define RES_ITRANSPARENT  4
  390. X#define RES_FORDER        5
  391. X#define RES_DSEARCH       6
  392. X#define RES_FINTITLE      7
  393. X#define RES_TEXTFONT      8
  394. X#define RES_WINDOWMAX     9
  395. X#define RES_ACTIONDEF     10
  396. X#define RES_MENUTEXTLEN   11
  397. X#define RES_SETWIDTH      12
  398. X#define RES_LOGGING       13
  399. X#define RES_TOPMARGIN     14
  400. X#define RES_BOTTOMMARGIN  15
  401. X#define RES_LEFTMARGIN    16
  402. X#define RES_RIGHTMARGIN   17
  403. X#define RES_CHECKINTERVAL 18
  404. X#define RES_SEARCHMENU    19
  405. X#define RES_NOTEWIDTH     20
  406. X#define RES_NOTEHEIGHT    21
  407. X
  408. X/* Resource default values (IDIR default is built dynamically) */
  409. X#define RESDEF_NBEEP        TRUE
  410. X#define RESDEF_CDESTROY        FALSE
  411. X#define RESDEF_PCOMMAND        "/usr/ucb/lpr $FILE"
  412. X#define RESDEF_ITRANSPARENT    FALSE
  413. X#define RESDEF_FORDER          "Miscellaneous"
  414. X#define RESDEF_DSEARCH          ""
  415. X#define RESDEF_FINTITLE         FALSE
  416. X#define RESDEF_TEXTFONT         NULL
  417. X#define RESDEF_WINDOWMAX         20
  418. X#define RESDEF_ACTIONDEF        CHOICE_FOLDER
  419. X#define RESDEF_MENUTEXTLEN    20
  420. X#define RESDEF_SETWIDTH        80
  421. X#define RESDEF_LOGGING        TRUE
  422. X#define RESDEF_TOPMARGIN    25
  423. X#define RESDEF_BOTTOMMARGIN    5
  424. X#define RESDEF_LEFTMARGIN    5
  425. X#define RESDEF_RIGHTMARGIN    5
  426. X#define RESDEF_CHECKINTERVAL    60
  427. X#define RESDEF_SEARCHMENU    "."
  428. X#define RESDEF_NOTEWIDTH    -1
  429. X#define RESDEF_NOTEHEIGHT    -1
  430. X
  431. X#ifndef public
  432. X#define public extern
  433. X#endif
  434. X
  435. X#define NOTEDIR ".pan"
  436. X#define NOTENAM "Note_%d_%d"
  437. X#define CTRLNAM "PanCtrl"
  438. X#define CTRLLCK "PanCtrl.lock"
  439. X#define ERRLNAM "PanCtrl.log"
  440. X#define PIDNAM  "PID"
  441. X
  442. X#define DEFWIDTH  260
  443. X#define DEFHEIGHT 200
  444. X#define DEFSPACING 30
  445. X#define DEFPANELSPACING 10
  446. X
  447. X/*
  448. X    Most of the following size parameters have become estimates since I
  449. X    implemented the new window creation algorithm
  450. X*/
  451. X
  452. X#define MAINWIDTH  200
  453. X#define MAINHEIGHT 90
  454. X
  455. X#define FLDRWIDTH  350
  456. X#define FLDRHEIGHT 100
  457. X#define FLDRSPACING 30
  458. X
  459. X#define DESTROYWIDTH  220
  460. X#define DESTROYHEIGHT 280
  461. X#define DESTROYSPACING 30
  462. X
  463. X#define SEARCHWIDTH  230
  464. X#define SEARCHHEIGHT 230
  465. X#define SEARCHSPACING 30
  466. X
  467. X#define MOVEWIDTH  600
  468. X#define MOVEHEIGHT 250
  469. X#define MOVESPACING 30
  470. X
  471. X/* Empirically determined scrollbar width.  How can you really find out? */
  472. X#define SCROLLWIDTH 35
  473. X
  474. X#define FORCE   1
  475. X#define NOFORCE 0
  476. X
  477. X#define NOTITLE "Untitled"
  478. X
  479. X#define MAXTITLELEN     100
  480. X#define MAXTITLEDISLEN  8
  481. X#define MAXSEARCHLEN    MAXTITLELEN
  482. X#define MAXSEARCHDISLEN 12
  483. X#define MAXBUFLEN       1024
  484. X
  485. X#define MAXSUBDIR      20  /* Max. len of sub dir name */
  486. X#define MAXNAME        256 /* Max. note file name len */
  487. X
  488. X#define COL_ROLLOVER 10
  489. X#define COL_MAXCOL    6
  490. X
  491. X#define CHOICE_ALL       "All"
  492. X#define CHOICE_FROM_LIST "From List"
  493. X
  494. X#define CHOICE_QUIT    "Quit"
  495. X#define CHOICE_MOVE    "Move Note..."
  496. X#define CHOICE_FOLDER  "Create Folder..."
  497. X#define CHOICE_DESTROY "Destroy Folder..."
  498. X#define CHOICE_PRINT   "Print Note"
  499. X
  500. X#define ERRONDISPLAY 1
  501. X#define ERRINLOG     0
  502. X
  503. Xpublic Frame  main_frame;
  504. Xpublic Panel  main_panel;
  505. Xpublic Menu   main_newnote;
  506. Xpublic Menu   main_expose;
  507. Xpublic Menu   main_print;
  508. X
  509. Xpublic Frame      folder_frame;
  510. Xpublic Panel_item folder_item;
  511. Xpublic Menu_item  folder_mitem;
  512. X
  513. Xpublic Frame      move_frame;
  514. Xpublic Panel      move_panel;
  515. Xpublic Menu_item  move_mitem;
  516. X
  517. Xpublic Frame      destroy_frame;
  518. Xpublic Panel_item destroy_item;
  519. Xpublic Menu_item  destroy_mitem;
  520. X
  521. Xpublic Frame      search_frame;
  522. Xpublic Panel_item search_item;
  523. Xpublic Panel_item search_button;
  524. X
  525. Xpublic int move_up, destroy_up, search_up;
  526. X
  527. Xenum NoteState {
  528. X    Visible = 0,
  529. X    Hidden  = 1,
  530. X    Veiled  = 2
  531. X};
  532. Xtypedef enum NoteState NoteState;
  533. X
  534. Xstruct Note {
  535. X    Rect       rect;
  536. X    NoteState  state;
  537. X    char       ntitle[MAXTITLELEN + 1];
  538. X    int        mapped;
  539. X    Frame      frame;
  540. X    Panel      panel;
  541. X    Textsw     textsw;
  542. X    Panel_item title;
  543. X    Panel_item hide;
  544. X    Panel_item action;
  545. X    Menu       actionmenu;
  546. X    Panel_item cdate;
  547. X    Panel_item ctime;
  548. X    Icon       icon;
  549. X#ifdef PAN_DND
  550. X    Xv_opaque  drag_obj;
  551. X    Xv_opaque  drag_tgt;
  552. X    int        got_itms;
  553. X    Xv_opaque  sel_itm1;
  554. X    Xv_opaque  sel_itm2;
  555. X    Xv_opaque  sel_itm3;
  556. X#endif
  557. X    long       crttime;
  558. X    long       touched;
  559. X    char       basename[MAXNAME];
  560. X    struct SubDir *sp;
  561. X};
  562. X
  563. Xstruct SubDir {
  564. X    char           subdir[MAXSUBDIR];
  565. X   struct LLM_root note_rt;
  566. X};
  567. X
  568. Xstruct FreeWin {
  569. X    Frame      frame;
  570. X    Panel      panel;
  571. X    Textsw     textsw;
  572. X    Panel_item title;
  573. X    Panel_item hide;
  574. X    Panel_item action;
  575. X    Menu       actionmenu;
  576. X    Panel_item cdate;
  577. X    Panel_item ctime;
  578. X    Icon       icon;
  579. X#ifdef PAN_DND
  580. X    Xv_opaque  drag_obj;
  581. X    Xv_opaque  drag_tgt;
  582. X    int        got_itms;
  583. X    Xv_opaque  sel_itm1;
  584. X    Xv_opaque  sel_itm2;
  585. X    Xv_opaque  sel_itm3;
  586. X#endif
  587. X};
  588. X
  589. Xpublic int  confirmdestroy;
  590. Xpublic int  noticenobeep;
  591. Xpublic int  icontransparent;
  592. Xpublic char folderorder[2048];
  593. Xpublic int  fintitle;
  594. Xpublic char textfont[2048];
  595. Xpublic int  windowmax;
  596. Xpublic char actiondef[2048];
  597. Xpublic int  menutextlen;
  598. Xpublic int  setwidth;
  599. Xpublic char widthtext[20];
  600. Xpublic int  logging;
  601. Xpublic int  topmargin;
  602. Xpublic int  bottommargin;
  603. Xpublic int  leftmargin;
  604. Xpublic int  rightmargin;
  605. Xpublic int  checkinterval;
  606. Xpublic char searchmenu[2048];
  607. Xpublic int  notewidth;
  608. Xpublic int  noteheight;
  609. X
  610. Xpublic int  notecount;
  611. X
  612. Xpublic int  debug_on;
  613. X
  614. Xpublic char note_dir [MAXBUFLEN];
  615. Xpublic char myname [MAXBUFLEN];
  616. X
  617. Xextern int  cleanup(), hideall(), exposeall(), hidenote(), noteaction();
  618. Xextern int  dismissed(), frameexit(), dragdrop(), reseticon(), newtitle();
  619. Xextern int  newnote(), exposemenu(), actionmenu(), newfolder(), folderdone();
  620. Xextern int  notesearch(), movenote(), destroyfolder(), createfolder();
  621. Xextern int  search_menu_proc();
  622. Xextern Menu gen_exposemenu(), gen_prtmenu();
  623. Xextern Notify_value child_death();
  624. Xextern Notify_value check_ctl_file();
  625. Xextern char *add_sorted();
  626. X
  627. X#ifdef PAN_DND
  628. Xextern drag_proc();
  629. X#endif
  630. X
  631. Xpublic struct LLM_root subdir_rt;
  632. Xpublic struct LLM_root freewin_rt;
  633. X
  634. X#endif /* PAN */
  635. SHAR_EOF
  636. chmod 0644 pan3.0/pan.h ||
  637. echo 'restore of pan3.0/pan.h failed'
  638. Wc_c="`wc -c < 'pan3.0/pan.h'`"
  639. test 10131 -eq "$Wc_c" ||
  640.     echo 'pan3.0/pan.h: original size 10131, current size' "$Wc_c"
  641. fi
  642. # ============= pan3.0/menu.c ==============
  643. if test -f 'pan3.0/menu.c' -a X"$1" != X"-c"; then
  644.     echo 'x - skipping pan3.0/menu.c (File already exists)'
  645. else
  646. echo 'x - extracting pan3.0/menu.c (Text)'
  647. sed 's/^X//' << 'SHAR_EOF' > 'pan3.0/menu.c' &&
  648. X/*
  649. XPost A Note V3.0
  650. XCopyright (c) 1993, Jeffrey W. Bailey
  651. XAll rights reserved.
  652. X
  653. XPermission is granted to distribute this program in exact, complete
  654. Xsource form, which includes this copyright notice, as long as no fee
  655. Xother than media and distribution cost is charged.
  656. X
  657. XThis program may not be used in whole, or in part, in any other manner
  658. Xwithout prior written permission from the author.
  659. X
  660. XThis program may not be distributed in modified form without prior
  661. Xwritten permission from the author.  In other words, patches may be
  662. Xdistributed, but modified source may not be distributed.
  663. X
  664. XIf there are any questions, comments or suggestions, the author may be
  665. Xcontacted at:
  666. X
  667. X    jeff@rd1.interlan.com
  668. X
  669. X    or
  670. X
  671. X    Jeffrey Bailey
  672. X    Racal-Datacom, Inc.
  673. X    Mail Stop E-110
  674. X    1601 N. Harrison Parkway
  675. X    Sunrise, FL  33323-2899
  676. X*/
  677. X
  678. X#include "pan.h"
  679. X#include <xview/font.h>
  680. X
  681. Xextern int errno;
  682. Xextern char *sys_errlist[];
  683. X
  684. X/*
  685. X    Routine to dynamically create a menu of all currently hidden notes
  686. X    for the expose from list menu.
  687. X*/
  688. XMenu gen_exposemenu(mitem, op)
  689. X    Menu_item mitem;
  690. X    Menu_generate op;
  691. X    {
  692. X    int  cols;
  693. X    int  count = 0;
  694. X    int  i;
  695. X    static Menu menu = NULL;
  696. X    Menu_item mi;
  697. X    char *cp;
  698. X    char *text;
  699. X    struct Note *np;
  700. X    struct SubDir *sp;
  701. X    char title[2 * MAXTITLELEN];
  702. X
  703. X    if(op == MENU_DISPLAY)
  704. X        {
  705. X        text = (char *)xv_get(mitem, MENU_STRING);
  706. X        if(menu != NULL)
  707. X            {
  708. X            for(i = xv_get(menu, MENU_NITEMS); i > 0; i--)
  709. X                {
  710. X                xv_set(menu, MENU_REMOVE, i, NULL);
  711. X                xv_destroy(xv_get(menu, MENU_NTH_ITEM, i));
  712. X                }
  713. X            xv_set(menu, MENU_NCOLS, 1, NULL);
  714. X            }
  715. X        else
  716. X            {
  717. X            menu = xv_create(NULL, MENU, NULL);
  718. X            }
  719. X        sp = (struct SubDir *)LLM_first(&subdir_rt);
  720. X        while(sp != NULL)
  721. X            {
  722. X            if(strcmp(sp->subdir, text) == 0) break;
  723. X            sp = (struct SubDir *)LLM_next(&subdir_rt);
  724. X            }
  725. X        np = (struct Note *)LLM_first(&sp->note_rt);
  726. X        /* find first note not visible */
  727. X        while(np != NULL && np->state == Visible)
  728. X            {
  729. X            np = (struct Note *)LLM_next(&sp->note_rt);
  730. X            }
  731. X        if(np != NULL)
  732. X            {
  733. X            cp = malloc(strlen(CHOICE_ALL) + 1);
  734. X            strcpy(cp, CHOICE_ALL);
  735. X            mi = xv_create(NULL, MENUITEM,
  736. X                MENU_STRING, cp,
  737. X                MENU_NOTIFY_PROC, exposemenu,
  738. X                MENU_CLIENT_DATA, 0xFFFFFFFF,
  739. X                MENU_RELEASE,
  740. X                MENU_RELEASE_IMAGE,
  741. X                NULL);
  742. X            xv_set(menu, MENU_APPEND_ITEM, mi, NULL);
  743. X            count++;
  744. X            }
  745. X        while(np != NULL)
  746. X            {
  747. X            if(np->state != Visible)
  748. X                {
  749. X                *title = 0;
  750. X                menu_string_normalize(np->ntitle, title);
  751. X                cp = malloc(strlen(title) + 1);
  752. X                strcpy(cp, title);
  753. X                mi = xv_create(NULL, MENUITEM,
  754. X                    MENU_STRING, cp,
  755. X                    MENU_NOTIFY_PROC, exposemenu,
  756. X                    MENU_CLIENT_DATA, np,
  757. X                    MENU_RELEASE,
  758. X                    MENU_RELEASE_IMAGE,
  759. X                    NULL);
  760. X                xv_set(menu, MENU_APPEND_ITEM, mi, NULL);
  761. X                count++;
  762. X                }
  763. X            np = (struct Note *)LLM_next(&sp->note_rt);
  764. X            }
  765. X        if(count == 0)
  766. X            {
  767. X            mi = xv_create(NULL, MENUITEM,
  768. X                MENU_STRING, "No hidden notes",
  769. X                MENU_NOTIFY_PROC, exposemenu,
  770. X                MENU_CLIENT_DATA, NULL,
  771. X                MENU_RELEASE,
  772. X                NULL);
  773. X            xv_set(menu, MENU_APPEND_ITEM, mi, NULL);
  774. X            }
  775. X        else
  776. X            {
  777. X            cols = menu_columns(count);
  778. X            xv_set(menu, MENU_NCOLS, cols, NULL);
  779. X            }
  780. X        }
  781. X    return(menu);
  782. X    }
  783. X
  784. X/*
  785. X    Handles the Action menu choices.
  786. X*/
  787. Xactionmenu(menu, mitem)
  788. X    Menu menu;
  789. X    Menu_item mitem;
  790. X    {
  791. X    char *text;
  792. X    Menu_item pullright;
  793. X    Menu mpullright;
  794. X    char *ptext;
  795. X    struct Note *np;
  796. X
  797. X    if(strcmp((text = (char *)xv_get(mitem, MENU_STRING)), CHOICE_QUIT) == 0)
  798. X        {
  799. X        cleanup(0);
  800. X        }
  801. X    /* Figure out if we have a print item by climbing the hierarchy */
  802. X    mpullright = NULL;
  803. X    pullright = (Menu_item) xv_get(menu, MENU_PARENT);
  804. X    if(pullright != NULL)
  805. X        mpullright = (Menu_item) xv_get(pullright, MENU_PARENT);
  806. X    if(mpullright != NULL)
  807. X        pullright = (Menu_item) xv_get(mpullright, MENU_PARENT);
  808. X    if(pullright != NULL)
  809. X        {
  810. X        ptext = (char *)xv_get(pullright, MENU_STRING);
  811. X        if(strcmp(ptext, CHOICE_PRINT) == 0)
  812. X            {
  813. X            np = (struct Note *)xv_get(mitem, MENU_CLIENT_DATA);
  814. X            if(np == NULL)
  815. X                {
  816. X                notice_prompt(main_frame, NULL,
  817. X                    NOTICE_MESSAGE_STRINGS,
  818. X                        "No notes to print",
  819. X                        NULL,
  820. X                    NOTICE_BUTTON_YES, "Acknowledge",
  821. X                    NOTICE_NO_BEEPING, noticenobeep,
  822. X                    NULL);
  823. X                return;
  824. X                }
  825. X            w_printnote(np, ERRONDISPLAY);
  826. X            }
  827. X        }
  828. X    }
  829. X
  830. X/*
  831. X    Routine to dynamically create a menu of all notes
  832. X    for the action print note menu.
  833. X*/
  834. XMenu gen_prtmenu(mitem, op)
  835. X    Menu_item mitem;
  836. X    Menu_generate op;
  837. X    {
  838. X    int  cols;
  839. X    int  count = 0;
  840. X    int  i;
  841. X    static Menu menu = NULL;
  842. X    Menu_item mi;
  843. X    char *cp;
  844. X    char *text;
  845. X    struct Note *np;
  846. X    struct SubDir *sp;
  847. X    char title[2 * MAXTITLELEN];
  848. X
  849. X    if(op == MENU_DISPLAY)
  850. X        {
  851. X        text = (char *)xv_get(mitem, MENU_STRING);
  852. X        if(menu != NULL)
  853. X            {
  854. X            for(i = xv_get(menu, MENU_NITEMS); i > 0; i--)
  855. X                {
  856. X                xv_set(menu, MENU_REMOVE, i, NULL);
  857. X                xv_destroy(xv_get(menu, MENU_NTH_ITEM, i));
  858. X                }
  859. X            xv_set(menu, MENU_NCOLS, 1, NULL);
  860. X            }
  861. X        else
  862. X            {
  863. X            menu = xv_create(NULL, MENU, NULL);
  864. X            }
  865. X        sp = (struct SubDir *)LLM_first(&subdir_rt);
  866. X        while(sp != NULL)
  867. X            {
  868. X            if(strcmp(sp->subdir, text) == 0) break;
  869. X            sp = (struct SubDir *)LLM_next(&subdir_rt);
  870. X            }
  871. X        np = (struct Note *)LLM_first(&sp->note_rt);
  872. X        while(np != NULL)
  873. X            {
  874. X            *title = 0;
  875. X            menu_string_normalize(np->ntitle, title);
  876. X            cp = malloc(strlen(title) + 1);
  877. X            strcpy(cp, title);
  878. X            mi = xv_create(NULL, MENUITEM,
  879. X                MENU_STRING, cp,
  880. X                MENU_NOTIFY_PROC, actionmenu,
  881. X                MENU_CLIENT_DATA, np,
  882. X                MENU_RELEASE,
  883. X                MENU_RELEASE_IMAGE,
  884. X                NULL);
  885. X            xv_set(menu, MENU_APPEND_ITEM, mi, NULL);
  886. X            count++;
  887. X            np = (struct Note *)LLM_next(&sp->note_rt);
  888. X            }
  889. X        if(count == 0)
  890. X            {
  891. X            mi = xv_create(NULL, MENUITEM,
  892. X                MENU_STRING, "No notes to print",
  893. X                MENU_NOTIFY_PROC, actionmenu,
  894. X                MENU_CLIENT_DATA, NULL,
  895. X                MENU_RELEASE,
  896. X                NULL);
  897. X            xv_set(menu, MENU_APPEND_ITEM, mi, NULL);
  898. X            }
  899. X        else
  900. X            {
  901. X            cols = menu_columns(count);
  902. X            xv_set(menu, MENU_NCOLS, cols, NULL);
  903. X            }
  904. X        }
  905. X    return(menu);
  906. X    }
  907. X
  908. Xstatic Font panel_font;
  909. Xstatic int  pf_width;
  910. Xstatic int  pf_height;
  911. Xstatic int  mitem_len;
  912. X
  913. Xinit_menu_string_normalize()
  914. X    {
  915. X    pf_width = 0;
  916. X    panel_font = xv_get(main_panel, PANEL_FONT);
  917. X    if(panel_font)
  918. X        {
  919. X        pf_width =  xv_get(panel_font, FONT_DEFAULT_CHAR_WIDTH);
  920. X        pf_height =  xv_get(panel_font, FONT_DEFAULT_CHAR_HEIGHT);
  921. X        }
  922. X    mitem_len = pf_width * menutextlen;
  923. X    }
  924. X
  925. Xmenu_string_normalize(src, dst)
  926. X    char *src, *dst;
  927. X    {
  928. X    Font_string_dims dims;
  929. X    int  i;
  930. X    int  slen;
  931. X
  932. X    if(*src == 0)
  933. X        {
  934. X        strcpy(dst, NOTITLE);
  935. X        return;
  936. X        }
  937. X
  938. X    strncpy(dst, src, menutextlen);
  939. X    dst[menutextlen] = 0;
  940. X    if(pf_width == 0) return;
  941. X
  942. X    slen = strlen(src);
  943. X
  944. X    i = menutextlen;
  945. X    xv_get(panel_font, FONT_STRING_DIMS, dst, &dims);
  946. X    while(dims.width < mitem_len && i < slen)
  947. X        {
  948. X        dst[i] = src[i];
  949. X        i++;
  950. X        dst[i] = 0;
  951. X        xv_get(panel_font, FONT_STRING_DIMS, dst, &dims);
  952. X        }
  953. X    while(dims.width > mitem_len)
  954. X        {
  955. X        i--;
  956. X        dst[i] = 0;
  957. X        xv_get(panel_font, FONT_STRING_DIMS, dst, &dims);
  958. X        }
  959. X    }
  960. X
  961. Xmenu_columns(count)
  962. X    int  count;
  963. X    {
  964. X    int  cols = 0;
  965. X    int  h, rh;
  966. X
  967. X    if(pf_width == 0)
  968. X        {
  969. X        cols = count / COL_ROLLOVER;
  970. X        if(cols == 0) cols = 1;
  971. X        if(cols == 1 && count > COL_ROLLOVER) cols = 2;
  972. X        if(cols > COL_MAXCOL) cols = COL_MAXCOL;
  973. X        }
  974. X    else
  975. X        {
  976. X        rh = mitem_len + (mitem_len / 2);
  977. X        h = pf_height * count;
  978. X        while(h > rh && cols < COL_MAXCOL)
  979. X            {
  980. X            cols++;
  981. X            h = pf_height * (count / cols);
  982. X            }
  983. X        }
  984. X    return(cols);
  985. X    }
  986. SHAR_EOF
  987. chmod 0644 pan3.0/menu.c ||
  988. echo 'restore of pan3.0/menu.c failed'
  989. Wc_c="`wc -c < 'pan3.0/menu.c'`"
  990. test 9172 -eq "$Wc_c" ||
  991.     echo 'pan3.0/menu.c: original size 9172, current size' "$Wc_c"
  992. fi
  993. # ============= pan3.0/move.c ==============
  994. if test -f 'pan3.0/move.c' -a X"$1" != X"-c"; then
  995.     echo 'x - skipping pan3.0/move.c (File already exists)'
  996. else
  997. echo 'x - extracting pan3.0/move.c (Text)'
  998. sed 's/^X//' << 'SHAR_EOF' > 'pan3.0/move.c' &&
  999. X/*
  1000. XPost A Note V3.0
  1001. XCopyright (c) 1993, Jeffrey W. Bailey
  1002. XAll rights reserved.
  1003. X
  1004. XPermission is granted to distribute this program in exact, complete
  1005. Xsource form, which includes this copyright notice, as long as no fee
  1006. Xother than media and distribution cost is charged.
  1007. X
  1008. XThis program may not be used in whole, or in part, in any other manner
  1009. Xwithout prior written permission from the author.
  1010. X
  1011. XThis program may not be distributed in modified form without prior
  1012. Xwritten permission from the author.  In other words, patches may be
  1013. Xdistributed, but modified source may not be distributed.
  1014. X
  1015. XIf there are any questions, comments or suggestions, the author may be
  1016. Xcontacted at:
  1017. X
  1018. X    jeff@rd1.interlan.com
  1019. X
  1020. X    or
  1021. X
  1022. X    Jeffrey Bailey
  1023. X    Racal-Datacom, Inc.
  1024. X    Mail Stop E-110
  1025. X    1601 N. Harrison Parkway
  1026. X    Sunrise, FL  33323-2899
  1027. X*/
  1028. X
  1029. X#include "pan.h"
  1030. X#include <X11/X.h>
  1031. X#include <X11/Xutil.h>
  1032. X
  1033. Xextern int errno;
  1034. Xextern char *sys_errlist[];
  1035. X
  1036. Xint applymove();
  1037. Xint movedone();
  1038. Xint chosesrc();
  1039. Xint move_resize_proc();
  1040. X
  1041. Xstatic Panel_item srctext, dsttext, notetext, srclist, dstlist, notelist;
  1042. Xstatic Panel_item appbutton;
  1043. X
  1044. Xmovenote(menu, mitem)
  1045. X    Menu menu;
  1046. X    Menu_item mitem;
  1047. X    {
  1048. X    Rect *prect;
  1049. X    int  x, y;
  1050. X    int  row;
  1051. X    struct SubDir *sp;
  1052. X    struct Note *np;
  1053. X    static XClassHint chint;
  1054. X    char buf[MAXTITLELEN + 1];
  1055. X
  1056. X    w_popupxy(&x, &y, MOVEWIDTH, MOVEHEIGHT, MOVESPACING);
  1057. X    move_mitem = mitem;
  1058. X    move_frame = xv_create(main_frame, FRAME_CMD,
  1059. X                           XV_LABEL, "Move Notes",
  1060. X                           XV_X, x,
  1061. X                           XV_Y, y,
  1062. X                           FRAME_NO_CONFIRM, TRUE,
  1063. X                           FRAME_DONE_PROC, movedone,
  1064. X                           FRAME_SHOW_RESIZE_CORNER, TRUE,
  1065. X                           WIN_EVENT_PROC, move_resize_proc,
  1066. X                           WIN_CONSUME_EVENTS,
  1067. X                               WIN_RESIZE,
  1068. X                               NULL,
  1069. X                           NULL);
  1070. X    if(move_frame == NULL)
  1071. X        {
  1072. X        notice_prompt(main_frame, NULL,
  1073. X            NOTICE_MESSAGE_STRINGS,
  1074. X                "Unable to create sub-frame (internal error)",
  1075. X                NULL,
  1076. X            NOTICE_BUTTON_YES, "Acknowledge",
  1077. X            NOTICE_NO_BEEPING, noticenobeep,
  1078. X            NULL);
  1079. X        return;
  1080. X        }
  1081. X
  1082. X    /* Set up the X class since xview doesn't */
  1083. X    chint.res_name = "pan";
  1084. X    chint.res_class = "Pan";
  1085. X    XSetClassHint((Display *)xv_get(move_frame, XV_DISPLAY),
  1086. X        xv_get(move_frame, XV_XID), &chint);
  1087. X
  1088. X    move_panel = (Panel) xv_get(move_frame, FRAME_CMD_PANEL);
  1089. X    xv_set(move_panel, WIN_RETAINED, FALSE, NULL);
  1090. X
  1091. X    srclist = xv_create(move_panel, PANEL_LIST,
  1092. X        XV_X, xv_col(move_panel, 0),
  1093. X        XV_Y, xv_row(move_panel, 1),
  1094. X        PANEL_LIST_DISPLAY_ROWS, 7,
  1095. X        PANEL_LIST_WIDTH, xv_col(move_panel, 15),
  1096. X        PANEL_CHOOSE_ONE, TRUE,
  1097. X        PANEL_READ_ONLY, TRUE,
  1098. X        PANEL_NOTIFY_PROC, chosesrc,
  1099. X        NULL);
  1100. X    srctext = xv_create(move_panel, PANEL_MESSAGE,
  1101. X        XV_X, xv_col(move_panel, 0),
  1102. X        XV_Y, xv_row(move_panel, 0),
  1103. X        PANEL_LABEL_STRING, "Source Folder",
  1104. X        NULL);
  1105. X
  1106. X    prect = (Rect *) xv_get(srclist, PANEL_ITEM_RECT);
  1107. X    dstlist = xv_create(move_panel, PANEL_LIST,
  1108. X        XV_X, prect->r_left + prect->r_width + SCROLLWIDTH + 20,
  1109. X        XV_Y, xv_row(move_panel, 1),
  1110. X        PANEL_LIST_DISPLAY_ROWS, 7,
  1111. X        PANEL_LIST_WIDTH, xv_col(move_panel, 15),
  1112. X        PANEL_CHOOSE_ONE, TRUE,
  1113. X        PANEL_READ_ONLY, TRUE,
  1114. X        NULL);
  1115. X    dsttext = xv_create(move_panel, PANEL_MESSAGE,
  1116. X        XV_X, prect->r_left + prect->r_width + SCROLLWIDTH + 20,
  1117. X        XV_Y, xv_row(move_panel, 0),
  1118. X        PANEL_LABEL_STRING, "Destination Folder",
  1119. X        NULL);
  1120. X
  1121. X    row = 0;
  1122. X    sp = (struct SubDir *) LLM_first(&subdir_rt);
  1123. X    while(sp != NULL)
  1124. X        {
  1125. X        xv_set(srclist,
  1126. X            PANEL_LIST_INSERT, row,
  1127. X            PANEL_LIST_STRING, row, sp->subdir, 
  1128. X            PANEL_LIST_CLIENT_DATA, row, sp, 
  1129. X            NULL);
  1130. X        xv_set(dstlist,
  1131. X            PANEL_LIST_INSERT, row,
  1132. X            PANEL_LIST_STRING, row, sp->subdir, 
  1133. X            PANEL_LIST_CLIENT_DATA, row, sp, 
  1134. X            NULL);
  1135. X        sp = (struct SubDir *) LLM_next(&subdir_rt);
  1136. X        row++;
  1137. X        }
  1138. X
  1139. X    prect = (Rect *) xv_get(dstlist, PANEL_ITEM_RECT);
  1140. X    notelist = xv_create(move_panel, PANEL_LIST,
  1141. X        XV_X, prect->r_left + prect->r_width + SCROLLWIDTH + 20,
  1142. X        XV_Y, xv_row(move_panel, 1),
  1143. X        PANEL_LIST_DISPLAY_ROWS, 7,
  1144. X        PANEL_LIST_WIDTH, xv_col(move_panel, 20),
  1145. X        PANEL_CHOOSE_ONE, FALSE,
  1146. X        PANEL_READ_ONLY, TRUE,
  1147. X        NULL);
  1148. X
  1149. X    notetext = xv_create(move_panel, PANEL_MESSAGE,
  1150. X        XV_X, prect->r_left + prect->r_width + SCROLLWIDTH + 20,
  1151. X        XV_Y, xv_row(move_panel, 0),
  1152. X        PANEL_LABEL_STRING, "Notes To Move",
  1153. X        NULL);
  1154. X
  1155. X    y = prect->r_top + prect->r_height + DEFPANELSPACING;
  1156. X
  1157. X    appbutton = xv_create(move_panel, PANEL_BUTTON,
  1158. X                     XV_X, xv_col(move_panel, 0),
  1159. X                     XV_Y, y,
  1160. X                     PANEL_LABEL_STRING, "Apply",
  1161. X                     PANEL_NOTIFY_PROC, applymove,
  1162. X                     NULL);
  1163. X
  1164. X    window_fit(move_panel);
  1165. X    window_fit(move_frame);
  1166. X
  1167. X    row = 0;
  1168. X    sp = (struct SubDir *) LLM_first(&subdir_rt);
  1169. X    np = (struct Note *)LLM_first(&sp->note_rt);
  1170. X    while(np != NULL)
  1171. X        {
  1172. X        strcpy(buf, np->ntitle);
  1173. X        if(strlen(buf) == 0) strcpy(buf, NOTITLE);
  1174. X        xv_set(notelist,
  1175. X            PANEL_LIST_INSERT, row,
  1176. X            PANEL_LIST_STRING, row, buf,
  1177. X            PANEL_LIST_CLIENT_DATA, row, np, 
  1178. X            PANEL_LIST_SELECT, row, FALSE,
  1179. X            NULL);
  1180. X        np = (struct Note *)LLM_next(&sp->note_rt);
  1181. X        row++;
  1182. X        }
  1183. X    xv_set(move_frame, XV_SHOW, TRUE, NULL);
  1184. X    (void) xv_set(move_mitem, MENU_INACTIVE, TRUE, NULL);
  1185. X    move_up = 1;
  1186. X    }
  1187. X
  1188. Xmovedone()
  1189. X    {
  1190. X    xv_destroy_safe(move_frame);
  1191. X    (void) xv_set(move_mitem, MENU_INACTIVE, FALSE, NULL);
  1192. X    move_up = 0;
  1193. X    }
  1194. X
  1195. Xapplymove(item, event)
  1196. X    Panel_item item;
  1197. X    Event *event;
  1198. X    {
  1199. X    int  i;
  1200. X    int  row;
  1201. X    struct Note *np;
  1202. X    struct SubDir *src_sp;
  1203. X    struct SubDir *dst_sp;
  1204. X
  1205. X    /* get src dir */
  1206. X    row = xv_get(srclist, PANEL_LIST_NROWS);
  1207. X    for(i = 0; i < row; i++)
  1208. X        {
  1209. X        if(xv_get(srclist, PANEL_LIST_SELECTED, i))
  1210. X            {
  1211. X            src_sp = (struct SubDir *) xv_get(srclist, PANEL_LIST_CLIENT_DATA,
  1212. X                                              i);
  1213. X            }
  1214. X        }
  1215. X
  1216. X    /* get dst dir */
  1217. X    row = xv_get(dstlist, PANEL_LIST_NROWS);
  1218. X    for(i = 0; i < row; i++)
  1219. X        {
  1220. X        if(xv_get(dstlist, PANEL_LIST_SELECTED, i))
  1221. X            {
  1222. X            dst_sp = (struct SubDir *) xv_get(dstlist, PANEL_LIST_CLIENT_DATA,
  1223. X                                              i);
  1224. X            }
  1225. X        }
  1226. X
  1227. X    row = xv_get(notelist, PANEL_LIST_NROWS);
  1228. X    for(i = 0; i < row; i++)
  1229. X        {
  1230. X        if(xv_get(notelist, PANEL_LIST_SELECTED, i))
  1231. X            {
  1232. X            np = (struct Note *) xv_get(notelist, PANEL_LIST_CLIENT_DATA, i);
  1233. X            if(w_movenote(src_sp, dst_sp, np, ERRONDISPLAY) < 0)
  1234. X                {
  1235. X                if(xv_get(move_frame, FRAME_CMD_PUSHPIN_IN) == FALSE)
  1236. X                    {
  1237. X                    xv_destroy_safe(move_frame);
  1238. X                    (void) xv_set(move_mitem, MENU_INACTIVE, FALSE, NULL);
  1239. X                    move_up = 0;
  1240. X                    }
  1241. X                return;
  1242. X                }
  1243. X            }
  1244. X        }
  1245. X
  1246. X    xv_set(notelist, XV_SHOW, FALSE, NULL);
  1247. X    for(i = row - 1; i >= 0; i--)
  1248. X        {
  1249. X        if(xv_get(notelist, PANEL_LIST_SELECTED, i))
  1250. X            {
  1251. X            xv_set(notelist, PANEL_LIST_DELETE, i, NULL);
  1252. X            }
  1253. X        }
  1254. X    xv_set(notelist, XV_SHOW, TRUE, NULL);
  1255. X
  1256. X    if(xv_get(move_frame, FRAME_CMD_PUSHPIN_IN) == FALSE)
  1257. X        {
  1258. X        xv_destroy_safe(move_frame);
  1259. X        (void) xv_set(move_mitem, MENU_INACTIVE, FALSE, NULL);
  1260. X        move_up = 0;
  1261. X        }
  1262. X    refresh_popups();
  1263. X    }
  1264. X
  1265. Xchosesrc(item, string, client_data, op, event)
  1266. X    Panel_item item;
  1267. X    char *string;
  1268. X    char *client_data;
  1269. X    Panel_list_op op;
  1270. X    Event *event;
  1271. X    {
  1272. X    int  i;
  1273. X    int  row;
  1274. X    struct SubDir *sp;
  1275. X    struct Note *np;
  1276. X    char buf[MAXTITLELEN + 1];
  1277. X
  1278. X    if(op == PANEL_LIST_OP_SELECT)
  1279. X        {
  1280. X        xv_set(notelist, XV_SHOW, FALSE, NULL);
  1281. X        row = xv_get(notelist, PANEL_LIST_NROWS);
  1282. X        for(i = row - 1; i >= 0; i--)
  1283. X            xv_set(notelist, PANEL_LIST_DELETE, i, NULL);
  1284. X        sp = (struct SubDir *)client_data;
  1285. X        row = 0;
  1286. X        np = (struct Note *)LLM_first(&sp->note_rt);
  1287. X        while(np != NULL)
  1288. X            {
  1289. X            strcpy(buf, np->ntitle);
  1290. X            if(strlen(buf) == 0) strcpy(buf, NOTITLE);
  1291. X            xv_set(notelist,
  1292. X                PANEL_LIST_INSERT, row,
  1293. X                PANEL_LIST_STRING, row, buf,
  1294. X                PANEL_LIST_CLIENT_DATA, row, np, 
  1295. X                PANEL_LIST_SELECT, row, FALSE,
  1296. X                NULL);
  1297. X            np = (struct Note *)LLM_next(&sp->note_rt);
  1298. X            row++;
  1299. X            }
  1300. X        xv_set(notelist, XV_SHOW, TRUE, NULL);
  1301. X        }
  1302. X    }
  1303. X
  1304. Xrefresh_move()
  1305. X    {
  1306. X    int  row, i;
  1307. X    struct SubDir *sp;
  1308. X    struct Note *np;
  1309. X    char buf[MAXTITLELEN + 1];
  1310. X
  1311. X    if(!move_up) return;
  1312. X
  1313. X    xv_set(srclist, XV_SHOW, FALSE, NULL);
  1314. X    xv_set(dstlist, XV_SHOW, FALSE, NULL);
  1315. X    xv_set(notelist, XV_SHOW, FALSE, NULL);
  1316. X
  1317. X    row = xv_get(srclist, PANEL_LIST_NROWS);
  1318. X    for(i = row - 1; i >= 0; i--)
  1319. X        xv_set(srclist, PANEL_LIST_DELETE, i, NULL);
  1320. X
  1321. X    row = xv_get(dstlist, PANEL_LIST_NROWS);
  1322. X    for(i = row - 1; i >= 0; i--)
  1323. X        xv_set(dstlist, PANEL_LIST_DELETE, i, NULL);
  1324. X
  1325. X    row = xv_get(notelist, PANEL_LIST_NROWS);
  1326. X    for(i = row - 1; i >= 0; i--)
  1327. X        xv_set(notelist, PANEL_LIST_DELETE, i, NULL);
  1328. X
  1329. X    row = 0;
  1330. X    sp = (struct SubDir *) LLM_first(&subdir_rt);
  1331. X    while(sp != NULL)
  1332. X        {
  1333. X        xv_set(srclist,
  1334. X            PANEL_LIST_INSERT, row,
  1335. X            PANEL_LIST_STRING, row, sp->subdir, 
  1336. X            PANEL_LIST_CLIENT_DATA, row, sp, 
  1337. X            NULL);
  1338. X        xv_set(dstlist,
  1339. X            PANEL_LIST_INSERT, row,
  1340. X            PANEL_LIST_STRING, row, sp->subdir, 
  1341. X            PANEL_LIST_CLIENT_DATA, row, sp, 
  1342. X            NULL);
  1343. X        sp = (struct SubDir *) LLM_next(&subdir_rt);
  1344. X        row++;
  1345. X        }
  1346. X
  1347. X    row = 0;
  1348. X    sp = (struct SubDir *) LLM_first(&subdir_rt);
  1349. X    np = (struct Note *)LLM_first(&sp->note_rt);
  1350. X    while(np != NULL)
  1351. X        {
  1352. X        strcpy(buf, np->ntitle);
  1353. X        if(strlen(buf) == 0) strcpy(buf, NOTITLE);
  1354. X        xv_set(notelist,
  1355. X            PANEL_LIST_INSERT, row,
  1356. X            PANEL_LIST_STRING, row, buf,
  1357. X            PANEL_LIST_CLIENT_DATA, row, np, 
  1358. X            PANEL_LIST_SELECT, row, FALSE,
  1359. X            NULL);
  1360. X        np = (struct Note *)LLM_next(&sp->note_rt);
  1361. X        row++;
  1362. X        }
  1363. X
  1364. X    xv_set(srclist, XV_SHOW, TRUE, NULL);
  1365. X    xv_set(dstlist, XV_SHOW, TRUE, NULL);
  1366. X    xv_set(notelist, XV_SHOW, TRUE, NULL);
  1367. X    }
  1368. X
  1369. Xmove_resize_proc(frame, event, arg)
  1370. X    Frame frame;
  1371. X    Event *event;
  1372. X    Notify_arg arg;
  1373. X    {
  1374. X    Rect rect, *prect;
  1375. X    int  x, y, rh, h;
  1376. X
  1377. X    if(event_id(event) != WIN_RESIZE) return;
  1378. X    frame_get_rect(frame, &rect);
  1379. X    rect.r_height -= (topmargin + bottommargin); /* correct for wm title bar */
  1380. X    rect.r_width -= (leftmargin + rightmargin);  /* correct for wm border */
  1381. X
  1382. X    prect = (Rect *) xv_get(appbutton, PANEL_ITEM_RECT);
  1383. X    y = rect.r_height - prect->r_height - DEFPANELSPACING;
  1384. X    x = rect.r_width / 2 - prect->r_width / 2;
  1385. X    xv_set(appbutton, XV_Y, y, XV_X, x, NULL);
  1386. X
  1387. X    rh = xv_get(srclist, PANEL_LIST_ROW_HEIGHT);
  1388. X    y -= (2 * rh);
  1389. X    prect = (Rect *) xv_get(srclist, PANEL_ITEM_RECT);
  1390. X    y -= prect->r_top;
  1391. X
  1392. X    if(y < rh) y = rh;
  1393. X    h = y / rh;
  1394. X
  1395. X    xv_set(srclist, PANEL_LIST_DISPLAY_ROWS, h, NULL);
  1396. X    xv_set(dstlist, PANEL_LIST_DISPLAY_ROWS, h, NULL);
  1397. X    xv_set(notelist, PANEL_LIST_DISPLAY_ROWS, h, NULL);
  1398. X
  1399. X    prect = (Rect *) xv_get(notelist, PANEL_ITEM_RECT);
  1400. X    y = rect.r_width - prect->r_left - SCROLLWIDTH;
  1401. X    xv_set(notelist, PANEL_LIST_WIDTH, y, NULL);
  1402. X    }
  1403. SHAR_EOF
  1404. chmod 0644 pan3.0/move.c ||
  1405. echo 'restore of pan3.0/move.c failed'
  1406. Wc_c="`wc -c < 'pan3.0/move.c'`"
  1407. test 12055 -eq "$Wc_c" ||
  1408.     echo 'pan3.0/move.c: original size 12055, current size' "$Wc_c"
  1409. fi
  1410. # ============= pan3.0/pan.icon ==============
  1411. if test -f 'pan3.0/pan.icon' -a X"$1" != X"-c"; then
  1412.     echo 'x - skipping pan3.0/pan.icon (File already exists)'
  1413. else
  1414. echo 'x - extracting pan3.0/pan.icon (Text)'
  1415. sed 's/^X//' << 'SHAR_EOF' > 'pan3.0/pan.icon' &&
  1416. X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  1417. X */
  1418. X    0x0000,0x0000,0x0000,0x0800,
  1419. X    0x0000,0x0000,0x0000,0x1600,
  1420. X    0x0000,0x0000,0x0000,0x1100,
  1421. X    0x0000,0x0000,0x0000,0x2200,
  1422. X    0x0000,0x0000,0x0000,0x4200,
  1423. X    0x0000,0x0000,0x0000,0x6400,
  1424. X    0x07FF,0xFFFF,0xFFFF,0x9FE0,
  1425. X    0x0400,0x0000,0x0001,0x0820,
  1426. X    0x0400,0x0000,0x0001,0x1020,
  1427. X    0x0400,0x0020,0x0002,0x2020,
  1428. X    0x0424,0x0022,0x0004,0x2020,
  1429. X    0x045E,0x61FE,0x0004,0x4020,
  1430. X    0x0401,0xB600,0x0008,0x8020,
  1431. X    0x0400,0x0000,0x0010,0x8020,
  1432. X    0x0400,0x0000,0x0011,0x0020,
  1433. X    0x0400,0x0000,0x01A2,0x0020,
  1434. X    0x0404,0x0100,0x0142,0x0020,
  1435. X    0x04EB,0x5531,0xAE45,0xB920,
  1436. X    0x0400,0x8983,0xF089,0x8320,
  1437. X    0x0400,0x0118,0x0108,0x0020,
  1438. X    0x0400,0x0008,0x0110,0x0020,
  1439. X    0x0400,0x0000,0x0220,0x0020,
  1440. X    0x0400,0x0000,0x2420,0x0020,
  1441. X    0x046E,0x340F,0x4446,0x8220,
  1442. X    0x0400,0x83A8,0x0888,0x7DA0,
  1443. X    0x0400,0x0000,0x1080,0x0020,
  1444. X    0x0400,0x0000,0x1100,0x0020,
  1445. X    0x0400,0x0000,0x2E00,0x0020,
  1446. X    0x0400,0x0000,0x2200,0x0020,
  1447. X    0x0421,0x8800,0x4C00,0x0020,
  1448. X    0x0442,0xA800,0x7000,0x0020,
  1449. X    0x0418,0x457D,0xC000,0x0020,
  1450. X    0x0400,0x0248,0x0000,0x0020,
  1451. X    0x0400,0x0000,0x0000,0x0020,
  1452. X    0x0400,0x0000,0x0000,0x0020,
  1453. X    0x0400,0x0000,0x0000,0x0020,
  1454. X    0x0400,0x0000,0x0000,0x0020,
  1455. X    0x0400,0x0000,0x0000,0x0020,
  1456. X    0x0400,0x0000,0x0000,0x0020,
  1457. X    0x0400,0x0000,0x0000,0x0020,
  1458. X    0x0400,0x0000,0x0000,0x0020,
  1459. X    0x0400,0x0000,0x0000,0x0020,
  1460. X    0x0400,0x0000,0x0000,0x0020,
  1461. X    0x0400,0x0000,0x0000,0x0020,
  1462. X    0x0400,0x0000,0x0000,0x0020,
  1463. X    0x0400,0x0000,0x0000,0x0020,
  1464. X    0x07FF,0xFFFF,0xFFFF,0xFFE0,
  1465. X    0x0000,0x0000,0x0000,0x0000,
  1466. X    0x0000,0x0000,0x0000,0x0000,
  1467. X    0x0000,0x0000,0x0000,0x0000,
  1468. X    0x0000,0x0000,0x0000,0x0000,
  1469. X    0x0000,0x0000,0x0000,0x0000,
  1470. X    0x0000,0x0000,0x0000,0x0000,
  1471. X    0x0000,0x0000,0x0000,0x0000,
  1472. X    0x0000,0x0000,0x0000,0x0000,
  1473. X    0x0000,0x0000,0x0000,0x0000,
  1474. X    0x0000,0x0000,0x0000,0x0000,
  1475. X    0x0000,0x0000,0x0000,0x0000,
  1476. X    0x0000,0x0000,0x0000,0x0000,
  1477. X    0x0000,0x0000,0x0000,0x0000,
  1478. X    0x0000,0x0000,0x0000,0x0000,
  1479. X    0x0000,0x0000,0x0000,0x0000,
  1480. X    0x0000,0x0000,0x0000,0x0000,
  1481. X    0x0000,0x0000,0x0000,0x0000
  1482. SHAR_EOF
  1483. chmod 0644 pan3.0/pan.icon ||
  1484. echo 'restore of pan3.0/pan.icon failed'
  1485. Wc_c="`wc -c < 'pan3.0/pan.icon'`"
  1486. test 1997 -eq "$Wc_c" ||
  1487.     echo 'pan3.0/pan.icon: original size 1997, current size' "$Wc_c"
  1488. fi
  1489. true || echo 'restore of pan3.0/hidexp.c failed'
  1490. echo End of part 2, continue with part 3
  1491. exit 0
  1492.  
  1493. --
  1494. Jeffrey Bailey
  1495. Racal-Datacom, Inc.
  1496. Mail Stop E-110
  1497. 1601 N. Harrison Parkway                  INET : jeff@rd1.interlan.com
  1498. Sunrise, FL 33323-2899                    UUCP : ...uflorida!novavax!rd1!jeff
  1499.  
  1500. exit 0 # Just in case...
  1501. -- 
  1502.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  1503. \X/  Amiga - The only way to fly! |    sources-x@sterling.com
  1504.  "It's intuitively obvious to the |
  1505.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1506.